File: //home/nassaugo/www/wp-content/plugins/woocommerce-paypal-payments/assets/ppcp-applepay-js-boot.js
(()=>{"use strict";var t={4744:t=>{var e=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&!function(t){var e=Object.prototype.toString.call(t);return"[object RegExp]"===e||"[object Date]"===e||function(t){return t.$$typeof===n}(t)}(t)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(t,e){return!1!==e.clone&&e.isMergeableObject(t)?u((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function o(t,e,n){return t.concat(e).map(function(t){return r(t,n)})}function i(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]}(t))}function a(t,e){try{return e in t}catch(t){return!1}}function u(t,n,c){(c=c||{}).arrayMerge=c.arrayMerge||o,c.isMergeableObject=c.isMergeableObject||e,c.cloneUnlessOtherwiseSpecified=r;var l=Array.isArray(n);return l===Array.isArray(t)?l?c.arrayMerge(t,n,c):function(t,e,n){var o={};return n.isMergeableObject(t)&&i(t).forEach(function(e){o[e]=r(t[e],n)}),i(e).forEach(function(i){(function(t,e){return a(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,i)||(a(t,i)&&n.isMergeableObject(e[i])?o[i]=function(t,e){if(!e.customMerge)return u;var n=e.customMerge(t);return"function"==typeof n?n:u}(i,n)(t[i],e[i],n):o[i]=r(e[i],n))}),o}(t,n,c):r(n,c)}u.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(t,n){return u(t,n,e)},{})};var c=u;t.exports=c}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}function r(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach(function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])}),n}function o(t,e){if(void 0===e&&(e=Promise),u(t,e),"undefined"==typeof document)return e.resolve(null);var n=function(t){var e,n,r=t.sdkBaseUrl,o=t.environment,i=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(t,["sdkBaseUrl","environment"]),a=r||function(t){return"sandbox"===t?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}(o),u=i,c=Object.keys(u).filter(function(t){return void 0!==u[t]&&null!==u[t]&&""!==u[t]}).reduce(function(t,e){var n,r=u[e].toString();return n=function(t,e){return(e?"-":"")+t.toLowerCase()},"data"===(e=e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,n)).substring(0,4)||"crossorigin"===e?t.attributes[e]=r:t.queryParams[e]=r,t},{queryParams:{},attributes:{}}),l=c.queryParams,s=c.attributes;return l["merchant-id"]&&-1!==l["merchant-id"].indexOf(",")&&(s["data-merchant-id"]=l["merchant-id"],l["merchant-id"]="*"),{url:"".concat(a,"?").concat((e=l,n="",Object.keys(e).forEach(function(t){0!==n.length&&(n+="&"),n+=t+"="+e[t]}),n)),attributes:s}}(t),o=n.url,c=n.attributes,l=c["data-namespace"]||"paypal",s=a(l);return c["data-js-sdk-library"]||(c["data-js-sdk-library"]="paypal-js"),function(t,e){var n=document.querySelector('script[src="'.concat(t,'"]'));if(null===n)return null;var o=r(t,e),i=n.cloneNode();if(delete i.dataset.uidAuto,Object.keys(i.dataset).length!==Object.keys(o.dataset).length)return null;var a=!0;return Object.keys(i.dataset).forEach(function(t){i.dataset[t]!==o.dataset[t]&&(a=!1)}),a?n:null}(o,c)&&s?e.resolve(s):i({url:o,attributes:c},e).then(function(){var t=a(l);if(t)return t;throw new Error("The window.".concat(l," global variable is not available."))})}function i(t,e){void 0===e&&(e=Promise),u(t,e);var n=t.url,o=t.attributes;if("string"!=typeof n||0===n.length)throw new Error("Invalid url.");if(void 0!==o&&"object"!=typeof o)throw new Error("Expected attributes to be an object.");return new e(function(t,e){if("undefined"==typeof document)return t();var i,a,u,c;a=(i={url:n,attributes:o,onSuccess:function(){return t()},onError:function(){var t=new Error('The script "'.concat(n,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return e(t)}}).onSuccess,u=i.onError,(c=r(i.url,i.attributes)).onerror=u,c.onload=a,document.head.insertBefore(c,document.head.firstElementChild)})}function a(t){return window[t]}function u(t,e){if("object"!=typeof t||null===t)throw new Error("Expected an options object.");var n=t.environment;if(n&&"production"!==n&&"sandbox"!==n)throw new Error('The `environment` option must be either "production" or "sandbox".');if(void 0!==e&&"function"!=typeof e)throw new Error("Expected PromisePonyfill to be a function.")}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),"function"==typeof SuppressedError&&SuppressedError;const c=function(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;fetch(e.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:e.nonce})}).then(function(t){return t.json()}).then(function(i){var a;(function(t,e){return!(!t||t.user!==e||(new Date).getTime()>=1e3*t.expiration)})(i,e.user)&&(a=i,sessionStorage.setItem("ppcp-data-client-id",JSON.stringify(a)),t["data-client-token"]=i.token,o(t).then(function(t){"function"==typeof n&&n(t)}).catch(function(t){"function"==typeof r&&r(t)}))})};function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||p(t,e)||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 f(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=p(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},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(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function p(t,e){if(t){if("string"==typeof t)return y(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(t,e):void 0}}function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,h(r.key),r)}}function h(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}var b=function(){return t=function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.paypal=null,this.buttons=new Map,this.messages=new Map,this.renderEventName="ppcp-render",document.ppcpWidgetBuilderStatus=function(){console.log({buttons:e.buttons,messages:e.messages})},jQuery(document).off(this.renderEventName).on(this.renderEventName,function(){e.renderAll()})},(e=[{key:"setPaypal",value:function(t){this.paypal=t,jQuery(document).trigger("ppcp-paypal-loaded",t)}},{key:"registerButtons",value:function(t,e){t=this.sanitizeWrapper(t),this.buttons.set(this.toKey(t),{wrapper:t,options:e})}},{key:"renderButtons",value:function(t){t=this.sanitizeWrapper(t);var e=this.toKey(t);if(this.buttons.has(e)&&!this.hasRendered(t)){var n=this.buttons.get(e),r=this.paypal.Buttons(n.options);if(r.isEligible()){var o=this.buildWrapperTarget(t);o&&(r.hasReturned()?r.resume():r.render(o))}else this.buttons.delete(e)}}},{key:"renderAllButtons",value:function(){var t,e=f(this.buttons);try{for(e.s();!(t=e.n()).done;){var n=s(t.value,1)[0];this.renderButtons(n)}}catch(t){e.e(t)}finally{e.f()}}},{key:"registerMessages",value:function(t,e){this.messages.set(t,{wrapper:t,options:e})}},{key:"renderMessages",value:function(t){var e=this;if(this.messages.has(t)){var n=this.messages.get(t);if(this.hasRendered(t))document.querySelector(t).setAttribute("data-pp-amount",n.options.amount);else{var r=this.paypal.Messages(n.options);r.render(n.wrapper),setTimeout(function(){e.hasRendered(t)||r.render(n.wrapper)},100)}}}},{key:"renderAllMessages",value:function(){var t,e=f(this.messages);try{for(e.s();!(t=e.n()).done;){var n=s(t.value,2),r=n[0];n[1],this.renderMessages(r)}}catch(t){e.e(t)}finally{e.f()}}},{key:"renderAll",value:function(){this.renderAllButtons(),this.renderAllMessages()}},{key:"hasRendered",value:function(t){var e=t;if(Array.isArray(t)){e=t[0];var n,r=f(t.slice(1));try{for(r.s();!(n=r.n()).done;)e+=" .item-"+n.value}catch(t){r.e(t)}finally{r.f()}}var o=document.querySelector(e);return o&&o.hasChildNodes()}},{key:"sanitizeWrapper",value:function(t){return Array.isArray(t)&&1===(t=t.filter(function(t){return!!t})).length&&(t=t[0]),t}},{key:"buildWrapperTarget",value:function(t){var e=t;if(Array.isArray(t)){var n=jQuery(t[0]);if(!n.length)return;var r="item-"+t[1],o=n.find("."+r);o.length||(o=jQuery('<div class="'.concat(r,'"></div>')),n.append(o)),e=o.get(0)}return jQuery(e).length?e:null}},{key:"toKey",value:function(t){return Array.isArray(t)?JSON.stringify(t):t}}])&&d(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.widgetBuilder=window.widgetBuilder||new b;const v=window.widgetBuilder;var m=n(4744),g=n.n(m),w=function(t){return t.replace(/([-_]\w)/g,function(t){return t[1].toUpperCase()})},S=function(t){var e=function(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[w(n)]=t[n]);return e}(t.url_params);t.script_attributes&&(e=g()(e,t.script_attributes));var n=function(t){var e,n,r=null==t||null===(e=t.save_payment_methods)||void 0===e?void 0:e.id_token;return r&&!0===(null==t||null===(n=t.user)||void 0===n?void 0:n.is_logged)?{"data-user-id-token":r}:{}}(t);return g().all([e,n])};function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function _(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function O(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?_(Object(n),!0).forEach(function(e){P(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function P(t,e,n){return(e=function(t){var e=function(t){if("object"!=j(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=j(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==j(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function k(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return E(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(E(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,E(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,E(f,"constructor",l),E(l,"constructor",c),c.displayName="GeneratorFunction",E(l,o,"GeneratorFunction"),E(f),E(f,o,"Generator"),E(f,r,function(){return this}),E(f,"toString",function(){return"[object Generator]"}),(k=function(){return{w:i,m:p}})()}function E(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}E=function(t,e,n,r){function i(e,n){E(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},E(t,e,n,r)}function C(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function A(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){C(i,r,o,a,u,"next",t)}function u(t){C(i,r,o,a,u,"throw",t)}a(void 0)})}}var T=new Map,x=new Map,I=function(){var t=A(k().m(function t(e,n){var r;return k().w(function(t){for(;;)switch(t.n){case 0:if(null===(r=n.data_client_id)||void 0===r||!r.set_attribute||!0===n.vault_v3_enabled){t.n=1;break}return t.a(2,new Promise(function(t,r){c(e,n.data_client_id,function(e){v.setPaypal(e),t(e)},r)}));case 1:return t.a(2,null)}},t)}));return function(_x,e){return t.apply(this,arguments)}}(),M=function(){var t=A(k().m(function t(e,n){var r,i,a;return k().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}throw new Error("Namespace is required");case 1:if(!T.has(e)){t.n=2;break}return console.log("Script already loaded for namespace: ".concat(e)),t.a(2,T.get(e));case 2:if(!x.has(e)){t.n=3;break}return console.log("Script loading in progress for namespace: ".concat(e)),t.a(2,x.get(e));case 3:return r=O(O({},S(n)),{},{"data-namespace":e}),t.n=4,I(r,n);case 4:if(!(i=t.v)){t.n=5;break}return t.a(2,i);case 5:return a=new Promise(function(t,n){o(r).then(function(n){v.setPaypal(n),T.set(e,n),console.log("Script loaded for namespace: ".concat(e)),t(n)}).catch(function(t){console.error("Failed to load script for namespace: ".concat(e),t),n(t)}).finally(function(){x.delete(e)})}),x.set(e,a),t.a(2,a)}},t)}));return function(e,n){return t.apply(this,arguments)}}();function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function R(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function D(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,F(r.key),r)}}function F(t){var e=function(t){if("object"!=B(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=B(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(e)?e:e+""}var q=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.contextBootstrapRegistry={},this.contextBootstrapWatchers=[]},(e=[{key:"watchContextBootstrap",value:function(t){this.contextBootstrapWatchers.push(t),Object.values(this.contextBootstrapRegistry).forEach(t)}},{key:"registerContextBootstrap",value:function(t,e){this.contextBootstrapRegistry[t]={context:t,handler:e};var n,r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return R(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},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(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(this.contextBootstrapWatchers);try{for(r.s();!(n=r.n()).done;)(0,n.value)(this.contextBootstrapRegistry[t])}catch(t){r.e(t)}finally{r.f()}}}])&&D(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.ppcpResources=window.ppcpResources||{};const G=window.ppcpResources.ButtonModuleWatcher=window.ppcpResources.ButtonModuleWatcher||new q;function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function W(t){var e,n=[],r=function(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return H(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?H(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},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(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(t);try{for(r.s();!(e=r.n()).done;){var o=e.value,i=o.contactField,a=void 0===i?null:i,u=o.code,c=void 0===u?null:u,l=o.message,s=a?new ApplePayError(c,a,void 0===l?null:l):new ApplePayError(c);n.push(s)}}catch(t){r.e(t)}finally{r.f()}return n}function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function U(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return L(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(L(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,L(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,L(f,"constructor",l),L(l,"constructor",c),c.displayName="GeneratorFunction",L(l,o,"GeneratorFunction"),L(f),L(f,o,"Generator"),L(f,r,function(){return this}),L(f,"toString",function(){return"[object Generator]"}),(U=function(){return{w:i,m:p}})()}function L(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}L=function(t,e,n,r){function i(e,n){L(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},L(t,e,n,r)}function Q(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function z(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,V(r.key),r)}}function V(t){var e=function(t){if("object"!=N(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=N(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==N(e)?e:e+""}var J=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.url=e,this.nonce=n},e=[{key:"validate",value:(n=U().m(function t(e){var n,r,o;return U().w(function(t){for(;;)switch(t.n){case 0:return n=new FormData(e),t.n=1,fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:this.nonce,form_encoded:new URLSearchParams(n).toString()})});case 1:return r=t.v,t.n=2,r.json();case 2:if((o=t.v).success){t.n=4;break}if(o.data.refresh&&jQuery(document.body).trigger("update_checkout"),!o.data.errors){t.n=3;break}return t.a(2,o.data.errors);case 3:throw Error(o.data.message);case 4:return t.a(2,[])}},t,this)}),r=function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function a(t){Q(i,r,o,a,u,"next",t)}function u(t){Q(i,r,o,a,u,"throw",t)}a(void 0)})},function(_x){return r.apply(this,arguments)})}],e&&z(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,r}();function $(t){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$(t)}function K(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,X(r.key),r)}}function X(t){var e=function(t){if("object"!=$(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=$(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$(e)?e:e+""}var Y=function(){return t=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.genericErrorText=e,this.wrapper=n},e=[{key:"genericError",value:function(){this.clear(),this.message(this.genericErrorText)}},{key:"appendPreparedErrorMessageElement",value:function(t){this._getMessageContainer().replaceWith(t)}},{key:"message",value:function(t){this._addMessage(t),this._scrollToMessages()}},{key:"messages",value:function(t){var e=this;t.forEach(function(t){return e._addMessage(t)}),this._scrollToMessages()}},{key:"currentHtml",value:function(){return this._getMessageContainer().outerHTML}},{key:"_addMessage",value:function(t){if("undefined"!=typeof String&&!$(String)||0===t.length)throw new Error("A new message text must be a non-empty string.");var e=this._getMessageContainer(),n=this._prepareMessageElement(t);e.appendChild(n)}},{key:"_scrollToMessages",value:function(){jQuery.scroll_to_notices(jQuery(".woocommerce-error"))}},{key:"_getMessageContainer",value:function(){var t=document.querySelector("ul.woocommerce-error");return null===t&&((t=document.createElement("ul")).setAttribute("class","woocommerce-error"),t.setAttribute("role","alert"),jQuery(this.wrapper).prepend(t)),t}},{key:"_prepareMessageElement",value:function(t){var e=document.createElement("li");return e.innerHTML=t,e}},{key:"clear",value:function(){jQuery(".woocommerce-error, .woocommerce-message").remove()}}],e&&K(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const Z=Y;function tt(t){return tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tt(t)}function et(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nt(r.key),r)}}function nt(t){var e=function(t){if("object"!=tt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=tt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==tt(e)?e:e+""}function rt(t,e,n){(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(t,e),e.set(t,n)}function ot(t,e){return t.get(at(t,e))}function it(t,e,n){return t.set(at(t,e),n),n}function at(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var ut=new WeakMap,ct=new WeakMap,lt=new WeakMap,st=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),rt(this,ut,""),rt(this,ct,!1),rt(this,lt,null);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.length&&it(ut,this,"[".concat(n.join(" | "),"]"))},e=[{key:"enabled",set:function(t){it(ct,this,t)}},{key:"log",value:function(){if(ot(ct,this)){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(t=console).log.apply(t,[ot(ut,this)].concat(n))}}},{key:"error",value:function(){for(var t,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(t=console).error.apply(t,[ot(ut,this)].concat(n))}},{key:"group",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;ot(ct,this)&&(t&&!ot(lt,this)||(console.groupEnd(),it(lt,this,null)),t&&(console.group(t),it(lt,this,t)))}}],e&&et(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ft(t){return ft="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ft(t)}function pt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return yt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},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(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function yt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function dt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,ht(r.key),r)}}function ht(t){var e=function(t){if("object"!=ft(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ft(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ft(e)?e:e+""}var bt=function(){return t=function t(e,n){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.selector=e,this.selectorInContainer=n,this.containers=[],this.reloadContainers(),jQuery(window).resize(function(){r.refresh()}).resize(),jQuery(document).on("ppcp-smart-buttons-init",function(){r.refresh()}),jQuery(document).on("ppcp-shown ppcp-hidden ppcp-enabled ppcp-disabled",function(t,e){r.refresh(),setTimeout(r.refresh.bind(r),200)}),new MutationObserver(this.observeElementsCallback.bind(this)).observe(document.body,{childList:!0,subtree:!0})},(e=[{key:"observeElementsCallback",value:function(t,e){var n,r=this.selector+", .widget_shopping_cart, .widget_shopping_cart_content",o=!1,i=pt(t);try{for(i.s();!(n=i.n()).done;){var a=n.value;"childList"===a.type&&a.addedNodes.forEach(function(t){t.matches&&t.matches(r)&&(o=!0)})}}catch(t){i.e(t)}finally{i.f()}o&&(this.reloadContainers(),this.refresh())}},{key:"reloadContainers",value:function(){var t=this;jQuery(this.selector).each(function(e,n){var r=jQuery(n).parent();t.containers.some(function(t){return t.is(r)})||t.containers.push(r)})}},{key:"refresh",value:function(){var t,e=this,n=pt(this.containers);try{var r=function(){var n=t.value,r=jQuery(n),o=r.width();r.removeClass("ppcp-width-500 ppcp-width-300 ppcp-width-min"),o>=500?r.addClass("ppcp-width-500"):o>=300?r.addClass("ppcp-width-300"):r.addClass("ppcp-width-min");var i=r.children(":visible").first();r.find(e.selectorInContainer).each(function(t,e){var n=jQuery(e);if(n.is(i))return n.css("margin-top","0px"),!0;var r=n.height(),o=Math.max(11,Math.round(.3*r));n.css("margin-top","".concat(o,"px"))})};for(n.s();!(t=n.n()).done;)r()}catch(t){n.e(t)}finally{n.f()}}}])&&dt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),vt="ppcp-gateway",mt={Cart:"cart",Checkout:"checkout",BlockCart:"cart-block",BlockCheckout:"checkout-block",Product:"product",MiniCart:"mini-cart",PayNow:"pay-now",Preview:"preview",Blocks:["cart-block","checkout-block"],Gateways:["checkout","pay-now"]},gt=function(){var t=document.querySelector('input[name="payment_method"]:checked');return t?t.value:null};function wt(t){return wt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wt(t)}function St(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function jt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?St(Object(n),!0).forEach(function(e){_t(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):St(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _t(t,e,n){return(e=function(t){var e=function(t){if("object"!=wt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=wt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==wt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Ot=Object.freeze({INVALIDATE:"ppcp_invalidate_methods",RENDER:"ppcp_render_method",REDRAW:"ppcp_redraw_method"});function Pt(t){return Object.values(Ot).includes(t)}function kt(t){var e=t.event,n=t.paymentMethod,r=void 0===n?"":n,o=t.callback;if(!Pt(e))throw new Error("Invalid event: ".concat(e));var i=r?"".concat(e,"-").concat(r):e;document.body.addEventListener(i,o)}var Et=function(t){return"string"==typeof t?document.querySelector(t):t};function Ct(t){return Ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ct(t)}function At(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Tt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},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(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Tt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function xt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Rt(r.key),r)}}function It(t,e,n){Mt(t,e),e.set(t,n)}function Mt(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Bt(t,e,n){return(e=Rt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Rt(t){var e=function(t){if("object"!=Ct(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ct(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ct(e)?e:e+""}function Dt(t,e){return t.get(qt(t,e))}function Ft(t,e,n){return t.set(qt(t,e),n),n}function qt(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}var Gt=new WeakMap,Ht=new WeakMap,Wt=new WeakMap,Nt=new WeakMap,Ut=new WeakMap,Lt=new WeakMap,Qt=new WeakMap,zt=new WeakMap,Vt=new WeakMap,Jt=new WeakMap,$t=new WeakMap,Kt=new WeakMap,Xt=new WeakMap,Yt=new WeakMap,Zt=new WeakMap,te=new WeakMap,ee=new WeakMap,ne=new WeakSet,re=function(){return t=function t(e){var n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Mt(this,r=ne),r.add(this),It(this,Gt,void 0),It(this,Ht,!1),It(this,Wt,!1),It(this,Nt,void 0),It(this,Ut,void 0),It(this,Lt,void 0),It(this,Qt,[]),It(this,zt,void 0),It(this,Vt,void 0),It(this,Jt,void 0),It(this,$t,void 0),It(this,Kt,void 0),It(this,Xt,null),It(this,Yt,!0),It(this,Zt,!0),It(this,te,null),It(this,ee,[]),this.methodId===t.methodId)throw new Error("Cannot initialize the PaymentButton base class");i||(i={});var s=!(null===(n=i)||void 0===n||!n.is_debug),f=this.methodId.replace(/^ppcp?-/,"");Ft(Nt,this,e),Ft(zt,this,i),Ft(Vt,this,a),Ft(Jt,this,o),Ft($t,this,u),Ft(Kt,this,c),this.onClick=l,Ft(Gt,this,new st(f,e)),s&&(Dt(Gt,this).enabled=!0,function(t,e){window.ppcpPaymentButtonList=window.ppcpPaymentButtonList||{};var n=window.ppcpPaymentButtonList;n[t]=n[t]||[],n[t].push(e)}(f,this)),Ft(Ut,this,this.constructor.getWrappers(Dt(zt,this),Dt(Vt,this))),this.applyButtonStyles(Dt(zt,this)),this.registerValidationRules(qt(ne,this,oe).bind(this),qt(ne,this,ie).bind(this)),function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".ppcp-button-apm",n=e;if(!window.ppcpApmButtons){if(t&&t.button){var r=t.button.wrapper;jQuery(r).children('div[class^="item-"]').length>0&&(e+=", ".concat(r,' div[class^="item-"]'),n+=', div[class^="item-"]')}window.ppcpApmButtons=new bt(e,n)}}(Dt(Vt,this)),this.initEventListeners()},e=[{key:"methodId",get:function(){return this.constructor.methodId}},{key:"cssClass",get:function(){return this.constructor.cssClass}},{key:"isInitialized",get:function(){return Dt(Ht,this)}},{key:"context",get:function(){return Dt(Nt,this)}},{key:"buttonConfig",get:function(){return Dt(zt,this)}},{key:"ppcpConfig",get:function(){return Dt(Vt,this)}},{key:"externalHandler",get:function(){return Dt(Jt,this)||{}}},{key:"contextHandler",get:function(){return Dt($t,this)||{}}},{key:"requiresShipping",get:function(){return"function"==typeof this.contextHandler.shippingAllowed&&this.contextHandler.shippingAllowed()}},{key:"wrappers",get:function(){return Dt(Ut,this)}},{key:"style",get:function(){return mt.MiniCart===this.context?Dt(Lt,this).MiniCart:Dt(Lt,this).Default}},{key:"wrapperId",get:function(){return mt.MiniCart===this.context?this.wrappers.MiniCart:this.isSeparateGateway?this.wrappers.Gateway:mt.Blocks.includes(this.context)?this.wrappers.Block:this.wrappers.Default}},{key:"isInsideClassicGateway",get:function(){return mt.Gateways.includes(this.context)}},{key:"isSeparateGateway",get:function(){return Dt(zt,this).is_wc_gateway_enabled&&this.isInsideClassicGateway}},{key:"isCurrentGateway",get:function(){if(!this.isInsideClassicGateway)return!0;var t=gt();return this.isSeparateGateway?this.methodId===t:vt===t}},{key:"isPreview",get:function(){return mt.Preview===this.context}},{key:"isEligible",get:function(){return Dt(Xt,this)},set:function(t){t!==Dt(Xt,this)&&(Ft(Xt,this,t),this.triggerRedraw())}},{key:"isVisible",get:function(){return Dt(Yt,this)},set:function(t){Dt(Yt,this)!==t&&(Ft(Yt,this,t),this.triggerRedraw())}},{key:"isEnabled",get:function(){return Dt(Zt,this)},set:function(t){Dt(Zt,this)!==t&&(Ft(Zt,this,t),this.triggerRedraw())}},{key:"wrapperElement",get:function(){return document.getElementById(this.wrapperId)}},{key:"ppcpButtonWrapperSelector",get:function(){var t,e;return mt.Blocks.includes(this.context)?null:this.context===mt.MiniCart?null===(e=this.ppcpConfig)||void 0===e||null===(e=e.button)||void 0===e?void 0:e.mini_cart_wrapper:null===(t=this.ppcpConfig)||void 0===t||null===(t=t.button)||void 0===t?void 0:t.wrapper}},{key:"isPresent",get:function(){return this.wrapperElement instanceof HTMLElement}},{key:"isButtonAttached",get:function(){if(!Dt(te,this))return!1;for(var t=Dt(te,this).parentElement;null!==(e=t)&&void 0!==e&&e.parentElement;){var e;if("BODY"===t.tagName)return!0;t=t.parentElement}return!1}},{key:"log",value:function(){var t;(t=Dt(Gt,this)).log.apply(t,arguments)}},{key:"error",value:function(){var t;(t=Dt(Gt,this)).error.apply(t,arguments)}},{key:"logGroup",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;Dt(Gt,this).group(t)}},{key:"registerValidationRules",value:function(t,e){}},{key:"validateConfiguration",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=At(Dt(ee,this));try{for(n.s();!(t=n.n()).done;){var r=t.value,o=r.check();if(r.shouldPass&&o)return!0;if(!r.shouldPass&&o)return!e&&r.errorMessage&&this.error(r.errorMessage),!1}}catch(t){n.e(t)}finally{n.f()}return!0}},{key:"applyButtonStyles",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e||(e=this.ppcpConfig),Ft(Lt,this,this.constructor.getStyles(t,e)),this.isInitialized&&this.triggerRedraw()}},{key:"configure",value:function(){}},{key:"init",value:function(){Ft(Ht,this,!0)}},{key:"reinit",value:function(){Ft(Ht,this,!1),Ft(Xt,this,!1)}},{key:"triggerRedraw",value:function(){this.showPaymentGateway(),function(t){var e=t.event,n=t.paymentMethod,r=void 0===n?"":n;if(!Pt(e))throw new Error("Invalid event: ".concat(e));var o=r?"".concat(e,"-").concat(r):e;document.body.dispatchEvent(new Event(o))}({event:Ot.REDRAW,paymentMethod:this.methodId})}},{key:"syncProductButtonsState",value:function(){var t,e=document.querySelector(this.ppcpButtonWrapperSelector);e&&(this.isVisible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}(e),this.isEnabled=!((t=Et(e))&&jQuery(t).hasClass("ppcp-disabled")))}},{key:"initEventListeners",value:function(){var t=this;if(kt({event:Ot.REDRAW,paymentMethod:this.methodId,callback:function(){return t.refresh()}}),this.isInsideClassicGateway){var e=this.isSeparateGateway?this.methodId:vt;kt({event:Ot.INVALIDATE,callback:function(){return t.isVisible=!1}}),kt({event:Ot.RENDER,paymentMethod:e,callback:function(){return t.isVisible=!0}})}this.context===mt.Product&&(jQuery(document).on("ppcp-shown ppcp-hidden ppcp-enabled ppcp-disabled",function(e,n){jQuery(n.selector).is(t.ppcpButtonWrapperSelector)&&t.syncProductButtonsState()}),this.syncProductButtonsState())}},{key:"refresh",value:function(){this.isPresent&&(this.isEligible?(this.applyWrapperStyles(),this.isEligible&&this.isCurrentGateway&&this.isVisible&&(this.isButtonAttached||(this.log("refresh.addButton"),this.addButton()))):this.wrapperElement.style.display="none")}},{key:"showPaymentGateway",value:function(){if(!Dt(Wt,this)&&this.isSeparateGateway&&this.isEligible){var t='style[data-hide-gateway="'.concat(this.methodId,'"]'),e="#".concat(this.wrappers.Default),n=document.querySelector(".wc_payment_method.payment_method_".concat(this.methodId));document.querySelectorAll(t).forEach(function(t){return t.remove()}),"none"!==n.style.display&&""!==n.style.display||(n.style.display="block"),document.querySelectorAll(e).forEach(function(t){return t.remove()}),this.log("Show gateway"),Ft(Wt,this,!0),this.isVisible=this.isCurrentGateway}}},{key:"applyWrapperStyles",value:function(){var t,e,n=this.wrapperElement;if(n){var r,o=this.style,i=o.shape,a=o.height,u=At(Dt(Qt,this));try{for(u.s();!(r=u.n()).done;){var c=r.value;n.classList.remove(c)}}catch(t){u.e(t)}finally{u.f()}Ft(Qt,this,[]);var l=["ppcp-button-".concat(i),"ppcp-button-apm",this.cssClass];(t=n.classList).add.apply(t,l),(e=Dt(Qt,this)).push.apply(e,l),a&&(n.style.height="".concat(a,"px")),n.style.display=this.isVisible?"block":"none";var s=this.context===mt.Product?"form.cart":null;!function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=Et(t);r&&(e?(jQuery(r).removeClass("ppcp-disabled").off("mouseup").find("> *").css("pointer-events",""),function(t,e){jQuery(document).trigger("ppcp-enabled",{handler:"ButtonsDisabler.setEnabled",action:"enable",selector:t,element:e})}(t,r)):(jQuery(r).addClass("ppcp-disabled").on("mouseup",function(t){if(t.stopImmediatePropagation(),n){var e=jQuery(n);e.find(".single_add_to_cart_button").hasClass("disabled")&&e.find(":submit").trigger("click")}}).find("> *").css("pointer-events","none"),function(t,e){jQuery(document).trigger("ppcp-disabled",{handler:"ButtonsDisabler.setEnabled",action:"disable",selector:t,element:e})}(t,r)))}(n,this.isEnabled,s)}}},{key:"addButton",value:function(){throw new Error("Must be implemented by the child class")}},{key:"insertButton",value:function(t){if(this.isPresent){var e=this.wrapperElement;Dt(te,this)&&this.removeButton(),this.log("insertButton",t),Ft(te,this,t),e.appendChild(Dt(te,this))}}},{key:"removeButton",value:function(){if(this.isPresent&&Dt(te,this)){this.log("removeButton");try{this.wrapperElement.removeChild(Dt(te,this))}catch(t){}Ft(te,this,null)}}}],n=[{key:"createButton",value:function(t,e,n,r,o,i){var a,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,c=(a="__ppcpPBInstances",document.body[a]||Object.defineProperty(document.body,a,{value:new Map,enumerable:!1,writable:!1,configurable:!1}),document.body[a]),l="".concat(this.methodId,".").concat(t);if(!c.has(l)){var s=new this(t,e,n,r,o,i,u);c.set(l,s)}return c.get(l)}},{key:"getWrappers",value:function(t,e){throw new Error("Must be implemented in the child class")}},{key:"getStyles",value:function(t,e){throw new Error("Must be implemented in the child class")}}],e&&xt(t.prototype,e),n&&xt(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function oe(t,e){Dt(ee,this).push({check:t,errorMessage:e,shouldPass:!1})}function ie(t){Dt(ee,this).push({check:t,shouldPass:!0})}function ae(t){return ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ae(t)}function ue(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ce(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ce(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},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(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function le(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return se(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(se(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,se(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,se(f,"constructor",l),se(l,"constructor",c),c.displayName="GeneratorFunction",se(l,o,"GeneratorFunction"),se(f),se(f,o,"Generator"),se(f,r,function(){return this}),se(f,"toString",function(){return"[object Generator]"}),(le=function(){return{w:i,m:p}})()}function se(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}se=function(t,e,n,r){function i(e,n){se(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},se(t,e,n,r)}function fe(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function pe(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){fe(i,r,o,a,u,"next",t)}function u(t){fe(i,r,o,a,u,"throw",t)}a(void 0)})}}function ye(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function de(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ye(Object(n),!0).forEach(function(e){_e(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ye(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function he(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Oe(r.key),r)}}function be(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(be=function(){return!!t})()}function ve(t,e,n,r){var o=me(ge(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof o?function(t){return o.apply(n,t)}:o}function me(){return me="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=ge(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},me.apply(null,arguments)}function ge(t){return ge=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ge(t)}function we(t,e){return we=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},we(t,e)}function Se(t,e,n){je(t,e),e.set(t,n)}function je(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _e(t,e,n){return(e=Oe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Oe(t){var e=function(t){if("object"!=ae(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ae(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ae(e)?e:e+""}function Pe(t,e){return t.get(Ee(t,e))}function ke(t,e,n){return t.set(Ee(t,e),n),n}function Ee(t,e,n){if("function"==typeof t?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}Bt(re,"methodId","generic"),Bt(re,"cssClass","");var Ce=new WeakMap,Ae=new WeakMap,Te=new WeakMap,xe=new WeakMap,Ie=new WeakMap,Me=new WeakMap,Be=new WeakMap,Re=new WeakMap,De=new WeakMap,Fe=new WeakMap,qe=new WeakSet,Ge=function(t){function e(t,n,r,o,i,a){var u,c,l;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),u=function(t,e,n){return e=ge(e),function(t,e){if(e&&("object"==ae(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,be()?Reflect.construct(e,n||[],ge(t).constructor):e.apply(t,n))}(this,e,[t,n,r,o,i,a]),je(c=u,l=qe),l.add(c),Se(u,Ce,null),Se(u,Ae,[]),Se(u,Te,[]),Se(u,xe,null),Se(u,Ie,null),Se(u,Me,null),Se(u,Be,{}),Se(u,Re,0),Se(u,De,1e3),Se(u,Fe,null),u.init=u.init.bind(u),u.onPaymentAuthorized=u.onPaymentAuthorized.bind(u),u.onButtonClick=u.onButtonClick.bind(u),ke(Be,u,{quantity:null,items:[]}),u.log("Create instance"),u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&we(t,e)}(e,t),n=e,r=[{key:"requiresShipping",get:function(){var t;return!!ve(e,"requiresShipping",this,1)&&!(null===(t=this.buttonConfig.product)||void 0===t||!t.needShipping)&&(mt.Checkout!==this.context||this.shouldUpdateButtonWithFormData)}},{key:"transactionInfo",get:function(){return Pe(Ie,this)},set:function(t){ke(Ie,this,t),this.refresh()}},{key:"nonce",get:function(){var t=document.getElementById("woocommerce-process-checkout-nonce");return(null==t?void 0:t.value)||this.buttonConfig.nonce}},{key:"registerValidationRules",value:function(t,e){var n=this;e(function(){return n.isPreview}),t(function(){return!Pe(Me,n)},"No API configuration - missing configure() call?"),t(function(){return!Pe(Ie,n)},"No transactionInfo - missing configure() call?"),t(function(){var t;return(null===(t=n.buttonAttributes)||void 0===t?void 0:t.height)&&isNaN(parseInt(n.buttonAttributes.height))},"Invalid height in buttonAttributes"),t(function(){var t;return(null===(t=n.buttonAttributes)||void 0===t?void 0:t.borderRadius)&&isNaN(parseInt(n.buttonAttributes.borderRadius))},"Invalid borderRadius in buttonAttributes"),t(function(){var t;return!(null!==(t=n.contextHandler)&&void 0!==t&&t.validateContext())},"Invalid context handler.")}},{key:"configure",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Pe(Re,this)||ke(Re,this,Date.now()),null!=r&&r.height&&null!=r&&r.borderRadius&&ke(Fe,this,de({},r));var o=null!=r&&r.height?r:Pe(Fe,this);if(Date.now()-Pe(Re,this)>Pe(De,this))return this.log("ApplePay: Timeout waiting for buttonAttributes - proceeding with initialization"),ke(Me,this,t),ke(Ie,this,e),this.buttonAttributes=o||r,void this.init();null!=o&&o.height&&null!=o&&o.borderRadius?(ke(Re,this,0),ke(Me,this,t),ke(Ie,this,e),this.buttonAttributes=o,this.init()):setTimeout(function(){return n.configure(t,e,r)},100)}},{key:"init",value:function(){this.isInitialized||this.validateConfiguration()&&(ve(e,"init",this,3)([]),this.checkEligibility())}},{key:"reinit",value:(a=pe(le().m(function t(){var n=this;return le().w(function(t){for(;;)switch(t.n){case 0:if(this.validateConfiguration(!0)){t.n=1;break}return t.a(2);case 1:return t.n=2,this.contextHandler.transactionInfo().then(function(t){n.transactionInfo=t}).catch(function(t){console.error("Failed to get transaction info:",t)});case 2:ve(e,"reinit",this,3)([]),this.init();case 3:return t.a(2)}},t,this)})),function(){return a.apply(this,arguments)})},{key:"checkEligibility",value:function(){if(this.isPreview)this.isEligible=!0;else try{var t;if(null===(t=window.ApplePaySession)||void 0===t||!t.canMakePayments())return void(this.isEligible=!1);this.isEligible=!!Pe(Me,this).isEligible}catch(t){this.isEligible=!1}}},{key:"applePaySession",value:function(t){this.log("applePaySession",t);var e=new ApplePaySession(4,t);return this.requiresShipping&&(e.onshippingmethodselected=this.onShippingMethodSelected(e),e.onshippingcontactselected=this.onShippingContactSelected(e)),e.onvalidatemerchant=this.onValidateMerchant(e),e.onpaymentauthorized=this.onPaymentAuthorized(e),e.begin(),e}},{key:"applyWrapperStyles",value:function(){var t,n;ve(e,"applyWrapperStyles",this,3)([]);var r=this.wrapperElement;if(r){var o=null!==(t=this.buttonAttributes)&&void 0!==t&&t.height||null!==(n=this.buttonAttributes)&&void 0!==n&&n.borderRadius?this.buttonAttributes:Pe(Fe,this),i=null!=o&&o.height?parseInt(o.height,10):48;isNaN(i)?(r.style.setProperty("--apple-pay-button-height","".concat(48,"px")),r.style.height="".concat(48,"px")):(r.style.setProperty("--apple-pay-button-height","".concat(i,"px")),r.style.height="".concat(i,"px"));var a=null!=o&&o.borderRadius?parseInt(o.borderRadius,10):4;isNaN(a)||(r.style.borderRadius="".concat(a,"px"))}}},{key:"addButton",value:function(){var t,e,n=this,r=this.style,o=r.color,i=r.type,a=r.language;null!==(t=this.buttonAttributes)&&void 0!==t&&t.height||null===(e=Pe(Fe,this))||void 0===e||!e.height||(this.buttonAttributes=de({},Pe(Fe,this)));var u=document.createElement("apple-pay-button");u.id="apple-"+this.wrapperId,u.setAttribute("buttonstyle",o),u.setAttribute("type",i),u.setAttribute("locale",a),u.style.display="block",u.addEventListener("click",function(t){t.preventDefault(),n.onButtonClick()}),this.insertButton(u)}},{key:"onButtonClick",value:(i=pe(le().m(function t(){var e,n,r,o,i,a,u,c;return le().w(function(t){for(;;)switch(t.p=t.n){case 0:if(this.log("onButtonClick"),e=this.paymentRequest(),window.ppcpFundingSource="apple_pay",mt.Checkout!==this.context){t.n=6;break}n="form.woocommerce-checkout",r=new Z(PayPalCommerceGateway.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper"));try{o=new FormData(document.querySelector(n)),ke(Ce,this,Object.fromEntries(o.entries())),this.updateRequestDataWithForm(e)}catch(t){console.error(t)}if(this.log("=== paymentRequest",e),i=this.applePaySession(e),!(a=PayPalCommerceGateway.early_checkout_validation_enabled?new J(PayPalCommerceGateway.ajax.validate_checkout.endpoint,PayPalCommerceGateway.ajax.validate_checkout.nonce):null)){t.n=5;break}return t.p=1,t.n=2,a.validate(document.querySelector(n));case 2:if(!((u=t.v).length>0)){t.n=3;break}return r.messages(u),jQuery(document.body).trigger("checkout_error",[r.currentHtml()]),i.abort(),t.a(2);case 3:t.n=5;break;case 4:t.p=4,c=t.v,console.error(c);case 5:return t.a(2);case 6:this.applePaySession(e);case 7:return t.a(2)}},t,this,[[1,4]])})),function(){return i.apply(this,arguments)})},{key:"shouldUpdateButtonWithFormData",get:function(){var t;return mt.Checkout===this.context&&"use_applepay"===(null===(t=this.buttonConfig)||void 0===t||null===(t=t.preferences)||void 0===t?void 0:t.checkout_data_mode)}},{key:"shouldCompletePaymentWithContextHandler",get:function(){return!this.contextHandler.shippingAllowed()||mt.Checkout===this.context&&!this.shouldUpdateButtonWithFormData}},{key:"updateRequestDataWithForm",value:function(t){if(this.shouldUpdateButtonWithFormData&&(t.billingContact=this.fillBillingContact(Pe(Ce,this)),this.requiresShipping)){t.shippingContact=this.fillShippingContact(Pe(Ce,this));var e=this.transactionInfo.chosenShippingMethods[0];t.shippingMethods=[];var n,r=ue(this.transactionInfo.shippingPackages);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(e===o.id){var i={label:o.label,detail:"",amount:o.cost_str,identifier:o.id};ke(Te,this,i),t.shippingMethods.push(i);break}}}catch(t){r.e(t)}finally{r.f()}var a,u=ue(this.transactionInfo.shippingPackages);try{for(u.s();!(a=u.n()).done;){var c=a.value;e!==c.id&&t.shippingMethods.push({label:c.label,detail:"",amount:c.cost_str,identifier:c.id})}}catch(t){u.e(t)}finally{u.f()}ke(xe,this,t),this.log("=== paymentRequest.shippingMethods",t.shippingMethods)}}},{key:"paymentRequest",value:function(){var t=Pe(Me,this),e=this.buttonConfig,n={countryCode:t.countryCode,merchantCapabilities:t.merchantCapabilities,supportedNetworks:t.supportedNetworks,requiredShippingContactFields:["postalAddress","email","phone"],requiredBillingContactFields:["postalAddress"]};this.requiresShipping||(this.shouldCompletePaymentWithContextHandler?n.requiredShippingContactFields=[]:n.requiredShippingContactFields=["email","phone"]);var r=Object.assign({},n);return r.currencyCode=e.shop.currencyCode,r.total={label:e.shop.totalLabel,type:"final",amount:this.transactionInfo.totalPrice},r}},{key:"refreshProductContextData",value:function(){var t;mt.Product===this.context&&(Pe(Be,this).quantity=null===(t=document.querySelector("input.qty"))||void 0===t?void 0:t.value,Pe(Be,this).items=this.contextHandler.products(),this.log("Products updated",Pe(Be,this)))}},{key:"adminValidation",value:function(t){fetch(this.buttonConfig.ajax_url,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"ppcp_validate","woocommerce-process-checkout-nonce":this.nonce,validation:t}).toString()})}},{key:"onValidateMerchant",value:function(t){var e=this;return function(n){e.log("onvalidatemerchant call"),v.paypal.Applepay().validateMerchant({validationUrl:n.validationURL}).then(function(n){t.completeMerchantValidation(n.merchantSession),e.adminValidation(!0)}).catch(function(n){console.error(n),e.adminValidation(!1),e.log("onvalidatemerchant session abort"),t.abort()})}}},{key:"onShippingMethodSelected",value:function(t){var e=this;this.log("onshippingmethodselected",this.buttonConfig.ajax_url);var n=this.buttonConfig.ajax_url;return function(r){e.log("onshippingmethodselected call");var o=e.getShippingMethodData(r);jQuery.ajax({url:n,method:"POST",data:o,success:function(n){e.log("onshippingmethodselected ok");var o=n.data;!1===n.success&&(o.errors=W(o.errors)),ke(Te,e,r.shippingMethod),o.newShippingMethods=o.newShippingMethods.sort(function(t){return t.label===Pe(Te,e).label?-1:1}),!1===n.success&&(o.errors=W(o.errors)),t.completeShippingMethodSelection(o)},error:function(n,r,o){e.log("onshippingmethodselected error",r),console.warn(r,o),t.abort()}})}}},{key:"onShippingContactSelected",value:function(t){var e=this;this.log("onshippingcontactselected",this.buttonConfig.ajax_url);var n=this.buttonConfig.ajax_url;return function(r){e.log("onshippingcontactselected call");var o=e.getShippingContactData(r);jQuery.ajax({url:n,method:"POST",data:o,success:function(n){e.log("onshippingcontactselected ok");var o=n.data;ke(Ae,e,r.shippingContact),!1===n.success&&(o.errors=W(o.errors)),o.newShippingMethods&&ke(Te,e,o.newShippingMethods[0]),t.completeShippingContactSelection(o)},error:function(n,r,o){e.log("onshippingcontactselected error",r),console.warn(r,o),t.abort()}})}}},{key:"getShippingContactData",value:function(t){var e=this.buttonConfig.product.id;switch(this.refreshProductContextData(),this.context){case mt.Product:return{action:"ppcp_update_shipping_contact",product_id:e,products:JSON.stringify(Pe(Be,this).items),caller_page:"productDetail",product_quantity:Pe(Be,this).quantity,simplified_contact:t.shippingContact,need_shipping:this.requiresShipping,"woocommerce-process-checkout-nonce":this.nonce};case mt.Cart:case mt.Checkout:case mt.BlockCart:case mt.BlockCheckout:case mt.MiniCart:return{action:"ppcp_update_shipping_contact",simplified_contact:t.shippingContact,caller_page:"cart",need_shipping:this.requiresShipping,"woocommerce-process-checkout-nonce":this.nonce}}}},{key:"getShippingMethodData",value:function(t){var e,n,r,o,i,a,u=this.buttonConfig.product.id;switch(this.refreshProductContextData(),this.context){case mt.Product:return{action:"ppcp_update_shipping_method",shipping_method:t.shippingMethod,simplified_contact:this.hasValidContactInfo(Pe(Ae,this))?Pe(Ae,this):null!==(e=null===(n=Pe(xe,this))||void 0===n?void 0:n.shippingContact)&&void 0!==e?e:null===(r=Pe(xe,this))||void 0===r?void 0:r.billingContact,product_id:u,products:JSON.stringify(Pe(Be,this).items),caller_page:"productDetail",product_quantity:Pe(Be,this).quantity,"woocommerce-process-checkout-nonce":this.nonce};case mt.Cart:case mt.Checkout:case mt.BlockCart:case mt.BlockCheckout:case mt.MiniCart:return{action:"ppcp_update_shipping_method",shipping_method:t.shippingMethod,simplified_contact:this.hasValidContactInfo(Pe(Ae,this))?Pe(Ae,this):null!==(o=null===(i=Pe(xe,this))||void 0===i?void 0:i.shippingContact)&&void 0!==o?o:null===(a=Pe(xe,this))||void 0===a?void 0:a.billingContact,caller_page:"cart","woocommerce-process-checkout-nonce":this.nonce}}}},{key:"onPaymentAuthorized",value:function(t){var e=this;return this.log("onpaymentauthorized"),function(){var n=pe(le().m(function n(r){var o,i,a,u,c,l,s,f;return le().w(function(n){for(;;)switch(n.p=n.n){case 0:return e.log("onpaymentauthorized call"),o=function(){var t=pe(le().m(function t(n){return le().w(function(t){for(;;)if(0===t.n)return t.a(2,new Promise(function(t,o){try{var i,a=n.billing_contact||Pe(xe,e).billingContact,u=n.shipping_contact||Pe(xe,e).shippingContact,c=Pe(Te,e)||(Pe(xe,e).shippingMethods||[])[0],l={action:"ppcp_create_order",caller_page:e.context,product_id:null!==(i=e.buttonConfig.product.id)&&void 0!==i?i:null,products:JSON.stringify(Pe(Be,e).items),product_quantity:Pe(Be,e).quantity,shipping_contact:u,billing_contact:a,token:r.payment.token,shipping_method:c,"woocommerce-process-checkout-nonce":e.nonce,funding_source:"applepay",_wp_http_referer:"/?wc-ajax=update_order_review",paypal_order_id:n.paypal_order_id};e.log("onpaymentauthorized request",e.buttonConfig.ajax_url,n),jQuery.ajax({url:e.buttonConfig.ajax_url,method:"POST",data:l,complete:function(){e.log("onpaymentauthorized complete")},success:function(n){e.log("onpaymentauthorized ok"),t(n)},error:function(t,n,r){e.log("onpaymentauthorized error",n),o(new Error(r))}})}catch(t){e.error("onpaymentauthorized catch",t)}}))},t)}));return function(e){return t.apply(this,arguments)}}(),n.n=1,e.contextHandler.createOrder();case 1:return i=n.v,e.log("onpaymentauthorized paypal order ID",i,r.payment.token,r.payment.billingContact),n.p=2,n.n=3,v.paypal.Applepay().confirmOrder({orderId:i,token:r.payment.token,billingContact:r.payment.billingContact});case 3:if(a=n.v,e.log("onpaymentauthorized confirmOrderResponse",a),!a||!a.approveApplePayPayment){n.n=13;break}if("APPROVED"!==a.approveApplePayPayment.status){n.n=11;break}if(n.p=4,!e.shouldCompletePaymentWithContextHandler){n.n=6;break}return u=!1,n.n=5,e.contextHandler.approveOrder({orderID:i},{restart:function(){return new Promise(function(t){u=!0,t()})},order:{get:function(){return new Promise(function(t){t(null)})}}});case 5:u?(e.error("onpaymentauthorized approveOrder FAIL"),t.completePayment(ApplePaySession.STATUS_FAILURE),t.abort()):(e.log("onpaymentauthorized approveOrder OK"),t.completePayment(ApplePaySession.STATUS_SUCCESS)),n.n=8;break;case 6:return c={billing_contact:r.payment.billingContact,shipping_contact:r.payment.shippingContact,paypal_order_id:i},n.n=7,o(c);case 7:"success"===(l=n.v).result?(t.completePayment(ApplePaySession.STATUS_SUCCESS),window.location.href=l.redirect):t.completePayment(ApplePaySession.STATUS_FAILURE);case 8:n.n=10;break;case 9:n.p=9,s=n.v,t.completePayment(ApplePaySession.STATUS_FAILURE),t.abort(),console.error(s);case 10:n.n=12;break;case 11:console.error("Error status is not APPROVED"),t.completePayment(ApplePaySession.STATUS_FAILURE);case 12:n.n=14;break;case 13:console.error("Invalid confirmOrderResponse"),t.completePayment(ApplePaySession.STATUS_FAILURE);case 14:n.n=16;break;case 15:n.p=15,f=n.v,console.error("Error confirming order with applepay token",f),t.completePayment(ApplePaySession.STATUS_FAILURE),t.abort();case 16:return n.a(2)}},n,null,[[4,9],[2,15]])}));return function(_x){return n.apply(this,arguments)}}()}},{key:"fillBillingContact",value:function(t){return Ee(qe,this,He).call(this,t,"billing","")}},{key:"fillShippingContact",value:function(t){return null!=t&&t.shipping_first_name?Ee(qe,this,He).call(this,t,"shipping","billing"):this.fillBillingContact(t)}},{key:"hasValidContactInfo",value:function(t){return Array.isArray(t)?t.length>0:Object.keys(t||{}).length>0}}],o=[{key:"getWrappers",value:function(t,e){var n,r,o;return function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=function(t){return t.replace(/^#/,"")};return{Default:o(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""),SmartButton:o(e),Block:o(n),Gateway:o(r),MiniCart:o(t)}}((null==t||null===(n=t.button)||void 0===n?void 0:n.wrapper)||"",(null==t||null===(r=t.button)||void 0===r?void 0:r.mini_cart_wrapper)||"",(null==e||null===(o=e.button)||void 0===o?void 0:o.wrapper)||"","ppc-button-applepay-container","ppc-button-ppcp-applepay")}},{key:"getStyles",value:function(t,e){var n=(null==t?void 0:t.button)||{},r={color:n.color,lang:n.lang,type:n.type},o={style:r,mini_cart_style:r};return function(t,e){return{Default:jt(jt({},t.style),e.style),MiniCart:jt(jt({},t.mini_cart_style),e.mini_cart_style)}}((null==e?void 0:e.button)||{},o)}}],r&&he(n.prototype,r),o&&he(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i,a}(re);function He(t,e,n){t&&"object"===ae(t)||(t={});var r=function(r){return t["".concat(e,"_").concat(r)]||t["".concat(n,"_").concat(r)]||""};return{givenName:r("first_name"),familyName:r("last_name"),emailAddress:r("email"),phoneNumber:r("phone"),addressLines:[r("address_1"),r("address_2")],locality:r("city"),postalCode:r("postcode"),countryCode:r("country"),administrativeArea:r("state")}}_e(Ge,"methodId","ppcp-applepay"),_e(Ge,"cssClass","ppcp-button-applepay");const We=Ge;function Ne(t){return Ne="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ne(t)}function Ue(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Le(r.key),r)}}function Le(t){var e=function(t){if("object"!=Ne(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ne(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ne(e)?e:e+""}var Qe=function(){return t=function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e,this.quantity=n,this.variations=r,this.extra=o},(e=[{key:"data",value:function(){return{id:this.id,quantity:this.quantity,variations:this.variations,extra:this.extra}}}])&&Ue(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const ze=Qe;function Ve(t){return Ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ve(t)}function Je(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function $e(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Je(Object(n),!0).forEach(function(e){Ke(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Je(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Ke(t,e,n){return(e=Ye(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Xe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ye(r.key),r)}}function Ye(t){var e=function(t){if("object"!=Ve(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ve(e)?e:e+""}function Ze(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ze=function(){return!!t})()}function tn(){return tn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=en(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}},tn.apply(null,arguments)}function en(t){return en=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},en(t)}function nn(t,e){return nn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},nn(t,e)}var rn=function(t){function e(t,n,r,o){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=function(t,e,n){return e=en(e),function(t,e){if(e&&("object"==Ve(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ze()?Reflect.construct(e,n||[],en(t).constructor):e.apply(t,n))}(this,e,[t,n,null,o])).booking=r,i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nn(t,e)}(e,t),n=e,r=[{key:"data",value:function(){return $e($e({},(t=e,n=this,"function"==typeof(r=tn(en(1&3?t.prototype:t),"data",n))?function(t){return r.apply(n,t)}:r)([])),{},{booking:this.booking});var t,n,r}}],r&&Xe(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ze);const on=rn;function an(t){return an="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},an(t)}function un(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,cn(r.key),r)}}function cn(t){var e=function(t){if("object"!=an(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=an(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==an(e)?e:e+""}var ln=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"form.woocommerce-checkout";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.target=e}return e=t,r=[{key:"fullPage",value:function(){return new t(window)}}],(n=[{key:"setTarget",value:function(t){this.target=t}},{key:"block",value:function(){jQuery(this.target).block({message:null,overlayCSS:{background:"#fff",opacity:.6},baseZ:1e4})}},{key:"unblock",value:function(){jQuery(this.target).unblock()}}])&&un(e.prototype,n),r&&un(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();const sn=ln,fn=function(t,e){return function(n,r){var o=sn.fullPage();o.block();var i=!t.config.vaultingEnabled||"venmo"!==n.paymentSource,a={nonce:t.config.ajax.approve_order.nonce,order_id:n.orderID,funding_source:window.ppcpFundingSource,should_create_wc_order:i};return i&&n.payer&&(a.payer=n.payer),i&&n.shippingAddress&&(a.shipping_address=n.shippingAddress),fetch(t.config.ajax.approve_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(a)}).then(function(t){return t.json()}).then(function(n){var o;if(!n.success)return e.genericError(),r.restart().catch(function(){e.genericError()});var i,a=null===(o=n.data)||void 0===o?void 0:o.order_received_url;i=a||t.config.redirect,setTimeout(function(){window.location.href=i},200)}).finally(function(){o.unblock()})}};function pn(t){return pn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pn(t)}function yn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return dn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?dn(t,e):void 0}}(t,e)||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 dn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var hn={"#billing_email":["email_address"],"#billing_last_name":["name","surname"],"#billing_first_name":["name","given_name"],"#billing_country":["address","country_code"],"#billing_address_1":["address","address_line_1"],"#billing_address_2":["address","address_line_2"],"#billing_state":["address","admin_area_1"],"#billing_city":["address","admin_area_2"],"#billing_postcode":["address","postal_code"],"#billing_phone":["phone"]};function bn(t){var e,n,r,o,i,a,u,c;return{email_address:t.email_address,phone:t.phone,name:{surname:null===(e=t.name)||void 0===e?void 0:e.surname,given_name:null===(n=t.name)||void 0===n?void 0:n.given_name},address:{country_code:null===(r=t.address)||void 0===r?void 0:r.country_code,address_line_1:null===(o=t.address)||void 0===o?void 0:o.address_line_1,address_line_2:null===(i=t.address)||void 0===i?void 0:i.address_line_2,admin_area_1:null===(a=t.address)||void 0===a?void 0:a.admin_area_1,admin_area_2:null===(u=t.address)||void 0===u?void 0:u.admin_area_2,postal_code:null===(c=t.address)||void 0===c?void 0:c.postal_code}}}function vn(){var t,e,n=null!==(t=null===(e=window)||void 0===e||null===(e=e.PayPalCommerceGateway)||void 0===e?void 0:e.payer)&&void 0!==t?t:window._PpcpPayerSessionDetails;if(!n)return null;var r,o,i,a=(i={},Object.entries(hn).forEach(function(t){var e=yn(t,2),n=e[0],r=e[1],o=function(t){var e;return null===(e=document.querySelector(t))||void 0===e?void 0:e.value}(n);o&&function(t,e,n){for(var r=t,o=0;o<e.length-1;o++)r=r[e[o]]=r[e[o]]||{};r[e[e.length-1]]=n}(i,r,o)}),i.phone&&"string"==typeof i.phone&&(i.phone={phone_type:"HOME",phone_number:{national_number:i.phone}}),i);return a?(r=a,(o=function(t,e){for(var n=0,r=Object.entries(e);n<r.length;n++){var i=yn(r[n],2),a=i[0],u=i[1];null!=u&&("object"===pn(u)?t[a]=o(t[a]||{},u):t[a]=u)}return t})(bn(n),bn(r))):bn(n)}function mn(t){return mn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mn(t)}function gn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return wn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},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(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function wn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Sn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,jn(r.key),r)}}function jn(t){var e=function(t){if("object"!=mn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=mn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mn(e)?e:e+""}var On=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cartItemKeys=e},(e=[{key:"getEndpoint",value:function(){var t="/?wc-ajax=%%endpoint%%";return"undefined"!=typeof wc_cart_fragments_params&&wc_cart_fragments_params.wc_ajax_url&&(t=wc_cart_fragments_params.wc_ajax_url),t.toString().replace("%%endpoint%%","remove_from_cart")}},{key:"addFromPurchaseUnits",value:function(t){var e,n=gn(t||[]);try{for(n.s();!(e=n.n()).done;){var r,o=gn(e.value.items||[]);try{for(o.s();!(r=o.n()).done;){var i=r.value;i.cart_item_key&&this.cartItemKeys.push(i.cart_item_key)}}catch(t){o.e(t)}finally{o.f()}}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"removeFromCart",value:function(){var t=this;return new Promise(function(e,n){if(t.cartItemKeys&&t.cartItemKeys.length){var r,o=t.cartItemKeys.length,i=0,a=function(){++i>=o&&e()},u=gn(t.cartItemKeys);try{for(u.s();!(r=u.n()).done;){var c=r.value,l=new URLSearchParams;l.append("cart_item_key",c),c?fetch(t.getEndpoint(),{method:"POST",credentials:"same-origin",body:l}).then(function(t){return t.json()}).then(function(){a()}).catch(function(){a()}):a()}}catch(t){u.e(t)}finally{u.f()}}else e()})}}])&&Sn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const Pn=On;function kn(t){return kn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kn(t)}function En(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||An(t,e)||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 Cn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=An(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},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(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function An(t,e){if(t){if("string"==typeof t)return Tn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Tn(t,e):void 0}}function Tn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function xn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,In(r.key),r)}}function In(t){var e=function(t){if("object"!=kn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=kn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==kn(e)?e:e+""}var Mn=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"getPrefixedFields",value:function(t,e){var n,r={},o=Cn(new FormData(t).entries());try{for(o.s();!(n=o.n()).done;){var i=En(n.value,2),a=i[0],u=i[1];e&&!a.startsWith(e)||(r[a]=u)}}catch(t){o.e(t)}finally{o.f()}return r}},{key:"getFilteredFields",value:function(t,e,n){var r,o=new FormData(t),i={},a={},u=Cn(o.entries());try{var c=function(){var t=En(r.value,2),o=t[0],u=t[1];if(-1!==o.indexOf("[]")){var c=o;a[c]=a[c]||0,o=o.replace("[]","[".concat(a[c],"]")),a[c]++}return o?e&&-1!==e.indexOf(o)||n&&n.some(function(t){return o.startsWith(t)})?0:void(i[o]=u):0};for(u.s();!(r=u.n()).done;)c()}catch(t){u.e(t)}finally{u.f()}return i}}],null&&xn(t.prototype,null),e&&xn(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Bn(t){return Bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bn(t)}function Rn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Dn(r.key),r)}}function Dn(t){var e=function(t){if("object"!=Bn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Bn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Bn(e)?e:e+""}var Fn,qn,Gn,Hn=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},e=[{key:"cleanHashParams",value:function(){var t=this;if(window.location.hash){var e=window.location.hash.substring(1).split("&").filter(function(e){var n=e.split("=")[0];return!t.PAYPAL_PARAMS.includes(n)});if(e.length>0){var n="#"+e.join("&");window.history.replaceState(null,"",window.location.pathname+window.location.search+n)}else window.history.replaceState(null,"",window.location.pathname+window.location.search)}}},{key:"isResumeFlow",value:function(){return!!window.location.hash&&window.location.hash.substring(1).split("&").some(function(t){return"switch_initiated_time"===t.split("=")[0]})}},{key:"reloadButtonsIfRequired",value:function(t){this.isResumeFlow()&&(this.cleanHashParams(),jQuery(t).trigger("ppcp-reload-buttons"))}}],null&&Rn(t.prototype,null),e&&Rn(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();Fn=Hn,Gn=["onApprove","token","PayerID","payerID","button_session_id","billingToken","orderID","switch_initiated_time","onCancel","onError"],(qn=Dn(qn="PAYPAL_PARAMS"))in Fn?Object.defineProperty(Fn,qn,{value:Gn,enumerable:!0,configurable:!0,writable:!0}):Fn[qn]=Gn;const Wn=Hn;function Nn(t){return Nn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nn(t)}function Un(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Ln(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qn(r.key),r)}}function Qn(t){var e=function(t){if("object"!=Nn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Nn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Nn(e)?e:e+""}var zn=function(){return function(t,e){return e&&Ln(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.cartUpdater=n,this.formElement=r,this.errorHandler=o,this.cartHelper=null},[{key:"subscriptionsConfiguration",value:function(t){var e=this;return{createSubscription:function(e,n){return n.subscription.create({plan_id:t})},onApprove:function(t,n){fetch(e.config.ajax.approve_subscription.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:e.config.ajax.approve_subscription.nonce,order_id:t.orderID,subscription_id:t.subscriptionID})}).then(function(t){return t.json()}).then(function(){var t=e.getSubscriptionProducts();fetch(e.config.ajax.change_cart.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:e.config.ajax.change_cart.nonce,products:t})}).then(function(t){return t.json()}).then(function(t){if(!t.success)throw console.log(t),Error(t.data.message);location.href=e.config.redirect})})},onError:function(t){console.error(t),Wn.reloadButtonsIfRequired(e.config.button.wrapper)}}}},{key:"getSubscriptionProducts",value:function(){var t=document.querySelector('[name="add-to-cart"]').value;return[new ze(t,1,this.variations(),this.extraFields())]}},{key:"configuration",value:function(){var t=this;return{createOrder:this.createOrder(),onApprove:fn(this,this.errorHandler),onError:function(e){t.refreshMiniCart(),t.isBookingProduct()&&e.message?(t.errorHandler.clear(),t.errorHandler.message(e.message)):t.errorHandler.genericError(),Wn.reloadButtonsIfRequired(t.config.button.wrapper)},onCancel:function(){t.isBookingProduct()?t.cleanCart():t.refreshMiniCart(),Wn.reloadButtonsIfRequired(t.config.button.wrapper)}}}},{key:"getProducts",value:function(){var t=this;if(this.isBookingProduct()){var e=document.querySelector('[name="add-to-cart"]').value;return[new on(e,1,Mn.getPrefixedFields(this.formElement,"wc_bookings_field"),this.extraFields())]}if(this.isGroupedProduct()){var n=[];return this.formElement.querySelectorAll('input[type="number"]').forEach(function(e){if(e.value){var r=e.getAttribute("name").match(/quantity\[([\d]*)\]/);if(2===r.length){var o=parseInt(r[1]),i=parseInt(e.value);n.push(new ze(o,i,null,t.extraFields()))}}}),n}var r=document.querySelector('[name="add-to-cart"]').value,o=document.querySelector('[name="quantity"]').value,i=this.variations();return[new ze(r,o,i,this.extraFields())]}},{key:"extraFields",value:function(){return Mn.getFilteredFields(this.formElement,["add-to-cart","quantity","product_id","variation_id"],["attribute_","wc_bookings_field"])}},{key:"createOrder",value:function(){var t=this;return this.cartHelper=null,function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.errorHandler.clear(),t.cartUpdater.update(function(e){t.cartHelper=(new Pn).addFromPurchaseUnits(e);var n=vn(),r=void 0!==t.config.bn_codes[t.config.context]?t.config.bn_codes[t.config.context]:"";return fetch(t.config.ajax.create_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.create_order.nonce,purchase_units:e,payer:n,bn_code:r,payment_method:vt,funding_source:window.ppcpFundingSource,context:t.config.context})}).then(function(t){return t.json()}).then(function(t){if(!t.success)throw console.error(t),Error(t.data.message);return t.data.id})},t.getProducts(),r.updateCartOptions||{})}}},{key:"updateCart",value:function(t){return this.cartUpdater.update(function(t){return t},this.getProducts(),t)}},{key:"variations",value:function(){return this.hasVariations()?function(t){return function(t){if(Array.isArray(t))return Un(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Un(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Un(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(this.formElement.querySelectorAll("[name^='attribute_']")).map(function(t){return{value:t.value,name:t.name}}):null}},{key:"hasVariations",value:function(){return this.formElement.classList.contains("variations_form")}},{key:"isGroupedProduct",value:function(){return this.formElement.classList.contains("grouped_form")}},{key:"isBookingProduct",value:function(){return!!this.formElement.querySelector(".wc-booking-product-id")}},{key:"cleanCart",value:function(){var t=this;this.cartHelper.removeFromCart().then(function(){t.refreshMiniCart()}).catch(function(e){t.refreshMiniCart()})}},{key:"refreshMiniCart",value:function(){jQuery(document.body).trigger("wc_fragment_refresh")}}])}();const Vn=zn;function Jn(t){return Jn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jn(t)}function $n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Kn(r.key),r)}}function Kn(t){var e=function(t){if("object"!=Jn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Jn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Jn(e)?e:e+""}var Xn=function(){return function(t,e){return e&&$n(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.endpoint=e,this.nonce=n},[{key:"simulate",value:function(t,e){var n=this;return new Promise(function(r,o){fetch(n.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:n.nonce,products:e})}).then(function(t){return t.json()}).then(function(e){if(e.success){var n=t(e.data);r(n)}else o(e.data)})})}}])}();const Yn=Xn;function Zn(t){return Zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zn(t)}function tr(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function er(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?tr(Object(n),!0).forEach(function(e){nr(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tr(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function nr(t,e,n){return(e=or(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,or(r.key),r)}}function or(t){var e=function(t){if("object"!=Zn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Zn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Zn(e)?e:e+""}var ir=function(){return function(t,e){return e&&rr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.endpoint=e,this.nonce=n},[{key:"update",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(o,i){fetch(n.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(er({nonce:n.nonce,products:e},r))}).then(function(t){return t.json()}).then(function(e){if(e.success){var n=t(e.data);o(n)}else i(e.data)})})}}])}();const ar=ir;function ur(t){return ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ur(t)}function cr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,lr(r.key),r)}}function lr(t){var e=function(t){if("object"!=ur(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=ur(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ur(e)?e:e+""}var sr=function(){return function(t,e){return e&&cr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.errorHandler=n},[{key:"subscriptionsConfiguration",value:function(t){var e=this;return{createSubscription:function(e,n){return n.subscription.create({plan_id:t})},onApprove:function(t){fetch(e.config.ajax.approve_subscription.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:e.config.ajax.approve_subscription.nonce,order_id:t.orderID,subscription_id:t.subscriptionID,should_create_wc_order:!e.config.vaultingEnabled||"venmo"!==t.paymentSource})}).then(function(t){return t.json()}).then(function(t){var n;if(!t.success)throw Error(t.data.message);var r=null===(n=t.data)||void 0===n?void 0:n.order_received_url;location.href=r||e.config.redirect})},onError:function(t){console.error(t)}}}},{key:"configuration",value:function(){var t=this;return{createOrder:function(){var e=vn(),n=void 0!==t.config.bn_codes[t.config.context]?t.config.bn_codes[t.config.context]:"";return fetch(t.config.ajax.create_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.create_order.nonce,purchase_units:[],payment_method:vt,funding_source:window.ppcpFundingSource,bn_code:n,payer:e,context:t.config.context})}).then(function(t){return t.json()}).then(function(t){if(!t.success)throw console.error(t),Error(t.data.message);return t.data.id})},onApprove:fn(this,this.errorHandler),onCancel:function(){Wn.reloadButtonsIfRequired(t.config.button.wrapper)},onError:function(){t.errorHandler.genericError(),Wn.reloadButtonsIfRequired(t.config.button.wrapper)}}}}])}();const fr=sr;function pr(t){return pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pr(t)}function yr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,dr(r.key),r)}}function dr(t){var e=function(t){if("object"!=pr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=pr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==pr(e)?e:e+""}var hr=function(){return function(t,e){return e&&yr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.buttonConfig=e,this.ppcpConfig=n},[{key:"isVaultV3Mode",value:function(){var t,e,n;return(null===(t=this.ppcpConfig)||void 0===t||null===(t=t.save_payment_methods)||void 0===t?void 0:t.id_token)&&!(null!==(e=this.ppcpConfig)&&void 0!==e&&null!==(e=e.data_client_id)&&void 0!==e&&e.paypal_subscriptions_enabled)&&(null===(n=this.ppcpConfig)||void 0===n?void 0:n.can_save_vault_token)}},{key:"validateContext",value:function(){var t;return null===(t=this.ppcpConfig)||void 0===t||null===(t=t.locations_with_subscription_product)||void 0===t||!t.cart||this.isVaultV3Mode()}},{key:"shippingAllowed",value:function(){return this.buttonConfig.product.needShipping}},{key:"transactionInfo",value:function(){var t=this;return new Promise(function(e,n){var r=t.ppcpConfig.ajax.cart_script_params.endpoint,o=-1!==r.indexOf("?")?"&":"?";fetch(r+o+"shipping=1",{method:"GET",credentials:"same-origin"}).then(function(t){return t.json()}).then(function(t){if(t.success){var n=t.data;e({countryCode:n.country_code,currencyCode:n.currency_code,totalPriceStatus:"FINAL",totalPrice:n.total_str,chosenShippingMethods:n.chosen_shipping_methods||null,shippingPackages:n.shipping_packages||null})}})})}},{key:"createOrder",value:function(){return this.actionHandler().configuration().createOrder(null,null)}},{key:"approveOrder",value:function(t,e){return this.actionHandler().configuration().onApprove(t,e)}},{key:"actionHandler",value:function(){return new fr(this.ppcpConfig,this.errorHandler())}},{key:"errorHandler",value:function(){return new Z(this.ppcpConfig.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper"))}}])}();const br=hr;function vr(t){return vr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vr(t)}function mr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,gr(r.key),r)}}function gr(t){var e=function(t){if("object"!=vr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=vr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==vr(e)?e:e+""}function wr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(wr=function(){return!!t})()}function Sr(t){return Sr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Sr(t)}function jr(t,e){return jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},jr(t,e)}var _r=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Sr(e),function(t,e){if(e&&("object"==vr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,wr()?Reflect.construct(e,n||[],Sr(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jr(t,e)}(e,t),function(t,e){return e&&mr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"validateContext",value:function(){var t;return null===(t=this.ppcpConfig)||void 0===t||null===(t=t.locations_with_subscription_product)||void 0===t||!t.product||this.isVaultV3Mode()}},{key:"transactionInfo",value:function(){var t=this,e=new Z(this.ppcpConfig.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper")),n=new Vn(null,null,document.querySelector("form.cart"),e),r=PayPalCommerceGateway.data_client_id.has_subscriptions&&PayPalCommerceGateway.data_client_id.paypal_subscriptions_enabled?n.getSubscriptionProducts():n.getProducts();return new Promise(function(e,n){new Yn(t.ppcpConfig.ajax.simulate_cart.endpoint,t.ppcpConfig.ajax.simulate_cart.nonce).simulate(function(t){e({countryCode:t.country_code,currencyCode:t.currency_code,totalPriceStatus:"FINAL",totalPrice:t.total})},r)})}},{key:"createOrder",value:function(){return this.actionHandler().configuration().createOrder(null,null,{updateCartOptions:{keepShipping:!0}})}},{key:"actionHandler",value:function(){return new Vn(this.ppcpConfig,new ar(this.ppcpConfig.ajax.change_cart.endpoint,this.ppcpConfig.ajax.change_cart.nonce),document.querySelector("form.cart"),this.errorHandler())}},{key:"products",value:function(){return this.actionHandler().getProducts()}}])}(br);const Or=_r;function Pr(t){return Pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pr(t)}function kr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(kr=function(){return!!t})()}function Er(t){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Er(t)}function Cr(t,e){return Cr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cr(t,e)}var Ar=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Er(e),function(t,e){if(e&&("object"==Pr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,kr()?Reflect.construct(e,n||[],Er(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cr(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(br);const Tr=Ar;!function(){var t;function e(t){var e=0;return function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}var n,r="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){return t==Array.prototype||t==Object.prototype||(t[e]=n.value),t},o=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof globalThis&&globalThis];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function i(t,e){if(e)t:{var n=o;t=t.split(".");for(var i=0;i<t.length-1;i++){var a=t[i];if(!(a in n))break t;n=n[a]}(e=e(i=n[t=t[t.length-1]]))!=i&&null!=e&&r(n,t,{configurable:!0,writable:!0,value:e})}}function a(t){return(t={next:t})[Symbol.iterator]=function(){return this},t}function u(t){var n="undefined"!=typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return n?n.call(t):{next:e(t)}}if(i("Symbol",function(t){function e(t,e){this.A=t,r(this,"description",{configurable:!0,writable:!0,value:e})}if(t)return t;e.prototype.toString=function(){return this.A};var n="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",o=0;return function t(r){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new e(n+(r||"")+"_"+o++,r)}}),i("Symbol.iterator",function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var n="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),i=0;i<n.length;i++){var u=o[n[i]];"function"==typeof u&&"function"!=typeof u.prototype[t]&&r(u.prototype,t,{configurable:!0,writable:!0,value:function(){return a(e(this))}})}return t}),"function"==typeof Object.setPrototypeOf)n=Object.setPrototypeOf;else{var c;t:{var l={};try{l.__proto__={a:!0},c=l.a;break t}catch(t){}c=!1}n=c?function(t,e){if(t.__proto__=e,t.__proto__!==e)throw new TypeError(t+" is not extensible");return t}:null}var s=n;function f(){this.m=!1,this.j=null,this.v=void 0,this.h=1,this.u=this.C=0,this.l=null}function p(t){if(t.m)throw new TypeError("Generator is already running");t.m=!0}function y(t,e){return t.h=3,{value:e}}function d(t){this.g=new f,this.G=t}function h(t,e,n,r){try{var o=e.call(t.g.j,n);if(!(o instanceof Object))throw new TypeError("Iterator result "+o+" is not an object");if(!o.done)return t.g.m=!1,o;var i=o.value}catch(e){return t.g.j=null,t.g.s(e),b(t)}return t.g.j=null,r.call(t.g,i),b(t)}function b(t){for(;t.g.h;)try{var e=t.G(t.g);if(e)return t.g.m=!1,{value:e.value,done:!1}}catch(e){t.g.v=void 0,t.g.s(e)}if(t.g.m=!1,t.g.l){if(e=t.g.l,t.g.l=null,e.F)throw e.D;return{value:e.return,done:!0}}return{value:void 0,done:!0}}function v(t){this.next=function(e){return t.o(e)},this.throw=function(e){return t.s(e)},this.return=function(e){return function(t,e){p(t.g);var n=t.g.j;return n?h(t,"return"in n?n.return:function(t){return{value:t,done:!0}},e,t.g.return):(t.g.return(e),b(t))}(t,e)},this[Symbol.iterator]=function(){return this}}function m(t,e){return e=new v(new d(e)),s&&t.prototype&&s(e,t.prototype),e}if(f.prototype.o=function(t){this.v=t},f.prototype.s=function(t){this.l={D:t,F:!0},this.h=this.C||this.u},f.prototype.return=function(t){this.l={return:t},this.h=this.u},d.prototype.o=function(t){return p(this.g),this.g.j?h(this,this.g.j.next,t,this.g.o):(this.g.o(t),b(this))},d.prototype.s=function(t){return p(this.g),this.g.j?h(this,this.g.j.throw,t,this.g.o):(this.g.s(t),b(this))},i("Array.prototype.entries",function(t){return t||function(){return function(t,e){t instanceof String&&(t+="");var n=0,r=!1,o={next:function(){if(!r&&n<t.length){var o=n++;return{value:e(o,t[o]),done:!1}}return r=!0,{done:!0,value:void 0}}};return o[Symbol.iterator]=function(){return o},o}(this,function(t,e){return[t,e]})}}),"undefined"!=typeof Blob&&("undefined"==typeof FormData||!FormData.prototype.keys)){var g=function(t,e){for(var n=0;n<t.length;n++)e(t[n])},w=function(t){return t.replace(/\r?\n|\r/g,"\r\n")},S=function(t,e,n){return e instanceof Blob?(n=void 0!==n?String(n+""):"string"==typeof e.name?e.name:"blob",e.name===n&&"[object Blob]"!==Object.prototype.toString.call(e)||(e=new File([e],n)),[String(t),e]):[String(t),String(e)]},j=function(t,e){if(t.length<e)throw new TypeError(e+" argument required, but only "+t.length+" present.")},_="object"==typeof globalThis?globalThis:"object"==typeof window?window:"object"==typeof self?self:this,O=_.FormData,P=_.XMLHttpRequest&&_.XMLHttpRequest.prototype.send,k=_.Request&&_.fetch,E=_.navigator&&_.navigator.sendBeacon,C=_.Element&&_.Element.prototype,A=_.Symbol&&Symbol.toStringTag;A&&(Blob.prototype[A]||(Blob.prototype[A]="Blob"),"File"in _&&!File.prototype[A]&&(File.prototype[A]="File"));try{new File([],"")}catch(t){_.File=function(t,e,n){return t=new Blob(t,n||{}),Object.defineProperties(t,{name:{value:e},lastModified:{value:+(n&&void 0!==n.lastModified?new Date(n.lastModified):new Date)},toString:{value:function(){return"[object File]"}}}),A&&Object.defineProperty(t,A,{value:"File"}),t}}var T=function(t){return t.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},x=function(t){this.i=[];var e=this;t&&g(t.elements,function(t){if(t.name&&!t.disabled&&"submit"!==t.type&&"button"!==t.type&&!t.matches("form fieldset[disabled] *"))if("file"===t.type){var n=t.files&&t.files.length?t.files:[new File([],"",{type:"application/octet-stream"})];g(n,function(n){e.append(t.name,n)})}else"select-multiple"===t.type||"select-one"===t.type?g(t.options,function(n){!n.disabled&&n.selected&&e.append(t.name,n.value)}):"checkbox"===t.type||"radio"===t.type?t.checked&&e.append(t.name,t.value):(n="textarea"===t.type?w(t.value):t.value,e.append(t.name,n))})};if((t=x.prototype).append=function(t,e,n){j(arguments,2),this.i.push(S(t,e,n))},t.delete=function(t){j(arguments,1);var e=[];t=String(t),g(this.i,function(n){n[0]!==t&&e.push(n)}),this.i=e},t.entries=function t(){var e,n=this;return m(t,function(t){if(1==t.h&&(e=0),3!=t.h)return e<n.i.length?t=y(t,n.i[e]):(t.h=0,t=void 0),t;e++,t.h=2})},t.forEach=function(t,e){j(arguments,1);for(var n=u(this),r=n.next();!r.done;r=n.next()){var o=u(r.value);r=o.next().value,o=o.next().value,t.call(e,o,r,this)}},t.get=function(t){j(arguments,1);var e=this.i;t=String(t);for(var n=0;n<e.length;n++)if(e[n][0]===t)return e[n][1];return null},t.getAll=function(t){j(arguments,1);var e=[];return t=String(t),g(this.i,function(n){n[0]===t&&e.push(n[1])}),e},t.has=function(t){j(arguments,1),t=String(t);for(var e=0;e<this.i.length;e++)if(this.i[e][0]===t)return!0;return!1},t.keys=function t(){var e,n,r,o=this;return m(t,function(t){if(1==t.h&&(e=u(o),n=e.next()),3!=t.h)return n.done?void(t.h=0):(r=n.value,y(t,u(r).next().value));n=e.next(),t.h=2})},t.set=function(t,e,n){j(arguments,2),t=String(t);var r=[],o=S(t,e,n),i=!0;g(this.i,function(e){e[0]===t?i&&(i=!r.push(o)):r.push(e)}),i&&r.push(o),this.i=r},t.values=function t(){var e,n,r,o,i=this;return m(t,function(t){if(1==t.h&&(e=u(i),n=e.next()),3!=t.h)return n.done?void(t.h=0):(r=n.value,(o=u(r)).next(),y(t,o.next().value));n=e.next(),t.h=2})},x.prototype._asNative=function(){for(var t=new O,e=u(this),n=e.next();!n.done;n=e.next()){var r=u(n.value);n=r.next().value,r=r.next().value,t.append(n,r)}return t},x.prototype._blob=function(){var t="----formdata-polyfill-"+Math.random(),e=[],n="--"+t+'\r\nContent-Disposition: form-data; name="';return this.forEach(function(t,r){return"string"==typeof t?e.push(n+T(w(r))+'"\r\n\r\n'+w(t)+"\r\n"):e.push(n+T(w(r))+'"; filename="'+T(t.name)+'"\r\nContent-Type: '+(t.type||"application/octet-stream")+"\r\n\r\n",t,"\r\n")}),e.push("--"+t+"--"),new Blob(e,{type:"multipart/form-data; boundary="+t})},x.prototype[Symbol.iterator]=function(){return this.entries()},x.prototype.toString=function(){return"[object FormData]"},C&&!C.matches&&(C.matches=C.matchesSelector||C.mozMatchesSelector||C.msMatchesSelector||C.oMatchesSelector||C.webkitMatchesSelector||function(t){for(var e=(t=(this.document||this.ownerDocument).querySelectorAll(t)).length;0<=--e&&t.item(e)!==this;);return-1<e}),A&&(x.prototype[A]="FormData"),P){var I=_.XMLHttpRequest.prototype.setRequestHeader;_.XMLHttpRequest.prototype.setRequestHeader=function(t,e){I.call(this,t,e),"content-type"===t.toLowerCase()&&(this.B=!0)},_.XMLHttpRequest.prototype.send=function(t){t instanceof x?(t=t._blob(),this.B||this.setRequestHeader("Content-Type",t.type),P.call(this,t)):P.call(this,t)}}k&&(_.fetch=function(t,e){return e&&e.body&&e.body instanceof x&&(e.body=e.body._blob()),k.call(this,t,e)}),E&&(_.navigator.sendBeacon=function(t,e){return e instanceof x&&(e=e._asNative()),E.call(this,t,e)}),_.FormData=x}}();function xr(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return Ir(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Ir(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Ir(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Ir(f,"constructor",l),Ir(l,"constructor",c),c.displayName="GeneratorFunction",Ir(l,o,"GeneratorFunction"),Ir(f),Ir(f,o,"Generator"),Ir(f,r,function(){return this}),Ir(f,"toString",function(){return"[object Generator]"}),(xr=function(){return{w:i,m:p}})()}function Ir(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Ir=function(t,e,n,r){function i(e,n){Ir(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Ir(t,e,n,r)}function Mr(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}const Br=function(t){return new Promise(function(){var e,n=(e=xr().m(function e(n,r){var o,i,a,u,c;return xr().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,o=new sn,i=new Z(t.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper")),a="checkout"===t.context?"form.checkout":"form#order_review",u=t.early_checkout_validation_enabled?new J(t.ajax.validate_checkout.endpoint,t.ajax.validate_checkout.nonce):null){e.n=1;break}return n(),e.a(2);case 1:u.validate(document.querySelector(a)).then(function(t){t.length>0?(o.unblock(),i.clear(),i.messages(t),jQuery(document.body).trigger("checkout_error",[i.currentHtml()]),r()):n()}),e.n=3;break;case 2:e.p=2,c=e.v,console.error(c),r();case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){Mr(i,r,o,a,u,"next",t)}function u(t){Mr(i,r,o,a,u,"throw",t)}a(void 0)})});return function(_x,t){return n.apply(this,arguments)}}())};function Rr(t){return Rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rr(t)}function Dr(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return Fr(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Fr(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Fr(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Fr(f,"constructor",l),Fr(l,"constructor",c),c.displayName="GeneratorFunction",Fr(l,o,"GeneratorFunction"),Fr(f),Fr(f,o,"Generator"),Fr(f,r,function(){return this}),Fr(f,"toString",function(){return"[object Generator]"}),(Dr=function(){return{w:i,m:p}})()}function Fr(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Fr=function(t,e,n,r){function i(e,n){Fr(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Fr(t,e,n,r)}function qr(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Gr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Hr(r.key),r)}}function Hr(t){var e=function(t){if("object"!=Rr(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Rr(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Rr(e)?e:e+""}var Wr=function(){return function(t,e){return e&&Gr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.errorHandler=n,this.spinner=r},[{key:"subscriptionsConfiguration",value:function(t){var e,n,r=this;return{createSubscription:(e=Dr().m(function e(n,o){return Dr().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,Br(r.config);case 1:e.n=3;break;case 2:throw e.p=2,e.v,{type:"form-validation-error"};case 3:return e.a(2,o.subscription.create({plan_id:t}))}},e,null,[[0,2]])}),n=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){qr(i,r,o,a,u,"next",t)}function u(t){qr(i,r,o,a,u,"throw",t)}a(void 0)})},function(_x,t){return n.apply(this,arguments)}),onApprove:function(t,e){fetch(r.config.ajax.approve_subscription.endpoint,{method:"POST",credentials:"same-origin",body:JSON.stringify({nonce:r.config.ajax.approve_subscription.nonce,order_id:t.orderID,subscription_id:t.subscriptionID})}).then(function(t){return t.json()}).then(function(t){document.querySelector("#place_order").click()})},onError:function(t){console.error(t)}}}},{key:"configuration",value:function(){var t,e,n=this,r=this.spinner;return{createOrder:function(t,e){var o,i=vn(),a=void 0!==n.config.bn_codes[n.config.context]?n.config.bn_codes[n.config.context]:"",u=n.errorHandler,c="checkout"===n.config.context?"form.checkout":"form#order_review",l=new FormData(document.querySelector(c)),s=!!jQuery("#createaccount").is(":checked"),f=gt(),p=window.ppcpFundingSource,y=!(null===(o=document.getElementById("wc-ppcp-credit-card-gateway-new-payment-method"))||void 0===o||!o.checked);return fetch(n.config.ajax.create_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:n.config.ajax.create_order.nonce,payer:i,bn_code:a,context:n.config.context,order_id:n.config.order_id,order_key:n.config.order_key,payment_method:f,funding_source:p,form_encoded:new URLSearchParams(l).toString(),createaccount:s,save_payment_method:y})}).then(function(t){return t.json()}).then(function(t){if(!t.success){if(r.unblock(),void 0!==t.messages){var e=new DOMParser;u.appendPreparedErrorMessageElement(e.parseFromString(t.messages,"text/html").querySelector("ul"))}else{var n,o;u.clear(),t.data.refresh&&jQuery(document.body).trigger("update_checkout"),(null===(n=t.data.errors)||void 0===n?void 0:n.length)>0?u.messages(t.data.errors):(null===(o=t.data.details)||void 0===o?void 0:o.length)>0?u.message(t.data.details.map(function(t){return"".concat(t.issue," ").concat(t.description)}).join("<br/>")):u.message(t.data.message),jQuery(document.body).trigger("checkout_error",[u.currentHtml()])}throw{type:"create-order-error",data:t.data}}var i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name","ppcp-resume-order"),i.setAttribute("value",t.data.custom_id),document.querySelector(c).appendChild(i),t.data.id})},onApprove:(t=this,e=this.errorHandler,function(n,r){var o=sn.fullPage();return o.block(),e.clear(),Wn.isResumeFlow()&&Wn.cleanHashParams(),fetch(t.config.ajax.approve_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.approve_order.nonce,order_id:n.orderID,funding_source:window.ppcpFundingSource})}).then(function(t){return t.json()}).then(function(t){if(!t.success){if(100===t.data.code?e.message(t.data.message):e.genericError(),void 0!==r&&void 0!==r.restart)return r.restart();throw new Error(t.data.message)}gt().startsWith("ppcp-")||jQuery('input[name="payment_method"][value="'.concat(vt,'"]')).prop("checked",!0),document.querySelector("#place_order").click()}).finally(function(){o.unblock()})}),onCancel:function(){r.unblock(),Wn.reloadButtonsIfRequired(n.config.button.wrapper)},onError:function(t){console.error(t),r.unblock(),t&&"create-order-error"===t.type||(n.errorHandler.genericError(),Wn.reloadButtonsIfRequired(n.config.button.wrapper))}}}}])}();const Nr=Wr;function Ur(t){return Ur="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ur(t)}function Lr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Qr(r.key),r)}}function Qr(t){var e=function(t){if("object"!=Ur(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ur(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ur(e)?e:e+""}function zr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(zr=function(){return!!t})()}function Vr(t){return Vr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Vr(t)}function Jr(t,e){return Jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Jr(t,e)}var $r=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Vr(e),function(t,e){if(e&&("object"==Ur(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,zr()?Reflect.construct(e,n||[],Vr(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Jr(t,e)}(e,t),function(t,e){return e&&Lr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"actionHandler",value:function(){return new Nr(this.ppcpConfig,this.errorHandler(),new sn)}}])}(br);const Kr=$r;function Xr(t){return Xr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xr(t)}function Yr(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Yr=function(){return!!t})()}function Zr(t){return Zr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zr(t)}function to(t,e){return to=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},to(t,e)}var eo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Zr(e),function(t,e){if(e&&("object"==Xr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Yr()?Reflect.construct(e,n||[],Zr(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&to(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(br);const no=eo;function ro(t){return ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ro(t)}function oo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(oo=function(){return!!t})()}function io(t){return io=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},io(t)}function ao(t,e){return ao=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ao(t,e)}var uo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=io(e),function(t,e){if(e&&("object"==ro(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,oo()?Reflect.construct(e,n||[],io(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ao(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(br);const co=uo;function lo(t){return lo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lo(t)}function so(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(so=function(){return!!t})()}function fo(t){return fo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fo(t)}function po(t,e){return po=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},po(t,e)}var yo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=fo(e),function(t,e){if(e&&("object"==lo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,so()?Reflect.construct(e,n||[],fo(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&po(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(br);const ho=yo;function bo(t){return bo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bo(t)}function vo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,mo(r.key),r)}}function mo(t){var e=function(t){if("object"!=bo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=bo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==bo(e)?e:e+""}function go(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(go=function(){return!!t})()}function wo(t){return wo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wo(t)}function So(t,e){return So=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},So(t,e)}var jo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=wo(e),function(t,e){if(e&&("object"==bo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,go()?Reflect.construct(e,n||[],wo(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&So(t,e)}(e,t),function(t,e){return e&&vo(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"transactionInfo",value:function(){return{countryCode:"US",currencyCode:"USD",totalPrice:"10.00",totalPriceStatus:"FINAL"}}},{key:"createOrder",value:function(){throw new Error("Create order fail. This is just a preview.")}},{key:"approveOrder",value:function(){throw new Error("Approve order fail. This is just a preview.")}},{key:"actionHandler",value:function(){throw new Error("Action handler fail. This is just a preview.")}},{key:"errorHandler",value:function(){throw new Error("Error handler fail. This is just a preview.")}}])}(br);const _o=jo;function Oo(t){return Oo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Oo(t)}function Po(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return ko(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(ko(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,ko(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,ko(f,"constructor",l),ko(l,"constructor",c),c.displayName="GeneratorFunction",ko(l,o,"GeneratorFunction"),ko(f),ko(f,o,"Generator"),ko(f,r,function(){return this}),ko(f,"toString",function(){return"[object Generator]"}),(Po=function(){return{w:i,m:p}})()}function ko(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ko=function(t,e,n,r){function i(e,n){ko(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},ko(t,e,n,r)}function Eo(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Co(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Ao(r.key),r)}}function Ao(t){var e=function(t){if("object"!=Oo(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Oo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Oo(e)?e:e+""}function To(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(To=function(){return!!t})()}function xo(t){return xo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},xo(t)}function Io(t,e){return Io=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Io(t,e)}var Mo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=xo(e),function(t,e){if(e&&("object"==Oo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,To()?Reflect.construct(e,n||[],xo(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Io(t,e)}(e,t),function(t,e){return e&&Co(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"validateContext",value:function(){var t;return null===(t=this.ppcpConfig)||void 0===t||null===(t=t.locations_with_subscription_product)||void 0===t||!t.payorder||this.isVaultV3Mode()}},{key:"transactionInfo",value:function(){var t=this;return new Promise(function(){var e,n=(e=Po().m(function e(n,r){var o;return Po().w(function(e){for(;;)switch(e.n){case 0:o=t.ppcpConfig.pay_now,n({countryCode:o.country_code,currencyCode:o.currency_code,totalPriceStatus:"FINAL",totalPrice:o.total_str});case 1:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){Eo(i,r,o,a,u,"next",t)}function u(t){Eo(i,r,o,a,u,"throw",t)}a(void 0)})});return function(_x,t){return n.apply(this,arguments)}}())}},{key:"actionHandler",value:function(){return new Nr(this.ppcpConfig,this.errorHandler(),new sn)}}])}(br);const Bo=Mo;function Ro(t){return Ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ro(t)}function Do(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Fo(r.key),r)}}function Fo(t){var e=function(t){if("object"!=Ro(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ro(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ro(e)?e:e+""}var qo=function(){return function(t,e,n){return n&&Do(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},0,[{key:"create",value:function(t,e,n){switch(t){case"product":return new Or(e,n);case"cart":return new Tr(e,n);case"checkout":return new Kr(e,n);case"pay-now":return new Bo(e,n);case"mini-cart":return new ho(e,n);case"cart-block":return new no(e,n);case"checkout-block":return new co(e,n);case"preview":return new _o(e,n)}}}])}();const Go=qo;function Ho(t){return Ho="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ho(t)}function Wo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return No(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?No(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},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(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function No(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Uo(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return Lo(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,i=s[e],y=p.p,d=i[2];n>3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&y<i[1])?(u=0,p.v=r,p.n=i[1]):y<d&&(o=n<3||i[0]>r||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Lo(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Lo(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Lo(f,"constructor",l),Lo(l,"constructor",c),c.displayName="GeneratorFunction",Lo(l,o,"GeneratorFunction"),Lo(f),Lo(f,o,"Generator"),Lo(f,r,function(){return this}),Lo(f,"toString",function(){return"[object Generator]"}),(Uo=function(){return{w:i,m:p}})()}function Lo(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Lo=function(t,e,n,r){function i(e,n){Lo(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Lo(t,e,n,r)}function Qo(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function zo(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){Qo(i,r,o,a,u,"next",t)}function u(t){Qo(i,r,o,a,u,"throw",t)}a(void 0)})}}function Vo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,Jo(r.key),r)}}function Jo(t){var e=function(t){if("object"!=Ho(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Ho(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ho(e)?e:e+""}var $o=function(){return function(t,e){return e&&Vo(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}(function t(e,n,r){var o=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.namespace=e,this.buttonConfig=n,this.ppcpConfig=r,this.buttonAttributes=i,this.applePayConfig=null,this.transactionInfo=null,this.contextHandler=null,this.buttons=[],G.watchContextBootstrap(function(){var t=zo(Uo().m(function t(e){var i,a;return Uo().w(function(t){for(;;)switch(t.n){case 0:if(o.contextHandler=Go.create(e.context,n,r,e.handler),i=We.createButton(e.context,e.handler,n,r,o.contextHandler,o.buttonAttributes),o.buttons.push(i),a=function(){i.configure(o.applePayConfig,o.transactionInfo,o.buttonAttributes),i.init()},!o.applePayConfig||!o.transactionInfo){t.n=1;break}a(),t.n=3;break;case 1:return t.n=2,o.init();case 2:o.applePayConfig&&o.transactionInfo&&a();case 3:return t.a(2)}},t)}));return function(_x){return t.apply(this,arguments)}}())},[{key:"init",value:(e=zo(Uo().m(function t(){var e,n,r,o;return Uo().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,this.applePayConfig){t.n=2;break}return t.n=1,window[this.namespace].Applepay().config();case 1:this.applePayConfig=t.v;case 2:if(this.transactionInfo){t.n=4;break}return t.n=3,this.fetchTransactionInfo();case 3:this.transactionInfo=t.v;case 4:if(this.applePayConfig)if(this.transactionInfo){e=Wo(this.buttons);try{for(e.s();!(n=e.n()).done;)(r=n.value).configure(this.applePayConfig,this.transactionInfo,this.buttonAttributes),r.init()}catch(t){e.e(t)}finally{e.f()}}else console.error("No transactionInfo found during init");else console.error("No ApplePayConfig received during init");t.n=6;break;case 5:t.p=5,o=t.v,console.error("Error during initialization:",o);case 6:return t.a(2)}},t,this,[[0,5]])})),function(){return e.apply(this,arguments)})},{key:"fetchTransactionInfo",value:(t=zo(Uo().m(function t(){var e;return Uo().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,this.contextHandler){t.n=1;break}throw new Error("ContextHandler is not initialized");case 1:return t.n=2,this.contextHandler.transactionInfo();case 2:return t.a(2,t.v);case 3:throw t.p=3,e=t.v,console.error("Error fetching transaction info:",e),e;case 4:return t.a(2)}},t,this,[[0,3]])})),function(){return t.apply(this,arguments)})},{key:"reinit",value:function(){var t,e=Wo(this.buttons);try{for(e.s();!(t=e.n()).done;)t.value.reinit()}catch(t){e.e(t)}finally{e.f()}}}]);var t,e}();const Ko=$o;!function(t){var e=t.buttonConfig,n=t.ppcpConfig,r="ppcpPaypalApplepay";function o(){!function(){if(e&&n){var t=new Ko(r,e,n);o=function(){t.reinit()},i={timeoutId:null,args:null},u=function(){i.timeoutId&&(o.apply(null,i.args||[]),a())},c=function(){a();for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];i.args=e,i.timeoutId=window.setTimeout(u,50)},c.cancel=a=function(){i.timeoutId&&window.clearTimeout(i.timeoutId),i.timeoutId=null,i.args=null},c.flush=u,l=c,document.addEventListener("ppcp_refresh_payment_buttons",l),window.jQuery("body").on("updated_cart_totals",l).on("updated_checkout",l),setTimeout(function(){document.body.addEventListener("wc_fragments_loaded",l),document.body.addEventListener("wc_fragments_refreshed",l)},1e3)}var o,i,a,u,c,l}()}document.addEventListener("DOMContentLoaded",function(){if(e&&n){var t=n.mini_cart_buttons_enabled,a=null!==document.getElementById(e.button.wrapper);if(t||a){var u=!1,c=!1,l=!1,s=function(){!u&&c&&l&&(u=!0,o())};i({url:e.sdk_url}).then(function(){l=!0,s()}),M(r,n).then(function(){c=!0,s()}).catch(function(t){console.error("Failed to load PayPal script: ",t)})}}else o()})}({buttonConfig:window.wc_ppcp_applepay,ppcpConfig:window.PayPalCommerceGateway})})();