(()=>{"use strict";var e={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 r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?c((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map(function(e){return r(e,n)})}function i(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 a(e,t){try{return t in e}catch(e){return!1}}function c(e,n,u){(u=u||{}).arrayMerge=u.arrayMerge||o,u.isMergeableObject=u.isMergeableObject||t,u.cloneUnlessOtherwiseSpecified=r;var s=Array.isArray(n);return s===Array.isArray(e)?s?u.arrayMerge(e,n,u):function(e,t,n){var o={};return n.isMergeableObject(e)&&i(e).forEach(function(t){o[t]=r(e[t],n)}),i(t).forEach(function(i){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,i)||(a(e,i)&&n.isMergeableObject(t[i])?o[i]=function(e,t){if(!t.customMerge)return c;var n=t.customMerge(e);return"function"==typeof n?n:c}(i,n)(e[i],t[i],n):o[i]=r(t[i],n))}),o}(e,n,u):r(n,u)}c.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return c(e,n,t)},{})};var u=c;e.exports=u}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const r=window.wp.element,o=window.wp.i18n,i=window.wc.wcBlocksRegistry,a=window.wp.data;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;n1&&void 0!==arguments[1]?arguments[1]:"info",i=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(i)switch(o){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:o}})})}function p(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,o,i,a,c=[],u=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(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)?y(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 y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0:function(e){return""!==e}(n)})):e};function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&void 0!==arguments[0]?arguments[0]:A,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_IS_PAYPAL_LOADED":return O(O({},e),{},{isPayPalLoaded:t.payload});case"SET_IS_GUEST":return O(O({},e),{},{isGuest:t.payload});case"SET_IS_AXO_ACTIVE":return O(O({},e),{},{isAxoActive:t.payload});case"SET_IS_AXO_SCRIPT_LOADED":return O(O({},e),{},{isAxoScriptLoaded:t.payload});case"SET_IS_EMAIL_SUBMITTED":return O(O({},e),{},{isEmailSubmitted:t.payload});case"SET_IS_EMAIL_LOOKUP_COMPLETED":return O(O({},e),{},{isEmailLookupCompleted:t.payload});case"SET_SHIPPING_ADDRESS":return O(O({},e),{},{shippingAddress:t.payload});case"SET_CARD_DETAILS":return O(O({},e),{},{cardDetails:t.payload});case"SET_PHONE_NUMBER":return O(O({},e),{},{phoneNumber:t.payload});case"SET_CARD_CHANGE_HANDLER":return O(O({},e),{},{cardChangeHandler:t.payload});default:return e}},actions:{setIsPayPalLoaded:function(e){return{type:"SET_IS_PAYPAL_LOADED",payload:e}},setIsGuest:function(e){return{type:"SET_IS_GUEST",payload:e}},setIsAxoActive:function(e){return{type:"SET_IS_AXO_ACTIVE",payload:e}},setIsAxoScriptLoaded:function(e){return{type:"SET_IS_AXO_SCRIPT_LOADED",payload:e}},setIsEmailSubmitted:function(e){return{type:"SET_IS_EMAIL_SUBMITTED",payload:e}},setIsEmailLookupCompleted:function(e){return{type:"SET_IS_EMAIL_LOOKUP_COMPLETED",payload:e}},setShippingAddress:function(e){return{type:"SET_SHIPPING_ADDRESS",payload:e}},setCardDetails:function(e){return{type:"SET_CARD_DETAILS",payload:e}},setPhoneNumber:function(e){return{type:"SET_PHONE_NUMBER",payload:e}},setCardChangeHandler:function(e){return{type:"SET_CARD_CHANGE_HANDLER",payload:e}}},selectors:{getIsPayPalLoaded:function(e){return e.isPayPalLoaded},getIsGuest:function(e){return e.isGuest},getIsAxoActive:function(e){return e.isAxoActive},getIsAxoScriptLoaded:function(e){return e.isAxoScriptLoaded},getIsEmailSubmitted:function(e){return e.isEmailSubmitted},getIsEmailLookupCompleted:function(e){return e.isEmailLookupCompleted},getShippingAddress:function(e){return e.shippingAddress},getCardDetails:function(e){return e.cardDetails},getPhoneNumber:function(e){return e.phoneNumber},getCardChangeHandler:function(e){return e.cardChangeHandler}}});(0,a.register)(j)}var P=function(e){(0,a.dispatch)(_).setIsGuest(e)},C=function(e){(0,a.dispatch)(_).setIsEmailLookupCompleted(e)};function x(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return T(s,"_invoke",function(n,r,o){var i,c,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,c=0,u=e,d.n=n,a}};function p(n,r){for(c=n,u=r,t=0;!f&&s&&!o&&t3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(T(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,T(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,T(f,"constructor",s),T(s,"constructor",u),u.displayName="GeneratorFunction",T(s,o,"GeneratorFunction"),T(f),T(f,o,"Generator"),T(f,r,function(){return this}),T(f,"toString",function(){return"[object Generator]"}),(x=function(){return{w:i,m:d}})()}function T(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}T=function(e,t,n,r){function i(t,n){T(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},T(e,t,n,r)}function I(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);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 o,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function q(e,t){if(e){if("string"==typeof e)return W(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)?W(e,t):void 0}}function W(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n')),n.append(o)),t=o.get(0)}return jQuery(t).length?t:null}},{key:"toKey",value:function(e){return Array.isArray(e)?JSON.stringify(e):e}}])&&J(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();window.widgetBuilder=window.widgetBuilder||new $;const z=window.widgetBuilder;var K=n(4744),V=n.n(K),Q=function(e){return e.replace(/([-_]\w)/g,function(e){return e[1].toUpperCase()})},Y=function(e){var t=function(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[Q(n)]=e[n]);return t}(e.url_params);e.script_attributes&&(t=V()(t,e.script_attributes));var n=function(e){var t,n,r=null==e||null===(t=e.save_payment_methods)||void 0===t?void 0:t.id_token;return r&&!0===(null==e||null===(n=e.user)||void 0===n?void 0:n.is_logged)?{"data-user-id-token":r}:{}}(e);return V().all([t,n])};function Z(e){return Z="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},Z(e)}function ee(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return te(s,"_invoke",function(n,r,o){var i,c,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,c=0,u=e,d.n=n,a}};function p(n,r){for(c=n,u=r,t=0;!f&&s&&!o&&t3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(te(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,te(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,te(f,"constructor",s),te(s,"constructor",u),u.displayName="GeneratorFunction",te(s,o,"GeneratorFunction"),te(f),te(f,o,"Generator"),te(f,r,function(){return this}),te(f,"toString",function(){return"[object Generator]"}),(ee=function(){return{w:i,m:d}})()}function te(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}te=function(e,t,n,r){function i(t,n){te(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},te(e,t,n,r)}function ne(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 re(e){for(var t=1;t3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(fe(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,fe(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,fe(f,"constructor",s),fe(s,"constructor",u),u.displayName="GeneratorFunction",fe(s,o,"GeneratorFunction"),fe(f),fe(f,o,"Generator"),fe(f,r,function(){return this}),fe(f,"toString",function(){return"[object Generator]"}),(le=function(){return{w:i,m:d}})()}function fe(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}fe=function(e,t,n,r){function i(t,n){fe(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},fe(e,t,n,r)}function de(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 pe(e){for(var t=1;t3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(be(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,be(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,be(f,"constructor",s),be(s,"constructor",u),u.displayName="GeneratorFunction",be(s,o,"GeneratorFunction"),be(f),be(f,o,"Generator"),be(f,r,function(){return this}),be(f,"toString",function(){return"[object Generator]"}),(ve=function(){return{w:i,m:d}})()}function be(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}be=function(e,t,n,r){function i(t,n){be(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},be(e,t,n,r)}function he(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}const ge=function(e){var t=e.fastlaneSdk,n=e.name,o=void 0===n?"fastlane-watermark-container":n,i=e.includeAdditionalInfo,a=void 0===i||i,c=(0,r.useRef)(null),u=(0,r.useRef)(null);return(0,r.useEffect)(function(){var e=function(){var e,n=(e=ve().m(function e(){var n,r;return ve().w(function(e){for(;;)switch(e.p=e.n){case 0:if(c.current){e.n=1;break}return e.a(2);case 1:return c.current.innerHTML="",e.p=2,e.n=3,t.FastlaneWatermarkComponent({includeAdditionalInfo:a});case 3:n=e.v,u.current=n,n.render("#".concat(o)),e.n=5;break;case 4:e.p=4,r=e.v,d("Error rendering watermark: ".concat(r),"error");case 5:return e.a(2)}},e,null,[[2,4]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){he(i,r,o,a,c,"next",e)}function c(e){he(i,r,o,a,c,"throw",e)}a(void 0)})});return function(){return n.apply(this,arguments)}}();return e(),function(){c.current&&(c.current.innerHTML="")}},[t,o,a]),React.createElement("div",{id:o,ref:c})};var we={container:null,root:null},Se=function(){if(we.root&&we.root.unmount(),we.container)if(we.container.parentNode)we.container.parentNode.removeChild(we.container);else{var e=document.querySelector(".wc-block-checkout-axo-block-watermark-container");e&&e.remove()}Object.assign(we,{container:null,root:null})};const Ee=function(e){var t=e.fastlaneSdk,n=(0,a.useSelect)(function(e){return e(_).getIsAxoActive()}),o=(0,a.useSelect)(function(e){return e(_).getIsAxoScriptLoaded()}),i=window.wc_ppcp_axo;return(0,r.useEffect)(function(){if("1"===(null==i?void 0:i.show_watermark))return n||!n&&!o?(function(){var e=document.querySelector(".wp-block-woocommerce-checkout-contact-information-block .wc-block-components-text-input");if(e&&!we.container){var t=e.querySelector('input[id="email"]');if(t){we.container=document.createElement("div"),we.container.setAttribute("class","wc-block-checkout-axo-block-watermark-container");var n=e.querySelector(".wc-block-axo-email-submit-button-container")||t;n.parentNode.insertBefore(we.container,n.nextSibling),we.root=(0,r.createRoot)(we.container)}}}(),function(e){var t,n=e.isAxoActive,o=e.fastlaneSdk;t=n||e.isAxoScriptLoaded?n?(0,r.createElement)(ge,{fastlaneSdk:o,name:"fastlane-watermark-email",includeAdditionalInfo:!0}):null:(0,r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"}),we.root&&we.root.render(t)}({isAxoActive:n,isAxoScriptLoaded:o,fastlaneSdk:t})):Se(),Se},[t,n,o]),null},Oe=function(e){var t=e.handleSubmit,n=(0,a.useSelect)(function(e){return{isGuest:e(_).getIsGuest(),isAxoActive:e(_).getIsAxoActive(),isEmailSubmitted:e(_).getIsEmailSubmitted()}}),r=n.isGuest,i=n.isAxoActive,c=n.isEmailSubmitted;return r&&i?React.createElement("button",{type:"button",onClick:t,className:"wc-block-components-button wp-element-button ".concat(c?"is-loading":""),disabled:c},React.createElement("span",{className:"wc-block-components-button__text",style:{visibility:c?"hidden":"visible"}},(0,o.__)("Continue","woocommerce-paypal-payments")),c&&React.createElement("span",{className:"wc-block-components-spinner","aria-hidden":"true",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"}})):null};function ke(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return _e(s,"_invoke",function(n,r,o){var i,c,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,c=0,u=e,d.n=n,a}};function p(n,r){for(c=n,u=r,t=0;!f&&s&&!o&&t3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(_e(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,_e(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,_e(f,"constructor",s),_e(s,"constructor",u),u.displayName="GeneratorFunction",_e(s,o,"GeneratorFunction"),_e(f),_e(f,o,"Generator"),_e(f,r,function(){return this}),_e(f,"toString",function(){return"[object Generator]"}),(ke=function(){return{w:i,m:d}})()}function _e(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}_e=function(e,t,n,r){function i(t,n){_e(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},_e(e,t,n,r)}function Ae(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}var je=null,Pe={container:null,root:null,unsubscribe:null},Ce=null,xe=function(){return je||(je=document.getElementById("email")),je},Te=function(e,t){e&&t||d("Shipping or billing address is missing: ".concat(JSON.stringify({shippingAddress:e,billingAddress:t})),"warn");var n={shippingAddress:e,billingAddress:t};d("Snapshot data: ".concat(JSON.stringify(n)));try{localStorage.setItem("axoOriginalCheckoutFields",JSON.stringify(n))}catch(e){d("Error saving to localStorage: ".concat(e),"error")}},Ie=function(e,t,n){d("Populating WooCommerce fields with profile data: ".concat(JSON.stringify(e)));var r=(0,a.dispatch)("wc/store/checkout");"function"==typeof r.__internalSetUseShippingAsBilling&&r.__internalSetUseShippingAsBilling(!1);var o=e.shippingAddress,i=o.address,c=o.name,u=o.phoneNumber,s={first_name:c.firstName,last_name:c.lastName,address_1:i.addressLine1,address_2:i.addressLine2||"",city:i.adminArea2,state:i.adminArea1||"",postcode:i.postalCode,country:i.countryCode,phone:u.nationalNumber};d("Setting WooCommerce shipping address: ".concat(JSON.stringify(s))),t(s);var l=e.card.paymentSource.card.billingAddress,f={first_name:e.name.firstName,last_name:e.name.lastName,address_1:l.addressLine1,address_2:l.addressLine2||"",city:l.adminArea2,state:l.adminArea1,postcode:l.postalCode,country:l.countryCode};d("Setting WooCommerce billing address: ".concat(JSON.stringify(f))),n(f),"function"==typeof r.setEditingShippingAddress&&r.setEditingShippingAddress(!1),"function"==typeof r.setEditingBillingAddress&&r.setEditingBillingAddress(!1)};const Le=function(e){var t=e.onChangeShippingAddressClick;return React.createElement("a",{className:"wc-block-axo-change-link",role:"button",onClick:function(e){e.preventDefault(),t()}},(0,o.__)("Choose a different shipping address","woocommerce-paypal-payments"))},Ne=function(e){var t=e.onChangeShippingAddressClick;return(0,r.useEffect)(function(){var e=document.querySelector("#shipping-fields .wc-block-components-checkout-step__heading");if(e&&!e.querySelector(".wc-block-checkout-axo-block-card__edit")){var n=document.createElement("span");n.className="wc-block-checkout-axo-block-card__edit",e.appendChild(n);var o=(0,r.createRoot)(n);return o.render(React.createElement(Le,{onChangeShippingAddressClick:t})),function(){o.unmount(),n.remove()}}},[t]),null};var Ge=function(e){if(!document.querySelector("#shipping-fields .wc-block-checkout-axo-block-card__edit")){var t=document.createElement("div");document.body.appendChild(t),(0,r.createRoot)(t).render(React.createElement(Ne,{onChangeShippingAddressClick:e}))}};function Re(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return De(s,"_invoke",function(n,r,o){var i,c,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,c=0,u=e,d.n=n,a}};function p(n,r){for(c=n,u=r,t=0;!f&&s&&!o&&t3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(De(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,De(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,De(f,"constructor",s),De(s,"constructor",u),u.displayName="GeneratorFunction",De(s,o,"GeneratorFunction"),De(f),De(f,o,"Generator"),De(f,r,function(){return this}),De(f,"toString",function(){return"[object Generator]"}),(Re=function(){return{w:i,m:d}})()}function De(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}De=function(e,t,n,r){function i(t,n){De(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},De(e,t,n,r)}function Fe(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}var Me=function(e,t){d("Update the phone prefill value: ".concat(t)),e.updatePrefills({phoneNumber:t})};var Be="wc/store/checkout",Ue=function(){var e=(0,a.useSelect)(function(e){var t=e(Be);return{isEditingShippingAddress:!t.getEditingShippingAddress||t.getEditingShippingAddress(),isEditingBillingAddress:!t.getEditingBillingAddress||t.getEditingBillingAddress()}},[]),t=e.isEditingShippingAddress,n=e.isEditingBillingAddress,o=(0,a.useDispatch)(Be),i=o.setEditingShippingAddress,c=o.setEditingBillingAddress;return{isEditingShippingAddress:t,isEditingBillingAddress:n,setShippingAddressEditing:(0,r.useCallback)(function(e){"function"==typeof i&&i(e)},[i]),setBillingAddressEditing:(0,r.useCallback)(function(e){"function"==typeof c&&c(e)},[c])}};function He(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return qe(s,"_invoke",function(n,r,o){var i,c,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,c=0,u=e,d.n=n,a}};function p(n,r){for(c=n,u=r,t=0;!f&&s&&!o&&t3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(qe(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,qe(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,qe(f,"constructor",s),qe(s,"constructor",u),u.displayName="GeneratorFunction",qe(s,o,"GeneratorFunction"),qe(f),qe(f,o,"Generator"),qe(f,r,function(){return this}),qe(f,"toString",function(){return"[object Generator]"}),(He=function(){return{w:i,m:d}})()}function qe(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}qe=function(e,t,n,r){function i(t,n){qe(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},qe(e,t,n,r)}function We(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function Je(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){We(i,r,o,a,c,"next",e)}function c(e){We(i,r,o,a,c,"throw",e)}a(void 0)})}}function Xe(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return $e(s,"_invoke",function(n,r,o){var i,c,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,c=0,u=e,d.n=n,a}};function p(n,r){for(c=n,u=r,t=0;!f&&s&&!o&&t3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):($e(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,$e(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,$e(f,"constructor",s),$e(s,"constructor",u),u.displayName="GeneratorFunction",$e(s,o,"GeneratorFunction"),$e(f),$e(f,o,"Generator"),$e(f,r,function(){return this}),$e(f,"toString",function(){return"[object Generator]"}),(Xe=function(){return{w:i,m:d}})()}function $e(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}$e=function(e,t,n,r){function i(t,n){$e(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},$e(e,t,n,r)}function ze(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function Ke(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ze(i,r,o,a,c,"next",e)}function c(e){ze(i,r,o,a,c,"throw",e)}a(void 0)})}}function Ve(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return Qe(s,"_invoke",function(n,r,o){var i,c,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,c=0,u=e,d.n=n,a}};function p(n,r){for(c=n,u=r,t=0;!f&&s&&!o&&t3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(Qe(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Qe(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,Qe(f,"constructor",s),Qe(s,"constructor",u),u.displayName="GeneratorFunction",Qe(s,o,"GeneratorFunction"),Qe(f),Qe(f,o,"Generator"),Qe(f,r,function(){return this}),Qe(f,"toString",function(){return"[object Generator]"}),(Ve=function(){return{w:i,m:d}})()}function Qe(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Qe=function(e,t,n,r){function i(t,n){Qe(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Qe(e,t,n,r)}function Ye(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}const Ze=function(e,t,n,o,i){var c=(0,a.useDispatch)(_),u=c.setIsAxoActive,s=c.setIsAxoScriptLoaded,l=c.setShippingAddress,f=c.setCardDetails,p=c.setCardChangeHandler,y=function(e,t,n){var o=(0,a.useDispatch)(_).setIsPayPalLoaded,i=(0,a.useSelect)(function(e){return{isPayPalLoaded:e(_).getIsPayPalLoaded()}},[]).isPayPalLoaded;return(0,r.useEffect)(function(){var r=function(){var r,a=(r=le().m(function r(){var a,c,u,s;return le().w(function(r){for(;;)switch(r.p=r.n){case 0:if(i||!n){r.n=7;break}return a=window.wc_ppcp_axo,r.p=1,r.n=2,fetch(a.ajax.axo_script_attributes.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:a.ajax.axo_script_attributes.nonce})});case 2:return c=r.v,r.n=3,c.json();case 3:if((u=r.v).success){r.n=4;break}return d("Failed to load axo script attributes: ".concat(u.data.message),"error"),r.a(2);case 4:return r.n=5,ue(e,pe(pe({},t),{},{script_attributes:pe(pe({},t.script_attributes),{},{"data-sdk-client-token":u.data.sdk_client_token})}));case 5:o(!0),r.n=7;break;case 6:r.p=6,s=r.v,d("Error loading PayPal script for namespace: ".concat(e,". Error: ").concat(s),"error");case 7:return r.a(2)}},r,null,[[1,6]])}),function(){var e=this,t=arguments;return new Promise(function(n,o){var i=r.apply(e,t);function a(e){me(i,n,o,a,c,"next",e)}function c(e){me(i,n,o,a,c,"throw",e)}a(void 0)})});return function(){return a.apply(this,arguments)}}();r()},[t,n,i]),i}(e,t,n),m=function(e){var t=Ue().setBillingAddressEditing,n=G().setBillingAddress,o=(0,a.useDispatch)(_).setCardDetails;return(0,r.useCallback)(Ke(Xe().m(function r(){var i,a,c,u,s,l,f,p,y,m,v;return Xe().w(function(r){for(;;)switch(r.n){case 0:if(!e){r.n=4;break}return r.n=1,e.profile.showCardSelector();case 1:if(a=r.v,c=a.selectionChanged,u=a.selectedCard,!c||null==u||null===(i=u.paymentSource)||void 0===i||!i.card){r.n=3;break}return s=u.paymentSource.card,l=s.name,f=s.billingAddress,p="",y="",l&&(m=l.split(" "),p=m[0],y=m.slice(1).join(" ")),v={first_name:p,last_name:y,address_1:(null==f?void 0:f.addressLine1)||"",address_2:(null==f?void 0:f.addressLine2)||"",city:(null==f?void 0:f.adminArea2)||"",state:(null==f?void 0:f.adminArea1)||"",postcode:(null==f?void 0:f.postalCode)||"",country:(null==f?void 0:f.countryCode)||""},r.n=2,Promise.all([new Promise(function(e){o(u),e()}),new Promise(function(e){n(v),e()}),new Promise(function(e){t(!1),e()})]);case 2:r.n=4;break;case 3:d("Selected card or billing address is missing.","error");case 4:return r.a(2)}},r)})),[e,o,n,t])}(o),v=function(e,t){var n=Ue().setShippingAddressEditing,o=G().setShippingAddress;return(0,r.useCallback)(Je(He().m(function r(){var i,a,c,u,s,l,f;return He().w(function(r){for(;;)switch(r.n){case 0:if(!e){r.n=3;break}return r.n=1,e.profile.showShippingAddressSelector();case 1:if(i=r.v,a=i.selectionChanged,c=i.selectedAddress,!a){r.n=3;break}return t(c),u=c.address,s=c.name,l=c.phoneNumber,f={first_name:s.firstName,last_name:s.lastName,address_1:u.addressLine1,address_2:u.addressLine2||"",city:u.adminArea2,state:u.adminArea1||"",postcode:u.postalCode,country:u.countryCode,phone:l.nationalNumber},r.n=2,new Promise(function(e){o(f),e()});case 2:return r.n=3,new Promise(function(e){n(!1),e()});case 3:return r.a(2)}},r)})),[e,t,o,n])}(o,l),b=G(),h=b.shippingAddress,g=b.billingAddress,w=b.setShippingAddress,S=b.setBillingAddress;return function(e){var t,n,o,i,c,u=(0,a.useDispatch)(_).setPhoneNumber,s=(0,a.useSelect)(function(e){return{phoneNumber:e(_).getPhoneNumber()}}).phoneNumber,l=G(),f=l.shippingAddress,d=l.billingAddress,p=(0,r.useRef)((t=Me,n={timeoutId:null,args:null},o=function(){n.timeoutId&&window.clearTimeout(n.timeoutId),n.timeoutId=null,n.args=null},i=function(){n.timeoutId&&(t.apply(null,n.args||[]),o())},c=function(){o();for(var e=arguments.length,t=new Array(e),r=0;r0&&void 0!==arguments[0]?arguments[0]:"").replace(/^\+?[01]+/,"").replace(/[^0-9]/g,"");return 10===e.length?e:""}(e||t);n&&n!==s&&u(n)},[d,f,s,u]);(0,r.useEffect)(function(){y()},[y]),(0,r.useEffect)(function(){e&&s&&p(e,s)},[p,e,s]),(0,r.useEffect)(function(){return function(){null!=p&&p.cancel&&p.cancel()}},[p])}(i),function(e){var t=(0,a.useDispatch)(_),n=t.setShippingAddress,o=t.setCardDetails,i=t.setIsGuest,c=(0,r.useRef)(!1);(0,r.useEffect)(function(){if(e&&!c.current){var t=new URLSearchParams(window.location.search);if("1"===t.get("ppcp_fastlane_error")){t.delete("ppcp_fastlane_error");var r=new URL(window.location);r.search=t.toString(),window.history.replaceState({},"",r),c.current=!0;var a=function(){var t,r=(t=Ve().m(function t(){var r,a,c,u,s;return Ve().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,null==(r=document.getElementById("email"))||!r.value){t.n=3;break}return t.n=1,e.identity.lookupCustomerByEmail(r.value);case 1:if(a=t.v,wp.data.dispatch(_).setIsEmailSubmitted(!0),null==a||!a.customerContextId){t.n=3;break}return c=a.customerContextId,t.n=2,e.identity.triggerAuthenticationFlow(c);case 2:"succeeded"===(null==(u=t.v)?void 0:u.authenticationState)&&(s=u.profileData,i(!1),null!=s&&s.shippingAddress&&n(s.shippingAddress),null!=s&&s.card&&o(s.card),C(!0));case 3:t.n=5;break;case 4:t.p=4,t.v,d("Failed to restore Fastlane session","warn");case 5:return t.a(2)}},t,null,[[0,4]])}),function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(e){Ye(i,r,o,a,c,"next",e)}function c(e){Ye(i,r,o,a,c,"throw",e)}a(void 0)})});return function(){return r.apply(this,arguments)}}();a()}}},[e,n,o,i])}(o),(0,r.useEffect)(function(){var e,t,n;e=".wc-block-components-express-payment--checkout, .wp-block-woocommerce-checkout-express-payment-block",t="wc-block-axo-is-authenticated",(n=function(){var n=document.querySelector(e);n?(0,a.select)(_).getIsGuest()?n.classList.remove(t):n.classList.add(t):d("Authentication class target element not found: ".concat(e),"warn")})(),(0,a.subscribe)(function(){n()}),function(){var e=".wp-block-woocommerce-checkout-fields-block",t="wc-block-axo-email-lookup-completed",n=function(){var n=document.querySelector(e);n?(0,a.select)(_).getIsEmailLookupCompleted()?n.classList.add(t):n.classList.remove(t):d("Email lookup completed class target element not found: ".concat(e),"warn")};n(),(0,a.subscribe)(function(){n()})}(),function(){var e=".wp-block-woocommerce-checkout-fields-block",t="wc-block-axo-is-loaded",n="wc-block-axo-is-authenticated",r="wc-block-axo-email-lookup-completed",o=function(){var o=document.querySelector(e);if(o){var i=(0,a.select)(_).getIsAxoActive(),c=(0,a.select)(_).getIsGuest(),u=(0,a.select)(_).getIsEmailLookupCompleted();i?o.classList.add(t):o.classList.remove(t),c?o.classList.remove(n):o.classList.add(n),u?o.classList.add(r):o.classList.remove(r)}else d("Checkout block class target element not found: ".concat(e),"warn")};o(),(0,a.subscribe)(function(){o()})}()},[]),(0,r.useEffect)(function(){if(function(e){var t=document.createElement("div");document.body.appendChild(t),(0,r.createRoot)(t).render((0,r.createElement)(Ee,{fastlaneSdk:e}))}(o),y&&o){s(!0),u(!0),p(m);var e=function(e,t,n,r,o,i,a,c,u){return function(){var s,l=(s=Re().m(function s(l){var f,p,y,m,v;return Re().w(function(s){for(;;)switch(s.p=s.n){case 0:if(s.p=0,d("Email value being looked up: ".concat(l)),e){s.n=1;break}throw new Error("FastlaneSDK is not initialized");case 1:if(e.identity){s.n=2;break}throw new Error("FastlaneSDK identity object is not available");case 2:return s.n=3,e.identity.lookupCustomerByEmail(l);case 3:if(f=s.v,d("Lookup response: ".concat(JSON.stringify(f))),f&&""===f.customerContextId&&C(!0),f&&f.customerContextId){s.n=4;break}return d("No customerContextId found in the response","warn"),s.a(2);case 4:return s.n=5,e.identity.triggerAuthenticationFlow(f.customerContextId);case 5:if((p=s.v)&&p.authenticationState){s.n=6;break}throw new Error("Invalid authentication response");case 6:y=p.authenticationState,m=p.profileData,p&&C(!0),"succeeded"===y?(r(o,i),P(!1),m&&m.shippingAddress&&t(m.shippingAddress),m&&m.card&&n(m.card),d("Profile Data: ".concat(JSON.stringify(m))),Ie(m,a,c),Ge(u)):d("Authentication failed or did not succeed","warn"),s.n=8;break;case 7:throw s.p=7,v=s.v,d("Error during email lookup or authentication:\n\t\t\t\t".concat(v)),v;case 8:return s.a(2)}},s,null,[[0,7]])}),function(){var e=this,t=arguments;return new Promise(function(n,r){var o=s.apply(e,t);function i(e){Fe(o,n,r,i,a,"next",e)}function a(e){Fe(o,n,r,i,a,"throw",e)}i(void 0)})});return function(_x){return l.apply(this,arguments)}}()}(o,l,f,Te,h,g,w,S,v);!function(e){var t=xe();if(t){var n=function(){var n,r=(n=ke().m(function n(){var r;return ke().w(function(n){for(;;)switch(n.p=n.n){case 0:if(!wp.data.select(_).getIsEmailSubmitted()&&t.value){n.n=1;break}return n.a(2);case 1:return wp.data.dispatch(_).setIsEmailSubmitted(!0),o(),n.p=2,n.n=3,e(t.value);case 3:n.n=5;break;case 4:n.p=4,r=n.v,d("Error during email submission: ".concat(r),"error");case 5:return n.p=5,wp.data.dispatch(_).setIsEmailSubmitted(!1),o(),n.f(5);case 6:return n.a(2)}},n,null,[[2,4,5,6]])}),function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){Ae(i,r,o,a,c,"next",e)}function c(e){Ae(i,r,o,a,c,"throw",e)}a(void 0)})});return function(){return r.apply(this,arguments)}}();Ce=function(e){var t=wp.data.select(_).getIsAxoActive();"Enter"===e.key&&t&&(e.preventDefault(),n())},t.addEventListener("keydown",Ce),Pe.container||(Pe.container=document.createElement("div"),Pe.container.setAttribute("class","wc-block-axo-email-submit-button-container"),t.parentNode.insertBefore(Pe.container,t.nextSibling),Pe.root=(0,r.createRoot)(Pe.container));var o=function(){Pe.root&&Pe.root.render((0,r.createElement)(Oe,{handleSubmit:n}))};o(),Pe.unsubscribe=wp.data.subscribe(function(){o()})}else d("Email input element not found. Functionality not added.","warn")}(e)}},[y,o,u,s,h,g,w,S,v,m,l,f,i,p]),y};function et(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var u=r&&r.prototype instanceof c?r:c,s=Object.create(u.prototype);return tt(s,"_invoke",function(n,r,o){var i,c,u,s=0,l=o||[],f=!1,d={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return i=t,c=0,u=e,d.n=n,a}};function p(n,r){for(c=n,u=r,t=0;!f&&s&&!o&&t3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(tt(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,tt(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,tt(f,"constructor",s),tt(s,"constructor",u),u.displayName="GeneratorFunction",tt(s,o,"GeneratorFunction"),tt(f),tt(f,o,"Generator"),tt(f,r,function(){return this}),tt(f,"toString",function(){return"[object Generator]"}),(et=function(){return{w:i,m:d}})()}function tt(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}tt=function(e,t,n,r){function i(t,n){tt(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},tt(e,t,n,r)}function nt(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function rt(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){nt(i,r,o,a,c,"next",e)}function c(e){nt(i,r,o,a,c,"throw",e)}a(void 0)})}}function ot(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,o,i,a,c=[],u=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==t);u=!0);}catch(e){s=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return it(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)?it(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 it(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n3?(o=y===r)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=p&&((o=n<2&&pr||r>y)&&(i[4]=n,i[5]=r,d.n=y,c=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),c=l,u=y;(t=c<2?e:u)||!f;){i||(c?c<3?(c>1&&(d.n=-1),p(c,u)):d.n=u:d.v=u);try{if(s=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=e}else if((t=(f=d.n<0)?u:n.call(r,d))!==a)break}catch(t){i=e,c=1,u=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(lt(t={},r,function(){return this}),t),f=s.prototype=c.prototype=Object.create(l);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,lt(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return u.prototype=s,lt(f,"constructor",s),lt(s,"constructor",u),u.displayName="GeneratorFunction",lt(s,o,"GeneratorFunction"),lt(f),lt(f,o,"Generator"),lt(f,r,function(){return this}),lt(f,"toString",function(){return"[object Generator]"}),(st=function(){return{w:i,m:d}})()}function lt(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}lt=function(e,t,n,r){function i(t,n){lt(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},lt(e,t,n,r)}function ft(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function dt(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ft(i,r,o,a,c,"next",e)}function c(e){ft(i,r,o,a,c,"throw",e)}a(void 0)})}}function pt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n