← Back
Editing: ppcp-axo-js-boot.js
(()=>{"use strict";const e={n:t=>{const n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},cw:e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},d:(t,n)=>{for(var r in n)e.o(n,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.hasOwn(e,t)};var t=e.cw(function(e,t){var n=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===r}(e)}(e)},r="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?s((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map(function(e){return i(e,n)})}function a(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function c(e,t){try{return t in e}catch(e){return!1}}function s(e,t,r){(r=r||{}).arrayMerge=r.arrayMerge||o,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=i;var l=Array.isArray(t);return l===Array.isArray(e)?l?r.arrayMerge(e,t,r):function(e,t,n){var r={};return n.isMergeableObject(e)&&a(e).forEach(function(t){r[t]=i(e[t],n)}),a(t).forEach(function(o){(function(e,t){return c(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(c(e,o)&&n.isMergeableObject(t[o])?r[o]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(o,n)(e[o],t[o],n):r[o]=i(t[o],n))}),r}(e,t,r):i(t,r)}s.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return s(e,n,t)},{})};var l=s;e.exports=l}),n=e.cw(function(e,t){var n=/["'&<>]/;e.exports=function(e){var t,r=""+e,i=n.exec(r);if(!i)return r;var o="",a=0,c=0;for(a=i.index;a<r.length;a++){switch(r.charCodeAt(a)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}c!==a&&(o+=r.substring(c,a)),c=a+1,o+=t}return c!==a?o+r.substring(c,a):o}});function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function a(e,t,n){return(t=function(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var c=r&&r.prototype instanceof l?r:l,u=Object.create(c.prototype);return s(u,"_invoke",function(n,r,i){var o,c,s,l=0,u=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,c=0,s=e,p.n=n,a}};function d(n,r){for(c=n,s=r,t=0;!f&&l&&!i&&t<u.length;t++){var i,o=u[t],d=p.p,h=o[2];n>3?(i=h===r)&&(s=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(c=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,c=0))}if(i||n>1)return a;throw f=!0,r}return function(i,u,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===u&&d(u,h),c=u,s=h;(t=c<2?e:s)||!f;){o||(c?c<3?(c>1&&(p.n=-1),d(c,s)):p.n=s:p.v=s);try{if(l=2,o){if(c||(i="next"),t=o[i]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=o.return)&&t.call(o),c<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),c=1);o=e}else if((t=(f=p.n<0)?s:n.call(r,p))!==a)break}catch(t){o=e,c=1,s=t}finally{l=1}}return{value:t,done:f}}}(n,i,o),!0),u}var a={};function l(){}function u(){}function f(){}t=Object.getPrototypeOf;var p=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),d=f.prototype=l.prototype=Object.create(p);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,s(e,i,"GeneratorFunction")),e.prototype=Object.create(d),e}return u.prototype=f,s(d,"constructor",f),s(f,"constructor",u),u.displayName="GeneratorFunction",s(f,i,"GeneratorFunction"),s(d),s(d,i,"Generator"),s(d,r,function(){return this}),s(d,"toString",function(){return"[object Generator]"}),(c=function(){return{w:o,m:h}})()}function s(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}s=function(e,t,n,r){function o(t,n){s(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},s(e,t,n,r)}function l(e,t,n,r,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,i)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){l(o,r,i,a,c,"next",e)}function c(e){l(o,r,i,a,c,"throw",e)}a(void 0)})}}function f(_x){return p.apply(this,arguments)}function p(){return(p=u(c().m(function e(t){var n,r;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=null,e.p=1,e.n=2,t.json();case 2:n=e.v,e.n=4;break;case 3:e.p=3,e.v;case 4:if(!n){e.n=5;break}return e.a(2,n);case 5:throw(r=new Error("Endpoint returned no usable JSON (HTTP ".concat(t.status,")."))).status=t.status,r;case 6:return e.a(2)}},e,null,[[1,3]])}))).apply(this,arguments)}function d(e){return h.apply(this,arguments)}function h(){return h=u(c().m(function e(t){var n,r,i,a,s,l,u,p,d,h,m=arguments;return c().w(function(e){for(;;)switch(e.n){case 0:return n=t.endpoint,r=t.nonce,i=m.length>1&&void 0!==m[1]?m[1]:{},e.n=1,fetch(n,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(o({nonce:r},i))});case 1:return a=e.v,e.n=2,f(a);case 2:if((s=e.v).success){e.n=3;break}throw(h=new Error((null===(l=s.data)||void 0===l?void 0:l.message)||"")).isUserFacing=Boolean(null===(u=s.data)||void 0===u?void 0:u.message),h.errors=null===(p=s.data)||void 0===p?void 0:p.errors,h.refresh=Boolean(null===(d=s.data)||void 0===d?void 0:d.refresh),h.status=a.status,h;case 3:return e.a(2,s.data)}},e)})),h.apply(this,arguments)}var m=["locale"];function y(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var s=r&&r.prototype instanceof c?r:c,l=Object.create(s.prototype);return v(l,"_invoke",function(n,r,i){var o,c,s,l=0,u=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,c=0,s=e,p.n=n,a}};function d(n,r){for(c=n,s=r,t=0;!f&&l&&!i&&t<u.length;t++){var i,o=u[t],d=p.p,h=o[2];n>3?(i=h===r)&&(s=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(c=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,c=0))}if(i||n>1)return a;throw f=!0,r}return function(i,u,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===u&&d(u,h),c=u,s=h;(t=c<2?e:s)||!f;){o||(c?c<3?(c>1&&(p.n=-1),d(c,s)):p.n=s:p.v=s);try{if(l=2,o){if(c||(i="next"),t=o[i]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=o.return)&&t.call(o),c<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),c=1);o=e}else if((t=(f=p.n<0)?s:n.call(r,p))!==a)break}catch(t){o=e,c=1,s=t}finally{l=1}}return{value:t,done:f}}}(n,i,o),!0),l}var a={};function c(){}function s(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(v(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,v(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,v(f,"constructor",l),v(l,"constructor",s),s.displayName="GeneratorFunction",v(l,i,"GeneratorFunction"),v(f),v(f,i,"Generator"),v(f,r,function(){return this}),v(f,"toString",function(){return"[object Generator]"}),(y=function(){return{w:o,m:p}})()}function v(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}v=function(e,t,n,r){function o(t,n){v(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},v(e,t,n,r)}function b(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function g(e,t,n,r,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,i)}function w(_x,e){return S.apply(this,arguments)}function S(){var e;return e=y().m(function e(t,n){var r,i,o;return y().w(function(e){for(;;)switch(e.p=e.n){case 0:if(r=n.locale,i=b(n,m),!r){e.n=4;break}return e.p=1,e.n=2,t.createInstance(n);case 2:return e.a(2,e.v);case 3:if(e.p=3,"ERR_DEV_UNSUPPORTED_LOCALE"===(null==(o=e.v)?void 0:o.code)){e.n=4;break}throw o;case 4:return e.a(2,t.createInstance(i))}},e,null,[[1,3]])}),S=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){g(o,r,i,a,c,"next",e)}function c(e){g(o,r,i,a,c,"throw",e)}a(void 0)})},S.apply(this,arguments)}var k="__ppcpV6ScriptPromises";function P(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window,n=function(e){return e[k]||(e[k]={}),e[k]}(t);return n[e]||(n[e]=new Promise(function(r,i){var o=t.document.createElement("script");o.src=e,o.async=!0,o.onload=r,o.onerror=function(){o.remove(),delete n[e],i(new Error("Failed to load script: ".concat(e)))},t.document.head.appendChild(o)})),n[e]}function O(e){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(e)}function _(e,t,n){return(t=function(e){var t=function(e){if("object"!=O(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=O(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==O(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var j=_(_({},"googlepay",{configKey:"google_pay",sdkComponent:"googlepay-payments",gatewayId:"ppcp-googlepay"}),"applepay",{configKey:"apple_pay",sdkComponent:"applepay-payments",gatewayId:"ppcp-applepay",fundingSource:"apple_pay"}),E=Object.keys(j);function C(e){return E.filter(function(t){return function(e,t){var n;return!(null===(n=function(e,t){var n=j[t];return n?e[n.configKey]:void 0}(e,t))||void 0===n||!n.enabled)}(e,t)}).map(function(e){return j[e].sdkComponent})}function x(e){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(e)}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function F(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var s=r&&r.prototype instanceof c?r:c,l=Object.create(s.prototype);return T(l,"_invoke",function(n,r,i){var o,c,s,l=0,u=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,c=0,s=e,p.n=n,a}};function d(n,r){for(c=n,s=r,t=0;!f&&l&&!i&&t<u.length;t++){var i,o=u[t],d=p.p,h=o[2];n>3?(i=h===r)&&(s=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(c=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,c=0))}if(i||n>1)return a;throw f=!0,r}return function(i,u,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===u&&d(u,h),c=u,s=h;(t=c<2?e:s)||!f;){o||(c?c<3?(c>1&&(p.n=-1),d(c,s)):p.n=s:p.v=s);try{if(l=2,o){if(c||(i="next"),t=o[i]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=o.return)&&t.call(o),c<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),c=1);o=e}else if((t=(f=p.n<0)?s:n.call(r,p))!==a)break}catch(t){o=e,c=1,s=t}finally{l=1}}return{value:t,done:f}}}(n,i,o),!0),l}var a={};function c(){}function s(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(T(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,T(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,T(f,"constructor",l),T(l,"constructor",s),s.displayName="GeneratorFunction",T(l,i,"GeneratorFunction"),T(f),T(f,i,"Generator"),T(f,r,function(){return this}),T(f,"toString",function(){return"[object Generator]"}),(F=function(){return{w:o,m:p}})()}function T(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}T=function(e,t,n,r){function o(t,n){T(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},T(e,t,n,r)}function I(e,t,n,r,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,i)}function D(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,N(r.key),r)}}function N(e){var t=function(e){if("object"!=x(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=x(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==x(t)?t:t+""}var B="__ppcpV6TokenRefresh",L=function(){return t=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.listeners=[],this.timer=null,this.refreshAt=0,this.retryIn=void 0,this.refreshing=!1,this.busy=!1,this.pendingInstance=null,this.renewInstance=null},n=[{key:"start",value:function(e,t){var n=this;this.renewInstance=e,document.addEventListener("visibilitychange",function(){"visible"===document.visibilityState&&n.refreshAt&&Date.now()>=n.refreshAt&&n.refresh()}),this.planNextRefresh(t)}},{key:"subscribe",value:function(e){var t=this;return this.listeners.push(e),function(){var n=t.listeners.indexOf(e);n>=0&&t.listeners.splice(n,1)}}},{key:"setBusy",value:function(e){if(this.busy=Boolean(e),!this.busy&&this.pendingInstance){var t=this.pendingInstance;this.pendingInstance=null,this.notify(t)}}},{key:"planNextRefresh",value:function(e){this.retryIn=e.retry_in,this.scheduleRefresh(e.refresh_in)}},{key:"scheduleRefresh",value:function(e){var t=this;if(Number.isFinite(e)){var n=1e3*e;clearTimeout(this.timer),this.refreshAt=Date.now()+n,this.timer=setTimeout(function(){return t.refresh()},n)}}},{key:"refresh",value:(e=F().m(function e(){var t,n,r,i;return F().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!this.refreshing){e.n=1;break}return e.a(2);case 1:return this.refreshing=!0,e.p=2,e.n=3,this.renewInstance();case 3:t=e.v,n=t.sdkInstance,r=t.tokenData,this.planNextRefresh(r),this.busy?this.pendingInstance=n:this.notify(n),e.n=5;break;case 4:e.p=4,i=e.v,console.error("[PPCP SDK v6] Client token refresh failed",i),this.scheduleRefresh(this.retryIn);case 5:return e.p=5,this.refreshing=!1,e.f(5);case 6:return e.a(2)}},e,this,[[2,4,5,6]])}),r=function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){I(o,r,i,a,c,"next",e)}function c(e){I(o,r,i,a,c,"throw",e)}a(void 0)})},function(){return r.apply(this,arguments)})},{key:"notify",value:function(e){(function(e){return function(e){if(Array.isArray(e))return A(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return A(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()})(this.listeners).forEach(function(t){try{t(e)}catch(e){console.error("[PPCP SDK v6]",e)}})}}],n&&D(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var e,t,n,r}();function M(e){return M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M(e)}function G(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var s=r&&r.prototype instanceof c?r:c,l=Object.create(s.prototype);return V(l,"_invoke",function(n,r,i){var o,c,s,l=0,u=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,c=0,s=e,p.n=n,a}};function d(n,r){for(c=n,s=r,t=0;!f&&l&&!i&&t<u.length;t++){var i,o=u[t],d=p.p,h=o[2];n>3?(i=h===r)&&(s=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(c=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,c=0))}if(i||n>1)return a;throw f=!0,r}return function(i,u,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===u&&d(u,h),c=u,s=h;(t=c<2?e:s)||!f;){o||(c?c<3?(c>1&&(p.n=-1),d(c,s)):p.n=s:p.v=s);try{if(l=2,o){if(c||(i="next"),t=o[i]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=o.return)&&t.call(o),c<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),c=1);o=e}else if((t=(f=p.n<0)?s:n.call(r,p))!==a)break}catch(t){o=e,c=1,s=t}finally{l=1}}return{value:t,done:f}}}(n,i,o),!0),l}var a={};function c(){}function s(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(V(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,V(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,V(f,"constructor",l),V(l,"constructor",s),s.displayName="GeneratorFunction",V(l,i,"GeneratorFunction"),V(f),V(f,i,"Generator"),V(f,r,function(){return this}),V(f,"toString",function(){return"[object Generator]"}),(G=function(){return{w:o,m:p}})()}function V(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}V=function(e,t,n,r){function o(t,n){V(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},V(e,t,n,r)}function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach(function(t){R(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function R(e,t,n){return(t=function(e){var t=function(e){if("object"!=M(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==M(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $(e){return function(e){if(Array.isArray(e))return H(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||z(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||z(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e,t){if(e){if("string"==typeof e)return H(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H(e,t):void 0}}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Q(e,t,n,r,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,i)}function K(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Q(o,r,i,a,c,"next",e)}function c(e){Q(o,r,i,a,c,"throw",e)}a(void 0)})}}var J="__ppcpV6InstancePromise",X="__ppcpV6ClientMetadataId";function Z(){return window[J]||null}function Y(){var e,t;return window[X]||(window[X]=(null===(e=window.crypto)||void 0===e||null===(t=e.randomUUID)||void 0===t?void 0:t.call(e))||"ppcp-".concat(Date.now(),"-").concat(Math.random().toString(16).slice(2))),window[X]}var ee={product:"product-details",cart:"cart",checkout:"checkout","pay-now":"checkout","mini-cart":"mini-cart","cart-block":"cart","checkout-block":"checkout"};function te(e,t){var n,r,i,o;return Z()||(window[J]=(n=function(_x,e){return ne.apply(this,arguments)}(e,t),i=new Error("PayPal SDK v6 did not load within ".concat(15e3," ms.")),o=new Promise(function(e,t){r=setTimeout(function(){return t(i)},15e3)}),Promise.race([n,o]).finally(function(){return clearTimeout(r)})).then(function(e){var t=e.sdkInstance,n=e.tokenData;return function(e,t){(window[B]||(window[B]=new L),window[B]).start(e,t)}(e.renewInstance,n),document.dispatchEvent(new CustomEvent("ppcp-sdk-v6-ready",{detail:{sdkInstance:t}})),t}).catch(function(e){throw delete window[J],e})),Z()}function ne(){return ne=K(G().m(function e(t,n){var r,i,o,a,c,s,l,u,f,p,h;return G().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Promise.all([P(t.sdk_url),d(t.ajax.client_token)]);case 1:if(s=e.v,l=U(s,2),u=l[1],null!==(r=window.paypal)&&void 0!==r&&r.createInstance){e.n=2;break}throw new Error("PayPal SDK v6 global not found after script load.");case 2:return f=["paypal-payments"],Object.values(t.venmo_button||{}).some(Boolean)&&f.push("venmo-payments"),null!==(i=t.card_fields)&&void 0!==i&&i.enabled&&f.push("card-fields"),null!==(o=t.card_button)&&void 0!==o&&o.row&&f.push("paypal-guest-payments"),null!==(a=t.fastlane)&&void 0!==a&&a.enabled&&f.push("fastlane"),f.push.apply(f,$(C(t))),null!==(c=t.messages)&&void 0!==c&&c.enabled&&f.push("paypal-messages"),p={clientToken:u.client_token,components:f,pageType:ee[n]||"checkout",locale:t.locale,clientMetadataId:Y()},e.n=3,w(window.paypal,p);case 3:return h=e.v,e.a(2,{sdkInstance:h,tokenData:u,renewInstance:function(){var e=K(G().m(function e(){var n,r;return G().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,d(t.ajax.client_token);case 1:return n=e.v,e.n=2,w(window.paypal,W(W({},p),{},{clientToken:n.client_token}));case 2:return r=e.v,window[J]=Promise.resolve(r),e.a(2,{sdkInstance:r,tokenData:n})}},e)}));return function(){return e.apply(this,arguments)}}()})}},e)})),ne.apply(this,arguments)}function re(){var e,t,n,r=window.wc_ppcp_sdk_v6?window.wc_ppcp_sdk_v6:((null===(t=window.wc)||void 0===t||null===(t=t.wcSettings)||void 0===t||null===(n=t.getSetting)||void 0===n?void 0:n.call(t,"paymentMethodData"))||{})["ppcp-sdk-v6"]||null;return null!=r&&null!==(e=r.fastlane)&&void 0!==e&&e.enabled?r:null}function ie(e){return ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ie(e)}function oe(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var s=r&&r.prototype instanceof c?r:c,l=Object.create(s.prototype);return ae(l,"_invoke",function(n,r,i){var o,c,s,l=0,u=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,c=0,s=e,p.n=n,a}};function d(n,r){for(c=n,s=r,t=0;!f&&l&&!i&&t<u.length;t++){var i,o=u[t],d=p.p,h=o[2];n>3?(i=h===r)&&(s=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(c=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,c=0))}if(i||n>1)return a;throw f=!0,r}return function(i,u,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===u&&d(u,h),c=u,s=h;(t=c<2?e:s)||!f;){o||(c?c<3?(c>1&&(p.n=-1),d(c,s)):p.n=s:p.v=s);try{if(l=2,o){if(c||(i="next"),t=o[i]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=o.return)&&t.call(o),c<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),c=1);o=e}else if((t=(f=p.n<0)?s:n.call(r,p))!==a)break}catch(t){o=e,c=1,s=t}finally{l=1}}return{value:t,done:f}}}(n,i,o),!0),l}var a={};function c(){}function s(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(ae(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,ae(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,ae(f,"constructor",l),ae(l,"constructor",s),s.displayName="GeneratorFunction",ae(l,i,"GeneratorFunction"),ae(f),ae(f,i,"Generator"),ae(f,r,function(){return this}),ae(f,"toString",function(){return"[object Generator]"}),(oe=function(){return{w:o,m:p}})()}function ae(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}ae=function(e,t,n,r){function o(t,n){ae(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},ae(e,t,n,r)}function ce(e,t,n,r,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,i)}function se(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,le(r.key),r)}}function le(e){var t=function(e){if("object"!=ie(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ie(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ie(t)?t:t+""}var ue=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.namespace=t,this.connection=null,this.identity=null,this.profile=null,this.FastlaneCardComponent=null,this.FastlanePaymentComponent=null,this.FastlaneWatermarkComponent=null},t=[{key:"connect",value:function(e){var t=re();return t?this.connectV6(t,e):this.connectV5(e)}},{key:"connectV6",value:(n=oe().m(function e(t,n){var r,i;return oe().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,te(t,t.page_context||"checkout");case 1:return r=e.v,i=this,e.n=2,r.createFastlane(n);case 2:i.init.call(i,e.v);case 3:return e.a(2)}},e,this)}),r=function(){var e=this,t=arguments;return new Promise(function(r,i){var o=n.apply(e,t);function a(e){ce(o,r,i,a,c,"next",e)}function c(e){ce(o,r,i,a,c,"throw",e)}a(void 0)})},function(_x,e){return r.apply(this,arguments)})},{key:"connectV5",value:function(e){var t=this;return new Promise(function(n,r){window[t.namespace]?window[t.namespace].Fastlane(e).then(function(e){t.init(e),n()}).catch(function(e){console.error(e),r(e)}):r(new Error("Namespace ".concat(t.namespace," not found on window object")))})}},{key:"init",value:function(e){this.connection=e,this.identity=this.connection.identity,this.profile=this.connection.profile,this.FastlaneCardComponent=this.connection.FastlaneCardComponent,this.FastlanePaymentComponent=this.connection.FastlanePaymentComponent,this.FastlaneWatermarkComponent=this.connection.FastlaneWatermarkComponent}},{key:"setLocale",value:function(e){this.connection.setLocale(e)}}],t&&se(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r}();const fe=ue;function pe(e){var t,n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",o=null===(t=window.wc_ppcp_axo)||void 0===t?void 0:t.wp_debug,a=null===(n=window.wc_ppcp_axo)||void 0===n||null===(n=n.ajax)||void 0===n||null===(n=n.frontend_logger)||void 0===n?void 0:n.endpoint,c=null===(r=window.wc_ppcp_axo)||void 0===r?void 0:r.logging_enabled;if(o)switch(i){case"error":console.error("[AXO] ".concat(e));break;case"warn":console.warn("[AXO] ".concat(e));break;default:console.log("[AXO] ".concat(e))}a&&c&&fetch(a,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:window.wc_ppcp_axo.ajax.frontend_logger.nonce,log:{message:e,level:i}})})}function de(e){return de="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},de(e)}function he(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,me(r.key),r)}}function me(e){var t=function(e){if("object"!=de(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=de(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==de(t)?t:t+""}const ye=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$=jQuery,this.config=t,this.selector=this.config.selector,this.id=this.config.id||null,this.className=this.config.className||null,this.attributes=this.config.attributes||null,this.anchorSelector=this.config.anchorSelector||null},(t=[{key:"trigger",value:function(e){this.$(this.selector).trigger(e)}},{key:"on",value:function(e,t){this.$(document).on(e,this.selector,t)}},{key:"hide",value:function(){this.$(this.selector).hide()}},{key:"show",value:function(){this.$(this.selector).show()}},{key:"click",value:function(){this.get().click()}},{key:"get",value:function(){return document.querySelector(this.selector)}}])&&he(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function ve(e){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ve(e)}function be(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,we(r.key),r)}}function ge(e,t,n){return t&&be(e.prototype,t),n&&be(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function we(e){var t=function(e){if("object"!=ve(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ve(t)?t:t+""}const Se=ge(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.gatewayRadioButton=new ye({selector:"#payment_method_ppcp-axo-gateway"}),this.gatewayDescription=new ye({selector:".payment_box.payment_method_ppcp-axo-gateway"}),this.defaultSubmitButton=new ye({selector:"#place_order"}),this.paymentContainer=new ye({id:"ppcp-axo-payment-container",selector:"#ppcp-axo-payment-container",className:"ppcp-axo-payment-container"}),this.watermarkContainer=new ye({id:"ppcp-axo-watermark-container",selector:"#ppcp-axo-watermark-container",className:"ppcp-axo-watermark-container ppcp-axo-watermark-loading loader"}),this.customerDetails=new ye({selector:"#customer_details > *:not(#ppcp-axo-customer-details)"}),this.axoCustomerDetails=new ye({id:"ppcp-axo-customer-details",selector:"#ppcp-axo-customer-details",className:"ppcp-axo-customer-details",anchorSelector:"#customer_details"}),this.emailWidgetContainer=new ye({id:"ppcp-axo-email-widget",selector:"#ppcp-axo-email-widget",className:"ppcp-axo-email-widget"}),this.shippingAddressContainer=new ye({id:"ppcp-axo-shipping-address-container",selector:"#ppcp-axo-shipping-address-container",className:"ppcp-axo-shipping-address-container"}),this.billingAddressContainer=new ye({id:"ppcp-axo-billing-address-container",selector:"#ppcp-axo-billing-address-container",className:"ppcp-axo-billing-address-container"}),this.fieldBillingEmail=new ye({selector:"#billing_email_field"}),this.billingEmailFieldWrapper=new ye({id:"ppcp-axo-billing-email-field-wrapper",selector:"#ppcp-axo-billing-email-field-wrapper"}),this.billingEmailSubmitButton=new ye({id:"ppcp-axo-billing-email-submit-button",selector:"#ppcp-axo-billing-email-submit-button",className:"ppcp-axo-billing-email-submit-button-hidden button alt wp-element-button wc-block-components-button"}),this.billingEmailSubmitButtonSpinner=new ye({id:"ppcp-axo-billing-email-submit-button-spinner",selector:"#ppcp-axo-billing-email-submit-button-spinner",className:"loader ppcp-axo-overlay"}),this.submitButtonContainer=new ye({selector:"#ppcp-axo-submit-button-container"}),this.submitButton=new ye({selector:"#ppcp-axo-submit-button-container button"}),this.changeShippingAddressLink=new ye({selector:"*[data-ppcp-axo-change-shipping-address]",attributes:"data-ppcp-axo-change-shipping-address"}),this.changeBillingAddressLink=new ye({selector:"*[data-ppcp-axo-change-billing-address]",attributes:"data-ppcp-axo-change-billing-address"}),this.changeCardLink=new ye({selector:"*[data-ppcp-axo-change-card]",attributes:"data-ppcp-axo-change-card"}),this.showGatewaySelectionLink=new ye({selector:"*[data-ppcp-axo-show-gateway-selection]",attributes:"data-ppcp-axo-show-gateway-selection"}),this.axoNonceInput=new ye({id:"ppcp-axo-nonce",selector:"#ppcp-axo-nonce"})});function ke(){return ke.c||(ke.c=e.n(n()))}function Pe(e){return Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pe(e)}function Oe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _e(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Oe(Object(n),!0).forEach(function(t){je(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function je(e,t,n){return(t=Ae(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ce(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ce(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ce(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function xe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ae(r.key),r)}}function Ae(e){var t=function(e){if("object"!=Pe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Pe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pe(t)?t:t+""}function Fe(e,t,n){Te(e,t),t.set(e,n)}function Te(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ie(e,t){return e.get(Ne(e,t))}function De(e,t,n){return e.set(Ne(e,t),n),n}function Ne(e,t,n){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}n();var Be=new WeakMap,Le=new WeakMap,Me=new WeakMap,Ge=new WeakMap,Ve=new WeakMap,qe=new WeakMap,We=new WeakMap,Re=new WeakSet,$e=function(){return e=function e(t){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Te(this,n=Re),n.add(this),Fe(this,Be,void 0),Fe(this,Le,{}),Fe(this,Me,!1),Fe(this,Ge,void 0),Fe(this,Ve,void 0),Fe(this,qe,{}),Fe(this,We,void 0),De(Ge,this,t.baseSelector),De(Ve,this,t.contentSelector),De(qe,this,t.fields||{}),De(We,this,t.template),De(Be,this,new Map)},(t=[{key:"isActive",value:function(){return Ie(Me,this)}},{key:"setData",value:function(e){De(Le,this,e),this.refresh()}},{key:"dataValue",value:function(e){if(!e||!Ie(qe,this)[e])return"";if("function"==typeof Ie(qe,this)[e].valueCallback){var t=Ie(qe,this)[e].valueCallback(Ie(Le,this));return Ne(Re,this,Ue).call(this,t)}var n=Ie(qe,this)[e].valuePath;if(!n)return"";var r=n.split(".").reduce(function(e,t){return e&&void 0!==e[t]?e[t]:void 0},Ie(Le,this));return Ne(Re,this,Ue).call(this,r)}},{key:"activate",value:function(){De(Me,this,!0),this.storeFormData(),this.refresh()}},{key:"deactivate",value:function(){De(Me,this,!1),this.restoreFormData(),this.refresh()}},{key:"toggle",value:function(){Ie(Me,this)?this.deactivate():this.activate()}},{key:"refresh",value:function(){var e=this,t=document.querySelector(Ie(Ve,this));t&&(t.innerHTML="",Ie(Me,this)?this.showField(Ie(Ve,this)):this.hideField(Ie(Ve,this)),this.loopFields(function(t){var n=t.selector;Ie(Me,e)?e.hideField(n):e.showField(n)}),"function"==typeof Ie(We,this)&&(t.innerHTML=Ie(We,this).call(this,{value:function(t){return e.dataValue(t)},isEmpty:function(){var t=!0;return e.loopFields(function(n,r){if(e.dataValue(r))return t=!1,!1}),t}})))}},{key:"loopFields",value:function(e){for(var t=0,n=Object.entries(Ie(qe,this));t<n.length;t++){var r=Ee(n[t],2),i=r[0],o=r[1],a=o.selector,c=o.inputName,s="".concat(a,' [name="').concat(c,'"]');e(_e({inputSelector:c?s:""},o),i)}}},{key:"storeFormData",value:function(){var e=this;this.loopFields(function(t,n){var r,i,o=t.inputSelector;if(o&&!Ie(Be,e).has(n)){var a=document.querySelector(o);a&&(i=n,"checkbox"===(r=a).type||"radio"===r.type?(Ie(Be,e).set(i,r.checked),Ne(Re,e,ze).call(e,r,e.dataValue(i))):(Ie(Be,e).set(i,r.value),Ne(Re,e,ze).call(e,r,"")))}})}},{key:"restoreFormData",value:function(){var e=this,t=!1;this.loopFields(function(n,r){var i=n.inputSelector;if(Ie(Be,e).has(r)){var o=i?document.querySelector(i):null,a=Ie(Be,e).get(r);Ie(Be,e).delete(r),Ne(Re,e,ze).call(e,o,a)&&(t=!0)}}),t&&document.body.dispatchEvent(new Event("update_checkout"))}},{key:"syncDataToForm",value:function(){var e=this;if(Ie(Me,this)){var t=!1;this.loopFields(function(n,r){var i=n.inputSelector,o=i?document.querySelector(i):null;Ne(Re,e,ze).call(e,o,e.dataValue(r))&&(t=!0)}),t&&document.body.dispatchEvent(new Event("update_checkout"))}}},{key:"showField",value:function(e){var t=document.querySelector(Ie(Ge,this)+" "+e);t&&t.classList.remove("ppcp-axo-field-hidden")}},{key:"hideField",value:function(e){var t=document.querySelector(Ie(Ge,this)+" "+e);t&&t.classList.add("ppcp-axo-field-hidden")}},{key:"inputElement",value:function(e){var t=Ie(qe,this)[e].selector,n=document.querySelector(t+" select");return n||(document.querySelector(t+" input")||null)}},{key:"inputValue",value:function(e){var t=this.inputElement(e);return t?t.value:""}},{key:"toSubmitData",value:function(e){var t=this;this.loopFields(function(n,r){if(!n.valuePath||!n.selector)return!0;var i=t.inputElement(r);if(!i)return!0;e[i.name]=t.dataValue(r)})}}])&&xe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Ue(e){if(null==e)return"";var t=String(e);return ke()()(t)}function ze(e,t){var n;return!(!e||"SELECT"===e.tagName&&!function(){for(var n=0;n<e.options.length;n++)if(e.options[n].value===t)return!0;return!1}()||("checkbox"===e.type||"radio"===e.type?(t=!!t,n=e.checked,e.checked=t):(n=e.value,e.value=t),n===t))}const He=$e;function Qe(e){return Qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qe(e)}function Ke(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Je(r.key),r)}}function Je(e){var t=function(e){if("object"!=Qe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Qe(t)?t:t+""}const Xe=function(){return e=function e(t,n,r){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=n,this.states=r,this.group=new He({baseSelector:".woocommerce-checkout",contentSelector:t,template:function(e){if(e.isEmpty())return'\n <div style="margin-bottom: 20px;">\n <div class="axo-checkout-header-section">\n <h3>Shipping</h3>\n <a href="javascript:void(0)" '.concat(i.el.changeShippingAddressLink.attributes,">Edit</a>\n </div>\n <div>Please fill in your shipping details.</div>\n </div>\n ");var t=e.value("countryCode"),n=e.value("stateCode"),r=i.states[t]&&i.states[t][n]?i.states[t][n]:n;return i.hasEmptyValues(e)?'\n <div style="margin-bottom: 20px;">\n <div class="axo-checkout-header-section">\n <h3>Shipping</h3>\n <a href="javascript:void(0)" '.concat(i.el.changeShippingAddressLink.attributes,">Edit</a>\n </div>\n <div>Please fill in your shipping details.</div>\n </div>\n "):'\n <div style="margin-bottom: 20px;">\n <div class="axo-checkout-header-section">\n <h3>Shipping</h3>\n <a href="javascript:void(0)" '.concat(i.el.changeShippingAddressLink.attributes,">Edit</a>\n </div>\n <div>").concat(e.value("email"),"</div>\n <div>").concat(e.value("company"),"</div>\n <div>").concat(e.value("firstName")," ").concat(e.value("lastName"),"</div>\n <div>").concat(e.value("street1"),"</div>\n <div>").concat(e.value("street2"),"</div>\n <div>").concat(e.value("city")).concat(r?", "+r:""," ").concat(e.value("postCode"),"</div>\n <div>").concat(function(e,t){if(!t)return"";var n=document.querySelector("#billing_country");if(!n)return t;var r=n.querySelector('option[value="'.concat(t,'"]'));return r?r.textContent:t}(0,t),"</div>\n <div>").concat(e.value("phone"),"</div>\n </div>\n ")},fields:{email:{valuePath:"email"},firstName:{key:"firstName",selector:"#shipping_first_name_field",valuePath:"shipping.name.firstName",inputName:"shipping_first_name"},lastName:{selector:"#shipping_last_name_field",valuePath:"shipping.name.lastName",inputName:"shipping_last_name"},street1:{selector:"#shipping_address_1_field",valuePath:"shipping.address.addressLine1",inputName:"shipping_address_1"},street2:{selector:"#shipping_address_2_field",valuePath:null,inputName:"shipping_address_2"},postCode:{selector:"#shipping_postcode_field",valuePath:"shipping.address.postalCode",inputName:"shipping_postcode"},city:{selector:"#shipping_city_field",valuePath:"shipping.address.adminArea2",inputName:"shipping_city"},stateCode:{selector:"#shipping_state_field",valuePath:"shipping.address.adminArea1",inputName:"shipping_state"},countryCode:{selector:"#shipping_country_field",valuePath:"shipping.address.countryCode",inputName:"shipping_country"},company:{selector:"#shipping_company_field",valuePath:null,inputName:"shipping_company"},shipDifferentAddress:{selector:"#ship-to-different-address",valuePath:null,inputName:"ship_to_different_address",valueCallback:function(){return!0}},phone:{valueCallback:function(e){var t,n,r="",i=null==e||null===(t=e.shipping)||void 0===t||null===(t=t.phoneNumber)||void 0===t?void 0:t.countryCode,o=null==e||null===(n=e.shipping)||void 0===n||null===(n=n.phoneNumber)||void 0===n?void 0:n.nationalNumber;return i&&(r="+".concat(i," ")),r+o}}}})},(t=[{key:"hasEmptyValues",value:function(e){return!(e.value("email")&&e.value("firstName")&&e.value("lastName")&&e.value("street1")&&e.value("city"))}},{key:"isActive",value:function(){return this.group.active}},{key:"activate",value:function(){this.group.activate(),this.group.syncDataToForm()}},{key:"deactivate",value:function(){this.group.deactivate()}},{key:"refresh",value:function(){this.group.refresh()}},{key:"setData",value:function(e){this.group.setData(e),this.group.syncDataToForm()}},{key:"toSubmitData",value:function(e){return this.group.toSubmitData(e)}}])&&Ke(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Ze(e){return Ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ze(e)}function Ye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,et(r.key),r)}}function et(e){var t=function(e){if("object"!=Ze(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ze(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ze(t)?t:t+""}const tt=function(){return e=function e(t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=n,this.group=new He({baseSelector:".woocommerce-checkout",contentSelector:t,template:function(e){return e.isEmpty()?'\n <div style="margin-bottom: 20px;">\n <div class="axo-checkout-header-section">\n <h3>Billing</h3>\n <a href="javascript:void(0)" '.concat(r.el.changeBillingAddressLink.attributes,">Edit</a>\n </div>\n <div>Please fill in your billing details.</div>\n </div>\n "):""},fields:{email:{valuePath:"email"},firstName:{selector:"#billing_first_name_field",valuePath:null,inputName:"billing_first_name"},lastName:{selector:"#billing_last_name_field",valuePath:null,inputName:"billing_last_name"},street1:{selector:"#billing_address_1_field",valuePath:"billing.address.addressLine1",inputName:"billing_address_1"},street2:{selector:"#billing_address_2_field",valuePath:null,inputName:"billing_address_2"},postCode:{selector:"#billing_postcode_field",valuePath:"billing.address.postalCode",inputName:"billing_postcode"},city:{selector:"#billing_city_field",valuePath:"billing.address.adminArea2",inputName:"billing_city"},stateCode:{selector:"#billing_state_field",valuePath:"billing.address.adminArea1",inputName:"billing_state"},countryCode:{selector:"#billing_country_field",valuePath:"billing.address.countryCode",inputName:"billing_country"},company:{selector:"#billing_company_field",valuePath:null,inputName:"billing_company"},phone:{selector:"#billing_phone_field",valuePath:"billing.phoneNumber",inputName:"billing_phone"}}})},(t=[{key:"isActive",value:function(){return this.group.active}},{key:"activate",value:function(){this.group.activate()}},{key:"deactivate",value:function(){this.group.deactivate()}},{key:"refresh",value:function(){this.group.refresh()}},{key:"setData",value:function(e){this.group.setData(e)}},{key:"inputValue",value:function(e){return this.group.inputValue(e)}},{key:"fullName",value:function(){return"".concat(this.inputValue("firstName")," ").concat(this.inputValue("lastName")).trim()}},{key:"toSubmitData",value:function(e){return this.group.toSubmitData(e)}}])&&Ye(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function nt(e){return nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nt(e)}function rt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,it(r.key),r)}}function it(e){var t=function(e){if("object"!=nt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=nt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==nt(t)?t:t+""}const ot=function(){return e=function e(t,n,r){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=n,this.manager=r,this.group=new He({baseSelector:".ppcp-axo-payment-container",contentSelector:t,template:function(e){var t=function(){return i.manager.hideGatewaySelection?'<p style="margin-top: 40px; text-align: center;"><a href="javascript:void(0)" '.concat(i.el.showGatewaySelectionLink.attributes,">Select other payment method</a></p>"):""};if(e.isEmpty())return'\n <div style="margin-bottom: 20px; text-align: center;">\n '.concat(t(),"\n </div>\n ");var n=e.value("expiry").split("-");return'\n <div class="axo-checkout-wrapper">\n <div class="axo-checkout-header-section">\n <h3>Card Details</h3>\n <a href="javascript:void(0)" '.concat(i.el.changeCardLink.attributes,'>Edit</a>\n </div>\n <div class="axo-checkout-card-preview styled-card">\n <div class="ppcp-card-icon-wrapper">\n <img\n class="ppcp-card-icon"\n title="').concat(e.value("brand"),'"\n src="').concat(window.wc_ppcp_axo.icons_directory).concat({VISA:"visa-light.svg",MASTERCARD:"mastercard-light.svg",AMEX:"amex-light.svg",DISCOVER:"discover-light.svg",DINERS:"dinersclub-light.svg",JCB:"jcb-light.svg",UNIONPAY:"unionpay-light.svg"}[e.value("brand")],'"\n alt="').concat(e.value("brand"),'"\n >\n </div>\n <div class="axo-card-meta-wrapper">\n <div class="axo-card-number">').concat(e.value("lastDigits")?"•••• "+e.value("lastDigits"):"",'</div>\n <div class="axo-card-owner">').concat(e.value("name"),'</div>\n <div class="axo-card-expiry">').concat(n[1],"/").concat(n[0],"</div>\n\n </div>\n\n </div>\n ").concat(t(),"\n </div>\n ")},fields:{brand:{valuePath:"card.paymentSource.card.brand"},expiry:{valuePath:"card.paymentSource.card.expiry"},lastDigits:{valuePath:"card.paymentSource.card.lastDigits"},name:{valuePath:"card.paymentSource.card.name"}}})},(t=[{key:"activate",value:function(){this.group.activate()}},{key:"deactivate",value:function(){this.group.deactivate()}},{key:"refresh",value:function(){this.group.refresh()}},{key:"setData",value:function(e){this.group.setData(e)}},{key:"toSubmitData",value:function(e){var t=this.group.dataValue("name"),n=this.splitName(t),r=n.firstName,i=n.lastName;return e.billing_first_name=r,e.billing_last_name=i||r,this.group.toSubmitData(e)}},{key:"splitName",value:function(e){var t=e.trim().split(" ");return{firstName:t[0],lastName:t.length>1?t[t.length-1]:""}}}])&&rt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function at(e){return at="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},at(e)}function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function st(e,t,n){return(t=ut(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ut(r.key),r)}}function ut(e){var t=function(e){if("object"!=at(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=at(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==at(t)?t:t+""}const ft=function(){return e=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.submitButtonSelector=t,this.spinnerSelector=n,this.state={isProcessing:!1,canSubmit:!1,lastProcessedEmail:null}},t=[{key:"getState",value:function(){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ct(Object(n),!0).forEach(function(t){st(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ct(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},this.state)}},{key:"updateButtonUI",value:function(){var e=document.querySelector(this.submitButtonSelector);if(e){var t=document.querySelector(this.spinnerSelector);this.state.isProcessing?(e.setAttribute("disabled","disabled"),null==t||t.classList.add("loader","ppcp-axo-overlay"),e.classList.add("processing"),pe("Button set to processing state")):this.state.canSubmit?(e.removeAttribute("disabled"),null==t||t.classList.remove("loader","ppcp-axo-overlay"),e.classList.remove("processing"),pe("Button set to ready state")):(e.setAttribute("disabled","disabled"),null==t||t.classList.remove("loader","ppcp-axo-overlay"),e.classList.remove("processing"),pe("Button set to disabled state"))}else pe("Submit button not found, skipping UI update","warn")}},{key:"setProcessing",value:function(){this.state.isProcessing=!0,this.state.canSubmit=!1,this.updateButtonUI(),pe("Button state changed to: processing")}},{key:"setReady",value:function(){this.state.isProcessing=!1,this.state.canSubmit=!0,this.updateButtonUI(),pe("Button state changed to: ready")}},{key:"setDisabled",value:function(){this.state.isProcessing=!1,this.state.canSubmit=!1,this.updateButtonUI(),pe("Button state changed to: disabled")}},{key:"shouldProcessEmail",value:function(e,t){var n=!this.state.isProcessing&&this.state.lastProcessedEmail!==e&&e&&t(e);return pe("shouldProcessEmail: ".concat(n," (processing: ").concat(this.state.isProcessing,", lastEmail: ").concat(this.state.lastProcessedEmail,", currentEmail: ").concat(e,")")),n}},{key:"shouldAllowRetry",value:function(e,t){var n=!this.state.isProcessing&&e&&t(e);return pe("shouldAllowRetry: ".concat(n," (processing: ").concat(this.state.isProcessing,", email: ").concat(e,")")),n}},{key:"markEmailAsProcessing",value:function(e){this.state.lastProcessedEmail=e,this.setProcessing(),pe("Email marked as processing: ".concat(e))}},{key:"clearLastProcessedEmail",value:function(){var e=this.state.lastProcessedEmail;this.state.lastProcessedEmail=null,pe("Cleared last processed email: ".concat(e))}},{key:"handleAuthFailureOrCancellation",value:function(){var e=this;pe("Handling auth failure/cancellation - allowing retry"),this.clearLastProcessedEmail(),this.setReady(),setTimeout(function(){e.updateButtonUI(),pe("Forced button UI update after cancellation")},100)}},{key:"handleEmailLookupFailure",value:function(){pe("Handling email lookup failure - disabling button"),this.clearLastProcessedEmail(),this.setDisabled()}},{key:"handleSuccess",value:function(){pe("Handling successful processing"),this.setReady()}},{key:"reset",value:function(){this.state={isProcessing:!1,canSubmit:!1,lastProcessedEmail:null},this.updateButtonUI(),pe("Button state reset to initial state")}},{key:"isProcessing",value:function(){return this.state.isProcessing}},{key:"canSubmit",value:function(){return this.state.canSubmit&&!this.state.isProcessing}}],t&<(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function pt(e){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pt(e)}function dt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ht(r.key),r)}}function ht(e){var t=function(e){if("object"!=pt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pt(t)?t:t+""}const mt=function(){function e(){var t=arguments;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),window.paypalInsightDataLayer=window.paypalInsightDataLayer||[],document.paypalInsight=function(){paypalInsightDataLayer.push(t)}}return t=e,n=[{key:"init",value:function(){return e.instance||(e.instance=new e),e.instance}},{key:"isAvailable",value:function(){return"function"==typeof window.paypalInsight}},{key:"track",value:function(t,n){e.init(),e.isAvailable()&&window.paypalInsight("event",t,n)}},{key:"config",value:function(t,n){e.init(),e.isAvailable()&&window.paypalInsight("config",t,n)}},{key:"setSessionId",value:function(t){e.init(),e.isAvailable()&&window.paypalInsight("set",{session_id:t})}},{key:"trackJsLoad",value:function(){e.track("js_load",{timestamp:Date.now()})}},{key:"trackBeginCheckout",value:function(t){e.track("begin_checkout",t)}},{key:"trackSubmitCheckoutEmail",value:function(t){e.track("submit_checkout_email",t)}},{key:"trackSelectPaymentMethod",value:function(t){e.track("select_payment_method",t)}},{key:"trackEndCheckout",value:function(t){e.track("end_checkout",t)}}],null&&dt(t.prototype,null),n&&dt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();var yt=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=function(e){return"string"==typeof e?document.querySelector(e):e}(e);r&&(t?(jQuery(r).removeClass("ppcp-disabled").off("mouseup").find("> *").css("pointer-events",""),function(e,t){jQuery(document).trigger("ppcp-enabled",{handler:"ButtonsDisabler.setEnabled",action:"enable",selector:e,element:t})}(e,r)):(jQuery(r).addClass("ppcp-disabled").on("mouseup",function(e){if(e.stopImmediatePropagation(),n){var t=jQuery(n);t.find(".single_add_to_cart_button").hasClass("disabled")&&t.find(":submit").trigger("click")}}).find("> *").css("pointer-events","none"),function(e,t){jQuery(document).trigger("ppcp-disabled",{handler:"ButtonsDisabler.setEnabled",action:"disable",selector:e,element:t})}(e,r)))},vt=function(){var e=document.querySelector('input[name="payment_method"]:checked');return e?e.value:null};function bt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function gt(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var s=r&&r.prototype instanceof c?r:c,l=Object.create(s.prototype);return wt(l,"_invoke",function(n,r,i){var o,c,s,l=0,u=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,c=0,s=e,p.n=n,a}};function d(n,r){for(c=n,s=r,t=0;!f&&l&&!i&&t<u.length;t++){var i,o=u[t],d=p.p,h=o[2];n>3?(i=h===r)&&(s=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(c=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,c=0))}if(i||n>1)return a;throw f=!0,r}return function(i,u,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===u&&d(u,h),c=u,s=h;(t=c<2?e:s)||!f;){o||(c?c<3?(c>1&&(p.n=-1),d(c,s)):p.n=s:p.v=s);try{if(l=2,o){if(c||(i="next"),t=o[i]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=o.return)&&t.call(o),c<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),c=1);o=e}else if((t=(f=p.n<0)?s:n.call(r,p))!==a)break}catch(t){o=e,c=1,s=t}finally{l=1}}return{value:t,done:f}}}(n,i,o),!0),l}var a={};function c(){}function s(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(wt(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,wt(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,wt(f,"constructor",l),wt(l,"constructor",s),s.displayName="GeneratorFunction",wt(l,i,"GeneratorFunction"),wt(f),wt(f,i,"Generator"),wt(f,r,function(){return this}),wt(f,"toString",function(){return"[object Generator]"}),(gt=function(){return{w:o,m:p}})()}function wt(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}wt=function(e,t,n,r){function o(t,n){wt(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},wt(e,t,n,r)}function St(e,t,n,r,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,i)}function kt(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){St(o,r,i,a,c,"next",e)}function c(e){St(o,r,i,a,c,"throw",e)}a(void 0)})}}function Pt(e){return Pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Pt(e)}function Ot(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,jt(r.key),r)}}function _t(e,t,n){return(t=jt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jt(e){var t=function(e){if("object"!=Pt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Pt(t)?t:t+""}var Et=function(){return e=function e(t,n,r){var i,o,a,c,s,l,u=this;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),_t(this,"axoConfig",null),_t(this,"ppcpConfig",null),_t(this,"$",null),_t(this,"fastlane",null),_t(this,"cardComponent",null),_t(this,"initialized",!1),_t(this,"hideGatewaySelection",!1),_t(this,"phoneNumber",null),_t(this,"data",{}),_t(this,"status",{}),_t(this,"styles",{}),_t(this,"locale","en_us"),_t(this,"el",null),_t(this,"emailInput",null),_t(this,"phoneInput",null),_t(this,"shippingView",null),_t(this,"billingView",null),_t(this,"cardView",null),_t(this,"deleteKeysWithEmptyString",function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var r=n[t];""===e[r]?delete e[r]:"object"===Pt(e[r])&&(e[r]=u.deleteKeysWithEmptyString(e[r]),0===Object.keys(e[r]).length&&delete e[r])}return Array.isArray(e)?e.filter(function(e){return e}):e}),this.namespace=t,this.axoConfig=n,this.ppcpConfig=r,this.fastlane=new fe(t),this.$=jQuery,this.hasProcessedSessionRestore=!1,this.status={active:!1,validEmail:!1,hasProfile:!1,useEmailWidget:this.useEmailWidget(),hasCard:!1},this.buttonStateManager=null,this.clearData(),this.states=this.axoConfig.woocommerce.states,this.el=new Se,this.emailInput=document.querySelector(this.el.fieldBillingEmail.selector+" input"),this.styles={root:{backgroundColorPrimary:"#ffffff"}},this.cardOptions=this.getCardOptions(),this.enabledShippingLocations=this.axoConfig.enabled_shipping_locations,this.registerEventHandlers(),this.shippingView=new Xe(this.el.shippingAddressContainer.selector,this.el,this.states),this.billingView=new tt(this.el.billingAddressContainer.selector,this.el),this.cardView=new ot(this.el.paymentContainer.selector+"-details",this.el,this),document.axoDebugSetStatus=function(e,t){u.setStatus(e,t)},document.axoDebugObject=function(){return u},null!==(i=this.axoConfig)&&void 0!==i&&null!==(i=i.insights)&&void 0!==i&&i.enabled&&null!==(o=this.axoConfig)&&void 0!==o&&null!==(o=o.insights)&&void 0!==o&&o.client_id&&null!==(a=this.axoConfig)&&void 0!==a&&null!==(a=a.insights)&&void 0!==a&&a.session_id&&(mt.config(null===(c=this.axoConfig)||void 0===c||null===(c=c.insights)||void 0===c?void 0:c.client_id,{debug:"1"===(null==n?void 0:n.wp_debug)}),mt.setSessionId(null===(s=this.axoConfig)||void 0===s||null===(s=s.insights)||void 0===s?void 0:s.session_id),mt.trackJsLoad(),document.querySelector(".woocommerce-checkout")&&mt.trackBeginCheckout({amount:null===(l=this.axoConfig)||void 0===l||null===(l=l.insights)||void 0===l?void 0:l.amount,page_type:"checkout",user_data:{country:"US",is_store_member:!1}})),this.onChangePhone=this.onChangePhone.bind(this),this.initPhoneSyncWooToFastlane(),this.triggerGatewayChange()},t=[{key:"isRyanFlow",get:function(){return!!this.data.card}},{key:"cardFormSelector",get:function(){return this.el.paymentContainer.selector+"-form"}},{key:"isWatermarkEnabled",get:function(){return"1"===this.axoConfig.show_watermark}},{key:"registerEventHandlers",value:function(){var e,t=this,n=null===(e=document.querySelector("input[name=payment_method]:checked"))||void 0===e?void 0:e.value;this.$(document).on("change","input[name=payment_method]",function(e){var r;n!==e.target.value&&(mt.trackSelectPaymentMethod({payment_method_selected:(null===(r=t.axoConfig)||void 0===r||null===(r=r.insights)||void 0===r?void 0:r.payment_method_selected_map[e.target.value])||"other",page_type:"checkout"}),n=e.target.value)}),this.el.gatewayRadioButton.on("change",function(e){e.target.checked?t.activateAxo():t.deactivateAxo()}),this.$(document).on("updated_checkout payment_method_selected",function(){t.triggerGatewayChange()}),this.el.submitButton.on("click",function(){return t.onClickSubmitButton(),!1}),this.el.changeShippingAddressLink.on("click",kt(gt().m(function e(){var n,r,i;return gt().w(function(e){for(;;)switch(e.n){case 0:if(!t.status.hasProfile){e.n=2;break}return e.n=1,t.fastlane.profile.showShippingAddressSelector();case 1:n=e.v,r=n.selectionChanged,i=n.selectedAddress,r&&(t.setShipping(i),t.shippingView.refresh());case 2:return e.a(2)}},e)}))),this.el.changeBillingAddressLink.on("click",kt(gt().m(function e(){return gt().w(function(e){for(;;)switch(e.n){case 0:t.status.hasProfile&&t.el.changeCardLink.trigger("click");case 1:return e.a(2)}},e)}))),this.el.changeCardLink.on("click",kt(gt().m(function e(){var n;return gt().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,t.fastlane.profile.showCardSelector();case 1:(n=e.v).selectionChanged&&(t.setCard(n.selectedCard),t.setBilling({address:n.selectedCard.paymentSource.card.billingAddress}));case 2:return e.a(2)}},e)}))),this.el.showGatewaySelectionLink.on("click",kt(gt().m(function e(){return gt().w(function(e){for(;;)switch(e.n){case 0:t.hideGatewaySelection=!1,t.$(".wc_payment_methods label").show(),t.$(".wc_payment_methods input").show(),t.cardView.refresh();case 1:return e.a(2)}},e)}))),this.reEnableEmailInput(),this.$("#billing_email_field input").on("focus",function(e){var n,r,i,o;null!==(n=t.buttonStateManager)&&void 0!==n&&n.isProcessing()||(null===(r=t.buttonStateManager)||void 0===r||r.clearLastProcessedEmail(),null!==(i=t.emailInput)&&void 0!==i&&i.value&&t.validateEmailFormat(t.emailInput.value)&&(null===(o=t.buttonStateManager)||void 0===o||o.setReady()))}),document.addEventListener("axo_status_updated",function(e){var t=document.querySelector("[name='terms-field']");if(t){var n=e.detail,r=n.active&&!1===n.validEmail&&!1===n.hasProfile;t.parentElement.style.display=r?"none":"block"}})}},{key:"rerender",value:function(){var e=this.identifyScenario(this.status.active,this.status.validEmail,this.status.hasProfile);pe("Scenario: ".concat(JSON.stringify(e))),this.el.watermarkContainer.hide(),e.defaultSubmitButton?(re()||this.el.defaultSubmitButton.show(),this.el.billingEmailSubmitButton.hide()):(this.el.defaultSubmitButton.hide(),this.el.billingEmailSubmitButton.show()),e.defaultEmailField?this.el.fieldBillingEmail.show():this.el.fieldBillingEmail.hide(),e.defaultFormFields?(this.el.customerDetails.show(),this.toggleLoaderAndOverlay(this.el.customerDetails,"loader","ppcp-axo-overlay")):this.el.customerDetails.hide(),e.extraFormFields&&this.el.customerDetails.show(),e.axoEmailField?(this.showAxoEmailField(),this.el.watermarkContainer.show(),document.querySelector("#billing_email_field .woocommerce-input-wrapper").append(document.querySelector(this.el.watermarkContainer.selector))):(this.el.emailWidgetContainer.hide(),e.defaultEmailField||this.el.fieldBillingEmail.hide()),e.axoProfileViews?(this.shippingView.activate(),this.cardView.activate(),this.status.hasCard&&this.billingView.activate(),this.$(this.el.shippingAddressContainer.selector).after(this.$(this.el.watermarkContainer.selector)),this.el.watermarkContainer.show(),this.$(this.el.axoCustomerDetails.selector).addClass("col-1")):(this.shippingView.deactivate(),this.billingView.deactivate(),this.cardView.deactivate(),this.$(this.el.axoCustomerDetails.selector).removeClass("col-1")),e.axoPaymentContainer?(this.el.paymentContainer.show(),this.el.gatewayDescription.hide()):this.el.paymentContainer.hide(),e.axoSubmitButton?this.el.submitButtonContainer.show():this.el.submitButtonContainer.hide(),this.ensureBillingFieldsConsistency(),this.ensureShippingFieldsConsistency(),(e.defaultFormFields||e.extraFormFields)&&this.refreshEnhancedSelects()}},{key:"refreshEnhancedSelects",value:function(){this.$("select.country_select:visible, select.state_select:visible").not(".select2-hidden-accessible").length&&this.$(document.body).trigger("country_to_state_changed")}},{key:"identifyScenario",value:function(e,t,n){var r={defaultSubmitButton:!1,defaultEmailField:!1,defaultFormFields:!1,extraFormFields:!1,axoEmailField:!1,axoProfileViews:!1,axoPaymentContainer:!1,axoSubmitButton:!1};if(e&&t&&n)return r.extraFormFields=!0,r.axoProfileViews=!0,r.axoPaymentContainer=!0,r.axoSubmitButton=!0,r;if(e&&t&&!n)return r.defaultFormFields=!0,r.axoEmailField=!0,r.axoPaymentContainer=!0,r.axoSubmitButton=!0,r;if(e&&!t)return r.axoEmailField=!0,r;if(!e)return r.defaultSubmitButton=!0,r.defaultEmailField=!0,r.defaultFormFields=!0,r;throw new Error("Invalid scenario.")}},{key:"ensureBillingFieldsConsistency",value:function(){var e=this.$(".woocommerce-billing-fields .form-row:visible"),t=this.$(".woocommerce-billing-fields h3");e.length?t.show():t.hide()}},{key:"ensureShippingFieldsConsistency",value:function(){var e=this.$(".woocommerce-shipping-fields .form-row:visible"),t=this.$(".woocommerce-shipping-fields h3").not("#ship-to-different-address");e.length?t.show():t.hide()}},{key:"showAxoEmailField",value:function(){this.status.useEmailWidget?(this.el.emailWidgetContainer.show(),this.el.fieldBillingEmail.hide()):(this.el.emailWidgetContainer.hide(),this.el.fieldBillingEmail.show())}},{key:"setStatus",value:function(e,t){this.status[e]=t,pe("Status updated: ".concat(JSON.stringify(this.status))),document.dispatchEvent(new CustomEvent("axo_status_updated",{detail:this.status})),this.rerender()}},{key:"activateAxo",value:function(){if(this.initPlacements(),this.initFastlane(),this.setStatus("active",!0),this.readPhoneFromWoo(),pe("Attempt on activation - emailInput: ".concat(this.emailInput.value)),"1"===new URLSearchParams(window.location.search).get("ppcp_fastlane_error"))pe("Payment failure detected, session restoration will be attempted");else if(this.emailInput&&this.emailInput.value){var e;null!==(e=this.buttonStateManager)&&void 0!==e&&e.shouldProcessEmail(this.emailInput.value,this.validateEmailFormat.bind(this))?this.onChangeEmail():this.refreshFastlanePrefills()}else this.refreshFastlanePrefills()}},{key:"deactivateAxo",value:function(){this.setStatus("active",!1)}},{key:"initPlacements",value:function(){var e=this.el.axoCustomerDetails;document.querySelector(e.selector)||document.querySelector(e.anchorSelector).insertAdjacentHTML("afterbegin",'\n <div id="'.concat(e.id,'" class="').concat(e.className,'"></div>\n '));var t=document.querySelector(e.selector),n=this.el.billingAddressContainer;document.querySelector(n.selector)||t.insertAdjacentHTML("beforeend",'\n <div id="'.concat(n.id,'" class="').concat(n.className,'"></div>\n '));var r=this.el.shippingAddressContainer;document.querySelector(r.selector)||t.insertAdjacentHTML("beforeend",'\n <div id="'.concat(r.id,'" class="').concat(r.className,'"></div>\n '));var i=this.el.billingEmailFieldWrapper;document.querySelector(i.selector)||document.querySelector("#billing_email_field .woocommerce-input-wrapper").insertAdjacentHTML("afterend",'\n <div id="'.concat(i.id,'"></div>\n '));var o=this.el.watermarkContainer;document.querySelector(o.selector)||document.querySelector(i.selector).insertAdjacentHTML("beforeend",'\n <div class="'.concat(o.className,'" id="').concat(o.id,'"></div>\n '));var a=this.el.paymentContainer;if(document.querySelector(a.selector)||document.querySelector(".payment_method_ppcp-axo-gateway").insertAdjacentHTML("beforeend",'\n <div id="'.concat(a.id,'" class="').concat(a.className,' axo-hidden">\n <div id="').concat(a.id,'-form" class="').concat(a.className,'-form"></div>\n <div id="').concat(a.id,'-details" class="').concat(a.className,'-details"></div>\n </div>\n ')),this.useEmailWidget()){var c=this.el.emailWidgetContainer;document.querySelector(c.selector)||t.insertAdjacentHTML("afterbegin",'\n <div id="'.concat(c.id,'" class="').concat(c.className,'">\n --- EMAIL WIDGET PLACEHOLDER ---\n </div>\n '))}else{var s=document.querySelector(this.el.fieldBillingEmail.selector);t.prepend(s),document.querySelector(this.el.billingEmailFieldWrapper.selector).prepend(document.querySelector("#billing_email_field .woocommerce-input-wrapper"))}}},{key:"initButtonStateManager",value:function(){this.buttonStateManager||(this.buttonStateManager=new ft(this.el.billingEmailSubmitButton.selector,this.el.billingEmailSubmitButtonSpinner.selector),pe("Button state manager initialized"))}},{key:"registerEmailEventHandlers",value:function(){var e=this,t=document.querySelector("#billing_email_field input");t&&t.addEventListener("keydown",function(){var t=kt(gt().m(function t(n){var r;return gt().w(function(t){for(;;)switch(t.n){case 0:if("Enter"!==n.key||"ppcp-axo-gateway"!==vt()){t.n=2;break}if(n.preventDefault(),n.stopPropagation(),pe("Enter key on email field - value: ".concat(e.emailInput.value)),e.validateEmail(e.el.fieldBillingEmail.selector),!e.emailInput||null===(r=e.buttonStateManager)||void 0===r||!r.shouldAllowRetry(e.emailInput.value,e.validateEmailFormat.bind(e))){t.n=1;break}return t.n=1,e.onChangeEmail();case 1:return t.a(2,!1);case 2:return t.a(2)}},t)}));return function(_x){return t.apply(this,arguments)}}());var n=document.querySelector(this.el.billingEmailSubmitButton.selector);n&&n.addEventListener("click",function(){var t=kt(gt().m(function t(n){var r;return gt().w(function(t){for(;;)switch(t.n){case 0:if(n.preventDefault(),pe("Submit button clicked - email: ".concat(e.emailInput.value)),!e.emailInput||null===(r=e.buttonStateManager)||void 0===r||!r.shouldAllowRetry(e.emailInput.value,e.validateEmailFormat.bind(e))){t.n=1;break}return t.n=1,e.onChangeEmail();case 1:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}())}},{key:"initFastlane",value:(d=kt(gt().m(function e(){return gt().w(function(e){for(;;)switch(e.n){case 0:if(!this.initialized){e.n=1;break}return e.a(2);case 1:return this.initialized=!0,e.n=2,this.connect();case 2:return e.n=3,this.renderWatermark();case 3:return this.renderEmailSubmitButton(),this.initButtonStateManager(),this.registerEmailEventHandlers(),this.watchEmail(),e.n=4,this.restoreSessionAfterFailure();case 4:return e.a(2)}},e,this)})),function(){return d.apply(this,arguments)})},{key:"connect",value:(p=kt(gt().m(function e(){return gt().w(function(e){for(;;)switch(e.n){case 0:return this.axoConfig.environment.is_sandbox&&window.localStorage.setItem("axoEnv","sandbox"),e.n=1,this.fastlane.connect({locale:this.locale,styles:this.styles,cardOptions:{allowedBrands:this.cardOptions},shippingAddressOptions:{allowedLocations:this.enabledShippingLocations}});case 1:this.fastlane.setLocale("en_us");case 2:return e.a(2)}},e,this)})),function(){return p.apply(this,arguments)})},{key:"triggerGatewayChange",value:function(){this.el.gatewayRadioButton.trigger("change")}},{key:"renderWatermark",value:(f=kt(gt().m(function e(){var t,n=arguments;return gt().w(function(e){for(;;)switch(e.n){case 0:if(t=!(n.length>0&&void 0!==n[0])||n[0],this.isWatermarkEnabled){e.n=1;break}return this.el.watermarkContainer.hide(),e.a(2);case 1:return e.n=2,this.fastlane.FastlaneWatermarkComponent({includeAdditionalInfo:t});case 2:e.v.render(this.el.watermarkContainer.selector),this.toggleWatermarkLoading(this.el.watermarkContainer,"ppcp-axo-watermark-loading","loader");case 3:return e.a(2)}},e,this)})),function(){return f.apply(this,arguments)})},{key:"renderEmailSubmitButton",value:function(){var e=this.el.billingEmailSubmitButton,t=this.el.billingEmailSubmitButtonSpinner;if(!document.querySelector(e.selector)){var n=document.querySelector("#billing_email_field .woocommerce-input-wrapper"),r=document.querySelector("#ppcp-axo-watermark-container");n.insertAdjacentHTML("beforeend",'\n <button type="button" id="'.concat(e.id,'" class="').concat(e.className,'">\n ').concat(this.axoConfig.billing_email_button_text,'\n <span id="').concat(t.id,'"></span>\n </button>\n '));var i=document.querySelector(e.selector);n.insertBefore(i,r),i.offsetHeight,i.classList.remove("ppcp-axo-billing-email-submit-button-hidden"),i.classList.add("ppcp-axo-billing-email-submit-button-loaded")}}},{key:"watchEmail",value:function(){var e=this;this.useEmailWidget()||(this.emailInput.addEventListener("change",kt(gt().m(function t(){var n;return gt().w(function(t){for(;;)switch(t.n){case 0:pe("Change event attempt - emailInput: ".concat(e.emailInput.value)),e.emailInput&&null!==(n=e.buttonStateManager)&&void 0!==n&&n.shouldProcessEmail(e.emailInput.value,e.validateEmailFormat.bind(e))&&(e.validateEmail(e.el.fieldBillingEmail.selector),e.onChangeEmail());case 1:return t.a(2)}},t)}))),pe("Checking initial email value: ".concat(this.emailInput.value)),this.emailInput.value&&this.onChangeEmail())}},{key:"initPhoneSyncWooToFastlane",value:function(){var e;this.phoneInput=document.querySelector("#billing_phone"),null===(e=this.phoneInput)||void 0===e||e.addEventListener("change",this.onChangePhone)}},{key:"sanitizePhoneNumber",value:function(e){var t=e.replace(/^\+1/,"").replace(/\D/g,"");return 10===t.length?t:null}},{key:"readPhoneFromWoo",value:function(){if(!this.phoneInput)return!1;var e=this.phoneInput.value,t=this.sanitizePhoneNumber(e);return!!t&&(this.data.phone=t,!0)}},{key:"onChangeEmail",value:(u=kt(gt().m(function e(){var t,n,r,i,o,a;return gt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this.status.active){e.n=1;break}return pe("Email checking skipped, AXO not active."),e.a(2);case 1:if(this.emailInput){e.n=2;break}return pe("Email field not initialized."),e.a(2);case 2:if(n=this.emailInput.value,null!==(t=this.buttonStateManager)&&void 0!==t&&t.shouldProcessEmail(n,this.validateEmailFormat.bind(this))){e.n=3;break}return pe("Email processing skipped - already processing or same email"),e.a(2);case 3:if(pe("Email changed: ".concat(n||"<empty>")),this.buttonStateManager.markEmailAsProcessing(n),this.clearData(),this.emailInput.value=this.stripSpaces(this.emailInput.value),this.$(this.el.paymentContainer.selector+"-details").html(""),this.removeFastlaneComponent(),this.setStatus("validEmail",!1),this.setStatus("hasProfile",!1),this.hideGatewaySelection=!1,this.emailInput.value&&this.emailInput.checkValidity()&&this.validateEmailFormat(this.emailInput.value)){e.n=4;break}return pe("The email address is not valid."),null===(r=this.buttonStateManager)||void 0===r||r.setDisabled(),e.a(2);case 4:if(this.data.email=this.emailInput.value,this.billingView.setData(this.data),this.readPhoneFromWoo(),this.fastlane.identity){e.n=5;break}return pe("Not initialized."),null===(i=this.buttonStateManager)||void 0===i||i.setDisabled(),e.a(2);case 5:return mt.trackSubmitCheckoutEmail({page_type:"checkout"}),this.disableGatewaySelection(),e.p=6,e.n=7,this.lookupCustomerByEmail();case 7:e.n=9;break;case 8:e.p=8,a=e.v,pe("Email lookup failed: ".concat(a.message),"error"),null===(o=this.buttonStateManager)||void 0===o||o.handleEmailLookupFailure();case 9:return e.p=9,this.enableGatewaySelection(),e.f(9);case 10:return e.a(2)}},e,this,[[6,8,9,10]])})),function(){return u.apply(this,arguments)})},{key:"onChangePhone",value:(l=kt(gt().m(function e(){return gt().w(function(e){for(;;)switch(e.n){case 0:if(!this.readPhoneFromWoo()||!this.status.active){e.n=1;break}return e.n=1,this.refreshFastlanePrefills();case 1:return e.a(2,Promise.resolve())}},e,this)})),function(){return l.apply(this,arguments)})},{key:"lookupCustomerByEmail",value:(s=kt(gt().m(function e(){var t,n,r,i,o,a,c;return gt().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.fastlane.identity.lookupCustomerByEmail(this.emailInput.value);case 1:if(t=e.v,pe("lookupCustomerByEmail: ".concat(JSON.stringify(t))),!t.customerContextId){e.n=7;break}return pe("Email is associated with a Connect profile or a PayPal member"),e.n=2,this.fastlane.identity.triggerAuthenticationFlow(t.customerContextId);case 2:if(n=e.v,pe("AuthResponse - triggerAuthenticationFlow: ".concat(JSON.stringify(n))),"succeeded"!==n.authenticationState){e.n=4;break}return e.n=3,this.handleSuccessfulAuth(n);case 3:null===(r=this.buttonStateManager)||void 0===r||r.handleSuccess(),e.n=6;break;case 4:return pe("Authentication Failed or Canceled"),e.n=5,this.handleFailedAuth();case 5:null===(i=this.buttonStateManager)||void 0===i||i.handleAuthFailureOrCancellation();case 6:e.n=9;break;case 7:return pe("No profile found with this email address."),e.n=8,this.handleGuestCustomer();case 8:null===(o=this.buttonStateManager)||void 0===o||o.handleSuccess();case 9:e.n=11;break;case 10:throw e.p=10,c=e.v,pe("lookupCustomerByEmail error: ".concat(c.message),"error"),null===(a=this.buttonStateManager)||void 0===a||a.handleEmailLookupFailure(),c;case 11:return e.a(2)}},e,this,[[0,10]])})),function(){return s.apply(this,arguments)})},{key:"disableGatewaySelection",value:function(){this.$(".wc_payment_methods input").prop("disabled",!0)}},{key:"enableGatewaySelection",value:function(){this.$(".wc_payment_methods input").prop("disabled",!1)}},{key:"clearData",value:function(){this.data={email:null,phone:null,billing:null,shipping:null,card:null}}},{key:"setShipping",value:function(e){this.data.shipping=e,this.shippingView.setData(this.data)}},{key:"setBilling",value:function(e){this.data.billing=e,this.billingView.setData(this.data)}},{key:"setCard",value:function(e){this.data.card=e,this.cardView.setData(this.data)}},{key:"onClickSubmitButton",value:function(){var e=this;if(this.isRyanFlow){pe("Starting Ryan flow."),this.$("#ship-to-different-address-checkbox").prop("checked","checked");var t={};this.billingView.toSubmitData(t),this.shippingView.toSubmitData(t),this.cardView.toSubmitData(t),this.ensureBillingPhoneNumber(t),pe("Ryan flow - submitted nonce: ".concat(this.data.card.id)),this.submit(this.data.card.id,t)}else{pe("Starting Gary flow.");try{this.cardComponent.getPaymentToken(this.tokenizeData()).then(function(t){pe("Gary flow - submitted nonce: ".concat(t.id)),e.submit(t.id)})}catch(e){alert("Error tokenizing data."),pe("Error tokenizing data. ".concat(e.message),"error")}}}},{key:"cardComponentData",value:function(){var e={fields:{cardholderName:{enabled:"1"===this.axoConfig.name_on_card}},styles:this.deleteKeysWithEmptyString(this.axoConfig.style_options)};return this.data.phone&&!this.isRyanFlow&&(e.fields.phoneNumber={prefill:this.data.phone}),e}},{key:"initializeFastlaneComponent",value:(c=kt(gt().m(function e(){var t,n;return gt().w(function(e){for(;;)switch(e.n){case 0:if(this.status.active&&!this.cardComponent){e.n=1;break}return e.a(2,Promise.resolve());case 1:return t=this.cardFormSelector,n=this.cardComponentData(),e.n=2,this.fastlane.FastlaneCardComponent(n);case 2:return this.cardComponent=e.v,e.a(2,this.cardComponent.render(t))}},e,this)})),function(){return c.apply(this,arguments)})},{key:"removeFastlaneComponent",value:function(){document.querySelector(this.cardFormSelector).innerHTML="",this.cardComponent=null}},{key:"refreshFastlanePrefills",value:(a=kt(gt().m(function e(){var t,n,r;return gt().w(function(e){for(;;)switch(e.n){case 0:if(this.cardComponent){e.n=1;break}return e.a(2,Promise.resolve());case 1:return t=this.cardComponentData(),n=t.fields,r=Object.keys(n).reduce(function(e,t){return n[t].hasOwnProperty("prefill")&&(e[t]=n[t].prefill),e},{}),e.a(2,this.cardComponent.updatePrefills(r))}},e,this)})),function(){return a.apply(this,arguments)})},{key:"tokenizeData",value:function(){return{cardholderName:{fullName:this.billingView.fullName()},billingAddress:{addressLine1:this.billingView.inputValue("street1"),addressLine2:this.billingView.inputValue("street2"),adminArea1:this.billingView.inputValue("stateCode"),adminArea2:this.billingView.inputValue("city"),postalCode:this.billingView.inputValue("postCode"),countryCode:this.billingView.inputValue("countryCode")}}}},{key:"submit",value:function(e,t){var n=this;if(this.el.axoNonceInput.get()||this.$("form.woocommerce-checkout").append('<input type="hidden" id="'.concat(this.el.axoNonceInput.id,'" name="axo_nonce" value="" />')),this.el.axoNonceInput.get().value=e,t){var r=document.querySelector("form.woocommerce-checkout"),i=new FormData(r);this.showLoading(),Object.keys(t).forEach(function(e){i.set(e,t[e])}),i.set("fastlane_member",!0),fetch(wc_checkout_params.checkout_url,{method:"POST",body:i}).then(function(e){return e.json()}).then(function(e){if("failure"===e.result){if(e.messages){var t=n.$(".woocommerce-notices-wrapper").eq(0);t.html(e.messages),n.$("html, body").animate({scrollTop:t.offset().top},500)}return pe("Error sending checkout form. ".concat(e),"error"),void n.hideLoading()}e.redirect&&(window.location.href=e.redirect)}).catch(function(e){pe("Error sending checkout form. ".concat(e.message),"error"),n.hideLoading()})}else this.el.defaultSubmitButton.click()}},{key:"showLoading",value:function(){jQuery("form.woocommerce-checkout").append('<div class="blockUI blockOverlay" style="z-index: 1000; border: medium; margin: 0px; padding: 0px; width: 100%; height: 100%; top: 0px; left: 0px; background: rgb(255, 255, 255); opacity: 0.6; cursor: default; position: absolute;"></div>'),function(e){yt(e,!1,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null)}(".woocommerce-checkout-payment")}},{key:"hideLoading",value:function(){jQuery("form.woocommerce-checkout .blockOverlay").remove(),yt(".woocommerce-checkout-payment",!0)}},{key:"useEmailWidget",value:function(){var e;return"use_widget"===(null===(e=this.axoConfig)||void 0===e||null===(e=e.widgets)||void 0===e?void 0:e.email)}},{key:"getCardOptions",value:function(){var e,t=this.axoConfig.merchant_country||"US",n=new Set((null===(e=this.axoConfig.allowed_cards)||void 0===e?void 0:e[t])||["VISA","MASTERCARD","AMEX","DISCOVER"]),r=new Set((this.axoConfig.disable_cards||[]).map(function(e){return e.toUpperCase()}));return function(e){return function(e){if(Array.isArray(e))return bt(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return bt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bt(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(n).filter(function(e){return!r.has(e)})}},{key:"ensureBillingPhoneNumber",value:function(e){if(""===e.billing_phone){var t,n,r="",i=null===(t=this.data.shipping)||void 0===t||null===(t=t.phoneNumber)||void 0===t?void 0:t.countryCode,o=null===(n=this.data.shipping)||void 0===n||null===(n=n.phoneNumber)||void 0===n?void 0:n.nationalNumber;i&&(r="+".concat(i," ")),r+=o,e.billing_phone=r}}},{key:"toggleLoaderAndOverlay",value:function(e,t,n){var r=document.querySelector("".concat(e.selector," .").concat(t)),i=document.querySelector("".concat(e.selector," .").concat(n));r&&r.classList.toggle(t),i&&i.classList.toggle(n)}},{key:"spinnerToggleLoaderAndOverlay",value:function(e,t,n){var r=document.querySelector("".concat(e.selector));r&&(r.classList.toggle(t),r.classList.toggle(n))}},{key:"toggleWatermarkLoading",value:function(e,t,n){var r=document.querySelector("".concat(e.selector,".").concat(t)),i=document.querySelector("".concat(e.selector,".").concat(n));r&&r.classList.toggle(t),i&&i.classList.toggle(n)}},{key:"validateEmailFormat",value:function(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}},{key:"stripSpaces",value:function(e){return e.replace(/\s+/g,"")}},{key:"validateEmail",value:function(e){var t=document.querySelector(e),n=document.querySelector(e+" input").value;this.validateEmailFormat(n)?(t.classList.remove("woocommerce-invalid"),t.classList.add("woocommerce-validated"),this.setStatus("validEmail",!0)):(t.classList.remove("woocommerce-validated"),t.classList.add("woocommerce-invalid"),this.setStatus("validEmail",!1))}},{key:"reEnableEmailInput",value:function(){var e=this,t=function(t){var n,r,i;null!==(n=e.buttonStateManager)&&void 0!==n&&n.isProcessing()||null===(r=e.emailInput)||void 0===r||!r.value||!e.validateEmailFormat(e.emailInput.value)||null===(i=e.buttonStateManager)||void 0===i||i.setReady()};this.$("#billing_email_field input").on("focus",t),this.$("#billing_email_field input").on("input",t),this.$("#billing_email_field input").on("click",t)}},{key:"restoreSessionAfterFailure",value:(o=kt(gt().m(function e(){var t,n,r,i,o,a,c,s,l,u;return gt().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this.fastlane&&!this.hasProcessedSessionRestore){e.n=1;break}return e.a(2);case 1:if("1"===(t=new URLSearchParams(window.location.search)).get("ppcp_fastlane_error")){e.n=2;break}return e.a(2);case 2:if(t.delete("ppcp_fastlane_error"),(n=new URL(window.location)).search=t.toString(),window.history.replaceState({},"",n),this.hasProcessedSessionRestore=!0,e.p=3,null===(r=this.emailInput)||void 0===r||!r.value){e.n=12;break}return pe("Restoring Fastlane session for email: ".concat(this.emailInput.value)),null===(i=this.buttonStateManager)||void 0===i||i.markEmailAsProcessing(this.emailInput.value),e.n=4,this.fastlane.identity.lookupCustomerByEmail(this.emailInput.value);case 4:if(null==(o=e.v)||!o.customerContextId){e.n=10;break}return e.n=5,this.fastlane.identity.triggerAuthenticationFlow(o.customerContextId);case 5:if("succeeded"!==(null==(a=e.v)?void 0:a.authenticationState)){e.n=7;break}return e.n=6,this.handleSuccessfulAuth(a);case 6:null===(c=this.buttonStateManager)||void 0===c||c.handleSuccess(),pe("Fastlane session successfully restored"),e.n=9;break;case 7:return e.n=8,this.handleFailedAuth();case 8:null===(s=this.buttonStateManager)||void 0===s||s.handleAuthFailureOrCancellation();case 9:e.n=12;break;case 10:return e.n=11,this.handleGuestCustomer();case 11:null===(l=this.buttonStateManager)||void 0===l||l.handleSuccess();case 12:e.n=14;break;case 13:e.p=13,e.v,pe("Failed to restore Fastlane session","warn"),pe("Fastlane session restoration error:","error"),null===(u=this.buttonStateManager)||void 0===u||u.handleEmailLookupFailure();case 14:return e.a(2)}},e,this,[[3,13]])})),function(){return o.apply(this,arguments)})},{key:"handleSuccessfulAuth",value:(i=kt(gt().m(function e(t){var n,r,i,o,a,c,s;return gt().w(function(e){for(;;)switch(e.n){case 0:if((r=t.profileData.shippingAddress)&&this.setShipping(r),!t.profileData.card){e.n=1;break}this.setStatus("hasCard",!0),e.n=2;break;case 1:return e.n=2,this.initializeFastlaneComponent();case 2:return(i=null===(n=t.profileData)||void 0===n||null===(n=n.card)||void 0===n||null===(n=n.paymentSource)||void 0===n||null===(n=n.card)||void 0===n?void 0:n.billingAddress)&&(this.setCard(t.profileData.card),c={address:i},(s=null!==(o=null===(a=t.profileData)||void 0===a||null===(a=a.shippingAddress)||void 0===a||null===(a=a.phoneNumber)||void 0===a?void 0:a.nationalNumber)&&void 0!==o?o:"")&&(c.phoneNumber=s),this.setBilling(c)),this.setStatus("validEmail",!0),this.setStatus("hasProfile",!0),this.hideGatewaySelection=!0,this.$(".wc_payment_methods label").hide(),this.$(".wc_payment_methods input").hide(),e.n=3,this.renderWatermark(!1);case 3:this.rerender();case 4:return e.a(2)}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"handleFailedAuth",value:(r=kt(gt().m(function e(){return gt().w(function(e){for(;;)switch(e.n){case 0:return this.setStatus("validEmail",!0),this.setStatus("hasProfile",!1),e.n=1,this.renderWatermark(!0);case 1:return e.n=2,this.initializeFastlaneComponent();case 2:return e.a(2)}},e,this)})),function(){return r.apply(this,arguments)})},{key:"handleGuestCustomer",value:(n=kt(gt().m(function e(){return gt().w(function(e){for(;;)switch(e.n){case 0:return this.setStatus("validEmail",!0),this.setStatus("hasProfile",!1),e.n=1,this.renderWatermark(!0);case 1:return e.n=2,this.initializeFastlaneComponent();case 2:return e.a(2)}},e,this)})),function(){return n.apply(this,arguments)})}],t&&Ot(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r,i,o,a,c,s,l,u,f,p,d}();const Ct=Et;function xt(e,t){void 0===t&&(t={});var n=document.createElement("script");return n.src=e,Object.keys(t).forEach(function(e){n.setAttribute(e,t[e]),"data-csp-nonce"===e&&n.setAttribute("nonce",t["data-csp-nonce"])}),n}function At(e,t){if(void 0===t&&(t=Promise),Tt(e,t),"undefined"==typeof document)return t.resolve(null);var n=function(e){var t,n,r=e.sdkBaseUrl,i=e.environment,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["sdkBaseUrl","environment"]),a=r||function(e){return"sandbox"===e?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}(i),c=o,s=Object.keys(c).filter(function(e){return void 0!==c[e]&&null!==c[e]&&""!==c[e]}).reduce(function(e,t){var n,r=c[t].toString();return n=function(e,t){return(t?"-":"")+e.toLowerCase()},"data"===(t=t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,n)).substring(0,4)||"crossorigin"===t?e.attributes[t]=r:e.queryParams[t]=r,e},{queryParams:{},attributes:{}}),l=s.queryParams,u=s.attributes;return l["merchant-id"]&&-1!==l["merchant-id"].indexOf(",")&&(u["data-merchant-id"]=l["merchant-id"],l["merchant-id"]="*"),{url:"".concat(a,"?").concat((t=l,n="",Object.keys(t).forEach(function(e){0!==n.length&&(n+="&"),n+=e+"="+t[e]}),n)),attributes:u}}(e),r=n.url,i=n.attributes,o=i["data-namespace"]||"paypal",a=Ft(o);return i["data-js-sdk-library"]||(i["data-js-sdk-library"]="paypal-js"),function(e,t){var n=document.querySelector('script[src="'.concat(e,'"]'));if(null===n)return null;var r=xt(e,t),i=n.cloneNode();if(delete i.dataset.uidAuto,Object.keys(i.dataset).length!==Object.keys(r.dataset).length)return null;var o=!0;return Object.keys(i.dataset).forEach(function(e){i.dataset[e]!==r.dataset[e]&&(o=!1)}),o?n:null}(r,i)&&a?t.resolve(a):function(e,t){void 0===t&&(t=Promise),Tt(e,t);var n=e.url,r=e.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==r&&"object"!=typeof r)throw new Error("Expected attributes to be an object.");return new t(function(e,t){if("undefined"==typeof document)return e();!function(e){var t=e.onSuccess,n=e.onError,r=xt(e.url,e.attributes);r.onerror=n,r.onload=t,document.head.insertBefore(r,document.head.firstElementChild)}({url:n,attributes:r,onSuccess:function(){return e()},onError:function(){var e=new Error('The script "'.concat(n,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return t(e)}})})}({url:r,attributes:i},t).then(function(){var e=Ft(o);if(e)return e;throw new Error("The window.".concat(o," global variable is not available."))})}function Ft(e){return window[e]}function Tt(e,t){if("object"!=typeof e||null===e)throw new Error("Expected an options object.");var n=e.environment;if(n&&"production"!==n&&"sandbox"!==n)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==t&&"function"!=typeof t)throw new Error("Expected PromisePonyfill to be a function.")}function It(e){return It="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},It(e)}function Dt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,c=[],s=!0,l=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw i}}return c}}(e,t)||Bt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Nt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Bt(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}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,o=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(a)throw i}}}}function Bt(e,t){if(e){if("string"==typeof e)return Lt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lt(e,t):void 0}}function Lt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Mt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Gt(r.key),r)}}function Gt(e){var t=function(e){if("object"!=It(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=It(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==It(t)?t:t+""}"function"==typeof SuppressedError&&SuppressedError;var Vt=function(){return e=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.paypal=null,this.buttons=new Map,this.messages=new Map,this.renderEventName="ppcp-render",document.ppcpWidgetBuilderStatus=function(){console.log({buttons:t.buttons,messages:t.messages})},jQuery(document).off(this.renderEventName).on(this.renderEventName,function(){t.renderAll()})},(t=[{key:"setPaypal",value:function(e){this.paypal=e,jQuery(document).trigger("ppcp-paypal-loaded",e)}},{key:"registerButtons",value:function(e,t){e=this.sanitizeWrapper(e),this.buttons.set(this.toKey(e),{wrapper:e,options:t})}},{key:"renderButtons",value:function(e){e=this.sanitizeWrapper(e);var t=this.toKey(e);if(this.buttons.has(t)&&!this.hasRendered(e)){var n=this.buttons.get(t),r=this.paypal.Buttons(n.options);if(r.isEligible()){var i=this.buildWrapperTarget(e);i&&(r.hasReturned()?r.resume():r.render(i))}else this.buttons.delete(t)}}},{key:"renderAllButtons",value:function(){var e,t=Nt(this.buttons);try{for(t.s();!(e=t.n()).done;){var n=Dt(e.value,1)[0];this.renderButtons(n)}}catch(e){t.e(e)}finally{t.f()}}},{key:"removeButtons",value:function(e){var t,n=Nt(this.buttons);try{for(n.s();!(t=n.n()).done;){var r=Dt(t.value,2),i=r[0],o=r[1];(Array.isArray(o.wrapper)?o.wrapper[0]:o.wrapper)===e&&this.buttons.delete(i)}}catch(e){n.e(e)}finally{n.f()}}},{key:"registerMessages",value:function(e,t){this.messages.set(e,{wrapper:e,options:t})}},{key:"renderMessages",value:function(e){var t=this;if(this.messages.has(e)){var n=this.messages.get(e);if(this.hasRendered(e))document.querySelector(e).setAttribute("data-pp-amount",n.options.amount);else{var r=this.paypal.Messages(n.options);r.render(n.wrapper),setTimeout(function(){t.hasRendered(e)||r.render(n.wrapper)},100)}}}},{key:"renderAllMessages",value:function(){var e,t=Nt(this.messages);try{for(t.s();!(e=t.n()).done;){var n=Dt(e.value,2),r=n[0];n[1],this.renderMessages(r)}}catch(e){t.e(e)}finally{t.f()}}},{key:"renderAll",value:function(){this.renderAllButtons(),this.renderAllMessages()}},{key:"hasRendered",value:function(e){var t=e;if(Array.isArray(e)){t=e[0];var n,r=Nt(e.slice(1));try{for(r.s();!(n=r.n()).done;)t+=" .item-"+n.value}catch(e){r.e(e)}finally{r.f()}}var i=document.querySelector(t);return i&&i.hasChildNodes()}},{key:"sanitizeWrapper",value:function(e){return Array.isArray(e)&&1===(e=e.filter(function(e){return!!e})).length&&(e=e[0]),e}},{key:"buildWrapperTarget",value:function(e){var t=e;if(Array.isArray(e)){var n=jQuery(e[0]);if(!n.length)return;var r="item-"+e[1],i=n.find("."+r);i.length||(i=jQuery('<div class="'.concat(r,'"></div>')),n.append(i)),t=i.get(0)}return jQuery(t).length?t:null}},{key:"toKey",value:function(e){return Array.isArray(e)?JSON.stringify(e):e}}])&&Mt(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();window.widgetBuilder=window.widgetBuilder||new Vt;const qt=window.widgetBuilder;function Wt(){return Wt.c||(Wt.c=e.n(t()))}t();var Rt=function(e){return e.replace(/([-_]\w)/g,function(e){return e[1].toUpperCase()})},$t=["checkout","checkout-block","pay-now"],Ut=function(e){var t=function(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[Rt(n)]=e[n]);return t}(e.url_params);e.script_attributes&&(t=Wt()()(t,e.script_attributes));var n=function(e){var t=function(e){var t,n,r;if(!0!==(null==e||null===(t=e.user)||void 0===t?void 0:t.is_logged))return null;var i=null==e||null===(n=e.save_payment_methods)||void 0===n?void 0:n.id_token;return i?!0===(null==e||null===(r=e.vault_component)||void 0===r?void 0:r.is_eligible)&&$t.includes(null==e?void 0:e.context)?null:i:null}(e);return t?{"data-user-id-token":t}:{}}(e);return Wt()().all([t,n])};function zt(e){return zt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zt(e)}function Ht(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var s=r&&r.prototype instanceof c?r:c,l=Object.create(s.prototype);return Qt(l,"_invoke",function(n,r,i){var o,c,s,l=0,u=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,c=0,s=e,p.n=n,a}};function d(n,r){for(c=n,s=r,t=0;!f&&l&&!i&&t<u.length;t++){var i,o=u[t],d=p.p,h=o[2];n>3?(i=h===r)&&(s=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(c=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,c=0))}if(i||n>1)return a;throw f=!0,r}return function(i,u,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===u&&d(u,h),c=u,s=h;(t=c<2?e:s)||!f;){o||(c?c<3?(c>1&&(p.n=-1),d(c,s)):p.n=s:p.v=s);try{if(l=2,o){if(c||(i="next"),t=o[i]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=o.return)&&t.call(o),c<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),c=1);o=e}else if((t=(f=p.n<0)?s:n.call(r,p))!==a)break}catch(t){o=e,c=1,s=t}finally{l=1}}return{value:t,done:f}}}(n,i,o),!0),l}var a={};function c(){}function s(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(Qt(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Qt(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,Qt(f,"constructor",l),Qt(l,"constructor",s),s.displayName="GeneratorFunction",Qt(l,i,"GeneratorFunction"),Qt(f),Qt(f,i,"Generator"),Qt(f,r,function(){return this}),Qt(f,"toString",function(){return"[object Generator]"}),(Ht=function(){return{w:o,m:p}})()}function Qt(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}Qt=function(e,t,n,r){function o(t,n){Qt(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Qt(e,t,n,r)}function Kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Kt(Object(n),!0).forEach(function(t){Xt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xt(e,t,n){return(t=function(e){var t=function(e){if("object"!=zt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=zt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==zt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zt(e,t,n,r,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,i)}var Yt,en,tn,nn,rn,on,an=new Map,cn=new Map,sn=function(){var e,t=(e=Ht().m(function e(t,n){var r,i;return Ht().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}throw new Error("Namespace is required");case 1:if(!an.has(t)){e.n=2;break}return console.log("Script already loaded for namespace: ".concat(t)),e.a(2,an.get(t));case 2:if(!cn.has(t)){e.n=3;break}return console.log("Script loading in progress for namespace: ".concat(t)),e.a(2,cn.get(t));case 3:return r=Jt(Jt({},Ut(n)),{},{"data-namespace":t}),i=new Promise(function(e,n){At(r).then(function(n){qt.setPaypal(n),an.set(t,n),console.log("Script loaded for namespace: ".concat(t)),e(n)}).catch(function(e){console.error("Failed to load script for namespace: ".concat(t),e),n(e)}).finally(function(){cn.delete(t)})}),cn.set(t,i),e.a(2,i)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){Zt(o,r,i,a,c,"next",e)}function c(e){Zt(o,r,i,a,c,"throw",e)}a(void 0)})});return function(_x,e){return t.apply(this,arguments)}}();function ln(e){return ln="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ln(e)}function un(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var s=r&&r.prototype instanceof c?r:c,l=Object.create(s.prototype);return fn(l,"_invoke",function(n,r,i){var o,c,s,l=0,u=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,c=0,s=e,p.n=n,a}};function d(n,r){for(c=n,s=r,t=0;!f&&l&&!i&&t<u.length;t++){var i,o=u[t],d=p.p,h=o[2];n>3?(i=h===r)&&(s=o[(c=o[4])?5:(c=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(c=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,c=0))}if(i||n>1)return a;throw f=!0,r}return function(i,u,h){if(l>1)throw TypeError("Generator is already running");for(f&&1===u&&d(u,h),c=u,s=h;(t=c<2?e:s)||!f;){o||(c?c<3?(c>1&&(p.n=-1),d(c,s)):p.n=s:p.v=s);try{if(l=2,o){if(c||(i="next"),t=o[i]){if(!(t=t.call(o,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,c<2&&(c=0)}else 1===c&&(t=o.return)&&t.call(o),c<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),c=1);o=e}else if((t=(f=p.n<0)?s:n.call(r,p))!==a)break}catch(t){o=e,c=1,s=t}finally{l=1}}return{value:t,done:f}}}(n,i,o),!0),l}var a={};function c(){}function s(){}function l(){}t=Object.getPrototypeOf;var u=[][r]?t(t([][r]())):(fn(t={},r,function(){return this}),t),f=l.prototype=c.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,fn(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return s.prototype=l,fn(f,"constructor",l),fn(l,"constructor",s),s.displayName="GeneratorFunction",fn(l,i,"GeneratorFunction"),fn(f),fn(f,i,"Generator"),fn(f,r,function(){return this}),fn(f,"toString",function(){return"[object Generator]"}),(un=function(){return{w:o,m:p}})()}function fn(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}fn=function(e,t,n,r){function o(t,n){fn(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},fn(e,t,n,r)}function pn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function dn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pn(Object(n),!0).forEach(function(t){hn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function hn(e,t,n){return(t=function(e){var t=function(e){if("object"!=ln(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ln(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ln(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mn(e,t,n,r,i,o,a){try{var c=e[o](a),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,i)}function yn(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){mn(o,r,i,a,c,"next",e)}function c(e){mn(o,r,i,a,c,"throw",e)}a(void 0)})}}Yt={axoConfig:window.wc_ppcp_axo,ppcpConfig:window.PayPalCommerceGateway},en=Yt.axoConfig,tn=Yt.ppcpConfig,nn="ppcpPaypalClassicAxo",rn=function(){new Ct(nn,en,tn)},on=function(){return Boolean(re())},document.addEventListener("DOMContentLoaded",yn(un().m(function e(){var t,n;return un().w(function(e){for(;;)switch(e.n){case 0:if(!on()){e.n=1;break}return rn(),e.a(2);case 1:if("undefined"!=typeof PayPalCommerceGateway){e.n=2;break}return console.error("AXO could not be configured."),e.a(2);case 2:return e.n=3,fetch(en.ajax.axo_script_attributes.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:en.ajax.axo_script_attributes.nonce})});case 3:return t=e.v,e.n=4,t.json();case 4:if((n=e.v).success){e.n=5;break}throw new Error(n.data.message);case 5:sn(nn,dn(dn({},tn),{},{script_attributes:dn(dn({},tn.script_attributes),{},{"data-sdk-client-token":n.data.sdk_client_token})})).then(function(){rn()}).catch(function(e){pe("Failed to load PayPal script: ".concat(e),"error")});case 6:return e.a(2)}},e)})))})();
Save File
Cancel