Ubuntu

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ (()=>{"use strict";var t={4744:t=>{var e=function(t){return function(t){return!!t&&"object"==typeof t}(t)&&!function(t){var e=Object.prototype.toString.call(t);return"[object RegExp]"===e||"[object Date]"===e||function(t){return t.$$typeof===n}(t)}(t)},n="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(t,e){return!1!==e.clone&&e.isMergeableObject(t)?u((n=t,Array.isArray(n)?[]:{}),t,e):t;var n}function o(t,e,n){return t.concat(e).map(function(t){return r(t,n)})}function i(t){return Object.keys(t).concat(function(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]}(t))}function a(t,e){try{return e in t}catch(t){return!1}}function u(t,n,c){(c=c||{}).arrayMerge=c.arrayMerge||o,c.isMergeableObject=c.isMergeableObject||e,c.cloneUnlessOtherwiseSpecified=r;var l=Array.isArray(n);return l===Array.isArray(t)?l?c.arrayMerge(t,n,c):function(t,e,n){var o={};return n.isMergeableObject(t)&&i(t).forEach(function(e){o[e]=r(t[e],n)}),i(e).forEach(function(i){(function(t,e){return a(t,e)&&!(Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))})(t,i)||(a(t,i)&&n.isMergeableObject(e[i])?o[i]=function(t,e){if(!e.customMerge)return u;var n=e.customMerge(t);return"function"==typeof n?n:u}(i,n)(t[i],e[i],n):o[i]=r(e[i],n))}),o}(t,n,c):r(n,c)}u.all=function(t,e){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(t,n){return u(t,n,e)},{})};var c=u;t.exports=c}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,n),i.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);const r=window.wp.element;function o(t,e){void 0===e&&(e={});var n=document.createElement("script");return n.src=t,Object.keys(e).forEach(function(t){n.setAttribute(t,e[t]),"data-csp-nonce"===t&&n.setAttribute("nonce",e["data-csp-nonce"])}),n}function i(t,e){if(void 0===e&&(e=Promise),c(t,e),"undefined"==typeof document)return e.resolve(null);var n=function(t){var e,n,r=t.sdkBaseUrl,o=t.environment,i=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o3&&void 0!==arguments[3]?arguments[3]:null;fetch(e.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:e.nonce})}).then(function(t){return t.json()}).then(function(o){var a;(function(t,e){return!(!t||t.user!==e||(new Date).getTime()>=1e3*t.expiration)})(o,e.user)&&(a=o,sessionStorage.setItem("ppcp-data-client-id",JSON.stringify(a)),t["data-client-token"]=o.token,i(t).then(function(t){"function"==typeof n&&n(t)}).catch(function(t){"function"==typeof r&&r(t)}))})};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 y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||h(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=h(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function h(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n')),n.append(o)),e=o.get(0)}return jQuery(e).length?e:null}},{key:"toKey",value:function(t){return Array.isArray(t)?JSON.stringify(t):t}}])&&b(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.widgetBuilder=window.widgetBuilder||new g;const w=window.widgetBuilder;var S=n(4744),j=n.n(S),O=function(t){return t.replace(/([-_]\w)/g,function(t){return t[1].toUpperCase()})},P=function(t){var e=function(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[O(n)]=t[n]);return e}(t.url_params);t.script_attributes&&(e=j()(e,t.script_attributes));var n=function(t){var e,n,r=null==t||null===(e=t.save_payment_methods)||void 0===e?void 0:e.id_token;return r&&!0===(null==t||null===(n=t.user)||void 0===n?void 0:n.is_logged)?{"data-user-id-token":r}:{}}(t);return j().all([e,n])};function _(t){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(t)}function k(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function E(t){for(var e=1;e3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(A(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,A(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,A(f,"constructor",l),A(l,"constructor",c),c.displayName="GeneratorFunction",A(l,o,"GeneratorFunction"),A(f),A(f,o,"Generator"),A(f,r,function(){return this}),A(f,"toString",function(){return"[object Generator]"}),(T=function(){return{w:i,m:p}})()}function A(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}A=function(t,e,n,r){function i(e,n){A(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},A(t,e,n,r)}function x(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function I(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){x(i,r,o,a,u,"next",t)}function u(t){x(i,r,o,a,u,"throw",t)}a(void 0)})}}var M=new Map,R=new Map,D=function(){var t=I(T().m(function t(e,n){var r;return T().w(function(t){for(;;)switch(t.n){case 0:if(null===(r=n.data_client_id)||void 0===r||!r.set_attribute||!0===n.vault_v3_enabled){t.n=1;break}return t.a(2,new Promise(function(t,r){f(e,n.data_client_id,function(e){w.setPaypal(e),t(e)},r)}));case 1:return t.a(2,null)}},t)}));return function(_x,e){return t.apply(this,arguments)}}(),B=function(){var t=I(T().m(function t(e,n){var r,o,a;return T().w(function(t){for(;;)switch(t.n){case 0:if(e){t.n=1;break}throw new Error("Namespace is required");case 1:if(!M.has(e)){t.n=2;break}return console.log("Script already loaded for namespace: ".concat(e)),t.a(2,M.get(e));case 2:if(!R.has(e)){t.n=3;break}return console.log("Script loading in progress for namespace: ".concat(e)),t.a(2,R.get(e));case 3:return r=E(E({},P(n)),{},{"data-namespace":e}),t.n=4,D(r,n);case 4:if(!(o=t.v)){t.n=5;break}return t.a(2,o);case 5:return a=new Promise(function(t,n){i(r).then(function(n){w.setPaypal(n),M.set(e,n),console.log("Script loaded for namespace: ".concat(e)),t(n)}).catch(function(t){console.error("Failed to load script for namespace: ".concat(e),t),n(t)}).finally(function(){R.delete(e)})}),R.set(e,a),t.a(2,a)}},t)}));return function(e,n){return t.apply(this,arguments)}}();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 F(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(this.contextBootstrapWatchers);try{for(r.s();!(n=r.n()).done;)(0,n.value)(this.contextBootstrapRegistry[t])}catch(t){r.e(t)}finally{r.f()}}}])&&H(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();window.ppcpResources=window.ppcpResources||{};const W=window.ppcpResources.ButtonModuleWatcher=window.ppcpResources.ButtonModuleWatcher||new N;function L(t){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L(t)}function U(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 Q(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:null;et(it,this)&&(t&&!et(at,this)||(console.groupEnd(),nt(at,this,null)),t&&(console.group(t),nt(at,this,t)))}}],e&&X(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function ct(t){return ct="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ct(t)}function lt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return st(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?st(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function st(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=500?r.addClass("ppcp-width-500"):o>=300?r.addClass("ppcp-width-300"):r.addClass("ppcp-width-min");var i=r.children(":visible").first();r.find(e.selectorInContainer).each(function(t,e){var n=jQuery(e);if(n.is(i))return n.css("margin-top","0px"),!0;var r=n.height(),o=Math.max(11,Math.round(.3*r));n.css("margin-top","".concat(o,"px"))})};for(n.s();!(t=n.n()).done;)r()}catch(t){n.e(t)}finally{n.f()}}}])&&ft(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}(),dt="ppcp-gateway",ht={Cart:"cart",Checkout:"checkout",BlockCart:"cart-block",BlockCheckout:"checkout-block",Product:"product",MiniCart:"mini-cart",PayNow:"pay-now",Preview:"preview",Blocks:["cart-block","checkout-block"],Gateways:["checkout","pay-now"]},vt=function(){var t=document.querySelector('input[name="payment_method"]:checked');return t?t.value:null},bt=function(t){return"string"==typeof t?document.querySelector(t):t};function mt(t){return mt="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},mt(t)}function gt(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return wt(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function wt(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Ot(this,r=zt),r.add(this),jt(this,Tt,void 0),jt(this,At,!1),jt(this,xt,!1),jt(this,It,void 0),jt(this,Mt,void 0),jt(this,Rt,void 0),jt(this,Dt,[]),jt(this,Bt,void 0),jt(this,Gt,void 0),jt(this,Ft,void 0),jt(this,Ht,void 0),jt(this,qt,void 0),jt(this,Nt,null),jt(this,Wt,!0),jt(this,Lt,!0),jt(this,Ut,null),jt(this,Qt,[]),this.methodId===t.methodId)throw new Error("Cannot initialize the PaymentButton base class");i||(i={});var s=!(null===(n=i)||void 0===n||!n.is_debug),f=this.methodId.replace(/^ppcp?-/,"");Et(It,this,e),Et(Bt,this,i),Et(Gt,this,a),Et(Ft,this,o),Et(Ht,this,u),Et(qt,this,c),this.onClick=l,Et(Tt,this,new ut(f,e)),s&&(kt(Tt,this).enabled=!0,function(t,e){window.ppcpPaymentButtonList=window.ppcpPaymentButtonList||{};var n=window.ppcpPaymentButtonList;n[t]=n[t]||[],n[t].push(e)}(f,this)),Et(Mt,this,this.constructor.getWrappers(kt(Bt,this),kt(Gt,this))),this.applyButtonStyles(kt(Bt,this)),this.registerValidationRules(Ct(zt,this,Jt).bind(this),Ct(zt,this,$t).bind(this)),function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".ppcp-button-apm",n=e;if(!window.ppcpApmButtons){if(t&&t.button){var r=t.button.wrapper;jQuery(r).children('div[class^="item-"]').length>0&&(e+=", ".concat(r,' div[class^="item-"]'),n+=', div[class^="item-"]')}window.ppcpApmButtons=new yt(e,n)}}(kt(Gt,this)),this.initEventListeners()},e=[{key:"methodId",get:function(){return this.constructor.methodId}},{key:"cssClass",get:function(){return this.constructor.cssClass}},{key:"isInitialized",get:function(){return kt(At,this)}},{key:"context",get:function(){return kt(It,this)}},{key:"buttonConfig",get:function(){return kt(Bt,this)}},{key:"ppcpConfig",get:function(){return kt(Gt,this)}},{key:"externalHandler",get:function(){return kt(Ft,this)||{}}},{key:"contextHandler",get:function(){return kt(Ht,this)||{}}},{key:"requiresShipping",get:function(){return"function"==typeof this.contextHandler.shippingAllowed&&this.contextHandler.shippingAllowed()}},{key:"wrappers",get:function(){return kt(Mt,this)}},{key:"style",get:function(){return ht.MiniCart===this.context?kt(Rt,this).MiniCart:kt(Rt,this).Default}},{key:"wrapperId",get:function(){return ht.MiniCart===this.context?this.wrappers.MiniCart:this.isSeparateGateway?this.wrappers.Gateway:ht.Blocks.includes(this.context)?this.wrappers.Block:this.wrappers.Default}},{key:"isInsideClassicGateway",get:function(){return ht.Gateways.includes(this.context)}},{key:"isSeparateGateway",get:function(){return kt(Bt,this).is_wc_gateway_enabled&&this.isInsideClassicGateway}},{key:"isCurrentGateway",get:function(){if(!this.isInsideClassicGateway)return!0;var t=vt();return this.isSeparateGateway?this.methodId===t:dt===t}},{key:"isPreview",get:function(){return ht.Preview===this.context}},{key:"isEligible",get:function(){return kt(Nt,this)},set:function(t){t!==kt(Nt,this)&&(Et(Nt,this,t),this.triggerRedraw())}},{key:"isVisible",get:function(){return kt(Wt,this)},set:function(t){kt(Wt,this)!==t&&(Et(Wt,this,t),this.triggerRedraw())}},{key:"isEnabled",get:function(){return kt(Lt,this)},set:function(t){kt(Lt,this)!==t&&(Et(Lt,this,t),this.triggerRedraw())}},{key:"wrapperElement",get:function(){return document.getElementById(this.wrapperId)}},{key:"ppcpButtonWrapperSelector",get:function(){var t,e;return ht.Blocks.includes(this.context)?null:this.context===ht.MiniCart?null===(e=this.ppcpConfig)||void 0===e||null===(e=e.button)||void 0===e?void 0:e.mini_cart_wrapper:null===(t=this.ppcpConfig)||void 0===t||null===(t=t.button)||void 0===t?void 0:t.wrapper}},{key:"isPresent",get:function(){return this.wrapperElement instanceof HTMLElement}},{key:"isButtonAttached",get:function(){if(!kt(Ut,this))return!1;for(var t=kt(Ut,this).parentElement;null!==(e=t)&&void 0!==e&&e.parentElement;){var e;if("BODY"===t.tagName)return!0;t=t.parentElement}return!1}},{key:"log",value:function(){var t;(t=kt(Tt,this)).log.apply(t,arguments)}},{key:"error",value:function(){var t;(t=kt(Tt,this)).error.apply(t,arguments)}},{key:"logGroup",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;kt(Tt,this).group(t)}},{key:"registerValidationRules",value:function(t,e){}},{key:"validateConfiguration",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=gt(kt(Qt,this));try{for(n.s();!(t=n.n()).done;){var r=t.value,o=r.check();if(r.shouldPass&&o)return!0;if(!r.shouldPass&&o)return!e&&r.errorMessage&&this.error(r.errorMessage),!1}}catch(t){n.e(t)}finally{n.f()}return!0}},{key:"applyButtonStyles",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e||(e=this.ppcpConfig),Et(Rt,this,this.constructor.getStyles(t,e)),this.isInitialized&&this.triggerRedraw()}},{key:"configure",value:function(){}},{key:"init",value:function(){Et(At,this,!0)}},{key:"reinit",value:function(){Et(At,this,!1),Et(Nt,this,!1)}},{key:"triggerRedraw",value:function(){this.showPaymentGateway(),function(t){var e=t.event,n=t.paymentMethod,r=void 0===n?"":n;if(!$(e))throw new Error("Invalid event: ".concat(e));var o=r?"".concat(e,"-").concat(r):e;document.body.dispatchEvent(new Event(o))}({event:V.REDRAW,paymentMethod:this.methodId})}},{key:"syncProductButtonsState",value:function(){var t,e=document.querySelector(this.ppcpButtonWrapperSelector);e&&(this.isVisible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}(e),this.isEnabled=!((t=bt(e))&&jQuery(t).hasClass("ppcp-disabled")))}},{key:"initEventListeners",value:function(){var t=this;if(Y({event:V.REDRAW,paymentMethod:this.methodId,callback:function(){return t.refresh()}}),this.isInsideClassicGateway){var e=this.isSeparateGateway?this.methodId:dt;Y({event:V.INVALIDATE,callback:function(){return t.isVisible=!1}}),Y({event:V.RENDER,paymentMethod:e,callback:function(){return t.isVisible=!0}})}this.context===ht.Product&&(jQuery(document).on("ppcp-shown ppcp-hidden ppcp-enabled ppcp-disabled",function(e,n){jQuery(n.selector).is(t.ppcpButtonWrapperSelector)&&t.syncProductButtonsState()}),this.syncProductButtonsState())}},{key:"refresh",value:function(){this.isPresent&&(this.isEligible?(this.applyWrapperStyles(),this.isEligible&&this.isCurrentGateway&&this.isVisible&&(this.isButtonAttached||(this.log("refresh.addButton"),this.addButton()))):this.wrapperElement.style.display="none")}},{key:"showPaymentGateway",value:function(){if(!kt(xt,this)&&this.isSeparateGateway&&this.isEligible){var t='style[data-hide-gateway="'.concat(this.methodId,'"]'),e="#".concat(this.wrappers.Default),n=document.querySelector(".wc_payment_method.payment_method_".concat(this.methodId));document.querySelectorAll(t).forEach(function(t){return t.remove()}),"none"!==n.style.display&&""!==n.style.display||(n.style.display="block"),document.querySelectorAll(e).forEach(function(t){return t.remove()}),this.log("Show gateway"),Et(xt,this,!0),this.isVisible=this.isCurrentGateway}}},{key:"applyWrapperStyles",value:function(){var t,e,n=this.wrapperElement;if(n){var r,o=this.style,i=o.shape,a=o.height,u=gt(kt(Dt,this));try{for(u.s();!(r=u.n()).done;){var c=r.value;n.classList.remove(c)}}catch(t){u.e(t)}finally{u.f()}Et(Dt,this,[]);var l=["ppcp-button-".concat(i),"ppcp-button-apm",this.cssClass];(t=n.classList).add.apply(t,l),(e=kt(Dt,this)).push.apply(e,l),a&&(n.style.height="".concat(a,"px")),n.style.display=this.isVisible?"block":"none";var s=this.context===ht.Product?"form.cart":null;!function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=bt(t);r&&(e?(jQuery(r).removeClass("ppcp-disabled").off("mouseup").find("> *").css("pointer-events",""),function(t,e){jQuery(document).trigger("ppcp-enabled",{handler:"ButtonsDisabler.setEnabled",action:"enable",selector:t,element:e})}(t,r)):(jQuery(r).addClass("ppcp-disabled").on("mouseup",function(t){if(t.stopImmediatePropagation(),n){var e=jQuery(n);e.find(".single_add_to_cart_button").hasClass("disabled")&&e.find(":submit").trigger("click")}}).find("> *").css("pointer-events","none"),function(t,e){jQuery(document).trigger("ppcp-disabled",{handler:"ButtonsDisabler.setEnabled",action:"disable",selector:t,element:e})}(t,r)))}(n,this.isEnabled,s)}}},{key:"addButton",value:function(){throw new Error("Must be implemented by the child class")}},{key:"insertButton",value:function(t){if(this.isPresent){var e=this.wrapperElement;kt(Ut,this)&&this.removeButton(),this.log("insertButton",t),Et(Ut,this,t),e.appendChild(kt(Ut,this))}}},{key:"removeButton",value:function(){if(this.isPresent&&kt(Ut,this)){this.log("removeButton");try{this.wrapperElement.removeChild(kt(Ut,this))}catch(t){}Et(Ut,this,null)}}}],n=[{key:"createButton",value:function(t,e,n,r,o,i){var a,u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,c=(a="__ppcpPBInstances",document.body[a]||Object.defineProperty(document.body,a,{value:new Map,enumerable:!1,writable:!1,configurable:!1}),document.body[a]),l="".concat(this.methodId,".").concat(t);if(!c.has(l)){var s=new this(t,e,n,r,o,i,u);c.set(l,s)}return c.get(l)}},{key:"getWrappers",value:function(t,e){throw new Error("Must be implemented in the child class")}},{key:"getStyles",value:function(t,e){throw new Error("Must be implemented in the child class")}}],e&&St(t.prototype,e),n&&St(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();function Jt(t,e){kt(Qt,this).push({check:t,errorMessage:e,shouldPass:!1})}function $t(t){kt(Qt,this).push({check:t,shouldPass:!0})}function Yt(t){return Yt="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},Yt(t)}function Kt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n1&&void 0!==arguments[1]&&arguments[1];(e=t)&&"object"===ee(e)&&(window._PpcpPayerSessionDetails=ie(e)),r&&(n=t,Object.entries(oe).forEach(function(t){var e=ne(t,2),r=e[0],o=e[1],i=function(t,e){return e.reduce(function(t,e){return null==t?void 0:t[e]},t)}(n,o);!function(t,e,n){var r;null!=n&&e&&("phone"===t[0]&&"object"===ee(n)&&(n=null===(r=n.phone_number)||void 0===r?void 0:r.national_number),e.value=n)}(o,document.querySelector(r),i)}))}function ce(t){return ce="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},ce(t)}function le(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:0;if(!this.canUseLocalStorage)throw new Error("Local storage is not available");var r=function(t,e){var n={data:t,expires:me(e)};return JSON.stringify(n)}(e,n),o=he(Se,this,Pe).call(this,t);localStorage.setItem(o,r)}},{key:"get",value:function(t){if(!this.canUseLocalStorage)throw new Error("Local storage is not available");var e=he(Se,this,Pe).call(this,t),n=be(localStorage.getItem(e));return n?n.data:null}},{key:"clear",value:function(t){if(!this.canUseLocalStorage)throw new Error("Local storage is not available");var e=he(Se,this,Pe).call(this,t);localStorage.removeItem(e)}}],e&&le(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Oe(){var t=this;this.canUseLocalStorage&&Object.keys(localStorage).forEach(function(e){if(e.startsWith(ye(ge,t))){var n=be(localStorage.getItem(e));n&&n.expires>0&&n.expires3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Be(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Be(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Be(f,"constructor",l),Be(l,"constructor",c),c.displayName="GeneratorFunction",Be(l,o,"GeneratorFunction"),Be(f),Be(f,o,"Generator"),Be(f,r,function(){return this}),Be(f,"toString",function(){return"[object Generator]"}),(De=function(){return{w:i,m:p}})()}function Be(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Be=function(t,e,n,r){function i(e,n){Be(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Be(t,e,n,r)}function Ge(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Fe(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){Ge(i,r,o,a,u,"next",t)}function u(t){Ge(i,r,o,a,u,"throw",t)}a(void 0)})}}function He(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 qe(t){for(var e=1;e6&&void 0!==arguments[6]?arguments[6]:null;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Ve(u=function(t,e,n){return e=Qe(e),function(t,e){if(e&&("object"==Re(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,We()?Reflect.construct(e,n||[],Qe(t).constructor):e.apply(t,n))}(this,e,[t,n,r,o,i,a,c]),on,null),Ve(u,an,null),Ve(u,un,null),Je(u,"googlePayConfig",null),Ve(u,cn,0),Ve(u,ln,1e3),Ve(u,sn,null),u.init=u.init.bind(u),u.onPaymentDataChanged=u.onPaymentDataChanged.bind(u),u.onButtonClick=u.onButtonClick.bind(u),u.onClick=c,u.log("Create instance"),u}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ze(t,e)}(e,t),n=e,r=[{key:"requiresShipping",get:function(){var t;return Le(e,"requiresShipping",this,1)&&(null===(t=this.buttonConfig.shipping)||void 0===t?void 0:t.enabled)}},{key:"googlePayApi",get:function(){var t;return null===(t=window.google)||void 0===t||null===(t=t.payments)||void 0===t?void 0:t.api}},{key:"paymentsClient",get:function(){return Ke(on,this)}},{key:"transactionInfo",get:function(){return Ke(an,this)},set:function(t){Ye(an,this,t),this.refresh()}},{key:"registerValidationRules",value:function(t,e){var n=this;return t(function(){return!["TEST","PRODUCTION"].includes(n.buttonConfig.environment)},"Invalid environment: ".concat(this.buttonConfig.environment)),e(function(){return n.isPreview}),t(function(){return!n.googlePayConfig},"No API configuration - missing configure() call?"),t(function(){return!n.transactionInfo},"No transactionInfo - missing configure() call?"),t(function(){var t;return!(null!==(t=n.contextHandler)&&void 0!==t&&t.validateContext())},"Invalid context handler."),t(function(){var t;return(null===(t=n.buttonAttributes)||void 0===t?void 0:t.height)&&isNaN(parseInt(n.buttonAttributes.height))},"Invalid height in buttonAttributes"),t(function(){var t;return(null===(t=n.buttonAttributes)||void 0===t?void 0:t.borderRadius)&&isNaN(parseInt(n.buttonAttributes.borderRadius))},"Invalid borderRadius in buttonAttributes"),!0}},{key:"configure",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ke(cn,this)||Ye(cn,this,Date.now()),null!=r&&r.height&&null!=r&&r.borderRadius&&Ye(sn,this,qe({},r));var o=null!=r&&r.height?r:Ke(sn,this);if(Date.now()-Ke(cn,this)>Ke(ln,this))return this.log("GooglePay: Timeout waiting for buttonAttributes - proceeding with initialization"),this.googlePayConfig=t,Ye(an,this,e),this.buttonAttributes=o||r,this.allowedPaymentMethods=this.googlePayConfig.allowedPaymentMethods,this.baseCardPaymentMethod=this.allowedPaymentMethods[0],void this.init();null!=o&&o.height&&null!=o&&o.borderRadius?(Ye(cn,this,0),this.googlePayConfig=t,Ye(an,this,e),this.buttonAttributes=o,this.allowedPaymentMethods=this.googlePayConfig.allowedPaymentMethods,this.baseCardPaymentMethod=this.allowedPaymentMethods[0],this.init()):setTimeout(function(){return n.configure(t,e,r)},100)}},{key:"init",value:function(){var t=this;this.isInitialized||this.validateConfiguration()&&(Le(e,"init",this,3)([]),Ye(on,this,this.createPaymentsClient()),this.paymentsClient.isReadyToPay(this.buildReadyToPayRequest(this.allowedPaymentMethods,this.googlePayConfig)).then(function(e){t.log("PaymentsClient.isReadyToPay response:",e),t.isEligible=!!e.result}).catch(function(e){t.error(e),t.isEligible=!1}))}},{key:"reinit",value:function(){this.validateConfiguration(!0)&&(Le(e,"reinit",this,3)([]),this.init())}},{key:"preparePaymentDataCallbacks",value:function(){var t={};return this.isPreview||this.requiresShipping&&(t.onPaymentDataChanged=this.onPaymentDataChanged),t}},{key:"createPaymentsClient",value:function(){if(!this.googlePayApi)return null;var t=this.preparePaymentDataCallbacks();return new this.googlePayApi.PaymentsClient({environment:this.buttonConfig.environment,paymentDataCallbacks:t})}},{key:"buildReadyToPayRequest",value:function(t,e){return this.log("Ready To Pay request",e,t),Object.assign({},e,{allowedPaymentMethods:t})}},{key:"addButton",value:function(){var t,n,r;if(this.paymentsClient){null!==(t=this.buttonAttributes)&&void 0!==t&&t.height||null===(n=Ke(sn,this))||void 0===n||!n.height||(this.buttonAttributes=qe({},Ke(sn,this))),this.removeButton();var o=this.baseCardPaymentMethod,i=this.style,a=i.color,u=i.type,c={buttonColor:a||"black",buttonSizeMode:"fill",buttonLocale:i.language||"en",buttonType:u||"pay",buttonRadius:parseInt(null===(r=this.buttonAttributes)||void 0===r?void 0:r.borderRadius,10),onClick:this.onButtonClick,allowedPaymentMethods:[o]},l=this.paymentsClient.createButton(c);Ye(un,this,l),Le(e,"insertButton",this,3)([l]),this.applyWrapperStyles()}}},{key:"applyWrapperStyles",value:function(){var t;Le(e,"applyWrapperStyles",this,3)([]);var n=this.wrapperElement;if(n){var r=null!==(t=this.buttonAttributes)&&void 0!==t&&t.height?this.buttonAttributes:Ke(sn,this);if(null!=r&&r.height){var o=parseInt(r.height,10);isNaN(o)||(n.style.height="".concat(o,"px"),n.style.minHeight="".concat(o,"px"))}}}},{key:"removeButton",value:function(){if(this.isPresent&&Ke(un,this)){this.log("removeButton");try{this.wrapperElement.removeChild(Ke(un,this))}catch(t){}Ye(un,this,null)}}},{key:"onButtonClick",value:(a=Fe(De().m(function t(){var e,n,r,o,i=this;return De().w(function(t){for(;;)switch(t.n){case 0:return this.logGroup("onButtonClick"),e=function(){var t=Fe(De().m(function t(){var e,n;return De().w(function(t){for(;;)if(0===t.n)return window.ppcpFundingSource="googlepay",null===(e=i.onClick)||void 0===e||e.call(i),n=i.paymentDataRequest(),i.log("onButtonClick: paymentDataRequest",n,i.context),t.a(2,i.paymentsClient.loadPaymentData(n).then(function(t){return i.log("loadPaymentData response:",t),t}).catch(function(t){throw i.error("loadPaymentData failed:",t),t}))},t)}));return function(){return t.apply(this,arguments)}}(),n=function(){var t=Fe(De().m(function t(){return De().w(function(t){for(;;)switch(t.n){case 0:if("function"==typeof i.contextHandler.validateForm){t.n=1;break}return t.a(2,Promise.resolve());case 1:return t.a(2,i.contextHandler.validateForm().catch(function(t){throw i.error("Form validation failed:",t),t}))}},t)}));return function(){return t.apply(this,arguments)}}(),r=function(){var t=Fe(De().m(function t(){return De().w(function(t){for(;;)switch(t.n){case 0:if("function"==typeof i.contextHandler.transactionInfo){t.n=1;break}return t.a(2,Promise.resolve());case 1:return t.a(2,i.contextHandler.transactionInfo().then(function(t){i.transactionInfo=t}).catch(function(t){throw i.error("Failed to get transaction info:",t),t}))}},t)}));return function(){return t.apply(this,arguments)}}(),t.n=1,n().then(r).then(e);case 1:if(o=t.v,this.logGroup(),o){t.n=2;break}return t.a(2);case 2:return t.a(2,this.processPayment(o))}},t,this)})),function(){return a.apply(this,arguments)})},{key:"paymentDataRequest",value:function(){var t=this.requiresShipping,e=[];return t&&e.push("SHIPPING_ADDRESS","SHIPPING_OPTION"),qe(qe({},{apiVersion:2,apiVersionMinor:0}),{},{allowedPaymentMethods:this.googlePayConfig.allowedPaymentMethods,transactionInfo:this.transactionInfo.finalObject,merchantInfo:this.googlePayConfig.merchantInfo,callbackIntents:e,emailRequired:!0,shippingAddressRequired:t,shippingOptionRequired:t,shippingAddressParameters:this.shippingAddressParameters()})}},{key:"shippingAddressParameters",value:function(){return{allowedCountryCodes:this.buttonConfig.shipping.countries,phoneNumberRequired:!0}}},{key:"onPaymentDataChanged",value:function(t){var e=this;return this.log("onPaymentDataChanged",t),new Promise(function(){var n=Fe(De().m(function n(r,o){var i,a,u,c,l,s,f,p;return De().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,a={},n.n=1,new te(e.buttonConfig.ajax.update_payment_data).update(t);case 1:if(u=n.v,c=e.transactionInfo,l=["checkout-block","checkout","cart-block","cart","mini-cart","pay-now"].includes(e.context),e.log("onPaymentDataChanged:updatedData",u),e.log("onPaymentDataChanged:transactionInfo",c),u.country_code=c.countryCode,u.currency_code=c.currencyCode,null!==(i=u.shipping_options)&&void 0!==i&&null!==(i=i.shippingOptions)&&void 0!==i&&i.length){n.n=2;break}return a.error=e.unserviceableShippingAddressError(),r(a),n.a(2);case 2:["INITIALIZE","SHIPPING_ADDRESS"].includes(t.callbackTrigger)&&(a.newShippingOptionParameters=e.sanitizeShippingOptions(u.shipping_options)),u.total&&l?(c.setTotal(u.total,u.shipping_fee),e.syncShippingOptionWithForm(null==t||null===(s=t.shippingOptionData)||void 0===s?void 0:s.id)):c.shippingFee=e.getShippingCosts(null==t||null===(f=t.shippingOptionData)||void 0===f?void 0:f.id,u.shipping_options),a.newTransactionInfo=e.calculateNewTransactionInfo(c),r(a),n.n=4;break;case 3:n.p=3,p=n.v,e.error("Error during onPaymentDataChanged:",p),o(p);case 4:return n.a(2)}},n,null,[[0,3]])}));return function(_x,t){return n.apply(this,arguments)}}())}},{key:"sanitizeShippingOptions",value:function(t){var e=t.shippingOptions.map(function(t){return{id:t.id,label:t.label,description:t.description}}),n=t.defaultSelectedOptionId;return e.some(function(t){return t.id===n})||(n=e[0].id),{defaultSelectedOptionId:n,shippingOptions:e}}},{key:"getShippingCosts",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.shippingOptions,r=void 0===n?[]:n,o=e.defaultSelectedOptionId,i=void 0===o?"":o;if(null==r||!r.length)return this.log("Cannot calculate shipping cost: No Shipping Options"),0;var a=function(t){return r.find(function(e){return e.id===t})},u=a("shipping_option_unselected"!==t&&a(t)?t:i);return Number(null==u?void 0:u.cost)||0}},{key:"unserviceableShippingAddressError",value:function(){return{reason:"SHIPPING_ADDRESS_UNSERVICEABLE",message:"Cannot ship to the selected address",intent:"SHIPPING_ADDRESS"}}},{key:"calculateNewTransactionInfo",value:function(t){return t.finalObject}},{key:"processPayment",value:(i=Fe(De().m(function t(e){var n,r,o,i,a,u,c,l,s,f,p,y,d,h=this;return De().w(function(t){for(;;)switch(t.p=t.n){case 0:return this.logGroup("processPayment"),r=nn(e),o=rn(e),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r={transactionState:t};return(e||n)&&(r.error={intent:e,message:n}),h.log("processPaymentResponse",r),r},a=function(t){return h.error(t),i("ERROR","PAYMENT_AUTHORIZATION",t)},u=function(){var t=Fe(De().m(function t(n){var r,o,i;return De().w(function(t){for(;;)switch(t.n){case 0:return r={orderId:n,paymentMethodData:e.paymentMethodData},t.n=1,w.paypal.Googlepay().confirmOrder(r);case 1:o=t.v,h.log("confirmOrder",o),i=null==o?void 0:o.status,t.n="APPROVED"===i?2:"PAYER_ACTION_REQUIRED"===i?3:4;break;case 2:return t.a(2,"approved");case 3:return t.a(2,tn);case 4:return t.a(2,Ze);case 5:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),c=function(t){return h.log("initiatePayerAction",t),w.paypal.Googlepay().initiatePayerAction({orderId:t})},l=function(){var t=Fe(De().m(function t(e){var n;return De().w(function(t){for(;;)switch(t.n){case 0:return n=!0,h.log("approveOrder",e),t.n=1,h.contextHandler.approveOrder({orderID:e,payer:r,shippingAddress:o},{restart:function(){return new Promise(function(t){n=!1,t()})},order:{get:function(){return new Promise(function(t){t(null)})}}});case 1:return t.a(2,n)}},t)}));return function(e){return t.apply(this,arguments)}}(),Me.setPayer(r),ue(r),t.p=1,t.n=2,this.contextHandler.createOrder();case 2:return s=t.v,this.log("createOrder",s),t.n=3,u(s);case 3:if(f=t.v,Ze!==f){t.n=4;break}n=a("TRANSACTION FAILED"),t.n=8;break;case 4:if(tn!==f){t.n=6;break}return t.n=5,c(s);case 5:p=t.v,this.log("3DS verification completed",p);case 6:return t.n=7,l(s);case 7:y=t.v,n=y?i("SUCCESS"):a("FAILED TO APPROVE");case 8:t.n=10;break;case 9:t.p=9,d=t.v,n=a(d.message);case 10:return this.logGroup(),t.a(2,n)}},t,this,[[1,9]])})),function(t){return i.apply(this,arguments)})},{key:"syncShippingOptionWithForm",value:function(t){for(var e=[".woocommerce-shipping-methods",".wc-block-components-shipping-rates-control",".wc-block-components-totals-shipping"],n=t.replace(/"/g,""),r=0,o=e;r1&&void 0!==arguments[1]?arguments[1]:"",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=function(t){return t.replace(/^#/,"")};return{Default:o(arguments.length>0&&void 0!==arguments[0]?arguments[0]:""),SmartButton:o(e),Block:o(n),Gateway:o(r),MiniCart:o(t)}}((null==t||null===(n=t.button)||void 0===n?void 0:n.wrapper)||"",(null==t||null===(r=t.button)||void 0===r?void 0:r.mini_cart_wrapper)||"",(null==e||null===(o=e.button)||void 0===o?void 0:o.wrapper)||"","ppc-button-googlepay-container","ppc-button-ppcp-googlepay")}},{key:"getStyles",value:function(t,e){var n=J((null==e?void 0:e.button)||{},(null==t?void 0:t.button)||{});return"buy"===n.MiniCart.type&&(n.MiniCart.type="pay"),n}}],r&&Ne(n.prototype,r),o&&Ne(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,o,i,a}(Vt);Je(fn,"methodId","ppcp-googlepay"),Je(fn,"cssClass","google-pay");const pn=fn;function yn(t){return yn="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},yn(t)}function dn(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"form.woocommerce-checkout";!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.target=e}return e=t,r=[{key:"fullPage",value:function(){return new t(window)}}],(n=[{key:"setTarget",value:function(t){this.target=t}},{key:"block",value:function(){jQuery(this.target).block({message:null,overlayCSS:{background:"#fff",opacity:.6},baseZ:1e4})}},{key:"unblock",value:function(){jQuery(this.target).unblock()}}])&&In(e.prototype,n),r&&In(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,r}();const Dn=Rn,Bn=function(t,e){return function(n,r){var o=Dn.fullPage();o.block();var i=!t.config.vaultingEnabled||"venmo"!==n.paymentSource,a={nonce:t.config.ajax.approve_order.nonce,order_id:n.orderID,funding_source:window.ppcpFundingSource,should_create_wc_order:i};return i&&n.payer&&(a.payer=n.payer),i&&n.shippingAddress&&(a.shipping_address=n.shippingAddress),fetch(t.config.ajax.approve_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(a)}).then(function(t){return t.json()}).then(function(n){var o;if(!n.success)return e.genericError(),r.restart().catch(function(){e.genericError()});var i,a=null===(o=n.data)||void 0===o?void 0:o.order_received_url;i=a||t.config.redirect,setTimeout(function(){window.location.href=i},200)}).finally(function(){o.unblock()})}};function Gn(t){return Gn="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},Gn(t)}function Fn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Hn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hn(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Hn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n0&&void 0!==arguments[0]?arguments[0]:[];!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cartItemKeys=e},(e=[{key:"getEndpoint",value:function(){var t="/?wc-ajax=%%endpoint%%";return"undefined"!=typeof wc_cart_fragments_params&&wc_cart_fragments_params.wc_ajax_url&&(t=wc_cart_fragments_params.wc_ajax_url),t.toString().replace("%%endpoint%%","remove_from_cart")}},{key:"addFromPurchaseUnits",value:function(t){var e,n=Fn(t||[]);try{for(n.s();!(e=n.n()).done;){var r,o=Fn(e.value.items||[]);try{for(o.s();!(r=o.n()).done;){var i=r.value;i.cart_item_key&&this.cartItemKeys.push(i.cart_item_key)}}catch(t){o.e(t)}finally{o.f()}}}catch(t){n.e(t)}finally{n.f()}return this}},{key:"removeFromCart",value:function(){var t=this;return new Promise(function(e,n){if(t.cartItemKeys&&t.cartItemKeys.length){var r,o=t.cartItemKeys.length,i=0,a=function(){++i>=o&&e()},u=Fn(t.cartItemKeys);try{for(u.s();!(r=u.n()).done;){var c=r.value,l=new URLSearchParams;l.append("cart_item_key",c),c?fetch(t.getEndpoint(),{method:"POST",credentials:"same-origin",body:l}).then(function(t){return t.json()}).then(function(){a()}).catch(function(){a()}):a()}}catch(t){u.e(t)}finally{u.f()}}else e()})}}])&&qn(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();const Ln=Wn;function Un(t){return Un="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},Un(t)}function Qn(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||Vn(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zn(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Vn(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Vn(t,e){if(t){if("string"==typeof t)return Jn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jn(t,e):void 0}}function Jn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n0){var n="#"+e.join("&");window.history.replaceState(null,"",window.location.pathname+window.location.search+n)}else window.history.replaceState(null,"",window.location.pathname+window.location.search)}}},{key:"isResumeFlow",value:function(){return!!window.location.hash&&window.location.hash.substring(1).split("&").some(function(t){return"switch_initiated_time"===t.split("=")[0]})}},{key:"reloadButtonsIfRequired",value:function(t){this.isResumeFlow()&&(this.cleanHashParams(),jQuery(t).trigger("ppcp-reload-buttons"))}}],null&&Zn(t.prototype,null),e&&Zn(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();er=or,rr=["onApprove","token","PayerID","payerID","button_session_id","billingToken","orderID","switch_initiated_time","onCancel","onError"],(nr=tr(nr="PAYPAL_PARAMS"))in er?Object.defineProperty(er,nr,{value:rr,enumerable:!0,configurable:!0,writable:!0}):er[nr]=rr;const ir=or;function ar(t){return ar="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},ar(t)}function ur(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n2&&void 0!==arguments[2]?arguments[2]:{};return t.errorHandler.clear(),t.cartUpdater.update(function(e){t.cartHelper=(new Ln).addFromPurchaseUnits(e);var n=ae(),r=void 0!==t.config.bn_codes[t.config.context]?t.config.bn_codes[t.config.context]:"";return fetch(t.config.ajax.create_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.create_order.nonce,purchase_units:e,payer:n,bn_code:r,payment_method:dt,funding_source:window.ppcpFundingSource,context:t.config.context})}).then(function(t){return t.json()}).then(function(t){if(!t.success)throw console.error(t),Error(t.data.message);return t.data.id})},t.getProducts(),r.updateCartOptions||{})}}},{key:"updateCart",value:function(t){return this.cartUpdater.update(function(t){return t},this.getProducts(),t)}},{key:"variations",value:function(){return this.hasVariations()?function(t){return function(t){if(Array.isArray(t))return ur(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ur(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ur(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(this.formElement.querySelectorAll("[name^='attribute_']")).map(function(t){return{value:t.value,name:t.name}}):null}},{key:"hasVariations",value:function(){return this.formElement.classList.contains("variations_form")}},{key:"isGroupedProduct",value:function(){return this.formElement.classList.contains("grouped_form")}},{key:"isBookingProduct",value:function(){return!!this.formElement.querySelector(".wc-booking-product-id")}},{key:"cleanCart",value:function(){var t=this;this.cartHelper.removeFromCart().then(function(){t.refreshMiniCart()}).catch(function(e){t.refreshMiniCart()})}},{key:"refreshMiniCart",value:function(){jQuery(document.body).trigger("wc_fragment_refresh")}}])}();const fr=sr;function pr(t){return pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pr(t)}function yr(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{};return new Promise(function(o,i){fetch(n.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(Pr({nonce:n.nonce,products:e},r))}).then(function(t){return t.json()}).then(function(e){if(e.success){var n=t(e.data);o(n)}else i(e.data)})})}}])}();const Tr=Cr;function Ar(t){return Ar="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},Ar(t)}function xr(t,e){for(var n=0;n>>0)+"_",o=0;return function t(r){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new e(n+(r||"")+"_"+o++,r)}}),i("Symbol.iterator",function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var n="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),i=0;i3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(ho(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,ho(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,ho(f,"constructor",l),ho(l,"constructor",c),c.displayName="GeneratorFunction",ho(l,o,"GeneratorFunction"),ho(f),ho(f,o,"Generator"),ho(f,r,function(){return this}),ho(f,"toString",function(){return"[object Generator]"}),(yo=function(){return{w:i,m:p}})()}function ho(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ho=function(t,e,n,r){function i(e,n){ho(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},ho(t,e,n,r)}function vo(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function bo(t,e){for(var n=0;n3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(So(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,So(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,So(f,"constructor",l),So(l,"constructor",c),c.displayName="GeneratorFunction",So(l,o,"GeneratorFunction"),So(f),So(f,o,"Generator"),So(f,r,function(){return this}),So(f,"toString",function(){return"[object Generator]"}),(wo=function(){return{w:i,m:p}})()}function So(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}So=function(t,e,n,r){function i(e,n){So(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},So(t,e,n,r)}function jo(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}const Oo=function(t){return new Promise(function(){var e,n=(e=wo().m(function e(n,r){var o,i,a,u,c;return wo().w(function(e){for(;;)switch(e.p=e.n){case 0:if(e.p=0,o=new Dn,i=new Sr(t.labels.error.generic,document.querySelector(".woocommerce-notices-wrapper")),a="checkout"===t.context?"form.checkout":"form#order_review",u=t.early_checkout_validation_enabled?new go(t.ajax.validate_checkout.endpoint,t.ajax.validate_checkout.nonce):null){e.n=1;break}return n(),e.a(2);case 1:u.validate(document.querySelector(a)).then(function(t){t.length>0?(o.unblock(),i.clear(),i.messages(t),jQuery(document.body).trigger("checkout_error",[i.currentHtml()]),r()):n()}),e.n=3;break;case 2:e.p=2,c=e.v,console.error(c),r();case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){jo(i,r,o,a,u,"next",t)}function u(t){jo(i,r,o,a,u,"throw",t)}a(void 0)})});return function(_x,t){return n.apply(this,arguments)}}())};function Po(t){return Po="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},Po(t)}function _o(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return ko(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(ko(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,ko(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,ko(f,"constructor",l),ko(l,"constructor",c),c.displayName="GeneratorFunction",ko(l,o,"GeneratorFunction"),ko(f),ko(f,o,"Generator"),ko(f,r,function(){return this}),ko(f,"toString",function(){return"[object Generator]"}),(_o=function(){return{w:i,m:p}})()}function ko(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ko=function(t,e,n,r){function i(e,n){ko(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},ko(t,e,n,r)}function Eo(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Co(t,e){for(var n=0;n0?u.messages(t.data.errors):(null===(o=t.data.details)||void 0===o?void 0:o.length)>0?u.message(t.data.details.map(function(t){return"".concat(t.issue," ").concat(t.description)}).join("
")):u.message(t.data.message),jQuery(document.body).trigger("checkout_error",[u.currentHtml()])}throw{type:"create-order-error",data:t.data}}var i=document.createElement("input");return i.setAttribute("type","hidden"),i.setAttribute("name","ppcp-resume-order"),i.setAttribute("value",t.data.custom_id),document.querySelector(c).appendChild(i),t.data.id})},onApprove:(t=this,e=this.errorHandler,function(n,r){var o=Dn.fullPage();return o.block(),e.clear(),ir.isResumeFlow()&&ir.cleanHashParams(),fetch(t.config.ajax.approve_order.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({nonce:t.config.ajax.approve_order.nonce,order_id:n.orderID,funding_source:window.ppcpFundingSource})}).then(function(t){return t.json()}).then(function(t){if(!t.success){if(100===t.data.code?e.message(t.data.message):e.genericError(),void 0!==r&&void 0!==r.restart)return r.restart();throw new Error(t.data.message)}vt().startsWith("ppcp-")||jQuery('input[name="payment_method"][value="'.concat(dt,'"]')).prop("checked",!0),document.querySelector("#place_order").click()}).finally(function(){o.unblock()})}),onCancel:function(){r.unblock(),ir.reloadButtonsIfRequired(n.config.button.wrapper)},onError:function(t){console.error(t),r.unblock(),t&&"create-order-error"===t.type||(n.errorHandler.genericError(),ir.reloadButtonsIfRequired(n.config.button.wrapper))}}}}])}();const xo=Ao;function Io(t){return Io="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},Io(t)}function Mo(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return Ro(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Ro(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Ro(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Ro(f,"constructor",l),Ro(l,"constructor",c),c.displayName="GeneratorFunction",Ro(l,o,"GeneratorFunction"),Ro(f),Ro(f,o,"Generator"),Ro(f,r,function(){return this}),Ro(f,"toString",function(){return"[object Generator]"}),(Mo=function(){return{w:i,m:p}})()}function Ro(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Ro=function(t,e,n,r){function i(e,n){Ro(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Ro(t,e,n,r)}function Do(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Bo(t,e){for(var n=0;n0?(o.unblock(),i.clear(),i.messages(t),jQuery(document.body).trigger("checkout_error",[i.currentHtml()]),r()):n()}),e.n=3;break;case 2:e.p=2,c=e.v,console.error(c),r();case 3:return e.a(2)}},e,null,[[0,2]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(t){Do(i,r,o,a,u,"next",t)}function u(t){Do(i,r,o,a,u,"throw",t)}a(void 0)})});return function(_x,t){return n.apply(this,arguments)}}())}},{key:"actionHandler",value:function(){return new xo(this.ppcpConfig,this.errorHandler(),new Dn)}}])}(Kr);const Wo=No;function Lo(t){return Lo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lo(t)}function Uo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Uo=function(){return!!t})()}function Qo(t){return Qo=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Qo(t)}function zo(t,e){return zo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},zo(t,e)}var Vo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Qo(e),function(t,e){if(e&&("object"==Lo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Uo()?Reflect.construct(e,n||[],Qo(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&zo(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(Kr);const Jo=Vo;function $o(t){return $o="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},$o(t)}function Yo(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Yo=function(){return!!t})()}function Ko(t){return Ko=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ko(t)}function Xo(t,e){return Xo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Xo(t,e)}var Zo=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=Ko(e),function(t,e){if(e&&("object"==$o(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Yo()?Reflect.construct(e,n||[],Ko(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Xo(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(Kr);const ti=Zo;function ei(t){return ei="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},ei(t)}function ni(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(ni=function(){return!!t})()}function ri(t){return ri=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},ri(t)}function oi(t,e){return oi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},oi(t,e)}var ii=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=ri(e),function(t,e){if(e&&("object"==ei(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,ni()?Reflect.construct(e,n||[],ri(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&oi(t,e)}(e,t),function(t){return Object.defineProperty(t,"prototype",{writable:!1}),t}(e)}(Kr);const ai=ii;function ui(t){return ui="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},ui(t)}function ci(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,l=Object.create(c.prototype);return li(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,n){return i=e,u=0,c=t,p.n=n,a}};function y(n,r){for(u=n,c=r,e=0;!f&&l&&!o&&e3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(li(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,li(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,li(f,"constructor",l),li(l,"constructor",c),c.displayName="GeneratorFunction",li(l,o,"GeneratorFunction"),li(f),li(f,o,"Generator"),li(f,r,function(){return this}),li(f,"toString",function(){return"[object Generator]"}),(ci=function(){return{w:i,m:p}})()}function li(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}li=function(t,e,n,r){function i(e,n){li(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},li(t,e,n,r)}function si(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function fi(t,e){for(var n=0;n=t.length?{done:!0}:{done:!1,value:t[_n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return i=t.done,t},e:function(t){a=!0,o=t},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function Mi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Di(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Di(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Di(f,"constructor",l),Di(l,"constructor",c),c.displayName="GeneratorFunction",Di(l,o,"GeneratorFunction"),Di(f),Di(f,o,"Generator"),Di(f,r,function(){return this}),Di(f,"toString",function(){return"[object Generator]"}),(Ri=function(){return{w:i,m:p}})()}function Di(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Di=function(t,e,n,r){function i(e,n){Di(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Di(t,e,n,r)}function Bi(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Gi(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){Bi(i,r,o,a,u,"next",t)}function u(t){Bi(i,r,o,a,u,"throw",t)}a(void 0)})}}function Fi(t,e){for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:{},a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.namespace=e,this.buttonConfig=n,this.ppcpConfig=r,this.buttonAttributes=i,this.onClick=a,this.googlePayConfig=null,this.transactionInfo=null,this.contextHandler=null,this.buttons=[],W.watchContextBootstrap(function(){var t=Gi(Ri().m(function t(e){var i,a;return Ri().w(function(t){for(;;)switch(t.n){case 0:if(o.contextHandler=Ai.create(e.context,n,r,e.handler),i=pn.createButton(e.context,e.handler,n,r,o.contextHandler,o.buttonAttributes,o.onClick),o.buttons.push(i),a=function(){i.configure(o.googlePayConfig,o.transactionInfo,o.buttonAttributes),i.init()},!o.googlePayConfig||!o.transactionInfo){t.n=1;break}a(),t.n=3;break;case 1:return t.n=2,o.init();case 2:o.googlePayConfig&&o.transactionInfo&&a();case 3:return t.a(2)}},t)}));return function(_x){return t.apply(this,arguments)}}())},[{key:"init",value:(e=Gi(Ri().m(function t(){var e,n,r,o;return Ri().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,this.googlePayConfig){t.n=2;break}return t.n=1,window[this.namespace].Googlepay().config();case 1:this.googlePayConfig=t.v;case 2:if(this.transactionInfo){t.n=4;break}return t.n=3,this.fetchTransactionInfo();case 3:this.transactionInfo=t.v;case 4:if(this.googlePayConfig)if(this.transactionInfo){e=Ii(this.buttons);try{for(e.s();!(n=e.n()).done;)(r=n.value).configure(this.googlePayConfig,this.transactionInfo,this.buttonAttributes),r.init()}catch(t){e.e(t)}finally{e.f()}}else console.error("No transactionInfo found during init");else console.error("No GooglePayConfig received during init");t.n=6;break;case 5:t.p=5,o=t.v,console.error("Error during initialization:",o);case 6:return t.a(2)}},t,this,[[0,5]])})),function(){return e.apply(this,arguments)})},{key:"fetchTransactionInfo",value:(t=Gi(Ri().m(function t(){var e;return Ri().w(function(t){for(;;)switch(t.p=t.n){case 0:if(t.p=0,this.contextHandler){t.n=1;break}throw new Error("ContextHandler is not initialized");case 1:return t.n=2,this.contextHandler.transactionInfo();case 2:return t.a(2,t.v);case 3:throw t.p=3,e=t.v,console.error("Error fetching transaction info:",e),e;case 4:return t.a(2)}},t,this,[[0,3]])})),function(){return t.apply(this,arguments)})},{key:"reinit",value:function(){var t,e=Ii(this.buttons);try{for(e.s();!(t=e.n()).done;)t.value.reinit()}catch(t){e.e(t)}finally{e.f()}}}]);var t,e}();const Ni=qi;function Wi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Qi(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Qi(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Qi(f,"constructor",l),Qi(l,"constructor",c),c.displayName="GeneratorFunction",Qi(l,o,"GeneratorFunction"),Qi(f),Qi(f,o,"Generator"),Qi(f,r,function(){return this}),Qi(f,"toString",function(){return"[object Generator]"}),(Ui=function(){return{w:i,m:p}})()}function Qi(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Qi=function(t,e,n,r){function i(e,n){Qi(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Qi(t,e,n,r)}function zi(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Vi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(Yi(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Yi(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,Yi(f,"constructor",l),Yi(l,"constructor",c),c.displayName="GeneratorFunction",Yi(l,o,"GeneratorFunction"),Yi(f),Yi(f,o,"Generator"),Yi(f,r,function(){return this}),Yi(f,"toString",function(){return"[object Generator]"}),($i=function(){return{w:i,m:p}})()}function Yi(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Yi=function(t,e,n,r){function i(e,n){Yi(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},Yi(t,e,n,r)}function Ki(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function Xi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n3?(o=d===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=n<2&&yr||r>d)&&(i[4]=n,i[5]=r,p.n=d,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&y(s,d),u=s,c=d;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),y(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(e){i=t,u=1,c=e}finally{l=1}}return{value:e,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}e=Object.getPrototypeOf;var s=[][r]?e(e([][r]())):(ea(e={},r,function(){return this}),e),f=l.prototype=u.prototype=Object.create(s);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,ea(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=l,ea(f,"constructor",l),ea(l,"constructor",c),c.displayName="GeneratorFunction",ea(l,o,"GeneratorFunction"),ea(f),ea(f,o,"Generator"),ea(f,r,function(){return this}),ea(f,"toString",function(){return"[object Generator]"}),(ta=function(){return{w:i,m:p}})()}function ea(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ea=function(t,e,n,r){function i(e,n){ea(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},ea(t,e,n,r)}function na(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function ra(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);n