File: //home/shrsglobal/www/wp-content/plugins/woocommerce-paypal-payments/assets/ppcp-axo-js-boot.js
(()=>{"use strict";var e={580:e=>{var t=/["'&<>]/;e.exports=function(e){var n,i=""+e,r=t.exec(i);if(!r)return i;var a="",o=0,s=0;for(o=r.index;o<i.length;o++){switch(i.charCodeAt(o)){case 34:n=""";break;case 38:n="&";break;case 39:n="'";break;case 60:n="<";break;case 62:n=">";break;default:continue}s!==o&&(a+=i.substring(s,o)),s=o+1,a+=n}return s!==o?a+i.substring(s,o):a}},4744:e=>{var t=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===n}(e)}(e)},n="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 r(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 o(e,t){try{return t in e}catch(e){return!1}}function s(e,n,l){(l=l||{}).arrayMerge=l.arrayMerge||r,l.isMergeableObject=l.isMergeableObject||t,l.cloneUnlessOtherwiseSpecified=i;var c=Array.isArray(n);return c===Array.isArray(e)?c?l.arrayMerge(e,n,l):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(a){(function(e,t){return o(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,a)||(o(e,a)&&n.isMergeableObject(t[a])?r[a]=function(e,t){if(!t.customMerge)return s;var n=t.customMerge(e);return"function"==typeof n?n:s}(a,n)(e[a],t[a],n):r[a]=i(t[a],n))}),r}(e,n,l):i(n,l)}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}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}function i(e){return i="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},i(e)}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,a(i.key),i)}}function a(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o=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=this;return new Promise(function(n,i){window[t.namespace]?window[t.namespace].Fastlane(e).then(function(e){t.init(e),n()}).catch(function(e){console.error(e),i(e)}):i(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)}}])&&r(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();const s=o;function l(e){var t,n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",a=null===(t=window.wc_ppcp_axo)||void 0===t?void 0:t.wp_debug,o=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,s=null===(i=window.wc_ppcp_axo)||void 0===i?void 0:i.logging_enabled;if(a)switch(r){case"error":console.error("[AXO] ".concat(e));break;case"warn":console.warn("[AXO] ".concat(e));break;default:console.log("[AXO] ".concat(e))}o&&s&&fetch(o,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:window.wc_ppcp_axo.ajax.frontend_logger.nonce,log:{message:e,level:r}})})}function c(e){return c="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},c(e)}function u(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,d(i.key),i)}}function d(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}const p=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)}}])&&u(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function f(e){return f="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},f(e)}function h(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,v(i.key),i)}}function m(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e){var t=function(e){if("object"!=f(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==f(t)?t:t+""}const y=m(function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.gatewayRadioButton=new p({selector:"#payment_method_ppcp-axo-gateway"}),this.gatewayDescription=new p({selector:".payment_box.payment_method_ppcp-axo-gateway"}),this.defaultSubmitButton=new p({selector:"#place_order"}),this.paymentContainer=new p({id:"ppcp-axo-payment-container",selector:"#ppcp-axo-payment-container",className:"ppcp-axo-payment-container"}),this.watermarkContainer=new p({id:"ppcp-axo-watermark-container",selector:"#ppcp-axo-watermark-container",className:"ppcp-axo-watermark-container ppcp-axo-watermark-loading loader"}),this.customerDetails=new p({selector:"#customer_details > *:not(#ppcp-axo-customer-details)"}),this.axoCustomerDetails=new p({id:"ppcp-axo-customer-details",selector:"#ppcp-axo-customer-details",className:"ppcp-axo-customer-details",anchorSelector:"#customer_details"}),this.emailWidgetContainer=new p({id:"ppcp-axo-email-widget",selector:"#ppcp-axo-email-widget",className:"ppcp-axo-email-widget"}),this.shippingAddressContainer=new p({id:"ppcp-axo-shipping-address-container",selector:"#ppcp-axo-shipping-address-container",className:"ppcp-axo-shipping-address-container"}),this.billingAddressContainer=new p({id:"ppcp-axo-billing-address-container",selector:"#ppcp-axo-billing-address-container",className:"ppcp-axo-billing-address-container"}),this.fieldBillingEmail=new p({selector:"#billing_email_field"}),this.billingEmailFieldWrapper=new p({id:"ppcp-axo-billing-email-field-wrapper",selector:"#ppcp-axo-billing-email-field-wrapper"}),this.billingEmailSubmitButton=new p({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 p({id:"ppcp-axo-billing-email-submit-button-spinner",selector:"#ppcp-axo-billing-email-submit-button-spinner",className:"loader ppcp-axo-overlay"}),this.submitButtonContainer=new p({selector:"#ppcp-axo-submit-button-container"}),this.submitButton=new p({selector:"#ppcp-axo-submit-button-container button"}),this.changeShippingAddressLink=new p({selector:"*[data-ppcp-axo-change-shipping-address]",attributes:"data-ppcp-axo-change-shipping-address"}),this.changeBillingAddressLink=new p({selector:"*[data-ppcp-axo-change-billing-address]",attributes:"data-ppcp-axo-change-billing-address"}),this.changeCardLink=new p({selector:"*[data-ppcp-axo-change-card]",attributes:"data-ppcp-axo-change-card"}),this.showGatewaySelectionLink=new p({selector:"*[data-ppcp-axo-show-gateway-selection]",attributes:"data-ppcp-axo-show-gateway-selection"}),this.axoNonceInput=new p({id:"ppcp-axo-nonce",selector:"#ppcp-axo-nonce"})});var b=n(580),g=n.n(b);function w(e){return w="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},w(e)}function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach(function(t){P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function P(e,t,n){return(t=j(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(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 i,r,a,o,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _(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)?_(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 _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function C(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,j(i.key),i)}}function j(e){var t=function(e){if("object"!=w(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=w(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==w(t)?t:t+""}function O(e,t,n){x(e,t),t.set(e,n)}function x(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function A(e,t){return e.get(N(e,t))}function F(e,t,n){return e.set(N(e,t),n),n}function N(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")}var D=new WeakMap,I=new WeakMap,B=new WeakMap,L=new WeakMap,T=new WeakMap,M=new WeakMap,q=new WeakMap,V=new WeakSet,W=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),x(this,n=V),n.add(this),O(this,D,void 0),O(this,I,{}),O(this,B,!1),O(this,L,void 0),O(this,T,void 0),O(this,M,{}),O(this,q,void 0),F(L,this,t.baseSelector),F(T,this,t.contentSelector),F(M,this,t.fields||{}),F(q,this,t.template),F(D,this,new Map)},(t=[{key:"isActive",value:function(){return A(B,this)}},{key:"setData",value:function(e){F(I,this,e),this.refresh()}},{key:"dataValue",value:function(e){if(!e||!A(M,this)[e])return"";if("function"==typeof A(M,this)[e].valueCallback){var t=A(M,this)[e].valueCallback(A(I,this));return N(V,this,G).call(this,t)}var n=A(M,this)[e].valuePath;if(!n)return"";var i=n.split(".").reduce(function(e,t){return e&&void 0!==e[t]?e[t]:void 0},A(I,this));return N(V,this,G).call(this,i)}},{key:"activate",value:function(){F(B,this,!0),this.storeFormData(),this.refresh()}},{key:"deactivate",value:function(){F(B,this,!1),this.restoreFormData(),this.refresh()}},{key:"toggle",value:function(){A(B,this)?this.deactivate():this.activate()}},{key:"refresh",value:function(){var e=this,t=document.querySelector(A(T,this));t&&(t.innerHTML="",A(B,this)?this.showField(A(T,this)):this.hideField(A(T,this)),this.loopFields(function(t){var n=t.selector;A(B,e)?e.hideField(n):e.showField(n)}),"function"==typeof A(q,this)&&(t.innerHTML=A(q,this).call(this,{value:function(t){return e.dataValue(t)},isEmpty:function(){var t=!0;return e.loopFields(function(n,i){if(e.dataValue(i))return t=!1,!1}),t}})))}},{key:"loopFields",value:function(e){for(var t=0,n=Object.entries(A(M,this));t<n.length;t++){var i=E(n[t],2),r=i[0],a=i[1],o=a.selector,s=a.inputName,l="".concat(o,' [name="').concat(s,'"]');e(k({inputSelector:s?l:""},a),r)}}},{key:"storeFormData",value:function(){var e=this;this.loopFields(function(t,n){var i,r,a=t.inputSelector;if(a&&!A(D,e).has(n)){var o=document.querySelector(a);o&&(r=n,"checkbox"===(i=o).type||"radio"===i.type?(A(D,e).set(r,i.checked),N(V,e,R).call(e,i,e.dataValue(r))):(A(D,e).set(r,i.value),N(V,e,R).call(e,i,"")))}})}},{key:"restoreFormData",value:function(){var e=this,t=!1;this.loopFields(function(n,i){var r=n.inputSelector;if(A(D,e).has(i)){var a=r?document.querySelector(r):null,o=A(D,e).get(i);A(D,e).delete(i),N(V,e,R).call(e,a,o)&&(t=!0)}}),t&&document.body.dispatchEvent(new Event("update_checkout"))}},{key:"syncDataToForm",value:function(){var e=this;if(A(B,this)){var t=!1;this.loopFields(function(n,i){var r=n.inputSelector,a=r?document.querySelector(r):null;N(V,e,R).call(e,a,e.dataValue(i))&&(t=!0)}),t&&document.body.dispatchEvent(new Event("update_checkout"))}}},{key:"showField",value:function(e){var t=document.querySelector(A(L,this)+" "+e);t&&t.classList.remove("ppcp-axo-field-hidden")}},{key:"hideField",value:function(e){var t=document.querySelector(A(L,this)+" "+e);t&&t.classList.add("ppcp-axo-field-hidden")}},{key:"inputElement",value:function(e){var t=A(M,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,i){if(!n.valuePath||!n.selector)return!0;var r=t.inputElement(i);if(!r)return!0;e[r.name]=t.dataValue(i)})}}])&&C(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function G(e){if(null==e)return"";var t=String(e);return g()(t)}function R(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 $=W;function U(e){return U="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},U(e)}function z(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,H(i.key),i)}}function H(e){var t=function(e){if("object"!=U(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=U(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==U(t)?t:t+""}const Q=function(){return e=function e(t,n,i){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.states=i,this.group=new $({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(r.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"),i=r.states[t]&&r.states[t][n]?r.states[t][n]:n;return r.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(r.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(r.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(i?", "+i:""," ").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 i=n.querySelector('option[value="'.concat(t,'"]'));return i?i.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,i="",r=null==e||null===(t=e.shipping)||void 0===t||null===(t=t.phoneNumber)||void 0===t?void 0:t.countryCode,a=null==e||null===(n=e.shipping)||void 0===n||null===(n=n.phoneNumber)||void 0===n?void 0:n.nationalNumber;return r&&(i="+".concat(r," ")),i+a}}}})},(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)}}])&&z(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function J(e){return J="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},J(e)}function X(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,K(i.key),i)}}function K(e){var t=function(e){if("object"!=J(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=J(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==J(t)?t:t+""}const Z=function(){return e=function e(t,n){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.group=new $({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(i.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)}}])&&X(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function Y(e){return Y="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},Y(e)}function ee(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,te(i.key),i)}}function te(e){var t=function(e){if("object"!=Y(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Y(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Y(t)?t:t+""}const ne=function(){return e=function e(t,n,i){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.manager=i,this.group=new $({baseSelector:".ppcp-axo-payment-container",contentSelector:t,template:function(e){var t=function(){return r.manager.hideGatewaySelection?'<p style="margin-top: 40px; text-align: center;"><a href="javascript:void(0)" '.concat(r.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(r.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),i=n.firstName,r=n.lastName;return e.billing_first_name=i,e.billing_last_name=r||i,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]:""}}}])&&ee(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();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 re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function ae(e,t,n){return(t=se(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oe(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,se(i.key),i)}}function se(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+""}const le=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?re(Object(n),!0).forEach(function(t){ae(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(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"),l("Button set to processing state")):this.state.canSubmit?(e.removeAttribute("disabled"),null==t||t.classList.remove("loader","ppcp-axo-overlay"),e.classList.remove("processing"),l("Button set to ready state")):(e.setAttribute("disabled","disabled"),null==t||t.classList.remove("loader","ppcp-axo-overlay"),e.classList.remove("processing"),l("Button set to disabled state"))}else l("Submit button not found, skipping UI update","warn")}},{key:"setProcessing",value:function(){this.state.isProcessing=!0,this.state.canSubmit=!1,this.updateButtonUI(),l("Button state changed to: processing")}},{key:"setReady",value:function(){this.state.isProcessing=!1,this.state.canSubmit=!0,this.updateButtonUI(),l("Button state changed to: ready")}},{key:"setDisabled",value:function(){this.state.isProcessing=!1,this.state.canSubmit=!1,this.updateButtonUI(),l("Button state changed to: disabled")}},{key:"shouldProcessEmail",value:function(e,t){var n=!this.state.isProcessing&&this.state.lastProcessedEmail!==e&&e&&t(e);return l("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 l("shouldAllowRetry: ".concat(n," (processing: ").concat(this.state.isProcessing,", email: ").concat(e,")")),n}},{key:"markEmailAsProcessing",value:function(e){this.state.lastProcessedEmail=e,this.setProcessing(),l("Email marked as processing: ".concat(e))}},{key:"clearLastProcessedEmail",value:function(){var e=this.state.lastProcessedEmail;this.state.lastProcessedEmail=null,l("Cleared last processed email: ".concat(e))}},{key:"handleAuthFailureOrCancellation",value:function(){var e=this;l("Handling auth failure/cancellation - allowing retry"),this.clearLastProcessedEmail(),this.setReady(),setTimeout(function(){e.updateButtonUI(),l("Forced button UI update after cancellation")},100)}},{key:"handleEmailLookupFailure",value:function(){l("Handling email lookup failure - disabling button"),this.clearLastProcessedEmail(),this.setDisabled()}},{key:"handleSuccess",value:function(){l("Handling successful processing"),this.setReady()}},{key:"reset",value:function(){this.state={isProcessing:!1,canSubmit:!1,lastProcessedEmail:null},this.updateButtonUI(),l("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&&oe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function ce(e){return ce="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},ce(e)}function ue(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,de(i.key),i)}}function de(e){var t=function(e){if("object"!=ce(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ce(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ce(t)?t:t+""}const pe=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:"track",value:function(t,n){e.init(),paypalInsight("event",t,n)}},{key:"config",value:function(t,n){e.init(),paypalInsight("config",t,n)}},{key:"setSessionId",value:function(t){e.init(),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&&ue(t.prototype,null),n&&ue(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n}();var fe=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=function(e){return"string"==typeof e?document.querySelector(e):e}(e);i&&(t?(jQuery(i).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,i)):(jQuery(i).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,i)))},he=function(){var e=document.querySelector('input[name="payment_method"]:checked');return e?e.value:null};function me(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function ve(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function a(n,i,r,a){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return ye(c,"_invoke",function(n,i,r){var a,s,l,c=0,u=r||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return a=t,s=0,l=e,p.n=n,o}};function f(n,i){for(s=n,l=i,t=0;!d&&c&&!r&&t<u.length;t++){var r,a=u[t],f=p.p,h=a[2];n>3?(r=h===i)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=f&&((r=n<2&&f<a[1])?(s=0,p.v=i,p.n=a[1]):f<h&&(r=n<3||a[0]>i||i>h)&&(a[4]=n,a[5]=i,p.n=h,s=0))}if(r||n>1)return o;throw d=!0,i}return function(r,u,h){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,h),s=u,l=h;(t=s<2?e:l)||!d;){a||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,a){if(s||(r="next"),t=a[r]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),s=1);a=e}else if((t=(d=p.n<0)?l:n.call(i,p))!==o)break}catch(t){a=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,r,a),!0),c}var o={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(ye(t={},i,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,ye(e,r,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,ye(d,"constructor",c),ye(c,"constructor",l),l.displayName="GeneratorFunction",ye(c,r,"GeneratorFunction"),ye(d),ye(d,r,"Generator"),ye(d,i,function(){return this}),ye(d,"toString",function(){return"[object Generator]"}),(ve=function(){return{w:a,m:p}})()}function ye(e,t,n,i){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}ye=function(e,t,n,i){function a(t,n){ye(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},ye(e,t,n,i)}function be(e,t,n,i,r,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,r)}function ge(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var a=e.apply(t,n);function o(e){be(a,i,r,o,s,"next",e)}function s(e){be(a,i,r,o,s,"throw",e)}o(void 0)})}}function we(e){return we="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},we(e)}function Se(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Pe(i.key),i)}}function ke(e,t,n){return(t=Pe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pe(e){var t=function(e){if("object"!=we(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=we(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==we(t)?t:t+""}var Ee=function(){return e=function e(t,n,i){var r,a,o,l,c,u,d=this;(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")})(this,e),ke(this,"axoConfig",null),ke(this,"ppcpConfig",null),ke(this,"$",null),ke(this,"fastlane",null),ke(this,"cardComponent",null),ke(this,"initialized",!1),ke(this,"hideGatewaySelection",!1),ke(this,"phoneNumber",null),ke(this,"data",{}),ke(this,"status",{}),ke(this,"styles",{}),ke(this,"locale","en_us"),ke(this,"el",null),ke(this,"emailInput",null),ke(this,"phoneInput",null),ke(this,"shippingView",null),ke(this,"billingView",null),ke(this,"cardView",null),ke(this,"deleteKeysWithEmptyString",function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var i=n[t];""===e[i]?delete e[i]:"object"===we(e[i])&&(e[i]=d.deleteKeysWithEmptyString(e[i]),0===Object.keys(e[i]).length&&delete e[i])}return Array.isArray(e)?e.filter(function(e){return e}):e}),this.namespace=t,this.axoConfig=n,this.ppcpConfig=i,this.fastlane=new s(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 y,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 Q(this.el.shippingAddressContainer.selector,this.el,this.states),this.billingView=new Z(this.el.billingAddressContainer.selector,this.el),this.cardView=new ne(this.el.paymentContainer.selector+"-details",this.el,this),document.axoDebugSetStatus=function(e,t){d.setStatus(e,t)},document.axoDebugObject=function(){return d},null!==(r=this.axoConfig)&&void 0!==r&&null!==(r=r.insights)&&void 0!==r&&r.enabled&&null!==(a=this.axoConfig)&&void 0!==a&&null!==(a=a.insights)&&void 0!==a&&a.client_id&&null!==(o=this.axoConfig)&&void 0!==o&&null!==(o=o.insights)&&void 0!==o&&o.session_id&&(pe.config(null===(l=this.axoConfig)||void 0===l||null===(l=l.insights)||void 0===l?void 0:l.client_id,{debug:"1"===(null==n?void 0:n.wp_debug)}),pe.setSessionId(null===(c=this.axoConfig)||void 0===c||null===(c=c.insights)||void 0===c?void 0:c.session_id),pe.trackJsLoad(),document.querySelector(".woocommerce-checkout")&&pe.trackBeginCheckout({amount:null===(u=this.axoConfig)||void 0===u||null===(u=u.insights)||void 0===u?void 0:u.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:"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 i;n!==e.target.value&&(pe.trackSelectPaymentMethod({payment_method_selected:(null===(i=t.axoConfig)||void 0===i||null===(i=i.insights)||void 0===i?void 0:i.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",ge(ve().m(function e(){var n,i,r;return ve().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,i=n.selectionChanged,r=n.selectedAddress,i&&(t.setShipping(r),t.shippingView.refresh());case 2:return e.a(2)}},e)}))),this.el.changeBillingAddressLink.on("click",ge(ve().m(function e(){return ve().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",ge(ve().m(function e(){var n;return ve().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",ge(ve().m(function e(){return ve().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,i,r,a;null!==(n=t.buttonStateManager)&&void 0!==n&&n.isProcessing()||(null===(i=t.buttonStateManager)||void 0===i||i.clearLastProcessedEmail(),null!==(r=t.emailInput)&&void 0!==r&&r.value&&t.validateEmailFormat(t.emailInput.value)&&(null===(a=t.buttonStateManager)||void 0===a||a.setReady()))}),document.addEventListener("axo_status_updated",function(e){var t=document.querySelector("[name='terms-field']");if(t){var n=e.detail,i=n.active&&!1===n.validEmail&&!1===n.hasProfile;t.parentElement.style.display=i?"none":"block"}})}},{key:"rerender",value:function(){var e=this.identifyScenario(this.status.active,this.status.validEmail,this.status.hasProfile);l("Scenario: ".concat(JSON.stringify(e))),this.el.watermarkContainer.hide(),e.defaultSubmitButton?(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()}},{key:"identifyScenario",value:function(e,t,n){var i={defaultSubmitButton:!1,defaultEmailField:!1,defaultFormFields:!1,extraFormFields:!1,axoEmailField:!1,axoProfileViews:!1,axoPaymentContainer:!1,axoSubmitButton:!1};if(e&&t&&n)return i.extraFormFields=!0,i.axoProfileViews=!0,i.axoPaymentContainer=!0,i.axoSubmitButton=!0,i;if(e&&t&&!n)return i.defaultFormFields=!0,i.axoEmailField=!0,i.axoPaymentContainer=!0,i.axoSubmitButton=!0,i;if(e&&!t)return i.axoEmailField=!0,i;if(!e)return i.defaultSubmitButton=!0,i.defaultEmailField=!0,i.defaultFormFields=!0,i;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");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,l("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(),l("Attempt on activation - emailInput: ".concat(this.emailInput.value)),"1"===new URLSearchParams(window.location.search).get("ppcp_fastlane_error"))l("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 i=this.el.shippingAddressContainer;document.querySelector(i.selector)||t.insertAdjacentHTML("beforeend",'\n <div id="'.concat(i.id,'" class="').concat(i.className,'"></div>\n '));var r=this.el.billingEmailFieldWrapper;document.querySelector(r.selector)||document.querySelector("#billing_email_field .woocommerce-input-wrapper").insertAdjacentHTML("afterend",'\n <div id="'.concat(r.id,'"></div>\n '));var a=this.el.watermarkContainer;document.querySelector(a.selector)||document.querySelector(r.selector).insertAdjacentHTML("beforeend",'\n <div class="'.concat(a.className,'" id="').concat(a.id,'"></div>\n '));var o=this.el.paymentContainer;if(document.querySelector(o.selector)||document.querySelector(".payment_method_ppcp-axo-gateway").insertAdjacentHTML("beforeend",'\n <div id="'.concat(o.id,'" class="').concat(o.className,' axo-hidden">\n <div id="').concat(o.id,'-form" class="').concat(o.className,'-form"></div>\n <div id="').concat(o.id,'-details" class="').concat(o.className,'-details"></div>\n </div>\n ')),this.useEmailWidget()){var s=this.el.emailWidgetContainer;document.querySelector(s.selector)||t.insertAdjacentHTML("afterbegin",'\n <div id="'.concat(s.id,'" class="').concat(s.className,'">\n --- EMAIL WIDGET PLACEHOLDER ---\n </div>\n '))}else{var l=document.querySelector(this.el.fieldBillingEmail.selector);t.prepend(l),document.querySelector(this.el.billingEmailFieldWrapper.selector).prepend(document.querySelector("#billing_email_field .woocommerce-input-wrapper"))}}},{key:"initButtonStateManager",value:function(){this.buttonStateManager||(this.buttonStateManager=new le(this.el.billingEmailSubmitButton.selector,this.el.billingEmailSubmitButtonSpinner.selector),l("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=ge(ve().m(function t(n){var i;return ve().w(function(t){for(;;)switch(t.n){case 0:if("Enter"!==n.key||"ppcp-axo-gateway"!==he()){t.n=2;break}if(n.preventDefault(),n.stopPropagation(),l("Enter key on email field - value: ".concat(e.emailInput.value)),e.validateEmail(e.el.fieldBillingEmail.selector),!e.emailInput||null===(i=e.buttonStateManager)||void 0===i||!i.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=ge(ve().m(function t(n){var i;return ve().w(function(t){for(;;)switch(t.n){case 0:if(n.preventDefault(),l("Submit button clicked - email: ".concat(e.emailInput.value)),!e.emailInput||null===(i=e.buttonStateManager)||void 0===i||!i.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:(m=ge(ve().m(function e(){return ve().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 m.apply(this,arguments)})},{key:"connect",value:(h=ge(ve().m(function e(){return ve().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 h.apply(this,arguments)})},{key:"triggerGatewayChange",value:function(){this.el.gatewayRadioButton.trigger("change")}},{key:"renderWatermark",value:(f=ge(ve().m(function e(){var t,n=arguments;return ve().w(function(e){for(;;)switch(e.n){case 0:return t=!(n.length>0&&void 0!==n[0])||n[0],e.n=1,this.fastlane.FastlaneWatermarkComponent({includeAdditionalInfo:t});case 1:e.v.render(this.el.watermarkContainer.selector),this.toggleWatermarkLoading(this.el.watermarkContainer,"ppcp-axo-watermark-loading","loader");case 2: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"),i=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 r=document.querySelector(e.selector);n.insertBefore(r,i),r.offsetHeight,r.classList.remove("ppcp-axo-billing-email-submit-button-hidden"),r.classList.add("ppcp-axo-billing-email-submit-button-loaded")}}},{key:"watchEmail",value:function(){var e=this;this.useEmailWidget()||(this.emailInput.addEventListener("change",ge(ve().m(function t(){var n;return ve().w(function(t){for(;;)switch(t.n){case 0:l("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)}))),l("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:(p=ge(ve().m(function e(){var t,n,i,r,a,o;return ve().w(function(e){for(;;)switch(e.p=e.n){case 0:if(this.status.active){e.n=1;break}return l("Email checking skipped, AXO not active."),e.a(2);case 1:if(this.emailInput){e.n=2;break}return l("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 l("Email processing skipped - already processing or same email"),e.a(2);case 3:if(l("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 l("The email address is not valid."),null===(i=this.buttonStateManager)||void 0===i||i.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 l("Not initialized."),null===(r=this.buttonStateManager)||void 0===r||r.setDisabled(),e.a(2);case 5:return pe.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,o=e.v,l("Email lookup failed: ".concat(o.message),"error"),null===(a=this.buttonStateManager)||void 0===a||a.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 p.apply(this,arguments)})},{key:"onChangePhone",value:(d=ge(ve().m(function e(){return ve().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 d.apply(this,arguments)})},{key:"lookupCustomerByEmail",value:(u=ge(ve().m(function e(){var t,n,i,r,a,o,s;return ve().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,l("lookupCustomerByEmail: ".concat(JSON.stringify(t))),!t.customerContextId){e.n=7;break}return l("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,l("AuthResponse - triggerAuthenticationFlow: ".concat(JSON.stringify(n))),"succeeded"!==n.authenticationState){e.n=4;break}return e.n=3,this.handleSuccessfulAuth(n);case 3:null===(i=this.buttonStateManager)||void 0===i||i.handleSuccess(),e.n=6;break;case 4:return l("Authentication Failed or Canceled"),e.n=5,this.handleFailedAuth();case 5:null===(r=this.buttonStateManager)||void 0===r||r.handleAuthFailureOrCancellation();case 6:e.n=9;break;case 7:return l("No profile found with this email address."),e.n=8,this.handleGuestCustomer();case 8:null===(a=this.buttonStateManager)||void 0===a||a.handleSuccess();case 9:e.n=11;break;case 10:throw e.p=10,s=e.v,l("lookupCustomerByEmail error: ".concat(s.message),"error"),null===(o=this.buttonStateManager)||void 0===o||o.handleEmailLookupFailure(),s;case 11:return e.a(2)}},e,this,[[0,10]])})),function(){return u.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){l("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),l("Ryan flow - submitted nonce: ".concat(this.data.card.id)),this.submit(this.data.card.id,t)}else{l("Starting Gary flow.");try{this.cardComponent.getPaymentToken(this.tokenizeData()).then(function(t){l("Gary flow - submitted nonce: ".concat(t.id)),e.submit(t.id)})}catch(e){alert("Error tokenizing data."),l("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=ge(ve().m(function e(){var t,n;return ve().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:(o=ge(ve().m(function e(){var t,n,i;return ve().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,i=Object.keys(n).reduce(function(e,t){return n[t].hasOwnProperty("prefill")&&(e[t]=n[t].prefill),e},{}),e.a(2,this.cardComponent.updatePrefills(i))}},e,this)})),function(){return o.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 i=document.querySelector("form.woocommerce-checkout"),r=new FormData(i);this.showLoading(),Object.keys(t).forEach(function(e){r.set(e,t[e])}),r.set("fastlane_member",!0),fetch(wc_checkout_params.checkout_url,{method:"POST",body:r}).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 l("Error sending checkout form. ".concat(e),"error"),void n.hideLoading()}e.redirect&&(window.location.href=e.redirect)}).catch(function(e){l("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){fe(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(),fe(".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"]),i=new Set((this.axoConfig.disable_cards||[]).map(function(e){return e.toUpperCase()}));return function(e){return function(e){if(Array.isArray(e))return me(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 me(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)?me(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!i.has(e)})}},{key:"ensureBillingPhoneNumber",value:function(e){if(""===e.billing_phone){var t,n,i="",r=null===(t=this.data.shipping)||void 0===t||null===(t=t.phoneNumber)||void 0===t?void 0:t.countryCode,a=null===(n=this.data.shipping)||void 0===n||null===(n=n.phoneNumber)||void 0===n?void 0:n.nationalNumber;r&&(i="+".concat(r," ")),i+=a,e.billing_phone=i}}},{key:"toggleLoaderAndOverlay",value:function(e,t,n){var i=document.querySelector("".concat(e.selector," .").concat(t)),r=document.querySelector("".concat(e.selector," .").concat(n));i&&i.classList.toggle(t),r&&r.classList.toggle(n)}},{key:"spinnerToggleLoaderAndOverlay",value:function(e,t,n){var i=document.querySelector("".concat(e.selector));i&&(i.classList.toggle(t),i.classList.toggle(n))}},{key:"toggleWatermarkLoading",value:function(e,t,n){var i=document.querySelector("".concat(e.selector,".").concat(t)),r=document.querySelector("".concat(e.selector,".").concat(n));i&&i.classList.toggle(t),r&&r.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,i,r;null!==(n=e.buttonStateManager)&&void 0!==n&&n.isProcessing()||null===(i=e.emailInput)||void 0===i||!i.value||!e.validateEmailFormat(e.emailInput.value)||null===(r=e.buttonStateManager)||void 0===r||r.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:(a=ge(ve().m(function e(){var t,n,i,r,a,o,s,c,u,d;return ve().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===(i=this.emailInput)||void 0===i||!i.value){e.n=12;break}return l("Restoring Fastlane session for email: ".concat(this.emailInput.value)),null===(r=this.buttonStateManager)||void 0===r||r.markEmailAsProcessing(this.emailInput.value),e.n=4,this.fastlane.identity.lookupCustomerByEmail(this.emailInput.value);case 4:if(null==(a=e.v)||!a.customerContextId){e.n=10;break}return e.n=5,this.fastlane.identity.triggerAuthenticationFlow(a.customerContextId);case 5:if("succeeded"!==(null==(o=e.v)?void 0:o.authenticationState)){e.n=7;break}return e.n=6,this.handleSuccessfulAuth(o);case 6:null===(s=this.buttonStateManager)||void 0===s||s.handleSuccess(),l("Fastlane session successfully restored"),e.n=9;break;case 7:return e.n=8,this.handleFailedAuth();case 8:null===(c=this.buttonStateManager)||void 0===c||c.handleAuthFailureOrCancellation();case 9:e.n=12;break;case 10:return e.n=11,this.handleGuestCustomer();case 11:null===(u=this.buttonStateManager)||void 0===u||u.handleSuccess();case 12:e.n=14;break;case 13:e.p=13,e.v,l("Failed to restore Fastlane session","warn"),l("Fastlane session restoration error:","error"),null===(d=this.buttonStateManager)||void 0===d||d.handleEmailLookupFailure();case 14:return e.a(2)}},e,this,[[3,13]])})),function(){return a.apply(this,arguments)})},{key:"handleSuccessfulAuth",value:(r=ge(ve().m(function e(t){var n,i,r,a,o,s,l;return ve().w(function(e){for(;;)switch(e.n){case 0:if((i=t.profileData.shippingAddress)&&this.setShipping(i),!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(r=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),s={address:r},(l=null!==(a=null===(o=t.profileData)||void 0===o||null===(o=o.shippingAddress)||void 0===o||null===(o=o.phoneNumber)||void 0===o?void 0:o.nationalNumber)&&void 0!==a?a:"")&&(s.phoneNumber=l),this.setBilling(s)),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 r.apply(this,arguments)})},{key:"handleFailedAuth",value:(i=ge(ve().m(function e(){return ve().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 i.apply(this,arguments)})},{key:"handleGuestCustomer",value:(n=ge(ve().m(function e(){return ve().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&&Se(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,i,r,a,o,c,u,d,p,f,h,m}();const _e=Ee;function Ce(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 je(e,t){if(void 0===t&&(t=Promise),xe(e,t),"undefined"==typeof document)return t.resolve(null);var n=function(e){var t,n,i=e.sdkBaseUrl,r=e.environment,a=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(e,["sdkBaseUrl","environment"]),o=i||function(e){return"sandbox"===e?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}(r),s=a,l=Object.keys(s).filter(function(e){return void 0!==s[e]&&null!==s[e]&&""!==s[e]}).reduce(function(e,t){var n,i=s[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]=i:e.queryParams[t]=i,e},{queryParams:{},attributes:{}}),c=l.queryParams,u=l.attributes;return c["merchant-id"]&&-1!==c["merchant-id"].indexOf(",")&&(u["data-merchant-id"]=c["merchant-id"],c["merchant-id"]="*"),{url:"".concat(o,"?").concat((t=c,n="",Object.keys(t).forEach(function(e){0!==n.length&&(n+="&"),n+=e+"="+t[e]}),n)),attributes:u}}(e),i=n.url,r=n.attributes,a=r["data-namespace"]||"paypal",o=Oe(a);return r["data-js-sdk-library"]||(r["data-js-sdk-library"]="paypal-js"),function(e,t){var n=document.querySelector('script[src="'.concat(e,'"]'));if(null===n)return null;var i=Ce(e,t),r=n.cloneNode();if(delete r.dataset.uidAuto,Object.keys(r.dataset).length!==Object.keys(i.dataset).length)return null;var a=!0;return Object.keys(r.dataset).forEach(function(e){r.dataset[e]!==i.dataset[e]&&(a=!1)}),a?n:null}(i,r)&&o?t.resolve(o):function(e,t){void 0===t&&(t=Promise),xe(e,t);var n=e.url,i=e.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==i&&"object"!=typeof i)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,i=Ce(e.url,e.attributes);i.onerror=n,i.onload=t,document.head.insertBefore(i,document.head.firstElementChild)}({url:n,attributes:i,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:i,attributes:r},t).then(function(){var e=Oe(a);if(e)return e;throw new Error("The window.".concat(a," global variable is not available."))})}function Oe(e){return window[e]}function xe(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"==typeof SuppressedError&&SuppressedError;const Ae=function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;fetch(t.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.nonce})}).then(function(e){return e.json()}).then(function(r){var a;(function(e,t){return!(!e||e.user!==t||(new Date).getTime()>=1e3*e.expiration)})(r,t.user)&&(a=r,sessionStorage.setItem("ppcp-data-client-id",JSON.stringify(a)),e["data-client-token"]=r.token,je(e).then(function(e){"function"==typeof n&&n(e)}).catch(function(e){"function"==typeof i&&i(e)}))})};function Fe(e){return Fe="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},Fe(e)}function Ne(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 i,r,a,o,s=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=a.call(n)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw r}}return s}}(e,t)||Ie(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 De(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Ie(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,i=function(){};return{s:i,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:i}}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 r,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw r}}}}function Ie(e,t){if(e){if("string"==typeof e)return Be(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)?Be(e,t):void 0}}function Be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function Le(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,Te(i.key),i)}}function Te(e){var t=function(e){if("object"!=Fe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Fe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fe(t)?t:t+""}var Me=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),i=this.paypal.Buttons(n.options);if(i.isEligible()){var r=this.buildWrapperTarget(e);r&&(i.hasReturned()?i.resume():i.render(r))}else this.buttons.delete(t)}}},{key:"renderAllButtons",value:function(){var e,t=De(this.buttons);try{for(t.s();!(e=t.n()).done;){var n=Ne(e.value,1)[0];this.renderButtons(n)}}catch(e){t.e(e)}finally{t.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 i=this.paypal.Messages(n.options);i.render(n.wrapper),setTimeout(function(){t.hasRendered(e)||i.render(n.wrapper)},100)}}}},{key:"renderAllMessages",value:function(){var e,t=De(this.messages);try{for(t.s();!(e=t.n()).done;){var n=Ne(e.value,2),i=n[0];n[1],this.renderMessages(i)}}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,i=De(e.slice(1));try{for(i.s();!(n=i.n()).done;)t+=" .item-"+n.value}catch(e){i.e(e)}finally{i.f()}}var r=document.querySelector(t);return r&&r.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 i="item-"+e[1],r=n.find("."+i);r.length||(r=jQuery('<div class="'.concat(i,'"></div>')),n.append(r)),t=r.get(0)}return jQuery(t).length?t:null}},{key:"toKey",value:function(e){return Array.isArray(e)?JSON.stringify(e):e}}])&&Le(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();window.widgetBuilder=window.widgetBuilder||new Me;const qe=window.widgetBuilder;var Ve=n(4744),We=n.n(Ve),Ge=function(e){return e.replace(/([-_]\w)/g,function(e){return e[1].toUpperCase()})},Re=function(e){var t=function(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[Ge(n)]=e[n]);return t}(e.url_params);e.script_attributes&&(t=We()(t,e.script_attributes));var n=function(e){var t,n,i=null==e||null===(t=e.save_payment_methods)||void 0===t?void 0:t.id_token;return i&&!0===(null==e||null===(n=e.user)||void 0===n?void 0:n.is_logged)?{"data-user-id-token":i}:{}}(e);return We().all([t,n])};function $e(e){return $e="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},$e(e)}function Ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ue(Object(n),!0).forEach(function(t){He(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ue(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function He(e,t,n){return(t=function(e){var t=function(e){if("object"!=$e(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=$e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==$e(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qe(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function a(n,i,r,a){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return Je(c,"_invoke",function(n,i,r){var a,s,l,c=0,u=r||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return a=t,s=0,l=e,p.n=n,o}};function f(n,i){for(s=n,l=i,t=0;!d&&c&&!r&&t<u.length;t++){var r,a=u[t],f=p.p,h=a[2];n>3?(r=h===i)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=f&&((r=n<2&&f<a[1])?(s=0,p.v=i,p.n=a[1]):f<h&&(r=n<3||a[0]>i||i>h)&&(a[4]=n,a[5]=i,p.n=h,s=0))}if(r||n>1)return o;throw d=!0,i}return function(r,u,h){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,h),s=u,l=h;(t=s<2?e:l)||!d;){a||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,a){if(s||(r="next"),t=a[r]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),s=1);a=e}else if((t=(d=p.n<0)?l:n.call(i,p))!==o)break}catch(t){a=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,r,a),!0),c}var o={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(Je(t={},i,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,Je(e,r,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,Je(d,"constructor",c),Je(c,"constructor",l),l.displayName="GeneratorFunction",Je(c,r,"GeneratorFunction"),Je(d),Je(d,r,"Generator"),Je(d,i,function(){return this}),Je(d,"toString",function(){return"[object Generator]"}),(Qe=function(){return{w:a,m:p}})()}function Je(e,t,n,i){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}Je=function(e,t,n,i){function a(t,n){Je(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Je(e,t,n,i)}function Xe(e,t,n,i,r,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,r)}function Ke(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var a=e.apply(t,n);function o(e){Xe(a,i,r,o,s,"next",e)}function s(e){Xe(a,i,r,o,s,"throw",e)}o(void 0)})}}var Ze,Ye,et,tt,nt=new Map,it=new Map,rt=function(){var e=Ke(Qe().m(function e(t,n){var i;return Qe().w(function(e){for(;;)switch(e.n){case 0:if(null===(i=n.data_client_id)||void 0===i||!i.set_attribute||!0===n.vault_v3_enabled){e.n=1;break}return e.a(2,new Promise(function(e,i){Ae(t,n.data_client_id,function(t){qe.setPaypal(t),e(t)},i)}));case 1:return e.a(2,null)}},e)}));return function(_x,t){return e.apply(this,arguments)}}(),at=function(){var e=Ke(Qe().m(function e(t,n){var i,r,a;return Qe().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}throw new Error("Namespace is required");case 1:if(!nt.has(t)){e.n=2;break}return console.log("Script already loaded for namespace: ".concat(t)),e.a(2,nt.get(t));case 2:if(!it.has(t)){e.n=3;break}return console.log("Script loading in progress for namespace: ".concat(t)),e.a(2,it.get(t));case 3:return i=ze(ze({},Re(n)),{},{"data-namespace":t}),e.n=4,rt(i,n);case 4:if(!(r=e.v)){e.n=5;break}return e.a(2,r);case 5:return a=new Promise(function(e,n){je(i).then(function(n){qe.setPaypal(n),nt.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(){it.delete(t)})}),it.set(t,a),e.a(2,a)}},e)}));return function(t,n){return e.apply(this,arguments)}}();function ot(e){return ot="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},ot(e)}function st(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function a(n,i,r,a){var l=i&&i.prototype instanceof s?i:s,c=Object.create(l.prototype);return lt(c,"_invoke",function(n,i,r){var a,s,l,c=0,u=r||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return a=t,s=0,l=e,p.n=n,o}};function f(n,i){for(s=n,l=i,t=0;!d&&c&&!r&&t<u.length;t++){var r,a=u[t],f=p.p,h=a[2];n>3?(r=h===i)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=f&&((r=n<2&&f<a[1])?(s=0,p.v=i,p.n=a[1]):f<h&&(r=n<3||a[0]>i||i>h)&&(a[4]=n,a[5]=i,p.n=h,s=0))}if(r||n>1)return o;throw d=!0,i}return function(r,u,h){if(c>1)throw TypeError("Generator is already running");for(d&&1===u&&f(u,h),s=u,l=h;(t=s<2?e:l)||!d;){a||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(c=2,a){if(s||(r="next"),t=a[r]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),s=1);a=e}else if((t=(d=p.n<0)?l:n.call(i,p))!==o)break}catch(t){a=e,s=1,l=t}finally{c=1}}return{value:t,done:d}}}(n,r,a),!0),c}var o={};function s(){}function l(){}function c(){}t=Object.getPrototypeOf;var u=[][i]?t(t([][i]())):(lt(t={},i,function(){return this}),t),d=c.prototype=s.prototype=Object.create(u);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,c):(e.__proto__=c,lt(e,r,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=c,lt(d,"constructor",c),lt(c,"constructor",l),l.displayName="GeneratorFunction",lt(c,r,"GeneratorFunction"),lt(d),lt(d,r,"Generator"),lt(d,i,function(){return this}),lt(d,"toString",function(){return"[object Generator]"}),(st=function(){return{w:a,m:p}})()}function lt(e,t,n,i){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}lt=function(e,t,n,i){function a(t,n){lt(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},lt(e,t,n,i)}function ct(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function ut(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){dt(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}function dt(e,t,n){return(t=function(e){var t=function(e){if("object"!=ot(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ot(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ot(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function pt(e,t,n,i,r,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,r)}function ft(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var a=e.apply(t,n);function o(e){pt(a,i,r,o,s,"next",e)}function s(e){pt(a,i,r,o,s,"throw",e)}o(void 0)})}}Ze={axoConfig:window.wc_ppcp_axo,ppcpConfig:window.PayPalCommerceGateway},Ye=Ze.axoConfig,et=Ze.ppcpConfig,tt="ppcpPaypalClassicAxo",document.addEventListener("DOMContentLoaded",ft(st().m(function e(){var t,n;return st().w(function(e){for(;;)switch(e.n){case 0:if("undefined"!=typeof PayPalCommerceGateway){e.n=1;break}return console.error("AXO could not be configured."),e.a(2);case 1:return e.n=2,fetch(Ye.ajax.axo_script_attributes.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:Ye.ajax.axo_script_attributes.nonce})});case 2:return t=e.v,e.n=3,t.json();case 3:if((n=e.v).success){e.n=4;break}throw new Error(n.data.message);case 4:at(tt,ut(ut({},et),{},{script_attributes:ut(ut({},et.script_attributes),{},{"data-sdk-client-token":n.data.sdk_client_token})})).then(function(){new _e(tt,Ye,et)}).catch(function(e){l("Failed to load PayPal script: ".concat(e),"error")});case 5:return e.a(2)}},e)})))})();