index of
/
home
/
thefkyzp
/
hulmvisaadvisor.com
/
wp-content
/
plugins
/
surecart
/
dist
/
File: /home/thefkyzp/hulmvisaadvisor.com/wp-content/plugins/surecart/dist/9829.js
"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[9829],{448:function(e,t,r){r.d(t,{a:function(){return d},b:function(){return s},g:function(){return l}});var n=r(4942),o=r(885);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function s(e){for(var t,r="",n=Object.entries(e);t=n.shift();){var i=t,a=(0,o.Z)(i,2),u=a[0],s=a[1];if(Array.isArray(s)||s&&s.constructor===Object){var l,d=c(Object.entries(s).reverse());try{for(d.s();!(l=d.n()).done;){var f=(0,o.Z)(l.value,2),p=f[0],h=f[1];n.unshift(["".concat(u,"[").concat(p,"]"),h])}}catch(e){d.e(e)}finally{d.f()}}else void 0!==s&&(null===s&&(s=""),r+="&"+[u,s].map(encodeURIComponent).join("="))}return r.substr(1)}function l(e){return(function(e){var t;try{t=new URL(e,"http://example.com").search.substring(1)}catch(e){}if(t)return t}(e)||"").replace(/\+/g,"%20").split("&").reduce((function(e,t){var r=t.split("=").filter(Boolean).map(decodeURIComponent),n=(0,o.Z)(r,2),i=n[0],c=n[1],u=void 0===c?"":c;return i&&function(e,t,r){for(var n=t.length,o=n-1,i=0;i<n;i++){var c=t[i];!c&&Array.isArray(e)&&(c=e.length.toString());var u=!isNaN(Number(t[i+1]));e[c]=i===o?r:e[c]||(u?[]:{}),Array.isArray(e[c])&&!u&&(e[c]=a({},e[c])),e=e[c]}}(e,i.replace(/\]/g,"").split("["),u),e}),{})}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!t||!Object.keys(t).length)return e;var r=e,n=e.indexOf("?");return-1!==n&&(t=Object.assign(l(e),t),r=r.substr(0,n)),r+"?"+s(t)}},930:function(e,t,r){r.d(t,{a:function(){return G},h:function(){return $}});var n=r(5861),o=r(5987),i=r(885),a=r(4942),c=r(1284),u=r.n(c),s=r(448),l=["rest_route"],d=["path","url"],f=["url","path","data","parse"];function p(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){(0,a.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var w=function(e,t){var r,n,o=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(r=e.namespace.replace(/^\/|\/$/g,""),o=(n=e.endpoint.replace(/^\//,""))?r+"/"+n:r),delete e.namespace,delete e.endpoint,t(y(y({},e),{},{path:o}))};function b(e){for(var t,r="",n=Object.entries(e);t=n.shift();){var o=t,a=(0,i.Z)(o,2),c=a[0],u=a[1];if(Array.isArray(u)||u&&u.constructor===Object){var s,l=p(Object.entries(u).reverse());try{for(l.s();!(s=l.n()).done;){var d=(0,i.Z)(s.value,2),f=d[0],h=d[1];n.unshift(["".concat(c,"[").concat(f,"]"),h])}}catch(e){l.e(e)}finally{l.f()}}else void 0!==u&&(null===u&&(u=""),r+="&"+[c,u].map(encodeURIComponent).join("="))}return r.substr(1)}function m(e){return(function(e){var t;try{t=new URL(e,"http://example.com").search.substring(1)}catch(e){}if(t)return t}(e)||"").replace(/\+/g,"%20").split("&").reduce((function(e,t){var r=t.split("=").filter(Boolean).map(decodeURIComponent),n=(0,i.Z)(r,2),o=n[0],a=n[1],c=void 0===a?"":a;return o&&function(e,t,r){for(var n=t.length,o=n-1,i=0;i<n;i++){var a=t[i];!a&&Array.isArray(e)&&(a=e.length.toString()),a=["__proto__","constructor","prototype"].includes(a)?a.toUpperCase():a;var c=!isNaN(Number(t[i+1]));e[a]=i===o?r:e[a]||(c?[]:{}),Array.isArray(e[a])&&!c&&(e[a]=y({},e[a])),e=e[a]}}(e,o.replace(/\]/g,"").split("["),c),e}),Object.create(null))}function g(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!t||!Object.keys(t).length)return e;var r=e,n=e.indexOf("?");return-1!==n&&(t=Object.assign(m(e),t),r=r.substr(0,n)),r+"?"+b(t)}function O(e,t){return void 0!==function(e,t){return m(e)[t]}(e,t)}function j(e){var t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map((function(e){return e.split("=")})).map((function(e){return e.map(decodeURIComponent)})).sort((function(e,t){return e[0].localeCompare(t[0])})).map((function(e){return e.map(encodeURIComponent)})).map((function(e){return e.join("=")})).join("&"):n}function _(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}var P=function(e){return e.json?e.json():Promise.reject(e)},x=function(e){return function(e){if(!e)return{};var t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}}(e.headers.get("link")).next},k=function(e){var t=!!e.path&&-1!==e.path.indexOf("per_page=-1"),r=!!e.url&&-1!==e.url.indexOf("per_page=-1");return t||r},A=function(){var e=(0,n.Z)(u().mark((function e(t,r){var n,i,a,c,s,l;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==t.parse){e.next=2;break}return e.abrupt("return",r(t));case 2:if(k(t)){e.next=4;break}return e.abrupt("return",r(t));case 4:return e.next=6,G(y(y({},(f={per_page:100},void 0,void 0,p=(u=t).path,h=u.url,y(y({},(0,o.Z)(u,d)),{},{url:h&&g(h,f),path:p&&g(p,f)}))),{},{parse:!1}));case 6:return n=e.sent,e.next=9,P(n);case 9:if(i=e.sent,Array.isArray(i)){e.next=12;break}return e.abrupt("return",i);case 12:if(a=x(n)){e.next=15;break}return e.abrupt("return",i);case 15:c=[].concat(i);case 16:if(!a){e.next=27;break}return e.next=19,G(y(y({},t),{},{path:void 0,url:a,parse:!1}));case 19:return s=e.sent,e.next=22,P(s);case 22:l=e.sent,c=c.concat(l),a=x(s),e.next=16;break;case 27:return e.abrupt("return",c);case 28:case"end":return e.stop()}var u,f,p,h}),e)})));return function(_x,t){return e.apply(this,arguments)}}(),E=new Set(["PATCH","PUT","DELETE"]),S=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t?204===e.status?null:e.json?e.json():Promise.reject(e):e},I=function(e){var t={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch((function(){throw t}))},T=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Promise.resolve(S(e,t)).catch((function(e){return Z(e,t)}))};function Z(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!t)throw e;return I(e).then((function(e){var t={code:"unknown_error",message:wp.i18n.__("An unknown error occurred.")};throw e||t}))}var D,U,C,M,R,N,L,B={Accept:"application/json, */*;q=0.1"},q={credentials:"include"},J=[function(e,t){return"string"!=typeof e.url||O(e.url,"_locale")||(e.url=g(e.url,{_locale:"user"})),"string"!=typeof e.path||O(e.path,"_locale")||(e.path=g(e.path,{_locale:"user"})),t(e)},w,function(e,t){var r=e.method,n=void 0===r?"GET":r;return E.has(n.toUpperCase())&&(e=y(y({},e),{},{headers:y(y({},e.headers),{},{"X-HTTP-Method-Override":n,"Content-Type":"application/json"}),method:"POST"})),t(e)},A],H=function(e){if(e.status>=200&&e.status<300)return e;throw e},F=function(e){var t=e.url,r=e.path,n=e.data,i=e.parse,a=void 0===i||i,c=(0,o.Z)(e,f),u=e.body,s=e.headers;return s=y(y({},B),s),n&&(u=JSON.stringify(n),s["Content-Type"]="application/json"),window.fetch(t||r||window.location.href,y(y(y({},q),c),{},{body:u,headers:s})).then((function(e){return Promise.resolve(e).then(H).catch((function(e){return Z(e,a)})).then((function(e){return T(e,a)}))}),(function(e){if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:wp.i18n.__("You are probably offline.")}}))};function G(e){return J.reduceRight((function(e,t){return function(r){return t(r,e)}}),F)(e).catch((function(t){return"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(G.nonceEndpoint).then(H).then((function(e){return e.text()})).then((function(t){return G.nonceMiddleware.nonce=t,G(e)}))}))}G.use=function(e){J.unshift(e)},G.setFetchHandler=function(e){F=e},G.createNonceMiddleware=function(e){var t=function e(t,r){var n=t.headers,o=void 0===n?{}:n;for(var i in o)if("x-wp-nonce"===i.toLowerCase()&&o[i]===e.nonce)return r(t);return r(y(y({},t),{},{headers:y(y({},o),{},{"X-WP-Nonce":e.nonce})}))};return t.nonce=e,t},G.createPreloadingMiddleware=function(e){var t=Object.fromEntries(Object.entries(e).map((function(e){var t=(0,i.Z)(e,2),r=t[0],n=t[1];return[j(r),n]})));return function(e,r){var n=e.parse,i=void 0===n||n,a=e.path;if(!a&&e.url){var c=m(e.url),u=c.rest_route,s=(0,o.Z)(c,l);"string"==typeof u&&(a=g(u,s))}if("string"!=typeof a)return r(e);var d=e.method||"GET",f=j(a);if("GET"===d&&t[f]){var p=t[f];return delete t[f],_(p,!!i)}if("OPTIONS"===d&&t[d]&&t[d][f]){var h=t[d][f];return delete t[d][f],_(h,!!i)}return r(e)}},G.createRootURLMiddleware=function(e){return function(t,r){return w(t,(function(t){var n,o=t.url,i=t.path;return"string"==typeof i&&(n=e,-1!==e.indexOf("?")&&(i=i.replace("?","&")),i=i.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(i=i.replace("?","&")),o=n+i),r(y(y({},t),{},{url:o}))}))}},G.fetchAllMiddleware=A,G.mediaUploadMiddleware=function(e,t){if(!function(e){var t=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&t}(e))return t(e);var r=0,n=function e(n){return r++,t({path:"/wp/v2/media/".concat(n,"/post-process"),method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((function(){return r<5?e(n):(t({path:"/wp/v2/media/".concat(n,"?force=true"),method:"DELETE"}),Promise.reject())}))};return t(y(y({},e),{},{parse:!1})).catch((function(t){var r=t.headers.get("x-wp-upload-attachment-id");return t.status>=500&&t.status<600&&r?n(r).catch((function(){return!1!==e.parse?Promise.reject({code:"post_process",message:wp.i18n.__("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(t)})):Z(t,e.parse)})).then((function(t){return T(t,e.parse)}))},G.fetchAllMiddleware=null,G.use(G.createRootURLMiddleware((null===(U=null===(D=null===window||void 0===window?void 0:window.parent)||void 0===D?void 0:D.scData)||void 0===U?void 0:U.root_url)||(null===(C=null===window||void 0===window?void 0:window.scData)||void 0===C?void 0:C.root_url))),(null===(M=null===window||void 0===window?void 0:window.scData)||void 0===M?void 0:M.nonce)&&(G.nonceMiddleware=G.createNonceMiddleware(null===(R=null===window||void 0===window?void 0:window.scData)||void 0===R?void 0:R.nonce),G.use(G.nonceMiddleware)),(null===(N=null===window||void 0===window?void 0:window.scData)||void 0===N?void 0:N.nonce_endpoint)&&(G.nonceEndpoint=null===(L=null===window||void 0===window?void 0:window.scData)||void 0===L?void 0:L.nonce_endpoint),G.use((function(e,t){return e.path=(0,s.a)(e.path,{t:Date.now()}),t(e)}));var K=function(e){var t={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.","surecart")};if((null==e?void 0:e.code)&&(null==e?void 0:e.message))throw e;if(!e||!e.json)throw t;return e.json().catch((function(){throw t}))},$=function(){var e=(0,n.Z)(u().mark((function e(t){var r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,K(t);case 2:if("rest_cookie_invalid_nonce"===(r=e.sent).code){e.next=5;break}throw r;case 5:return e.abrupt("return",window.fetch(G.nonceEndpoint).then((function(e){if(e.status>=200&&e.status<300)return e;throw e})).then((function(e){return e.text()})).then((function(e){G.nonceMiddleware.nonce=e})));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},3400:function(e,t,r){r.d(t,{g:function(){return f},l:function(){return u}});var n=r(4942),o=r(1002);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){(0,n.Z)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){void 0===t&&(t={});var r=document.createElement("script");return r.src=e,Object.keys(t).forEach((function(e){r.setAttribute(e,t[e]),"data-csp-nonce"===e&&r.setAttribute("nonce",t["data-csp-nonce"])})),r}function u(e,t){if(void 0===t&&(t=s()),d(e,t),"undefined"==typeof window)return t.resolve(null);var r=function(e){var t="https://www.paypal.com/sdk/js";e.sdkBaseURL&&(t=e.sdkBaseURL,delete e.sdkBaseURL),function(e){var t=e["merchant-id"],r=e["data-merchant-id"],n="",o="";Array.isArray(t)?t.length>1?(n="*",o=t.toString()):n=t.toString():"string"==typeof t&&t.length>0?n=t:"string"==typeof r&&r.length>0&&(n="*",o=r),e["merchant-id"]=n,e["data-merchant-id"]=o}(e);var r,n,o=Object.keys(e).filter((function(t){return void 0!==e[t]&&null!==e[t]&&""!==e[t]})).reduce((function(t,r){var n=e[r].toString();return"data-"===r.substring(0,5)?t.dataAttributes[r]=n:t.queryParams[r]=n,t}),{queryParams:{},dataAttributes:{}}),i=o.queryParams,a=o.dataAttributes;return{url:"".concat(t,"?").concat((r=i,n="",Object.keys(r).forEach((function(e){0!==n.length&&(n+="&"),n+=e+"="+r[e]})),n)),dataAttributes:a}}(e),n=r.url,i=r.dataAttributes,a=i["data-namespace"]||"paypal",u=l(a);return function(e,t){var r=document.querySelector('script[src="'.concat(e,'"]'));if(null===r)return null;var n=c(e,t),o=r.cloneNode();if(delete o.dataset.uidAuto,Object.keys(o.dataset).length!==Object.keys(n.dataset).length)return null;var i=!0;return Object.keys(o.dataset).forEach((function(e){o.dataset[e]!==n.dataset[e]&&(i=!1)})),i?r:null}(n,i)&&u?t.resolve(u):function(e,t){void 0===t&&(t=s()),d(e,t);var r=e.url,n=e.attributes;if("string"!=typeof r||0===r.length)throw new Error("Invalid url.");if(void 0!==n&&"object"!==(0,o.Z)(n))throw new Error("Expected attributes to be an object.");return new t((function(e,t){if("undefined"==typeof window)return e();!function(e){var t=e.onSuccess,r=e.onError,n=c(e.url,e.attributes);n.onerror=r,n.onload=t,document.head.insertBefore(n,document.head.firstElementChild)}({url:r,attributes:n,onSuccess:function(){return e()},onError:function(){var e=new Error('The script "'.concat(r,'" failed to load.'));return window.fetch?fetch(r).then((function(r){return 200===r.status&&t(e),r.text()})).then((function(e){var r=function(e){var t=e.split("/* Original Error:")[1];return t?t.replace(/\n/g,"").replace("*/","").trim():e}(e);t(new Error(r))})).catch((function(e){t(e)})):t(e)}})}))}({url:n,attributes:i},t).then((function(){var e=l(a);if(e)return e;throw new Error("The window.".concat(a," global variable is not available."))}))}function s(){if("undefined"==typeof Promise)throw new Error("Promise is undefined. To resolve the issue, use a Promise polyfill.");return Promise}function l(e){return window[e]}function d(e,t){if("object"!==(0,o.Z)(e)||null===e)throw new Error("Expected an options object.");if(void 0!==t&&"function"!=typeof t)throw new Error("Expected PromisePonyfill to be a function.")}var f=function(e){var t=e.clientId,r=e.reusable,n=e.merchantId,o=e.currency,i=void 0===o?"usd":o,c=e.merchantInitiated;return a(a({"client-id":t.replace(/ /g,"")},!r||c?{"merchant-id":n.replace(/ /g,"")}:{}),{},{commit:!1,intent:r?"tokenize":"capture",vault:!0,currency:i?i.toUpperCase():"USD"})}},9829:function(e,t,r){r.r(t),r.d(t,{sc_paypal_add_method:function(){return d}});var n=r(5861),o=r(5671),i=r(3144),a=r(1284),c=r.n(a),u=r(8860),s=r(3400),l=r(930),d=function(){function e(t){(0,o.Z)(this,e),(0,u.r)(this,t),this.liveMode=!0,this.customerId=void 0,this.successUrl=void 0,this.currency=void 0,this.loading=void 0,this.loaded=void 0,this.error=void 0,this.paymentIntent=void 0}var t,r;return(0,i.Z)(e,[{key:"componentWillLoad",value:function(){this.createPaymentIntent()}},{key:"handlePaymentIntentCreate",value:(r=(0,n.Z)(c().mark((function e(){var t,r,o,i,a,u,d,f,p=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this.paymentIntent||{},i=o.external_intent_id,a=(null===(r=null===(t=this.paymentIntent)||void 0===t?void 0:t.processor_data)||void 0===r?void 0:r.paypal)||{},u=a.client_id,d=a.account_id,f=a.merchant_initiated,u&&d&&i){e.next=4;break}return e.abrupt("return");case 4:if(this.paypal){e.next=16;break}return e.prev=5,e.next=8,(0,s.l)((0,s.g)({clientId:u,merchantId:d,merchantInitiated:f,reusable:!0}));case 8:this.paypal=e.sent,this.paypal.Buttons({onInit:function(){p.loaded=!0},createBillingAgreement:function(){return new Promise((function(e){return e(i)}))},onApprove:function(){var e=(0,n.Z)(c().mark((function e(){var t,r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,p.loading=!0,e.next=4,(0,l.a)({method:"PATCH",path:"surecart/v1/payment_intents/".concat(null===(t=p.paymentIntent)||void 0===t?void 0:t.id,"/capture")});case 4:if(r=e.sent,!["succeeded","pending","requires_approval"].includes(null==r?void 0:r.status)){e.next=9;break}window.location.assign(p.successUrl),e.next=10;break;case 9:throw{message:wp.i18n.__("The payment did not process. Please try again.","surecart")};case 10:e.next=17;break;case 12:e.prev=12,e.t0=e.catch(0),console.error(e.t0),p.error=(null===e.t0||void 0===e.t0?void 0:e.t0.message)||wp.i18n.__("The payment did not process. Please try again.","surecart"),p.loading=!1;case 17:case"end":return e.stop()}}),e,null,[[0,12]])})));return function(){return e.apply(this,arguments)}}(),onError:function(e){console.error(e),alert((null==e?void 0:e.message)||wp.i18n.__("The payment did not process. Please try again.","surecart"))}}).render(this.container),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(5),console.error("Failed to load the PayPal JS SDK script",e.t0),this.error=wp.i18n.__("Failed to load the PayPal JS SDK script","surecart");case 16:case"end":return e.stop()}}),e,this,[[5,12]])}))),function(){return r.apply(this,arguments)})},{key:"createPaymentIntent",value:(t=(0,n.Z)(c().mark((function e(){var t,r;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.loading=!0,this.error="",e.next=5,(0,l.a)({method:"POST",path:"surecart/v1/payment_intents",data:{processor_type:"paypal",reusable:!0,live_mode:this.liveMode,customer_id:this.customerId,currency:this.currency,refresh_status:!0}});case 5:this.paymentIntent=e.sent,e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.error=(null===(r=null===(t=null===e.t0||void 0===e.t0?void 0:e.t0.additional_errors)||void 0===t?void 0:t[0])||void 0===r?void 0:r.message)||(null===e.t0||void 0===e.t0?void 0:e.t0.message)||wp.i18n.__("Something went wrong","surecart");case 11:return e.prev=11,this.loading=!1,e.finish(11);case 14:case"end":return e.stop()}}),e,this,[[0,8,11,14]])}))),function(){return t.apply(this,arguments)})},{key:"render",value:function(){var e=this;return(0,u.h)(u.H,null,this.error&&(0,u.h)("sc-alert",{open:!!this.error,type:"danger"},(0,u.h)("span",{slot:"title"},wp.i18n.__("Error","surecart")),this.error),(0,u.h)("div",{class:"sc-paypal-button-container",hidden:!this.loaded,ref:function(t){return e.container=t}}))}}],[{key:"watchers",get:function(){return{paymentIntent:["handlePaymentIntentCreate"]}}}]),e}();d.style=':host{display:block}.paypal-buttons{position:relative;line-height:0;text-align:center}.paypal-buttons:after{content:" ";border-bottom:1px solid var(--sc-input-border-color);width:100%;height:0;top:50%;left:0;right:0;position:absolute}'},4942:function(e,t,r){function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,{Z:function(){return n}})},5987:function(e,t,r){r.d(t,{Z:function(){return o}});var n=r(3366);function o(e,t){if(null==e)return{};var r,o,i=(0,n.Z)(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}},3366:function(e,t,r){function n(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}r.d(t,{Z:function(){return n}})}}]);