(()=>{"use strict";var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{default:()=>g});const r=window.jQuery;var n=t.n(r);const o=window.wcPPCP.utils,a=window.wp.apiFetch;var i=t.n(a);const c=window.wcPPCP.actions;var u=t.n(c);function s(t){return s="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},s(t)}function l(){l=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function u(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,a=Object.create(o.prototype),i=new x(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var c=k(i,r);if(c){if(c===p)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=h(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var p={};function f(){}function d(){}function y(){}var v={};c(v,o,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(S([])));m&&m!==e&&r.call(m,o)&&(v=m);var w=y.prototype=f.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function n(o,a,i,c){var u=h(t[o],t,a);if("throw"!==u.type){var l=u.arg,p=l.value;return p&&"object"==s(p)&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,i,c)}),(function(t){n("throw",t,i,c)})):e.resolve(p).then((function(t){l.value=t,i(l)}),(function(t){return n("throw",t,i,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function a(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(a,a):a()}}function k(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method))return p;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=h(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,p;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function S(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,a=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return a.next=a}}return{next:C}}function C(){return{value:void 0,done:!0}}return d.prototype=y,c(w,"constructor",y),c(y,"constructor",d),d.displayName=c(y,i,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,c(t,i,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},b(P.prototype),c(P.prototype,a,(function(){return this})),t.AsyncIterator=P,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new P(u(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},b(w),c(w,i,"Generator"),c(w,o,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=S,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function p(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){f(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function f(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function d(t,e,r,n,o,a,i){try{var c=t[a](i),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function y(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){d(a,n,o,i,c,"next",t)}function c(t){d(a,n,o,i,c,"throw",t)}i(void 0)}))}}function v(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}const g=new(function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actions=new(u()),this.data=(0,o.getSetting)("cart"),this.page=(0,o.getSetting)("generalData").page,this.processing=!1,n()(document.body).on("updated_wc_div",this.onCartUpdated.bind(this)),n()(document.body).on("updated_cart_totals",this.onCartUpdated.bind(this)),n()(document.body).on("updated_checkout",this.onUpdatedCheckout.bind(this)),n()(document.body).on("wc_fragments_refreshed wc_fragments_loaded",this.onCartFragmentsChanged.bind(this))}var e,r,a,c,s,h,f,d,g,m;return e=t,r=[{key:"onCartUpdated",value:(m=y(l().mark((function t(e){var r,n,a;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null===(r=window)||void 0===r||null===(n=r.wcPPCPCartData)||void 0===n||!n.cart){t.next=5;break}a=window.wcPPCPCartData,this.data=p(p({},this.data),a.cart),t.next=8;break;case 5:return t.next=7,this.refreshData();case 7:a=t.sent;case 8:(0,o.setSetting)("queryParams",this.data.queryParams),this.actions.doAction("cart_updated",a,this),window.wcPPCPCartData=null;case 11:case"end":return t.stop()}}),t,this)}))),function(t){return m.apply(this,arguments)})},{key:"on",value:function(t,e){this.actions.addAction(t,e)}},{key:"trigger",value:function(t){for(var e,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(e=this.actions).doAction.apply(e,[t].concat(n))}},{key:"applyFilters",value:function(t){for(var e,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return(e=this.actions).applyFilters.apply(e,[t].concat(n))}},{key:"onUpdatedCheckout",value:(g=y(l().mark((function t(e,r){var n,a,i,c,u,s;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:a={},null!=r&&null!==(n=r.fragments)&&void 0!==n&&n.wc_ppcp_data&&(a=r.fragments.wc_ppcp_data,c=(i=a).cart,u=i.queryParams,s=void 0===u?null:u,this.data=p(p({},this.data),c),s&&(0,o.setSetting)("queryParams",s)),this.actions.doAction("updated_checkout",a,r);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return g.apply(this,arguments)})},{key:"onCartFragmentsChanged",value:function(){var t=this;setTimeout((function(){window.wcPPCPMiniCartUpdate&&(t.data=p(p({},t.data),wcPPCPMiniCartUpdate)),t.actions.doAction("fragments_changed",t)}),250)}},{key:"getData",value:function(){return(0,o.getSetting)("cart")}},{key:"getCurrency",value:function(){return this.actions.applyFilters("cart_get_currency",this.data.currency,this)}},{key:"getCountryCode",value:function(){return this.data.countryCode}},{key:"needsShipping",value:function(){var t;return this.actions.applyFilters("cart_needs_shipping",null===(t=this.data)||void 0===t?void 0:t.needsShipping,this)}},{key:"isEmpty",value:function(){var t;return null===(t=this.data)||void 0===t?void 0:t.isEmpty}},{key:"isPaymentMethodAvailable",value:function(t){var e,r,n;return null!==(e=null===(r=this.data)||void 0===r||null===(n=r.availablePaymentMethods)||void 0===n?void 0:n.includes(t))&&void 0!==e&&e}},{key:"refreshData",value:(d=y(l().mark((function t(){var e,r=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r.length>0&&void 0!==r[0]&&r[0],this.processing){t.next=18;break}return t.prev=2,this.processing=!0,t.next=6,i()({method:"POST",url:(0,o.getRestRoute)("cart/refresh"),data:{page:this.page}});case 6:return e=t.sent,this.data=p(p({},this.data),e.cart),this.data.queryParams=e.queryParams,t.abrupt("return",e);case 12:t.prev=12,t.t0=t.catch(2),console.log(t.t0);case 15:return t.prev=15,this.processing=!1,t.finish(15);case 18:case"end":return t.stop()}}),t,this,[[2,12,15,18]])}))),function(){return d.apply(this,arguments)})},{key:"addToCart",value:(f=y(l().mark((function t(e){var r=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",i()({method:"POST",url:(0,o.getRestRoute)("cart/item"),data:this.actions.applyFilters("add_to_cart_data",e,this)}).then((function(t){return t.cart&&(r.data=p(p({},r.data),t.cart)),t})).catch((function(t){throw t})));case 1:case"end":return t.stop()}}),t,this)}))),function(t){return f.apply(this,arguments)})},{key:"removeCartItem",value:function(t){var e=this;return i()({method:"DELETE",url:(0,o.getRestRoute)("cart/item"),data:{key:t}}).then((function(t){e.data=p(p({},e.data),t.cart)})).catch((function(t){console.log("Error removing item from cart. ",t)}))}},{key:"updateShipping",value:(h=y(l().mark((function t(e){var r=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",i()({method:"POST",url:(0,o.getRestRoute)("cart/shipping"),data:e}).then((function(t){return t.code||(r.data=p(p({},r.data),t)),r.sanitizeResponse(t)})).catch((function(t){throw t})));case 1:case"end":return t.stop()}}),t)}))),function(t){return h.apply(this,arguments)})},{key:"updateBilling",value:(s=y(l().mark((function t(e){var r=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",i()({method:"POST",url:(0,o.getRestRoute)("cart/billing"),data:e}).then((function(t){return t.code||(r.data=p(p({},r.data),t.cart)),t})).catch((function(t){throw t})));case 1:case"end":return t.stop()}}),t)}))),function(t){return s.apply(this,arguments)})},{key:"createOrder",value:(c=y(l().mark((function t(e){var r=this;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",i()({method:"POST",url:(0,o.getRestRoute)("cart/order"),data:e}).then((function(t){return r.sanitizeResponse(t)})));case 1:case"end":return t.stop()}}),t)}))),function(t){return c.apply(this,arguments)})},{key:"doOrderPay",value:(a=y(l().mark((function t(e){var r,n,a=this,c=arguments;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=c.length>1&&void 0!==c[1]?c[1]:{},n=(0,o.getSetting)("order"),t.abrupt("return",i()({method:"POST",url:(0,o.getRestRoute)("order/pay"),data:p(p({payment_method:e},r),n)}).then((function(t){return a.sanitizeResponse(t)})));case 3:case"end":return t.stop()}}),t)}))),function(t){return a.apply(this,arguments)})},{key:"getTotal",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",r=(null===(t=this.data)||void 0===t?void 0:t.total)||0;return"string"===e&&(r=r.toString()),this.actions.applyFilters("cart_total",r,this)}},{key:"getTotalCents",value:function(){var t;return this.actions.applyFilters("cart_total_cents",parseInt((null===(t=this.data)||void 0===t?void 0:t.totalCents)||0),this)}},{key:"getLineItems",value:function(){return this.data.lineItems||[]}},{key:"getShippingOptions",value:function(){return this.data.shippingOptions||[]}},{key:"getSelectedShippingMethod",value:function(){return this.data.selectedShippingMethod||""}},{key:"sanitizeResponse",value:function(t){return"string"==typeof t?t=t.replace(/<[^>]*>/g,""):Array.isArray(t)&&(t=this.sanitizeResponse(t[0])),t}}],r&&v(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}());(this.wcPPCP=this.wcPPCP||{}).cart=e})();
(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.r(t),e.d(t,{default:()=>n});const n=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.page=t}var t,n;return t=e,(n=[{key:"getPage",value:function(){return this.page}},{key:"isCheckout",value:function(){return"checkout"===this.page}},{key:"isExpressCheckout",value:function(){return"express_checkout"===this.page}},{key:"isCart",value:function(){return"cart"===this.page}},{key:"isProduct",value:function(){return"product"===this.page}},{key:"isOrderPay",value:function(){return"order_pay"===this.page}},{key:"isAddPaymentMethod",value:function(){return"add_payment_method"===this.page}}])&&r(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}();(this.wcPPCP=this.wcPPCP||{}).context=t})();
(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{getPaymentMethod:()=>i,getPaymentMethods:()=>n,registerPaymentMethod:()=>r});var o={},r=function(e){o[e.id]=e},n=function(){return o},i=function(e){return o[e]?o[e]:null};(this.wcPPCP=this.wcPPCP||{}).paymentMethods=t})();
(()=>{"use strict";var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{BaseController:()=>P,CartController:()=>W,CheckoutController:()=>ct,ExpressCheckoutController:()=>bt,MiniCartController:()=>jt,ProductController:()=>B});const n=window.jQuery;var r=t.n(n);const i=window.wp.apiFetch;var o=t.n(i);const a=window.wcPPCP.utils,c=window.lodash;var u=["email","phone"],s=["phone"];function l(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function h(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,r.key,r)}}const d=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.context=e,this.controller=n}var e,n;return e=t,n=[{key:"populate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(this.context.isCheckout()||this.context.isExpressCheckout())&&this.syncDOMToMap(e),null!=t&&t.billing&&this.populateBilling(t.billing,e),null!=t&&t.shipping&&!e.skipShipping&&e.needsShipping&&this.populateShipping(t.shipping,e)}},{key:"syncDOMToMap",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=["first_name","last_name","company","address_1","address_2","city","state","postcode","country","email","phone"];if(e.forEach((function(t){var e=r()('[name="billing_'.concat(t,'"]'));e.length&&(0,a.setFieldValue)(t,e.val(),"billing")})),t.needsShipping){var n=["first_name","last_name","company","address_1","address_2","city","state","postcode","country","phone"];n.forEach((function(t){var e=r()('[name="shipping_'.concat(t,'"]'));e.length&&(0,a.setFieldValue)(t,e.val(),"shipping")}))}}},{key:"populateBilling",value:function(t,e){var n=this,i=t.email,o=t.phone,s=l(t,u);(0,c.isEmpty)(s)||(this.context.isCheckout()||this.context.isExpressCheckout()?(0,a.isValidAddress)(s,["first_name","last_name","phone"])&&!(0,c.isEqual)(this.controller.getCartAddress("billing",!0),(0,c.omit)(s,["first_name","last_name"]))&&(this.controller.update_required=!0,this.populateAddressFields(s,"billing"),r()(document.body).one("updated_checkout",(function(){n.populateAddressFields(s,"billing")}))):this.populateAddressFields(s,"billing")),i&&(this.context.isCheckout()&&(0,a.isValid)("billing_email")||(0,a.setFieldValue)("billing_email",i)),o&&((0,a.setFieldValue)("billing_phone",o),e.needsShipping&&(0,a.setFieldValue)("shipping_phone",o))}},{key:"populateShipping",value:function(t,e){var n=this,i=t.phone,o=l(t,s);if(!(0,c.isEmpty)(o))if(this.context.isCheckout()||this.context.isExpressCheckout()){var u=this.controller.getCartFullAddress("shipping",!0);(0,c.isEqual)(u,o)||(this.controller.update_required=!0,this.populateAddressFields(o,"shipping"),r()(document.body).one("updated_checkout",(function(){n.populateAddressFields(o,"shipping")}))),(0,a.isValidAddress)(this.controller.getCartFullAddress("billing",!0),["phone","email"])||(o.first_name&&o.last_name&&!(0,a.isValid)("billing_first_name")&&!(0,a.isValid)("billing_last_name")&&((0,a.setFieldValue)("first_name",o.first_name,"billing"),(0,a.setFieldValue)("last_name",o.last_name,"billing")),this.populateAddressFields(o,"billing"))}else this.populateAddressFields(o,"shipping"),(0,a.isValidAddress)(this.controller.getCartFullAddress("billing",!0),["phone","email"])||this.populateAddressFields(o,"billing");i&&(0,a.setFieldValue)("shipping_phone",i),(this.context.isCheckout()||this.context.isExpressCheckout())&&this.maybeShipToDifferentAddress()}},{key:"maybeShipToDifferentAddress",value:function(){var t;if(null!==(t=r()('[name="ship_to_different_address"]'))&&void 0!==t&&t.length){var e=this.controller.getCartFullAddress("billing"),n=this.controller.getCartFullAddress("shipping"),i=!(0,c.isEqual)(e,n);r()('[name="ship_to_different_address"]').prop("checked",i).trigger("change")}}},{key:"populateAddressFields",value:function(t,e){for(var n in t)(0,a.setFieldValue)(n,t[n],e)}}],n&&h(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}(),p=window.wcPPCP.actions;var f=t.n(p);function y(t){return y="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},y(t)}function v(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 m(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?v(Object(n),!0).forEach((function(e){k(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function g(){g=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var i=e&&e.prototype instanceof h?e:h,o=Object.create(i.prototype),a=new E(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=k(a,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=s(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function d(){}function p(){}var f={};c(f,i,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(x([])));m&&m!==e&&n.call(m,i)&&(f=m);var b=p.prototype=h.prototype=Object.create(f);function w(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(i,o,a,c){var u=s(t[i],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==y(h)&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function k(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=s(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function x(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return d.prototype=p,c(b,"constructor",p),c(p,"constructor",d),d.displayName=c(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,a,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(_.prototype),c(_.prototype,o,(function(){return this})),t.AsyncIterator=_,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new _(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),c(b,a,"Generator"),c(b,i,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=x,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),O(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:x(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function b(t,e,n,r,i,o,a){try{var c=t[o](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,i)}function w(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){b(o,r,i,a,c,"next",t)}function c(t){b(o,r,i,a,c,"throw",t)}a(void 0)}))}}function _(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,r.key,r)}}function k(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var P=function(){function t(e){var n=e.id,r=e.settings,i=e.cart,o=e.context,a=e.gateway,c=e.container,u=void 0===c?null:c,s=e.paymentElementSelector,l=void 0===s?null:s;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=n,this.cart=i,this.gateway=a,this.context=o,this.settings=r,this.container=u||"li.payment_method_".concat(n),this.paymentElementSelector=l,this.order_field_key=a.getOrderFieldKey(),this.billing_token_key=a.getTokenFieldKey(),this.isPaymentMethodAvailable=!0,this.fields=new d(this.context,this),this.actions=new(f()),this.gateway.setController(this),this.gateway.initialize()}var e,n,i,c;return e=t,n=[{key:"initialize",value:function(){var t=this;this.loadPayPalScript().then(w(g().mark((function e(){return g().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.createPaymentElement();case 2:case"end":return e.stop()}}),e)}))))}},{key:"loadPayPalScript",value:function(){var t=this;return new Promise((function(e,n){(0,a.loadPayPalSdk)(t.getPayPalSDKArgs()).then((function(n){t.paypal=n,t.gateway.setPayPal(n),e()})).catch((function(e){console.log(e),null!=e&&e.code&&t.submitError((0,a.getErrorMessage)(e)),n()}))}))}},{key:"getPayPalSDKArgs",value:function(){return(0,a.getPayPalQueryParams)()}},{key:"createPaymentElement",value:(c=w(g().mark((function t(){var e,n,i,o;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.configurationError=null,this.cart.isPaymentMethodAvailable(this.gateway.id)){t.next=5;break}return this.isPaymentMethodAvailable=!1,this.onPaymentUnavailable(),t.abrupt("return");case 5:return e=!1,t.prev=6,t.next=9,this.gateway.canMakePayment();case 9:e=t.sent,t.next=16;break;case 12:t.prev=12,t.t0=t.catch(6),e=!1,t.t0 instanceof a.ConfigurationError?this.configurationError=t.t0.message:console.error("Payment method availability check failed:",t.t0);case 16:if(e){t.next=20;break}return this.isPaymentMethodAvailable=!1,this.onPaymentUnavailable(),t.abrupt("return");case 20:if(this.isPaymentMethodAvailable=!0,n=this.getElementContainer()){t.next=24;break}return t.abrupt("return");case 24:if(!this.gateway.shouldCreateElement(n)){t.next=40;break}if(!(n instanceof NodeList)){t.next=36;break}i=0;case 27:if(!(i<n.length)){t.next=34;break}return o=n[i],t.next=31,this.gateway.createPaymentElement(o);case 31:i++,t.next=27;break;case 34:t.next=38;break;case 36:return t.next=38,this.gateway.createPaymentElement(n);case 38:this.$paymentElement=r()(n),this.onPaymentElementReady();case 40:case"end":return t.stop()}}),t,this,[[6,12]])}))),function(){return c.apply(this,arguments)})},{key:"getPaymentElement",value:function(){return this.$paymentElement}},{key:"destroyPaymentElement",value:function(){var t,e;null===(t=(e=this.gateway).destroyPaymentElement)||void 0===t||t.call(e)}},{key:"disablePaymentElement",value:function(){var t,e,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(t=(e=this.gateway).disablePaymentElement)||void 0===t||t.call(e),n&&null!=this&&this.$paymentElement&&this.$paymentElement.addClass("disabled")}},{key:"enablePaymentElement",value:function(){var t,e;null===(t=(e=this.gateway).enablePaymentElement)||void 0===t||t.call(e),this.$paymentElement&&this.$paymentElement.removeClass("disabled")}},{key:"displayPaymentElement",value:function(){var t;null===(t=this.getPaymentElement())||void 0===t||t.show()}},{key:"hidePaymentElement",value:function(){var t;null===(t=this.getPaymentElement())||void 0===t||t.hide()}},{key:"needsShipping",value:function(){return this.cart.needsShipping()}},{key:"getElementContainer",value:function(){return null}},{key:"onPaymentUnavailable",value:function(){this.actions.doAction("payment_unavailable",this)}},{key:"onPaymentElementReady",value:function(){this.actions.doAction("payment_element_ready",this)}},{key:"onCancel",value:function(){this.enablePaymentElement()}},{key:"onError",value:function(t,e){this.currentError?(this.submitError(this.currentError),this.currentError=null):this.submitError(t),this.enablePaymentElement(),r()(document.body).triggerHandler("wc_ppcp_on_error",[this,e,t])}},{key:"fetchBillingToken",value:function(t){return o()({method:"GET",path:"/wc-ppcp/v1/billing-agreement/token/".concat(t)})}},{key:"createPaymentToken",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o()({method:"POST",path:"/wc-ppcp/v1/vault/payment-tokens",data:m({setup_token:t},e)})}},{key:"createOrder",value:function(t,e){var n=this;return this.cart.createOrder(m(m({},t),{},{payment_method:this.id})).catch((function(t){return n.currentError=t,t}))}},{key:"createVaultSetupToken",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.disablePaymentElement(!0),o()({method:"POST",url:(0,a.getRestPath)("/wc-ppcp/v1/vault/setup-tokens"),data:m({context:this.context.getPage(),payment_method:this.id},e)}).then((function(t){return t.id})).catch((function(e){throw t.currentError=e,t.enablePaymentElement(),e}))}},{key:"onShippingChange",value:function(t){return this.cart.updateShipping(m(m({},t),{},{payment_method:this.id})).then((function(t){return t})).catch((function(t){throw t}))}},{key:"onBillingChange",value:function(t){return this.cart.updateBilling(m({payment_method:this.id},t)).then((function(t){return t})).catch((function(t){throw t}))}},{key:"submitError",value:function(t){}},{key:"getShippingPrefix",value:function(){return"shipping"}},{key:"getCartAddress",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{address_1:(0,a.getFieldValue)("address_1",t,e),address_2:(0,a.getFieldValue)("address_2",t,e),state:(0,a.getFieldValue)("state",t,e),city:(0,a.getFieldValue)("city",t,e),postcode:(0,a.getFieldValue)("postcode",t,e),country:(0,a.getFieldValue)("country",t,e)}}},{key:"getCartFullAddress",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{first_name:(0,a.getFieldValue)("first_name",t,e),last_name:(0,a.getFieldValue)("last_name",t,e),address_1:(0,a.getFieldValue)("address_1",t,e),address_2:(0,a.getFieldValue)("address_2",t,e),state:(0,a.getFieldValue)("state",t,e),city:(0,a.getFieldValue)("city",t,e),postcode:(0,a.getFieldValue)("postcode",t,e),country:(0,a.getFieldValue)("country",t,e)}}},{key:"onClick",value:function(){this.storeAttributionValues()}},{key:"validate",value:(i=w(g().mark((function t(){return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",!0);case 1:case"end":return t.stop()}}),t)}))),function(){return i.apply(this,arguments)})},{key:"populateCheckoutFields",value:function(t){var e=this.actions.applyFilters("field_population_options",{skipShipping:!1,needsShipping:this.needsShipping()},this);this.fields.populate(t,e),this.actions.doAction("after_populate_checkout_fields",this)}},{key:"submit",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e&&this.populateCheckoutFields(e),this.showProcessing(),o()({method:"POST",url:(0,a.getRestRoute)("cart/checkout"),data:this.getCartCheckoutData()}).then((function(e){if(e.result&&"success"==e.result)window.location=e.redirect;else if(e.messages)return t.submitError(e.messages)})).catch((function(e){e.code&&t.submitError(e.message)}))}},{key:"getCartCheckoutData",value:function(){return m({payment_method:this.id,context:this.context.getPage()},(0,a.fieldsToJson)())}},{key:"getProcessingSelector",value:function(){return"body"}},{key:"showProcessing",value:function(){var t;null===(t=r()(this.getProcessingSelector()))||void 0===t||t.block({message:this.getProcessingMessage(),overlayCSS:{background:"#fff",opacity:.6}})}},{key:"hideProcessing",value:function(){var t;null===(t=r()(this.getProcessingSelector()))||void 0===t||t.unblock()}},{key:"getProcessingMessage",value:function(){return'<div class="wc-ppcp-loader">\n                        <div></div>\n                        <div></div>\n                        <div></div>\n                      </div>'}},{key:"getFullName",value:function(t){var e=[(0,a.getFieldValue)("first_name",t),(0,a.getFieldValue)("last_name",t)].filter(Boolean);return 0==e.length?null:1==e.length?e[0]:"".concat(e[0]," ").concat(e[1])}},{key:"updateGatewaySettings",value:function(t){var e="".concat(this.id,"_data");t[e]&&(this.gateway.settings=m(m({},this.gateway.settings),t[e]))}},{key:"isOrderAttributionEnabled",value:function(){return"undefined"!=typeof wc_order_attribution&&null!==document.querySelector("wc-order-attribution-inputs")}},{key:"storeAttributionValues",value:function(){if(!t.attributionDataStored&&!this.context.isCheckout()&&this.isOrderAttributionEnabled()){var e=wc_order_attribution.params.prefix;r()('input[type="hidden"][name^="'+e+'"]').each((function(t,e){var n=r()(e),i=n.attr("name");(0,a.setFieldValue)(i,n.val(),null)})),t.attributionDataStored=!0}}},{key:"getLineItems",value:function(){return this.cart.getLineItems()}},{key:"getShippingOptions",value:function(){return this.cart.getShippingOptions()}},{key:"getSelectedShippingMethod",value:function(){return this.cart.getSelectedShippingMethod()}},{key:"getCurrency",value:function(){return this.cart.getCurrency()}},{key:"getTotal",value:function(){return this.cart.getTotal()}},{key:"getTotalCents",value:function(){return this.cart.getTotalCents()}}],n&&_(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();k(P,"attributionDataStored",!1);const O=P;function E(t){return E="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},E(t)}function x(){x=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var i=e&&e.prototype instanceof h?e:h,o=Object.create(i.prototype),a=new P(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=w(a,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=s(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function d(){}function p(){}var f={};c(f,i,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==e&&n.call(v,i)&&(f=v);var m=p.prototype=h.prototype=Object.create(f);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(i,o,a,c){var u=s(t[i],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==E(h)&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=s(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function O(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:S}}function S(){return{value:void 0,done:!0}}return d.prototype=p,c(m,"constructor",p),c(p,"constructor",d),d.displayName=c(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(b.prototype),c(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new b(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),c(m,a,"Generator"),c(m,i,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=O,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:O(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function S(t,e,n,r,i,o,a){try{var c=t[o](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,i)}function j(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 C(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,r.key,r)}}function L(){return L="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=F(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},L.apply(this,arguments)}function F(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=A(t)););return t}function T(t,e){return T=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},T(t,e)}function R(t,e){if(e&&("object"===E(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return V(t)}function V(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function A(t){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},A(t)}function M(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var B=function(t){!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&&T(t,e)}(l,t);var e,n,i,o,c,u,s=(c=l,u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=A(c);if(u){var n=A(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return R(this,t)});function l(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),M(V(n=s.call(this,e)),"_excludedKeys",["add-to-cart","quantity","variation_id"]),n.product=t,n}return e=l,n=[{key:"initialize",value:function(){this.actions.addAction("found_variation",this.onFoundVariation.bind(this)),this.actions.addAction("reset_variation",this.onResetVariation.bind(this)),this.setMaxWidth(),L(A(l.prototype),"initialize",this).call(this)}},{key:"onPaymentElementReady",value:function(){var t,e;L(A(l.prototype),"onPaymentElementReady",this).call(this),this.product.isVariableProduct()&&(this.product.isVariationSelected()&&null!==(t=this.product)&&void 0!==t&&null!==(e=t.variation)&&void 0!==e&&e.is_in_stock?this.enablePaymentElement():this.disablePaymentElement(!0))}},{key:"needsShipping",value:function(){return this.cart.isEmpty()?this.product.needsShipping():L(A(l.prototype),"needsShipping",this).call(this)}},{key:"getElementContainer",value:function(){var t="wc-".concat(this.id,"-product-button-container"),e=document.querySelectorAll(".".concat(t));return e&&e.length>0?e:document.getElementById(t)}},{key:"setMaxWidth",value:function(){var t,e;if("add_to_cart"==(null===(t=this.settings)||void 0===t||null===(e=t.product)||void 0===e?void 0:e.button_width)){this.buttonWidth=r()("form.cart div.quantity").outerWidth(!0)+r()(".single_add_to_cart_button").outerWidth();var n=r()(".single_add_to_cart_button").css("marginLeft");n&&(this.buttonWidth+=parseInt(n.replace("px",""))),r()(this.container).css("max-width",this.buttonWidth+"px")}}},{key:"submitError",value:function(t){this.hideProcessing(),(0,a.submitErrorMessage)(t,"div.woocommerce-notices-wrapper")}},{key:"addToCart",value:function(){var t=this;return this.cart.addToCart(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?j(Object(n),!0).forEach((function(e){M(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({payment_method:this.id,product_id:this.product.getId(),variation_id:this.product.getVariationId(),qty:this.product.getQuantity(),variation:this.product.getVariationData(),needs_setup_token:this.settings.needsSetupToken},(0,a.convertFormToJson)(r()("form.cart"),this._excludedKeys))).then((function(e){if(!e.code)return t._cartItemKey=e.cart_item_key,e.order_id;t.currentError=e})).catch((function(e){return t.currentError=e,t.submitError(e)}))}},{key:"createOrder",value:function(){return this.addToCart()}},{key:"createVaultSetupToken",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.addToCart().then((function(){return L(A(l.prototype),"createVaultSetupToken",t).call(t,e)}))}},{key:"removeCartItem",value:(i=x().mark((function t(){return x().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._cartItemKey){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,this.cart.removeCartItem(this._cartItemKey);case 4:case"end":return t.stop()}}),t,this)})),o=function(){var t=this,e=arguments;return new Promise((function(n,r){var o=i.apply(t,e);function a(t){S(o,n,r,a,c,"next",t)}function c(t){S(o,n,r,a,c,"throw",t)}a(void 0)}))},function(){return o.apply(this,arguments)})},{key:"onFoundVariation",value:function(t,e){t?(this.destroyPaymentElement(),this.createPaymentElement()):e.variation.is_in_stock?this.enablePaymentElement():this.disablePaymentElement(!0)}},{key:"onResetVariation",value:function(){this.disablePaymentElement(!0)}},{key:"onCancel",value:function(){var t=this;this.removeCartItem().finally((function(){L(A(l.prototype),"onCancel",t).call(t)}))}},{key:"getTotal",value:function(t){return this.cart.isEmpty()?this.product.getTotal(t):L(A(l.prototype),"getTotal",this).call(this,t)}},{key:"getTotalCents",value:function(){return this.cart.isEmpty()?this.product.getTotalCents():L(A(l.prototype),"getTotalCents",this).call(this)}},{key:"getLineItems",value:function(){return this.cart.isEmpty()?this.product.getLineItems():L(A(l.prototype),"getLineItems",this).call(this)}}],n&&C(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),l}(O);function D(t){return D="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},D(t)}function G(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function I(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,r.key,r)}}function N(){return N="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=q(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},N.apply(this,arguments)}function q(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=K(t)););return t}function z(t,e){return z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},z(t,e)}function U(t,e){if(e&&("object"===D(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)}function K(t){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},K(t)}var W=function(t){!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&&z(t,e)}(u,t);var e,n,i,o,c=(i=u,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=K(i);if(o){var n=K(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return U(this,t)});function u(){return G(this,u),c.apply(this,arguments)}return e=u,(n=[{key:"initialize",value:function(){this.actions.addAction("cart_updated",this.onCartUpdated.bind(this)),r()(window).on("resize",this.doCartHtml.bind(this)),r()(document).on("change",'input[name^="shipping_method"]',this.onShippingSelected.bind(this)),N(K(u.prototype),"initialize",this).call(this),this.doCartHtml()}},{key:"getElementContainer",value:function(){return document.getElementById("wc-".concat(this.id,"-cart-button-container"))}},{key:"onCartUpdated",value:function(t){N(K(u.prototype),"initialize",this).call(this),this.doCartHtml()}},{key:"onShippingSelected",value:function(){this.storeAttributionValues()}},{key:"submitError",value:function(t){this.hideProcessing(),(0,a.submitErrorMessage)(t,"div.woocommerce-notices-wrapper","checkout")}},{key:"doCartHtml",value:function(){var t=r()(".checkout-button"),e=t.outerWidth();e&&r()(".wc-ppcp-cart-payments__container").length&&r()(".wc-ppcp-cart-payments__container").width(e),"none"!==t.css("float")&&r()(".wc-ppcp-cart-payments__container ").css("float",t.css("float"))}},{key:"onPaymentElementReady",value:function(){N(K(u.prototype),"onPaymentElementReady",this).call(this),r()(".wc-ppcp-cart-payments__container").show()}}])&&I(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),u}(O);const Y=window.wcPPCP.paymentMethods;function H(t){return H="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},H(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 J(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?$(Object(n),!0).forEach((function(e){Q(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 Q(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function X(){X=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var i=e&&e.prototype instanceof h?e:h,o=Object.create(i.prototype),a=new P(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=w(a,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=s(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function d(){}function p(){}var f={};c(f,i,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==e&&n.call(v,i)&&(f=v);var m=p.prototype=h.prototype=Object.create(f);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(i,o,a,c){var u=s(t[i],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==H(h)&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=s(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function O(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return d.prototype=p,c(m,"constructor",p),c(p,"constructor",d),d.displayName=c(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(b.prototype),c(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new b(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),c(m,a,"Generator"),c(m,i,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=O,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:O(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function Z(t,e,n,r,i,o,a){try{var c=t[o](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,i)}function tt(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){Z(o,r,i,a,c,"next",t)}function c(t){Z(o,r,i,a,c,"throw",t)}a(void 0)}))}}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,r.key,r)}}function nt(){return nt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=rt(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},nt.apply(this,arguments)}function rt(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=at(t)););return t}function it(t,e){return it=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},it(t,e)}function ot(t,e){if(e&&("object"===H(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)}function at(t){return at=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},at(t)}var ct=function(t){!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&&it(t,e)}(d,t);var e,n,i,u,s,l,h=(s=d,l=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=at(s);if(l){var n=at(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return ot(this,t)});function d(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,d),(e=h.call(this,t)).order=t.order,e.shippingAddressChanged=!1,e.promises=[],e}return e=d,n=[{key:"initialize",value:function(){nt(at(d.prototype),"initialize",this).call(this),this.actions.addAction("updated_checkout",this.updatedCheckout.bind(this)),r()(document.body).on("update_checkout",this.updateCheckout.bind(this)),this.context.isCheckout()?(r()(document.body).on("payment_method_selected",this.paymentMethodSelected.bind(this)),r()("form.checkout").on("checkout_place_order_".concat(this.id),this.onCheckoutPlaceOrder.bind(this))):(r()(document.body).on("change",'input[name="payment_method"]',this.paymentMethodSelected.bind(this)),r()(document.body).on("click","#place_order",this.onClickPlaceOrder.bind(this))),r()(document.body).on("checkout_error",this.onCheckoutError.bind(this)),r()(document.body).on("click",".wc-".concat(this.gateway.id,"-cancel__payment"),this.cancelPayment.bind(this)),r()(document.body).on("change",'[name="terms"]',this.handleTermsClick.bind(this)),r()(document.body).on("change",'[type="checkbox"]',this.handleCheckboxChange.bind(this)),r()(document.body).on("change",'[name="wc-'.concat(this.id,'-payment-token"]'),this.onPaymentTokenClick.bind(this)),window.addEventListener("hashchange",this.handleHashError.bind(this)),this.handleOrderPay()}},{key:"createPaymentElement",value:(u=tt(X().mark((function t(){var e=this;return X().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(this.promises);case 2:if(this.promises=[],!this.context.isCheckout()||this.isEnabledForCheckoutSection()){t.next=6;break}return this.hidePaymentMethodRow(),t.abrupt("return");case 6:nt(at(d.prototype),"createPaymentElement",this).call(this).then((function(){e.paymentMethodSelected()}));case 7:case"end":return t.stop()}}),t,this)}))),function(){return u.apply(this,arguments)})},{key:"isEnabledForCheckoutSection",value:function(){var t,e,n;return null===(t=null===(e=this.gateway.settings)||void 0===e||null===(n=e.sections)||void 0===n?void 0:n.includes("checkout"))||void 0===t||t}},{key:"hidePaymentMethodRow",value:function(){this.context.isOrderPay()?r()("form#order_review li.payment_method_".concat(this.id)).hide():r()("form.checkout li.payment_method_".concat(this.id)).hide()}},{key:"onPaymentUnavailable",value:function(){var t,e,n,i;if(nt(at(d.prototype),"onPaymentUnavailable",this).call(this),this.configurationError){var o=(0,a.isAdminUser)()?(null===(t=this.gateway.settings)||void 0===t||null===(e=t.i18n)||void 0===e?void 0:e.unavailable_admin)||this.configurationError:(null===(n=this.gateway.settings)||void 0===n||null===(i=n.i18n)||void 0===i?void 0:i.unavailable)||"Payment method unavailable",c=r()("div.payment_method_".concat(this.id)).find(".wc-".concat(this.id,"-payment-method__container"));c.find(".woocommerce-info").remove(),c.prepend('<div class="woocommerce-info"><p>'.concat(o,"</p></div>"))}else this.hidePaymentMethodRow()}},{key:"needsShipping",value:function(){return this.context.isOrderPay()?this.order.needsShipping():!this.context.isAddPaymentMethod()&&this.cart.needsShipping()}},{key:"getCurrency",value:function(){return this.context.isOrderPay()?this.order.getCurrency():nt(at(d.prototype),"getCurrency",this).call(this)}},{key:"getTotal",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string";return this.context.isOrderPay()?this.order.getTotal():nt(at(d.prototype),"getTotal",this).call(this,t)}},{key:"getTotalCents",value:function(){return this.context.isOrderPay()?this.order.getTotalCents():nt(at(d.prototype),"getTotalCents",this).call(this)}},{key:"getLineItems",value:function(){return this.context.isOrderPay()?this.order.getLineItems():nt(at(d.prototype),"getLineItems",this).call(this)}},{key:"updatedCheckout",value:function(t){nt(at(d.prototype),"initialize",this).call(this),this.paymentMethodSelected(),(this.isOrderReview()||this.isReadyToCheckout())&&this.displayPaymentReadyMessage()}},{key:"updateCheckout",value:function(){this.promises.push(new Promise((function(t){r()(document.body).one("updated_checkout",(function(){t()}))})))}},{key:"paymentMethodSelected",value:function(){if(this.isPaymentGatewaySelected()){if(!this.isPaymentMethodAvailable)return void this.displayPlaceOrderButton();this.gateway.supports("place_order_button")?(this.displayPlaceOrderButton(),this.isReadyToCheckout()&&this.isPaymentSectionPlacement()&&this.hidePaymentElement()):this.isReadyToCheckout()||this.isSavedPaymentMethodSelected()?this.displayPlaceOrderButton():(this.displayPaymentElement(),this.hidePlaceOrderButton())}else if(!this.gateway.supports("place_order_button")){var t;this.hidePaymentElement();var e=null===(t=r()('[name="payment_method"]:checked'))||void 0===t?void 0:t.val();e&&!(0,Y.getPaymentMethod)(e)&&this.displayPlaceOrderButton()}}},{key:"handleHashError",value:function(t){var e=t.newURL.match(/ppcp_error=(.*)/);e&&"true"==e[1]&&(this.displayPaymentElement(),history.pushState({},"",window.location.pathname+window.location.search))}},{key:"isOrderReview",value:function(){var t,e,n,r=null===(t=window)||void 0===t||null===(e=t.location)||void 0===e||null===(n=e.search)||void 0===n?void 0:n.match(/_ppcp_order_review=(.*)/);return(null==r?void 0:r.length)>0}},{key:"handleOrderPay",value:function(){if(this.isOrderReview())try{var t,e,n,i,o=(null===(t=window)||void 0===t||null===(e=t.location)||void 0===e||null===(n=e.search)||void 0===n?void 0:n.match(/_ppcp_order_review=(.*)/))[1],u=JSON.parse(atob(decodeURIComponent(o))),s=(u.payment_method,u.paypal_order),l=u.fields;if((0,a.setFieldValue)(this.order_field_key,s,""),!(0,c.isEmpty)(l))for(var h in l)(0,a.setFieldValue)(h,l[h],"");if(this.hidePaymentElement(),this.needsShipping()&&null!==(i=r()('[name="ship_to_different_address"]'))&&void 0!==i&&i.length){var d=!(0,c.isEqual)(this.getCartAddress("billing"),this.getCartAddress("shipping"));r()('[name="ship_to_different_address"]').prop("checked",d).trigger("change")}}catch(t){console.log(t)}}},{key:"createOrder",value:function(t,e){if(this.context.isOrderPay())return this.order.createOrder(this.id);var n=J(J({},this.convertFormToData()),{},{context:this.context.getPage(),payment_method:this.id});return this.cart.createOrder(n)}},{key:"createVaultSetupToken",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.context.isOrderPay()||(t=J(J({},this.convertFormToData()),{},{context:this.context.getPage(),payment_method:this.id})),nt(at(d.prototype),"createVaultSetupToken",this).call(this,t)}},{key:"displayPlaceOrderButton",value:function(){var t;null===(t=this.getPlaceOrderButton())||void 0===t||t.removeClass("wc-ppcp-hide-button")}},{key:"hidePlaceOrderButton",value:function(){var t;null===(t=this.getPlaceOrderButton())||void 0===t||t.addClass("wc-ppcp-hide-button")}},{key:"getPlaceOrderButton",value:function(){var t=r()("#place_order");return t.length||(t=r()('[name="woocommerce_checkout_place_order"]')),t.length||(t=r()('form.checkout button[type="submit"]')),t.length||(t=r()('form[id="order_review"] button[type="submit"]')),t}},{key:"getButtonPlacement",value:function(){var t;return(null===(t=this.settings)||void 0===t?void 0:t.buttonPlacement)||"place_order"}},{key:"isPlaceOrderPlacement",value:function(){return"place_order"===this.getButtonPlacement()}},{key:"isPaymentSectionPlacement",value:function(){return"payment_method"===this.getButtonPlacement()}},{key:"getElementContainer",value:function(){if(this.paymentElementSelector)return document.querySelector(this.paymentElementSelector);var t=this.getButtonPlacement(),e="wc-".concat(this.id,"-checkout-container"),n=".".concat(e),i="place_order"===t&&!this.gateway.supports("place_order_button");return document.querySelector(n)||(i?this.getPlaceOrderButton().after('<div class="'.concat(e,'"></div>')):"payment_method"===t&&r()("div.payment_method_".concat(this.id)).find(".wc-".concat(this.id,"-payment-method__container")).append('<div class="'.concat(e,'"></div>'))),i&&r()(n).hide(),document.querySelector(n)}},{key:"isPaymentGatewaySelected",value:function(){var t;return(null===(t=r()('[name="payment_method"]:checked'))||void 0===t?void 0:t.val())===this.id}},{key:"submitError",value:function(t){return"validation_errors"===(null==t?void 0:t.code)?(this.getForm().find(".input-text, select, input:checkbox").trigger("validate").trigger("blur"),(0,a.submitErrorMessage)(t.data.messages,this.getForm(),"checkout")):(0,a.submitErrorMessage)(t,this.getForm(),"checkout")}},{key:"getShippingPrefix",value:function(){var t;return null!==(t=r()('[name="ship_to_different_address"]'))&&void 0!==t&&t.length&&r()('[name="ship_to_different_address"]').is(":checked")?"shipping":"billing"}},{key:"isCheckoutReviewRequired",value:function(t){return!(!this.needsShipping()||!this.actions.applyFilters("is_checkout_review_required",!this.shippingAddressChanged,this)||(0,c.isEmpty)(t.shipping_address)||(0,c.isEqual)({city:t.shipping_address.city,state:t.shipping_address.state,postal_code:t.shipping_address.postal_code,country_code:t.shipping_address.country_code},{city:(0,a.getFieldValue)("shipping_city"),state:(0,a.getFieldValue)("shipping_state"),postal_code:(0,a.getFieldValue)("shipping_postcode"),country_code:(0,a.getFieldValue)("shipping_country")}))}},{key:"getForm",value:function(){return this.context.isCheckout()||this.context.isExpressCheckout()?r()(this.container).closest("form.checkout"):r()(this.container).closest("form")}},{key:"validateTerms",value:function(){return!r()('[name="terms"]').filter(":visible").length||r()('[name="terms"]').is(":checked")}},{key:"onClickPlaceOrder",value:function(t){this.isPaymentGatewaySelected()&&(this.onCheckoutPlaceOrder(t,null)||t.preventDefault())}},{key:"onCheckoutPlaceOrder",value:function(t){var e,n,r=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isSavedPaymentMethodSelected())return!0;if(this.isReadyToCheckout()||null!==(e=(n=this.gateway).isPaymentReady)&&void 0!==e&&e.call(n))return!0;if(!this.validateSync())return!1;if(this.gateway.supports("place_order_button")&&this.isPaymentSectionPlacement()&&!this.isReadyToCheckout())return this.submitError((0,a.getErrorMessage)({code:"order_button_click"}).replace("%s",this.gateway.settings.title)),!1;try{this.gateway.validatePaymentElement()}catch(t){return this.submitError(t),!1}return!this.gateway.supports("create_payment_method")||(this.gateway.createPaymentMethod(i).catch((function(t){r.submitError(t)})),!1)}},{key:"isTermsVisible",value:function(){return r()('[name="terms"]').filter(":visible").length>0}},{key:"handleTermsClick",value:function(){this.isPlaceOrderPlacement()&&this.gateway.supports("disable_for_terms")&&r()('[name="terms"]').filter(":visible").length&&(r()('[name="terms"]').is(":checked")?this.enablePaymentElement():this.disablePaymentElement())}},{key:"handleCheckboxChange",value:function(){var t=this;setTimeout((function(){t.isTermsVisible()&&t.handleTermsClick()}),250)}},{key:"onPaymentTokenClick",value:function(t){this.isSavedPaymentMethodSelected()?(this.hidePaymentElement(),this.displayPlaceOrderButton()):(this.displayPaymentElement(),this.gateway.supports("place_order_button")||this.hidePlaceOrderButton())}},{key:"validateSync",value:function(){return!(this.isPlaceOrderPlacement()&&!this.validateTerms()&&(this.submitError({code:"terms"}),1))}},{key:"validate",value:(i=tt(X().mark((function t(){var e=this;return X().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.validateSync()){t.next=2;break}return t.abrupt("return",!1);case 2:if(!this.context.isCheckout()){t.next=18;break}if(t.prev=3,!this.gateway.supports("api_form_validation")){t.next=7;break}return t.next=7,this.apiFormValidation();case 7:if(!this.gateway.supports("form_validation")){t.next=12;break}if(this.isCheckoutFormValid()){t.next=12;break}return this.disablePaymentElement(!0),t.next=12,this.apiFormValidation().finally((function(){e.enablePaymentElement()}));case 12:t.next=18;break;case 14:return t.prev=14,t.t0=t.catch(3),this.submitError(t.t0),t.abrupt("return",!1);case 18:return t.abrupt("return",!0);case 19:case"end":return t.stop()}}),t,this,[[3,14]])}))),function(){return i.apply(this,arguments)})},{key:"onShippingChange",value:function(t){var e;if(null!==(e=t)&&void 0!==e&&e.shipping_method)for(var n=(0,a.extractShippingMethod)(t.shipping_method),i=0,o=Object.keys(n);i<o.length;i++){var u=o[i],s=n[u],l=r()('[name="shipping_method['.concat(u,']"][value="').concat(s,'"]'));l.length?l.prop("checked",!0):this.update_required=!0}return t.address&&(this.shippingAddressChanged=!(0,c.isEqual)(t.address,{city:(0,a.getFieldValue)("shipping_city"),state:(0,a.getFieldValue)("shipping_state"),postcode:(0,a.getFieldValue)("shipping_postcode"),country:(0,a.getFieldValue)("shipping_country")})),t=J(J({},this.convertFormToData()),t),this.actions.doAction("checkout_on_shipping_change",t,this),nt(at(d.prototype),"onShippingChange",this).call(this,t)}},{key:"displayPaymentReadyMessage",value:function(){r()(".wc-".concat(this.gateway.id,"-popup__container")).hide(),r()(".wc-".concat(this.gateway.id,"-order-review-message__container")).show();var t=r()(".wc-".concat(this.gateway.id,"-order-review__message")).text().replace("%s",r()("#place_order").text());r()(".wc-".concat(this.gateway.id,"-order-review__message")).text(t)}},{key:"hidePaymentReadyMessage",value:function(){r()(".wc-".concat(this.gateway.id,"-popup__container")).show(),r()(".wc-".concat(this.gateway.id,"-order-review-message__container")).hide()}},{key:"cancelPayment",value:function(t){t.preventDefault(),(0,a.setFieldValue)(this.order_field_key,"",""),(0,a.setFieldValue)("".concat(this.gateway.id,"_payment_token"),null,null),this.hidePaymentReadyMessage(),this.displayPaymentElement(),this.gateway.supports("place_order_button")||this.hidePlaceOrderButton()}},{key:"getProcessingSelector",value:function(){return this.container}},{key:"getProcessingMessage",value:function(){return null}},{key:"fetchBillingToken",value:function(t){var e=this;return this.showProcessing(),nt(at(d.prototype),"fetchBillingToken",this).call(this,t).then((function(t){return e.hideProcessing(),t}))}},{key:"isReadyToCheckout",value:function(){return!(!(0,a.getFieldValue)(this.order_field_key,null)&&!(0,a.getFieldValue)("".concat(this.gateway.id,"_payment_token"),null))}},{key:"convertFormToData",value:function(){return(0,a.convertFormToJson)(r()("form.checkout"))}},{key:"submit",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;t&&this.populateCheckoutFields(t),this.gateway.supports("create_payment_method")||(this.hidePaymentElement(),this.displayPlaceOrderButton()),this.update_required?this.triggerCheckoutUpdate(t):(this.isPaymentSectionPlacement()&&!this.context.isExpressCheckout()||this.submitForm(t),this.isPaymentSectionPlacement()&&this.displayPaymentReadyMessage())}},{key:"triggerCheckoutUpdate",value:function(t){var e=this;return new Promise((function(n){r()(document.body).one("updated_checkout",(function(){null!=t&&t.vaultSetupToken&&e.needsShipping()?e.displayPaymentReadyMessage():e.submitForm(t),n()})),r()('[name="billing_country"],[name="billing_state"]').trigger("change"),e.shipToDifferentAddressChecked()&&r()('[name="shipping_country"],[name="shipping_state"]').trigger("change"),r()(document.body).trigger("update_checkout",{update_shipping_method:!1})}))}},{key:"submitForm",value:function(t){this.actions.applyFilters("checkout_submit_form",!0,t,this)&&this.getForm().submit()}},{key:"shipToDifferentAddressChecked",value:function(){var t;return!(null===(t=r()('[name="ship_to_different_address"]'))||void 0===t||!t.length)&&r()('[name="ship_to_different_address"]').is(":checked")}},{key:"getPaymentType",value:function(){return"checkout"}},{key:"isValidationEnabled",value:function(){return this.settings.checkoutValidationEnabled}},{key:"isSavedPaymentMethodSelected",value:function(){var t='[name="wc-'.concat(this.id,'-payment-token"]:checked');return this.isPaymentGatewaySelected()&&r()(t).length>0&&"new"!==r()(t).val()}},{key:"apiFormValidation",value:function(){var t=J(J({},this.convertFormToData()),{},{context:this.context.getPage(),payment_method:this.id});return o()({method:"POST",url:(0,a.getRestRoute)("checkout/validation"),data:t}).catch((function(t){throw t}))}},{key:"onCheckoutError",value:function(){this.isPaymentGatewaySelected()&&(this.enablePlaceOrderButton(),this.isReadyToCheckout()&&this.displayPaymentReadyMessage(),this.actions.doAction("checkout_error_".concat(this.gateway.id),this))}},{key:"enablePlaceOrderButton",value:function(){this.getPlaceOrderButton().prop("disabled",!1)}},{key:"isCheckoutFormValid",value:function(){var t=[];return r()(".validate-required:visible").each((function(e,n){var i=r()(n).find("input, select, textarea").first();if(i.length&&i.is(":visible")){var o=i.attr("name");"checkbox"===i.attr("type")?i.is(":checked")||t.push(o):""!==i.val()&&null!==i.val()||t.push(o)}})),0===t.length}}],n&&et(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),d}(O);function ut(t){return ut="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},ut(t)}function st(){st=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function u(t,e,n,r){var i=e&&e.prototype instanceof h?e:h,o=Object.create(i.prototype),a=new P(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return{value:void 0,done:!0}}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var c=w(a,n);if(c){if(c===l)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=s(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function s(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l={};function h(){}function d(){}function p(){}var f={};c(f,i,(function(){return this}));var y=Object.getPrototypeOf,v=y&&y(y(O([])));v&&v!==e&&n.call(v,i)&&(f=v);var m=p.prototype=h.prototype=Object.create(f);function g(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(i,o,a,c){var u=s(t[i],t,o);if("throw"!==u.type){var l=u.arg,h=l.value;return h&&"object"==ut(h)&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function w(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=s(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function O(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:E}}function E(){return{value:void 0,done:!0}}return d.prototype=p,c(m,"constructor",p),c(p,"constructor",d),d.displayName=c(p,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,c(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(b.prototype),c(b.prototype,o,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new b(u(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),c(m,a,"Generator"),c(m,i,(function(){return this})),c(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=O,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),u=n.call(o,"finallyLoc");if(c&&u){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),k(n),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;k(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:O(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},t}function lt(t,e,n,r,i,o,a){try{var c=t[o](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,i)}function ht(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){lt(o,r,i,a,c,"next",t)}function c(t){lt(o,r,i,a,c,"throw",t)}a(void 0)}))}}function dt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pt(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,r.key,r)}}function ft(){return ft="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=yt(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},ft.apply(this,arguments)}function yt(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=gt(t)););return t}function vt(t,e){return vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vt(t,e)}function mt(t,e){if(e&&("object"===ut(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)}function gt(t){return gt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},gt(t)}var bt=function(t){!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&&vt(t,e)}(c,t);var e,n,i,o,a=(i=c,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=gt(i);if(o){var n=gt(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return mt(this,t)});function c(){return dt(this,c),a.apply(this,arguments)}return e=c,n=[{key:"initialize",value:function(){var t=this;this.actions.addAction("updated_checkout",this.updatedCheckout.bind(this)),this.loadPayPalScript().then(ht(st().mark((function e(){return st().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.createPaymentElement();case 1:case"end":return e.stop()}}),e)}))))}},{key:"updatedCheckout",value:function(t){this.paypal&&this.createPaymentElement(),this.updateGatewaySettings(t)}},{key:"needsShipping",value:function(){return this.cart.needsShipping()}},{key:"validate",value:function(){return!0}},{key:"submit",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;ft(gt(c.prototype),"submit",this).call(this,t);var e=ft(gt(c.prototype),"getElementContainer",this).call(this);e&&r()(e).hide()}},{key:"getElementContainer",value:function(){var t;if(null!==(t=this.settings)&&void 0!==t&&t.expressElement){var e=document.querySelector(this.settings.expressElement);if(e)return e}return document.getElementById("wc-".concat(this.id,"-express-button"))}},{key:"onPaymentElementReady",value:function(){this.actions.doAction("payment_element_ready",this);var t=this.getElementContainer();t&&(r()(t).show(),this.addExpressClasses(r()(t))),r()(".wc-ppcp-express-checkout").show()}},{key:"addExpressClasses",value:function(t){if(t.length&&this.gateway.buttons){var e=Object.keys(this.gateway.buttons).length;t.addClass("button-count_".concat(e))}}},{key:"onClick",value:function(){r()('[name="terms"]').prop("checked",!0).trigger("change"),r()('[name="payment_method"][value="'.concat(this.id,'"]')).prop("checked",!0).trigger("click"),r()('[name="wc-'.concat(this.id,'-payment-token"][value="new"]')).trigger("click")}},{key:"paymentMethodSelected",value:function(){}},{key:"hidePaymentElement",value:function(){}}],n&&pt(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),c}(ct);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 _t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function kt(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,r.key,r)}}function Pt(){return Pt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=Ot(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Pt.apply(this,arguments)}function Ot(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=St(t)););return t}function Et(t,e){return Et=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Et(t,e)}function xt(t,e){if(e&&("object"===wt(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)}function St(t){return St=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},St(t)}var jt=function(t){!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&&Et(t,e)}(c,t);var e,n,i,o,a=(i=c,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=St(i);if(o){var n=St(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return xt(this,t)});function c(){return _t(this,c),a.apply(this,arguments)}return e=c,(n=[{key:"initialize",value:function(){this.actions.addAction("fragments_changed",this.onFragmentsChanged.bind(this)),Pt(St(c.prototype),"initialize",this).call(this)}},{key:"onFragmentsChanged",value:function(){this.cart.isEmpty()||Pt(St(c.prototype),"initialize",this).call(this)}},{key:"getElementContainer",value:function(){var t=document.querySelectorAll(".wc-ppcp-minicart-".concat(this.id));return t&&t.length>0?t:(r()(".woocommerce-mini-cart__buttons").append('<a id="wc-ppcp-minicart-'.concat(this.id,'"></a>')),document.getElementById("wc-ppcp-minicart-".concat(this.id)))}}])&&kt(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),c}(O);(this.wcPPCP=this.wcPPCP||{}).controllers=e})();
(()=>{"use strict";var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e);const r=window.wcPPCP.cart;var n=t.n(r);const o=window.wcPPCP.utils,i=window.wcPPCP.controllers,a=window.wcPPCP.context;var u=t.n(a);const c=window.jQuery;var l=t.n(c);const s=window.wcPPCP.actions;var f=t.n(s);function p(t){return p="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},p(t)}function h(){h=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=O(a,r);if(u){if(u===s)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var s={};function f(){}function y(){}function d(){}var v={};u(v,o,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(E([])));g&&g!==e&&r.call(g,o)&&(v=g);var b=d.prototype=f.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function n(o,i,a,u){var c=l(t[o],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==p(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function O(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method))return s;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,s;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,s):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:j}}function j(){return{value:void 0,done:!0}}return y.prototype=d,u(b,"constructor",d),u(d,"constructor",y),y.displayName=u(d,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,a,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(_.prototype),u(_.prototype,i,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new _(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(b),u(b,a,"Generator"),u(b,o,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),s},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),s}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},t}function y(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function d(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){y(i,n,o,a,u,"next",t)}function u(t){y(i,n,o,a,u,"throw",t)}a(void 0)}))}}function v(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var m=function(){function t(e){var r=e.id,n=e.settings,o=e.controller;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=r,this.settings=n,this.controller=o,this.paypal=null,this.capabilities=[],"payment_method"===this.settings.buttonPlacement&&this.capabilities.push("place_order_button"),this.actions=new(f())}var e,r,n,o;return e=t,r=[{key:"initialize",value:function(){}},{key:"setController",value:function(t){this.controller=t}},{key:"setPayPal",value:function(t){this.paypal=t}},{key:"canMakePayment",value:(o=d(h().mark((function t(){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",!0);case 1:case"end":return t.stop()}}),t)}))),function(){return o.apply(this,arguments)})},{key:"shouldCreateElement",value:function(t){return!0}},{key:"createPaymentElement",value:(n=d(h().mark((function t(e){return h().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:throw new Error("Must implement createPaymentElement()");case 1:case"end":return t.stop()}}),t)}))),function(t){return n.apply(this,arguments)})},{key:"getOrderFieldKey",value:function(){return"".concat(this.id,"_paypal_order_id")}},{key:"getTokenFieldKey",value:function(){return"".concat(this.id,"_payment_token")}},{key:"enablePaymentElement",value:function(){}},{key:"disablePaymentElement",value:function(){}},{key:"destroyPaymentElement",value:function(){}},{key:"validatePaymentElement",value:function(){return!0}},{key:"supports",value:function(t){return this.capabilities.includes(t)}}],r&&v(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function g(t){return g="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},g(t)}function b(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?b(Object(r),!0).forEach((function(e){_(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function _(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function O(){O=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=_(a,r);if(u){if(u===s)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var s={};function f(){}function p(){}function h(){}var y={};u(y,o,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(E([])));v&&v!==e&&r.call(v,o)&&(y=v);var m=h.prototype=f.prototype=Object.create(y);function b(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function n(o,i,a,u){var c=l(t[o],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==g(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function _(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return s;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,s;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,s):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:j}}function j(){return{value:void 0,done:!0}}return p.prototype=h,u(m,"constructor",h),u(h,"constructor",p),p.displayName=u(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},b(w.prototype),u(w.prototype,i,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(m),u(m,a,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=E,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),s},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),x(r),s}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},t}function P(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function x(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){P(i,n,o,a,u,"next",t)}function u(t){P(i,n,o,a,u,"throw",t)}a(void 0)}))}}function k(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function E(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function j(t,e){return j=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},j(t,e)}function L(t,e){if(e&&("object"===g(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)}function S(t){return S=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},S(t)}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)}var A=["color","label"];function F(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function T(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function C(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=R(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function D(){D=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function c(t,e,r,n){var o=e&&e.prototype instanceof f?e:f,i=Object.create(o.prototype),a=new P(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=w(a,r);if(u){if(u===s)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===s)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var s={};function f(){}function p(){}function h(){}var y={};u(y,o,(function(){return this}));var d=Object.getPrototypeOf,v=d&&d(d(x([])));v&&v!==e&&r.call(v,o)&&(y=v);var m=h.prototype=f.prototype=Object.create(y);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,u){var c=l(t[o],t,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==N(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,u)}),(function(t){n("throw",t,a,u)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,u)}))}u(c.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function w(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,w(t,e),"throw"===e.method))return s;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,s;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,s):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,s)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function O(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function x(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:k}}function k(){return{value:void 0,done:!0}}return p.prototype=h,u(m,"constructor",h),u(h,"constructor",p),p.displayName=u(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,u(t,a,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(b.prototype),u(b.prototype,i,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(c(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),u(m,a,"Generator"),u(m,o,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=x,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(O),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),s},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),O(r),s}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;O(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:x(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),s}},t}function G(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function I(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){G(i,n,o,a,u,"next",t)}function u(t){G(i,n,o,a,u,"throw",t)}a(void 0)}))}}function R(t,e){if(t){if("string"==typeof t)return U(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?U(t,e):void 0}}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Y(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function M(t,e){return M=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},M(t,e)}function V(t,e){if(e&&("object"===N(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)}function B(t){return B=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},B(t)}var z=function(t){!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&&M(t,e)}(f,t);var e,r,n,i,a,u,c,s=(u=f,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=B(u);if(c){var r=B(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return V(this,t)});function f(t){var e,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),(e=s.call(this,t)).capabilities=[].concat(function(t){if(Array.isArray(t))return U(t)}(r=e.capabilities)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||R(r)||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.")}(),["disable_for_terms"]),e.buttonActions={},e.buttons={},e}return e=f,r=[{key:"initialize",value:function(){this.controller.context.isCheckout()&&this.actions.addFilter("field_population_options",this.getFieldOptions.bind(this),10,2)}},{key:"getFieldOptions",value:function(t,e){return e===this.controller&&e.isPaymentGatewaySelected()&&(t.skipShipping=!!this.settings.paypalAddressDisabled),t}},{key:"shouldCreateElement",value:function(t){return!l()(t).find(".paypal-buttons").length}},{key:"canMakePayment",value:(a=I(D().mark((function t(){return D().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",!!this.paypal);case 1:case"end":return t.stop()}}),t,this)}))),function(){return a.apply(this,arguments)})},{key:"createPaymentElement",value:(i=I(D().mark((function t(e){var r,n,o,i,a,u,c,l;return D().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.buttons={},this.buttonActions={},r=this.getFunding(this.controller.context.getPage()),n=this.getSortedFunding(r),o=[],i=C(n);try{for(i.s();!(a=i.n()).done;)u=a.value,c=this.getButtonOptions(u),l=this.paypal.Buttons(c),this.buttons[u]=l,l.isEligible()&&o.push(l.render(e).catch((function(){})))}catch(t){i.e(t)}finally{i.f()}return t.next=9,Promise.all(o);case 9:return t.abrupt("return",this.buttons);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"getFunding",value:function(t){var e,r,n,o,i,a,u,c,l,s,f,p,h,y=[],d=this.settings;return this.controller.context.isProduct()?(null!==(e=this.settings)&&void 0!==e&&null!==(r=e.product)&&void 0!==r&&null!==(n=r.funding)&&void 0!==n&&n.includes("paypal")&&y.push(this.paypal.FUNDING.PAYPAL),null!==(o=this.settings)&&void 0!==o&&null!==(i=o.product)&&void 0!==i&&null!==(a=i.funding)&&void 0!==a&&a.includes("paylater")&&y.push(this.paypal.FUNDING.PAYLATER),null!==(u=this.settings)&&void 0!==u&&null!==(c=u.product)&&void 0!==c&&null!==(l=c.funding)&&void 0!==l&&l.includes("card")&&y.push(this.paypal.FUNDING.CARD)):(this.isFundingActive("paypal")&&null!=d&&null!==(s=d.paypal_sections)&&void 0!==s&&s.includes(t)&&y.push(this.paypal.FUNDING.PAYPAL),this.isFundingActive("paylater")&&null!=d&&null!==(f=d.paylater_sections)&&void 0!==f&&f.includes(t)&&y.push(this.paypal.FUNDING.PAYLATER),this.isFundingActive("card")&&null!=d&&null!==(p=d.credit_card_sections)&&void 0!==p&&p.includes(t)&&y.push(this.paypal.FUNDING.CARD),this.isFundingActive("venmo")&&null!=d&&null!==(h=d.venmo_sections)&&void 0!==h&&h.includes(t)&&y.push(this.paypal.FUNDING.VENMO)),y}},{key:"getSortedFunding",value:function(t){var e=this.settings.buttons_order||[];return t.sort((function(t,r){return e.indexOf(t)<e.indexOf(r)?-1:1})),t}},{key:"getButtonOptions",value:function(t){var e=this,r={fundingSource:t,style:this.getButtonStyle(t),onInit:function(r,n){var o,i;e.buttonActions[t]=n,l()(document.body).triggerHandler("wc_ppcp_on_init",[e.controller,t]),(e.controller.context.isCheckout()||e.controller.context.isOrderPay())&&e.controller.isTermsVisible()&&e.controller.handleTermsClick(),e.controller.context.isProduct()&&null!==(o=e.controller)&&void 0!==o&&null!==(i=o.$paymentElement)&&void 0!==i&&i.length&&e.controller.$paymentElement.is(".disabled")&&e.disablePaymentElement()},onClick:function(){return e.onClick(t)},onApprove:function(t,r){return e.onApprove(t,r)},onCancel:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e.onCancel(r,t)},onError:function(r){e.onError(r,t)},onDestroy:function(){e.onDestroy(t)},createOrder:function(t,r){return e.controller.createOrder(t,r)}};return this.controller.needsShipping()&&t!==this.paypal.FUNDING.VENMO&&(r.onShippingChange=function(){return e.onShippingChange.apply(e,arguments)}),this.settings.needsSetupToken&&(r.createOrder=null,r.createVaultSetupToken=function(){return e.controller.createVaultSetupToken()}),r}},{key:"onShippingChange",value:(n=I(D().mark((function t(e,r){var n,i,a;return D().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=(0,o.convertPayPalAddressToCart)((null==e?void 0:e.shipping_address)||{},!0),a=(null==e||null===(n=e.selected_shipping_option)||void 0===n?void 0:n.id)||"",t.prev=2,t.next=5,this.controller.onShippingChange({address:i,shipping_method:a,order_id:e.orderID});case 5:if(!t.sent.code){t.next=10;break}return t.abrupt("return",r.reject());case 10:return t.abrupt("return",r.resolve());case 11:t.next=16;break;case 13:return t.prev=13,t.t0=t.catch(2),t.abrupt("return",r.reject());case 16:case"end":return t.stop()}}),t,this,[[2,13]])}))),function(t,e){return n.apply(this,arguments)})},{key:"onClick",value:function(t){this.controller.onClick(),this.controller.validate(),l()(document.body).triggerHandler("wc_ppcp_on_click",[this.controller,t])}},{key:"getButtonStyle",value:function(t){var e,r,n,o,i,a,u,c,l,s=null;switch(t){case this.paypal.FUNDING.PAYPAL:s=null===(e=this.settings)||void 0===e||null===(r=e.buttons)||void 0===r?void 0:r.paypal;break;case this.paypal.FUNDING.PAYLATER:s=null===(n=this.settings)||void 0===n||null===(o=n.buttons)||void 0===o?void 0:o.paylater;break;case this.paypal.FUNDING.CARD:s=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?F(Object(r),!0).forEach((function(e){T(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},null===(i=this.settings)||void 0===i||null===(a=i.buttons)||void 0===a?void 0:a.card),s.tagline?(delete s.tagline,s.layout="vertical"):s.layout="horizontal";break;case this.paypal.FUNDING.VENMO:var f=null===(u=this.settings)||void 0===u||null===(c=u.buttons)||void 0===c?void 0:c.paypal;f.color,f.label,s=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(f,A)}return null!==(l=s)&&void 0!==l&&l.height&&(s.height=parseInt(s.height)),s}},{key:"enablePaymentElement",value:function(){var t=this;Object.keys(this.buttonActions||{}).forEach((function(e){var r;null===(r=t.buttonActions[e])||void 0===r||r.enable()}))}},{key:"disablePaymentElement",value:function(){var t=this;Object.keys(this.buttonActions||{}).forEach((function(e){var r;null===(r=t.buttonActions[e])||void 0===r||r.disable()}))}},{key:"destroyPaymentElement",value:function(){var t=this;Object.keys(this.buttons||{}).forEach((function(e){var r;null!==(r=t.buttons[e])&&void 0!==r&&r.close&&t.buttons[e].close()})),this.buttons={},this.buttonActions={}}},{key:"isFundingActive",value:function(t){var e,r;return null===(e=this.settings)||void 0===e||null===(r=e.funding)||void 0===r?void 0:r.includes(t)}}],r&&Y(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),f}(function(t){!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&&j(t,e)}(f,t);var e,r,n,i,a,u,c,s=(u=f,c=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=S(u);if(c){var r=S(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return L(this,t)});function f(){return k(this,f),s.apply(this,arguments)}return e=f,r=[{key:"onApprove",value:(a=x(O().mark((function t(e){var r,n=arguments;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=n.length>1&&void 0!==n[1]?n[1]:null,e.orderID&&(0,o.setFieldValue)(this.getOrderFieldKey(),e.orderID,null),!e.vaultSetupToken){t.next=6;break}return t.abrupt("return",this.handleVaultSetupToken(e));case 6:return t.abrupt("return",this.handleDirectPayment(e,r));case 7:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"handleVaultSetupToken",value:(i=x(O().mark((function t(e){var r,n;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.controller.createPaymentToken(e.vaultSetupToken,{order_id:e.orderID});case 3:r=t.sent,n=this.extractTokenCheckoutData(r),(0,o.setFieldValue)("".concat(this.id,"_payment_token"),r.id,null),this.controller.submit(n),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),this.controller.submitError(t.t0);case 12:case"end":return t.stop()}}),t,this,[[0,9]])}))),function(t){return i.apply(this,arguments)})},{key:"handleDirectPayment",value:(n=x(O().mark((function t(e,r){var n,o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,n={},!r||!r.order){t.next=7;break}return t.next=5,r.order.get();case 5:o=t.sent,n=this.extractStandardizedCheckoutData(o);case 7:this.controller.submit(n),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(0),this.controller.submitError(t.t0);case 13:case"end":return t.stop()}}),t,this,[[0,10]])}))),function(t,e){return n.apply(this,arguments)})},{key:"extractStandardizedCheckoutData",value:function(t){var e,r,n={};if(null!=t&&t.payer){var i,a,u={};t.payer.address&&(u=w({},(0,o.convertPayPalAddressToCart)(t.payer.address))),t.payer.name&&(u.first_name=t.payer.name.given_name,u.last_name=t.payer.name.surname),t.payer.email_address&&(u.email=t.payer.email_address),null!==(i=t.payer.phone)&&void 0!==i&&null!==(a=i.phone_number)&&void 0!==a&&a.national_number&&(u.phone=t.payer.phone.phone_number.national_number),n.billing=u}if(null!=t&&null!==(e=t.purchase_units)&&void 0!==e&&null!==(r=e[0])&&void 0!==r&&r.shipping){var c,l={},s=t.purchase_units[0].shipping;if(s.address&&(l=w({},(0,o.convertPayPalAddressToCart)(s.address))),null!==(c=s.name)&&void 0!==c&&c.full_name){var f=(0,o.extractFullName)(s.name.full_name);l.first_name=f[0],l.last_name=f[1]}n.shipping=l}return n}},{key:"extractTokenCheckoutData",value:function(t){var e,r,n={};if(null!=t&&null!==(e=t.payment_source)&&void 0!==e&&e.paypal){var i,a,u,c={},l=t.payment_source.paypal;if(l.name&&(c.first_name=l.name.given_name||"",c.last_name=l.name.surname||""),l.email_address&&(c.email=l.email_address),null!==(i=l.phone)&&void 0!==i&&null!==(a=i.phone_number)&&void 0!==a&&a.national_number&&(c.phone=l.phone.phone_number.national_number),n.billing=c,null!==(u=l.shipping)&&void 0!==u&&u.address){var s,f={},p=l.shipping;if(f=w({},(0,o.convertPayPalAddressToCart)(p.address)),null!==(s=p.name)&&void 0!==s&&s.full_name){var h=(0,o.extractFullName)(p.name.full_name);f.first_name=h[0],f.last_name=h[1]}n.shipping=f}}if(null!=t&&null!==(r=t.payment_source)&&void 0!==r&&r.card){var y={},d=t.payment_source.card;if(d.name){var v=(0,o.extractFullName)(d.name);y.first_name=v[0],y.last_name=v[1]}if(d.billing_address){var m=(0,o.convertPayPalAddressToCart)(d.billing_address);y=w(w({},y),m)}n.billing=y}return n}},{key:"onCancel",value:function(t,e){this.orderId=(null==t?void 0:t.orderID)||null,l()(document.body).triggerHandler("wc_ppcp_on_cancel",[this,e,t]),this.controller.onCancel()}},{key:"onError",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.controller.onError(t,e)}},{key:"onDestroy",value:function(t){l()(document.body).triggerHandler("wc_ppcp_on_destroy",[this.controller,t])}}],r&&E(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),f}(m));const H=z;if((0,o.isPluginConnected)()){var K=(0,o.getSetting)("ppcp_data"),$=new H({id:"ppcp",cart:n(),settings:K,controller:null});new i.CartController({id:"ppcp",cart:n(),context:new(u())("cart"),gateway:$,settings:K}).initialize()}(this.wcPPCP=this.wcPPCP||{}).paypalCart=e})();
function wcml_reset_cart_fragments(){try{document.body.dispatchEvent(new Event("wc_fragment_refresh")),sessionStorage.removeItem("wc_fragments")}catch(err){}}function wcml_cart_clear_removed_items(){var xhr=new XMLHttpRequest,formData=new FormData;formData.append("action","wcml_cart_clear_removed_items"),formData.append("wcml_nonce",document.querySelector("#wcml_clear_removed_items_nonce").value),xhr.open("POST",woocommerce_params.ajax_url),xhr.onload=function(){200===xhr.status&&(window.location=window.location.href)},xhr.send(formData)}document.addEventListener("DOMContentLoaded",(function(){document.addEventListener("click",(function(e){e.target.matches(".wcml_removed_cart_items_clear")&&(e.preventDefault(),wcml_cart_clear_removed_items())}));var name;(!sessionStorage.getItem("woocommerce_cart_hash")&&(name="woocommerce_cart_hash",!document.cookie.match("(^|;)\\s*"+name+"\\s*=\\s*([^;]+)")?.pop())||1==actions.is_lang_switched||1==actions.force_reset)&&setTimeout(wcml_reset_cart_fragments,0)}));
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.sbjs=e()}}(function(){return function e(t,r,n){function a(s,o){if(!r[s]){if(!t[s]){var c="function"==typeof require&&require;if(!o&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var p=r[s]={exports:{}};t[s][0].call(p.exports,function(e){var r=t[s][1][e];return a(r||e)},p,p.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)a(n[s]);return a}({1:[function(e,t,r){"use strict";var n=e("./init"),a={init:function(e){this.get=n(e),e&&e.callback&&"function"==typeof e.callback&&e.callback(this.get)}};t.exports=a},{"./init":6}],2:[function(e,t,r){"use strict";var n=e("./terms"),a=e("./helpers/utils"),i={containers:{current:"sbjs_current",current_extra:"sbjs_current_add",first:"sbjs_first",first_extra:"sbjs_first_add",session:"sbjs_session",udata:"sbjs_udata",promocode:"sbjs_promo"},service:{migrations:"sbjs_migrations"},delimiter:"|||",aliases:{main:{type:"typ",source:"src",medium:"mdm",campaign:"cmp",content:"cnt",term:"trm",id:"id",platform:"plt",format:"fmt",tactic:"tct"},extra:{fire_date:"fd",entrance_point:"ep",referer:"rf"},session:{pages_seen:"pgs",current_page:"cpg"},udata:{visits:"vst",ip:"uip",agent:"uag"},promo:"code"},pack:{main:function(e){return i.aliases.main.type+"="+e.type+i.delimiter+i.aliases.main.source+"="+e.source+i.delimiter+i.aliases.main.medium+"="+e.medium+i.delimiter+i.aliases.main.campaign+"="+e.campaign+i.delimiter+i.aliases.main.content+"="+e.content+i.delimiter+i.aliases.main.term+"="+e.term+i.delimiter+i.aliases.main.id+"="+e.id+i.delimiter+i.aliases.main.platform+"="+e.platform+i.delimiter+i.aliases.main.format+"="+e.format+i.delimiter+i.aliases.main.tactic+"="+e.tactic},extra:function(e){return i.aliases.extra.fire_date+"="+a.setDate(new Date,e)+i.delimiter+i.aliases.extra.entrance_point+"="+document.location.href+i.delimiter+i.aliases.extra.referer+"="+(document.referrer||n.none)},user:function(e,t){return i.aliases.udata.visits+"="+e+i.delimiter+i.aliases.udata.ip+"="+t+i.delimiter+i.aliases.udata.agent+"="+navigator.userAgent},session:function(e){return i.aliases.session.pages_seen+"="+e+i.delimiter+i.aliases.session.current_page+"="+document.location.href},promo:function(e){return i.aliases.promo+"="+a.setLeadingZeroToInt(a.randomInt(e.min,e.max),e.max.toString().length)}}};t.exports=i},{"./helpers/utils":5,"./terms":9}],3:[function(e,t,r){"use strict";var n=e("../data").delimiter;t.exports={useBase64:!1,setBase64Flag:function(e){this.useBase64=e},encodeData:function(e){return encodeURIComponent(e).replace(/\!/g,"%21").replace(/\~/g,"%7E").replace(/\*/g,"%2A").replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29")},decodeData:function(e){try{return decodeURIComponent(e).replace(/\%21/g,"!").replace(/\%7E/g,"~").replace(/\%2A/g,"*").replace(/\%27/g,"'").replace(/\%28/g,"(").replace(/\%29/g,")")}catch(t){try{return unescape(e)}catch(r){return""}}},set:function(e,t,r,n,a){var i,s;if(r){var o=new Date;o.setTime(o.getTime()+60*r*1e3),i="; expires="+o.toGMTString()}else i="";s=n&&!a?";domain=."+n:"";var c=this.encodeData(t);this.useBase64&&(c=btoa(c).replace(/=+$/,"")),document.cookie=this.encodeData(e)+"="+c+i+s+"; path=/"},get:function(e){for(var t=this.encodeData(e)+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var a=r[n];" "===a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(t)){var i=a.substring(t.length,a.length);if(/^[A-Za-z0-9+/]+$/.test(i))try{i=atob(i.padEnd(4*Math.ceil(i.length/4),"="))}catch(s){}return this.decodeData(i)}}return null},destroy:function(e,t,r){this.set(e,"",-1,t,r)},parse:function(e){var t=[],r={};if("string"==typeof e)t.push(e);else for(var a in e)e.hasOwnProperty(a)&&t.push(e[a]);for(var i=0;i<t.length;i++){var s;r[this.unsbjs(t[i])]={},s=this.get(t[i])?this.get(t[i]).split(n):[];for(var o=0;o<s.length;o++){var c=s[o].split("="),u=c.splice(0,1);u.push(c.join("=")),r[this.unsbjs(t[i])][u[0]]=this.decodeData(u[1])}}return r},unsbjs:function(e){return e.replace("sbjs_","")}}},{"../data":2}],4:[function(e,t,r){"use strict";t.exports={parse:function(e){for(var t=this.parseOptions,r=t.parser[t.strictMode?"strict":"loose"].exec(e),n={},a=14;a--;)n[t.key[a]]=r[a]||"";return n[t.q.name]={},n[t.key[12]].replace(t.q.parser,function(e,r,a){r&&(n[t.q.name][r]=a)}),n},parseOptions:{strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},getParam:function(e){for(var t={},r=(e||window.location.search.substring(1)).split("&"),n=0;n<r.length;n++){var a=r[n].split("=");if("undefined"==typeof t[a[0]])t[a[0]]=a[1];else if("string"==typeof t[a[0]]){var i=[t[a[0]],a[1]];t[a[0]]=i}else t[a[0]].push(a[1])}return t},getHost:function(e){return this.parse(e).host.replace("www.","")}}},{}],5:[function(e,t,r){"use strict";t.exports={escapeRegexp:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},setDate:function(e,t){var r=e.getTimezoneOffset()/60,n=e.getHours(),a=t||0===t?t:-r;return e.setHours(n+r+a),e.getFullYear()+"-"+this.setLeadingZeroToInt(e.getMonth()+1,2)+"-"+this.setLeadingZeroToInt(e.getDate(),2)+" "+this.setLeadingZeroToInt(e.getHours(),2)+":"+this.setLeadingZeroToInt(e.getMinutes(),2)+":"+this.setLeadingZeroToInt(e.getSeconds(),2)},setLeadingZeroToInt:function(e,t){for(var r=e+"";r.length<t;)r="0"+r;return r},randomInt:function(e,t){return Math.floor(Math.random()*(t-e+1))+e}}},{}],6:[function(e,t,r){"use strict";var n=e("./data"),a=e("./terms"),i=e("./helpers/cookies"),s=e("./helpers/uri"),o=e("./helpers/utils"),c=e("./params"),u=e("./migrations");t.exports=function(e){var t,r,p,f,m,d,l,g,h,y,_,v,b,x=c.fetch(e),k=s.getParam(),w=x.domain.host,q=x.domain.isolate,I=x.lifetime;function j(e){switch(e){case a.traffic.utm:t=a.traffic.utm,r="undefined"!=typeof k.utm_source?k.utm_source:"undefined"!=typeof k.gclid?"google":"undefined"!=typeof k.yclid?"yandex":a.none,p="undefined"!=typeof k.utm_medium?k.utm_medium:"undefined"!=typeof k.gclid?"cpc":"undefined"!=typeof k.yclid?"cpc":a.none,f="undefined"!=typeof k.utm_campaign?k.utm_campaign:"undefined"!=typeof k[x.campaign_param]?k[x.campaign_param]:"undefined"!=typeof k.gclid?"google_cpc":"undefined"!=typeof k.yclid?"yandex_cpc":a.none,m="undefined"!=typeof k.utm_content?k.utm_content:"undefined"!=typeof k[x.content_param]?k[x.content_param]:a.none,l=k.utm_id||a.none,g=k.utm_source_platform||a.none,h=k.utm_creative_format||a.none,y=k.utm_marketing_tactic||a.none,d="undefined"!=typeof k.utm_term?k.utm_term:"undefined"!=typeof k[x.term_param]?k[x.term_param]:function(){var e=document.referrer;if(k.utm_term)return k.utm_term;if(!(e&&s.parse(e).host&&s.parse(e).host.match(/^(?:.*\.)?yandex\..{2,9}$/i)))return!1;try{return s.getParam(s.parse(document.referrer).query).text}catch(t){return!1}}()||a.none;break;case a.traffic.organic:t=a.traffic.organic,r=r||s.getHost(document.referrer),p=a.referer.organic,f=a.none,m=a.none,d=a.none,l=a.none,g=a.none,h=a.none,y=a.none;break;case a.traffic.referral:t=a.traffic.referral,r=r||s.getHost(document.referrer),p=p||a.referer.referral,f=a.none,m=s.parse(document.referrer).path,d=a.none,l=a.none,g=a.none,h=a.none,y=a.none;break;case a.traffic.typein:t=a.traffic.typein,r=x.typein_attributes.source,p=x.typein_attributes.medium,f=a.none,m=a.none,d=a.none,l=a.none,g=a.none,h=a.none,y=a.none;break;default:t=a.oops,r=a.oops,p=a.oops,f=a.oops,m=a.oops,d=a.oops,l=a.oops,g=a.oops,h=a.oops,y=a.oops}var i={type:t,source:r,medium:p,campaign:f,content:m,term:d,id:l,platform:g,format:h,tactic:y};return n.pack.main(i)}function R(e){var t=document.referrer;switch(e){case a.traffic.organic:return!!t&&H(t)&&function(e){var t=new RegExp("^(?:.*\\.)?"+o.escapeRegexp("yandex")+"\\..{2,9}$"),n=new RegExp(".*"+o.escapeRegexp("text")+"=.*"),a=new RegExp("^(?:www\\.)?"+o.escapeRegexp("google")+"\\..{2,9}$");if(s.parse(e).query&&s.parse(e).host.match(t)&&s.parse(e).query.match(n))return r="yandex",!0;if(s.parse(e).host.match(a))return r="google",!0;if(!s.parse(e).query)return!1;for(var i=0;i<x.organics.length;i++){if(s.parse(e).host.match(new RegExp("^(?:.*\\.)?"+o.escapeRegexp(x.organics[i].host)+"$","i"))&&s.parse(e).query.match(new RegExp(".*"+o.escapeRegexp(x.organics[i].param)+"=.*","i")))return r=x.organics[i].display||x.organics[i].host,!0;if(i+1===x.organics.length)return!1}}(t);case a.traffic.referral:return!!t&&H(t)&&function(e){if(!(x.referrals.length>0))return r=s.getHost(e),!0;for(var t=0;t<x.referrals.length;t++){if(s.parse(e).host.match(new RegExp("^(?:.*\\.)?"+o.escapeRegexp(x.referrals[t].host)+"$","i")))return r=x.referrals[t].display||x.referrals[t].host,p=x.referrals[t].medium||a.referer.referral,!0;if(t+1===x.referrals.length)return r=s.getHost(e),!0}}(t);default:return!1}}function H(e){if(x.domain){if(q)return s.getHost(e)!==s.getHost(w);var t=new RegExp("^(?:.*\\.)?"+o.escapeRegexp(w)+"$","i");return!s.getHost(e).match(t)}return s.getHost(e)!==s.getHost(document.location.href)}function D(){i.set(n.containers.current_extra,n.pack.extra(x.timezone_offset),I,w,q),i.get(n.containers.first_extra)||i.set(n.containers.first_extra,n.pack.extra(x.timezone_offset),I,w,q)}return i.setBase64Flag(x.base64),u.go(I,w,q),i.set(n.containers.current,function(){var e;if("undefined"!=typeof k.utm_source||"undefined"!=typeof k.utm_medium||"undefined"!=typeof k.utm_campaign||"undefined"!=typeof k.utm_content||"undefined"!=typeof k.utm_term||"undefined"!=typeof k.utm_id||"undefined"!=typeof k.utm_source_platform||"undefined"!=typeof k.utm_creative_format||"undefined"!=typeof k.utm_marketing_tactic||"undefined"!=typeof k.gclid||"undefined"!=typeof k.yclid||"undefined"!=typeof k[x.campaign_param]||"undefined"!=typeof k[x.term_param]||"undefined"!=typeof k[x.content_param])D(),e=j(a.traffic.utm);else if(R(a.traffic.organic))D(),e=j(a.traffic.organic);else if(!i.get(n.containers.session)&&R(a.traffic.referral))D(),e=j(a.traffic.referral);else{if(i.get(n.containers.first)||i.get(n.containers.current))return i.get(n.containers.current);D(),e=j(a.traffic.typein)}return e}(),I,w,q),i.get(n.containers.first)||i.set(n.containers.first,i.get(n.containers.current),I,w,q),i.get(n.containers.udata)?(_=parseInt(i.parse(n.containers.udata)[i.unsbjs(n.containers.udata)][n.aliases.udata.visits])||1,_=i.get(n.containers.session)?_:_+1,v=n.pack.user(_,x.user_ip)):(_=1,v=n.pack.user(_,x.user_ip)),i.set(n.containers.udata,v,I,w,q),i.get(n.containers.session)?(b=parseInt(i.parse(n.containers.session)[i.unsbjs(n.containers.session)][n.aliases.session.pages_seen])||1,b+=1):b=1,i.set(n.containers.session,n.pack.session(b),x.session_length,w,q),x.promocode&&!i.get(n.containers.promocode)&&i.set(n.containers.promocode,n.pack.promo(x.promocode),I,w,q),i.parse(n.containers)}},{"./data":2,"./helpers/cookies":3,"./helpers/uri":4,"./helpers/utils":5,"./migrations":7,"./params":8,"./terms":9}],7:[function(e,t,r){"use strict";var n=e("./data"),a=e("./helpers/cookies");t.exports={go:function(e,t,r){var i,s=this.migrations,o={l:e,d:t,i:r};if(a.get(n.containers.first)||a.get(n.service.migrations)){if(!a.get(n.service.migrations))for(i=0;i<s.length;i++)s[i].go(s[i].id,o)}else{var c=[];for(i=0;i<s.length;i++)c.push(s[i].id);var u="";for(i=0;i<c.length;i++)u+=c[i]+"=1",i<c.length-1&&(u+=n.delimiter);a.set(n.service.migrations,u,o.l,o.d,o.i)}},migrations:[{id:"1418474375998",version:"1.0.0-beta",go:function(e,t){var r=e+"=1",i=e+"=0",s=function(e,t,r){return t||r?e:n.delimiter};try{var o=[];for(var c in n.containers)n.containers.hasOwnProperty(c)&&o.push(n.containers[c]);for(var u=0;u<o.length;u++)if(a.get(o[u])){var p=a.get(o[u]).replace(/(\|)?\|(\|)?/g,s);a.destroy(o[u],t.d,t.i),a.destroy(o[u],t.d,!t.i),a.set(o[u],p,t.l,t.d,t.i)}a.get(n.containers.session)&&a.set(n.containers.session,n.pack.session(0),t.l,t.d,t.i),a.set(n.service.migrations,r,t.l,t.d,t.i)}catch(f){a.set(n.service.migrations,i,t.l,t.d,t.i)}}}]}},{"./data":2,"./helpers/cookies":3}],8:[function(e,t,r){"use strict";var n=e("./terms"),a=e("./helpers/uri");t.exports={fetch:function(e){var t=e||{},r={};if(r.lifetime=this.validate.checkFloat(t.lifetime)||6,r.lifetime=parseInt(30*r.lifetime*24*60),r.session_length=this.validate.checkInt(t.session_length)||30,r.timezone_offset=this.validate.checkInt(t.timezone_offset),r.base64=t.base64||!1,r.campaign_param=t.campaign_param||!1,r.term_param=t.term_param||!1,r.content_param=t.content_param||!1,r.user_ip=t.user_ip||n.none,t.promocode?(r.promocode={},r.promocode.min=parseInt(t.promocode.min)||1e5,r.promocode.max=parseInt(t.promocode.max)||999999):r.promocode=!1,t.typein_attributes&&t.typein_attributes.source&&t.typein_attributes.medium?(r.typein_attributes={},r.typein_attributes.source=t.typein_attributes.source,r.typein_attributes.medium=t.typein_attributes.medium):r.typein_attributes={source:"(direct)",medium:"(none)"},t.domain&&this.validate.isString(t.domain)?r.domain={host:t.domain,isolate:!1}:t.domain&&t.domain.host?r.domain=t.domain:r.domain={host:a.getHost(document.location.hostname),isolate:!1},r.referrals=[],t.referrals&&t.referrals.length>0)for(var i=0;i<t.referrals.length;i++)t.referrals[i].host&&r.referrals.push(t.referrals[i]);if(r.organics=[],t.organics&&t.organics.length>0)for(var s=0;s<t.organics.length;s++)t.organics[s].host&&t.organics[s].param&&r.organics.push(t.organics[s]);return r.organics.push({host:"bing.com",param:"q",display:"bing"}),r.organics.push({host:"yahoo.com",param:"p",display:"yahoo"}),r.organics.push({host:"about.com",param:"q",display:"about"}),r.organics.push({host:"aol.com",param:"q",display:"aol"}),r.organics.push({host:"ask.com",param:"q",display:"ask"}),r.organics.push({host:"globososo.com",param:"q",display:"globo"}),r.organics.push({host:"go.mail.ru",param:"q",display:"go.mail.ru"}),r.organics.push({host:"rambler.ru",param:"query",display:"rambler"}),r.organics.push({host:"tut.by",param:"query",display:"tut.by"}),r.referrals.push({host:"t.co",display:"twitter.com"}),r.referrals.push({host:"plus.url.google.com",display:"plus.google.com"}),r},validate:{checkFloat:function(e){return!(!e||!this.isNumeric(parseFloat(e)))&&parseFloat(e)},checkInt:function(e){return!(!e||!this.isNumeric(parseInt(e)))&&parseInt(e)},isNumeric:function(e){return!isNaN(e)},isString:function(e){return"[object String]"===Object.prototype.toString.call(e)}}}},{"./helpers/uri":4,"./terms":9}],9:[function(e,t,r){"use strict";t.exports={traffic:{utm:"utm",organic:"organic",referral:"referral",typein:"typein"},referer:{referral:"referral",organic:"organic",social:"social"},none:"(none)",oops:"(Houston, we have a problem)"}},{}]},{},[1])(1)});
!function(t){"use strict";const e=t.params,n=(document.querySelector.bind(document),(t,e)=>e.split(".").reduce((t,e)=>t&&t[e],t)),i=()=>null,s=t=>null===t||t===undefined?"":t,o="wc/store/checkout";function a(t){document.querySelectorAll("wc-order-attribution-inputs").forEach((t,e)=>{e>0&&t.remove()});for(const e of document.querySelectorAll("wc-order-attribution-inputs"))e.values=t}function r(t){window.wp&&window.wp.data&&window.wp.data.dispatch&&window.wc&&window.wc.wcBlocksData&&window.wp.data.dispatch(window.wc.wcBlocksData.CHECKOUT_STORE_KEY).setExtensionData("woocommerce/order-attribution",t,!0)}function c(){return"undefined"!=typeof sbjs}function d(){if(window.wp&&window.wp.data&&"function"==typeof window.wp.data.subscribe){const e=window.wp.data.subscribe(function(){e(),r(t.getAttributionData())},o)}}t.getAttributionData=function(){const s=e.allowTracking&&c()?n:i,o=c()?sbjs.get:{},a=Object.entries(t.fields).map(([t,e])=>[t,s(o,e)]);return Object.fromEntries(a)},t.setOrderTracking=function(n){if(e.allowTracking=n,n){if(!c())return;sbjs.init({lifetime:Number(e.lifetime),session_length:Number(e.session),base64:Boolean(e.base64),timezone_offset:"0"})}else!function(){const t=window.location.hostname;["sbjs_current","sbjs_current_add","sbjs_first","sbjs_first_add","sbjs_session","sbjs_udata","sbjs_migrations","sbjs_promo"].forEach(e=>{document.cookie=`${e}=; path=/; max-age=-999; domain=.${t};`})}();const i=t.getAttributionData();a(i),r(i)},t.setOrderTracking(e.allowTracking),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",d):d(),window.customElements.define("wc-order-attribution-inputs",class extends HTMLElement{constructor(){if(super(),this._fieldNames=Object.keys(t.fields),this.hasOwnProperty("_values")){let t=this.values;delete this.values,this.values=t||{}}}connectedCallback(){this.innerHTML="";const t=new DocumentFragment;for(const n of this._fieldNames){const i=document.createElement("input");i.type="hidden",i.name=`${e.prefix}${n}`,i.value=s(this.values&&this.values[n]||""),t.appendChild(i)}this.appendChild(t)}set values(t){if(this._values=t,this.isConnected)for(const t of this._fieldNames){const n=this.querySelector(`input[name="${e.prefix}${t}"]`);n?n.value=s(this.values[t]):console.warn(`Field "${t}" not found. `+"Most likely, the '<wc-order-attribution-inputs>' element was manipulated.")}}get values(){return this._values}})}(window.wc_order_attribution);