@bigcommerce/checkout-sdk 1.817.0 → 1.818.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/checkout-button.js +1 -1
- package/dist/cjs/checkout-sdk-essential.js +1 -1
- package/dist/cjs/checkout-sdk.js +1 -1
- package/dist/cjs/hosted-form-v2-iframe-host.js +1 -1
- package/dist/cjs/integrations/amazon-pay.js +1 -1
- package/dist/cjs/integrations/bigcommerce-payments.js +1 -1
- package/dist/cjs/integrations/braintree.js +1 -1
- package/dist/cjs/integrations/google-pay.js +1 -1
- package/dist/cjs/integrations/klarna.js +1 -1
- package/dist/cjs/integrations/paypal-commerce.js +1 -1
- package/dist/cjs/integrations/paypal-express.js +1 -1
- package/dist/cjs/integrations/zip.js +1 -1
- package/dist/esm/checkout-button.js +1 -1
- package/dist/esm/checkout-sdk-essential.js +1 -1
- package/dist/esm/checkout-sdk.js +1 -1
- package/dist/esm/hosted-form-v2-iframe-host.js +1 -1
- package/dist/esm/integrations/amazon-pay.js +1 -1
- package/dist/esm/integrations/bigcommerce-payments.js +1 -1
- package/dist/esm/integrations/braintree.js +1 -1
- package/dist/esm/integrations/google-pay.js +1 -1
- package/dist/esm/integrations/klarna.js +1 -1
- package/dist/esm/integrations/paypal-commerce.js +1 -1
- package/dist/esm/integrations/paypal-express.js +1 -1
- package/dist/esm/integrations/zip.js +1 -1
- package/dist/types/checkout-sdk.d.ts +71 -1
- package/docs/README.md +3 -1
- package/docs/interfaces/BraintreeCreditCardPaymentInitializeOptions.md +140 -0
- package/docs/interfaces/WithBraintreeCreditCardPaymentInitializeOptions.md +17 -0
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see paypal-commerce.js.LICENSE.txt */
|
|
2
|
-
(()=>{var t={35:(t,e,n)=>{t=n.nmd(t);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",a="[object Function]",s="[object Object]",u=/^\[object .+?Constructor\]$/,c=/^(?:0|[1-9]\d*)$/,l={};l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l[o]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object Boolean]"]=l["[object DataView]"]=l["[object Date]"]=l["[object Error]"]=l[a]=l["[object Map]"]=l["[object Number]"]=l[s]=l["[object RegExp]"]=l["[object Set]"]=l["[object String]"]=l["[object WeakMap]"]=!1;var d,p,h,f="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,y="object"==typeof self&&self&&self.Object===Object&&self,m=f||y||Function("return this")(),v=e&&!e.nodeType&&e,g=v&&t&&!t.nodeType&&t,b=g&&g.exports===v,w=b&&f.process,S=function(){try{return g&&g.require&&g.require("util").types||w&&w.binding&&w.binding("util")}catch(t){}}(),_=S&&S.isTypedArray,I=Array.prototype,C=Function.prototype,P=Object.prototype,O=m["__core-js_shared__"],A=C.toString,k=P.hasOwnProperty,E=(d=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+d:"",j=P.toString,x=A.call(Object),T=RegExp("^"+A.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z=b?m.Buffer:void 0,F=m.Symbol,B=m.Uint8Array,D=(z&&z.allocUnsafe,p=Object.getPrototypeOf,h=Object,function(t){return p(h(t))}),M=Object.create,U=P.propertyIsEnumerable,N=I.splice,R=F?F.toStringTag:void 0,L=function(){try{var t=st(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),V=z?z.isBuffer:void 0,q=Math.max,$=Date.now,W=st(m,"Map"),H=st(Object,"create"),G=function(){function t(){}return function(e){if(!bt(e))return{};if(M)return M(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Y(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function K(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function J(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Z(t){var e=this.__data__=new K(t);this.size=e.size}function X(t,e,n){(void 0!==n&&!pt(t[e],n)||void 0===n&&!(e in t))&&et(t,e,n)}function Q(t,e,n){var r=t[e];k.call(t,e)&&pt(r,n)&&(void 0!==n||e in t)||et(t,e,n)}function tt(t,e){for(var n=t.length;n--;)if(pt(t[n][0],e))return n;return-1}function et(t,e,n){"__proto__"==e&&L?L(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}Y.prototype.clear=function(){this.__data__=H?H(null):{},this.size=0},Y.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Y.prototype.get=function(t){var e=this.__data__;if(H){var n=e[t];return n===r?void 0:n}return k.call(e,t)?e[t]:void 0},Y.prototype.has=function(t){var e=this.__data__;return H?void 0!==e[t]:k.call(e,t)},Y.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=H&&void 0===e?r:e,this},K.prototype.clear=function(){this.__data__=[],this.size=0},K.prototype.delete=function(t){var e=this.__data__,n=tt(e,t);return!(n<0||(n==e.length-1?e.pop():N.call(e,n,1),--this.size,0))},K.prototype.get=function(t){var e=this.__data__,n=tt(e,t);return n<0?void 0:e[n][1]},K.prototype.has=function(t){return tt(this.__data__,t)>-1},K.prototype.set=function(t,e){var n=this.__data__,r=tt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},J.prototype.clear=function(){this.size=0,this.__data__={hash:new Y,map:new(W||K),string:new Y}},J.prototype.delete=function(t){var e=at(this,t).delete(t);return this.size-=e?1:0,e},J.prototype.get=function(t){return at(this,t).get(t)},J.prototype.has=function(t){return at(this,t).has(t)},J.prototype.set=function(t,e){var n=at(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Z.prototype.clear=function(){this.__data__=new K,this.size=0},Z.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,e){var n=this.__data__;if(n instanceof K){var r=n.__data__;if(!W||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new J(r)}return n.set(t,e),this.size=n.size,this};function nt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":R&&R in Object(t)?function(t){var e=k.call(t,R),n=t[R];try{t[R]=void 0;var r=!0}catch(t){}var i=j.call(t);return r&&(e?t[R]=n:delete t[R]),i}(t):function(t){return j.call(t)}(t)}function rt(t){return wt(t)&&nt(t)==o}function it(t,e,n,r,i){t!==e&&function(t,e,n){for(var r=-1,i=Object(t),o=n(t),a=o.length;a--;){var s=o[++r];if(!1===e(i[s],s,i))break}}(e,function(o,a){if(i||(i=new Z),bt(o))!function(t,e,n,r,i,o,a){var u=lt(t,n),c=lt(e,n),l=a.get(c);if(l)X(t,n,l);else{var d,p,h,f,y,m=o?o(u,c,n+"",t,e,a):void 0,v=void 0===m;if(v){var g=ft(c),b=!g&&mt(c),w=!g&&!b&&St(c);m=c,g||b||w?ft(u)?m=u:wt(y=u)&&yt(y)?m=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(u):b?(v=!1,m=function(t){return t.slice()}(c)):w?(v=!1,f=new(h=(d=c).buffer).constructor(h.byteLength),new B(f).set(new B(h)),p=f,m=new d.constructor(p,d.byteOffset,d.length)):m=[]:function(t){if(!wt(t)||nt(t)!=s)return!1;var e=D(t);if(null===e)return!0;var n=k.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&A.call(n)==x}(c)||ht(c)?(m=u,ht(u)?m=function(t){return function(t,e,n){var r=!n;n||(n={});for(var i=-1,o=e.length;++i<o;){var a=e[i],s=void 0;void 0===s&&(s=t[a]),r?et(n,a,s):Q(n,a,s)}return n}(t,_t(t))}(u):bt(u)&&!vt(u)||(m=function(t){return"function"!=typeof t.constructor||ct(t)?{}:G(D(t))}(c))):v=!1}v&&(a.set(c,m),i(m,c,r,o,a),a.delete(c)),X(t,n,m)}}(t,e,a,n,it,r,i);else{var u=r?r(lt(t,a),o,a+"",t,e,i):void 0;void 0===u&&(u=o),X(t,a,u)}},_t)}var ot=L?function(t,e){return L(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Pt;function at(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function st(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!bt(t)||function(t){return!!E&&E in t}(t))&&(vt(t)?T:u).test(function(t){if(null!=t){try{return A.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function ut(t,e){var n=typeof t;return!!(e=null==e?i:e)&&("number"==n||"symbol"!=n&&c.test(t))&&t>-1&&t%1==0&&t<e}function ct(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||P)}function lt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var dt=function(t){var e=0,n=0;return function(){var r=$(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(ot);function pt(t,e){return t===e||t!=t&&e!=e}var ht=rt(function(){return arguments}())?rt:function(t){return wt(t)&&k.call(t,"callee")&&!U.call(t,"callee")},ft=Array.isArray;function yt(t){return null!=t&>(t.length)&&!vt(t)}var mt=V||function(){return!1};function vt(t){if(!bt(t))return!1;var e=nt(t);return e==a||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function gt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}function bt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function wt(t){return null!=t&&"object"==typeof t}var St=_?function(t){return function(e){return t(e)}}(_):function(t){return wt(t)&>(t.length)&&!!l[nt(t)]};function _t(t){return yt(t)?function(t,e){var n=ft(t),r=!n&&ht(t),i=!n&&!r&&mt(t),o=!n&&!r&&!i&&St(t),a=n||r||i||o,s=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],u=s.length;for(var c in t)!e&&!k.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ut(c,u))||s.push(c);return s}(t,!0):function(t){if(!bt(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=ct(t),n=[];for(var r in t)("constructor"!=r||!e&&k.call(t,r))&&n.push(r);return n}(t)}var It,Ct=(It=function(t,e,n){it(t,e,n)},function(t,e){return dt(function(t,e,n){return e=q(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=q(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=r[i];return s[e]=n(a),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,s)}}(t,e,Pt),t+"")}(function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;for(i=It.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(t,e,n){if(!bt(n))return!1;var r=typeof e;return!!("number"==r?yt(n)&&ut(e,n.length):"string"==r&&e in n)&&pt(n[e],t)}(e[0],e[1],o)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var a=e[n];a&&It(t,a,n)}return t}));function Pt(t){return t}t.exports=Ct},168:t=>{var e;e=function(){function t(){for(var t=0,e={};t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}function e(t){return t.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(e,n,o){if("undefined"!=typeof document){"number"==typeof(o=t({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var a=JSON.stringify(n);/^[\{\[]/.test(a)&&(n=a)}catch(t){}n=r.write?r.write(n,e):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var u in o)o[u]&&(s+="; "+u,!0!==o[u]&&(s+="="+o[u].split(";")[0]));return document.cookie=e+"="+n+s}}function a(t,n){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],a=0;a<o.length;a++){var s=o[a].split("="),u=s.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=e(s[0]);if(u=(r.read||r)(u,c)||e(u),n)try{u=JSON.parse(u)}catch(t){}if(i[c]=u,t===c)break}catch(t){}}return t?i[t]:i}}return i.set=o,i.get=function(t){return a(t,!1)},i.getJSON=function(t){return a(t,!0)},i.remove=function(e,n){o(e,"",t(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}(function(){})},"function"==typeof define&&define.amd&&define(e),t.exports=e()},282:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(9722);e.default=function(){return r||(r=i.default()),r}},315:(t,e,n)=>{"use strict";n(4886).default;var r=n(471);e.Hb=r.default;var i=n(5895);e.vQ=i.default,n(7995).default,n(9722).default,n(282).default},321:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(168),i=n(1675),o=n(5861),a=n(4670);function s(t){return new a.A(new o.A,new i.A,r,t)}},471:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(4886);e.default=function(){return new o.default(new i.default,r.createRequestSender())}},710:(t,e,n)=>{"use strict";function r(t){return"object"!=typeof t||null===t?t:Object.keys(t).filter(function(e){return void 0!==t[e]}).map(function(e){var n=t[e];return"string"==typeof n?e+"="+encodeURIComponent(n):e+"="+encodeURIComponent(JSON.stringify(n)||"")}).join("&")}n.d(e,{A:()=>r})},803:t=>{"use strict";t.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}},1675:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(4321),i=n(710),o=/application\/(\w+\+)?json/,a=/application\/x-www-form-urlencoded/;const s=function(){function t(){}return t.prototype.toRequestBody=function(t){var e=t.headers?this._getHeader(t.headers,"Content-Type"):"";if(t.body){if(o.test(e))return JSON.stringify(t.body);if(a.test(e))return(0,i.A)(t.body)}return t.body},t.prototype.toResponse=function(t){var e=this._parseResponseHeaders(t.getAllResponseHeaders());return{body:this._parseResponseBody("response"in t?t.response:t.responseText,e),headers:e,status:t.status,statusText:t.statusText}},t.prototype._parseResponseBody=function(t,e){var n=this._getHeader(e,"Content-Type");return t&&o.test(n)?JSON.parse(t):t},t.prototype._parseResponseHeaders=function(t){return(t?t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/):[]).reduce(function(t,e){var n,i=e.split(":"),o=(i.shift()||"").trim();return o?(0,r.Cl)((0,r.Cl)({},t),((n={})[o.toLowerCase()]=i.join(":").trim(),n)):t},{})},t.prototype._getHeader=function(t,e){return t&&e&&(t[e]||t[e.toLowerCase()])||""},t}()},1915:t=>{"use strict";var e="%[a-f0-9]{2}",n=new RegExp("("+e+")|([^%]+?)","gi"),r=new RegExp("("+e+")+","gi");function i(t,e){try{return[decodeURIComponent(t.join(""))]}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function o(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(n)||[],r=1;r<e.length;r++)e=(t=i(e,r).join("")).match(n)||[];return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=r.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var i=o(n[0]);i!==n[0]&&(e[n[0]]=i)}n=r.exec(t)}e["%C2"]="�";for(var a=Object.keys(e),s=0;s<a.length;s++){var u=a[s];t=t.replace(new RegExp(u,"g"),e[u])}return t}(t)}}},2024:(t,e,n)=>{"use strict";n.d(e,{A:()=>r});const r=function(){function t(t){var e=this;this._delay=t,this._resolve=function(){},this._promise=new Promise(function(t){e._resolve=t})}return t.prototype.onComplete=function(t){this._promise.then(t)},t.prototype.complete=function(){this._resolve(),this._timeoutToken&&window.clearTimeout(this._timeoutToken)},t.prototype.start=function(){var t=this;this._delay&&(this._timeoutToken=window.setTimeout(function(){return t.complete()},this._delay))},t}()},4043:(t,e,n)=>{"use strict";n.r(e),n.d(e,{RequestSender:()=>o.A,Timeout:()=>a.A,createRequestSender:()=>r.A,createTimeout:()=>i.A});var r=n(321),i=n(6889),o=n(4670),a=n(2024)},4321:(t,e,n)=>{"use strict";n.d(e,{Cl:()=>r});var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)}},4325:(t,e,n)=>{"use strict";n.d(e,{g:()=>i});var r=n(5889),i=function(){function t(){this._cache={}}return t.prototype.read=function(t,e){var n=this.getKey(t,e.params);return this._cache[n]||null},t.prototype.write=function(t,e,n){var r=this.getKey(t,e.params);this._cache[r]=n},t.prototype.getKey=function(t,e){return void 0===e&&(e={}),0===Object.keys(e).length?t:t+"?"+r.As(e)},t}()},4475:t=>{"use strict";var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var o,a,s=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),u=1;u<arguments.length;u++){for(var c in o=Object(arguments[u]))n.call(o,c)&&(s[c]=o[c]);if(e){a=e(o);for(var l=0;l<a.length;l++)r.call(o,a[l])&&(s[a[l]]=o[a[l]])}}return s}},4670:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var r=n(4321),i=n(35),o=n.n(i),a=n(4325),s=n(4843),u=n(2024);const c=function(){function t(t,e,n,r){void 0===r&&(r={}),this._requestFactory=t,this._payloadTransformer=e,this._cookie=n,this._options=r,this._cache=this._options.cache||new a.g}return t.prototype.sendRequest=function(t,e){var n=this,r=this._mergeDefaultOptions(t,e),i=this._getCachedRequest(t,r);if(i)return Promise.resolve(i);var o=this._requestFactory.createRequest(this._prependHost(t),r);return new Promise(function(e,i){var a=function(){var a=n._payloadTransformer.toResponse(o);a.status>=200&&a.status<300?(n._cacheRequest(t,r,a),e(a)):i(a)};o.onload=a,o.onerror=a,o.onabort=a,o.ontimeout=a,r.timeout instanceof u.A&&(r.timeout.onComplete(function(){return o.abort()}),r.timeout.start()),(0,s.A)(r.timeout)&&r.timeout.then(function(){return o.abort()}),o.send(n._payloadTransformer.toRequestBody(r))})},t.prototype.get=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"GET"}))},t.prototype.post=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"POST"}))},t.prototype.put=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"PUT"}))},t.prototype.patch=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"PATCH"}))},t.prototype.delete=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"DELETE"}))},t.prototype._mergeDefaultOptions=function(t,e){var n={credentials:!0,encodeParams:!0,headers:{Accept:"application/json, text/plain, */*"},method:"GET"},r=this._cookie.get("XSRF-TOKEN");return r&&n.headers&&!this._isAssetRequest(t,e)&&this._isLocalRequest(t)&&(n.headers["X-XSRF-TOKEN"]=r),e&&e.body&&n.headers&&(n.headers["Content-Type"]="application/json"),o()({},n,e)},t.prototype._prependHost=function(t){return!this._options.host||/^https?:\/\//.test(t)?t:this._options.host.replace(/\/$/,"")+"/"+t.replace(/^\//,"")},t.prototype._shouldCacheRequest=function(t){return"GET"===(t.method||"GET").toUpperCase()&&Boolean(t.cache)},t.prototype._getCachedRequest=function(t,e){return this._shouldCacheRequest(e)?this._cache.read(t,e):null},t.prototype._cacheRequest=function(t,e,n){this._shouldCacheRequest(e)&&this._cache.write(t,e,n)},t.prototype._isAssetRequest=function(t,e){return(!e||!e.method||"GET"===e.method.toUpperCase())&&/\.(png|gif|jpe?g|css|js|json|svg|html?)$/.test(t.split("?")[0])},t.prototype._isLocalRequest=function(t){return!!t.match(new RegExp("^(https?:)?//"+window.location.hostname))||!t.match(new RegExp("^(https?:)?//"))},t}()},4843:(t,e,n)=>{"use strict";function r(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}n.d(e,{A:()=>r})},4886:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._browserSupport=t,this._requestSender=e,this._scripts={},this._preloadedScripts={}}return t.prototype.loadScript=function(t,e){var n=this;return this._scripts[t]||(this._scripts[t]=new Promise(function(r,i){var o=document.createElement("script"),a=e||{},s=a.async,u=void 0!==s&&s,c=a.attributes,l=void 0===c?{}:c;Object.keys(l).forEach(function(t){o.setAttribute(t,l[t])}),o.onload=function(){return r()},o.onreadystatechange=function(){return r()},o.onerror=function(e){delete n._scripts[t],i(e)},o.async=u,o.src=t,document.body.appendChild(o)})),this._scripts[t]},t.prototype.loadScripts=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.loadScript(t,e)})).then(function(){})},t.prototype.preloadScript=function(t,e){var n=this;return this._preloadedScripts[t]||(this._preloadedScripts[t]=new Promise(function(r,i){var o=(e||{}).prefetch,a=void 0!==o&&o?"prefetch":"preload";if(n._browserSupport.canSupportRel(a)){var s=document.createElement("link");s.as="script",s.rel=a,s.href=t,s.onload=function(){r()},s.onerror=function(){delete n._preloadedScripts[t],i()},document.head.appendChild(s)}else n._requestSender.get(t,{credentials:!1,headers:{Accept:"application/javascript"}}).then(function(){return r()}).catch(i)})),this._preloadedScripts[t]},t.prototype.preloadScripts=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.preloadScript(t,e)})).then(function(){})},t}();e.default=n},5470:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9783),i=function(){function t(t,e){this._formBuilder=t,this._options=e}return t.prototype.postForm=function(t,e,n,r){var i=this._formBuilder.build(this._prependHost(t),e,r);window.addEventListener("unload",function t(){window.removeEventListener("unload",t),n&&n()}),document.body.appendChild(i),i.submit()},t.prototype._prependHost=function(t){return this._options&&this._options.host&&!(0,r.isAbsoluteUrl)(t)?(0,r.joinPaths)(this._options.host,t):t},t}();e.default=i},5477:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.canSupportRel=function(t){var e=document.createElement("link");return!!(e.relList&&e.relList.supports&&e.relList.supports(t))},t}();e.default=n},5861:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});var r=n(5889);const i=function(){function t(){}return t.prototype.createRequest=function(t,e){var n=new XMLHttpRequest;return this._configureRequest(n,t,e),n},t.prototype._configureRequest=function(t,e,n){void 0===n&&(n={}),t.open(n.method||"GET",this._formatUrl(e,n.params,n.encodeParams),!0),n.headers&&this._configureRequestHeaders(t,n.headers),"boolean"==typeof n.credentials&&(t.withCredentials=n.credentials),"number"==typeof n.timeout&&(t.timeout=n.timeout)},t.prototype._configureRequestHeaders=function(t,e){Object.keys(e).filter(function(t){return null!==e[t]}).forEach(function(n){t.setRequestHeader(n,e[n])})},t.prototype._formatUrl=function(t,e,n){return void 0===n&&(n=!0),e&&0!==Object.keys(e).length?t+"?"+r.As(e,{encode:n}):t},t}()},5889:(t,e,n)=>{"use strict";var r=n(803),i=n(4475);n(1915);function o(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}e.As=function(t,e){!1===(e=i({encode:!0,strict:!0,arrayFormat:"none"},e)).sort&&(e.sort=function(){});var n=function(t){switch(t.arrayFormat){case"index":return function(e,n,r){return null===n?[o(e,t),"[",r,"]"].join(""):[o(e,t),"[",o(r,t),"]=",o(n,t)].join("")};case"bracket":return function(e,n){return null===n?o(e,t):[o(e,t),"[]=",o(n,t)].join("")};default:return function(e,n){return null===n?o(e,t):[o(e,t),"=",o(n,t)].join("")}}}(e);return t?Object.keys(t).sort(e.sort).map(function(r){var i=t[r];if(void 0===i)return"";if(null===i)return o(r,e);if(Array.isArray(i)){var a=[];return i.slice().forEach(function(t){void 0!==t&&a.push(n(r,t,a.length))}),a.join("&")}return o(r,e)+"="+o(i,e)}).filter(function(t){return t.length>0}).join("&"):""}},5895:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(471);e.default=function(){return r||(r=i.default()),r}},6889:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});var r=n(2024);function i(t){return new r.A(t)}},7995:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._browserSupport=t,this._requestSender=e,this._stylesheets={},this._preloadedStylesheets={}}return t.prototype.loadStylesheet=function(t,e){var n=this;return this._stylesheets[t]||(this._stylesheets[t]=new Promise(function(r,i){var o=document.createElement("link"),a=e||{},s=a.prepend,u=void 0!==s&&s,c=a.attributes,l=void 0===c?{}:c;Object.keys(l).forEach(function(t){o.setAttribute(t,l[t])}),o.onload=function(){return r()},o.onerror=function(e){delete n._stylesheets[t],i(e)},o.rel="stylesheet",o.href=t,u&&document.head.children[0]?document.head.insertBefore(o,document.head.children[0]):document.head.appendChild(o)})),this._stylesheets[t]},t.prototype.loadStylesheets=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.loadStylesheet(t,e)})).then(function(){})},t.prototype.preloadStylesheet=function(t,e){var n=this;return this._preloadedStylesheets[t]||(this._preloadedStylesheets[t]=new Promise(function(r,i){var o=(e||{}).prefetch,a=void 0!==o&&o,s=a?"prefetch":"preload";if(n._browserSupport.canSupportRel(s)){var u=document.createElement("link");u.as="style",u.rel=a?"prefetch":"preload",u.href=t,u.onload=function(){r()},u.onerror=function(e){delete n._preloadedStylesheets[t],i(e)},document.head.appendChild(u)}else n._requestSender.get(t,{credentials:!1,headers:{Accept:"text/css"}}).then(function(){return r()}).catch(i)})),this._preloadedStylesheets[t]},t.prototype.preloadStylesheets=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.preloadStylesheet(t,e)})).then(function(){})},t}();e.default=n},8686:(t,e,n)=>{"use strict";e.createFormPoster=void 0;var r=n(9165);Object.defineProperty(e,"createFormPoster",{enumerable:!0,get:function(){return r.default}});n(5470)},9165:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9828),i=n(5470);e.default=function(t){var e=new r.default;return new i.default(e,t)}},9440:function(t,e,n){t=n.nmd(t),function(){var r,i="Expected a function",o="__lodash_hash_undefined__",a="__lodash_placeholder__",s=32,u=128,c=1/0,l=9007199254740991,d=NaN,p=4294967295,h=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],f="[object Arguments]",y="[object Array]",m="[object Boolean]",v="[object Date]",g="[object Error]",b="[object Function]",w="[object GeneratorFunction]",S="[object Map]",_="[object Number]",I="[object Object]",C="[object Promise]",P="[object RegExp]",O="[object Set]",A="[object String]",k="[object Symbol]",E="[object WeakMap]",j="[object ArrayBuffer]",x="[object DataView]",T="[object Float32Array]",z="[object Float64Array]",F="[object Int8Array]",B="[object Int16Array]",D="[object Int32Array]",M="[object Uint8Array]",U="[object Uint8ClampedArray]",N="[object Uint16Array]",R="[object Uint32Array]",L=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,H=RegExp($.source),G=RegExp(W.source),Y=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/[\\^$.*+?()[\]{}|]/g,et=RegExp(tt.source),nt=/^\s+/,rt=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ot=/\{\n\/\* \[wrapped with (.+)\] \*/,at=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ut=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,ht=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,yt=/^0o[0-7]+$/i,mt=/^(?:0|[1-9]\d*)$/,vt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,gt=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",St="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_t="\\u2700-\\u27bf",It="a-z\\xdf-\\xf6\\xf8-\\xff",Ct="A-Z\\xc0-\\xd6\\xd8-\\xde",Pt="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",At="["+wt+"]",kt="["+Ot+"]",Et="["+St+"]",jt="\\d+",xt="["+_t+"]",Tt="["+It+"]",zt="[^"+wt+Ot+jt+_t+It+Ct+"]",Ft="\\ud83c[\\udffb-\\udfff]",Bt="[^"+wt+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ut="["+Ct+"]",Nt="\\u200d",Rt="(?:"+Tt+"|"+zt+")",Lt="(?:"+Ut+"|"+zt+")",Vt="(?:['’](?:d|ll|m|re|s|t|ve))?",qt="(?:['’](?:D|LL|M|RE|S|T|VE))?",$t="(?:"+Et+"|"+Ft+")?",Wt="["+Pt+"]?",Ht=Wt+$t+"(?:"+Nt+"(?:"+[Bt,Dt,Mt].join("|")+")"+Wt+$t+")*",Gt="(?:"+[xt,Dt,Mt].join("|")+")"+Ht,Yt="(?:"+[Bt+Et+"?",Et,Dt,Mt,At].join("|")+")",Kt=RegExp("['’]","g"),Jt=RegExp(Et,"g"),Zt=RegExp(Ft+"(?="+Ft+")|"+Yt+Ht,"g"),Xt=RegExp([Ut+"?"+Tt+"+"+Vt+"(?="+[kt,Ut,"$"].join("|")+")",Lt+"+"+qt+"(?="+[kt,Ut+Rt,"$"].join("|")+")",Ut+"?"+Rt+"+"+Vt,Ut+"+"+qt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",jt,Gt].join("|"),"g"),Qt=RegExp("["+Nt+wt+St+Pt+"]"),te=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ee=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ne=-1,re={};re[T]=re[z]=re[F]=re[B]=re[D]=re[M]=re[U]=re[N]=re[R]=!0,re[f]=re[y]=re[j]=re[m]=re[x]=re[v]=re[g]=re[b]=re[S]=re[_]=re[I]=re[P]=re[O]=re[A]=re[E]=!1;var ie={};ie[f]=ie[y]=ie[j]=ie[x]=ie[m]=ie[v]=ie[T]=ie[z]=ie[F]=ie[B]=ie[D]=ie[S]=ie[_]=ie[I]=ie[P]=ie[O]=ie[A]=ie[k]=ie[M]=ie[U]=ie[N]=ie[R]=!0,ie[g]=ie[b]=ie[E]=!1;var oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ae=parseFloat,se=parseInt,ue="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ce="object"==typeof self&&self&&self.Object===Object&&self,le=ue||ce||Function("return this")(),de=e&&!e.nodeType&&e,pe=de&&t&&!t.nodeType&&t,he=pe&&pe.exports===de,fe=he&&ue.process,ye=function(){try{return pe&&pe.require&&pe.require("util").types||fe&&fe.binding&&fe.binding("util")}catch(t){}}(),me=ye&&ye.isArrayBuffer,ve=ye&&ye.isDate,ge=ye&&ye.isMap,be=ye&&ye.isRegExp,we=ye&&ye.isSet,Se=ye&&ye.isTypedArray;function _e(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ie(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var a=t[i];e(r,a,n(a),t)}return r}function Ce(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Pe(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ae(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}function ke(t,e){return!(null==t||!t.length)&&Ue(t,e,0)>-1}function Ee(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function je(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function xe(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Te(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function ze(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Fe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Be=Ve("length");function De(t,e,n){var r;return n(t,function(t,n,i){if(e(t,n,i))return r=n,!1}),r}function Me(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Ue(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Me(t,Re,n)}function Ne(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function Re(t){return t!=t}function Le(t,e){var n=null==t?0:t.length;return n?We(t,e)/n:d}function Ve(t){return function(e){return null==e?r:e[t]}}function qe(t){return function(e){return null==t?r:t[e]}}function $e(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}function We(t,e){for(var n,i=-1,o=t.length;++i<o;){var a=e(t[i]);a!==r&&(n=n===r?a:n+a)}return n}function He(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ge(t){return t?t.slice(0,dn(t)+1).replace(nt,""):t}function Ye(t){return function(e){return t(e)}}function Ke(t,e){return je(e,function(e){return t[e]})}function Je(t,e){return t.has(e)}function Ze(t,e){for(var n=-1,r=t.length;++n<r&&Ue(e,t[n],0)>-1;);return n}function Xe(t,e){for(var n=t.length;n--&&Ue(e,t[n],0)>-1;);return n}var Qe=qe({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=qe({"&":"&","<":"<",">":">",'"':""","'":"'"});function en(t){return"\\"+oe[t]}function nn(t){return Qt.test(t)}function rn(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function on(t,e){return function(n){return t(e(n))}}function an(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function sn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function un(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}function cn(t){return nn(t)?function(t){for(var e=Zt.lastIndex=0;Zt.test(t);)++e;return e}(t):Be(t)}function ln(t){return nn(t)?function(t){return t.match(Zt)||[]}(t):function(t){return t.split("")}(t)}function dn(t){for(var e=t.length;e--&&rt.test(t.charAt(e)););return e}var pn=qe({"&":"&","<":"<",">":">",""":'"',"'":"'"}),hn=function t(e){var n,rt=(e=null==e?le:hn.defaults(le.Object(),e,hn.pick(le,ee))).Array,wt=e.Date,St=e.Error,_t=e.Function,It=e.Math,Ct=e.Object,Pt=e.RegExp,Ot=e.String,At=e.TypeError,kt=rt.prototype,Et=_t.prototype,jt=Ct.prototype,xt=e["__core-js_shared__"],Tt=Et.toString,zt=jt.hasOwnProperty,Ft=0,Bt=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Dt=jt.toString,Mt=Tt.call(Ct),Ut=le._,Nt=Pt("^"+Tt.call(zt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Rt=he?e.Buffer:r,Lt=e.Symbol,Vt=e.Uint8Array,qt=Rt?Rt.allocUnsafe:r,$t=on(Ct.getPrototypeOf,Ct),Wt=Ct.create,Ht=jt.propertyIsEnumerable,Gt=kt.splice,Yt=Lt?Lt.isConcatSpreadable:r,Zt=Lt?Lt.iterator:r,Qt=Lt?Lt.toStringTag:r,oe=function(){try{var t=uo(Ct,"defineProperty");return t({},"",{}),t}catch(t){}}(),ue=e.clearTimeout!==le.clearTimeout&&e.clearTimeout,ce=wt&&wt.now!==le.Date.now&&wt.now,de=e.setTimeout!==le.setTimeout&&e.setTimeout,pe=It.ceil,fe=It.floor,ye=Ct.getOwnPropertySymbols,Be=Rt?Rt.isBuffer:r,qe=e.isFinite,fn=kt.join,yn=on(Ct.keys,Ct),mn=It.max,vn=It.min,gn=wt.now,bn=e.parseInt,wn=It.random,Sn=kt.reverse,_n=uo(e,"DataView"),In=uo(e,"Map"),Cn=uo(e,"Promise"),Pn=uo(e,"Set"),On=uo(e,"WeakMap"),An=uo(Ct,"create"),kn=On&&new On,En={},jn=Mo(_n),xn=Mo(In),Tn=Mo(Cn),zn=Mo(Pn),Fn=Mo(On),Bn=Lt?Lt.prototype:r,Dn=Bn?Bn.valueOf:r,Mn=Bn?Bn.toString:r;function Un(t){if(ts(t)&&!qa(t)&&!(t instanceof Vn)){if(t instanceof Ln)return t;if(zt.call(t,"__wrapped__"))return Uo(t)}return new Ln(t)}var Nn=function(){function t(){}return function(e){if(!Qa(e))return{};if(Wt)return Wt(e);t.prototype=e;var n=new t;return t.prototype=r,n}}();function Rn(){}function Ln(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=r}function Vn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function qn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Wn;++e<n;)this.add(t[e])}function Gn(t){var e=this.__data__=new $n(t);this.size=e.size}function Yn(t,e){var n=qa(t),r=!n&&Va(t),i=!n&&!r&&Ga(t),o=!n&&!r&&!i&&us(t),a=n||r||i||o,s=a?He(t.length,Ot):[],u=s.length;for(var c in t)!e&&!zt.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||mo(c,u))||s.push(c);return s}function Kn(t){var e=t.length;return e?t[Wr(0,e-1)]:r}function Jn(t,e){return To(Oi(t),or(e,0,t.length))}function Zn(t){return To(Oi(t))}function Xn(t,e,n){(n!==r&&!Na(t[e],n)||n===r&&!(e in t))&&rr(t,e,n)}function Qn(t,e,n){var i=t[e];zt.call(t,e)&&Na(i,n)&&(n!==r||e in t)||rr(t,e,n)}function tr(t,e){for(var n=t.length;n--;)if(Na(t[n][0],e))return n;return-1}function er(t,e,n,r){return lr(t,function(t,i,o){e(r,t,n(t),o)}),r}function nr(t,e){return t&&Ai(e,js(e),t)}function rr(t,e,n){"__proto__"==e&&oe?oe(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ir(t,e){for(var n=-1,i=e.length,o=rt(i),a=null==t;++n<i;)o[n]=a?r:Ps(t,e[n]);return o}function or(t,e,n){return t==t&&(n!==r&&(t=t<=n?t:n),e!==r&&(t=t>=e?t:e)),t}function ar(t,e,n,i,o,a){var s,u=1&e,c=2&e,l=4&e;if(n&&(s=o?n(t,i,o,a):n(t)),s!==r)return s;if(!Qa(t))return t;var d=qa(t);if(d){if(s=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&zt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!u)return Oi(t,s)}else{var p=po(t),h=p==b||p==w;if(Ga(t))return wi(t,u);if(p==I||p==f||h&&!o){if(s=c||h?{}:fo(t),!u)return c?function(t,e){return Ai(t,lo(t),e)}(t,function(t,e){return t&&Ai(e,xs(e),t)}(s,t)):function(t,e){return Ai(t,co(t),e)}(t,nr(s,t))}else{if(!ie[p])return o?t:{};s=function(t,e,n){var r,i=t.constructor;switch(e){case j:return Si(t);case m:case v:return new i(+t);case x:return function(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case T:case z:case F:case B:case D:case M:case U:case N:case R:return _i(t,n);case S:return new i;case _:case A:return new i(t);case P:return function(t){var e=new t.constructor(t.source,dt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new i;case k:return r=t,Dn?Ct(Dn.call(r)):{}}}(t,p,u)}}a||(a=new Gn);var y=a.get(t);if(y)return y;a.set(t,s),os(t)?t.forEach(function(r){s.add(ar(r,e,n,r,t,a))}):es(t)&&t.forEach(function(r,i){s.set(i,ar(r,e,n,i,t,a))});var g=d?r:(l?c?eo:to:c?xs:js)(t);return Ce(g||t,function(r,i){g&&(r=t[i=r]),Qn(s,i,ar(r,e,n,i,t,a))}),s}function sr(t,e,n){var i=n.length;if(null==t)return!i;for(t=Ct(t);i--;){var o=n[i],a=e[o],s=t[o];if(s===r&&!(o in t)||!a(s))return!1}return!0}function ur(t,e,n){if("function"!=typeof t)throw new At(i);return ko(function(){t.apply(r,n)},e)}function cr(t,e,n,r){var i=-1,o=ke,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=je(e,Ye(n))),r?(o=Ee,a=!1):e.length>=200&&(o=Je,a=!1,e=new Hn(e));t:for(;++i<s;){var l=t[i],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var p=c;p--;)if(e[p]===d)continue t;u.push(l)}else o(e,d,r)||u.push(l)}return u}Un.templateSettings={escape:Y,evaluate:K,interpolate:J,variable:"",imports:{_:Un}},Un.prototype=Rn.prototype,Un.prototype.constructor=Un,Ln.prototype=Nn(Rn.prototype),Ln.prototype.constructor=Ln,Vn.prototype=Nn(Rn.prototype),Vn.prototype.constructor=Vn,qn.prototype.clear=function(){this.__data__=An?An(null):{},this.size=0},qn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},qn.prototype.get=function(t){var e=this.__data__;if(An){var n=e[t];return n===o?r:n}return zt.call(e,t)?e[t]:r},qn.prototype.has=function(t){var e=this.__data__;return An?e[t]!==r:zt.call(e,t)},qn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=An&&e===r?o:e,this},$n.prototype.clear=function(){this.__data__=[],this.size=0},$n.prototype.delete=function(t){var e=this.__data__,n=tr(e,t);return!(n<0||(n==e.length-1?e.pop():Gt.call(e,n,1),--this.size,0))},$n.prototype.get=function(t){var e=this.__data__,n=tr(e,t);return n<0?r:e[n][1]},$n.prototype.has=function(t){return tr(this.__data__,t)>-1},$n.prototype.set=function(t,e){var n=this.__data__,r=tr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Wn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(In||$n),string:new qn}},Wn.prototype.delete=function(t){var e=ao(this,t).delete(t);return this.size-=e?1:0,e},Wn.prototype.get=function(t){return ao(this,t).get(t)},Wn.prototype.has=function(t){return ao(this,t).has(t)},Wn.prototype.set=function(t,e){var n=ao(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Hn.prototype.add=Hn.prototype.push=function(t){return this.__data__.set(t,o),this},Hn.prototype.has=function(t){return this.__data__.has(t)},Gn.prototype.clear=function(){this.__data__=new $n,this.size=0},Gn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Gn.prototype.get=function(t){return this.__data__.get(t)},Gn.prototype.has=function(t){return this.__data__.has(t)},Gn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!In||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Wn(r)}return n.set(t,e),this.size=n.size,this};var lr=ji(gr),dr=ji(br,!0);function pr(t,e){var n=!0;return lr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function hr(t,e,n){for(var i=-1,o=t.length;++i<o;){var a=t[i],s=e(a);if(null!=s&&(u===r?s==s&&!ss(s):n(s,u)))var u=s,c=a}return c}function fr(t,e){var n=[];return lr(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function yr(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=yo),i||(i=[]);++o<a;){var s=t[o];e>0&&n(s)?e>1?yr(s,e-1,n,r,i):xe(i,s):r||(i[i.length]=s)}return i}var mr=xi(),vr=xi(!0);function gr(t,e){return t&&mr(t,e,js)}function br(t,e){return t&&vr(t,e,js)}function wr(t,e){return Ae(e,function(e){return Ja(t[e])})}function Sr(t,e){for(var n=0,i=(e=mi(e,t)).length;null!=t&&n<i;)t=t[Do(e[n++])];return n&&n==i?t:r}function _r(t,e,n){var r=e(t);return qa(t)?r:xe(r,n(t))}function Ir(t){return null==t?t===r?"[object Undefined]":"[object Null]":Qt&&Qt in Ct(t)?function(t){var e=zt.call(t,Qt),n=t[Qt];try{t[Qt]=r;var i=!0}catch(t){}var o=Dt.call(t);return i&&(e?t[Qt]=n:delete t[Qt]),o}(t):function(t){return Dt.call(t)}(t)}function Cr(t,e){return t>e}function Pr(t,e){return null!=t&&zt.call(t,e)}function Or(t,e){return null!=t&&e in Ct(t)}function Ar(t,e,n){for(var i=n?Ee:ke,o=t[0].length,a=t.length,s=a,u=rt(a),c=1/0,l=[];s--;){var d=t[s];s&&e&&(d=je(d,Ye(e))),c=vn(d.length,c),u[s]=!n&&(e||o>=120&&d.length>=120)?new Hn(s&&d):r}d=t[0];var p=-1,h=u[0];t:for(;++p<o&&l.length<c;){var f=d[p],y=e?e(f):f;if(f=n||0!==f?f:0,!(h?Je(h,y):i(l,y,n))){for(s=a;--s;){var m=u[s];if(!(m?Je(m,y):i(t[s],y,n)))continue t}h&&h.push(y),l.push(f)}}return l}function kr(t,e,n){var i=null==(t=Po(t,e=mi(e,t)))?t:t[Do(Ko(e))];return null==i?r:_e(i,t,n)}function Er(t){return ts(t)&&Ir(t)==f}function jr(t,e,n,i,o){return t===e||(null==t||null==e||!ts(t)&&!ts(e)?t!=t&&e!=e:function(t,e,n,i,o,a){var s=qa(t),u=qa(e),c=s?y:po(t),l=u?y:po(e),d=(c=c==f?I:c)==I,p=(l=l==f?I:l)==I,h=c==l;if(h&&Ga(t)){if(!Ga(e))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Gn),s||us(t)?Xi(t,e,n,i,o,a):function(t,e,n,r,i,o,a){switch(n){case x:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case j:return!(t.byteLength!=e.byteLength||!o(new Vt(t),new Vt(e)));case m:case v:case _:return Na(+t,+e);case g:return t.name==e.name&&t.message==e.message;case P:case A:return t==e+"";case S:var s=rn;case O:var u=1&r;if(s||(s=sn),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var l=Xi(s(t),s(e),r,i,o,a);return a.delete(t),l;case k:if(Dn)return Dn.call(t)==Dn.call(e)}return!1}(t,e,c,n,i,o,a);if(!(1&n)){var b=d&&zt.call(t,"__wrapped__"),w=p&&zt.call(e,"__wrapped__");if(b||w){var C=b?t.value():t,E=w?e.value():e;return a||(a=new Gn),o(C,E,n,i,a)}}return!!h&&(a||(a=new Gn),function(t,e,n,i,o,a){var s=1&n,u=to(t),c=u.length;if(c!=to(e).length&&!s)return!1;for(var l=c;l--;){var d=u[l];if(!(s?d in e:zt.call(e,d)))return!1}var p=a.get(t),h=a.get(e);if(p&&h)return p==e&&h==t;var f=!0;a.set(t,e),a.set(e,t);for(var y=s;++l<c;){var m=t[d=u[l]],v=e[d];if(i)var g=s?i(v,m,d,e,t,a):i(m,v,d,t,e,a);if(!(g===r?m===v||o(m,v,n,i,a):g)){f=!1;break}y||(y="constructor"==d)}if(f&&!y){var b=t.constructor,w=e.constructor;b==w||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w||(f=!1)}return a.delete(t),a.delete(e),f}(t,e,n,i,o,a))}(t,e,n,i,jr,o))}function xr(t,e,n,i){var o=n.length,a=o,s=!i;if(null==t)return!a;for(t=Ct(t);o--;){var u=n[o];if(s&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=n[o])[0],l=t[c],d=u[1];if(s&&u[2]){if(l===r&&!(c in t))return!1}else{var p=new Gn;if(i)var h=i(l,d,c,t,e,p);if(!(h===r?jr(d,l,3,i,p):h))return!1}}return!0}function Tr(t){return!(!Qa(t)||(e=t,Bt&&Bt in e))&&(Ja(t)?Nt:ft).test(Mo(t));var e}function zr(t){return"function"==typeof t?t:null==t?nu:"object"==typeof t?qa(t)?Ur(t[0],t[1]):Mr(t):du(t)}function Fr(t){if(!So(t))return yn(t);var e=[];for(var n in Ct(t))zt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Br(t,e){return t<e}function Dr(t,e){var n=-1,r=Wa(t)?rt(t.length):[];return lr(t,function(t,i,o){r[++n]=e(t,i,o)}),r}function Mr(t){var e=so(t);return 1==e.length&&e[0][2]?Io(e[0][0],e[0][1]):function(n){return n===t||xr(n,t,e)}}function Ur(t,e){return go(t)&&_o(e)?Io(Do(t),e):function(n){var i=Ps(n,t);return i===r&&i===e?Os(n,t):jr(e,i,3)}}function Nr(t,e,n,i,o){t!==e&&mr(e,function(a,s){if(o||(o=new Gn),Qa(a))!function(t,e,n,i,o,a,s){var u=Oo(t,n),c=Oo(e,n),l=s.get(c);if(l)Xn(t,n,l);else{var d=a?a(u,c,n+"",t,e,s):r,p=d===r;if(p){var h=qa(c),f=!h&&Ga(c),y=!h&&!f&&us(c);d=c,h||f||y?qa(u)?d=u:Ha(u)?d=Oi(u):f?(p=!1,d=wi(c,!0)):y?(p=!1,d=_i(c,!0)):d=[]:rs(c)||Va(c)?(d=u,Va(u)?d=ms(u):Qa(u)&&!Ja(u)||(d=fo(c))):p=!1}p&&(s.set(c,d),o(d,c,i,a,s),s.delete(c)),Xn(t,n,d)}}(t,e,s,n,Nr,i,o);else{var u=i?i(Oo(t,s),a,s+"",t,e,o):r;u===r&&(u=a),Xn(t,s,u)}},xs)}function Rr(t,e){var n=t.length;if(n)return mo(e+=e<0?n:0,n)?t[e]:r}function Lr(t,e,n){e=e.length?je(e,function(t){return qa(t)?function(e){return Sr(e,1===t.length?t[0]:t)}:t}):[nu];var r=-1;e=je(e,Ye(oo()));var i=Dr(t,function(t,n,i){var o=je(e,function(e){return e(t)});return{criteria:o,index:++r,value:t}});return function(t){var e=t.length;for(t.sort(function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;++r<a;){var u=Ii(i[r],o[r]);if(u)return r>=s?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)});e--;)t[e]=t[e].value;return t}(i)}function Vr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],s=Sr(t,a);n(s,a)&&Jr(o,mi(a,t),s)}return o}function qr(t,e,n,r){var i=r?Ne:Ue,o=-1,a=e.length,s=t;for(t===e&&(e=Oi(e)),n&&(s=je(t,Ye(n)));++o<a;)for(var u=0,c=e[o],l=n?n(c):c;(u=i(s,l,u,r))>-1;)s!==t&&Gt.call(s,u,1),Gt.call(t,u,1);return t}function $r(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;mo(i)?Gt.call(t,i,1):ui(t,i)}}return t}function Wr(t,e){return t+fe(wn()*(e-t+1))}function Hr(t,e){var n="";if(!t||e<1||e>l)return n;do{e%2&&(n+=t),(e=fe(e/2))&&(t+=t)}while(e);return n}function Gr(t,e){return Eo(Co(t,e,nu),t+"")}function Yr(t){return Kn(Ns(t))}function Kr(t,e){var n=Ns(t);return To(n,or(e,0,n.length))}function Jr(t,e,n,i){if(!Qa(t))return t;for(var o=-1,a=(e=mi(e,t)).length,s=a-1,u=t;null!=u&&++o<a;){var c=Do(e[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=s){var d=u[c];(l=i?i(d,c,u):r)===r&&(l=Qa(d)?d:mo(e[o+1])?[]:{})}Qn(u,c,l),u=u[c]}return t}var Zr=kn?function(t,e){return kn.set(t,e),t}:nu,Xr=oe?function(t,e){return oe(t,"toString",{configurable:!0,enumerable:!1,value:Qs(e),writable:!0})}:nu;function Qr(t){return To(Ns(t))}function ti(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=rt(i);++r<i;)o[r]=t[r+e];return o}function ei(t,e){var n;return lr(t,function(t,r,i){return!(n=e(t,r,i))}),!!n}function ni(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=t[o];null!==a&&!ss(a)&&(n?a<=e:a<e)?r=o+1:i=o}return i}return ri(t,e,nu,n)}function ri(t,e,n,i){var o=0,a=null==t?0:t.length;if(0===a)return 0;for(var s=(e=n(e))!=e,u=null===e,c=ss(e),l=e===r;o<a;){var d=fe((o+a)/2),p=n(t[d]),h=p!==r,f=null===p,y=p==p,m=ss(p);if(s)var v=i||y;else v=l?y&&(i||h):u?y&&h&&(i||!f):c?y&&h&&!f&&(i||!m):!f&&!m&&(i?p<=e:p<e);v?o=d+1:a=d}return vn(a,4294967294)}function ii(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n],s=e?e(a):a;if(!n||!Na(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function oi(t){return"number"==typeof t?t:ss(t)?d:+t}function ai(t){if("string"==typeof t)return t;if(qa(t))return je(t,ai)+"";if(ss(t))return Mn?Mn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function si(t,e,n){var r=-1,i=ke,o=t.length,a=!0,s=[],u=s;if(n)a=!1,i=Ee;else if(o>=200){var c=e?null:Hi(t);if(c)return sn(c);a=!1,i=Je,u=new Hn}else u=e?[]:s;t:for(;++r<o;){var l=t[r],d=e?e(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var p=u.length;p--;)if(u[p]===d)continue t;e&&u.push(d),s.push(l)}else i(u,d,n)||(u!==s&&u.push(d),s.push(l))}return s}function ui(t,e){return null==(t=Po(t,e=mi(e,t)))||delete t[Do(Ko(e))]}function ci(t,e,n,r){return Jr(t,e,n(Sr(t,e)),r)}function li(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ti(t,r?0:o,r?o+1:i):ti(t,r?o+1:0,r?i:o)}function di(t,e){var n=t;return n instanceof Vn&&(n=n.value()),Te(e,function(t,e){return e.func.apply(e.thisArg,xe([t],e.args))},n)}function pi(t,e,n){var r=t.length;if(r<2)return r?si(t[0]):[];for(var i=-1,o=rt(r);++i<r;)for(var a=t[i],s=-1;++s<r;)s!=i&&(o[i]=cr(o[i]||a,t[s],e,n));return si(yr(o,1),e,n)}function hi(t,e,n){for(var i=-1,o=t.length,a=e.length,s={};++i<o;){var u=i<a?e[i]:r;n(s,t[i],u)}return s}function fi(t){return Ha(t)?t:[]}function yi(t){return"function"==typeof t?t:nu}function mi(t,e){return qa(t)?t:go(t,e)?[t]:Bo(vs(t))}var vi=Gr;function gi(t,e,n){var i=t.length;return n=n===r?i:n,!e&&n>=i?t:ti(t,e,n)}var bi=ue||function(t){return le.clearTimeout(t)};function wi(t,e){if(e)return t.slice();var n=t.length,r=qt?qt(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}function _i(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ii(t,e){if(t!==e){var n=t!==r,i=null===t,o=t==t,a=ss(t),s=e!==r,u=null===e,c=e==e,l=ss(e);if(!u&&!l&&!a&&t>e||a&&s&&c&&!u&&!l||i&&s&&c||!n&&c||!o)return 1;if(!i&&!a&&!l&&t<e||l&&n&&o&&!i&&!a||u&&n&&o||!s&&o||!c)return-1}return 0}function Ci(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,u=e.length,c=mn(o-a,0),l=rt(u+c),d=!r;++s<u;)l[s]=e[s];for(;++i<a;)(d||i<o)&&(l[n[i]]=t[i]);for(;c--;)l[s++]=t[i++];return l}function Pi(t,e,n,r){for(var i=-1,o=t.length,a=-1,s=n.length,u=-1,c=e.length,l=mn(o-s,0),d=rt(l+c),p=!r;++i<l;)d[i]=t[i];for(var h=i;++u<c;)d[h+u]=e[u];for(;++a<s;)(p||i<o)&&(d[h+n[a]]=t[i++]);return d}function Oi(t,e){var n=-1,r=t.length;for(e||(e=rt(r));++n<r;)e[n]=t[n];return e}function Ai(t,e,n,i){var o=!n;n||(n={});for(var a=-1,s=e.length;++a<s;){var u=e[a],c=i?i(n[u],t[u],u,n,t):r;c===r&&(c=t[u]),o?rr(n,u,c):Qn(n,u,c)}return n}function ki(t,e){return function(n,r){var i=qa(n)?Ie:er,o=e?e():{};return i(n,t,oo(r,2),o)}}function Ei(t){return Gr(function(e,n){var i=-1,o=n.length,a=o>1?n[o-1]:r,s=o>2?n[2]:r;for(a=t.length>3&&"function"==typeof a?(o--,a):r,s&&vo(n[0],n[1],s)&&(a=o<3?r:a,o=1),e=Ct(e);++i<o;){var u=n[i];u&&t(e,u,i,a)}return e})}function ji(t,e){return function(n,r){if(null==n)return n;if(!Wa(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=Ct(n);(e?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function xi(t){return function(e,n,r){for(var i=-1,o=Ct(e),a=r(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===n(o[u],u,o))break}return e}}function Ti(t){return function(e){var n=nn(e=vs(e))?ln(e):r,i=n?n[0]:e.charAt(0),o=n?gi(n,1).join(""):e.slice(1);return i[t]()+o}}function zi(t){return function(e){return Te(Js(Vs(e).replace(Kt,"")),t,"")}}function Fi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Nn(t.prototype),r=t.apply(n,e);return Qa(r)?r:n}}function Bi(t){return function(e,n,i){var o=Ct(e);if(!Wa(e)){var a=oo(n,3);e=js(e),n=function(t){return a(o[t],t,o)}}var s=t(e,n,i);return s>-1?o[a?e[s]:s]:r}}function Di(t){return Qi(function(e){var n=e.length,o=n,a=Ln.prototype.thru;for(t&&e.reverse();o--;){var s=e[o];if("function"!=typeof s)throw new At(i);if(a&&!u&&"wrapper"==ro(s))var u=new Ln([],!0)}for(o=u?o:n;++o<n;){var c=ro(s=e[o]),l="wrapper"==c?no(s):r;u=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ro(l[0])].apply(u,l[3]):1==s.length&&bo(s)?u[c]():u.thru(s)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&qa(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}})}function Mi(t,e,n,i,o,a,s,c,l,d){var p=e&u,h=1&e,f=2&e,y=24&e,m=512&e,v=f?r:Fi(t);return function u(){for(var g=arguments.length,b=rt(g),w=g;w--;)b[w]=arguments[w];if(y)var S=io(u),_=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,S);if(i&&(b=Ci(b,i,o,y)),a&&(b=Pi(b,a,s,y)),g-=_,y&&g<d){var I=an(b,S);return $i(t,e,Mi,u.placeholder,n,b,I,c,l,d-g)}var C=h?n:this,P=f?C[t]:t;return g=b.length,c?b=function(t,e){for(var n=t.length,i=vn(e.length,n),o=Oi(t);i--;){var a=e[i];t[i]=mo(a,n)?o[a]:r}return t}(b,c):m&&g>1&&b.reverse(),p&&l<g&&(b.length=l),this&&this!==le&&this instanceof u&&(P=v||Fi(P)),P.apply(C,b)}}function Ui(t,e){return function(n,r){return function(t,e,n,r){return gr(t,function(t,i,o){e(r,n(t),i,o)}),r}(n,t,e(r),{})}}function Ni(t,e){return function(n,i){var o;if(n===r&&i===r)return e;if(n!==r&&(o=n),i!==r){if(o===r)return i;"string"==typeof n||"string"==typeof i?(n=ai(n),i=ai(i)):(n=oi(n),i=oi(i)),o=t(n,i)}return o}}function Ri(t){return Qi(function(e){return e=je(e,Ye(oo())),Gr(function(n){var r=this;return t(e,function(t){return _e(t,r,n)})})})}function Li(t,e){var n=(e=e===r?" ":ai(e)).length;if(n<2)return n?Hr(e,t):e;var i=Hr(e,pe(t/cn(e)));return nn(e)?gi(ln(i),0,t).join(""):i.slice(0,t)}function Vi(t){return function(e,n,i){return i&&"number"!=typeof i&&vo(e,n,i)&&(n=i=r),e=ps(e),n===r?(n=e,e=0):n=ps(n),function(t,e,n,r){for(var i=-1,o=mn(pe((e-t)/(n||1)),0),a=rt(o);o--;)a[r?o:++i]=t,t+=n;return a}(e,n,i=i===r?e<n?1:-1:ps(i),t)}}function qi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ys(e),n=ys(n)),t(e,n)}}function $i(t,e,n,i,o,a,u,c,l,d){var p=8&e;e|=p?s:64,4&(e&=~(p?64:s))||(e&=-4);var h=[t,e,o,p?a:r,p?u:r,p?r:a,p?r:u,c,l,d],f=n.apply(r,h);return bo(t)&&Ao(f,h),f.placeholder=i,jo(f,t,e)}function Wi(t){var e=It[t];return function(t,n){if(t=ys(t),(n=null==n?0:vn(hs(n),292))&&qe(t)){var r=(vs(t)+"e").split("e");return+((r=(vs(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Hi=Pn&&1/sn(new Pn([,-0]))[1]==c?function(t){return new Pn(t)}:su;function Gi(t){return function(e){var n=po(e);return n==S?rn(e):n==O?un(e):function(t,e){return je(e,function(e){return[e,t[e]]})}(e,t(e))}}function Yi(t,e,n,o,c,l,d,p){var h=2&e;if(!h&&"function"!=typeof t)throw new At(i);var f=o?o.length:0;if(f||(e&=-97,o=c=r),d=d===r?d:mn(hs(d),0),p=p===r?p:hs(p),f-=c?c.length:0,64&e){var y=o,m=c;o=c=r}var v=h?r:no(t),g=[t,e,n,o,c,y,m,l,d,p];if(v&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==u&&8==n||r==u&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var c=e[3];if(c){var l=t[3];t[3]=l?Ci(l,c,e[4]):c,t[4]=l?an(t[3],a):e[4]}(c=e[5])&&(l=t[5],t[5]=l?Pi(l,c,e[6]):c,t[6]=l?an(t[5],a):e[6]),(c=e[7])&&(t[7]=c),r&u&&(t[8]=null==t[8]?e[8]:vn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(g,v),t=g[0],e=g[1],n=g[2],o=g[3],c=g[4],!(p=g[9]=g[9]===r?h?0:t.length:mn(g[9]-f,0))&&24&e&&(e&=-25),e&&1!=e)b=8==e||16==e?function(t,e,n){var i=Fi(t);return function o(){for(var a=arguments.length,s=rt(a),u=a,c=io(o);u--;)s[u]=arguments[u];var l=a<3&&s[0]!==c&&s[a-1]!==c?[]:an(s,c);return(a-=l.length)<n?$i(t,e,Mi,o.placeholder,r,s,l,r,r,n-a):_e(this&&this!==le&&this instanceof o?i:t,this,s)}}(t,e,p):e!=s&&33!=e||c.length?Mi.apply(r,g):function(t,e,n,r){var i=1&e,o=Fi(t);return function e(){for(var a=-1,s=arguments.length,u=-1,c=r.length,l=rt(c+s),d=this&&this!==le&&this instanceof e?o:t;++u<c;)l[u]=r[u];for(;s--;)l[u++]=arguments[++a];return _e(d,i?n:this,l)}}(t,e,n,o);else var b=function(t,e,n){var r=1&e,i=Fi(t);return function e(){return(this&&this!==le&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return jo((v?Zr:Ao)(b,g),t,e)}function Ki(t,e,n,i){return t===r||Na(t,jt[n])&&!zt.call(i,n)?e:t}function Ji(t,e,n,i,o,a){return Qa(t)&&Qa(e)&&(a.set(e,t),Nr(t,e,r,Ji,a),a.delete(e)),t}function Zi(t){return rs(t)?r:t}function Xi(t,e,n,i,o,a){var s=1&n,u=t.length,c=e.length;if(u!=c&&!(s&&c>u))return!1;var l=a.get(t),d=a.get(e);if(l&&d)return l==e&&d==t;var p=-1,h=!0,f=2&n?new Hn:r;for(a.set(t,e),a.set(e,t);++p<u;){var y=t[p],m=e[p];if(i)var v=s?i(m,y,p,e,t,a):i(y,m,p,t,e,a);if(v!==r){if(v)continue;h=!1;break}if(f){if(!Fe(e,function(t,e){if(!Je(f,e)&&(y===t||o(y,t,n,i,a)))return f.push(e)})){h=!1;break}}else if(y!==m&&!o(y,m,n,i,a)){h=!1;break}}return a.delete(t),a.delete(e),h}function Qi(t){return Eo(Co(t,r,$o),t+"")}function to(t){return _r(t,js,co)}function eo(t){return _r(t,xs,lo)}var no=kn?function(t){return kn.get(t)}:su;function ro(t){for(var e=t.name+"",n=En[e],r=zt.call(En,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function io(t){return(zt.call(Un,"placeholder")?Un:t).placeholder}function oo(){var t=Un.iteratee||ru;return t=t===ru?zr:t,arguments.length?t(arguments[0],arguments[1]):t}function ao(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function so(t){for(var e=js(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,_o(i)]}return e}function uo(t,e){var n=function(t,e){return null==t?r:t[e]}(t,e);return Tr(n)?n:r}var co=ye?function(t){return null==t?[]:(t=Ct(t),Ae(ye(t),function(e){return Ht.call(t,e)}))}:fu,lo=ye?function(t){for(var e=[];t;)xe(e,co(t)),t=$t(t);return e}:fu,po=Ir;function ho(t,e,n){for(var r=-1,i=(e=mi(e,t)).length,o=!1;++r<i;){var a=Do(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&Xa(i)&&mo(a,i)&&(qa(t)||Va(t))}function fo(t){return"function"!=typeof t.constructor||So(t)?{}:Nn($t(t))}function yo(t){return qa(t)||Va(t)||!!(Yt&&t&&t[Yt])}function mo(t,e){var n=typeof t;return!!(e=null==e?l:e)&&("number"==n||"symbol"!=n&&mt.test(t))&&t>-1&&t%1==0&&t<e}function vo(t,e,n){if(!Qa(n))return!1;var r=typeof e;return!!("number"==r?Wa(n)&&mo(e,n.length):"string"==r&&e in n)&&Na(n[e],t)}function go(t,e){if(qa(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ss(t))||X.test(t)||!Z.test(t)||null!=e&&t in Ct(e)}function bo(t){var e=ro(t),n=Un[e];if("function"!=typeof n||!(e in Vn.prototype))return!1;if(t===n)return!0;var r=no(n);return!!r&&t===r[0]}(_n&&po(new _n(new ArrayBuffer(1)))!=x||In&&po(new In)!=S||Cn&&po(Cn.resolve())!=C||Pn&&po(new Pn)!=O||On&&po(new On)!=E)&&(po=function(t){var e=Ir(t),n=e==I?t.constructor:r,i=n?Mo(n):"";if(i)switch(i){case jn:return x;case xn:return S;case Tn:return C;case zn:return O;case Fn:return E}return e});var wo=xt?Ja:yu;function So(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function _o(t){return t==t&&!Qa(t)}function Io(t,e){return function(n){return null!=n&&n[t]===e&&(e!==r||t in Ct(n))}}function Co(t,e,n){return e=mn(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=mn(r.length-e,0),a=rt(o);++i<o;)a[i]=r[e+i];i=-1;for(var s=rt(e+1);++i<e;)s[i]=r[i];return s[e]=n(a),_e(t,this,s)}}function Po(t,e){return e.length<2?t:Sr(t,ti(e,0,-1))}function Oo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ao=xo(Zr),ko=de||function(t,e){return le.setTimeout(t,e)},Eo=xo(Xr);function jo(t,e,n){var r=e+"";return Eo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Ce(h,function(n){var r="_."+n[0];e&n[1]&&!ke(t,r)&&t.push(r)}),t.sort()}(function(t){var e=t.match(ot);return e?e[1].split(at):[]}(r),n)))}function xo(t){var e=0,n=0;return function(){var i=gn(),o=16-(i-n);if(n=i,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(r,arguments)}}function To(t,e){var n=-1,i=t.length,o=i-1;for(e=e===r?i:e;++n<e;){var a=Wr(n,o),s=t[a];t[a]=t[n],t[n]=s}return t.length=e,t}var zo,Fo,Bo=(zo=za(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Q,function(t,n,r,i){e.push(r?i.replace(ct,"$1"):n||t)}),e},function(t){return 500===Fo.size&&Fo.clear(),t}),Fo=zo.cache,zo);function Do(t){if("string"==typeof t||ss(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Mo(t){if(null!=t){try{return Tt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Uo(t){if(t instanceof Vn)return t.clone();var e=new Ln(t.__wrapped__,t.__chain__);return e.__actions__=Oi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var No=Gr(function(t,e){return Ha(t)?cr(t,yr(e,1,Ha,!0)):[]}),Ro=Gr(function(t,e){var n=Ko(e);return Ha(n)&&(n=r),Ha(t)?cr(t,yr(e,1,Ha,!0),oo(n,2)):[]}),Lo=Gr(function(t,e){var n=Ko(e);return Ha(n)&&(n=r),Ha(t)?cr(t,yr(e,1,Ha,!0),r,n):[]});function Vo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=mn(r+i,0)),Me(t,oo(e,3),i)}function qo(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i-1;return n!==r&&(o=hs(n),o=n<0?mn(i+o,0):vn(o,i-1)),Me(t,oo(e,3),o,!0)}function $o(t){return null!=t&&t.length?yr(t,1):[]}function Wo(t){return t&&t.length?t[0]:r}var Ho=Gr(function(t){var e=je(t,fi);return e.length&&e[0]===t[0]?Ar(e):[]}),Go=Gr(function(t){var e=Ko(t),n=je(t,fi);return e===Ko(n)?e=r:n.pop(),n.length&&n[0]===t[0]?Ar(n,oo(e,2)):[]}),Yo=Gr(function(t){var e=Ko(t),n=je(t,fi);return(e="function"==typeof e?e:r)&&n.pop(),n.length&&n[0]===t[0]?Ar(n,r,e):[]});function Ko(t){var e=null==t?0:t.length;return e?t[e-1]:r}var Jo=Gr(Zo);function Zo(t,e){return t&&t.length&&e&&e.length?qr(t,e):t}var Xo=Qi(function(t,e){var n=null==t?0:t.length,r=ir(t,e);return $r(t,je(e,function(t){return mo(t,n)?+t:t}).sort(Ii)),r});function Qo(t){return null==t?t:Sn.call(t)}var ta=Gr(function(t){return si(yr(t,1,Ha,!0))}),ea=Gr(function(t){var e=Ko(t);return Ha(e)&&(e=r),si(yr(t,1,Ha,!0),oo(e,2))}),na=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,si(yr(t,1,Ha,!0),r,e)});function ra(t){if(!t||!t.length)return[];var e=0;return t=Ae(t,function(t){if(Ha(t))return e=mn(t.length,e),!0}),He(e,function(e){return je(t,Ve(e))})}function ia(t,e){if(!t||!t.length)return[];var n=ra(t);return null==e?n:je(n,function(t){return _e(e,r,t)})}var oa=Gr(function(t,e){return Ha(t)?cr(t,e):[]}),aa=Gr(function(t){return pi(Ae(t,Ha))}),sa=Gr(function(t){var e=Ko(t);return Ha(e)&&(e=r),pi(Ae(t,Ha),oo(e,2))}),ua=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,pi(Ae(t,Ha),r,e)}),ca=Gr(ra),la=Gr(function(t){var e=t.length,n=e>1?t[e-1]:r;return n="function"==typeof n?(t.pop(),n):r,ia(t,n)});function da(t){var e=Un(t);return e.__chain__=!0,e}function pa(t,e){return e(t)}var ha=Qi(function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,o=function(e){return ir(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Vn&&mo(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:pa,args:[o],thisArg:r}),new Ln(i,this.__chain__).thru(function(t){return e&&!t.length&&t.push(r),t})):this.thru(o)}),fa=ki(function(t,e,n){zt.call(t,n)?++t[n]:rr(t,n,1)}),ya=Bi(Vo),ma=Bi(qo);function va(t,e){return(qa(t)?Ce:lr)(t,oo(e,3))}function ga(t,e){return(qa(t)?Pe:dr)(t,oo(e,3))}var ba=ki(function(t,e,n){zt.call(t,n)?t[n].push(e):rr(t,n,[e])}),wa=Gr(function(t,e,n){var r=-1,i="function"==typeof e,o=Wa(t)?rt(t.length):[];return lr(t,function(t){o[++r]=i?_e(e,t,n):kr(t,e,n)}),o}),Sa=ki(function(t,e,n){rr(t,n,e)});function _a(t,e){return(qa(t)?je:Dr)(t,oo(e,3))}var Ia=ki(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),Ca=Gr(function(t,e){if(null==t)return[];var n=e.length;return n>1&&vo(t,e[0],e[1])?e=[]:n>2&&vo(e[0],e[1],e[2])&&(e=[e[0]]),Lr(t,yr(e,1),[])}),Pa=ce||function(){return le.Date.now()};function Oa(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,Yi(t,u,r,r,r,r,e)}function Aa(t,e){var n;if("function"!=typeof e)throw new At(i);return t=hs(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=r),n}}var ka=Gr(function(t,e,n){var r=1;if(n.length){var i=an(n,io(ka));r|=s}return Yi(t,r,e,n,i)}),Ea=Gr(function(t,e,n){var r=3;if(n.length){var i=an(n,io(Ea));r|=s}return Yi(e,r,t,n,i)});function ja(t,e,n){var o,a,s,u,c,l,d=0,p=!1,h=!1,f=!0;if("function"!=typeof t)throw new At(i);function y(e){var n=o,i=a;return o=a=r,d=e,u=t.apply(i,n)}function m(t){var n=t-l;return l===r||n>=e||n<0||h&&t-d>=s}function v(){var t=Pa();if(m(t))return g(t);c=ko(v,function(t){var n=e-(t-l);return h?vn(n,s-(t-d)):n}(t))}function g(t){return c=r,f&&o?y(t):(o=a=r,u)}function b(){var t=Pa(),n=m(t);if(o=arguments,a=this,l=t,n){if(c===r)return function(t){return d=t,c=ko(v,e),p?y(t):u}(l);if(h)return bi(c),c=ko(v,e),y(l)}return c===r&&(c=ko(v,e)),u}return e=ys(e)||0,Qa(n)&&(p=!!n.leading,s=(h="maxWait"in n)?mn(ys(n.maxWait)||0,e):s,f="trailing"in n?!!n.trailing:f),b.cancel=function(){c!==r&&bi(c),d=0,o=l=a=c=r},b.flush=function(){return c===r?u:g(Pa())},b}var xa=Gr(function(t,e){return ur(t,1,e)}),Ta=Gr(function(t,e,n){return ur(t,ys(e)||0,n)});function za(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new At(i);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(za.Cache||Wn),n}function Fa(t){if("function"!=typeof t)throw new At(i);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}za.Cache=Wn;var Ba=vi(function(t,e){var n=(e=1==e.length&&qa(e[0])?je(e[0],Ye(oo())):je(yr(e,1),Ye(oo()))).length;return Gr(function(r){for(var i=-1,o=vn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return _e(t,this,r)})}),Da=Gr(function(t,e){var n=an(e,io(Da));return Yi(t,s,r,e,n)}),Ma=Gr(function(t,e){var n=an(e,io(Ma));return Yi(t,64,r,e,n)}),Ua=Qi(function(t,e){return Yi(t,256,r,r,r,e)});function Na(t,e){return t===e||t!=t&&e!=e}var Ra=qi(Cr),La=qi(function(t,e){return t>=e}),Va=Er(function(){return arguments}())?Er:function(t){return ts(t)&&zt.call(t,"callee")&&!Ht.call(t,"callee")},qa=rt.isArray,$a=me?Ye(me):function(t){return ts(t)&&Ir(t)==j};function Wa(t){return null!=t&&Xa(t.length)&&!Ja(t)}function Ha(t){return ts(t)&&Wa(t)}var Ga=Be||yu,Ya=ve?Ye(ve):function(t){return ts(t)&&Ir(t)==v};function Ka(t){if(!ts(t))return!1;var e=Ir(t);return e==g||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!rs(t)}function Ja(t){if(!Qa(t))return!1;var e=Ir(t);return e==b||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Za(t){return"number"==typeof t&&t==hs(t)}function Xa(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=l}function Qa(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ts(t){return null!=t&&"object"==typeof t}var es=ge?Ye(ge):function(t){return ts(t)&&po(t)==S};function ns(t){return"number"==typeof t||ts(t)&&Ir(t)==_}function rs(t){if(!ts(t)||Ir(t)!=I)return!1;var e=$t(t);if(null===e)return!0;var n=zt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Tt.call(n)==Mt}var is=be?Ye(be):function(t){return ts(t)&&Ir(t)==P},os=we?Ye(we):function(t){return ts(t)&&po(t)==O};function as(t){return"string"==typeof t||!qa(t)&&ts(t)&&Ir(t)==A}function ss(t){return"symbol"==typeof t||ts(t)&&Ir(t)==k}var us=Se?Ye(Se):function(t){return ts(t)&&Xa(t.length)&&!!re[Ir(t)]},cs=qi(Br),ls=qi(function(t,e){return t<=e});function ds(t){if(!t)return[];if(Wa(t))return as(t)?ln(t):Oi(t);if(Zt&&t[Zt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Zt]());var e=po(t);return(e==S?rn:e==O?sn:Ns)(t)}function ps(t){return t?(t=ys(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function hs(t){var e=ps(t),n=e%1;return e==e?n?e-n:e:0}function fs(t){return t?or(hs(t),0,p):0}function ys(t){if("number"==typeof t)return t;if(ss(t))return d;if(Qa(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Qa(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ge(t);var n=ht.test(t);return n||yt.test(t)?se(t.slice(2),n?2:8):pt.test(t)?d:+t}function ms(t){return Ai(t,xs(t))}function vs(t){return null==t?"":ai(t)}var gs=Ei(function(t,e){if(So(e)||Wa(e))Ai(e,js(e),t);else for(var n in e)zt.call(e,n)&&Qn(t,n,e[n])}),bs=Ei(function(t,e){Ai(e,xs(e),t)}),ws=Ei(function(t,e,n,r){Ai(e,xs(e),t,r)}),Ss=Ei(function(t,e,n,r){Ai(e,js(e),t,r)}),_s=Qi(ir),Is=Gr(function(t,e){t=Ct(t);var n=-1,i=e.length,o=i>2?e[2]:r;for(o&&vo(e[0],e[1],o)&&(i=1);++n<i;)for(var a=e[n],s=xs(a),u=-1,c=s.length;++u<c;){var l=s[u],d=t[l];(d===r||Na(d,jt[l])&&!zt.call(t,l))&&(t[l]=a[l])}return t}),Cs=Gr(function(t){return t.push(r,Ji),_e(zs,r,t)});function Ps(t,e,n){var i=null==t?r:Sr(t,e);return i===r?n:i}function Os(t,e){return null!=t&&ho(t,e,Or)}var As=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Dt.call(e)),t[e]=n},Qs(nu)),ks=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Dt.call(e)),zt.call(t,e)?t[e].push(n):t[e]=[n]},oo),Es=Gr(kr);function js(t){return Wa(t)?Yn(t):Fr(t)}function xs(t){return Wa(t)?Yn(t,!0):function(t){if(!Qa(t))return function(t){var e=[];if(null!=t)for(var n in Ct(t))e.push(n);return e}(t);var e=So(t),n=[];for(var r in t)("constructor"!=r||!e&&zt.call(t,r))&&n.push(r);return n}(t)}var Ts=Ei(function(t,e,n){Nr(t,e,n)}),zs=Ei(function(t,e,n,r){Nr(t,e,n,r)}),Fs=Qi(function(t,e){var n={};if(null==t)return n;var r=!1;e=je(e,function(e){return e=mi(e,t),r||(r=e.length>1),e}),Ai(t,eo(t),n),r&&(n=ar(n,7,Zi));for(var i=e.length;i--;)ui(n,e[i]);return n}),Bs=Qi(function(t,e){return null==t?{}:function(t,e){return Vr(t,e,function(e,n){return Os(t,n)})}(t,e)});function Ds(t,e){if(null==t)return{};var n=je(eo(t),function(t){return[t]});return e=oo(e),Vr(t,n,function(t,n){return e(t,n[0])})}var Ms=Gi(js),Us=Gi(xs);function Ns(t){return null==t?[]:Ke(t,js(t))}var Rs=zi(function(t,e,n){return e=e.toLowerCase(),t+(n?Ls(e):e)});function Ls(t){return Ks(vs(t).toLowerCase())}function Vs(t){return(t=vs(t))&&t.replace(vt,Qe).replace(Jt,"")}var qs=zi(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),$s=zi(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),Ws=Ti("toLowerCase"),Hs=zi(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}),Gs=zi(function(t,e,n){return t+(n?" ":"")+Ks(e)}),Ys=zi(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Ks=Ti("toUpperCase");function Js(t,e,n){return t=vs(t),(e=n?r:e)===r?function(t){return te.test(t)}(t)?function(t){return t.match(Xt)||[]}(t):function(t){return t.match(st)||[]}(t):t.match(e)||[]}var Zs=Gr(function(t,e){try{return _e(t,r,e)}catch(t){return Ka(t)?t:new St(t)}}),Xs=Qi(function(t,e){return Ce(e,function(e){e=Do(e),rr(t,e,ka(t[e],t))}),t});function Qs(t){return function(){return t}}var tu=Di(),eu=Di(!0);function nu(t){return t}function ru(t){return zr("function"==typeof t?t:ar(t,1))}var iu=Gr(function(t,e){return function(n){return kr(n,t,e)}}),ou=Gr(function(t,e){return function(n){return kr(t,n,e)}});function au(t,e,n){var r=js(e),i=wr(e,r);null!=n||Qa(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=wr(e,js(e)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ja(t);return Ce(i,function(n){var r=e[n];t[n]=r,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Oi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,xe([this.value()],arguments))})}),t}function su(){}var uu=Ri(je),cu=Ri(Oe),lu=Ri(Fe);function du(t){return go(t)?Ve(Do(t)):function(t){return function(e){return Sr(e,t)}}(t)}var pu=Vi(),hu=Vi(!0);function fu(){return[]}function yu(){return!1}var mu,vu=Ni(function(t,e){return t+e},0),gu=Wi("ceil"),bu=Ni(function(t,e){return t/e},1),wu=Wi("floor"),Su=Ni(function(t,e){return t*e},1),_u=Wi("round"),Iu=Ni(function(t,e){return t-e},0);return Un.after=function(t,e){if("function"!=typeof e)throw new At(i);return t=hs(t),function(){if(--t<1)return e.apply(this,arguments)}},Un.ary=Oa,Un.assign=gs,Un.assignIn=bs,Un.assignInWith=ws,Un.assignWith=Ss,Un.at=_s,Un.before=Aa,Un.bind=ka,Un.bindAll=Xs,Un.bindKey=Ea,Un.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return qa(t)?t:[t]},Un.chain=da,Un.chunk=function(t,e,n){e=(n?vo(t,e,n):e===r)?1:mn(hs(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,a=0,s=rt(pe(i/e));o<i;)s[a++]=ti(t,o,o+=e);return s},Un.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Un.concat=function(){var t=arguments.length;if(!t)return[];for(var e=rt(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return xe(qa(n)?Oi(n):[n],yr(e,1))},Un.cond=function(t){var e=null==t?0:t.length,n=oo();return t=e?je(t,function(t){if("function"!=typeof t[1])throw new At(i);return[n(t[0]),t[1]]}):[],Gr(function(n){for(var r=-1;++r<e;){var i=t[r];if(_e(i[0],this,n))return _e(i[1],this,n)}})},Un.conforms=function(t){return function(t){var e=js(t);return function(n){return sr(n,t,e)}}(ar(t,1))},Un.constant=Qs,Un.countBy=fa,Un.create=function(t,e){var n=Nn(t);return null==e?n:nr(n,e)},Un.curry=function t(e,n,i){var o=Yi(e,8,r,r,r,r,r,n=i?r:n);return o.placeholder=t.placeholder,o},Un.curryRight=function t(e,n,i){var o=Yi(e,16,r,r,r,r,r,n=i?r:n);return o.placeholder=t.placeholder,o},Un.debounce=ja,Un.defaults=Is,Un.defaultsDeep=Cs,Un.defer=xa,Un.delay=Ta,Un.difference=No,Un.differenceBy=Ro,Un.differenceWith=Lo,Un.drop=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,(e=n||e===r?1:hs(e))<0?0:e,i):[]},Un.dropRight=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,0,(e=i-(e=n||e===r?1:hs(e)))<0?0:e):[]},Un.dropRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0,!0):[]},Un.dropWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0):[]},Un.fill=function(t,e,n,i){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&vo(t,e,n)&&(n=0,i=o),function(t,e,n,i){var o=t.length;for((n=hs(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:hs(i))<0&&(i+=o),i=n>i?0:fs(i);n<i;)t[n++]=e;return t}(t,e,n,i)):[]},Un.filter=function(t,e){return(qa(t)?Ae:fr)(t,oo(e,3))},Un.flatMap=function(t,e){return yr(_a(t,e),1)},Un.flatMapDeep=function(t,e){return yr(_a(t,e),c)},Un.flatMapDepth=function(t,e,n){return n=n===r?1:hs(n),yr(_a(t,e),n)},Un.flatten=$o,Un.flattenDeep=function(t){return null!=t&&t.length?yr(t,c):[]},Un.flattenDepth=function(t,e){return null!=t&&t.length?yr(t,e=e===r?1:hs(e)):[]},Un.flip=function(t){return Yi(t,512)},Un.flow=tu,Un.flowRight=eu,Un.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Un.functions=function(t){return null==t?[]:wr(t,js(t))},Un.functionsIn=function(t){return null==t?[]:wr(t,xs(t))},Un.groupBy=ba,Un.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Un.intersection=Ho,Un.intersectionBy=Go,Un.intersectionWith=Yo,Un.invert=As,Un.invertBy=ks,Un.invokeMap=wa,Un.iteratee=ru,Un.keyBy=Sa,Un.keys=js,Un.keysIn=xs,Un.map=_a,Un.mapKeys=function(t,e){var n={};return e=oo(e,3),gr(t,function(t,r,i){rr(n,e(t,r,i),t)}),n},Un.mapValues=function(t,e){var n={};return e=oo(e,3),gr(t,function(t,r,i){rr(n,r,e(t,r,i))}),n},Un.matches=function(t){return Mr(ar(t,1))},Un.matchesProperty=function(t,e){return Ur(t,ar(e,1))},Un.memoize=za,Un.merge=Ts,Un.mergeWith=zs,Un.method=iu,Un.methodOf=ou,Un.mixin=au,Un.negate=Fa,Un.nthArg=function(t){return t=hs(t),Gr(function(e){return Rr(e,t)})},Un.omit=Fs,Un.omitBy=function(t,e){return Ds(t,Fa(oo(e)))},Un.once=function(t){return Aa(2,t)},Un.orderBy=function(t,e,n,i){return null==t?[]:(qa(e)||(e=null==e?[]:[e]),qa(n=i?r:n)||(n=null==n?[]:[n]),Lr(t,e,n))},Un.over=uu,Un.overArgs=Ba,Un.overEvery=cu,Un.overSome=lu,Un.partial=Da,Un.partialRight=Ma,Un.partition=Ia,Un.pick=Bs,Un.pickBy=Ds,Un.property=du,Un.propertyOf=function(t){return function(e){return null==t?r:Sr(t,e)}},Un.pull=Jo,Un.pullAll=Zo,Un.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,oo(n,2)):t},Un.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,r,n):t},Un.pullAt=Xo,Un.range=pu,Un.rangeRight=hu,Un.rearg=Ua,Un.reject=function(t,e){return(qa(t)?Ae:fr)(t,Fa(oo(e,3)))},Un.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=oo(e,3);++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return $r(t,i),n},Un.rest=function(t,e){if("function"!=typeof t)throw new At(i);return Gr(t,e=e===r?e:hs(e))},Un.reverse=Qo,Un.sampleSize=function(t,e,n){return e=(n?vo(t,e,n):e===r)?1:hs(e),(qa(t)?Jn:Kr)(t,e)},Un.set=function(t,e,n){return null==t?t:Jr(t,e,n)},Un.setWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:Jr(t,e,n,i)},Un.shuffle=function(t){return(qa(t)?Zn:Qr)(t)},Un.slice=function(t,e,n){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&vo(t,e,n)?(e=0,n=i):(e=null==e?0:hs(e),n=n===r?i:hs(n)),ti(t,e,n)):[]},Un.sortBy=Ca,Un.sortedUniq=function(t){return t&&t.length?ii(t):[]},Un.sortedUniqBy=function(t,e){return t&&t.length?ii(t,oo(e,2)):[]},Un.split=function(t,e,n){return n&&"number"!=typeof n&&vo(t,e,n)&&(e=n=r),(n=n===r?p:n>>>0)?(t=vs(t))&&("string"==typeof e||null!=e&&!is(e))&&!(e=ai(e))&&nn(t)?gi(ln(t),0,n):t.split(e,n):[]},Un.spread=function(t,e){if("function"!=typeof t)throw new At(i);return e=null==e?0:mn(hs(e),0),Gr(function(n){var r=n[e],i=gi(n,0,e);return r&&xe(i,r),_e(t,this,i)})},Un.tail=function(t){var e=null==t?0:t.length;return e?ti(t,1,e):[]},Un.take=function(t,e,n){return t&&t.length?ti(t,0,(e=n||e===r?1:hs(e))<0?0:e):[]},Un.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,(e=i-(e=n||e===r?1:hs(e)))<0?0:e,i):[]},Un.takeRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!1,!0):[]},Un.takeWhile=function(t,e){return t&&t.length?li(t,oo(e,3)):[]},Un.tap=function(t,e){return e(t),t},Un.throttle=function(t,e,n){var r=!0,o=!0;if("function"!=typeof t)throw new At(i);return Qa(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),ja(t,e,{leading:r,maxWait:e,trailing:o})},Un.thru=pa,Un.toArray=ds,Un.toPairs=Ms,Un.toPairsIn=Us,Un.toPath=function(t){return qa(t)?je(t,Do):ss(t)?[t]:Oi(Bo(vs(t)))},Un.toPlainObject=ms,Un.transform=function(t,e,n){var r=qa(t),i=r||Ga(t)||us(t);if(e=oo(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Qa(t)&&Ja(o)?Nn($t(t)):{}}return(i?Ce:gr)(t,function(t,r,i){return e(n,t,r,i)}),n},Un.unary=function(t){return Oa(t,1)},Un.union=ta,Un.unionBy=ea,Un.unionWith=na,Un.uniq=function(t){return t&&t.length?si(t):[]},Un.uniqBy=function(t,e){return t&&t.length?si(t,oo(e,2)):[]},Un.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?si(t,r,e):[]},Un.unset=function(t,e){return null==t||ui(t,e)},Un.unzip=ra,Un.unzipWith=ia,Un.update=function(t,e,n){return null==t?t:ci(t,e,yi(n))},Un.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:ci(t,e,yi(n),i)},Un.values=Ns,Un.valuesIn=function(t){return null==t?[]:Ke(t,xs(t))},Un.without=oa,Un.words=Js,Un.wrap=function(t,e){return Da(yi(e),t)},Un.xor=aa,Un.xorBy=sa,Un.xorWith=ua,Un.zip=ca,Un.zipObject=function(t,e){return hi(t||[],e||[],Qn)},Un.zipObjectDeep=function(t,e){return hi(t||[],e||[],Jr)},Un.zipWith=la,Un.entries=Ms,Un.entriesIn=Us,Un.extend=bs,Un.extendWith=ws,au(Un,Un),Un.add=vu,Un.attempt=Zs,Un.camelCase=Rs,Un.capitalize=Ls,Un.ceil=gu,Un.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=ys(n))==n?n:0),e!==r&&(e=(e=ys(e))==e?e:0),or(ys(t),e,n)},Un.clone=function(t){return ar(t,4)},Un.cloneDeep=function(t){return ar(t,5)},Un.cloneDeepWith=function(t,e){return ar(t,5,e="function"==typeof e?e:r)},Un.cloneWith=function(t,e){return ar(t,4,e="function"==typeof e?e:r)},Un.conformsTo=function(t,e){return null==e||sr(t,e,js(e))},Un.deburr=Vs,Un.defaultTo=function(t,e){return null==t||t!=t?e:t},Un.divide=bu,Un.endsWith=function(t,e,n){t=vs(t),e=ai(e);var i=t.length,o=n=n===r?i:or(hs(n),0,i);return(n-=e.length)>=0&&t.slice(n,o)==e},Un.eq=Na,Un.escape=function(t){return(t=vs(t))&&G.test(t)?t.replace(W,tn):t},Un.escapeRegExp=function(t){return(t=vs(t))&&et.test(t)?t.replace(tt,"\\$&"):t},Un.every=function(t,e,n){var i=qa(t)?Oe:pr;return n&&vo(t,e,n)&&(e=r),i(t,oo(e,3))},Un.find=ya,Un.findIndex=Vo,Un.findKey=function(t,e){return De(t,oo(e,3),gr)},Un.findLast=ma,Un.findLastIndex=qo,Un.findLastKey=function(t,e){return De(t,oo(e,3),br)},Un.floor=wu,Un.forEach=va,Un.forEachRight=ga,Un.forIn=function(t,e){return null==t?t:mr(t,oo(e,3),xs)},Un.forInRight=function(t,e){return null==t?t:vr(t,oo(e,3),xs)},Un.forOwn=function(t,e){return t&&gr(t,oo(e,3))},Un.forOwnRight=function(t,e){return t&&br(t,oo(e,3))},Un.get=Ps,Un.gt=Ra,Un.gte=La,Un.has=function(t,e){return null!=t&&ho(t,e,Pr)},Un.hasIn=Os,Un.head=Wo,Un.identity=nu,Un.includes=function(t,e,n,r){t=Wa(t)?t:Ns(t),n=n&&!r?hs(n):0;var i=t.length;return n<0&&(n=mn(i+n,0)),as(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Ue(t,e,n)>-1},Un.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=mn(r+i,0)),Ue(t,e,i)},Un.inRange=function(t,e,n){return e=ps(e),n===r?(n=e,e=0):n=ps(n),function(t,e,n){return t>=vn(e,n)&&t<mn(e,n)}(t=ys(t),e,n)},Un.invoke=Es,Un.isArguments=Va,Un.isArray=qa,Un.isArrayBuffer=$a,Un.isArrayLike=Wa,Un.isArrayLikeObject=Ha,Un.isBoolean=function(t){return!0===t||!1===t||ts(t)&&Ir(t)==m},Un.isBuffer=Ga,Un.isDate=Ya,Un.isElement=function(t){return ts(t)&&1===t.nodeType&&!rs(t)},Un.isEmpty=function(t){if(null==t)return!0;if(Wa(t)&&(qa(t)||"string"==typeof t||"function"==typeof t.splice||Ga(t)||us(t)||Va(t)))return!t.length;var e=po(t);if(e==S||e==O)return!t.size;if(So(t))return!Fr(t).length;for(var n in t)if(zt.call(t,n))return!1;return!0},Un.isEqual=function(t,e){return jr(t,e)},Un.isEqualWith=function(t,e,n){var i=(n="function"==typeof n?n:r)?n(t,e):r;return i===r?jr(t,e,r,n):!!i},Un.isError=Ka,Un.isFinite=function(t){return"number"==typeof t&&qe(t)},Un.isFunction=Ja,Un.isInteger=Za,Un.isLength=Xa,Un.isMap=es,Un.isMatch=function(t,e){return t===e||xr(t,e,so(e))},Un.isMatchWith=function(t,e,n){return n="function"==typeof n?n:r,xr(t,e,so(e),n)},Un.isNaN=function(t){return ns(t)&&t!=+t},Un.isNative=function(t){if(wo(t))throw new St("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Tr(t)},Un.isNil=function(t){return null==t},Un.isNull=function(t){return null===t},Un.isNumber=ns,Un.isObject=Qa,Un.isObjectLike=ts,Un.isPlainObject=rs,Un.isRegExp=is,Un.isSafeInteger=function(t){return Za(t)&&t>=-9007199254740991&&t<=l},Un.isSet=os,Un.isString=as,Un.isSymbol=ss,Un.isTypedArray=us,Un.isUndefined=function(t){return t===r},Un.isWeakMap=function(t){return ts(t)&&po(t)==E},Un.isWeakSet=function(t){return ts(t)&&"[object WeakSet]"==Ir(t)},Un.join=function(t,e){return null==t?"":fn.call(t,e)},Un.kebabCase=qs,Un.last=Ko,Un.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=hs(n))<0?mn(i+o,0):vn(o,i-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Me(t,Re,o,!0)},Un.lowerCase=$s,Un.lowerFirst=Ws,Un.lt=cs,Un.lte=ls,Un.max=function(t){return t&&t.length?hr(t,nu,Cr):r},Un.maxBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Cr):r},Un.mean=function(t){return Le(t,nu)},Un.meanBy=function(t,e){return Le(t,oo(e,2))},Un.min=function(t){return t&&t.length?hr(t,nu,Br):r},Un.minBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Br):r},Un.stubArray=fu,Un.stubFalse=yu,Un.stubObject=function(){return{}},Un.stubString=function(){return""},Un.stubTrue=function(){return!0},Un.multiply=Su,Un.nth=function(t,e){return t&&t.length?Rr(t,hs(e)):r},Un.noConflict=function(){return le._===this&&(le._=Ut),this},Un.noop=su,Un.now=Pa,Un.pad=function(t,e,n){t=vs(t);var r=(e=hs(e))?cn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Li(fe(i),n)+t+Li(pe(i),n)},Un.padEnd=function(t,e,n){t=vs(t);var r=(e=hs(e))?cn(t):0;return e&&r<e?t+Li(e-r,n):t},Un.padStart=function(t,e,n){t=vs(t);var r=(e=hs(e))?cn(t):0;return e&&r<e?Li(e-r,n)+t:t},Un.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),bn(vs(t).replace(nt,""),e||0)},Un.random=function(t,e,n){if(n&&"boolean"!=typeof n&&vo(t,e,n)&&(e=n=r),n===r&&("boolean"==typeof e?(n=e,e=r):"boolean"==typeof t&&(n=t,t=r)),t===r&&e===r?(t=0,e=1):(t=ps(t),e===r?(e=t,t=0):e=ps(e)),t>e){var i=t;t=e,e=i}if(n||t%1||e%1){var o=wn();return vn(t+o*(e-t+ae("1e-"+((o+"").length-1))),e)}return Wr(t,e)},Un.reduce=function(t,e,n){var r=qa(t)?Te:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,lr)},Un.reduceRight=function(t,e,n){var r=qa(t)?ze:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,dr)},Un.repeat=function(t,e,n){return e=(n?vo(t,e,n):e===r)?1:hs(e),Hr(vs(t),e)},Un.replace=function(){var t=arguments,e=vs(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Un.result=function(t,e,n){var i=-1,o=(e=mi(e,t)).length;for(o||(o=1,t=r);++i<o;){var a=null==t?r:t[Do(e[i])];a===r&&(i=o,a=n),t=Ja(a)?a.call(t):a}return t},Un.round=_u,Un.runInContext=t,Un.sample=function(t){return(qa(t)?Kn:Yr)(t)},Un.size=function(t){if(null==t)return 0;if(Wa(t))return as(t)?cn(t):t.length;var e=po(t);return e==S||e==O?t.size:Fr(t).length},Un.snakeCase=Hs,Un.some=function(t,e,n){var i=qa(t)?Fe:ei;return n&&vo(t,e,n)&&(e=r),i(t,oo(e,3))},Un.sortedIndex=function(t,e){return ni(t,e)},Un.sortedIndexBy=function(t,e,n){return ri(t,e,oo(n,2))},Un.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=ni(t,e);if(r<n&&Na(t[r],e))return r}return-1},Un.sortedLastIndex=function(t,e){return ni(t,e,!0)},Un.sortedLastIndexBy=function(t,e,n){return ri(t,e,oo(n,2),!0)},Un.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=ni(t,e,!0)-1;if(Na(t[n],e))return n}return-1},Un.startCase=Gs,Un.startsWith=function(t,e,n){return t=vs(t),n=null==n?0:or(hs(n),0,t.length),e=ai(e),t.slice(n,n+e.length)==e},Un.subtract=Iu,Un.sum=function(t){return t&&t.length?We(t,nu):0},Un.sumBy=function(t,e){return t&&t.length?We(t,oo(e,2)):0},Un.template=function(t,e,n){var i=Un.templateSettings;n&&vo(t,e,n)&&(e=r),t=vs(t),e=ws({},e,i,Ki);var o,a,s=ws({},e.imports,i.imports,Ki),u=js(s),c=Ke(s,u),l=0,d=e.interpolate||gt,p="__p += '",h=Pt((e.escape||gt).source+"|"+d.source+"|"+(d===J?lt:gt).source+"|"+(e.evaluate||gt).source+"|$","g"),f="//# sourceURL="+(zt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ne+"]")+"\n";t.replace(h,function(e,n,r,i,s,u){return r||(r=i),p+=t.slice(l,u).replace(bt,en),n&&(o=!0,p+="' +\n__e("+n+") +\n'"),s&&(a=!0,p+="';\n"+s+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),p+="';\n";var y=zt.call(e,"variable")&&e.variable;if(y){if(ut.test(y))throw new St("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(a?p.replace(L,""):p).replace(V,"$1").replace(q,"$1;"),p="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=Zs(function(){return _t(u,f+"return "+p).apply(r,c)});if(m.source=p,Ka(m))throw m;return m},Un.times=function(t,e){if((t=hs(t))<1||t>l)return[];var n=p,r=vn(t,p);e=oo(e),t-=p;for(var i=He(r,e);++n<t;)e(n);return i},Un.toFinite=ps,Un.toInteger=hs,Un.toLength=fs,Un.toLower=function(t){return vs(t).toLowerCase()},Un.toNumber=ys,Un.toSafeInteger=function(t){return t?or(hs(t),-9007199254740991,l):0===t?t:0},Un.toString=vs,Un.toUpper=function(t){return vs(t).toUpperCase()},Un.trim=function(t,e,n){if((t=vs(t))&&(n||e===r))return Ge(t);if(!t||!(e=ai(e)))return t;var i=ln(t),o=ln(e);return gi(i,Ze(i,o),Xe(i,o)+1).join("")},Un.trimEnd=function(t,e,n){if((t=vs(t))&&(n||e===r))return t.slice(0,dn(t)+1);if(!t||!(e=ai(e)))return t;var i=ln(t);return gi(i,0,Xe(i,ln(e))+1).join("")},Un.trimStart=function(t,e,n){if((t=vs(t))&&(n||e===r))return t.replace(nt,"");if(!t||!(e=ai(e)))return t;var i=ln(t);return gi(i,Ze(i,ln(e))).join("")},Un.truncate=function(t,e){var n=30,i="...";if(Qa(e)){var o="separator"in e?e.separator:o;n="length"in e?hs(e.length):n,i="omission"in e?ai(e.omission):i}var a=(t=vs(t)).length;if(nn(t)){var s=ln(t);a=s.length}if(n>=a)return t;var u=n-cn(i);if(u<1)return i;var c=s?gi(s,0,u).join(""):t.slice(0,u);if(o===r)return c+i;if(s&&(u+=c.length-u),is(o)){if(t.slice(u).search(o)){var l,d=c;for(o.global||(o=Pt(o.source,vs(dt.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var p=l.index;c=c.slice(0,p===r?u:p)}}else if(t.indexOf(ai(o),u)!=u){var h=c.lastIndexOf(o);h>-1&&(c=c.slice(0,h))}return c+i},Un.unescape=function(t){return(t=vs(t))&&H.test(t)?t.replace($,pn):t},Un.uniqueId=function(t){var e=++Ft;return vs(t)+e},Un.upperCase=Ys,Un.upperFirst=Ks,Un.each=va,Un.eachRight=ga,Un.first=Wo,au(Un,(mu={},gr(Un,function(t,e){zt.call(Un.prototype,e)||(mu[e]=t)}),mu),{chain:!1}),Un.VERSION="4.17.21",Ce(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){Un[t].placeholder=Un}),Ce(["drop","take"],function(t,e){Vn.prototype[t]=function(n){n=n===r?1:mn(hs(n),0);var i=this.__filtered__&&!e?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=vn(n,i.__takeCount__):i.__views__.push({size:vn(n,p),type:t+(i.__dir__<0?"Right":"")}),i},Vn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ce(["filter","map","takeWhile"],function(t,e){var n=e+1,r=1==n||3==n;Vn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:oo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),Ce(["head","last"],function(t,e){var n="take"+(e?"Right":"");Vn.prototype[t]=function(){return this[n](1).value()[0]}}),Ce(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");Vn.prototype[t]=function(){return this.__filtered__?new Vn(this):this[n](1)}}),Vn.prototype.compact=function(){return this.filter(nu)},Vn.prototype.find=function(t){return this.filter(t).head()},Vn.prototype.findLast=function(t){return this.reverse().find(t)},Vn.prototype.invokeMap=Gr(function(t,e){return"function"==typeof t?new Vn(this):this.map(function(n){return kr(n,t,e)})}),Vn.prototype.reject=function(t){return this.filter(Fa(oo(t)))},Vn.prototype.slice=function(t,e){t=hs(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Vn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==r&&(n=(e=hs(e))<0?n.dropRight(-e):n.take(e-t)),n)},Vn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Vn.prototype.toArray=function(){return this.take(p)},gr(Vn.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Un[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);o&&(Un.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,u=e instanceof Vn,c=s[0],l=u||qa(e),d=function(t){var e=o.apply(Un,xe([t],s));return i&&p?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var p=this.__chain__,h=!!this.__actions__.length,f=a&&!p,y=u&&!h;if(!a&&l){e=y?e:new Vn(this);var m=t.apply(e,s);return m.__actions__.push({func:pa,args:[d],thisArg:r}),new Ln(m,p)}return f&&y?t.apply(this,s):(m=this.thru(d),f?i?m.value()[0]:m.value():m)})}),Ce(["pop","push","shift","sort","splice","unshift"],function(t){var e=kt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Un.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(qa(i)?i:[],t)}return this[n](function(n){return e.apply(qa(n)?n:[],t)})}}),gr(Vn.prototype,function(t,e){var n=Un[e];if(n){var r=n.name+"";zt.call(En,r)||(En[r]=[]),En[r].push({name:e,func:n})}}),En[Mi(r,2).name]=[{name:"wrapper",func:r}],Vn.prototype.clone=function(){var t=new Vn(this.__wrapped__);return t.__actions__=Oi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Oi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Oi(this.__views__),t},Vn.prototype.reverse=function(){if(this.__filtered__){var t=new Vn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Vn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=qa(t),r=e<0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=vn(e,t+a);break;case"takeRight":t=mn(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,d=l.length,p=0,h=vn(u,this.__takeCount__);if(!n||!r&&i==u&&h==u)return di(t,this.__actions__);var f=[];t:for(;u--&&p<h;){for(var y=-1,m=t[c+=e];++y<d;){var v=l[y],g=v.iteratee,b=v.type,w=g(m);if(2==b)m=w;else if(!w){if(1==b)continue t;break t}}f[p++]=m}return f},Un.prototype.at=ha,Un.prototype.chain=function(){return da(this)},Un.prototype.commit=function(){return new Ln(this.value(),this.__chain__)},Un.prototype.next=function(){this.__values__===r&&(this.__values__=ds(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?r:this.__values__[this.__index__++]}},Un.prototype.plant=function(t){for(var e,n=this;n instanceof Rn;){var i=Uo(n);i.__index__=0,i.__values__=r,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e},Un.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Vn){var e=t;return this.__actions__.length&&(e=new Vn(this)),(e=e.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:r}),new Ln(e,this.__chain__)}return this.thru(Qo)},Un.prototype.toJSON=Un.prototype.valueOf=Un.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Un.prototype.first=Un.prototype.head,Zt&&(Un.prototype[Zt]=function(){return this}),Un}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(le._=hn,define(function(){return hn})):pe?((pe.exports=hn)._=hn,de._=hn):le._=hn}.call(this)},9722:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(7995);e.default=function(){return new o.default(new i.default,r.createRequestSender())}},9783:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.joinPaths=e.isAbsoluteUrl=void 0,e.isAbsoluteUrl=function(t){return/^https?:\/\//.test(t)},e.joinPaths=function(t,e){return"".concat((n=t,n.replace(/\/$/,"")),"/").concat(function(t){return t.replace(/^\//,"")}(e));var n}},9828:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.build=function(t,e,n){var r=this,i=document.createElement("form");return i.style.display="none",i.setAttribute("action",t),i.setAttribute("method","POST"),i.setAttribute("target",n||"_top"),Object.keys(e).forEach(function(t){var n=e[t];i.appendChild(r._createInput(n,t))}),i},t.prototype._createInput=function(t,e){var n=document.createElement("input");return n.setAttribute("name",e),n.setAttribute("type","hidden"),n.setAttribute("value",t),n},t}();e.default=n}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};(()=>{"use strict";n.r(r),n.d(r,{createPayPalCommerceAlternativeMethodsButtonStrategy:()=>le,createPayPalCommerceAlternativeMethodsPaymentStrategy:()=>ut,createPayPalCommerceButtonStrategy:()=>ee,createPayPalCommerceCreditButtonStrategy:()=>ie,createPayPalCommerceCreditCardsPaymentStrategy:()=>xt,createPayPalCommerceCreditCustomerStrategy:()=>Ht,createPayPalCommerceCreditPaymentStrategy:()=>tt,createPayPalCommerceCustomerStrategy:()=>qt,createPayPalCommerceFastlaneCustomerStrategy:()=>Xt,createPayPalCommerceFastlanePaymentStrategy:()=>Rt,createPayPalCommercePaymentStrategy:()=>K,createPayPalCommerceRatePayPaymentStrategy:()=>Ft,createPayPalCommerceVenmoButtonStrategy:()=>se,createPayPalCommerceVenmoCustomerStrategy:()=>Kt,createPayPalCommerceVenmoPaymentStrategy:()=>rt});var t,e=n(315);function i(t,e){return Object.assign(t,{resolveIds:e})}class o extends Error{constructor(t){var e;super(t||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",e=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class a extends o{constructor(t){super(t||"Unable to proceed because the client library of a payment method is not loaded or ready to be used."),this.name="PaymentMethodClientUnavailableError",this.type="payment_method_client_unavailable"}}!function(t){t[t.MissingBillingAddress=0]="MissingBillingAddress",t[t.MissingCart=1]="MissingCart",t[t.MissingCheckout=2]="MissingCheckout",t[t.MissingConsignments=3]="MissingConsignments",t[t.MissingCustomer=4]="MissingCustomer",t[t.MissingCheckoutConfig=5]="MissingCheckoutConfig",t[t.MissingOrder=6]="MissingOrder",t[t.MissingOrderConfig=7]="MissingOrderConfig",t[t.MissingOrderId=8]="MissingOrderId",t[t.MissingPayment=9]="MissingPayment",t[t.MissingPaymentId=10]="MissingPaymentId",t[t.MissingPaymentInstrument=11]="MissingPaymentInstrument",t[t.MissingPaymentMethod=12]="MissingPaymentMethod",t[t.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",t[t.MissingPaymentStatus=14]="MissingPaymentStatus",t[t.MissingPaymentToken=15]="MissingPaymentToken",t[t.MissingShippingAddress=16]="MissingShippingAddress"}(t||(t={}));class s extends o{constructor(e){super(function(e){switch(e){case t.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case t.MissingCart:return"Unable to proceed because cart data is unavailable.";case t.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case t.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case t.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case t.MissingCheckoutConfig:case t.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case t.MissingOrder:return"Unable to proceed because order data is unavailable.";case t.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case t.MissingPayment:return"Unable to proceed because payment data is unavailable.";case t.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case t.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case t.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}var u=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class c{constructor(t){this.scriptLoader=t,this.window=window}getPayPalFastlaneSdk(t,e,n){return u(this,void 0,void 0,function*(){if(!this.window.paypalFastlaneSdk){const r=this.getPayPalFastlaneSdkConfiguration(t,e,n);if(yield this.loadPayPalSdk(r),!this.window.paypalFastlaneSdk)throw new a}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(t,e,n,r){return u(this,void 0,void 0,function*(){if(!this.window.paypalGooglePay||r){const r=this.getPayPalGooglePaySdkScriptConfigOrThrow(t,e,n);yield this.loadPayPalSdk(r)}if(!this.window.paypalGooglePay)throw new a;return this.window.paypalGooglePay})}getPayPalApmsSdk(t,e){return u(this,void 0,void 0,function*(){if(!this.window.paypalApms){const n=this.getPayPalApmSdkConfiguration(t,e);if(yield this.loadPayPalSdk(n),!this.window.paypalApms)throw new a}return this.window.paypalApms})}getPayPalMessages(t,e){return u(this,void 0,void 0,function*(){if(!this.window.paypalMessages){const n=this.getPayPalSdkMessagesConfiguration(t,e);yield this.loadPayPalSdk(n)}if(!this.window.paypalMessages)throw new a;return this.window.paypalMessages})}loadPayPalSdk({options:t,attributes:e}){return u(this,void 0,void 0,function*(){const n=this.transformConfig(t),r=this.transformConfig(e),i=`https://www.paypal.com/sdk/js?${new URLSearchParams(n).toString()}`;yield this.scriptLoader.loadScript(i,{async:!0,attributes:r})})}getPayPalFastlaneSdkConfiguration(e,n,r){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:u,merchantId:c,attributionId:l}=o;return{options:{"client-id":u,"merchant-id":c,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:n,intent:a},attributes:{"data-client-metadata-id":r.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":i}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,n,r=!0){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:u,merchantId:c,buyerCountry:l,attributionId:d,isHostedCheckoutEnabled:p,isDeveloperModeApplicable:h}=o,f=p||r;return{options:Object.assign({"client-id":u,"merchant-id":c,commit:f,components:["googlepay"],currency:n,intent:a},h&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":i,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{intent:i,clientId:o,merchantId:a,buyerCountry:u,attributionId:c,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:p=[]}=r,h=p,f=d.filter(t=>!p.includes(t));return{options:Object.assign({"client-id":o,"merchant-id":a,"enable-funding":h.length>0?h:void 0,"disable-funding":f.length>0?f:void 0,commit:!0,components:["buttons","payment-fields"],currency:n,intent:i},l&&{"buyer-country":u}),attributes:{"data-partner-attribution-id":c,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{clientId:i,merchantId:o,attributionId:a,isDeveloperModeApplicable:u,buyerCountry:c}=r;return{options:Object.assign({"client-id":i,"merchant-id":o,components:["messages"],currency:n},u&&{"buyer-country":c}),attributes:{"data-namespace":"paypalMessages","data-partner-attribution-id":a}}}transformConfig(t){let e={};return Object.keys(t).forEach(n=>{const r=t[n];null==r||""===r||Array.isArray(r)&&0===r.length||(e=Object.assign(Object.assign({},e),{[n]:Array.isArray(r)?r.join(","):r}))}),e}}const l={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},d="embedded-checkout-loading-indicator-rotation";class p{constructor(t){this.styles=Object.assign(Object.assign({},l),t&&t.styles),this.containerStyles=Object.assign({},t&&t.containerStyles),this.defineAnimation(),this.container=this.buildContainer(),this.indicator=this.buildIndicator(),this.container.appendChild(this.indicator)}show(t){if(t){const e=document.getElementById(t);if(!e)throw new Error("Unable to attach the loading indicator because the parent ID is not valid.");e.appendChild(this.container)}this.container.style.visibility="visible",this.container.style.opacity="1"}hide(){const t=()=>{this.container.style.visibility="hidden",this.container.removeEventListener("transitionend",t)};this.container.addEventListener("transitionend",t),this.container.style.opacity="0"}buildContainer(){const t=document.createElement("div");return t.style.display="block",t.style.bottom="0",t.style.left="0",t.style.height="100%",t.style.width="100%",t.style.position="absolute",t.style.right="0",t.style.top="0",t.style.transition="all 250ms ease-out",t.style.opacity="0",this.setStyleAttribute(t,this.containerStyles),t}buildIndicator(){const t=document.createElement("div");return t.style.display="block",t.style.width=`${this.styles.size}px`,t.style.height=`${this.styles.size}px`,t.style.borderRadius=`${this.styles.size}px`,t.style.border="solid 1px",t.style.borderColor=`${this.styles.backgroundColor} ${this.styles.backgroundColor} ${this.styles.color} ${this.styles.color}`,t.style.margin="0 auto",t.style.position="absolute",t.style.left="0",t.style.right="0",t.style.top="50%",t.style.transform="translateY(-50%) rotate(0deg)",t.style.transformStyle="preserve-3d",t.style.animation=`${d} 500ms infinite cubic-bezier(0.69, 0.31, 0.56, 0.83)`,t}setStyleAttribute(t,e){Object.keys(e).forEach(n=>{t.style.setProperty(n,e[n])})}defineAnimation(){var t;if(document.getElementById(d))return;const e=document.createElement("style");e.id=d,null===(t=document.head)||void 0===t||t.appendChild(e),e.sheet instanceof CSSStyleSheet&&e.sheet.insertRule(`\n @keyframes ${d} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}var h=n(8686),f=n(4043),y=n(9440);class m extends o{constructor(t){super(t||"An unexpected error has occurred during buy now cart creation process. Please try again later."),this.name="BuyNowCartCreationError",this.type="buy_now_cart_creation_error"}}const v={body:{},headers:{},status:0};class g extends o{constructor(t,{message:e,errors:n}={}){const{body:r,headers:i,status:o}=t||v;super(e||"An unexpected error has occurred."),this.name="RequestError",this.type="request",this.body=r,this.headers=i,this.status=o,this.errors=n||[]}}var b,w,S,_,I,C,P,O;!function(t){t.BuyNow="BUY_NOW"}(b||(b={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(w||(w={})),function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(S||(S={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(_||(_={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(I||(I={})),function(t){t.pill="pill",t.rect="rect"}(C||(C={})),function(t){t.OXXO="oxxo"}(P||(P={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(O||(O={}));var A=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class k{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.paypalCommerceRequestSender=n,this.paypalCommerceScriptLoader=r}loadPayPalSdk(t,e,n,r){return A(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=e||i.getCartOrThrow().currency.code,a=i.getPaymentMethodOrThrow(t);return this.paypalSdk=yield this.paypalCommerceScriptLoader.getPayPalSDK(a,o,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new a;return this.paypalSdk}createBuyNowCartOrThrow(e){return A(this,void 0,void 0,function*(){const n=e.getBuyNowCartRequestBody();if(!n)throw new s(t.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(n)}catch(t){throw new m}})}createOrder(t,e){return A(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.paypalCommerceRequestSender.createOrder(t,Object.assign({cartId:n},e));return r})}createOrderCardFields(t,e){return A(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.paypalCommerceRequestSender.createOrder(t,Object.assign({cartId:n},e));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(){return A(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState(),e=t.getCartOrThrow(),n=t.getConsignmentsOrThrow()[0];try{yield this.paypalCommerceRequestSender.updateOrder({availableShippingOptions:n.availableShippingOptions,cartId:e.id,selectedShippingOption:n.selectedShippingOption})}catch(t){throw new g}})}getOrderStatus(t,e){return A(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalCommerceRequestSender.getOrderStatus(t,e);return n}catch(t){throw new g}})}tokenizePayment(e,n){const r=this.paymentIntegrationService.getState().getCartOrThrow();if(!n)throw new s(t.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:e,order_id:n},r.source===b.BuyNow&&{cart_id:r.id}))}submitPayment(t,e,n){return A(this,void 0,void 0,function*(){const r={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:t,paypal_account:{order_id:e}}};yield this.paymentIntegrationService.submitPayment(Object.assign({methodId:t,paymentData:r},n?{gatewayId:n}:{}))})}getShippingOptionOrThrow(t){const e=this.paymentIntegrationService.getState().getConsignmentsOrThrow()[0],n=e.availableShippingOptions||[],r=n.find(t=>t.isRecommended),i=(t?n.find(e=>e.id===t):n.find(t=>{var n;return t.id===(null===(n=e.selectedShippingOption)||void 0===n?void 0:n.id)}))||r||n[0];if(!i)throw new Error("Your order can't be shipped to this address");return i}getAddress(t){return{firstName:(null==t?void 0:t.firstName)||"",lastName:(null==t?void 0:t.lastName)||"",email:(null==t?void 0:t.email)||"",phone:(null==t?void 0:t.phone)||"",company:"",address1:(null==t?void 0:t.address1)||"",address2:(null==t?void 0:t.address2)||"",city:(null==t?void 0:t.city)||"",countryCode:(null==t?void 0:t.countryCode)||"",postalCode:(null==t?void 0:t.postalCode)||"",stateOrProvince:"",stateOrProvinceCode:(null==t?void 0:t.stateOrProvinceCode)||"",customFields:[]}}getBillingAddressFromOrderDetails({payer:t}){var e,n;return this.getAddress({firstName:t.name.given_name,lastName:t.name.surname,email:t.email_address,address1:t.address.address_line_1,address2:t.address.address_line_2,city:t.address.admin_area_2,countryCode:t.address.country_code,postalCode:t.address.postal_code,stateOrProvinceCode:t.address.admin_area_1,phone:null===(n=null===(e=t.phone)||void 0===e?void 0:e.phone_number)||void 0===n?void 0:n.national_number})}getShippingAddressFromOrderDetails(t){const{payer:e,purchase_units:n}=t,{address:r,name:{full_name:i}}=n[0].shipping,[o,...a]=i.split(" ");return this.getAddress({firstName:o,lastName:a.join(" "),email:e.email_address,address1:r.address_line_1,address2:r.address_line_2,city:r.admin_area_2,countryCode:r.country_code,postalCode:r.postal_code,stateOrProvinceCode:r.admin_area_1})}getValidButtonStyle(t){const{color:e,height:n,label:r,shape:i}=t||{},o={color:e&&I[e]?e:void 0,height:this.getValidHeight(n),label:r&&_[r]?r:void 0,shape:i&&C[i]?i:void 0};return(0,y.omitBy)(o,y.isNil)}getValidHeight(t){return t&&"number"==typeof t?t>55?55:t<25?25:t:40}removeElement(t){const e=t&&document.getElementById(t);e&&(e.style.display="none")}}const E="This API endpoint is for internal use only and may change in the future";var j;!function(t){t.Json="application/json",t.JsonV1="application/vnd.bc.v1+json"}(j||(j={}));const x=j,T={"X-Checkout-SDK-Version":"1.817.0"};var z=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class F{constructor(t){this.requestSender=t}createOrder(t,e){return z(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t){return z(this,void 0,void 0,function*(){const e=t,n=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.put("/api/storefront/initialization/paypalcommerce",{headers:n,body:e})).body})}getOrderStatus(t="paypalcommerce",e){return z(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.get(n,Object.assign({headers:r},e))).body})}}var B=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class D{constructor(t){this.scriptLoader=t,this.window=window}getPayPalSDK(t,e,n,r){return B(this,void 0,void 0,function*(){const i=this.getPayPalSdkScriptConfigOrThrow(t,e,n);return this.loadPayPalSDK(i,r)})}loadPayPalSDK(t,e=!1){return B(this,void 0,void 0,function*(){if(!this.window.paypal||e){const e=this.transformConfig(t.options),n=this.transformConfig(t.attributes),r=`https://www.paypal.com/sdk/js?${new URLSearchParams(e).toString()}`;yield this.scriptLoader.loadScript(r,{async:!0,attributes:n})}if(!this.window.paypal)throw new a;return this.window.paypal})}getPayPalSdkScriptConfigOrThrow(e,n,r=!0){const{id:i,clientToken:o,initializationData:a}=e;if(!(null==a?void 0:a.clientId))throw new s(t.MissingPaymentMethod);const{intent:u,clientId:c,merchantId:l,buyerCountry:d,attributionId:p,isVenmoEnabled:h,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:y,isDeveloperModeApplicable:m,availableAlternativePaymentMethods:v=[],enabledAlternativePaymentMethods:g=[],isGooglePayEnabled:b}=a,w=f||r,S="paypalcommercecreditcards"===i,_=S?["card"]:[],I=y?["credit","paylater"]:[],C=r||!w,P=h?["venmo"]:[],O=C?g:[],A=b?["googlepay"]:[],k=r?["card-fields"]:[],E=[...S?[]:["card"],...y?[]:["credit","paylater"],...h?[]:["venmo"],...C?v.filter(t=>!g.includes(t)):v],j=[..._,...I,...P,...O];return{options:Object.assign({"client-id":c,"merchant-id":l,"enable-funding":j.length>0?j:void 0,"disable-funding":E.length>0?E:void 0,commit:w,components:["buttons","hosted-fields","payment-fields","legal",...A,...k],currency:n,intent:u},m&&{"buyer-country":d}),attributes:{"data-partner-attribution-id":p,"data-client-token":o}}}transformConfig(t){let e={};return Object.keys(t).forEach(n=>{const r=t[n];null==r||""===r||Array.isArray(r)&&0===r.length||(e=Object.assign(Object.assign({},e),{[n]:Array.isArray(r)?r.join(","):r}))}),e}}const M=t=>{const{getHost:n}=t.getState();return new k((0,h.createFormPoster)(),t,new F((0,f.createRequestSender)({host:n()})),new D((0,e.vQ)()))},U={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};class N extends o{constructor(t){super(t||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class R extends N{constructor(t){let e="Unable to submit payment for the order because the payload is invalid.";t&&(e=`${e} Make sure the following fields are provided correctly: ${t.join(", ")}.`),super(e),this.name="PaymentArgumentInvalidError"}}class L extends g{constructor(t){super(t,{message:"There is a problem processing your payment. Please try again later."}),this.name="PaymentMethodInvalidError",this.type="payment_method_invalid"}}class V extends o{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function q(t){return!("object"!=typeof t||null===t||void 0!==t.shouldSaveInstrument&&"boolean"!=typeof t.shouldSaveInstrument||void 0!==t.shouldSetAsDefaultInstrument&&"boolean"!=typeof t.shouldSetAsDefaultInstrument)}function $(t){return Boolean(t.instrumentId)}const W=function({styles:t}){const e={};return t.color&&(e.color=t.color),t.layout&&(e.layout=t.layout),(t["logo-type"]||t["logo-position"])&&(e.logo={},t["logo-type"]&&(e.logo.type=t["logo-type"]),t["logo-position"]&&(e.logo.position=t["logo-position"])),t.ratio&&(e.ratio=t.ratio),(t["text-color"]||t["text-size"])&&(e.text={},t["text-color"]&&(e.text.color=t["text-color"]),t["text-size"]&&(e.text.size=+t["text-size"])),e};function H(t){return"object"==typeof t&&null!==t&&"bigpayToken"in t&&"defaultInstrument"in t&&"provider"in t&&"trustedShippingAddress"in t&&"method"in t&&"type"in t}var G=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Y{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalCommerceSdk=n,this.loadingIndicator=r}initialize(t){var e;return G(this,void 0,void 0,function*(){const{methodId:n,paypalcommerce:r}=t||{};if(this.paypalcommerce=r,!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new N('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(n);const i=this.paymentIntegrationService.getState(),o=i.getPaymentMethodOrThrow(n),{container:a,bannerContainerId:s}=r,{orderId:u,paypalBNPLConfiguration:c=[],isPayPalCreditAvailable:l}=o.initializationData||{};if(void 0!==s){if(!document.getElementById(s))return void console.error("Unable to create banner without valid banner container ID.");const t=null==c?void 0:c.find(({id:t})=>"checkout"===t);if(l||!(null==t?void 0:t.status))return;const e=yield this.paypalCommerceSdk.getPayPalMessages(o,i.getCartOrThrow().currency.code);return e&&"function"==typeof(null==e?void 0:e.Messages)?this.renderMessages(e,s,t):void console.error("[BC PayPalCommerce PayLater]: banner could not be rendered, due to issues with loading PayPal SDK")}u?this.orderId=null===(e=o.initializationData)||void 0===e?void 0:e.orderId:(this.loadingIndicatorContainer=null==a?void 0:a.split("#")[1],yield this.paypalCommerceIntegrationService.loadPayPalSdk(n),r.onInit&&"function"==typeof r.onInit&&r.onInit(()=>this.renderButton(n,r)),(void 0===r.shouldRenderPayPalButtonOnInitialization||r.shouldRenderPayPalButtonOnInitialization)&&this.renderButton(n,r))})}execute(t,e){var n,r;return G(this,void 0,void 0,function*(){const{payment:i}=t,o=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{onError:a}=this.paypalcommerce||{};if(!i)throw new R(["payment"]);const{methodId:s,paymentData:u}=i;if(this.isPayPalVaultedInstrumentPaymentData(u)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new L;const c=this.isPayPalVaultedInstrumentPaymentData(u)?this.prepareVaultedInstrumentPaymentPayload(s,this.orderId,u):this.preparePaymentPayload(s,this.orderId,u);try{yield this.paymentIntegrationService.submitOrder(o,e),yield this.paymentIntegrationService.submitPayment(c)}catch(t){if(function(t){var e;return(t=>"object"==typeof t&&null!==t&&"body"in t)(t)&&"offsite_redirect"===(null===(e=t.body.additional_action_required)||void 0===e?void 0:e.type)}(t)){const e=null===(r=null===(n=t.body.additional_action_required)||void 0===n?void 0:n.data)||void 0===r?void 0:r.redirect_url;return new Promise(()=>window.location.replace(e))}return this.isProviderError(t)&&(yield this.paypalCommerceIntegrationService.loadPayPalSdk(i.methodId),yield new Promise((t,e)=>{var n;this.paypalcommerce&&(null===(n=this.paypalButton)||void 0===n||n.close(),this.renderButton(i.methodId,this.paypalcommerce),this.handleError(new Error("INSTRUMENT_DECLINED"),a)),e()})),this.handleError(t,a),Promise.reject()}})}finalize(){return Promise.reject(new V)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}prepareVaultedInstrumentPaymentPayload(t,e,n){const{instrumentId:r,shouldSetAsDefaultInstrument:i}=n,o=!this.isTrustedVaultingFlow(n);return o?{methodId:t,paymentData:{shouldSaveInstrument:o,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e}}}}:{methodId:t,paymentData:{instrumentId:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e},bigpay_token:{token:r}}}}}preparePaymentPayload(t,e,n){const{shouldSaveInstrument:r=!1,shouldSetAsDefaultInstrument:i=!1}=q(n)?n:{};return{methodId:t,paymentData:{shouldSaveInstrument:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e}}}}}renderButton(t,e){var n,r,i,o;const a=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:u}=s.initializationData||{},{checkoutPaymentButtonStyles:c}=u||{},{container:l,onError:d,onRenderButton:p,onValidate:h,submitForm:f}=e;if(!l)throw new N('Unable to initialize payment because "container" argument is not provided.');const y=Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{fundingSource:a.FUNDING.PAYPAL,style:this.paypalCommerceIntegrationService.getValidButtonStyle(c),createOrder:()=>this.createOrder(),onClick:(t,e)=>this.handleClick(e,h),onApprove:t=>this.handleApprove(t,f),onError:t=>this.handleError(t,d),onCancel:()=>this.toggleLoadingIndicator(!1)});this.paypalButton=a.Buttons(y),this.paypalButton.isEligible()&&(p&&"function"==typeof p&&p(),(null===(r=(n=this.paypalButton).hasReturned)||void 0===r?void 0:r.call(n))&&this.isPaypalCommerceAppSwitchEnabled(t)?null===(o=(i=this.paypalButton).resume)||void 0===o||o.call(i):this.paypalButton.render(l))}handleClick(t,e){return G(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;return null==e?void 0:e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,null==e||e()}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}createOrder(){return G(this,void 0,void 0,function*(){const t=this.getFieldsValues();return this.paypalCommerceIntegrationService.createOrder("paypalcommercecheckout",{shouldSaveInstrument:(null==t?void 0:t.shouldSaveInstrument)||!1})})}getFieldsValues(){const{getFieldsValues:t}=this.paypalcommerce||{};return"function"==typeof t?t():void 0}isTrustedVaultingFlow(t){if(t&&$(t)){const e=this.paymentIntegrationService.getState().getInstruments(),n=null==e?void 0:e.find(e=>H(e)&&e.bigpayToken===t.instrumentId);return!(H(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(t){return!!t&&$(t)&&q(t)}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:W(n)};t.Messages(r).render(`#${e}`)}isProviderError(t){var e,n,r;return!!function(t){return"object"==typeof t&&null!==t&&"errors"in t}(t)&&"INSTRUMENT_DECLINED"===(null===(r=null===(n=((null===(e=null==t?void 0:t.errors)||void 0===e?void 0:e.filter(t=>t.provider_error))||[])[0])||void 0===n?void 0:n.provider_error)||void 0===r?void 0:r.code)}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}}const K=i(t=>new Y(t,M(t),new c((0,e.vQ)()),new p({containerStyles:U})),[{id:"paypalcommerce"}]);function J(){return new c((0,e.Hb)())}class Z extends o{constructor(t){super(t||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}var X=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Q{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n,this.paypalCommerceSdk=r}initialize(t){return X(this,void 0,void 0,function*(){const{methodId:e,paypalcommerce:n,paypalcommercecredit:r}=t||{},i=r||n;if(!e)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new N('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(e);const o=this.paymentIntegrationService.getState(),a=o.getPaymentMethodOrThrow(e),{paypalBNPLConfiguration:s=[],orderId:u}=a.initializationData||{},{bannerContainerId:c,container:l}=i;if(void 0!==c){if(!document.getElementById(c))return void console.error("Unable to create banner without valid banner container ID.");const t=s&&s.find(({id:t})=>"checkout"===t);if(!(null==t?void 0:t.status))return;const e=yield this.paypalCommerceSdk.getPayPalMessages(a,o.getCartOrThrow().currency.code);return this.renderMessages(e,c,t)}u?this.orderId=u:(yield this.paypalCommerceIntegrationService.loadPayPalSdk(e),this.loadingIndicatorContainer=null==l?void 0:l.split("#")[1],this.renderButton(e,i))})}execute(t,e){return X(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new R(["payment"]);if(!this.orderId)throw new L;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalCommerceIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new V)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}renderButton(t,e){if(!(null==e?void 0:e.container))throw new N('Unable to initialize payment because "container" argument is not provided.');const n=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=e,d=[n.FUNDING.PAYLATER,n.FUNDING.CREDIT];let p=!1;d.forEach(t=>{if(p)return;const e={fundingSource:t,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecreditcheckout"),onClick:(t,e)=>this.handleClick(e,c),onApprove:t=>this.handleApprove(t,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:t=>this.handleError(t,s)};if(this.paypalButton=n.Buttons(e),this.paypalButton.isEligible()||t!==n.FUNDING.PAYLATER){if(!this.paypalButton.isEligible()&&t===n.FUNDING.CREDIT)throw new Z(`PayPal ${t} is not available for your region. Please use PayPal Checkout instead.`);u&&"function"==typeof u&&u(),this.paypalButton.render(a),p=!0}})}handleClick(t,e){return X(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;if(e&&"function"==typeof e)return e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,e&&"function"==typeof e&&e()}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:W(n)};t.Messages(r).render(`#${e}`)}}const tt=i(t=>new Q(t,M(t),new p({containerStyles:U}),J()),[{id:"paypalcommercecredit"}]);var et=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class nt{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n}initialize(t){var e,n;return et(this,void 0,void 0,function*(){const{methodId:r,paypalcommerce:i,paypalcommercevenmo:o}=t||{},a=o||i;if(!r)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!a)throw new N('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(r);const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(r);(null===(e=s.initializationData)||void 0===e?void 0:e.orderId)?this.orderId=null===(n=s.initializationData)||void 0===n?void 0:n.orderId:(yield this.paypalCommerceIntegrationService.loadPayPalSdk(r),this.loadingIndicatorContainer=a.container.split("#")[1],this.renderButton(r,a))})}execute(t,e){return et(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new R(["payment"]);if(!this.orderId)throw new L;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalCommerceIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new V)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}renderButton(t,e){const n=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=e,d={fundingSource:n.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmocheckout"),onClick:(t,e)=>this.handleClick(e,c),onApprove:t=>this.handleApprove(t,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:t=>this.handleError(t,s)};if(this.paypalButton=n.Buttons(d),!this.paypalButton.isEligible())throw new Z("PayPal Venmo is not available for your region. Please use PayPal Checkout instead.");u&&"function"==typeof u&&u(),this.paypalButton.render(a)}handleClick(t,e){return et(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;return e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,e(),this.toggleLoadingIndicator(!1)}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const rt=i(t=>new nt(t,M(t),new p({styles:{backgroundColor:"black"}})),[{id:"paypalcommercevenmo"}]);class it extends g{constructor(t){super(t,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}function ot(t,e,n=!0){var r;return null!==(r=t[e])&&void 0!==r?r:n}var at=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class st{constructor(t,e,n,r,i=3e3,o=3e5){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalCommerceSdk=n,this.loadingIndicator=r,this.pollingInterval=i,this.maxPollingIntervalTime=o,this.pollingTimer=0,this.stopPolling=y.noop,this.isPollingEnabled=!1}initialize(t){return at(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,paypalcommerce:r,paypalcommercealternativemethods:i}=t,o=i||r;if(this.paypalcommercealternativemethods=i,!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!o)throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');const a=this.paymentIntegrationService.getState(),s=a.getPaymentMethodOrThrow(n,e),{orderId:u,shouldRenderFields:c}=s.initializationData||{},l=a.getStoreConfigOrThrow().checkoutSettings.features;this.isPollingEnabled=ot(l,"PAYPAL-5192.paypal_commerce_ideal_polling"),u?this.orderId=u:(this.paypalApms=yield this.paypalCommerceSdk.getPayPalApmsSdk(s,a.getCartOrThrow().currency.code),this.loadingIndicatorContainer=o.container.split("#")[1],this.renderButton(n,e,o),c&&this.renderFields(n,o))})}execute(t,e){return at(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new R(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new L;this.isPollingEnabled&&"ideal"===i&&(yield new Promise((t,e)=>{this.initializePollingMechanism(i,t,e,o)})),this.isNonInstantPaymentMethod(i)||(yield this.paymentIntegrationService.submitOrder(r,e)),yield this.paypalCommerceIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new V)}deinitialize(){var t;return this.orderId=void 0,this.isPollingEnabled&&this.resetPollingMechanism(),null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}initializePollingMechanism(t,e,n,r){return at(this,void 0,void 0,function*(){yield new Promise((t,e)=>{const n=setTimeout(t,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),e())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.paypalCommerceIntegrationService.getOrderStatus(r),o=i===O.Approved,a=i===O.PollingError;if(o)return this.deinitializePollingMechanism(),e();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(t,e,n,r);yield this.reinitializeStrategy({methodId:t,gatewayId:r,paypalcommercealternativemethods:this.paypalcommercealternativemethods}),this.handleError(new it)}catch(t){n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}reinitializeStrategy(t){return at(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}handleError(t){const{onError:e}=this.paypalcommercealternativemethods||{};this.isPollingEnabled&&this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}renderButton(t,e,n){const r=this.getPaypalAmpsSdkOrThrow(),i=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t,e),{buttonStyle:o}=i.initializationData||{},{container:a,onError:s,onRenderButton:u,submitForm:c}=n,l={fundingSource:t,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),onInit:(t,e)=>n.onInitButton(e),createOrder:()=>this.onCreateOrder(t,e,n),onApprove:t=>this.handleApprove(t,c),onCancel:()=>{this.toggleLoadingIndicator(!1),this.deinitializePollingMechanism()},onError:t=>{this.deinitializePollingMechanism(),this.handleFailure(t,s)},onClick:(t,e)=>at(this,void 0,void 0,function*(){return n.onValidate(e.resolve,e.reject)})};this.paypalButton=r.Buttons(l),this.paypalButton.isEligible()&&(u&&"function"==typeof u&&u(),this.paypalButton.render(a))}onCreateOrder(t,e,n){return at(this,void 0,void 0,function*(){const{onValidate:r}=n;yield r(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),y.noop);const i=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout");if(this.isNonInstantPaymentMethod(t)){const n={useStoreCredit:!1},r={params:{methodId:t,gatewayId:e}};yield this.paymentIntegrationService.submitOrder(n,r),yield this.paypalCommerceIntegrationService.submitPayment(t,i,e)}return i})}handleApprove({orderID:t},e){this.orderId=t,e()}handleFailure(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}renderFields(t,e){const n=this.getPaypalAmpsSdkOrThrow(),r=this.paymentIntegrationService.getState(),{firstName:i,lastName:o,email:a}=r.getBillingAddressOrThrow(),{apmFieldsContainer:s,apmFieldsStyles:u}=e;if(!s)throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods" argument should contain "apmFieldsContainer".');const c=document.querySelector(s);c&&(c.innerHTML="");const l={fundingSource:t,style:u||{},fields:{name:{value:`${i} ${o}`},email:{value:a}}};n.PaymentFields(l).render(s)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isNonInstantPaymentMethod(t){return t.toUpperCase()in P}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new a;return this.paypalApms}}const ut=i(t=>new st(t,M(t),J(),new p({containerStyles:U})),[{gateway:"paypalcommercealternativemethods"}]);var ct,lt,dt,pt,ht,ft,yt,mt;!function(t){t.CVV="cvv",t.PAN="pan"}(ct||(ct={}));class vt{static get(t){const e=`${encodeURIComponent(`${t}`)}=`,n=document.cookie;let r=null;const i=n.indexOf(e);if(i>-1){let t=n.indexOf(";",i);-1===t&&(t=n.length),r=decodeURIComponent(n.substring(i+e.length,t))}return r}static set(t,e,n={secure:!0}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(e)}`;const{expires:i,path:o,domain:a,secure:s}=n;if(i)r+=`; expires=${i.toUTCString()}`;else{const t=new Date,e=60;t.setTime(t.getTime()+60*e*1e3),r+=`; expires=${t.toUTCString()}`}o&&(r+=`; path=${o}`),a&&(r+=`; domain=${a}`),s&&(r+="; secure"),document.cookie=r}static remove(t,e){vt.set(t,"",Object.assign({expires:new Date(0)},e))}}!function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(lt||(lt={})),function(t){t.Succeeded="succeeded",t.Cancelled="cancelled",t.Errored="errored"}(dt||(dt={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(pt||(pt={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(ht||(ht={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(ft||(ft={})),function(t){t.pill="pill",t.rect="rect"}(yt||(yt={})),function(t){t.SUCCEEDED="succeeded",t.FAILED="failed",t.CANCELED="canceled",t.UNRECOGNIZED="unrecognized"}(mt||(mt={}));var gt,bt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class wt{constructor(){this.window=window}initializePayPalFastlane(t,e,n){return bt(this,void 0,void 0,function*(){if(e&&(window.localStorage.setItem("fastlaneEnv","sandbox"),window.localStorage.setItem("axoEnv","sandbox")),!this.window.paypalFastlane){const e={root:{backgroundColorPrimary:"transparent"}};this.window.paypalFastlane=yield t.Fastlane({styles:n||e})}return this.window.paypalFastlane})}getPayPalFastlaneOrThrow(){if(!this.window.paypalFastlane)throw new a;return this.window.paypalFastlane}lookupCustomerOrThrow(t){return bt(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(t)})}triggerAuthenticationFlowOrThrow(t){return bt(this,void 0,void 0,function*(){return t?this.getPayPalFastlaneOrThrow().identity.triggerAuthenticationFlow(t):{}})}updateStorageSessionId(t){const e=new Date;e.setDate(e.getDate()+14);const n={expires:e,secure:!0};vt.set("bc-fastlane-sessionId",t,n)}removeStorageSessionId(){vt.remove("bc-fastlane-sessionId")}getStorageSessionId(){return vt.get("bc-fastlane-sessionId")||""}mapPayPalFastlaneProfileToBcCustomerData(t,e){var n,r,i;const{authenticationState:o,profileData:a}=e,s=null===(i=null===(r=null===(n=null==a?void 0:a.card)||void 0===n?void 0:n.paymentSource)||void 0===r?void 0:r.card)||void 0===i?void 0:i.billingAddress,u=null==a?void 0:a.shippingAddress,c=null==a?void 0:a.name,l=null==a?void 0:a.card,d=u?this.mapPayPalToBcAddress(u.address,u.name,u.phoneNumber):void 0,p=s&&c?this.mapPayPalToBcAddress(s,c,null==u?void 0:u.phoneNumber):void 0,h=l?this.mapPayPalToBcInstrument(t,l):[],f=this.filterAddresses([d,p]);return{authenticationState:o||mt.UNRECOGNIZED,addresses:f,billingAddress:p,shippingAddress:d,instruments:h}}mapPayPalToBcInstrument(t,e){const{id:n,paymentSource:r}=e,{brand:i,expiry:o,lastDigits:a}=r.card,[s,u]=o.split("-");return[{bigpayToken:n,brand:i,defaultInstrument:!1,expiryMonth:u,expiryYear:s,iin:"",last4:a,method:t,provider:t,trustedShippingAddress:!1,untrustedShippingCardVerificationMode:ct.PAN,type:"card"}]}mapBcToPayPalAddress(t){return{company:(null==t?void 0:t.company)||"",addressLine1:(null==t?void 0:t.address1)||"",addressLine2:(null==t?void 0:t.address2)||"",adminArea1:(null==t?void 0:t.stateOrProvinceCode)||(null==t?void 0:t.stateOrProvince)||"",adminArea2:(null==t?void 0:t.city)||"",postalCode:(null==t?void 0:t.postalCode)||"",countryCode:(null==t?void 0:t.countryCode)||""}}mapPayPalToBcAddress(t,e,n,r){const[i,o]=e.fullName.split(" "),a=(null==n?void 0:n.nationalNumber)||"",s=(null==n?void 0:n.countryCode)||"";return{id:Date.now(),type:"paypal-address",firstName:e.firstName||i||"",lastName:e.lastName||o||"",company:t.company||"",address1:t.addressLine1,address2:t.addressLine2||"",city:t.adminArea2,stateOrProvince:t.adminArea1,stateOrProvinceCode:t.adminArea1,country:t.countryCode||"",countryCode:t.countryCode||"",postalCode:t.postalCode,phone:s+a,customFields:r||[]}}filterAddresses(t){return t.reduce((t,e)=>e?t.some(t=>this.isEqualAddresses(t,e))?t:[...t,e]:t,[])}isEqualAddresses(t,e){return(0,y.isEqual)(this.normalizeAddress(t),this.normalizeAddress(e))}normalizeAddress(t){return(0,y.omit)(t,["id","phone"])}}function St(){return new wt}!function(t){t.CardCode="cardCode",t.CardCodeVerification="cardCodeVerification",t.CardExpiry="cardExpiry",t.CardName="cardName",t.CardNumber="cardNumber",t.CardNumberVerification="cardNumberVerification",t.CardExpiryVerification="cardExpiryVerification"}(gt||(gt={}));const _t=gt;function It(t){return _t.CardNumber in t&&_t.CardName in t&&_t.CardExpiry in t}function Ct(t){return _t.CardNumberVerification in t&&_t.CardCodeVerification in t&&_t.CardExpiryVerification in t}class Pt extends o{constructor(t){super(t||"Unable to proceed because the client library of a payment method has thrown an unexpected error."),this.name="PaymentMethodFailedError",this.type="payment_method_client_invalid"}}var Ot;!function(t){t[t.CheckoutButtonNotInitialized=0]="CheckoutButtonNotInitialized",t[t.CustomerNotInitialized=1]="CustomerNotInitialized",t[t.PaymentNotInitialized=2]="PaymentNotInitialized",t[t.ShippingNotInitialized=3]="ShippingNotInitialized",t[t.SpamProtectionNotInitialized=4]="SpamProtectionNotInitialized"}(Ot||(Ot={}));class At extends o{constructor(t){super(function(t){switch(t){case Ot.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case Ot.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case Ot.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case Ot.SpamProtectionNotInitialized:return"Unable to proceed because the checkout spam protection has not been initialized.";default:return"Unable to proceed because the required component has not been initialized."}}(t)),this.subtype=t,this.name="NotInitializedError",this.type="not_initialized"}}class kt extends o{constructor(t,e){super(e||"Unable to proceed because the payment form contains invalid data."),this.details=t,this.name="PaymentInvalidFormError",this.type="payment_invalid_form"}}var Et=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class jt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalCommerceSdk=n,this.paypalCommerceFastlaneUtils=r}initialize(t){return Et(this,void 0,void 0,function*(){const{methodId:e,paypalcommercecreditcards:n,paypalcommerce:r}=t,i=n||r,{form:o,onCreditCardFieldsRenderingError:a,onLoadComplete:s}=i||{};if(!e)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!o)throw new N('Unable to proceed because "options.paypalcommercecreditcards.form" argument is not provided.');this.hostedFormOptions=o,this.isCreditCardForm=It(o.fields),this.isCreditCardVaultedForm=Ct(o.fields)&&!this.hasUndefinedValues(),yield this.paymentIntegrationService.loadPaymentMethod(e),yield this.paypalCommerceIntegrationService.loadPayPalSdk(e,void 0,!0,!0),null==s||s(),(this.isCreditCardForm||this.isCreditCardVaultedForm)&&(yield this.initializeFields(o,a)),this.shouldInitializePayPalFastlane(e)&&(yield this.initializePayPalFastlaneOrThrow(e))})}execute(t,e){return Et(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{methodId:i,paymentData:o}=n||{};if(!n||!i)throw new R(["payment"]);if(this.executionPaymentData=o,this.isCreditCardForm||this.isCreditCardVaultedForm)yield this.validateHostedFormOrThrow(),yield this.submitHostedForm();else{const{orderId:t}=yield this.paypalCommerceIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",this.getInstrumentParams());this.returnedOrderId=t}const a=this.preparePaymentPayload(i,o,this.returnedOrderId,this.returnedVaultedToken);yield this.paymentIntegrationService.submitOrder(r,e),yield this.paymentIntegrationService.submitPayment(a)})}finalize(){return Promise.reject(new V)}deinitialize(){var t,e,n,r;return Et(this,void 0,void 0,function*(){return yield null===(t=this.cvvField)||void 0===t?void 0:t.close(),yield null===(e=this.expiryField)||void 0===e?void 0:e.close(),yield null===(n=this.numberField)||void 0===n?void 0:n.close(),yield null===(r=this.nameField)||void 0===r?void 0:r.close(),Promise.resolve()})}preparePaymentPayload(t,e,n,r){const{shouldSaveInstrument:i=!1,shouldSetAsDefaultInstrument:o=!1}=q(e)?e:{},a=e&&$(e)?e.instrumentId:void 0,s=(0,y.omitBy)({verification_nonce:r,token:a},y.isNil);return{methodId:t,paymentData:{shouldSaveInstrument:i,shouldSetAsDefaultInstrument:o,instrumentId:a,formattedPayload:Object.assign(Object.assign({},r||a?{bigpay_token:s}:{}),n?{card_with_order:{order_id:n}}:{})}}}initializeFields(t,e){return Et(this,void 0,void 0,function*(){const{fields:n,styles:r}=t,i=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),o=this.getExecuteCallback(n),a=Object.assign({style:this.getInputStyles(r),onApprove:({orderID:t,vaultSetupToken:e,liabilityShift:n})=>{if(n===w.No||n===w.Unknown)throw new Error;return this.handleApprove({orderID:t,vaultSetupToken:e})},onError:()=>{throw new Pt},inputEvents:{onChange:e=>this.onChangeHandler(t,e),onFocus:e=>this.onFocusHandler(t,e),onBlur:e=>this.onBlurHandler(t,e),onInputSubmitRequest:e=>this.onInputSubmitRequest(t,e)}},o);if(this.cardFields=yield i.CardFields(a),!this.cardFields.isEligible())throw new At(Ot.PaymentNotInitialized);try{this.stylizeInputContainers(n),It(n)&&(yield this.renderFields(n)),Ct(n)&&(yield this.renderVaultedFields(n))}catch(t){"function"==typeof e&&e(t)}})}getExecuteCallback(t){return Ct(t)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>Et(this,void 0,void 0,function*(){const{setupToken:t}=(yield this.paypalCommerceIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",Object.assign(Object.assign({},this.getInstrumentParams()),{setupToken:!0})))||{};return t})}}createOrderCallback(){return{createOrder:()=>Et(this,void 0,void 0,function*(){const{orderId:t}=(yield this.paypalCommerceIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",this.getInstrumentParams()))||{};return t})}}handleApprove({orderID:t,vaultSetupToken:e}){t&&(this.returnedOrderId=t),e&&(this.returnedVaultedToken=e)}renderFields(t){var e,n,r,i;return Et(this,void 0,void 0,function*(){const o=this.getCardFieldsOrThrow();(null===(e=t.cardCode)||void 0===e?void 0:e.containerId)&&(this.cvvField=o.CVVField({placeholder:""}),yield this.cvvField.render(`#${t.cardCode.containerId}`)),(null===(n=t.cardExpiry)||void 0===n?void 0:n.containerId)&&(this.expiryField=o.ExpiryField(),yield this.expiryField.render(`#${t.cardExpiry.containerId}`)),(null===(r=t.cardName)||void 0===r?void 0:r.containerId)&&(this.nameField=o.NameField({placeholder:""}),yield this.nameField.render(`#${t.cardName.containerId}`)),(null===(i=t.cardNumber)||void 0===i?void 0:i.containerId)&&(this.numberField=o.NumberField({placeholder:""}),yield this.numberField.render(`#${t.cardNumber.containerId}`))})}renderVaultedFields(t){var e,n,r;return Et(this,void 0,void 0,function*(){const i=this.getCardFieldsOrThrow();(null===(e=t.cardCodeVerification)||void 0===e?void 0:e.containerId)&&(this.cvvField=i.CVVField({placeholder:""}),yield this.cvvField.render(`#${t.cardCodeVerification.containerId}`)),(null===(n=t.cardExpiryVerification)||void 0===n?void 0:n.containerId)&&(this.expiryField=i.ExpiryField(),yield this.expiryField.render(`#${t.cardExpiryVerification.containerId}`)),(null===(r=t.cardNumberVerification)||void 0===r?void 0:r.containerId)&&(this.numberField=i.NumberField({placeholder:""}),yield this.numberField.render(`#${t.cardNumberVerification.containerId}`))})}getInstrumentParams(){if(!this.executionPaymentData)return{};if(q(this.executionPaymentData)){const{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}=this.executionPaymentData;return{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}}if($(this.executionPaymentData)){const{instrumentId:t}=this.executionPaymentData;return{instrumentId:t}}return{}}getFieldTypeByEmittedField({emittedBy:t}){return{fieldType:this.mapFieldType(t)}}submitHostedForm(){return Et(this,void 0,void 0,function*(){const t=this.getCardFieldsOrThrow(),e=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),n={billingAddress:{company:e.company,addressLine1:e.address1,addressLine2:e.address2,adminArea1:e.stateOrProvinceCode,adminArea2:e.city,postalCode:e.postalCode,countryCode:e.countryCode}};try{this.isCreditCardVaultedForm?yield t.submit():yield t.submit(n)}catch(t){throw new Pt("Failed authentication. Please try to authorize again.")}})}validateHostedFormOrThrow(){var t,e;return Et(this,void 0,void 0,function*(){const n=this.getCardFieldsOrThrow(),r=yield n.getState().then(t=>t),i=this.getValidityData(r);if(!i.isValid)throw null===(e=null===(t=this.hostedFormOptions)||void 0===t?void 0:t.onValidate)||void 0===e||e.call(t,i),new kt(this.mapValidationErrors(i.errors))})}getValidityData({fields:t}){const e=Object.assign({},t);delete e.cardNameField;const n=Object.keys(e);return{isValid:n.every(t=>{var n;return null===(n=e[t])||void 0===n?void 0:n.isValid}),errors:n.reduce((t,n)=>{var r;const i=this.mapFieldType(n);return Object.assign(Object.assign({},t),{[i]:(null===(r=e[n])||void 0===r?void 0:r.isValid)?void 0:[this.getInvalidErrorByFieldType(i)]})},{})}}getInvalidErrorByFieldType(t){switch(t){case _t.CardCode:case _t.CardCodeVerification:return{fieldType:t,message:"Invalid card code",type:"invalid_card_code"};case _t.CardNumber:case _t.CardNumberVerification:return{fieldType:t,message:"Invalid card number",type:"invalid_card_number"};case _t.CardExpiry:case _t.CardExpiryVerification:return{fieldType:t,message:"Invalid card expiry",type:"invalid_card_expiry"};default:return{fieldType:t,message:"Invalid field",type:"invalid"}}}mapValidationErrors(t={}){const e={};return Object.keys(t).forEach(n=>{var r,i;e[n]=[{message:(null===(i=null===(r=t[n])||void 0===r?void 0:r[0])||void 0===i?void 0:i.message)||"",type:n}]}),e}mapFieldType(t){switch(t){case"name":return _t.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?_t.CardNumber:_t.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?_t.CardExpiry:_t.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?_t.CardCode:_t.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new At(Ot.PaymentNotInitialized);return this.cardFields}getInputStyles(t){var e,n,r;const i={"font-size":(null===(e=null==t?void 0:t.default)||void 0===e?void 0:e.fontSize)||"1rem","font-family":(null===(n=null==t?void 0:t.default)||void 0===n?void 0:n.fontFamily)||"Montserrat, Arial, Helvetica, sans-serif","font-weight":(null===(r=null==t?void 0:t.default)||void 0===r?void 0:r.fontWeight)||"400",outline:"none",padding:"9px 13px"},o=Object.assign(Object.assign({},i),{color:"#333333"});return{input:o,".invalid":Object.assign(Object.assign({},i),{color:"red"}),".valid":o,":focus":o}}stylizeInputContainers(t){Object.values(t||{}).forEach(t=>{const e=document.getElementById(`${(null==t?void 0:t.containerId)||""}`);e&&(e.style.padding="0px",e.style.boxShadow="none",e.style.border="none",e.style.background="transparent",e.style.marginBottom="10px",e.style.marginLeft="-5px")})}hasUndefinedValues(){return!this.hostedFormOptions||Object.values(this.hostedFormOptions.fields).some(t=>void 0===t)}onChangeHandler(t,e){var n;null===(n=null==t?void 0:t.onValidate)||void 0===n||n.call(t,this.getValidityData(e))}onFocusHandler(t,e){var n;null===(n=null==t?void 0:t.onFocus)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}onBlurHandler(t,e){var n;null===(n=null==t?void 0:t.onBlur)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}onInputSubmitRequest(t,e){var n;null===(n=null==t?void 0:t.onEnter)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}shouldInitializePayPalFastlane(t){var e,n;const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(t),o=r.getPaymentProviderCustomer(),a=(s=o)&&("authenticationState"in s||"addresses"in s||"instruments"in s)?o:{};var s;return(null===(e=null==i?void 0:i.initializationData)||void 0===e?void 0:e.isAcceleratedCheckoutEnabled)&&(null===(n=null==i?void 0:i.initializationData)||void 0===n?void 0:n.isPayPalCommerceAnalyticsV2Enabled)&&!(null==a?void 0:a.authenticationState)}initializePayPalFastlaneOrThrow(t){return Et(this,void 0,void 0,function*(){try{const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow(),r=e.getPaymentMethodOrThrow(t),{initializationData:i}=r;if(!(null==i?void 0:i.connectClientToken))return;const o=yield this.paypalCommerceSdk.getPayPalFastlaneSdk(r,n.currency.code,n.id);yield this.paypalCommerceFastlaneUtils.initializePayPalFastlane(o,!!(null==i?void 0:i.isDeveloperModeApplicable))}catch(t){}})}}const xt=i(t=>new jt(t,M(t),J(),St()),[{id:"paypalcommercecreditcards"}]);var Tt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class zt{constructor(t,e,n,r=3e3,i=3e5){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=y.noop}initialize(t){return Tt(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,paypalcommerceratepay:r}=t;if(!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new N('Unable to initialize payment because "options.paypalcommerceratepay" argument is not provided.');const{legalTextContainer:i,container:o,loadingContainerId:a}=r;if(!o)throw new N('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new N('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new N('Unable to initialize payment because "options.loadingContainerId" argument is not provided.');this.loadingIndicatorContainer=a;const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(n,e),{merchantId:u}=s.initializationData||{};if(!u)throw new N("Unable to initialize payment because merchantId argument is not provided.");this.paypalcommerceratepay=r,yield this.paypalCommerceIntegrationService.loadPayPalSdk(n),this.createFraudNetScript(u,n,e),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(t,e){return Tt(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{getFieldsValues:i}=this.paypalcommerceratepay||{};if(!n)throw new R(["payment"]);if(!i||"function"!=typeof i)throw new N('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const t=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout",{metadataId:this.guid}),{ratepayBirthDate:o,ratepayPhoneNumber:a,ratepayPhoneCountryCode:s}=i(),u={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:n.methodId,rate_pay:{birth_date:this.normalizeDate(o),phone:{national_number:a,country_code:s.split("+")[1]}},paypal_account:{order_id:t}}};return yield this.paymentIntegrationService.submitOrder(r,e),yield this.paymentIntegrationService.submitPayment({methodId:n.methodId,paymentData:u}),yield new Promise((t,e)=>{this.initializePollingMechanism(n.methodId,t,e,n.gatewayId)})}catch(t){return this.handleError(t),new Promise((t,e)=>e())}})}finalize(){return Promise.reject(new V)}deinitialize(){const{legalTextContainer:t}=this.paypalcommerceratepay||{},e=document.querySelectorAll('[data-id="fraudnetScript"]')[0],n=document.querySelectorAll('[data-id="fraudnetConfig"]')[0];if(this.deinitializePollingMechanism(),e.remove(),n.remove(),t){const e=document.getElementById(t);null==e||e.remove()}return Promise.resolve()}normalizeDate(t){const e=this.formatDate(t.getDate()),n=this.formatDate(t.getMonth()+1);return`${t.getFullYear()}-${n}-${e}`}formatDate(t){return`${t<10?0:""}${t}`}renderLegalText(t,e){const n=t,r=e.split("#")[1],i=document.getElementById(r),o=null==i?void 0:i.parentNode,a=document.createElement("div");a.style.marginBottom="20px",a.setAttribute("id",n),null==o||o.prepend(a);const s=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),u=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new N('Unable to initialize payment because "legalTextContainerElement" argument is not found.');u.render(`#${n}`)}handleError(t){const{onError:e}=this.paypalcommerceratepay||{};this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}createFraudNetScript(t,e,n){const r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e,n),{testMode:i}=r.config,o=document.createElement("script");o.setAttribute("type","application/json"),o.setAttribute("fncls","fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99"),o.setAttribute("data-id","fraudnetScript"),this.guid=this.generateGUID();const a={f:this.guid,s:`${t}_checkout-page`,sandbox:i};o.innerHTML=JSON.stringify(a),document.body.appendChild(o)}generateGUID(){let t="";for(let e=0;e<32;e+=1)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(62*Math.random())];return t}loadFraudnetConfig(){const t=document.createElement("script");t.setAttribute("data-id","fraudnetConfig"),t.src="https://c.paypal.com/da/r/fb.js",document.body.appendChild(t)}reinitializeStrategy(t){return Tt(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}initializePollingMechanism(t,e,n,r){return Tt(this,void 0,void 0,function*(){yield new Promise((t,e)=>{const n=setTimeout(t,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),e())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.paypalCommerceIntegrationService.getOrderStatus("paypalcommercealternativemethods",{params:{useMetadata:!0}}),o=i===O.PollingStop,a=i===O.PollingError;if(o)return this.deinitializePollingMechanism(),e();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(t,e,n,r);yield this.reinitializeStrategy({methodId:t,gatewayId:r,paypalcommerceratepay:this.paypalcommerceratepay}),this.handleError(new it)}catch(t){this.handleError(t),n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const Ft=i(t=>new zt(t,M(t),new p({containerStyles:Object.assign(Object.assign({},U),{position:"fixed"})})),[{gateway:"paypalcommercealternativemethods",id:"ratepay"}]);function Bt(t){return"string"!=typeof t}function Dt(t,e){if(e||t)return function(t){var e,n;const r={},i=(0,y.omitBy)(t.root,Bt),o=(0,y.omitBy)(t.input,Bt),a=(0,y.omitBy)(t.toggle,Bt),s=(0,y.omitBy)(null===(e=t.text)||void 0===e?void 0:e.body,Bt),u=(0,y.omitBy)(null===(n=t.text)||void 0===n?void 0:n.caption,Bt),c=t.branding;return Object.keys(i).length&&(r.root=i),Object.keys(o).length&&(r.input=o),Object.keys(a).length&&(r.toggle=a),Object.keys(s).length&&(r.text={},r.text.body=s),Object.keys(u).length&&(r.text=Object.assign({},r.text),r.text.caption=u),c&&(r.branding=c),r}(function(t,e){var n,r,i,o,a,s,u,c,l,d,p,h,f,y,m,v,g,b,w,S,_,I;return{root:{backgroundColorPrimary:(null==t?void 0:t.fastlaneRootSettingsBackgroundColor)||(null===(n=null==e?void 0:e.root)||void 0===n?void 0:n.backgroundColorPrimary),errorColor:(null==t?void 0:t.fastlaneRootSettingsErrorColor)||(null===(r=null==e?void 0:e.root)||void 0===r?void 0:r.errorColor),fontFamily:(null==t?void 0:t.fastlaneRootSettingsFontFamily)||(null===(i=null==e?void 0:e.root)||void 0===i?void 0:i.fontFamily),fontSizeBase:(null==t?void 0:t.fastlaneRootSettingsFontSize)||(null===(o=null==e?void 0:e.root)||void 0===o?void 0:o.fontSizeBase),padding:(null==t?void 0:t.fastlaneRootSettingsPadding)||(null===(a=null==e?void 0:e.root)||void 0===a?void 0:a.padding),primaryColor:(null==t?void 0:t.fastlaneRootSettingsPrimaryColor)||(null===(s=null==e?void 0:e.root)||void 0===s?void 0:s.primaryColor)},input:{borderRadius:(null==t?void 0:t.fastlaneInputSettingsBorderRadius)||(null===(u=null==e?void 0:e.input)||void 0===u?void 0:u.borderRadius),borderColor:(null==t?void 0:t.fastlaneInputSettingsBorderColor)||(null===(c=null==e?void 0:e.input)||void 0===c?void 0:c.borderColor),focusBorderColor:(null==t?void 0:t.fastlaneInputSettingsFocusBorderBase)||(null===(l=null==e?void 0:e.input)||void 0===l?void 0:l.focusBorderColor),backgroundColor:(null==t?void 0:t.fastlaneInputSettingsBackgroundColor)||(null===(d=null==e?void 0:e.input)||void 0===d?void 0:d.backgroundColor),borderWidth:(null==t?void 0:t.fastlaneInputSettingsBorderWidth)||(null===(p=null==e?void 0:e.input)||void 0===p?void 0:p.borderWidth),textColorBase:(null==t?void 0:t.fastlaneInputSettingsTextColorBase)||(null===(h=null==e?void 0:e.input)||void 0===h?void 0:h.textColorBase)},toggle:{colorPrimary:(null==t?void 0:t.fastlaneToggleSettingsColorPrimary)||(null===(f=null==e?void 0:e.toggle)||void 0===f?void 0:f.colorPrimary),colorSecondary:(null==t?void 0:t.fastlaneToggleSettingsColorSecondary)||(null===(y=null==e?void 0:e.toggle)||void 0===y?void 0:y.colorSecondary)},text:{body:{color:(null==t?void 0:t.fastlaneTextBodySettingsColor)||(null===(v=null===(m=null==e?void 0:e.text)||void 0===m?void 0:m.body)||void 0===v?void 0:v.color),fontSize:(null==t?void 0:t.fastlaneTextBodySettingsFontSize)||(null===(b=null===(g=null==e?void 0:e.text)||void 0===g?void 0:g.body)||void 0===b?void 0:b.fontSize)},caption:{color:(null==t?void 0:t.fastlaneTextCaptionSettingsColor)||(null===(S=null===(w=null==e?void 0:e.text)||void 0===w?void 0:w.caption)||void 0===S?void 0:S.color),fontSize:(null==t?void 0:t.fastlaneTextCaptionSettingsFontSize)||(null===(I=null===(_=null==e?void 0:e.text)||void 0===_?void 0:_.caption)||void 0===I?void 0:I.fontSize)}},branding:(null==t?void 0:t.fastlaneBrandingSettings)||(null==e?void 0:e.branding)}}(t,e))}function Mt(t){return!!t&&("authenticationState"in t||"addresses"in t||"instruments"in t)}var Ut=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Nt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceRequestSender=e,this.paypalCommerceSdk=n,this.paypalCommerceFastlaneUtils=r}initialize(t){var e,n;return Ut(this,void 0,void 0,function*(){const{methodId:r,paypalcommercefastlane:i}=t;if(this.methodId=r,this.paypalcommercefastlane=i,!r)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new N('Unable to initialize payment because "options.paypalcommercefastlane" argument is not provided.');if(!i.onInit||"function"!=typeof i.onInit)throw new N('Unable to initialize payment because "options.paypalcommercefastlane.onInit" argument is not provided or it is not a function.');if(!i.onChange||"function"!=typeof i.onChange)throw new N('Unable to initialize payment because "options.paypalcommercefastlane.onChange" argument is not provided or it is not a function.');yield this.paymentIntegrationService.loadPaymentMethod(r);const o=this.paymentIntegrationService.getState(),a=o.getCartOrThrow(),s=o.getPaymentMethodOrThrow(r),{isDeveloperModeApplicable:u,isFastlaneStylingEnabled:c}=s.initializationData||{};this.threeDSVerificationMethod=null===(e=s.initializationData)||void 0===e?void 0:e.threeDSVerificationMethod,this.paypalFastlaneSdk=yield this.paypalCommerceSdk.getPayPalFastlaneSdk(s,a.currency.code,a.id);const l=Dt(c?null===(n=null==s?void 0:s.initializationData)||void 0===n?void 0:n.fastlaneStyles:{},null==i?void 0:i.styles);yield this.paypalCommerceFastlaneUtils.initializePayPalFastlane(this.paypalFastlaneSdk,!!u,l),this.shouldRunAuthenticationFlow()&&(yield this.runPayPalAuthenticationFlowOrThrow(r)),yield this.initializePayPalPaymentComponent(),i.onInit(t=>this.renderPayPalPaymentComponent(t)),i.onChange(()=>this.handlePayPalStoredInstrumentChange(r))})}execute(t,e){return Ut(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new R(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&$(i);try{yield this.paymentIntegrationService.submitOrder(r,e);const t=a?yield this.prepareVaultedInstrumentPaymentPayload(o,i):yield this.preparePaymentPayload(o,i);yield this.paymentIntegrationService.submitPayment(t),this.paypalCommerceFastlaneUtils.removeStorageSessionId()}catch(t){if(function(t){return"object"==typeof t&&null!==t&&"message"in t&&"response"in t&&"body"in t.response&&"name"in t.response.body}(t)&&"INVALID_REQUEST"===t.response.body.name){const t={translationKey:"payment.errors.invalid_request_error"};return this.handleError(t),Promise.reject()}if(t instanceof Error&&"FastlaneError"!==t.name)throw t;return Promise.reject()}})}finalize(){return Promise.reject(new V)}deinitialize(){return Ut(this,void 0,void 0,function*(){return Promise.resolve()})}shouldRunAuthenticationFlow(){const t=this.paymentIntegrationService.getState(),e=t.getCartOrThrow(),n=t.getCustomerOrThrow(),r=t.getPaymentProviderCustomer(),i=Mt(r)?r:{},o=this.paypalCommerceFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===mt.CANCELED||(null==i?void 0:i.authenticationState)||o!==e.id)}runPayPalAuthenticationFlowOrThrow(t){return Ut(this,void 0,void 0,function*(){try{const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow(),r=e.getCustomer(),i=e.getBillingAddress(),o=(null==r?void 0:r.email)||(null==i?void 0:i.email)||"",{customerContextId:a}=yield this.paypalCommerceFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalCommerceFastlaneUtils.triggerAuthenticationFlowOrThrow(a),{authenticationState:u,addresses:c,instruments:l}=this.paypalCommerceFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:u,addresses:c,instruments:l}),s.authenticationState===mt.CANCELED?this.paypalCommerceFastlaneUtils.removeStorageSessionId():this.paypalCommerceFastlaneUtils.updateStorageSessionId(n.id)}catch(t){}})}initializePayPalPaymentComponent(){return Ut(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),e=t.phone,n=`${t.firstName} ${t.lastName}`.trim(),r=this.paypalCommerceFastlaneUtils.getPayPalFastlaneOrThrow(),i={fields:Object.assign({cardholderName:{prefill:n,enabled:!0}},e&&{phoneNumber:{prefill:e}})};this.paypalComponentMethods=yield r.FastlaneCardComponent(i)})}renderPayPalPaymentComponent(t){const e=this.getPayPalComponentMethodsOrThrow();if(!t)throw new N('Unable to render card component because "container" argument is not provided.');e.render(t)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new a;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(t,e){return Ut(this,void 0,void 0,function*(){const{instrumentId:n}=e,r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),i=this.isPaypalCommerceFastlaneThreeDSAvailable()&&r.config.is3dsEnabled;i||(yield this.createOrder(n));const o=i?yield this.get3DSNonce(n):n;return{methodId:t,paymentData:{formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:o}}}}})}preparePaymentPayload(t,e){return Ut(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getBillingAddressOrThrow(),i=n.getPaymentMethodOrThrow(t),o=`${r.firstName} ${r.lastName}`.trim(),{getPaymentToken:a}=this.getPayPalComponentMethodsOrThrow(),{id:s}=yield a({name:{fullName:o},billingAddress:this.paypalCommerceFastlaneUtils.mapBcToPayPalAddress(r)}),u=this.isPaypalCommerceFastlaneThreeDSAvailable()&&i.config.is3dsEnabled;u||(yield this.createOrder(s));const c=u?yield this.get3DSNonce(s):s,{shouldSaveInstrument:l=!1,shouldSetAsDefaultInstrument:d=!1}=q(e)?e:{};return{methodId:t,paymentData:Object.assign(Object.assign({},e),{shouldSaveInstrument:l,shouldSetAsDefaultInstrument:d,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:c}}})}})}createOrder(t){return Ut(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState().getCartOrThrow().id;if(this.methodId){const{orderId:n}=yield this.paypalCommerceRequestSender.createOrder(this.methodId,{cartId:e,fastlaneToken:t});this.orderId=n}})}get3DSNonce(t){var e;return Ut(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),o=n.getStoreConfigOrThrow().links.checkoutLink,s=null===(e=this.paypalFastlaneSdk)||void 0===e?void 0:e.ThreeDomainSecureClient;if(!s)throw new a;const u={amount:i.orderAmount.toFixed(2),currency:r.currency.code,nonce:t,threeDSRequested:"SCA_ALWAYS"===this.threeDSVerificationMethod,transactionContext:{experience_context:{locale:"en-US",return_url:o,cancel_url:o}}};if(yield s.isEligible(u)){const{liabilityShift:t,authenticationState:e,nonce:n}=yield s.show();if(t===w.No||t===w.Unknown||e===dt.Errored||e===dt.Cancelled)throw new L;if(e===dt.Succeeded)return yield this.createOrder(n),n}return t})}handlePayPalStoredInstrumentChange(t){return Ut(this,void 0,void 0,function*(){const e=this.paypalCommerceFastlaneUtils.getPayPalFastlaneOrThrow(),{selectionChanged:n,selectedCard:r}=yield e.profile.showCardSelector();if(n){const e=this.paymentIntegrationService.getState().getPaymentProviderCustomer(),n=Mt(e)?e:{},i=this.paypalCommerceFastlaneUtils.mapPayPalToBcInstrument(t,r)[0];return yield this.paymentIntegrationService.updatePaymentProviderCustomer(Object.assign(Object.assign({},n),{instruments:[i]})),i}})}isPaypalCommerceFastlaneThreeDSAvailable(){return ot(this.paymentIntegrationService.getState().getStoreConfigOrThrow().checkoutSettings.features,"PROJECT-7080.paypalcommerce_fastlane_three_ds")}handleError(t){var e;(null===(e=this.paypalcommercefastlane)||void 0===e?void 0:e.onError)&&"function"==typeof this.paypalcommercefastlane.onError&&this.paypalcommercefastlane.onError(t)}}const Rt=i(t=>{const{getHost:e}=t.getState();return new Nt(t,new F((0,f.createRequestSender)({host:e()})),J(),St())},[{id:"paypalcommerceacceleratedcheckout"}]);var Lt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Vt{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.onError=y.noop}initialize(t){return Lt(this,void 0,void 0,function*(){const{paypalcommerce:e,methodId:n}=t;if(!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(!e.container)throw new N('Unable to initialize payment because "options.paypalcommerce.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new N('Unable to initialize payment because "options.paypalcommerce.onClick" argument is not a function.');this.onError=e.onError||y.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return Lt(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signInCustomer(t,e),Promise.resolve()})}signOut(t){return Lt(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signOutCustomer(t),Promise.resolve()})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){var n,r;const{container:i,onClick:o,onComplete:a}=e,s=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:c,paymentButtonStyles:l,isAppSwitchEnabled:d}=u.initializationData||{},{checkoutTopButtonStyles:p}=l||{},h=Object.assign(Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommerce"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)}),o&&{onClick:()=>o()}),f=Object.assign(Object.assign({},!d&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,a)}),y=Object.assign(Object.assign({fundingSource:s.FUNDING.PAYPAL,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},p),{height:36}))},h),c&&f),m=s.Buttons(y);m.isEligible()?(null===(n=m.hasReturned)||void 0===n?void 0:n.call(m))&&this.isPaypalCommerceAppSwitchEnabled(t)?null===(r=m.resume)||void 0===r||r.call(m):m.render(`#${i}`):this.paypalCommerceIntegrationService.removeElement(i)}onHostedCheckoutApprove(e,n,r,i){return Lt(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),o.lineItems.physicalItems.length>0){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalCommerceIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return Lt(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}onShippingOptionsChange(t){return Lt(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}}const qt=i(t=>new Vt(t,M(t)),[{id:"paypalcommerce"}]);var $t=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Wt{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.onError=y.noop}initialize(t){return $t(this,void 0,void 0,function*(){const{paypalcommercecredit:e,methodId:n}=t;if(!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(!e.container)throw new N('Unable to initialize payment because "options.paypalcommercecredit.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new N('Unable to initialize payment because "options.paypalcommercecredit.onClick" argument is not a function.');this.onError=e.onError||y.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return $t(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return $t(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){const{container:n,onComplete:r,onClick:i}=e,o=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:s,paymentButtonStyles:u,isAppSwitchEnabled:c}=a.initializationData||{},{checkoutTopButtonStyles:l}=u||{},d=Object.assign({createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},i&&{onClick:()=>i()}),p=Object.assign(Object.assign({},!c&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,r)}),h=[o.FUNDING.PAYLATER,o.FUNDING.CREDIT];let f=!1;h.forEach(t=>{if(!f){const e=Object.assign(Object.assign({fundingSource:t,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},l),{height:36}))},d),s&&p),r=o.Buttons(e);r.isEligible()&&(r.render(`#${n}`),f=!0)}}),f||this.paypalCommerceIntegrationService.removeElement(n)}onHostedCheckoutApprove(e,n,r,i){return $t(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),o.lineItems.physicalItems.length>0){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalCommerceIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return $t(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}onShippingOptionsChange(t){return $t(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}}const Ht=i(t=>new Wt(t,M(t)),[{id:"paypalcommercecredit"}]);var Gt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Yt{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return Gt(this,void 0,void 0,function*(){const{paypalcommercevenmo:e,methodId:n}=t;if(!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(!e.container)throw new N('Unable to initialize payment because "options.paypalcommercevenmo.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new N('Unable to initialize payment because "options.paypalcommercevenmo.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return Gt(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return Gt(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){const{container:n,onClick:r}=e,i=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:a}=o.initializationData||{},{checkoutTopButtonStyles:s}=a||{},u=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},s),{height:36})),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},r&&{onClick:()=>r()}),c=i.Buttons(u);c.isEligible()?c.render(`#${n}`):this.paypalCommerceIntegrationService.removeElement(n)}}const Kt=i(t=>new Yt(t,M(t)),[{id:"paypalcommercevenmo"}]);var Jt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Zt{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalCommerceSdk=e,this.paypalCommerceFastlaneUtils=n}initialize(t){var e;return Jt(this,void 0,void 0,function*(){const{methodId:n,paypalcommercefastlane:r}=t;if(!n)throw new N('Unable to proceed because "methodId" argument is not provided.');try{yield this.paymentIntegrationService.loadPaymentMethod(n);const t=this.paymentIntegrationService.getState(),i=t.getCartOrThrow(),o=t.getPaymentMethodOrThrow(n),a=!!(null===(e=o.initializationData)||void 0===e?void 0:e.isDeveloperModeApplicable),s=yield this.paypalCommerceSdk.getPayPalFastlaneSdk(o,i.currency.code,i.id);yield this.paypalCommerceFastlaneUtils.initializePayPalFastlane(s,a,this.getFastlaneStyles(n,r))}catch(t){}return Promise.resolve()})}deinitialize(){return Jt(this,void 0,void 0,function*(){return Promise.resolve()})}signIn(t,e){return Jt(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return Jt(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){return Jt(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:e,continueWithCheckoutCallback:n,methodId:r}=t||{};if(!r)throw new N('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new N('Unable to proceed because "continueWithCheckoutCallback" argument is not provided and it must be a function.');if(this.paymentIntegrationService.getState().getCustomerOrThrow().isGuest){e&&"function"==typeof e&&e();try{yield this.runPayPalAuthenticationFlowOrThrow(r)}catch(t){}}n()})}runPayPalAuthenticationFlowOrThrow(t){return Jt(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow().id,r=e.getCustomer(),i=e.getBillingAddress(),o=(null==r?void 0:r.email)||(null==i?void 0:i.email)||"",{customerContextId:a}=yield this.paypalCommerceFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalCommerceFastlaneUtils.triggerAuthenticationFlowOrThrow(a),u=s.authenticationState===mt.CANCELED;yield this.updateCustomerDataState(t,s),u?this.paypalCommerceFastlaneUtils.removeStorageSessionId():this.paypalCommerceFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(t,e){var n;return Jt(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:u}=this.paypalCommerceFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,e);if(yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:i,addresses:o,instruments:u}),a&&(yield this.paymentIntegrationService.updateBillingAddress(a)),s&&r.lineItems.physicalItems.length>0){const e=yield this.paymentIntegrationService.updateShippingAddress(s),r=e.getPaymentMethodOrThrow(t),{isFastlaneShippingOptionAutoSelectEnabled:i}=r.initializationData||{},o=e.getConsignments()||[],a=(null===(n=o[0])||void 0===n?void 0:n.availableShippingOptions)||[],u=a[0],c=a.find(t=>t.isRecommended);if((c||u)&&i){const t=(null==c?void 0:c.id)||u.id;yield this.paymentIntegrationService.selectShippingOption(t)}}})}getFastlaneStyles(t,e){const n=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{fastlaneStyles:r,isFastlaneStylingEnabled:i}=n.initializationData||{};return Dt(i?r:{},null==e?void 0:e.styles)}}const Xt=i(t=>new Zt(t,J(),St()),[{id:"paypalcommerceacceleratedcheckout"},{id:"paypalcommercecreditcards"}]);var Qt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class te{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){var e;return Qt(this,void 0,void 0,function*(){const{paypalcommerce:n,containerId:r,methodId:i}=t,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new N('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new N('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(o&&!n.currencyCode)throw new N('Unable to initialize payment because "options.paypalcommerce.currencyCode" argument is not provided.');if(o&&"function"!=typeof(null===(e=n.buyNowInitializeOptions)||void 0===e?void 0:e.getBuyNowCartRequestBody))throw new N('Unable to initialize payment because "options.paypalcommerce.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');o||(yield this.paymentIntegrationService.loadDefaultCheckout());const a=o?n.currencyCode:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(i,a,!1),this.renderButton(r,i,n,o)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n,r){var i,o;const{buyNowInitializeOptions:a,style:s,onComplete:u,onEligibilityFailure:c}=n,l=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),d=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:p,isAppSwitchEnabled:h}=d.initializationData||{},f=Object.assign(Object.assign({},!r&&this.isPaypalCommerceAppSwitchEnabled(e)&&{appSwitchWhenAvailable:!0}),{createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommerce"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)}),y={onClick:()=>this.handleClick(a),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},m=Object.assign(Object.assign({},!h&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,u)}),v=Object.assign(Object.assign(Object.assign({fundingSource:l.FUNDING.PAYPAL,style:this.paypalCommerceIntegrationService.getValidButtonStyle(s)},f),a&&y),p&&m),g=l.Buttons(v);g.isEligible()?(null===(i=g.hasReturned)||void 0===i?void 0:i.call(g))&&this.isPaypalCommerceAppSwitchEnabled(e)?null===(o=g.resume)||void 0===o||o.call(g):g.render(`#${t}`):c&&"function"==typeof c?c():this.paypalCommerceIntegrationService.removeElement(t)}handleClick(t){return Qt(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(e,n,r,i){return Qt(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),o.lineItems.physicalItems.length>0){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalCommerceIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t){return Qt(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingOptionsChange(t){return Qt(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}}const ee=i(t=>new te(t,M(t)),[{id:"paypalcommerce"}]);var ne=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class re{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalCommerceSdk=n}initialize(t){var e;return ne(this,void 0,void 0,function*(){const{paypalcommercecredit:n,containerId:r,methodId:i}=t,{buyNowInitializeOptions:o,currencyCode:a,messagingContainerId:s}=n||{},u=!!o;if(!i)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new N('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new N('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(u&&!a)throw new N('Unable to initialize payment because "options.paypalcommercecredit.currencyCode" argument is not provided.');if(u&&"function"!=typeof(null==o?void 0:o.getBuyNowCartRequestBody))throw new N('Unable to initialize payment because "options.paypalcommercecredit.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');u||(yield this.paymentIntegrationService.loadDefaultCheckout());const c=this.paymentIntegrationService.getState(),l=u?a:c.getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(i,l,!1),this.renderButton(r,i,n);const d=c.getStoreConfigOrThrow().checkoutSettings.features;if(null!==(e=d["PAYPAL-5557.Hide_ppc_banner_implementation"])&&void 0!==e&&e)return;const p=s&&document.getElementById(s);if(l&&p){const t=c.getPaymentMethodOrThrow(i),{paypalBNPLConfiguration:e=[]}=t.initializationData||{},n=e&&e.find(({id:t})=>"cart"===t);if(!(null==n?void 0:n.status))return;p.removeAttribute("data-pp-style-logo-type"),p.removeAttribute("data-pp-style-logo-position"),p.removeAttribute("data-pp-style-text-color"),p.removeAttribute("data-pp-style-text-size");const r=yield this.paypalCommerceSdk.getPayPalMessages(t,l);this.renderMessages(r,s,n)}})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:c,isAppSwitchEnabled:l}=u.initializationData||{},d={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},p={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h=Object.assign(Object.assign({},!l&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,o)}),f=[s.FUNDING.PAYLATER,s.FUNDING.CREDIT];let y=!1;f.forEach(e=>{if(!y){const n=Object.assign(Object.assign(Object.assign({fundingSource:e,style:this.paypalCommerceIntegrationService.getValidButtonStyle(i)},d),r&&p),c&&h),o=s.Buttons(n);o.isEligible()?(o.render(`#${t}`),y=!0):a&&"function"==typeof a&&a()}}),y||this.paypalCommerceIntegrationService.removeElement(t)}handleClick(t){return ne(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(e,n,r,i){return ne(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),o.lineItems.physicalItems.length>0){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalCommerceIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t){return ne(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingOptionsChange(t){return ne(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"cart",style:W(n)};t.Messages(r).render(`#${e}`)}}const ie=i(t=>new re(t,M(t),J()),[{id:"paypalcommercecredit"}]);var oe=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ae{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return oe(this,void 0,void 0,function*(){const{paypalcommercevenmo:e,containerId:n,methodId:r}=t,{buyNowInitializeOptions:i,currencyCode:o}=e||{},a=!!i;if(!r)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new N('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(a&&!o)throw new N('Unable to initialize payment because "options.paypalcommercevenmo.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new N('Unable to initialize payment because "options.paypalcommercevenmo.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');a||(yield this.paymentIntegrationService.loadDefaultCheckout());const s=a?o:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(r,s,!1),this.renderButton(n,r,e)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onEligibilityFailure:o}=n,a=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),s=a.FUNDING.VENMO,u={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},c={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:s,style:this.getValidVenmoButtonStyles(i)},u),r&&c),d=a.Buttons(l);d.isEligible()?d.render(`#${t}`):o&&"function"==typeof o?o():this.paypalCommerceIntegrationService.removeElement(t)}getValidVenmoButtonStyles(t){const e=this.paypalCommerceIntegrationService.getValidButtonStyle(t);return e.color===I.gold?Object.assign(Object.assign({},e),{color:void 0}):e}handleClick(t){return oe(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const se=i(t=>new ae(t,M(t)),[{id:"paypalcommercevenmo"}]);var ue=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ce{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return ue(this,void 0,void 0,function*(){const{paypalcommercealternativemethods:e,containerId:n,methodId:r}=t,{apm:i,buyNowInitializeOptions:o,currencyCode:a}=e||{},s=!!o;if(!r)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new N('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');if(!i)throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods.apm" argument is not provided.');if(s&&!a)throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods.currencyCode" argument is not provided.');if(s&&"function"!=typeof(null==o?void 0:o.getBuyNowCartRequestBody))throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');s||(yield this.paymentIntegrationService.loadDefaultCheckout());const u=s?a:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(r,u,!1),this.renderButton(n,r,e)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{apm:r,buyNowInitializeOptions:i,style:o,onEligibilityFailure:a}=n,s=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow();if(!Object.values(s.FUNDING).includes(r))throw new N('Unable to initialize PayPal button because "options.paypalcommercealternativemethods.apm" argument is not valid funding source.');const u={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethod"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},c={onClick:()=>this.handleClick(i),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:r,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o)},u),i&&c),d=s.Buttons(l);d.isEligible()?d.render(`#${t}`):a&&"function"==typeof a?a():this.paypalCommerceIntegrationService.removeElement(t)}handleClick(t){return ue(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const le=i(t=>new ce(t,M(t)),[{id:"paypalcommercealternativemethods"}])})(),module.exports=r})();
|
|
2
|
+
(()=>{var t={35:(t,e,n)=>{t=n.nmd(t);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",a="[object Function]",s="[object Object]",u=/^\[object .+?Constructor\]$/,c=/^(?:0|[1-9]\d*)$/,l={};l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l[o]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object Boolean]"]=l["[object DataView]"]=l["[object Date]"]=l["[object Error]"]=l[a]=l["[object Map]"]=l["[object Number]"]=l[s]=l["[object RegExp]"]=l["[object Set]"]=l["[object String]"]=l["[object WeakMap]"]=!1;var d,p,h,f="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,y="object"==typeof self&&self&&self.Object===Object&&self,m=f||y||Function("return this")(),v=e&&!e.nodeType&&e,g=v&&t&&!t.nodeType&&t,b=g&&g.exports===v,w=b&&f.process,S=function(){try{return g&&g.require&&g.require("util").types||w&&w.binding&&w.binding("util")}catch(t){}}(),_=S&&S.isTypedArray,I=Array.prototype,C=Function.prototype,P=Object.prototype,O=m["__core-js_shared__"],A=C.toString,k=P.hasOwnProperty,E=(d=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+d:"",j=P.toString,x=A.call(Object),T=RegExp("^"+A.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z=b?m.Buffer:void 0,F=m.Symbol,B=m.Uint8Array,D=(z&&z.allocUnsafe,p=Object.getPrototypeOf,h=Object,function(t){return p(h(t))}),M=Object.create,U=P.propertyIsEnumerable,N=I.splice,R=F?F.toStringTag:void 0,L=function(){try{var t=st(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),V=z?z.isBuffer:void 0,q=Math.max,$=Date.now,W=st(m,"Map"),H=st(Object,"create"),G=function(){function t(){}return function(e){if(!bt(e))return{};if(M)return M(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Y(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function K(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function J(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Z(t){var e=this.__data__=new K(t);this.size=e.size}function X(t,e,n){(void 0!==n&&!pt(t[e],n)||void 0===n&&!(e in t))&&et(t,e,n)}function Q(t,e,n){var r=t[e];k.call(t,e)&&pt(r,n)&&(void 0!==n||e in t)||et(t,e,n)}function tt(t,e){for(var n=t.length;n--;)if(pt(t[n][0],e))return n;return-1}function et(t,e,n){"__proto__"==e&&L?L(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}Y.prototype.clear=function(){this.__data__=H?H(null):{},this.size=0},Y.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Y.prototype.get=function(t){var e=this.__data__;if(H){var n=e[t];return n===r?void 0:n}return k.call(e,t)?e[t]:void 0},Y.prototype.has=function(t){var e=this.__data__;return H?void 0!==e[t]:k.call(e,t)},Y.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=H&&void 0===e?r:e,this},K.prototype.clear=function(){this.__data__=[],this.size=0},K.prototype.delete=function(t){var e=this.__data__,n=tt(e,t);return!(n<0||(n==e.length-1?e.pop():N.call(e,n,1),--this.size,0))},K.prototype.get=function(t){var e=this.__data__,n=tt(e,t);return n<0?void 0:e[n][1]},K.prototype.has=function(t){return tt(this.__data__,t)>-1},K.prototype.set=function(t,e){var n=this.__data__,r=tt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},J.prototype.clear=function(){this.size=0,this.__data__={hash:new Y,map:new(W||K),string:new Y}},J.prototype.delete=function(t){var e=at(this,t).delete(t);return this.size-=e?1:0,e},J.prototype.get=function(t){return at(this,t).get(t)},J.prototype.has=function(t){return at(this,t).has(t)},J.prototype.set=function(t,e){var n=at(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Z.prototype.clear=function(){this.__data__=new K,this.size=0},Z.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,e){var n=this.__data__;if(n instanceof K){var r=n.__data__;if(!W||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new J(r)}return n.set(t,e),this.size=n.size,this};function nt(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":R&&R in Object(t)?function(t){var e=k.call(t,R),n=t[R];try{t[R]=void 0;var r=!0}catch(t){}var i=j.call(t);return r&&(e?t[R]=n:delete t[R]),i}(t):function(t){return j.call(t)}(t)}function rt(t){return wt(t)&&nt(t)==o}function it(t,e,n,r,i){t!==e&&function(t,e,n){for(var r=-1,i=Object(t),o=n(t),a=o.length;a--;){var s=o[++r];if(!1===e(i[s],s,i))break}}(e,function(o,a){if(i||(i=new Z),bt(o))!function(t,e,n,r,i,o,a){var u=lt(t,n),c=lt(e,n),l=a.get(c);if(l)X(t,n,l);else{var d,p,h,f,y,m=o?o(u,c,n+"",t,e,a):void 0,v=void 0===m;if(v){var g=ft(c),b=!g&&mt(c),w=!g&&!b&&St(c);m=c,g||b||w?ft(u)?m=u:wt(y=u)&&yt(y)?m=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(u):b?(v=!1,m=function(t){return t.slice()}(c)):w?(v=!1,f=new(h=(d=c).buffer).constructor(h.byteLength),new B(f).set(new B(h)),p=f,m=new d.constructor(p,d.byteOffset,d.length)):m=[]:function(t){if(!wt(t)||nt(t)!=s)return!1;var e=D(t);if(null===e)return!0;var n=k.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&A.call(n)==x}(c)||ht(c)?(m=u,ht(u)?m=function(t){return function(t,e,n){var r=!n;n||(n={});for(var i=-1,o=e.length;++i<o;){var a=e[i],s=void 0;void 0===s&&(s=t[a]),r?et(n,a,s):Q(n,a,s)}return n}(t,_t(t))}(u):bt(u)&&!vt(u)||(m=function(t){return"function"!=typeof t.constructor||ct(t)?{}:G(D(t))}(c))):v=!1}v&&(a.set(c,m),i(m,c,r,o,a),a.delete(c)),X(t,n,m)}}(t,e,a,n,it,r,i);else{var u=r?r(lt(t,a),o,a+"",t,e,i):void 0;void 0===u&&(u=o),X(t,a,u)}},_t)}var ot=L?function(t,e){return L(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Pt;function at(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function st(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!bt(t)||function(t){return!!E&&E in t}(t))&&(vt(t)?T:u).test(function(t){if(null!=t){try{return A.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function ut(t,e){var n=typeof t;return!!(e=null==e?i:e)&&("number"==n||"symbol"!=n&&c.test(t))&&t>-1&&t%1==0&&t<e}function ct(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||P)}function lt(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var dt=function(t){var e=0,n=0;return function(){var r=$(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(ot);function pt(t,e){return t===e||t!=t&&e!=e}var ht=rt(function(){return arguments}())?rt:function(t){return wt(t)&&k.call(t,"callee")&&!U.call(t,"callee")},ft=Array.isArray;function yt(t){return null!=t&>(t.length)&&!vt(t)}var mt=V||function(){return!1};function vt(t){if(!bt(t))return!1;var e=nt(t);return e==a||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function gt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}function bt(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function wt(t){return null!=t&&"object"==typeof t}var St=_?function(t){return function(e){return t(e)}}(_):function(t){return wt(t)&>(t.length)&&!!l[nt(t)]};function _t(t){return yt(t)?function(t,e){var n=ft(t),r=!n&&ht(t),i=!n&&!r&&mt(t),o=!n&&!r&&!i&&St(t),a=n||r||i||o,s=a?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],u=s.length;for(var c in t)!e&&!k.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ut(c,u))||s.push(c);return s}(t,!0):function(t){if(!bt(t))return function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}(t);var e=ct(t),n=[];for(var r in t)("constructor"!=r||!e&&k.call(t,r))&&n.push(r);return n}(t)}var It,Ct=(It=function(t,e,n){it(t,e,n)},function(t,e){return dt(function(t,e,n){return e=q(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=q(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=r[i];return s[e]=n(a),function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}(t,this,s)}}(t,e,Pt),t+"")}(function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;for(i=It.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(t,e,n){if(!bt(n))return!1;var r=typeof e;return!!("number"==r?yt(n)&&ut(e,n.length):"string"==r&&e in n)&&pt(n[e],t)}(e[0],e[1],o)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var a=e[n];a&&It(t,a,n)}return t}));function Pt(t){return t}t.exports=Ct},168:t=>{var e;e=function(){function t(){for(var t=0,e={};t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}function e(t){return t.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(e,n,o){if("undefined"!=typeof document){"number"==typeof(o=t({path:"/"},i.defaults,o)).expires&&(o.expires=new Date(1*new Date+864e5*o.expires)),o.expires=o.expires?o.expires.toUTCString():"";try{var a=JSON.stringify(n);/^[\{\[]/.test(a)&&(n=a)}catch(t){}n=r.write?r.write(n,e):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=encodeURIComponent(String(e)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var u in o)o[u]&&(s+="; "+u,!0!==o[u]&&(s+="="+o[u].split(";")[0]));return document.cookie=e+"="+n+s}}function a(t,n){if("undefined"!=typeof document){for(var i={},o=document.cookie?document.cookie.split("; "):[],a=0;a<o.length;a++){var s=o[a].split("="),u=s.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=e(s[0]);if(u=(r.read||r)(u,c)||e(u),n)try{u=JSON.parse(u)}catch(t){}if(i[c]=u,t===c)break}catch(t){}}return t?i[t]:i}}return i.set=o,i.get=function(t){return a(t,!1)},i.getJSON=function(t){return a(t,!0)},i.remove=function(e,n){o(e,"",t(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}(function(){})},"function"==typeof define&&define.amd&&define(e),t.exports=e()},282:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(9722);e.default=function(){return r||(r=i.default()),r}},315:(t,e,n)=>{"use strict";n(4886).default;var r=n(471);e.Hb=r.default;var i=n(5895);e.vQ=i.default,n(7995).default,n(9722).default,n(282).default},321:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(168),i=n(1675),o=n(5861),a=n(4670);function s(t){return new a.A(new o.A,new i.A,r,t)}},471:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(4886);e.default=function(){return new o.default(new i.default,r.createRequestSender())}},710:(t,e,n)=>{"use strict";function r(t){return"object"!=typeof t||null===t?t:Object.keys(t).filter(function(e){return void 0!==t[e]}).map(function(e){var n=t[e];return"string"==typeof n?e+"="+encodeURIComponent(n):e+"="+encodeURIComponent(JSON.stringify(n)||"")}).join("&")}n.d(e,{A:()=>r})},803:t=>{"use strict";t.exports=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}},1675:(t,e,n)=>{"use strict";n.d(e,{A:()=>s});var r=n(4321),i=n(710),o=/application\/(\w+\+)?json/,a=/application\/x-www-form-urlencoded/;const s=function(){function t(){}return t.prototype.toRequestBody=function(t){var e=t.headers?this._getHeader(t.headers,"Content-Type"):"";if(t.body){if(o.test(e))return JSON.stringify(t.body);if(a.test(e))return(0,i.A)(t.body)}return t.body},t.prototype.toResponse=function(t){var e=this._parseResponseHeaders(t.getAllResponseHeaders());return{body:this._parseResponseBody("response"in t?t.response:t.responseText,e),headers:e,status:t.status,statusText:t.statusText}},t.prototype._parseResponseBody=function(t,e){var n=this._getHeader(e,"Content-Type");return t&&o.test(n)?JSON.parse(t):t},t.prototype._parseResponseHeaders=function(t){return(t?t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/):[]).reduce(function(t,e){var n,i=e.split(":"),o=(i.shift()||"").trim();return o?(0,r.Cl)((0,r.Cl)({},t),((n={})[o.toLowerCase()]=i.join(":").trim(),n)):t},{})},t.prototype._getHeader=function(t,e){return t&&e&&(t[e]||t[e.toLowerCase()])||""},t}()},1915:t=>{"use strict";var e="%[a-f0-9]{2}",n=new RegExp("("+e+")|([^%]+?)","gi"),r=new RegExp("("+e+")+","gi");function i(t,e){try{return[decodeURIComponent(t.join(""))]}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function o(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(n)||[],r=1;r<e.length;r++)e=(t=i(e,r).join("")).match(n)||[];return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=r.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var i=o(n[0]);i!==n[0]&&(e[n[0]]=i)}n=r.exec(t)}e["%C2"]="�";for(var a=Object.keys(e),s=0;s<a.length;s++){var u=a[s];t=t.replace(new RegExp(u,"g"),e[u])}return t}(t)}}},2024:(t,e,n)=>{"use strict";n.d(e,{A:()=>r});const r=function(){function t(t){var e=this;this._delay=t,this._resolve=function(){},this._promise=new Promise(function(t){e._resolve=t})}return t.prototype.onComplete=function(t){this._promise.then(t)},t.prototype.complete=function(){this._resolve(),this._timeoutToken&&window.clearTimeout(this._timeoutToken)},t.prototype.start=function(){var t=this;this._delay&&(this._timeoutToken=window.setTimeout(function(){return t.complete()},this._delay))},t}()},4043:(t,e,n)=>{"use strict";n.r(e),n.d(e,{RequestSender:()=>o.A,Timeout:()=>a.A,createRequestSender:()=>r.A,createTimeout:()=>i.A});var r=n(321),i=n(6889),o=n(4670),a=n(2024)},4321:(t,e,n)=>{"use strict";n.d(e,{Cl:()=>r});var r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)}},4325:(t,e,n)=>{"use strict";n.d(e,{g:()=>i});var r=n(5889),i=function(){function t(){this._cache={}}return t.prototype.read=function(t,e){var n=this.getKey(t,e.params);return this._cache[n]||null},t.prototype.write=function(t,e,n){var r=this.getKey(t,e.params);this._cache[r]=n},t.prototype.getKey=function(t,e){return void 0===e&&(e={}),0===Object.keys(e).length?t:t+"?"+r.As(e)},t}()},4475:t=>{"use strict";var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,i){for(var o,a,s=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),u=1;u<arguments.length;u++){for(var c in o=Object(arguments[u]))n.call(o,c)&&(s[c]=o[c]);if(e){a=e(o);for(var l=0;l<a.length;l++)r.call(o,a[l])&&(s[a[l]]=o[a[l]])}}return s}},4670:(t,e,n)=>{"use strict";n.d(e,{A:()=>c});var r=n(4321),i=n(35),o=n.n(i),a=n(4325),s=n(4843),u=n(2024);const c=function(){function t(t,e,n,r){void 0===r&&(r={}),this._requestFactory=t,this._payloadTransformer=e,this._cookie=n,this._options=r,this._cache=this._options.cache||new a.g}return t.prototype.sendRequest=function(t,e){var n=this,r=this._mergeDefaultOptions(t,e),i=this._getCachedRequest(t,r);if(i)return Promise.resolve(i);var o=this._requestFactory.createRequest(this._prependHost(t),r);return new Promise(function(e,i){var a=function(){var a=n._payloadTransformer.toResponse(o);a.status>=200&&a.status<300?(n._cacheRequest(t,r,a),e(a)):i(a)};o.onload=a,o.onerror=a,o.onabort=a,o.ontimeout=a,r.timeout instanceof u.A&&(r.timeout.onComplete(function(){return o.abort()}),r.timeout.start()),(0,s.A)(r.timeout)&&r.timeout.then(function(){return o.abort()}),o.send(n._payloadTransformer.toRequestBody(r))})},t.prototype.get=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"GET"}))},t.prototype.post=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"POST"}))},t.prototype.put=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"PUT"}))},t.prototype.patch=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"PATCH"}))},t.prototype.delete=function(t,e){return this.sendRequest(t,(0,r.Cl)((0,r.Cl)({},e),{method:"DELETE"}))},t.prototype._mergeDefaultOptions=function(t,e){var n={credentials:!0,encodeParams:!0,headers:{Accept:"application/json, text/plain, */*"},method:"GET"},r=this._cookie.get("XSRF-TOKEN");return r&&n.headers&&!this._isAssetRequest(t,e)&&this._isLocalRequest(t)&&(n.headers["X-XSRF-TOKEN"]=r),e&&e.body&&n.headers&&(n.headers["Content-Type"]="application/json"),o()({},n,e)},t.prototype._prependHost=function(t){return!this._options.host||/^https?:\/\//.test(t)?t:this._options.host.replace(/\/$/,"")+"/"+t.replace(/^\//,"")},t.prototype._shouldCacheRequest=function(t){return"GET"===(t.method||"GET").toUpperCase()&&Boolean(t.cache)},t.prototype._getCachedRequest=function(t,e){return this._shouldCacheRequest(e)?this._cache.read(t,e):null},t.prototype._cacheRequest=function(t,e,n){this._shouldCacheRequest(e)&&this._cache.write(t,e,n)},t.prototype._isAssetRequest=function(t,e){return(!e||!e.method||"GET"===e.method.toUpperCase())&&/\.(png|gif|jpe?g|css|js|json|svg|html?)$/.test(t.split("?")[0])},t.prototype._isLocalRequest=function(t){return!!t.match(new RegExp("^(https?:)?//"+window.location.hostname))||!t.match(new RegExp("^(https?:)?//"))},t}()},4843:(t,e,n)=>{"use strict";function r(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}n.d(e,{A:()=>r})},4886:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._browserSupport=t,this._requestSender=e,this._scripts={},this._preloadedScripts={}}return t.prototype.loadScript=function(t,e){var n=this;return this._scripts[t]||(this._scripts[t]=new Promise(function(r,i){var o=document.createElement("script"),a=e||{},s=a.async,u=void 0!==s&&s,c=a.attributes,l=void 0===c?{}:c;Object.keys(l).forEach(function(t){o.setAttribute(t,l[t])}),o.onload=function(){return r()},o.onreadystatechange=function(){return r()},o.onerror=function(e){delete n._scripts[t],i(e)},o.async=u,o.src=t,document.body.appendChild(o)})),this._scripts[t]},t.prototype.loadScripts=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.loadScript(t,e)})).then(function(){})},t.prototype.preloadScript=function(t,e){var n=this;return this._preloadedScripts[t]||(this._preloadedScripts[t]=new Promise(function(r,i){var o=(e||{}).prefetch,a=void 0!==o&&o?"prefetch":"preload";if(n._browserSupport.canSupportRel(a)){var s=document.createElement("link");s.as="script",s.rel=a,s.href=t,s.onload=function(){r()},s.onerror=function(){delete n._preloadedScripts[t],i()},document.head.appendChild(s)}else n._requestSender.get(t,{credentials:!1,headers:{Accept:"application/javascript"}}).then(function(){return r()}).catch(i)})),this._preloadedScripts[t]},t.prototype.preloadScripts=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.preloadScript(t,e)})).then(function(){})},t}();e.default=n},5470:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9783),i=function(){function t(t,e){this._formBuilder=t,this._options=e}return t.prototype.postForm=function(t,e,n,r){var i=this._formBuilder.build(this._prependHost(t),e,r);window.addEventListener("unload",function t(){window.removeEventListener("unload",t),n&&n()}),document.body.appendChild(i),i.submit()},t.prototype._prependHost=function(t){return this._options&&this._options.host&&!(0,r.isAbsoluteUrl)(t)?(0,r.joinPaths)(this._options.host,t):t},t}();e.default=i},5477:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.canSupportRel=function(t){var e=document.createElement("link");return!!(e.relList&&e.relList.supports&&e.relList.supports(t))},t}();e.default=n},5861:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});var r=n(5889);const i=function(){function t(){}return t.prototype.createRequest=function(t,e){var n=new XMLHttpRequest;return this._configureRequest(n,t,e),n},t.prototype._configureRequest=function(t,e,n){void 0===n&&(n={}),t.open(n.method||"GET",this._formatUrl(e,n.params,n.encodeParams),!0),n.headers&&this._configureRequestHeaders(t,n.headers),"boolean"==typeof n.credentials&&(t.withCredentials=n.credentials),"number"==typeof n.timeout&&(t.timeout=n.timeout)},t.prototype._configureRequestHeaders=function(t,e){Object.keys(e).filter(function(t){return null!==e[t]}).forEach(function(n){t.setRequestHeader(n,e[n])})},t.prototype._formatUrl=function(t,e,n){return void 0===n&&(n=!0),e&&0!==Object.keys(e).length?t+"?"+r.As(e,{encode:n}):t},t}()},5889:(t,e,n)=>{"use strict";var r=n(803),i=n(4475);n(1915);function o(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}e.As=function(t,e){!1===(e=i({encode:!0,strict:!0,arrayFormat:"none"},e)).sort&&(e.sort=function(){});var n=function(t){switch(t.arrayFormat){case"index":return function(e,n,r){return null===n?[o(e,t),"[",r,"]"].join(""):[o(e,t),"[",o(r,t),"]=",o(n,t)].join("")};case"bracket":return function(e,n){return null===n?o(e,t):[o(e,t),"[]=",o(n,t)].join("")};default:return function(e,n){return null===n?o(e,t):[o(e,t),"=",o(n,t)].join("")}}}(e);return t?Object.keys(t).sort(e.sort).map(function(r){var i=t[r];if(void 0===i)return"";if(null===i)return o(r,e);if(Array.isArray(i)){var a=[];return i.slice().forEach(function(t){void 0!==t&&a.push(n(r,t,a.length))}),a.join("&")}return o(r,e)+"="+o(i,e)}).filter(function(t){return t.length>0}).join("&"):""}},5895:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i=n(471);e.default=function(){return r||(r=i.default()),r}},6889:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});var r=n(2024);function i(t){return new r.A(t)}},7995:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){this._browserSupport=t,this._requestSender=e,this._stylesheets={},this._preloadedStylesheets={}}return t.prototype.loadStylesheet=function(t,e){var n=this;return this._stylesheets[t]||(this._stylesheets[t]=new Promise(function(r,i){var o=document.createElement("link"),a=e||{},s=a.prepend,u=void 0!==s&&s,c=a.attributes,l=void 0===c?{}:c;Object.keys(l).forEach(function(t){o.setAttribute(t,l[t])}),o.onload=function(){return r()},o.onerror=function(e){delete n._stylesheets[t],i(e)},o.rel="stylesheet",o.href=t,u&&document.head.children[0]?document.head.insertBefore(o,document.head.children[0]):document.head.appendChild(o)})),this._stylesheets[t]},t.prototype.loadStylesheets=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.loadStylesheet(t,e)})).then(function(){})},t.prototype.preloadStylesheet=function(t,e){var n=this;return this._preloadedStylesheets[t]||(this._preloadedStylesheets[t]=new Promise(function(r,i){var o=(e||{}).prefetch,a=void 0!==o&&o,s=a?"prefetch":"preload";if(n._browserSupport.canSupportRel(s)){var u=document.createElement("link");u.as="style",u.rel=a?"prefetch":"preload",u.href=t,u.onload=function(){r()},u.onerror=function(e){delete n._preloadedStylesheets[t],i(e)},document.head.appendChild(u)}else n._requestSender.get(t,{credentials:!1,headers:{Accept:"text/css"}}).then(function(){return r()}).catch(i)})),this._preloadedStylesheets[t]},t.prototype.preloadStylesheets=function(t,e){var n=this;return Promise.all(t.map(function(t){return n.preloadStylesheet(t,e)})).then(function(){})},t}();e.default=n},8686:(t,e,n)=>{"use strict";e.createFormPoster=void 0;var r=n(9165);Object.defineProperty(e,"createFormPoster",{enumerable:!0,get:function(){return r.default}});n(5470)},9165:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(9828),i=n(5470);e.default=function(t){var e=new r.default;return new i.default(e,t)}},9440:function(t,e,n){t=n.nmd(t),function(){var r,i="Expected a function",o="__lodash_hash_undefined__",a="__lodash_placeholder__",s=32,u=128,c=1/0,l=9007199254740991,d=NaN,p=4294967295,h=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],f="[object Arguments]",y="[object Array]",m="[object Boolean]",v="[object Date]",g="[object Error]",b="[object Function]",w="[object GeneratorFunction]",S="[object Map]",_="[object Number]",I="[object Object]",C="[object Promise]",P="[object RegExp]",O="[object Set]",A="[object String]",k="[object Symbol]",E="[object WeakMap]",j="[object ArrayBuffer]",x="[object DataView]",T="[object Float32Array]",z="[object Float64Array]",F="[object Int8Array]",B="[object Int16Array]",D="[object Int32Array]",M="[object Uint8Array]",U="[object Uint8ClampedArray]",N="[object Uint16Array]",R="[object Uint32Array]",L=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,q=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,H=RegExp($.source),G=RegExp(W.source),Y=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tt=/[\\^$.*+?()[\]{}|]/g,et=RegExp(tt.source),nt=/^\s+/,rt=/\s/,it=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ot=/\{\n\/\* \[wrapped with (.+)\] \*/,at=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ut=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,ht=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,yt=/^0o[0-7]+$/i,mt=/^(?:0|[1-9]\d*)$/,vt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,gt=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,wt="\\ud800-\\udfff",St="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_t="\\u2700-\\u27bf",It="a-z\\xdf-\\xf6\\xf8-\\xff",Ct="A-Z\\xc0-\\xd6\\xd8-\\xde",Pt="\\ufe0e\\ufe0f",Ot="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",At="["+wt+"]",kt="["+Ot+"]",Et="["+St+"]",jt="\\d+",xt="["+_t+"]",Tt="["+It+"]",zt="[^"+wt+Ot+jt+_t+It+Ct+"]",Ft="\\ud83c[\\udffb-\\udfff]",Bt="[^"+wt+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ut="["+Ct+"]",Nt="\\u200d",Rt="(?:"+Tt+"|"+zt+")",Lt="(?:"+Ut+"|"+zt+")",Vt="(?:['’](?:d|ll|m|re|s|t|ve))?",qt="(?:['’](?:D|LL|M|RE|S|T|VE))?",$t="(?:"+Et+"|"+Ft+")?",Wt="["+Pt+"]?",Ht=Wt+$t+"(?:"+Nt+"(?:"+[Bt,Dt,Mt].join("|")+")"+Wt+$t+")*",Gt="(?:"+[xt,Dt,Mt].join("|")+")"+Ht,Yt="(?:"+[Bt+Et+"?",Et,Dt,Mt,At].join("|")+")",Kt=RegExp("['’]","g"),Jt=RegExp(Et,"g"),Zt=RegExp(Ft+"(?="+Ft+")|"+Yt+Ht,"g"),Xt=RegExp([Ut+"?"+Tt+"+"+Vt+"(?="+[kt,Ut,"$"].join("|")+")",Lt+"+"+qt+"(?="+[kt,Ut+Rt,"$"].join("|")+")",Ut+"?"+Rt+"+"+Vt,Ut+"+"+qt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",jt,Gt].join("|"),"g"),Qt=RegExp("["+Nt+wt+St+Pt+"]"),te=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ee=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ne=-1,re={};re[T]=re[z]=re[F]=re[B]=re[D]=re[M]=re[U]=re[N]=re[R]=!0,re[f]=re[y]=re[j]=re[m]=re[x]=re[v]=re[g]=re[b]=re[S]=re[_]=re[I]=re[P]=re[O]=re[A]=re[E]=!1;var ie={};ie[f]=ie[y]=ie[j]=ie[x]=ie[m]=ie[v]=ie[T]=ie[z]=ie[F]=ie[B]=ie[D]=ie[S]=ie[_]=ie[I]=ie[P]=ie[O]=ie[A]=ie[k]=ie[M]=ie[U]=ie[N]=ie[R]=!0,ie[g]=ie[b]=ie[E]=!1;var oe={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ae=parseFloat,se=parseInt,ue="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ce="object"==typeof self&&self&&self.Object===Object&&self,le=ue||ce||Function("return this")(),de=e&&!e.nodeType&&e,pe=de&&t&&!t.nodeType&&t,he=pe&&pe.exports===de,fe=he&&ue.process,ye=function(){try{return pe&&pe.require&&pe.require("util").types||fe&&fe.binding&&fe.binding("util")}catch(t){}}(),me=ye&&ye.isArrayBuffer,ve=ye&&ye.isDate,ge=ye&&ye.isMap,be=ye&&ye.isRegExp,we=ye&&ye.isSet,Se=ye&&ye.isTypedArray;function _e(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function Ie(t,e,n,r){for(var i=-1,o=null==t?0:t.length;++i<o;){var a=t[i];e(r,a,n(a),t)}return r}function Ce(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Pe(t,e){for(var n=null==t?0:t.length;n--&&!1!==e(t[n],n,t););return t}function Oe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ae(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var a=t[n];e(a,n,t)&&(o[i++]=a)}return o}function ke(t,e){return!(null==t||!t.length)&&Ue(t,e,0)>-1}function Ee(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}function je(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}function xe(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function Te(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function ze(t,e,n,r){var i=null==t?0:t.length;for(r&&i&&(n=t[--i]);i--;)n=e(n,t[i],i,t);return n}function Fe(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var Be=Ve("length");function De(t,e,n){var r;return n(t,function(t,n,i){if(e(t,n,i))return r=n,!1}),r}function Me(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function Ue(t,e,n){return e==e?function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}(t,e,n):Me(t,Re,n)}function Ne(t,e,n,r){for(var i=n-1,o=t.length;++i<o;)if(r(t[i],e))return i;return-1}function Re(t){return t!=t}function Le(t,e){var n=null==t?0:t.length;return n?We(t,e)/n:d}function Ve(t){return function(e){return null==e?r:e[t]}}function qe(t){return function(e){return null==t?r:t[e]}}function $e(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}function We(t,e){for(var n,i=-1,o=t.length;++i<o;){var a=e(t[i]);a!==r&&(n=n===r?a:n+a)}return n}function He(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function Ge(t){return t?t.slice(0,dn(t)+1).replace(nt,""):t}function Ye(t){return function(e){return t(e)}}function Ke(t,e){return je(e,function(e){return t[e]})}function Je(t,e){return t.has(e)}function Ze(t,e){for(var n=-1,r=t.length;++n<r&&Ue(e,t[n],0)>-1;);return n}function Xe(t,e){for(var n=t.length;n--&&Ue(e,t[n],0)>-1;);return n}var Qe=qe({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),tn=qe({"&":"&","<":"<",">":">",'"':""","'":"'"});function en(t){return"\\"+oe[t]}function nn(t){return Qt.test(t)}function rn(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function on(t,e){return function(n){return t(e(n))}}function an(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var s=t[n];s!==e&&s!==a||(t[n]=a,o[i++]=n)}return o}function sn(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function un(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=[t,t]}),n}function cn(t){return nn(t)?function(t){for(var e=Zt.lastIndex=0;Zt.test(t);)++e;return e}(t):Be(t)}function ln(t){return nn(t)?function(t){return t.match(Zt)||[]}(t):function(t){return t.split("")}(t)}function dn(t){for(var e=t.length;e--&&rt.test(t.charAt(e)););return e}var pn=qe({"&":"&","<":"<",">":">",""":'"',"'":"'"}),hn=function t(e){var n,rt=(e=null==e?le:hn.defaults(le.Object(),e,hn.pick(le,ee))).Array,wt=e.Date,St=e.Error,_t=e.Function,It=e.Math,Ct=e.Object,Pt=e.RegExp,Ot=e.String,At=e.TypeError,kt=rt.prototype,Et=_t.prototype,jt=Ct.prototype,xt=e["__core-js_shared__"],Tt=Et.toString,zt=jt.hasOwnProperty,Ft=0,Bt=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Dt=jt.toString,Mt=Tt.call(Ct),Ut=le._,Nt=Pt("^"+Tt.call(zt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Rt=he?e.Buffer:r,Lt=e.Symbol,Vt=e.Uint8Array,qt=Rt?Rt.allocUnsafe:r,$t=on(Ct.getPrototypeOf,Ct),Wt=Ct.create,Ht=jt.propertyIsEnumerable,Gt=kt.splice,Yt=Lt?Lt.isConcatSpreadable:r,Zt=Lt?Lt.iterator:r,Qt=Lt?Lt.toStringTag:r,oe=function(){try{var t=uo(Ct,"defineProperty");return t({},"",{}),t}catch(t){}}(),ue=e.clearTimeout!==le.clearTimeout&&e.clearTimeout,ce=wt&&wt.now!==le.Date.now&&wt.now,de=e.setTimeout!==le.setTimeout&&e.setTimeout,pe=It.ceil,fe=It.floor,ye=Ct.getOwnPropertySymbols,Be=Rt?Rt.isBuffer:r,qe=e.isFinite,fn=kt.join,yn=on(Ct.keys,Ct),mn=It.max,vn=It.min,gn=wt.now,bn=e.parseInt,wn=It.random,Sn=kt.reverse,_n=uo(e,"DataView"),In=uo(e,"Map"),Cn=uo(e,"Promise"),Pn=uo(e,"Set"),On=uo(e,"WeakMap"),An=uo(Ct,"create"),kn=On&&new On,En={},jn=Mo(_n),xn=Mo(In),Tn=Mo(Cn),zn=Mo(Pn),Fn=Mo(On),Bn=Lt?Lt.prototype:r,Dn=Bn?Bn.valueOf:r,Mn=Bn?Bn.toString:r;function Un(t){if(ts(t)&&!qa(t)&&!(t instanceof Vn)){if(t instanceof Ln)return t;if(zt.call(t,"__wrapped__"))return Uo(t)}return new Ln(t)}var Nn=function(){function t(){}return function(e){if(!Qa(e))return{};if(Wt)return Wt(e);t.prototype=e;var n=new t;return t.prototype=r,n}}();function Rn(){}function Ln(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=r}function Vn(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function qn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function $n(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Wn(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Hn(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new Wn;++e<n;)this.add(t[e])}function Gn(t){var e=this.__data__=new $n(t);this.size=e.size}function Yn(t,e){var n=qa(t),r=!n&&Va(t),i=!n&&!r&&Ga(t),o=!n&&!r&&!i&&us(t),a=n||r||i||o,s=a?He(t.length,Ot):[],u=s.length;for(var c in t)!e&&!zt.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||mo(c,u))||s.push(c);return s}function Kn(t){var e=t.length;return e?t[Wr(0,e-1)]:r}function Jn(t,e){return To(Oi(t),or(e,0,t.length))}function Zn(t){return To(Oi(t))}function Xn(t,e,n){(n!==r&&!Na(t[e],n)||n===r&&!(e in t))&&rr(t,e,n)}function Qn(t,e,n){var i=t[e];zt.call(t,e)&&Na(i,n)&&(n!==r||e in t)||rr(t,e,n)}function tr(t,e){for(var n=t.length;n--;)if(Na(t[n][0],e))return n;return-1}function er(t,e,n,r){return lr(t,function(t,i,o){e(r,t,n(t),o)}),r}function nr(t,e){return t&&Ai(e,js(e),t)}function rr(t,e,n){"__proto__"==e&&oe?oe(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function ir(t,e){for(var n=-1,i=e.length,o=rt(i),a=null==t;++n<i;)o[n]=a?r:Ps(t,e[n]);return o}function or(t,e,n){return t==t&&(n!==r&&(t=t<=n?t:n),e!==r&&(t=t>=e?t:e)),t}function ar(t,e,n,i,o,a){var s,u=1&e,c=2&e,l=4&e;if(n&&(s=o?n(t,i,o,a):n(t)),s!==r)return s;if(!Qa(t))return t;var d=qa(t);if(d){if(s=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&zt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!u)return Oi(t,s)}else{var p=po(t),h=p==b||p==w;if(Ga(t))return wi(t,u);if(p==I||p==f||h&&!o){if(s=c||h?{}:fo(t),!u)return c?function(t,e){return Ai(t,lo(t),e)}(t,function(t,e){return t&&Ai(e,xs(e),t)}(s,t)):function(t,e){return Ai(t,co(t),e)}(t,nr(s,t))}else{if(!ie[p])return o?t:{};s=function(t,e,n){var r,i=t.constructor;switch(e){case j:return Si(t);case m:case v:return new i(+t);case x:return function(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case T:case z:case F:case B:case D:case M:case U:case N:case R:return _i(t,n);case S:return new i;case _:case A:return new i(t);case P:return function(t){var e=new t.constructor(t.source,dt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case O:return new i;case k:return r=t,Dn?Ct(Dn.call(r)):{}}}(t,p,u)}}a||(a=new Gn);var y=a.get(t);if(y)return y;a.set(t,s),os(t)?t.forEach(function(r){s.add(ar(r,e,n,r,t,a))}):es(t)&&t.forEach(function(r,i){s.set(i,ar(r,e,n,i,t,a))});var g=d?r:(l?c?eo:to:c?xs:js)(t);return Ce(g||t,function(r,i){g&&(r=t[i=r]),Qn(s,i,ar(r,e,n,i,t,a))}),s}function sr(t,e,n){var i=n.length;if(null==t)return!i;for(t=Ct(t);i--;){var o=n[i],a=e[o],s=t[o];if(s===r&&!(o in t)||!a(s))return!1}return!0}function ur(t,e,n){if("function"!=typeof t)throw new At(i);return ko(function(){t.apply(r,n)},e)}function cr(t,e,n,r){var i=-1,o=ke,a=!0,s=t.length,u=[],c=e.length;if(!s)return u;n&&(e=je(e,Ye(n))),r?(o=Ee,a=!1):e.length>=200&&(o=Je,a=!1,e=new Hn(e));t:for(;++i<s;){var l=t[i],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var p=c;p--;)if(e[p]===d)continue t;u.push(l)}else o(e,d,r)||u.push(l)}return u}Un.templateSettings={escape:Y,evaluate:K,interpolate:J,variable:"",imports:{_:Un}},Un.prototype=Rn.prototype,Un.prototype.constructor=Un,Ln.prototype=Nn(Rn.prototype),Ln.prototype.constructor=Ln,Vn.prototype=Nn(Rn.prototype),Vn.prototype.constructor=Vn,qn.prototype.clear=function(){this.__data__=An?An(null):{},this.size=0},qn.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},qn.prototype.get=function(t){var e=this.__data__;if(An){var n=e[t];return n===o?r:n}return zt.call(e,t)?e[t]:r},qn.prototype.has=function(t){var e=this.__data__;return An?e[t]!==r:zt.call(e,t)},qn.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=An&&e===r?o:e,this},$n.prototype.clear=function(){this.__data__=[],this.size=0},$n.prototype.delete=function(t){var e=this.__data__,n=tr(e,t);return!(n<0||(n==e.length-1?e.pop():Gt.call(e,n,1),--this.size,0))},$n.prototype.get=function(t){var e=this.__data__,n=tr(e,t);return n<0?r:e[n][1]},$n.prototype.has=function(t){return tr(this.__data__,t)>-1},$n.prototype.set=function(t,e){var n=this.__data__,r=tr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this},Wn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(In||$n),string:new qn}},Wn.prototype.delete=function(t){var e=ao(this,t).delete(t);return this.size-=e?1:0,e},Wn.prototype.get=function(t){return ao(this,t).get(t)},Wn.prototype.has=function(t){return ao(this,t).has(t)},Wn.prototype.set=function(t,e){var n=ao(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Hn.prototype.add=Hn.prototype.push=function(t){return this.__data__.set(t,o),this},Hn.prototype.has=function(t){return this.__data__.has(t)},Gn.prototype.clear=function(){this.__data__=new $n,this.size=0},Gn.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},Gn.prototype.get=function(t){return this.__data__.get(t)},Gn.prototype.has=function(t){return this.__data__.has(t)},Gn.prototype.set=function(t,e){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!In||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Wn(r)}return n.set(t,e),this.size=n.size,this};var lr=ji(gr),dr=ji(br,!0);function pr(t,e){var n=!0;return lr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function hr(t,e,n){for(var i=-1,o=t.length;++i<o;){var a=t[i],s=e(a);if(null!=s&&(u===r?s==s&&!ss(s):n(s,u)))var u=s,c=a}return c}function fr(t,e){var n=[];return lr(t,function(t,r,i){e(t,r,i)&&n.push(t)}),n}function yr(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=yo),i||(i=[]);++o<a;){var s=t[o];e>0&&n(s)?e>1?yr(s,e-1,n,r,i):xe(i,s):r||(i[i.length]=s)}return i}var mr=xi(),vr=xi(!0);function gr(t,e){return t&&mr(t,e,js)}function br(t,e){return t&&vr(t,e,js)}function wr(t,e){return Ae(e,function(e){return Ja(t[e])})}function Sr(t,e){for(var n=0,i=(e=mi(e,t)).length;null!=t&&n<i;)t=t[Do(e[n++])];return n&&n==i?t:r}function _r(t,e,n){var r=e(t);return qa(t)?r:xe(r,n(t))}function Ir(t){return null==t?t===r?"[object Undefined]":"[object Null]":Qt&&Qt in Ct(t)?function(t){var e=zt.call(t,Qt),n=t[Qt];try{t[Qt]=r;var i=!0}catch(t){}var o=Dt.call(t);return i&&(e?t[Qt]=n:delete t[Qt]),o}(t):function(t){return Dt.call(t)}(t)}function Cr(t,e){return t>e}function Pr(t,e){return null!=t&&zt.call(t,e)}function Or(t,e){return null!=t&&e in Ct(t)}function Ar(t,e,n){for(var i=n?Ee:ke,o=t[0].length,a=t.length,s=a,u=rt(a),c=1/0,l=[];s--;){var d=t[s];s&&e&&(d=je(d,Ye(e))),c=vn(d.length,c),u[s]=!n&&(e||o>=120&&d.length>=120)?new Hn(s&&d):r}d=t[0];var p=-1,h=u[0];t:for(;++p<o&&l.length<c;){var f=d[p],y=e?e(f):f;if(f=n||0!==f?f:0,!(h?Je(h,y):i(l,y,n))){for(s=a;--s;){var m=u[s];if(!(m?Je(m,y):i(t[s],y,n)))continue t}h&&h.push(y),l.push(f)}}return l}function kr(t,e,n){var i=null==(t=Po(t,e=mi(e,t)))?t:t[Do(Ko(e))];return null==i?r:_e(i,t,n)}function Er(t){return ts(t)&&Ir(t)==f}function jr(t,e,n,i,o){return t===e||(null==t||null==e||!ts(t)&&!ts(e)?t!=t&&e!=e:function(t,e,n,i,o,a){var s=qa(t),u=qa(e),c=s?y:po(t),l=u?y:po(e),d=(c=c==f?I:c)==I,p=(l=l==f?I:l)==I,h=c==l;if(h&&Ga(t)){if(!Ga(e))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Gn),s||us(t)?Xi(t,e,n,i,o,a):function(t,e,n,r,i,o,a){switch(n){case x:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case j:return!(t.byteLength!=e.byteLength||!o(new Vt(t),new Vt(e)));case m:case v:case _:return Na(+t,+e);case g:return t.name==e.name&&t.message==e.message;case P:case A:return t==e+"";case S:var s=rn;case O:var u=1&r;if(s||(s=sn),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;r|=2,a.set(t,e);var l=Xi(s(t),s(e),r,i,o,a);return a.delete(t),l;case k:if(Dn)return Dn.call(t)==Dn.call(e)}return!1}(t,e,c,n,i,o,a);if(!(1&n)){var b=d&&zt.call(t,"__wrapped__"),w=p&&zt.call(e,"__wrapped__");if(b||w){var C=b?t.value():t,E=w?e.value():e;return a||(a=new Gn),o(C,E,n,i,a)}}return!!h&&(a||(a=new Gn),function(t,e,n,i,o,a){var s=1&n,u=to(t),c=u.length;if(c!=to(e).length&&!s)return!1;for(var l=c;l--;){var d=u[l];if(!(s?d in e:zt.call(e,d)))return!1}var p=a.get(t),h=a.get(e);if(p&&h)return p==e&&h==t;var f=!0;a.set(t,e),a.set(e,t);for(var y=s;++l<c;){var m=t[d=u[l]],v=e[d];if(i)var g=s?i(v,m,d,e,t,a):i(m,v,d,t,e,a);if(!(g===r?m===v||o(m,v,n,i,a):g)){f=!1;break}y||(y="constructor"==d)}if(f&&!y){var b=t.constructor,w=e.constructor;b==w||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w||(f=!1)}return a.delete(t),a.delete(e),f}(t,e,n,i,o,a))}(t,e,n,i,jr,o))}function xr(t,e,n,i){var o=n.length,a=o,s=!i;if(null==t)return!a;for(t=Ct(t);o--;){var u=n[o];if(s&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var c=(u=n[o])[0],l=t[c],d=u[1];if(s&&u[2]){if(l===r&&!(c in t))return!1}else{var p=new Gn;if(i)var h=i(l,d,c,t,e,p);if(!(h===r?jr(d,l,3,i,p):h))return!1}}return!0}function Tr(t){return!(!Qa(t)||(e=t,Bt&&Bt in e))&&(Ja(t)?Nt:ft).test(Mo(t));var e}function zr(t){return"function"==typeof t?t:null==t?nu:"object"==typeof t?qa(t)?Ur(t[0],t[1]):Mr(t):du(t)}function Fr(t){if(!So(t))return yn(t);var e=[];for(var n in Ct(t))zt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Br(t,e){return t<e}function Dr(t,e){var n=-1,r=Wa(t)?rt(t.length):[];return lr(t,function(t,i,o){r[++n]=e(t,i,o)}),r}function Mr(t){var e=so(t);return 1==e.length&&e[0][2]?Io(e[0][0],e[0][1]):function(n){return n===t||xr(n,t,e)}}function Ur(t,e){return go(t)&&_o(e)?Io(Do(t),e):function(n){var i=Ps(n,t);return i===r&&i===e?Os(n,t):jr(e,i,3)}}function Nr(t,e,n,i,o){t!==e&&mr(e,function(a,s){if(o||(o=new Gn),Qa(a))!function(t,e,n,i,o,a,s){var u=Oo(t,n),c=Oo(e,n),l=s.get(c);if(l)Xn(t,n,l);else{var d=a?a(u,c,n+"",t,e,s):r,p=d===r;if(p){var h=qa(c),f=!h&&Ga(c),y=!h&&!f&&us(c);d=c,h||f||y?qa(u)?d=u:Ha(u)?d=Oi(u):f?(p=!1,d=wi(c,!0)):y?(p=!1,d=_i(c,!0)):d=[]:rs(c)||Va(c)?(d=u,Va(u)?d=ms(u):Qa(u)&&!Ja(u)||(d=fo(c))):p=!1}p&&(s.set(c,d),o(d,c,i,a,s),s.delete(c)),Xn(t,n,d)}}(t,e,s,n,Nr,i,o);else{var u=i?i(Oo(t,s),a,s+"",t,e,o):r;u===r&&(u=a),Xn(t,s,u)}},xs)}function Rr(t,e){var n=t.length;if(n)return mo(e+=e<0?n:0,n)?t[e]:r}function Lr(t,e,n){e=e.length?je(e,function(t){return qa(t)?function(e){return Sr(e,1===t.length?t[0]:t)}:t}):[nu];var r=-1;e=je(e,Ye(oo()));var i=Dr(t,function(t,n,i){var o=je(e,function(e){return e(t)});return{criteria:o,index:++r,value:t}});return function(t){var e=t.length;for(t.sort(function(t,e){return function(t,e,n){for(var r=-1,i=t.criteria,o=e.criteria,a=i.length,s=n.length;++r<a;){var u=Ii(i[r],o[r]);if(u)return r>=s?u:u*("desc"==n[r]?-1:1)}return t.index-e.index}(t,e,n)});e--;)t[e]=t[e].value;return t}(i)}function Vr(t,e,n){for(var r=-1,i=e.length,o={};++r<i;){var a=e[r],s=Sr(t,a);n(s,a)&&Jr(o,mi(a,t),s)}return o}function qr(t,e,n,r){var i=r?Ne:Ue,o=-1,a=e.length,s=t;for(t===e&&(e=Oi(e)),n&&(s=je(t,Ye(n)));++o<a;)for(var u=0,c=e[o],l=n?n(c):c;(u=i(s,l,u,r))>-1;)s!==t&&Gt.call(s,u,1),Gt.call(t,u,1);return t}function $r(t,e){for(var n=t?e.length:0,r=n-1;n--;){var i=e[n];if(n==r||i!==o){var o=i;mo(i)?Gt.call(t,i,1):ui(t,i)}}return t}function Wr(t,e){return t+fe(wn()*(e-t+1))}function Hr(t,e){var n="";if(!t||e<1||e>l)return n;do{e%2&&(n+=t),(e=fe(e/2))&&(t+=t)}while(e);return n}function Gr(t,e){return Eo(Co(t,e,nu),t+"")}function Yr(t){return Kn(Ns(t))}function Kr(t,e){var n=Ns(t);return To(n,or(e,0,n.length))}function Jr(t,e,n,i){if(!Qa(t))return t;for(var o=-1,a=(e=mi(e,t)).length,s=a-1,u=t;null!=u&&++o<a;){var c=Do(e[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(o!=s){var d=u[c];(l=i?i(d,c,u):r)===r&&(l=Qa(d)?d:mo(e[o+1])?[]:{})}Qn(u,c,l),u=u[c]}return t}var Zr=kn?function(t,e){return kn.set(t,e),t}:nu,Xr=oe?function(t,e){return oe(t,"toString",{configurable:!0,enumerable:!1,value:Qs(e),writable:!0})}:nu;function Qr(t){return To(Ns(t))}function ti(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=rt(i);++r<i;)o[r]=t[r+e];return o}function ei(t,e){var n;return lr(t,function(t,r,i){return!(n=e(t,r,i))}),!!n}function ni(t,e,n){var r=0,i=null==t?r:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=t[o];null!==a&&!ss(a)&&(n?a<=e:a<e)?r=o+1:i=o}return i}return ri(t,e,nu,n)}function ri(t,e,n,i){var o=0,a=null==t?0:t.length;if(0===a)return 0;for(var s=(e=n(e))!=e,u=null===e,c=ss(e),l=e===r;o<a;){var d=fe((o+a)/2),p=n(t[d]),h=p!==r,f=null===p,y=p==p,m=ss(p);if(s)var v=i||y;else v=l?y&&(i||h):u?y&&h&&(i||!f):c?y&&h&&!f&&(i||!m):!f&&!m&&(i?p<=e:p<e);v?o=d+1:a=d}return vn(a,4294967294)}function ii(t,e){for(var n=-1,r=t.length,i=0,o=[];++n<r;){var a=t[n],s=e?e(a):a;if(!n||!Na(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function oi(t){return"number"==typeof t?t:ss(t)?d:+t}function ai(t){if("string"==typeof t)return t;if(qa(t))return je(t,ai)+"";if(ss(t))return Mn?Mn.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function si(t,e,n){var r=-1,i=ke,o=t.length,a=!0,s=[],u=s;if(n)a=!1,i=Ee;else if(o>=200){var c=e?null:Hi(t);if(c)return sn(c);a=!1,i=Je,u=new Hn}else u=e?[]:s;t:for(;++r<o;){var l=t[r],d=e?e(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var p=u.length;p--;)if(u[p]===d)continue t;e&&u.push(d),s.push(l)}else i(u,d,n)||(u!==s&&u.push(d),s.push(l))}return s}function ui(t,e){return null==(t=Po(t,e=mi(e,t)))||delete t[Do(Ko(e))]}function ci(t,e,n,r){return Jr(t,e,n(Sr(t,e)),r)}function li(t,e,n,r){for(var i=t.length,o=r?i:-1;(r?o--:++o<i)&&e(t[o],o,t););return n?ti(t,r?0:o,r?o+1:i):ti(t,r?o+1:0,r?i:o)}function di(t,e){var n=t;return n instanceof Vn&&(n=n.value()),Te(e,function(t,e){return e.func.apply(e.thisArg,xe([t],e.args))},n)}function pi(t,e,n){var r=t.length;if(r<2)return r?si(t[0]):[];for(var i=-1,o=rt(r);++i<r;)for(var a=t[i],s=-1;++s<r;)s!=i&&(o[i]=cr(o[i]||a,t[s],e,n));return si(yr(o,1),e,n)}function hi(t,e,n){for(var i=-1,o=t.length,a=e.length,s={};++i<o;){var u=i<a?e[i]:r;n(s,t[i],u)}return s}function fi(t){return Ha(t)?t:[]}function yi(t){return"function"==typeof t?t:nu}function mi(t,e){return qa(t)?t:go(t,e)?[t]:Bo(vs(t))}var vi=Gr;function gi(t,e,n){var i=t.length;return n=n===r?i:n,!e&&n>=i?t:ti(t,e,n)}var bi=ue||function(t){return le.clearTimeout(t)};function wi(t,e){if(e)return t.slice();var n=t.length,r=qt?qt(n):new t.constructor(n);return t.copy(r),r}function Si(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}function _i(t,e){var n=e?Si(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Ii(t,e){if(t!==e){var n=t!==r,i=null===t,o=t==t,a=ss(t),s=e!==r,u=null===e,c=e==e,l=ss(e);if(!u&&!l&&!a&&t>e||a&&s&&c&&!u&&!l||i&&s&&c||!n&&c||!o)return 1;if(!i&&!a&&!l&&t<e||l&&n&&o&&!i&&!a||u&&n&&o||!s&&o||!c)return-1}return 0}function Ci(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,u=e.length,c=mn(o-a,0),l=rt(u+c),d=!r;++s<u;)l[s]=e[s];for(;++i<a;)(d||i<o)&&(l[n[i]]=t[i]);for(;c--;)l[s++]=t[i++];return l}function Pi(t,e,n,r){for(var i=-1,o=t.length,a=-1,s=n.length,u=-1,c=e.length,l=mn(o-s,0),d=rt(l+c),p=!r;++i<l;)d[i]=t[i];for(var h=i;++u<c;)d[h+u]=e[u];for(;++a<s;)(p||i<o)&&(d[h+n[a]]=t[i++]);return d}function Oi(t,e){var n=-1,r=t.length;for(e||(e=rt(r));++n<r;)e[n]=t[n];return e}function Ai(t,e,n,i){var o=!n;n||(n={});for(var a=-1,s=e.length;++a<s;){var u=e[a],c=i?i(n[u],t[u],u,n,t):r;c===r&&(c=t[u]),o?rr(n,u,c):Qn(n,u,c)}return n}function ki(t,e){return function(n,r){var i=qa(n)?Ie:er,o=e?e():{};return i(n,t,oo(r,2),o)}}function Ei(t){return Gr(function(e,n){var i=-1,o=n.length,a=o>1?n[o-1]:r,s=o>2?n[2]:r;for(a=t.length>3&&"function"==typeof a?(o--,a):r,s&&vo(n[0],n[1],s)&&(a=o<3?r:a,o=1),e=Ct(e);++i<o;){var u=n[i];u&&t(e,u,i,a)}return e})}function ji(t,e){return function(n,r){if(null==n)return n;if(!Wa(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=Ct(n);(e?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function xi(t){return function(e,n,r){for(var i=-1,o=Ct(e),a=r(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===n(o[u],u,o))break}return e}}function Ti(t){return function(e){var n=nn(e=vs(e))?ln(e):r,i=n?n[0]:e.charAt(0),o=n?gi(n,1).join(""):e.slice(1);return i[t]()+o}}function zi(t){return function(e){return Te(Js(Vs(e).replace(Kt,"")),t,"")}}function Fi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var n=Nn(t.prototype),r=t.apply(n,e);return Qa(r)?r:n}}function Bi(t){return function(e,n,i){var o=Ct(e);if(!Wa(e)){var a=oo(n,3);e=js(e),n=function(t){return a(o[t],t,o)}}var s=t(e,n,i);return s>-1?o[a?e[s]:s]:r}}function Di(t){return Qi(function(e){var n=e.length,o=n,a=Ln.prototype.thru;for(t&&e.reverse();o--;){var s=e[o];if("function"!=typeof s)throw new At(i);if(a&&!u&&"wrapper"==ro(s))var u=new Ln([],!0)}for(o=u?o:n;++o<n;){var c=ro(s=e[o]),l="wrapper"==c?no(s):r;u=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ro(l[0])].apply(u,l[3]):1==s.length&&bo(s)?u[c]():u.thru(s)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&qa(r))return u.plant(r).value();for(var i=0,o=n?e[i].apply(this,t):r;++i<n;)o=e[i].call(this,o);return o}})}function Mi(t,e,n,i,o,a,s,c,l,d){var p=e&u,h=1&e,f=2&e,y=24&e,m=512&e,v=f?r:Fi(t);return function u(){for(var g=arguments.length,b=rt(g),w=g;w--;)b[w]=arguments[w];if(y)var S=io(u),_=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,S);if(i&&(b=Ci(b,i,o,y)),a&&(b=Pi(b,a,s,y)),g-=_,y&&g<d){var I=an(b,S);return $i(t,e,Mi,u.placeholder,n,b,I,c,l,d-g)}var C=h?n:this,P=f?C[t]:t;return g=b.length,c?b=function(t,e){for(var n=t.length,i=vn(e.length,n),o=Oi(t);i--;){var a=e[i];t[i]=mo(a,n)?o[a]:r}return t}(b,c):m&&g>1&&b.reverse(),p&&l<g&&(b.length=l),this&&this!==le&&this instanceof u&&(P=v||Fi(P)),P.apply(C,b)}}function Ui(t,e){return function(n,r){return function(t,e,n,r){return gr(t,function(t,i,o){e(r,n(t),i,o)}),r}(n,t,e(r),{})}}function Ni(t,e){return function(n,i){var o;if(n===r&&i===r)return e;if(n!==r&&(o=n),i!==r){if(o===r)return i;"string"==typeof n||"string"==typeof i?(n=ai(n),i=ai(i)):(n=oi(n),i=oi(i)),o=t(n,i)}return o}}function Ri(t){return Qi(function(e){return e=je(e,Ye(oo())),Gr(function(n){var r=this;return t(e,function(t){return _e(t,r,n)})})})}function Li(t,e){var n=(e=e===r?" ":ai(e)).length;if(n<2)return n?Hr(e,t):e;var i=Hr(e,pe(t/cn(e)));return nn(e)?gi(ln(i),0,t).join(""):i.slice(0,t)}function Vi(t){return function(e,n,i){return i&&"number"!=typeof i&&vo(e,n,i)&&(n=i=r),e=ps(e),n===r?(n=e,e=0):n=ps(n),function(t,e,n,r){for(var i=-1,o=mn(pe((e-t)/(n||1)),0),a=rt(o);o--;)a[r?o:++i]=t,t+=n;return a}(e,n,i=i===r?e<n?1:-1:ps(i),t)}}function qi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ys(e),n=ys(n)),t(e,n)}}function $i(t,e,n,i,o,a,u,c,l,d){var p=8&e;e|=p?s:64,4&(e&=~(p?64:s))||(e&=-4);var h=[t,e,o,p?a:r,p?u:r,p?r:a,p?r:u,c,l,d],f=n.apply(r,h);return bo(t)&&Ao(f,h),f.placeholder=i,jo(f,t,e)}function Wi(t){var e=It[t];return function(t,n){if(t=ys(t),(n=null==n?0:vn(hs(n),292))&&qe(t)){var r=(vs(t)+"e").split("e");return+((r=(vs(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Hi=Pn&&1/sn(new Pn([,-0]))[1]==c?function(t){return new Pn(t)}:su;function Gi(t){return function(e){var n=po(e);return n==S?rn(e):n==O?un(e):function(t,e){return je(e,function(e){return[e,t[e]]})}(e,t(e))}}function Yi(t,e,n,o,c,l,d,p){var h=2&e;if(!h&&"function"!=typeof t)throw new At(i);var f=o?o.length:0;if(f||(e&=-97,o=c=r),d=d===r?d:mn(hs(d),0),p=p===r?p:hs(p),f-=c?c.length:0,64&e){var y=o,m=c;o=c=r}var v=h?r:no(t),g=[t,e,n,o,c,y,m,l,d,p];if(v&&function(t,e){var n=t[1],r=e[1],i=n|r,o=i<131,s=r==u&&8==n||r==u&&256==n&&t[7].length<=e[8]||384==r&&e[7].length<=e[8]&&8==n;if(!o&&!s)return t;1&r&&(t[2]=e[2],i|=1&n?0:4);var c=e[3];if(c){var l=t[3];t[3]=l?Ci(l,c,e[4]):c,t[4]=l?an(t[3],a):e[4]}(c=e[5])&&(l=t[5],t[5]=l?Pi(l,c,e[6]):c,t[6]=l?an(t[5],a):e[6]),(c=e[7])&&(t[7]=c),r&u&&(t[8]=null==t[8]?e[8]:vn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(g,v),t=g[0],e=g[1],n=g[2],o=g[3],c=g[4],!(p=g[9]=g[9]===r?h?0:t.length:mn(g[9]-f,0))&&24&e&&(e&=-25),e&&1!=e)b=8==e||16==e?function(t,e,n){var i=Fi(t);return function o(){for(var a=arguments.length,s=rt(a),u=a,c=io(o);u--;)s[u]=arguments[u];var l=a<3&&s[0]!==c&&s[a-1]!==c?[]:an(s,c);return(a-=l.length)<n?$i(t,e,Mi,o.placeholder,r,s,l,r,r,n-a):_e(this&&this!==le&&this instanceof o?i:t,this,s)}}(t,e,p):e!=s&&33!=e||c.length?Mi.apply(r,g):function(t,e,n,r){var i=1&e,o=Fi(t);return function e(){for(var a=-1,s=arguments.length,u=-1,c=r.length,l=rt(c+s),d=this&&this!==le&&this instanceof e?o:t;++u<c;)l[u]=r[u];for(;s--;)l[u++]=arguments[++a];return _e(d,i?n:this,l)}}(t,e,n,o);else var b=function(t,e,n){var r=1&e,i=Fi(t);return function e(){return(this&&this!==le&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return jo((v?Zr:Ao)(b,g),t,e)}function Ki(t,e,n,i){return t===r||Na(t,jt[n])&&!zt.call(i,n)?e:t}function Ji(t,e,n,i,o,a){return Qa(t)&&Qa(e)&&(a.set(e,t),Nr(t,e,r,Ji,a),a.delete(e)),t}function Zi(t){return rs(t)?r:t}function Xi(t,e,n,i,o,a){var s=1&n,u=t.length,c=e.length;if(u!=c&&!(s&&c>u))return!1;var l=a.get(t),d=a.get(e);if(l&&d)return l==e&&d==t;var p=-1,h=!0,f=2&n?new Hn:r;for(a.set(t,e),a.set(e,t);++p<u;){var y=t[p],m=e[p];if(i)var v=s?i(m,y,p,e,t,a):i(y,m,p,t,e,a);if(v!==r){if(v)continue;h=!1;break}if(f){if(!Fe(e,function(t,e){if(!Je(f,e)&&(y===t||o(y,t,n,i,a)))return f.push(e)})){h=!1;break}}else if(y!==m&&!o(y,m,n,i,a)){h=!1;break}}return a.delete(t),a.delete(e),h}function Qi(t){return Eo(Co(t,r,$o),t+"")}function to(t){return _r(t,js,co)}function eo(t){return _r(t,xs,lo)}var no=kn?function(t){return kn.get(t)}:su;function ro(t){for(var e=t.name+"",n=En[e],r=zt.call(En,e)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==t)return i.name}return e}function io(t){return(zt.call(Un,"placeholder")?Un:t).placeholder}function oo(){var t=Un.iteratee||ru;return t=t===ru?zr:t,arguments.length?t(arguments[0],arguments[1]):t}function ao(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function so(t){for(var e=js(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,_o(i)]}return e}function uo(t,e){var n=function(t,e){return null==t?r:t[e]}(t,e);return Tr(n)?n:r}var co=ye?function(t){return null==t?[]:(t=Ct(t),Ae(ye(t),function(e){return Ht.call(t,e)}))}:fu,lo=ye?function(t){for(var e=[];t;)xe(e,co(t)),t=$t(t);return e}:fu,po=Ir;function ho(t,e,n){for(var r=-1,i=(e=mi(e,t)).length,o=!1;++r<i;){var a=Do(e[r]);if(!(o=null!=t&&n(t,a)))break;t=t[a]}return o||++r!=i?o:!!(i=null==t?0:t.length)&&Xa(i)&&mo(a,i)&&(qa(t)||Va(t))}function fo(t){return"function"!=typeof t.constructor||So(t)?{}:Nn($t(t))}function yo(t){return qa(t)||Va(t)||!!(Yt&&t&&t[Yt])}function mo(t,e){var n=typeof t;return!!(e=null==e?l:e)&&("number"==n||"symbol"!=n&&mt.test(t))&&t>-1&&t%1==0&&t<e}function vo(t,e,n){if(!Qa(n))return!1;var r=typeof e;return!!("number"==r?Wa(n)&&mo(e,n.length):"string"==r&&e in n)&&Na(n[e],t)}function go(t,e){if(qa(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!ss(t))||X.test(t)||!Z.test(t)||null!=e&&t in Ct(e)}function bo(t){var e=ro(t),n=Un[e];if("function"!=typeof n||!(e in Vn.prototype))return!1;if(t===n)return!0;var r=no(n);return!!r&&t===r[0]}(_n&&po(new _n(new ArrayBuffer(1)))!=x||In&&po(new In)!=S||Cn&&po(Cn.resolve())!=C||Pn&&po(new Pn)!=O||On&&po(new On)!=E)&&(po=function(t){var e=Ir(t),n=e==I?t.constructor:r,i=n?Mo(n):"";if(i)switch(i){case jn:return x;case xn:return S;case Tn:return C;case zn:return O;case Fn:return E}return e});var wo=xt?Ja:yu;function So(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function _o(t){return t==t&&!Qa(t)}function Io(t,e){return function(n){return null!=n&&n[t]===e&&(e!==r||t in Ct(n))}}function Co(t,e,n){return e=mn(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=mn(r.length-e,0),a=rt(o);++i<o;)a[i]=r[e+i];i=-1;for(var s=rt(e+1);++i<e;)s[i]=r[i];return s[e]=n(a),_e(t,this,s)}}function Po(t,e){return e.length<2?t:Sr(t,ti(e,0,-1))}function Oo(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ao=xo(Zr),ko=de||function(t,e){return le.setTimeout(t,e)},Eo=xo(Xr);function jo(t,e,n){var r=e+"";return Eo(t,function(t,e){var n=e.length;if(!n)return t;var r=n-1;return e[r]=(n>1?"& ":"")+e[r],e=e.join(n>2?", ":" "),t.replace(it,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Ce(h,function(n){var r="_."+n[0];e&n[1]&&!ke(t,r)&&t.push(r)}),t.sort()}(function(t){var e=t.match(ot);return e?e[1].split(at):[]}(r),n)))}function xo(t){var e=0,n=0;return function(){var i=gn(),o=16-(i-n);if(n=i,o>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(r,arguments)}}function To(t,e){var n=-1,i=t.length,o=i-1;for(e=e===r?i:e;++n<e;){var a=Wr(n,o),s=t[a];t[a]=t[n],t[n]=s}return t.length=e,t}var zo,Fo,Bo=(zo=za(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Q,function(t,n,r,i){e.push(r?i.replace(ct,"$1"):n||t)}),e},function(t){return 500===Fo.size&&Fo.clear(),t}),Fo=zo.cache,zo);function Do(t){if("string"==typeof t||ss(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Mo(t){if(null!=t){try{return Tt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Uo(t){if(t instanceof Vn)return t.clone();var e=new Ln(t.__wrapped__,t.__chain__);return e.__actions__=Oi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var No=Gr(function(t,e){return Ha(t)?cr(t,yr(e,1,Ha,!0)):[]}),Ro=Gr(function(t,e){var n=Ko(e);return Ha(n)&&(n=r),Ha(t)?cr(t,yr(e,1,Ha,!0),oo(n,2)):[]}),Lo=Gr(function(t,e){var n=Ko(e);return Ha(n)&&(n=r),Ha(t)?cr(t,yr(e,1,Ha,!0),r,n):[]});function Vo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=mn(r+i,0)),Me(t,oo(e,3),i)}function qo(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i-1;return n!==r&&(o=hs(n),o=n<0?mn(i+o,0):vn(o,i-1)),Me(t,oo(e,3),o,!0)}function $o(t){return null!=t&&t.length?yr(t,1):[]}function Wo(t){return t&&t.length?t[0]:r}var Ho=Gr(function(t){var e=je(t,fi);return e.length&&e[0]===t[0]?Ar(e):[]}),Go=Gr(function(t){var e=Ko(t),n=je(t,fi);return e===Ko(n)?e=r:n.pop(),n.length&&n[0]===t[0]?Ar(n,oo(e,2)):[]}),Yo=Gr(function(t){var e=Ko(t),n=je(t,fi);return(e="function"==typeof e?e:r)&&n.pop(),n.length&&n[0]===t[0]?Ar(n,r,e):[]});function Ko(t){var e=null==t?0:t.length;return e?t[e-1]:r}var Jo=Gr(Zo);function Zo(t,e){return t&&t.length&&e&&e.length?qr(t,e):t}var Xo=Qi(function(t,e){var n=null==t?0:t.length,r=ir(t,e);return $r(t,je(e,function(t){return mo(t,n)?+t:t}).sort(Ii)),r});function Qo(t){return null==t?t:Sn.call(t)}var ta=Gr(function(t){return si(yr(t,1,Ha,!0))}),ea=Gr(function(t){var e=Ko(t);return Ha(e)&&(e=r),si(yr(t,1,Ha,!0),oo(e,2))}),na=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,si(yr(t,1,Ha,!0),r,e)});function ra(t){if(!t||!t.length)return[];var e=0;return t=Ae(t,function(t){if(Ha(t))return e=mn(t.length,e),!0}),He(e,function(e){return je(t,Ve(e))})}function ia(t,e){if(!t||!t.length)return[];var n=ra(t);return null==e?n:je(n,function(t){return _e(e,r,t)})}var oa=Gr(function(t,e){return Ha(t)?cr(t,e):[]}),aa=Gr(function(t){return pi(Ae(t,Ha))}),sa=Gr(function(t){var e=Ko(t);return Ha(e)&&(e=r),pi(Ae(t,Ha),oo(e,2))}),ua=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,pi(Ae(t,Ha),r,e)}),ca=Gr(ra),la=Gr(function(t){var e=t.length,n=e>1?t[e-1]:r;return n="function"==typeof n?(t.pop(),n):r,ia(t,n)});function da(t){var e=Un(t);return e.__chain__=!0,e}function pa(t,e){return e(t)}var ha=Qi(function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,o=function(e){return ir(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Vn&&mo(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:pa,args:[o],thisArg:r}),new Ln(i,this.__chain__).thru(function(t){return e&&!t.length&&t.push(r),t})):this.thru(o)}),fa=ki(function(t,e,n){zt.call(t,n)?++t[n]:rr(t,n,1)}),ya=Bi(Vo),ma=Bi(qo);function va(t,e){return(qa(t)?Ce:lr)(t,oo(e,3))}function ga(t,e){return(qa(t)?Pe:dr)(t,oo(e,3))}var ba=ki(function(t,e,n){zt.call(t,n)?t[n].push(e):rr(t,n,[e])}),wa=Gr(function(t,e,n){var r=-1,i="function"==typeof e,o=Wa(t)?rt(t.length):[];return lr(t,function(t){o[++r]=i?_e(e,t,n):kr(t,e,n)}),o}),Sa=ki(function(t,e,n){rr(t,n,e)});function _a(t,e){return(qa(t)?je:Dr)(t,oo(e,3))}var Ia=ki(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),Ca=Gr(function(t,e){if(null==t)return[];var n=e.length;return n>1&&vo(t,e[0],e[1])?e=[]:n>2&&vo(e[0],e[1],e[2])&&(e=[e[0]]),Lr(t,yr(e,1),[])}),Pa=ce||function(){return le.Date.now()};function Oa(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,Yi(t,u,r,r,r,r,e)}function Aa(t,e){var n;if("function"!=typeof e)throw new At(i);return t=hs(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=r),n}}var ka=Gr(function(t,e,n){var r=1;if(n.length){var i=an(n,io(ka));r|=s}return Yi(t,r,e,n,i)}),Ea=Gr(function(t,e,n){var r=3;if(n.length){var i=an(n,io(Ea));r|=s}return Yi(e,r,t,n,i)});function ja(t,e,n){var o,a,s,u,c,l,d=0,p=!1,h=!1,f=!0;if("function"!=typeof t)throw new At(i);function y(e){var n=o,i=a;return o=a=r,d=e,u=t.apply(i,n)}function m(t){var n=t-l;return l===r||n>=e||n<0||h&&t-d>=s}function v(){var t=Pa();if(m(t))return g(t);c=ko(v,function(t){var n=e-(t-l);return h?vn(n,s-(t-d)):n}(t))}function g(t){return c=r,f&&o?y(t):(o=a=r,u)}function b(){var t=Pa(),n=m(t);if(o=arguments,a=this,l=t,n){if(c===r)return function(t){return d=t,c=ko(v,e),p?y(t):u}(l);if(h)return bi(c),c=ko(v,e),y(l)}return c===r&&(c=ko(v,e)),u}return e=ys(e)||0,Qa(n)&&(p=!!n.leading,s=(h="maxWait"in n)?mn(ys(n.maxWait)||0,e):s,f="trailing"in n?!!n.trailing:f),b.cancel=function(){c!==r&&bi(c),d=0,o=l=a=c=r},b.flush=function(){return c===r?u:g(Pa())},b}var xa=Gr(function(t,e){return ur(t,1,e)}),Ta=Gr(function(t,e,n){return ur(t,ys(e)||0,n)});function za(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new At(i);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(za.Cache||Wn),n}function Fa(t){if("function"!=typeof t)throw new At(i);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}za.Cache=Wn;var Ba=vi(function(t,e){var n=(e=1==e.length&&qa(e[0])?je(e[0],Ye(oo())):je(yr(e,1),Ye(oo()))).length;return Gr(function(r){for(var i=-1,o=vn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return _e(t,this,r)})}),Da=Gr(function(t,e){var n=an(e,io(Da));return Yi(t,s,r,e,n)}),Ma=Gr(function(t,e){var n=an(e,io(Ma));return Yi(t,64,r,e,n)}),Ua=Qi(function(t,e){return Yi(t,256,r,r,r,e)});function Na(t,e){return t===e||t!=t&&e!=e}var Ra=qi(Cr),La=qi(function(t,e){return t>=e}),Va=Er(function(){return arguments}())?Er:function(t){return ts(t)&&zt.call(t,"callee")&&!Ht.call(t,"callee")},qa=rt.isArray,$a=me?Ye(me):function(t){return ts(t)&&Ir(t)==j};function Wa(t){return null!=t&&Xa(t.length)&&!Ja(t)}function Ha(t){return ts(t)&&Wa(t)}var Ga=Be||yu,Ya=ve?Ye(ve):function(t){return ts(t)&&Ir(t)==v};function Ka(t){if(!ts(t))return!1;var e=Ir(t);return e==g||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!rs(t)}function Ja(t){if(!Qa(t))return!1;var e=Ir(t);return e==b||e==w||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Za(t){return"number"==typeof t&&t==hs(t)}function Xa(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=l}function Qa(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ts(t){return null!=t&&"object"==typeof t}var es=ge?Ye(ge):function(t){return ts(t)&&po(t)==S};function ns(t){return"number"==typeof t||ts(t)&&Ir(t)==_}function rs(t){if(!ts(t)||Ir(t)!=I)return!1;var e=$t(t);if(null===e)return!0;var n=zt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Tt.call(n)==Mt}var is=be?Ye(be):function(t){return ts(t)&&Ir(t)==P},os=we?Ye(we):function(t){return ts(t)&&po(t)==O};function as(t){return"string"==typeof t||!qa(t)&&ts(t)&&Ir(t)==A}function ss(t){return"symbol"==typeof t||ts(t)&&Ir(t)==k}var us=Se?Ye(Se):function(t){return ts(t)&&Xa(t.length)&&!!re[Ir(t)]},cs=qi(Br),ls=qi(function(t,e){return t<=e});function ds(t){if(!t)return[];if(Wa(t))return as(t)?ln(t):Oi(t);if(Zt&&t[Zt])return function(t){for(var e,n=[];!(e=t.next()).done;)n.push(e.value);return n}(t[Zt]());var e=po(t);return(e==S?rn:e==O?sn:Ns)(t)}function ps(t){return t?(t=ys(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function hs(t){var e=ps(t),n=e%1;return e==e?n?e-n:e:0}function fs(t){return t?or(hs(t),0,p):0}function ys(t){if("number"==typeof t)return t;if(ss(t))return d;if(Qa(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Qa(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ge(t);var n=ht.test(t);return n||yt.test(t)?se(t.slice(2),n?2:8):pt.test(t)?d:+t}function ms(t){return Ai(t,xs(t))}function vs(t){return null==t?"":ai(t)}var gs=Ei(function(t,e){if(So(e)||Wa(e))Ai(e,js(e),t);else for(var n in e)zt.call(e,n)&&Qn(t,n,e[n])}),bs=Ei(function(t,e){Ai(e,xs(e),t)}),ws=Ei(function(t,e,n,r){Ai(e,xs(e),t,r)}),Ss=Ei(function(t,e,n,r){Ai(e,js(e),t,r)}),_s=Qi(ir),Is=Gr(function(t,e){t=Ct(t);var n=-1,i=e.length,o=i>2?e[2]:r;for(o&&vo(e[0],e[1],o)&&(i=1);++n<i;)for(var a=e[n],s=xs(a),u=-1,c=s.length;++u<c;){var l=s[u],d=t[l];(d===r||Na(d,jt[l])&&!zt.call(t,l))&&(t[l]=a[l])}return t}),Cs=Gr(function(t){return t.push(r,Ji),_e(zs,r,t)});function Ps(t,e,n){var i=null==t?r:Sr(t,e);return i===r?n:i}function Os(t,e){return null!=t&&ho(t,e,Or)}var As=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Dt.call(e)),t[e]=n},Qs(nu)),ks=Ui(function(t,e,n){null!=e&&"function"!=typeof e.toString&&(e=Dt.call(e)),zt.call(t,e)?t[e].push(n):t[e]=[n]},oo),Es=Gr(kr);function js(t){return Wa(t)?Yn(t):Fr(t)}function xs(t){return Wa(t)?Yn(t,!0):function(t){if(!Qa(t))return function(t){var e=[];if(null!=t)for(var n in Ct(t))e.push(n);return e}(t);var e=So(t),n=[];for(var r in t)("constructor"!=r||!e&&zt.call(t,r))&&n.push(r);return n}(t)}var Ts=Ei(function(t,e,n){Nr(t,e,n)}),zs=Ei(function(t,e,n,r){Nr(t,e,n,r)}),Fs=Qi(function(t,e){var n={};if(null==t)return n;var r=!1;e=je(e,function(e){return e=mi(e,t),r||(r=e.length>1),e}),Ai(t,eo(t),n),r&&(n=ar(n,7,Zi));for(var i=e.length;i--;)ui(n,e[i]);return n}),Bs=Qi(function(t,e){return null==t?{}:function(t,e){return Vr(t,e,function(e,n){return Os(t,n)})}(t,e)});function Ds(t,e){if(null==t)return{};var n=je(eo(t),function(t){return[t]});return e=oo(e),Vr(t,n,function(t,n){return e(t,n[0])})}var Ms=Gi(js),Us=Gi(xs);function Ns(t){return null==t?[]:Ke(t,js(t))}var Rs=zi(function(t,e,n){return e=e.toLowerCase(),t+(n?Ls(e):e)});function Ls(t){return Ks(vs(t).toLowerCase())}function Vs(t){return(t=vs(t))&&t.replace(vt,Qe).replace(Jt,"")}var qs=zi(function(t,e,n){return t+(n?"-":"")+e.toLowerCase()}),$s=zi(function(t,e,n){return t+(n?" ":"")+e.toLowerCase()}),Ws=Ti("toLowerCase"),Hs=zi(function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}),Gs=zi(function(t,e,n){return t+(n?" ":"")+Ks(e)}),Ys=zi(function(t,e,n){return t+(n?" ":"")+e.toUpperCase()}),Ks=Ti("toUpperCase");function Js(t,e,n){return t=vs(t),(e=n?r:e)===r?function(t){return te.test(t)}(t)?function(t){return t.match(Xt)||[]}(t):function(t){return t.match(st)||[]}(t):t.match(e)||[]}var Zs=Gr(function(t,e){try{return _e(t,r,e)}catch(t){return Ka(t)?t:new St(t)}}),Xs=Qi(function(t,e){return Ce(e,function(e){e=Do(e),rr(t,e,ka(t[e],t))}),t});function Qs(t){return function(){return t}}var tu=Di(),eu=Di(!0);function nu(t){return t}function ru(t){return zr("function"==typeof t?t:ar(t,1))}var iu=Gr(function(t,e){return function(n){return kr(n,t,e)}}),ou=Gr(function(t,e){return function(n){return kr(t,n,e)}});function au(t,e,n){var r=js(e),i=wr(e,r);null!=n||Qa(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=wr(e,js(e)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ja(t);return Ce(i,function(n){var r=e[n];t[n]=r,a&&(t.prototype[n]=function(){var e=this.__chain__;if(o||e){var n=t(this.__wrapped__);return(n.__actions__=Oi(this.__actions__)).push({func:r,args:arguments,thisArg:t}),n.__chain__=e,n}return r.apply(t,xe([this.value()],arguments))})}),t}function su(){}var uu=Ri(je),cu=Ri(Oe),lu=Ri(Fe);function du(t){return go(t)?Ve(Do(t)):function(t){return function(e){return Sr(e,t)}}(t)}var pu=Vi(),hu=Vi(!0);function fu(){return[]}function yu(){return!1}var mu,vu=Ni(function(t,e){return t+e},0),gu=Wi("ceil"),bu=Ni(function(t,e){return t/e},1),wu=Wi("floor"),Su=Ni(function(t,e){return t*e},1),_u=Wi("round"),Iu=Ni(function(t,e){return t-e},0);return Un.after=function(t,e){if("function"!=typeof e)throw new At(i);return t=hs(t),function(){if(--t<1)return e.apply(this,arguments)}},Un.ary=Oa,Un.assign=gs,Un.assignIn=bs,Un.assignInWith=ws,Un.assignWith=Ss,Un.at=_s,Un.before=Aa,Un.bind=ka,Un.bindAll=Xs,Un.bindKey=Ea,Un.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return qa(t)?t:[t]},Un.chain=da,Un.chunk=function(t,e,n){e=(n?vo(t,e,n):e===r)?1:mn(hs(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,a=0,s=rt(pe(i/e));o<i;)s[a++]=ti(t,o,o+=e);return s},Un.compact=function(t){for(var e=-1,n=null==t?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i},Un.concat=function(){var t=arguments.length;if(!t)return[];for(var e=rt(t-1),n=arguments[0],r=t;r--;)e[r-1]=arguments[r];return xe(qa(n)?Oi(n):[n],yr(e,1))},Un.cond=function(t){var e=null==t?0:t.length,n=oo();return t=e?je(t,function(t){if("function"!=typeof t[1])throw new At(i);return[n(t[0]),t[1]]}):[],Gr(function(n){for(var r=-1;++r<e;){var i=t[r];if(_e(i[0],this,n))return _e(i[1],this,n)}})},Un.conforms=function(t){return function(t){var e=js(t);return function(n){return sr(n,t,e)}}(ar(t,1))},Un.constant=Qs,Un.countBy=fa,Un.create=function(t,e){var n=Nn(t);return null==e?n:nr(n,e)},Un.curry=function t(e,n,i){var o=Yi(e,8,r,r,r,r,r,n=i?r:n);return o.placeholder=t.placeholder,o},Un.curryRight=function t(e,n,i){var o=Yi(e,16,r,r,r,r,r,n=i?r:n);return o.placeholder=t.placeholder,o},Un.debounce=ja,Un.defaults=Is,Un.defaultsDeep=Cs,Un.defer=xa,Un.delay=Ta,Un.difference=No,Un.differenceBy=Ro,Un.differenceWith=Lo,Un.drop=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,(e=n||e===r?1:hs(e))<0?0:e,i):[]},Un.dropRight=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,0,(e=i-(e=n||e===r?1:hs(e)))<0?0:e):[]},Un.dropRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0,!0):[]},Un.dropWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!0):[]},Un.fill=function(t,e,n,i){var o=null==t?0:t.length;return o?(n&&"number"!=typeof n&&vo(t,e,n)&&(n=0,i=o),function(t,e,n,i){var o=t.length;for((n=hs(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:hs(i))<0&&(i+=o),i=n>i?0:fs(i);n<i;)t[n++]=e;return t}(t,e,n,i)):[]},Un.filter=function(t,e){return(qa(t)?Ae:fr)(t,oo(e,3))},Un.flatMap=function(t,e){return yr(_a(t,e),1)},Un.flatMapDeep=function(t,e){return yr(_a(t,e),c)},Un.flatMapDepth=function(t,e,n){return n=n===r?1:hs(n),yr(_a(t,e),n)},Un.flatten=$o,Un.flattenDeep=function(t){return null!=t&&t.length?yr(t,c):[]},Un.flattenDepth=function(t,e){return null!=t&&t.length?yr(t,e=e===r?1:hs(e)):[]},Un.flip=function(t){return Yi(t,512)},Un.flow=tu,Un.flowRight=eu,Un.fromPairs=function(t){for(var e=-1,n=null==t?0:t.length,r={};++e<n;){var i=t[e];r[i[0]]=i[1]}return r},Un.functions=function(t){return null==t?[]:wr(t,js(t))},Un.functionsIn=function(t){return null==t?[]:wr(t,xs(t))},Un.groupBy=ba,Un.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Un.intersection=Ho,Un.intersectionBy=Go,Un.intersectionWith=Yo,Un.invert=As,Un.invertBy=ks,Un.invokeMap=wa,Un.iteratee=ru,Un.keyBy=Sa,Un.keys=js,Un.keysIn=xs,Un.map=_a,Un.mapKeys=function(t,e){var n={};return e=oo(e,3),gr(t,function(t,r,i){rr(n,e(t,r,i),t)}),n},Un.mapValues=function(t,e){var n={};return e=oo(e,3),gr(t,function(t,r,i){rr(n,r,e(t,r,i))}),n},Un.matches=function(t){return Mr(ar(t,1))},Un.matchesProperty=function(t,e){return Ur(t,ar(e,1))},Un.memoize=za,Un.merge=Ts,Un.mergeWith=zs,Un.method=iu,Un.methodOf=ou,Un.mixin=au,Un.negate=Fa,Un.nthArg=function(t){return t=hs(t),Gr(function(e){return Rr(e,t)})},Un.omit=Fs,Un.omitBy=function(t,e){return Ds(t,Fa(oo(e)))},Un.once=function(t){return Aa(2,t)},Un.orderBy=function(t,e,n,i){return null==t?[]:(qa(e)||(e=null==e?[]:[e]),qa(n=i?r:n)||(n=null==n?[]:[n]),Lr(t,e,n))},Un.over=uu,Un.overArgs=Ba,Un.overEvery=cu,Un.overSome=lu,Un.partial=Da,Un.partialRight=Ma,Un.partition=Ia,Un.pick=Bs,Un.pickBy=Ds,Un.property=du,Un.propertyOf=function(t){return function(e){return null==t?r:Sr(t,e)}},Un.pull=Jo,Un.pullAll=Zo,Un.pullAllBy=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,oo(n,2)):t},Un.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?qr(t,e,r,n):t},Un.pullAt=Xo,Un.range=pu,Un.rangeRight=hu,Un.rearg=Ua,Un.reject=function(t,e){return(qa(t)?Ae:fr)(t,Fa(oo(e,3)))},Un.remove=function(t,e){var n=[];if(!t||!t.length)return n;var r=-1,i=[],o=t.length;for(e=oo(e,3);++r<o;){var a=t[r];e(a,r,t)&&(n.push(a),i.push(r))}return $r(t,i),n},Un.rest=function(t,e){if("function"!=typeof t)throw new At(i);return Gr(t,e=e===r?e:hs(e))},Un.reverse=Qo,Un.sampleSize=function(t,e,n){return e=(n?vo(t,e,n):e===r)?1:hs(e),(qa(t)?Jn:Kr)(t,e)},Un.set=function(t,e,n){return null==t?t:Jr(t,e,n)},Un.setWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:Jr(t,e,n,i)},Un.shuffle=function(t){return(qa(t)?Zn:Qr)(t)},Un.slice=function(t,e,n){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&vo(t,e,n)?(e=0,n=i):(e=null==e?0:hs(e),n=n===r?i:hs(n)),ti(t,e,n)):[]},Un.sortBy=Ca,Un.sortedUniq=function(t){return t&&t.length?ii(t):[]},Un.sortedUniqBy=function(t,e){return t&&t.length?ii(t,oo(e,2)):[]},Un.split=function(t,e,n){return n&&"number"!=typeof n&&vo(t,e,n)&&(e=n=r),(n=n===r?p:n>>>0)?(t=vs(t))&&("string"==typeof e||null!=e&&!is(e))&&!(e=ai(e))&&nn(t)?gi(ln(t),0,n):t.split(e,n):[]},Un.spread=function(t,e){if("function"!=typeof t)throw new At(i);return e=null==e?0:mn(hs(e),0),Gr(function(n){var r=n[e],i=gi(n,0,e);return r&&xe(i,r),_e(t,this,i)})},Un.tail=function(t){var e=null==t?0:t.length;return e?ti(t,1,e):[]},Un.take=function(t,e,n){return t&&t.length?ti(t,0,(e=n||e===r?1:hs(e))<0?0:e):[]},Un.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?ti(t,(e=i-(e=n||e===r?1:hs(e)))<0?0:e,i):[]},Un.takeRightWhile=function(t,e){return t&&t.length?li(t,oo(e,3),!1,!0):[]},Un.takeWhile=function(t,e){return t&&t.length?li(t,oo(e,3)):[]},Un.tap=function(t,e){return e(t),t},Un.throttle=function(t,e,n){var r=!0,o=!0;if("function"!=typeof t)throw new At(i);return Qa(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),ja(t,e,{leading:r,maxWait:e,trailing:o})},Un.thru=pa,Un.toArray=ds,Un.toPairs=Ms,Un.toPairsIn=Us,Un.toPath=function(t){return qa(t)?je(t,Do):ss(t)?[t]:Oi(Bo(vs(t)))},Un.toPlainObject=ms,Un.transform=function(t,e,n){var r=qa(t),i=r||Ga(t)||us(t);if(e=oo(e,4),null==n){var o=t&&t.constructor;n=i?r?new o:[]:Qa(t)&&Ja(o)?Nn($t(t)):{}}return(i?Ce:gr)(t,function(t,r,i){return e(n,t,r,i)}),n},Un.unary=function(t){return Oa(t,1)},Un.union=ta,Un.unionBy=ea,Un.unionWith=na,Un.uniq=function(t){return t&&t.length?si(t):[]},Un.uniqBy=function(t,e){return t&&t.length?si(t,oo(e,2)):[]},Un.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?si(t,r,e):[]},Un.unset=function(t,e){return null==t||ui(t,e)},Un.unzip=ra,Un.unzipWith=ia,Un.update=function(t,e,n){return null==t?t:ci(t,e,yi(n))},Un.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:ci(t,e,yi(n),i)},Un.values=Ns,Un.valuesIn=function(t){return null==t?[]:Ke(t,xs(t))},Un.without=oa,Un.words=Js,Un.wrap=function(t,e){return Da(yi(e),t)},Un.xor=aa,Un.xorBy=sa,Un.xorWith=ua,Un.zip=ca,Un.zipObject=function(t,e){return hi(t||[],e||[],Qn)},Un.zipObjectDeep=function(t,e){return hi(t||[],e||[],Jr)},Un.zipWith=la,Un.entries=Ms,Un.entriesIn=Us,Un.extend=bs,Un.extendWith=ws,au(Un,Un),Un.add=vu,Un.attempt=Zs,Un.camelCase=Rs,Un.capitalize=Ls,Un.ceil=gu,Un.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=ys(n))==n?n:0),e!==r&&(e=(e=ys(e))==e?e:0),or(ys(t),e,n)},Un.clone=function(t){return ar(t,4)},Un.cloneDeep=function(t){return ar(t,5)},Un.cloneDeepWith=function(t,e){return ar(t,5,e="function"==typeof e?e:r)},Un.cloneWith=function(t,e){return ar(t,4,e="function"==typeof e?e:r)},Un.conformsTo=function(t,e){return null==e||sr(t,e,js(e))},Un.deburr=Vs,Un.defaultTo=function(t,e){return null==t||t!=t?e:t},Un.divide=bu,Un.endsWith=function(t,e,n){t=vs(t),e=ai(e);var i=t.length,o=n=n===r?i:or(hs(n),0,i);return(n-=e.length)>=0&&t.slice(n,o)==e},Un.eq=Na,Un.escape=function(t){return(t=vs(t))&&G.test(t)?t.replace(W,tn):t},Un.escapeRegExp=function(t){return(t=vs(t))&&et.test(t)?t.replace(tt,"\\$&"):t},Un.every=function(t,e,n){var i=qa(t)?Oe:pr;return n&&vo(t,e,n)&&(e=r),i(t,oo(e,3))},Un.find=ya,Un.findIndex=Vo,Un.findKey=function(t,e){return De(t,oo(e,3),gr)},Un.findLast=ma,Un.findLastIndex=qo,Un.findLastKey=function(t,e){return De(t,oo(e,3),br)},Un.floor=wu,Un.forEach=va,Un.forEachRight=ga,Un.forIn=function(t,e){return null==t?t:mr(t,oo(e,3),xs)},Un.forInRight=function(t,e){return null==t?t:vr(t,oo(e,3),xs)},Un.forOwn=function(t,e){return t&&gr(t,oo(e,3))},Un.forOwnRight=function(t,e){return t&&br(t,oo(e,3))},Un.get=Ps,Un.gt=Ra,Un.gte=La,Un.has=function(t,e){return null!=t&&ho(t,e,Pr)},Un.hasIn=Os,Un.head=Wo,Un.identity=nu,Un.includes=function(t,e,n,r){t=Wa(t)?t:Ns(t),n=n&&!r?hs(n):0;var i=t.length;return n<0&&(n=mn(i+n,0)),as(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&Ue(t,e,n)>-1},Un.indexOf=function(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=mn(r+i,0)),Ue(t,e,i)},Un.inRange=function(t,e,n){return e=ps(e),n===r?(n=e,e=0):n=ps(n),function(t,e,n){return t>=vn(e,n)&&t<mn(e,n)}(t=ys(t),e,n)},Un.invoke=Es,Un.isArguments=Va,Un.isArray=qa,Un.isArrayBuffer=$a,Un.isArrayLike=Wa,Un.isArrayLikeObject=Ha,Un.isBoolean=function(t){return!0===t||!1===t||ts(t)&&Ir(t)==m},Un.isBuffer=Ga,Un.isDate=Ya,Un.isElement=function(t){return ts(t)&&1===t.nodeType&&!rs(t)},Un.isEmpty=function(t){if(null==t)return!0;if(Wa(t)&&(qa(t)||"string"==typeof t||"function"==typeof t.splice||Ga(t)||us(t)||Va(t)))return!t.length;var e=po(t);if(e==S||e==O)return!t.size;if(So(t))return!Fr(t).length;for(var n in t)if(zt.call(t,n))return!1;return!0},Un.isEqual=function(t,e){return jr(t,e)},Un.isEqualWith=function(t,e,n){var i=(n="function"==typeof n?n:r)?n(t,e):r;return i===r?jr(t,e,r,n):!!i},Un.isError=Ka,Un.isFinite=function(t){return"number"==typeof t&&qe(t)},Un.isFunction=Ja,Un.isInteger=Za,Un.isLength=Xa,Un.isMap=es,Un.isMatch=function(t,e){return t===e||xr(t,e,so(e))},Un.isMatchWith=function(t,e,n){return n="function"==typeof n?n:r,xr(t,e,so(e),n)},Un.isNaN=function(t){return ns(t)&&t!=+t},Un.isNative=function(t){if(wo(t))throw new St("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Tr(t)},Un.isNil=function(t){return null==t},Un.isNull=function(t){return null===t},Un.isNumber=ns,Un.isObject=Qa,Un.isObjectLike=ts,Un.isPlainObject=rs,Un.isRegExp=is,Un.isSafeInteger=function(t){return Za(t)&&t>=-9007199254740991&&t<=l},Un.isSet=os,Un.isString=as,Un.isSymbol=ss,Un.isTypedArray=us,Un.isUndefined=function(t){return t===r},Un.isWeakMap=function(t){return ts(t)&&po(t)==E},Un.isWeakSet=function(t){return ts(t)&&"[object WeakSet]"==Ir(t)},Un.join=function(t,e){return null==t?"":fn.call(t,e)},Un.kebabCase=qs,Un.last=Ko,Un.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=hs(n))<0?mn(i+o,0):vn(o,i-1)),e==e?function(t,e,n){for(var r=n+1;r--;)if(t[r]===e)return r;return r}(t,e,o):Me(t,Re,o,!0)},Un.lowerCase=$s,Un.lowerFirst=Ws,Un.lt=cs,Un.lte=ls,Un.max=function(t){return t&&t.length?hr(t,nu,Cr):r},Un.maxBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Cr):r},Un.mean=function(t){return Le(t,nu)},Un.meanBy=function(t,e){return Le(t,oo(e,2))},Un.min=function(t){return t&&t.length?hr(t,nu,Br):r},Un.minBy=function(t,e){return t&&t.length?hr(t,oo(e,2),Br):r},Un.stubArray=fu,Un.stubFalse=yu,Un.stubObject=function(){return{}},Un.stubString=function(){return""},Un.stubTrue=function(){return!0},Un.multiply=Su,Un.nth=function(t,e){return t&&t.length?Rr(t,hs(e)):r},Un.noConflict=function(){return le._===this&&(le._=Ut),this},Un.noop=su,Un.now=Pa,Un.pad=function(t,e,n){t=vs(t);var r=(e=hs(e))?cn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Li(fe(i),n)+t+Li(pe(i),n)},Un.padEnd=function(t,e,n){t=vs(t);var r=(e=hs(e))?cn(t):0;return e&&r<e?t+Li(e-r,n):t},Un.padStart=function(t,e,n){t=vs(t);var r=(e=hs(e))?cn(t):0;return e&&r<e?Li(e-r,n)+t:t},Un.parseInt=function(t,e,n){return n||null==e?e=0:e&&(e=+e),bn(vs(t).replace(nt,""),e||0)},Un.random=function(t,e,n){if(n&&"boolean"!=typeof n&&vo(t,e,n)&&(e=n=r),n===r&&("boolean"==typeof e?(n=e,e=r):"boolean"==typeof t&&(n=t,t=r)),t===r&&e===r?(t=0,e=1):(t=ps(t),e===r?(e=t,t=0):e=ps(e)),t>e){var i=t;t=e,e=i}if(n||t%1||e%1){var o=wn();return vn(t+o*(e-t+ae("1e-"+((o+"").length-1))),e)}return Wr(t,e)},Un.reduce=function(t,e,n){var r=qa(t)?Te:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,lr)},Un.reduceRight=function(t,e,n){var r=qa(t)?ze:$e,i=arguments.length<3;return r(t,oo(e,4),n,i,dr)},Un.repeat=function(t,e,n){return e=(n?vo(t,e,n):e===r)?1:hs(e),Hr(vs(t),e)},Un.replace=function(){var t=arguments,e=vs(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Un.result=function(t,e,n){var i=-1,o=(e=mi(e,t)).length;for(o||(o=1,t=r);++i<o;){var a=null==t?r:t[Do(e[i])];a===r&&(i=o,a=n),t=Ja(a)?a.call(t):a}return t},Un.round=_u,Un.runInContext=t,Un.sample=function(t){return(qa(t)?Kn:Yr)(t)},Un.size=function(t){if(null==t)return 0;if(Wa(t))return as(t)?cn(t):t.length;var e=po(t);return e==S||e==O?t.size:Fr(t).length},Un.snakeCase=Hs,Un.some=function(t,e,n){var i=qa(t)?Fe:ei;return n&&vo(t,e,n)&&(e=r),i(t,oo(e,3))},Un.sortedIndex=function(t,e){return ni(t,e)},Un.sortedIndexBy=function(t,e,n){return ri(t,e,oo(n,2))},Un.sortedIndexOf=function(t,e){var n=null==t?0:t.length;if(n){var r=ni(t,e);if(r<n&&Na(t[r],e))return r}return-1},Un.sortedLastIndex=function(t,e){return ni(t,e,!0)},Un.sortedLastIndexBy=function(t,e,n){return ri(t,e,oo(n,2),!0)},Un.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var n=ni(t,e,!0)-1;if(Na(t[n],e))return n}return-1},Un.startCase=Gs,Un.startsWith=function(t,e,n){return t=vs(t),n=null==n?0:or(hs(n),0,t.length),e=ai(e),t.slice(n,n+e.length)==e},Un.subtract=Iu,Un.sum=function(t){return t&&t.length?We(t,nu):0},Un.sumBy=function(t,e){return t&&t.length?We(t,oo(e,2)):0},Un.template=function(t,e,n){var i=Un.templateSettings;n&&vo(t,e,n)&&(e=r),t=vs(t),e=ws({},e,i,Ki);var o,a,s=ws({},e.imports,i.imports,Ki),u=js(s),c=Ke(s,u),l=0,d=e.interpolate||gt,p="__p += '",h=Pt((e.escape||gt).source+"|"+d.source+"|"+(d===J?lt:gt).source+"|"+(e.evaluate||gt).source+"|$","g"),f="//# sourceURL="+(zt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ne+"]")+"\n";t.replace(h,function(e,n,r,i,s,u){return r||(r=i),p+=t.slice(l,u).replace(bt,en),n&&(o=!0,p+="' +\n__e("+n+") +\n'"),s&&(a=!0,p+="';\n"+s+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),p+="';\n";var y=zt.call(e,"variable")&&e.variable;if(y){if(ut.test(y))throw new St("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(a?p.replace(L,""):p).replace(V,"$1").replace(q,"$1;"),p="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=Zs(function(){return _t(u,f+"return "+p).apply(r,c)});if(m.source=p,Ka(m))throw m;return m},Un.times=function(t,e){if((t=hs(t))<1||t>l)return[];var n=p,r=vn(t,p);e=oo(e),t-=p;for(var i=He(r,e);++n<t;)e(n);return i},Un.toFinite=ps,Un.toInteger=hs,Un.toLength=fs,Un.toLower=function(t){return vs(t).toLowerCase()},Un.toNumber=ys,Un.toSafeInteger=function(t){return t?or(hs(t),-9007199254740991,l):0===t?t:0},Un.toString=vs,Un.toUpper=function(t){return vs(t).toUpperCase()},Un.trim=function(t,e,n){if((t=vs(t))&&(n||e===r))return Ge(t);if(!t||!(e=ai(e)))return t;var i=ln(t),o=ln(e);return gi(i,Ze(i,o),Xe(i,o)+1).join("")},Un.trimEnd=function(t,e,n){if((t=vs(t))&&(n||e===r))return t.slice(0,dn(t)+1);if(!t||!(e=ai(e)))return t;var i=ln(t);return gi(i,0,Xe(i,ln(e))+1).join("")},Un.trimStart=function(t,e,n){if((t=vs(t))&&(n||e===r))return t.replace(nt,"");if(!t||!(e=ai(e)))return t;var i=ln(t);return gi(i,Ze(i,ln(e))).join("")},Un.truncate=function(t,e){var n=30,i="...";if(Qa(e)){var o="separator"in e?e.separator:o;n="length"in e?hs(e.length):n,i="omission"in e?ai(e.omission):i}var a=(t=vs(t)).length;if(nn(t)){var s=ln(t);a=s.length}if(n>=a)return t;var u=n-cn(i);if(u<1)return i;var c=s?gi(s,0,u).join(""):t.slice(0,u);if(o===r)return c+i;if(s&&(u+=c.length-u),is(o)){if(t.slice(u).search(o)){var l,d=c;for(o.global||(o=Pt(o.source,vs(dt.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var p=l.index;c=c.slice(0,p===r?u:p)}}else if(t.indexOf(ai(o),u)!=u){var h=c.lastIndexOf(o);h>-1&&(c=c.slice(0,h))}return c+i},Un.unescape=function(t){return(t=vs(t))&&H.test(t)?t.replace($,pn):t},Un.uniqueId=function(t){var e=++Ft;return vs(t)+e},Un.upperCase=Ys,Un.upperFirst=Ks,Un.each=va,Un.eachRight=ga,Un.first=Wo,au(Un,(mu={},gr(Un,function(t,e){zt.call(Un.prototype,e)||(mu[e]=t)}),mu),{chain:!1}),Un.VERSION="4.17.21",Ce(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){Un[t].placeholder=Un}),Ce(["drop","take"],function(t,e){Vn.prototype[t]=function(n){n=n===r?1:mn(hs(n),0);var i=this.__filtered__&&!e?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=vn(n,i.__takeCount__):i.__views__.push({size:vn(n,p),type:t+(i.__dir__<0?"Right":"")}),i},Vn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ce(["filter","map","takeWhile"],function(t,e){var n=e+1,r=1==n||3==n;Vn.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:oo(t,3),type:n}),e.__filtered__=e.__filtered__||r,e}}),Ce(["head","last"],function(t,e){var n="take"+(e?"Right":"");Vn.prototype[t]=function(){return this[n](1).value()[0]}}),Ce(["initial","tail"],function(t,e){var n="drop"+(e?"":"Right");Vn.prototype[t]=function(){return this.__filtered__?new Vn(this):this[n](1)}}),Vn.prototype.compact=function(){return this.filter(nu)},Vn.prototype.find=function(t){return this.filter(t).head()},Vn.prototype.findLast=function(t){return this.reverse().find(t)},Vn.prototype.invokeMap=Gr(function(t,e){return"function"==typeof t?new Vn(this):this.map(function(n){return kr(n,t,e)})}),Vn.prototype.reject=function(t){return this.filter(Fa(oo(t)))},Vn.prototype.slice=function(t,e){t=hs(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Vn(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==r&&(n=(e=hs(e))<0?n.dropRight(-e):n.take(e-t)),n)},Vn.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Vn.prototype.toArray=function(){return this.take(p)},gr(Vn.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),o=Un[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);o&&(Un.prototype[e]=function(){var e=this.__wrapped__,s=i?[1]:arguments,u=e instanceof Vn,c=s[0],l=u||qa(e),d=function(t){var e=o.apply(Un,xe([t],s));return i&&p?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var p=this.__chain__,h=!!this.__actions__.length,f=a&&!p,y=u&&!h;if(!a&&l){e=y?e:new Vn(this);var m=t.apply(e,s);return m.__actions__.push({func:pa,args:[d],thisArg:r}),new Ln(m,p)}return f&&y?t.apply(this,s):(m=this.thru(d),f?i?m.value()[0]:m.value():m)})}),Ce(["pop","push","shift","sort","splice","unshift"],function(t){var e=kt[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Un.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var i=this.value();return e.apply(qa(i)?i:[],t)}return this[n](function(n){return e.apply(qa(n)?n:[],t)})}}),gr(Vn.prototype,function(t,e){var n=Un[e];if(n){var r=n.name+"";zt.call(En,r)||(En[r]=[]),En[r].push({name:e,func:n})}}),En[Mi(r,2).name]=[{name:"wrapper",func:r}],Vn.prototype.clone=function(){var t=new Vn(this.__wrapped__);return t.__actions__=Oi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Oi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Oi(this.__views__),t},Vn.prototype.reverse=function(){if(this.__filtered__){var t=new Vn(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Vn.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,n=qa(t),r=e<0,i=n?t.length:0,o=function(t,e,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=vn(e,t+a);break;case"takeRight":t=mn(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,d=l.length,p=0,h=vn(u,this.__takeCount__);if(!n||!r&&i==u&&h==u)return di(t,this.__actions__);var f=[];t:for(;u--&&p<h;){for(var y=-1,m=t[c+=e];++y<d;){var v=l[y],g=v.iteratee,b=v.type,w=g(m);if(2==b)m=w;else if(!w){if(1==b)continue t;break t}}f[p++]=m}return f},Un.prototype.at=ha,Un.prototype.chain=function(){return da(this)},Un.prototype.commit=function(){return new Ln(this.value(),this.__chain__)},Un.prototype.next=function(){this.__values__===r&&(this.__values__=ds(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?r:this.__values__[this.__index__++]}},Un.prototype.plant=function(t){for(var e,n=this;n instanceof Rn;){var i=Uo(n);i.__index__=0,i.__values__=r,e?o.__wrapped__=i:e=i;var o=i;n=n.__wrapped__}return o.__wrapped__=t,e},Un.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Vn){var e=t;return this.__actions__.length&&(e=new Vn(this)),(e=e.reverse()).__actions__.push({func:pa,args:[Qo],thisArg:r}),new Ln(e,this.__chain__)}return this.thru(Qo)},Un.prototype.toJSON=Un.prototype.valueOf=Un.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Un.prototype.first=Un.prototype.head,Zt&&(Un.prototype[Zt]=function(){return this}),Un}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(le._=hn,define(function(){return hn})):pe?((pe.exports=hn)._=hn,de._=hn):le._=hn}.call(this)},9722:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(7995);e.default=function(){return new o.default(new i.default,r.createRequestSender())}},9783:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.joinPaths=e.isAbsoluteUrl=void 0,e.isAbsoluteUrl=function(t){return/^https?:\/\//.test(t)},e.joinPaths=function(t,e){return"".concat((n=t,n.replace(/\/$/,"")),"/").concat(function(t){return t.replace(/^\//,"")}(e));var n}},9828:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(){}return t.prototype.build=function(t,e,n){var r=this,i=document.createElement("form");return i.style.display="none",i.setAttribute("action",t),i.setAttribute("method","POST"),i.setAttribute("target",n||"_top"),Object.keys(e).forEach(function(t){var n=e[t];i.appendChild(r._createInput(n,t))}),i},t.prototype._createInput=function(t,e){var n=document.createElement("input");return n.setAttribute("name",e),n.setAttribute("type","hidden"),n.setAttribute("value",t),n},t}();e.default=n}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.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.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t);var r={};(()=>{"use strict";n.r(r),n.d(r,{createPayPalCommerceAlternativeMethodsButtonStrategy:()=>le,createPayPalCommerceAlternativeMethodsPaymentStrategy:()=>ut,createPayPalCommerceButtonStrategy:()=>ee,createPayPalCommerceCreditButtonStrategy:()=>ie,createPayPalCommerceCreditCardsPaymentStrategy:()=>xt,createPayPalCommerceCreditCustomerStrategy:()=>Ht,createPayPalCommerceCreditPaymentStrategy:()=>tt,createPayPalCommerceCustomerStrategy:()=>qt,createPayPalCommerceFastlaneCustomerStrategy:()=>Xt,createPayPalCommerceFastlanePaymentStrategy:()=>Rt,createPayPalCommercePaymentStrategy:()=>K,createPayPalCommerceRatePayPaymentStrategy:()=>Ft,createPayPalCommerceVenmoButtonStrategy:()=>se,createPayPalCommerceVenmoCustomerStrategy:()=>Kt,createPayPalCommerceVenmoPaymentStrategy:()=>rt});var t,e=n(315);function i(t,e){return Object.assign(t,{resolveIds:e})}class o extends Error{constructor(t){var e;super(t||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",e=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class a extends o{constructor(t){super(t||"Unable to proceed because the client library of a payment method is not loaded or ready to be used."),this.name="PaymentMethodClientUnavailableError",this.type="payment_method_client_unavailable"}}!function(t){t[t.MissingBillingAddress=0]="MissingBillingAddress",t[t.MissingCart=1]="MissingCart",t[t.MissingCheckout=2]="MissingCheckout",t[t.MissingConsignments=3]="MissingConsignments",t[t.MissingCustomer=4]="MissingCustomer",t[t.MissingCheckoutConfig=5]="MissingCheckoutConfig",t[t.MissingOrder=6]="MissingOrder",t[t.MissingOrderConfig=7]="MissingOrderConfig",t[t.MissingOrderId=8]="MissingOrderId",t[t.MissingPayment=9]="MissingPayment",t[t.MissingPaymentId=10]="MissingPaymentId",t[t.MissingPaymentInstrument=11]="MissingPaymentInstrument",t[t.MissingPaymentMethod=12]="MissingPaymentMethod",t[t.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",t[t.MissingPaymentStatus=14]="MissingPaymentStatus",t[t.MissingPaymentToken=15]="MissingPaymentToken",t[t.MissingShippingAddress=16]="MissingShippingAddress"}(t||(t={}));class s extends o{constructor(e){super(function(e){switch(e){case t.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case t.MissingCart:return"Unable to proceed because cart data is unavailable.";case t.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case t.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case t.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case t.MissingCheckoutConfig:case t.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case t.MissingOrder:return"Unable to proceed because order data is unavailable.";case t.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case t.MissingPayment:return"Unable to proceed because payment data is unavailable.";case t.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case t.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case t.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}var u=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class c{constructor(t){this.scriptLoader=t,this.window=window}getPayPalFastlaneSdk(t,e,n){return u(this,void 0,void 0,function*(){if(!this.window.paypalFastlaneSdk){const r=this.getPayPalFastlaneSdkConfiguration(t,e,n);if(yield this.loadPayPalSdk(r),!this.window.paypalFastlaneSdk)throw new a}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(t,e,n,r){return u(this,void 0,void 0,function*(){if(!this.window.paypalGooglePay||r){const r=this.getPayPalGooglePaySdkScriptConfigOrThrow(t,e,n);yield this.loadPayPalSdk(r)}if(!this.window.paypalGooglePay)throw new a;return this.window.paypalGooglePay})}getPayPalApmsSdk(t,e){return u(this,void 0,void 0,function*(){if(!this.window.paypalApms){const n=this.getPayPalApmSdkConfiguration(t,e);if(yield this.loadPayPalSdk(n),!this.window.paypalApms)throw new a}return this.window.paypalApms})}getPayPalMessages(t,e){return u(this,void 0,void 0,function*(){if(!this.window.paypalMessages){const n=this.getPayPalSdkMessagesConfiguration(t,e);yield this.loadPayPalSdk(n)}if(!this.window.paypalMessages)throw new a;return this.window.paypalMessages})}loadPayPalSdk({options:t,attributes:e}){return u(this,void 0,void 0,function*(){const n=this.transformConfig(t),r=this.transformConfig(e),i=`https://www.paypal.com/sdk/js?${new URLSearchParams(n).toString()}`;yield this.scriptLoader.loadScript(i,{async:!0,attributes:r})})}getPayPalFastlaneSdkConfiguration(e,n,r){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:u,merchantId:c,attributionId:l}=o;return{options:{"client-id":u,"merchant-id":c,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:n,intent:a},attributes:{"data-client-metadata-id":r.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":i}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,n,r=!0){const{clientToken:i,initializationData:o}=e;if(!o||!o.clientId)throw new s(t.MissingPaymentMethod);const{intent:a,clientId:u,merchantId:c,buyerCountry:l,attributionId:d,isHostedCheckoutEnabled:p,isDeveloperModeApplicable:h}=o,f=p||r;return{options:Object.assign({"client-id":u,"merchant-id":c,commit:f,components:["googlepay"],currency:n,intent:a},h&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":i,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{intent:i,clientId:o,merchantId:a,buyerCountry:u,attributionId:c,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:p=[]}=r,h=p,f=d.filter(t=>!p.includes(t));return{options:Object.assign({"client-id":o,"merchant-id":a,"enable-funding":h.length>0?h:void 0,"disable-funding":f.length>0?f:void 0,commit:!0,components:["buttons","payment-fields"],currency:n,intent:i},l&&{"buyer-country":u}),attributes:{"data-partner-attribution-id":c,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(e,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new s(t.MissingPaymentMethod);const{clientId:i,merchantId:o,attributionId:a,isDeveloperModeApplicable:u,buyerCountry:c}=r;return{options:Object.assign({"client-id":i,"merchant-id":o,components:["messages"],currency:n},u&&{"buyer-country":c}),attributes:{"data-namespace":"paypalMessages","data-partner-attribution-id":a}}}transformConfig(t){let e={};return Object.keys(t).forEach(n=>{const r=t[n];null==r||""===r||Array.isArray(r)&&0===r.length||(e=Object.assign(Object.assign({},e),{[n]:Array.isArray(r)?r.join(","):r}))}),e}}const l={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},d="embedded-checkout-loading-indicator-rotation";class p{constructor(t){this.styles=Object.assign(Object.assign({},l),t&&t.styles),this.containerStyles=Object.assign({},t&&t.containerStyles),this.defineAnimation(),this.container=this.buildContainer(),this.indicator=this.buildIndicator(),this.container.appendChild(this.indicator)}show(t){if(t){const e=document.getElementById(t);if(!e)throw new Error("Unable to attach the loading indicator because the parent ID is not valid.");e.appendChild(this.container)}this.container.style.visibility="visible",this.container.style.opacity="1"}hide(){const t=()=>{this.container.style.visibility="hidden",this.container.removeEventListener("transitionend",t)};this.container.addEventListener("transitionend",t),this.container.style.opacity="0"}buildContainer(){const t=document.createElement("div");return t.style.display="block",t.style.bottom="0",t.style.left="0",t.style.height="100%",t.style.width="100%",t.style.position="absolute",t.style.right="0",t.style.top="0",t.style.transition="all 250ms ease-out",t.style.opacity="0",this.setStyleAttribute(t,this.containerStyles),t}buildIndicator(){const t=document.createElement("div");return t.style.display="block",t.style.width=`${this.styles.size}px`,t.style.height=`${this.styles.size}px`,t.style.borderRadius=`${this.styles.size}px`,t.style.border="solid 1px",t.style.borderColor=`${this.styles.backgroundColor} ${this.styles.backgroundColor} ${this.styles.color} ${this.styles.color}`,t.style.margin="0 auto",t.style.position="absolute",t.style.left="0",t.style.right="0",t.style.top="50%",t.style.transform="translateY(-50%) rotate(0deg)",t.style.transformStyle="preserve-3d",t.style.animation=`${d} 500ms infinite cubic-bezier(0.69, 0.31, 0.56, 0.83)`,t}setStyleAttribute(t,e){Object.keys(e).forEach(n=>{t.style.setProperty(n,e[n])})}defineAnimation(){var t;if(document.getElementById(d))return;const e=document.createElement("style");e.id=d,null===(t=document.head)||void 0===t||t.appendChild(e),e.sheet instanceof CSSStyleSheet&&e.sheet.insertRule(`\n @keyframes ${d} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}var h=n(8686),f=n(4043),y=n(9440);class m extends o{constructor(t){super(t||"An unexpected error has occurred during buy now cart creation process. Please try again later."),this.name="BuyNowCartCreationError",this.type="buy_now_cart_creation_error"}}const v={body:{},headers:{},status:0};class g extends o{constructor(t,{message:e,errors:n}={}){const{body:r,headers:i,status:o}=t||v;super(e||"An unexpected error has occurred."),this.name="RequestError",this.type="request",this.body=r,this.headers=i,this.status=o,this.errors=n||[]}}var b,w,S,_,I,C,P,O;!function(t){t.BuyNow="BUY_NOW"}(b||(b={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(w||(w={})),function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(S||(S={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(_||(_={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(I||(I={})),function(t){t.pill="pill",t.rect="rect"}(C||(C={})),function(t){t.OXXO="oxxo"}(P||(P={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(O||(O={}));var A=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class k{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.paypalCommerceRequestSender=n,this.paypalCommerceScriptLoader=r}loadPayPalSdk(t,e,n,r){return A(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=e||i.getCartOrThrow().currency.code,a=i.getPaymentMethodOrThrow(t);return this.paypalSdk=yield this.paypalCommerceScriptLoader.getPayPalSDK(a,o,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new a;return this.paypalSdk}createBuyNowCartOrThrow(e){return A(this,void 0,void 0,function*(){const n=e.getBuyNowCartRequestBody();if(!n)throw new s(t.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(n)}catch(t){throw new m}})}createOrder(t,e){return A(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.paypalCommerceRequestSender.createOrder(t,Object.assign({cartId:n},e));return r})}createOrderCardFields(t,e){return A(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.paypalCommerceRequestSender.createOrder(t,Object.assign({cartId:n},e));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(){return A(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState(),e=t.getCartOrThrow(),n=t.getConsignmentsOrThrow()[0];try{yield this.paypalCommerceRequestSender.updateOrder({availableShippingOptions:n.availableShippingOptions,cartId:e.id,selectedShippingOption:n.selectedShippingOption})}catch(t){throw new g}})}getOrderStatus(t,e){return A(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalCommerceRequestSender.getOrderStatus(t,e);return n}catch(t){throw new g}})}tokenizePayment(e,n){const r=this.paymentIntegrationService.getState().getCartOrThrow();if(!n)throw new s(t.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:e,order_id:n},r.source===b.BuyNow&&{cart_id:r.id}))}submitPayment(t,e,n){return A(this,void 0,void 0,function*(){const r={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:t,paypal_account:{order_id:e}}};yield this.paymentIntegrationService.submitPayment(Object.assign({methodId:t,paymentData:r},n?{gatewayId:n}:{}))})}getShippingOptionOrThrow(t){const e=this.paymentIntegrationService.getState().getConsignmentsOrThrow()[0],n=e.availableShippingOptions||[],r=n.find(t=>t.isRecommended),i=(t?n.find(e=>e.id===t):n.find(t=>{var n;return t.id===(null===(n=e.selectedShippingOption)||void 0===n?void 0:n.id)}))||r||n[0];if(!i)throw new Error("Your order can't be shipped to this address");return i}getAddress(t){return{firstName:(null==t?void 0:t.firstName)||"",lastName:(null==t?void 0:t.lastName)||"",email:(null==t?void 0:t.email)||"",phone:(null==t?void 0:t.phone)||"",company:"",address1:(null==t?void 0:t.address1)||"",address2:(null==t?void 0:t.address2)||"",city:(null==t?void 0:t.city)||"",countryCode:(null==t?void 0:t.countryCode)||"",postalCode:(null==t?void 0:t.postalCode)||"",stateOrProvince:"",stateOrProvinceCode:(null==t?void 0:t.stateOrProvinceCode)||"",customFields:[]}}getBillingAddressFromOrderDetails({payer:t}){var e,n;return this.getAddress({firstName:t.name.given_name,lastName:t.name.surname,email:t.email_address,address1:t.address.address_line_1,address2:t.address.address_line_2,city:t.address.admin_area_2,countryCode:t.address.country_code,postalCode:t.address.postal_code,stateOrProvinceCode:t.address.admin_area_1,phone:null===(n=null===(e=t.phone)||void 0===e?void 0:e.phone_number)||void 0===n?void 0:n.national_number})}getShippingAddressFromOrderDetails(t){const{payer:e,purchase_units:n}=t,{address:r,name:{full_name:i}}=n[0].shipping,[o,...a]=i.split(" ");return this.getAddress({firstName:o,lastName:a.join(" "),email:e.email_address,address1:r.address_line_1,address2:r.address_line_2,city:r.admin_area_2,countryCode:r.country_code,postalCode:r.postal_code,stateOrProvinceCode:r.admin_area_1})}getValidButtonStyle(t){const{color:e,height:n,label:r,shape:i}=t||{},o={color:e&&I[e]?e:void 0,height:this.getValidHeight(n),label:r&&_[r]?r:void 0,shape:i&&C[i]?i:void 0};return(0,y.omitBy)(o,y.isNil)}getValidHeight(t){return t&&"number"==typeof t?t>55?55:t<25?25:t:40}removeElement(t){const e=t&&document.getElementById(t);e&&(e.style.display="none")}}const E="This API endpoint is for internal use only and may change in the future";var j;!function(t){t.Json="application/json",t.JsonV1="application/vnd.bc.v1+json"}(j||(j={}));const x=j,T={"X-Checkout-SDK-Version":"1.818.0"};var z=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class F{constructor(t){this.requestSender=t}createOrder(t,e){return z(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t){return z(this,void 0,void 0,function*(){const e=t,n=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.put("/api/storefront/initialization/paypalcommerce",{headers:n,body:e})).body})}getOrderStatus(t="paypalcommerce",e){return z(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":E,"Content-Type":x.Json},T);return(yield this.requestSender.get(n,Object.assign({headers:r},e))).body})}}var B=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class D{constructor(t){this.scriptLoader=t,this.window=window}getPayPalSDK(t,e,n,r){return B(this,void 0,void 0,function*(){const i=this.getPayPalSdkScriptConfigOrThrow(t,e,n);return this.loadPayPalSDK(i,r)})}loadPayPalSDK(t,e=!1){return B(this,void 0,void 0,function*(){if(!this.window.paypal||e){const e=this.transformConfig(t.options),n=this.transformConfig(t.attributes),r=`https://www.paypal.com/sdk/js?${new URLSearchParams(e).toString()}`;yield this.scriptLoader.loadScript(r,{async:!0,attributes:n})}if(!this.window.paypal)throw new a;return this.window.paypal})}getPayPalSdkScriptConfigOrThrow(e,n,r=!0){const{id:i,clientToken:o,initializationData:a}=e;if(!(null==a?void 0:a.clientId))throw new s(t.MissingPaymentMethod);const{intent:u,clientId:c,merchantId:l,buyerCountry:d,attributionId:p,isVenmoEnabled:h,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:y,isDeveloperModeApplicable:m,availableAlternativePaymentMethods:v=[],enabledAlternativePaymentMethods:g=[],isGooglePayEnabled:b}=a,w=f||r,S="paypalcommercecreditcards"===i,_=S?["card"]:[],I=y?["credit","paylater"]:[],C=r||!w,P=h?["venmo"]:[],O=C?g:[],A=b?["googlepay"]:[],k=r?["card-fields"]:[],E=[...S?[]:["card"],...y?[]:["credit","paylater"],...h?[]:["venmo"],...C?v.filter(t=>!g.includes(t)):v],j=[..._,...I,...P,...O];return{options:Object.assign({"client-id":c,"merchant-id":l,"enable-funding":j.length>0?j:void 0,"disable-funding":E.length>0?E:void 0,commit:w,components:["buttons","hosted-fields","payment-fields","legal",...A,...k],currency:n,intent:u},m&&{"buyer-country":d}),attributes:{"data-partner-attribution-id":p,"data-client-token":o}}}transformConfig(t){let e={};return Object.keys(t).forEach(n=>{const r=t[n];null==r||""===r||Array.isArray(r)&&0===r.length||(e=Object.assign(Object.assign({},e),{[n]:Array.isArray(r)?r.join(","):r}))}),e}}const M=t=>{const{getHost:n}=t.getState();return new k((0,h.createFormPoster)(),t,new F((0,f.createRequestSender)({host:n()})),new D((0,e.vQ)()))},U={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};class N extends o{constructor(t){super(t||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class R extends N{constructor(t){let e="Unable to submit payment for the order because the payload is invalid.";t&&(e=`${e} Make sure the following fields are provided correctly: ${t.join(", ")}.`),super(e),this.name="PaymentArgumentInvalidError"}}class L extends g{constructor(t){super(t,{message:"There is a problem processing your payment. Please try again later."}),this.name="PaymentMethodInvalidError",this.type="payment_method_invalid"}}class V extends o{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function q(t){return!("object"!=typeof t||null===t||void 0!==t.shouldSaveInstrument&&"boolean"!=typeof t.shouldSaveInstrument||void 0!==t.shouldSetAsDefaultInstrument&&"boolean"!=typeof t.shouldSetAsDefaultInstrument)}function $(t){return Boolean(t.instrumentId)}const W=function({styles:t}){const e={};return t.color&&(e.color=t.color),t.layout&&(e.layout=t.layout),(t["logo-type"]||t["logo-position"])&&(e.logo={},t["logo-type"]&&(e.logo.type=t["logo-type"]),t["logo-position"]&&(e.logo.position=t["logo-position"])),t.ratio&&(e.ratio=t.ratio),(t["text-color"]||t["text-size"])&&(e.text={},t["text-color"]&&(e.text.color=t["text-color"]),t["text-size"]&&(e.text.size=+t["text-size"])),e};function H(t){return"object"==typeof t&&null!==t&&"bigpayToken"in t&&"defaultInstrument"in t&&"provider"in t&&"trustedShippingAddress"in t&&"method"in t&&"type"in t}var G=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Y{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalCommerceSdk=n,this.loadingIndicator=r}initialize(t){var e;return G(this,void 0,void 0,function*(){const{methodId:n,paypalcommerce:r}=t||{};if(this.paypalcommerce=r,!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new N('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(n);const i=this.paymentIntegrationService.getState(),o=i.getPaymentMethodOrThrow(n),{container:a,bannerContainerId:s}=r,{orderId:u,paypalBNPLConfiguration:c=[],isPayPalCreditAvailable:l}=o.initializationData||{};if(void 0!==s){if(!document.getElementById(s))return void console.error("Unable to create banner without valid banner container ID.");const t=null==c?void 0:c.find(({id:t})=>"checkout"===t);if(l||!(null==t?void 0:t.status))return;const e=yield this.paypalCommerceSdk.getPayPalMessages(o,i.getCartOrThrow().currency.code);return e&&"function"==typeof(null==e?void 0:e.Messages)?this.renderMessages(e,s,t):void console.error("[BC PayPalCommerce PayLater]: banner could not be rendered, due to issues with loading PayPal SDK")}u?this.orderId=null===(e=o.initializationData)||void 0===e?void 0:e.orderId:(this.loadingIndicatorContainer=null==a?void 0:a.split("#")[1],yield this.paypalCommerceIntegrationService.loadPayPalSdk(n),r.onInit&&"function"==typeof r.onInit&&r.onInit(()=>this.renderButton(n,r)),(void 0===r.shouldRenderPayPalButtonOnInitialization||r.shouldRenderPayPalButtonOnInitialization)&&this.renderButton(n,r))})}execute(t,e){var n,r;return G(this,void 0,void 0,function*(){const{payment:i}=t,o=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{onError:a}=this.paypalcommerce||{};if(!i)throw new R(["payment"]);const{methodId:s,paymentData:u}=i;if(this.isPayPalVaultedInstrumentPaymentData(u)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new L;const c=this.isPayPalVaultedInstrumentPaymentData(u)?this.prepareVaultedInstrumentPaymentPayload(s,this.orderId,u):this.preparePaymentPayload(s,this.orderId,u);try{yield this.paymentIntegrationService.submitOrder(o,e),yield this.paymentIntegrationService.submitPayment(c)}catch(t){if(function(t){var e;return(t=>"object"==typeof t&&null!==t&&"body"in t)(t)&&"offsite_redirect"===(null===(e=t.body.additional_action_required)||void 0===e?void 0:e.type)}(t)){const e=null===(r=null===(n=t.body.additional_action_required)||void 0===n?void 0:n.data)||void 0===r?void 0:r.redirect_url;return new Promise(()=>window.location.replace(e))}return this.isProviderError(t)&&(yield this.paypalCommerceIntegrationService.loadPayPalSdk(i.methodId),yield new Promise((t,e)=>{var n;this.paypalcommerce&&(null===(n=this.paypalButton)||void 0===n||n.close(),this.renderButton(i.methodId,this.paypalcommerce),this.handleError(new Error("INSTRUMENT_DECLINED"),a)),e()})),this.handleError(t,a),Promise.reject()}})}finalize(){return Promise.reject(new V)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}prepareVaultedInstrumentPaymentPayload(t,e,n){const{instrumentId:r,shouldSetAsDefaultInstrument:i}=n,o=!this.isTrustedVaultingFlow(n);return o?{methodId:t,paymentData:{shouldSaveInstrument:o,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e}}}}:{methodId:t,paymentData:{instrumentId:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e},bigpay_token:{token:r}}}}}preparePaymentPayload(t,e,n){const{shouldSaveInstrument:r=!1,shouldSetAsDefaultInstrument:i=!1}=q(n)?n:{};return{methodId:t,paymentData:{shouldSaveInstrument:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e}}}}}renderButton(t,e){var n,r,i,o;const a=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:u}=s.initializationData||{},{checkoutPaymentButtonStyles:c}=u||{},{container:l,onError:d,onRenderButton:p,onValidate:h,submitForm:f}=e;if(!l)throw new N('Unable to initialize payment because "container" argument is not provided.');const y=Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{fundingSource:a.FUNDING.PAYPAL,style:this.paypalCommerceIntegrationService.getValidButtonStyle(c),createOrder:()=>this.createOrder(),onClick:(t,e)=>this.handleClick(e,h),onApprove:t=>this.handleApprove(t,f),onError:t=>this.handleError(t,d),onCancel:()=>this.toggleLoadingIndicator(!1)});this.paypalButton=a.Buttons(y),this.paypalButton.isEligible()&&(p&&"function"==typeof p&&p(),(null===(r=(n=this.paypalButton).hasReturned)||void 0===r?void 0:r.call(n))&&this.isPaypalCommerceAppSwitchEnabled(t)?null===(o=(i=this.paypalButton).resume)||void 0===o||o.call(i):this.paypalButton.render(l))}handleClick(t,e){return G(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;return null==e?void 0:e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,null==e||e()}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}createOrder(){return G(this,void 0,void 0,function*(){const t=this.getFieldsValues();return this.paypalCommerceIntegrationService.createOrder("paypalcommercecheckout",{shouldSaveInstrument:(null==t?void 0:t.shouldSaveInstrument)||!1})})}getFieldsValues(){const{getFieldsValues:t}=this.paypalcommerce||{};return"function"==typeof t?t():void 0}isTrustedVaultingFlow(t){if(t&&$(t)){const e=this.paymentIntegrationService.getState().getInstruments(),n=null==e?void 0:e.find(e=>H(e)&&e.bigpayToken===t.instrumentId);return!(H(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(t){return!!t&&$(t)&&q(t)}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:W(n)};t.Messages(r).render(`#${e}`)}isProviderError(t){var e,n,r;return!!function(t){return"object"==typeof t&&null!==t&&"errors"in t}(t)&&"INSTRUMENT_DECLINED"===(null===(r=null===(n=((null===(e=null==t?void 0:t.errors)||void 0===e?void 0:e.filter(t=>t.provider_error))||[])[0])||void 0===n?void 0:n.provider_error)||void 0===r?void 0:r.code)}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}}const K=i(t=>new Y(t,M(t),new c((0,e.vQ)()),new p({containerStyles:U})),[{id:"paypalcommerce"}]);function J(){return new c((0,e.Hb)())}class Z extends o{constructor(t){super(t||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}var X=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Q{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n,this.paypalCommerceSdk=r}initialize(t){return X(this,void 0,void 0,function*(){const{methodId:e,paypalcommerce:n,paypalcommercecredit:r}=t||{},i=r||n;if(!e)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new N('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(e);const o=this.paymentIntegrationService.getState(),a=o.getPaymentMethodOrThrow(e),{paypalBNPLConfiguration:s=[],orderId:u}=a.initializationData||{},{bannerContainerId:c,container:l}=i;if(void 0!==c){if(!document.getElementById(c))return void console.error("Unable to create banner without valid banner container ID.");const t=s&&s.find(({id:t})=>"checkout"===t);if(!(null==t?void 0:t.status))return;const e=yield this.paypalCommerceSdk.getPayPalMessages(a,o.getCartOrThrow().currency.code);return this.renderMessages(e,c,t)}u?this.orderId=u:(yield this.paypalCommerceIntegrationService.loadPayPalSdk(e),this.loadingIndicatorContainer=null==l?void 0:l.split("#")[1],this.renderButton(e,i))})}execute(t,e){return X(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new R(["payment"]);if(!this.orderId)throw new L;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalCommerceIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new V)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}renderButton(t,e){if(!(null==e?void 0:e.container))throw new N('Unable to initialize payment because "container" argument is not provided.');const n=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=e,d=[n.FUNDING.PAYLATER,n.FUNDING.CREDIT];let p=!1;d.forEach(t=>{if(p)return;const e={fundingSource:t,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecreditcheckout"),onClick:(t,e)=>this.handleClick(e,c),onApprove:t=>this.handleApprove(t,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:t=>this.handleError(t,s)};if(this.paypalButton=n.Buttons(e),this.paypalButton.isEligible()||t!==n.FUNDING.PAYLATER){if(!this.paypalButton.isEligible()&&t===n.FUNDING.CREDIT)throw new Z(`PayPal ${t} is not available for your region. Please use PayPal Checkout instead.`);u&&"function"==typeof u&&u(),this.paypalButton.render(a),p=!0}})}handleClick(t,e){return X(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;if(e&&"function"==typeof e)return e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,e&&"function"==typeof e&&e()}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:W(n)};t.Messages(r).render(`#${e}`)}}const tt=i(t=>new Q(t,M(t),new p({containerStyles:U}),J()),[{id:"paypalcommercecredit"}]);var et=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class nt{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n}initialize(t){var e,n;return et(this,void 0,void 0,function*(){const{methodId:r,paypalcommerce:i,paypalcommercevenmo:o}=t||{},a=o||i;if(!r)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!a)throw new N('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(r);const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(r);(null===(e=s.initializationData)||void 0===e?void 0:e.orderId)?this.orderId=null===(n=s.initializationData)||void 0===n?void 0:n.orderId:(yield this.paypalCommerceIntegrationService.loadPayPalSdk(r),this.loadingIndicatorContainer=a.container.split("#")[1],this.renderButton(r,a))})}execute(t,e){return et(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new R(["payment"]);if(!this.orderId)throw new L;yield this.paymentIntegrationService.submitOrder(r,e),yield this.paypalCommerceIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new V)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}renderButton(t,e){const n=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=e,d={fundingSource:n.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmocheckout"),onClick:(t,e)=>this.handleClick(e,c),onApprove:t=>this.handleApprove(t,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:t=>this.handleError(t,s)};if(this.paypalButton=n.Buttons(d),!this.paypalButton.isEligible())throw new Z("PayPal Venmo is not available for your region. Please use PayPal Checkout instead.");u&&"function"==typeof u&&u(),this.paypalButton.render(a)}handleClick(t,e){return et(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;return e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,e(),this.toggleLoadingIndicator(!1)}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const rt=i(t=>new nt(t,M(t),new p({styles:{backgroundColor:"black"}})),[{id:"paypalcommercevenmo"}]);class it extends g{constructor(t){super(t,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}function ot(t,e,n=!0){var r;return null!==(r=t[e])&&void 0!==r?r:n}var at=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class st{constructor(t,e,n,r,i=3e3,o=3e5){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalCommerceSdk=n,this.loadingIndicator=r,this.pollingInterval=i,this.maxPollingIntervalTime=o,this.pollingTimer=0,this.stopPolling=y.noop,this.isPollingEnabled=!1}initialize(t){return at(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,paypalcommerce:r,paypalcommercealternativemethods:i}=t,o=i||r;if(this.paypalcommercealternativemethods=i,!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!o)throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');const a=this.paymentIntegrationService.getState(),s=a.getPaymentMethodOrThrow(n,e),{orderId:u,shouldRenderFields:c}=s.initializationData||{},l=a.getStoreConfigOrThrow().checkoutSettings.features;this.isPollingEnabled=ot(l,"PAYPAL-5192.paypal_commerce_ideal_polling"),u?this.orderId=u:(this.paypalApms=yield this.paypalCommerceSdk.getPayPalApmsSdk(s,a.getCartOrThrow().currency.code),this.loadingIndicatorContainer=o.container.split("#")[1],this.renderButton(n,e,o),c&&this.renderFields(n,o))})}execute(t,e){return at(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new R(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new L;this.isPollingEnabled&&"ideal"===i&&(yield new Promise((t,e)=>{this.initializePollingMechanism(i,t,e,o)})),this.isNonInstantPaymentMethod(i)||(yield this.paymentIntegrationService.submitOrder(r,e)),yield this.paypalCommerceIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new V)}deinitialize(){var t;return this.orderId=void 0,this.isPollingEnabled&&this.resetPollingMechanism(),null===(t=this.paypalButton)||void 0===t||t.close(),Promise.resolve()}initializePollingMechanism(t,e,n,r){return at(this,void 0,void 0,function*(){yield new Promise((t,e)=>{const n=setTimeout(t,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),e())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.paypalCommerceIntegrationService.getOrderStatus(r),o=i===O.Approved,a=i===O.PollingError;if(o)return this.deinitializePollingMechanism(),e();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(t,e,n,r);yield this.reinitializeStrategy({methodId:t,gatewayId:r,paypalcommercealternativemethods:this.paypalcommercealternativemethods}),this.handleError(new it)}catch(t){n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}reinitializeStrategy(t){return at(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}handleError(t){const{onError:e}=this.paypalcommercealternativemethods||{};this.isPollingEnabled&&this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}renderButton(t,e,n){const r=this.getPaypalAmpsSdkOrThrow(),i=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t,e),{buttonStyle:o}=i.initializationData||{},{container:a,onError:s,onRenderButton:u,submitForm:c}=n,l={fundingSource:t,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),onInit:(t,e)=>n.onInitButton(e),createOrder:()=>this.onCreateOrder(t,e,n),onApprove:t=>this.handleApprove(t,c),onCancel:()=>{this.toggleLoadingIndicator(!1),this.deinitializePollingMechanism()},onError:t=>{this.deinitializePollingMechanism(),this.handleFailure(t,s)},onClick:(t,e)=>at(this,void 0,void 0,function*(){return n.onValidate(e.resolve,e.reject)})};this.paypalButton=r.Buttons(l),this.paypalButton.isEligible()&&(u&&"function"==typeof u&&u(),this.paypalButton.render(a))}onCreateOrder(t,e,n){return at(this,void 0,void 0,function*(){const{onValidate:r}=n;yield r(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),y.noop);const i=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout");if(this.isNonInstantPaymentMethod(t)){const n={useStoreCredit:!1},r={params:{methodId:t,gatewayId:e}};yield this.paymentIntegrationService.submitOrder(n,r),yield this.paypalCommerceIntegrationService.submitPayment(t,i,e)}return i})}handleApprove({orderID:t},e){this.orderId=t,e()}handleFailure(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}renderFields(t,e){const n=this.getPaypalAmpsSdkOrThrow(),r=this.paymentIntegrationService.getState(),{firstName:i,lastName:o,email:a}=r.getBillingAddressOrThrow(),{apmFieldsContainer:s,apmFieldsStyles:u}=e;if(!s)throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods" argument should contain "apmFieldsContainer".');const c=document.querySelector(s);c&&(c.innerHTML="");const l={fundingSource:t,style:u||{},fields:{name:{value:`${i} ${o}`},email:{value:a}}};n.PaymentFields(l).render(s)}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isNonInstantPaymentMethod(t){return t.toUpperCase()in P}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new a;return this.paypalApms}}const ut=i(t=>new st(t,M(t),J(),new p({containerStyles:U})),[{gateway:"paypalcommercealternativemethods"}]);var ct,lt,dt,pt,ht,ft,yt,mt;!function(t){t.CVV="cvv",t.PAN="pan"}(ct||(ct={}));class vt{static get(t){const e=`${encodeURIComponent(`${t}`)}=`,n=document.cookie;let r=null;const i=n.indexOf(e);if(i>-1){let t=n.indexOf(";",i);-1===t&&(t=n.length),r=decodeURIComponent(n.substring(i+e.length,t))}return r}static set(t,e,n={secure:!0}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(e)}`;const{expires:i,path:o,domain:a,secure:s}=n;if(i)r+=`; expires=${i.toUTCString()}`;else{const t=new Date,e=60;t.setTime(t.getTime()+60*e*1e3),r+=`; expires=${t.toUTCString()}`}o&&(r+=`; path=${o}`),a&&(r+=`; domain=${a}`),s&&(r+="; secure"),document.cookie=r}static remove(t,e){vt.set(t,"",Object.assign({expires:new Date(0)},e))}}!function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(lt||(lt={})),function(t){t.Succeeded="succeeded",t.Cancelled="cancelled",t.Errored="errored"}(dt||(dt={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(pt||(pt={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(ht||(ht={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(ft||(ft={})),function(t){t.pill="pill",t.rect="rect"}(yt||(yt={})),function(t){t.SUCCEEDED="succeeded",t.FAILED="failed",t.CANCELED="canceled",t.UNRECOGNIZED="unrecognized"}(mt||(mt={}));var gt,bt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class wt{constructor(){this.window=window}initializePayPalFastlane(t,e,n){return bt(this,void 0,void 0,function*(){if(e&&(window.localStorage.setItem("fastlaneEnv","sandbox"),window.localStorage.setItem("axoEnv","sandbox")),!this.window.paypalFastlane){const e={root:{backgroundColorPrimary:"transparent"}};this.window.paypalFastlane=yield t.Fastlane({styles:n||e})}return this.window.paypalFastlane})}getPayPalFastlaneOrThrow(){if(!this.window.paypalFastlane)throw new a;return this.window.paypalFastlane}lookupCustomerOrThrow(t){return bt(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(t)})}triggerAuthenticationFlowOrThrow(t){return bt(this,void 0,void 0,function*(){return t?this.getPayPalFastlaneOrThrow().identity.triggerAuthenticationFlow(t):{}})}updateStorageSessionId(t){const e=new Date;e.setDate(e.getDate()+14);const n={expires:e,secure:!0};vt.set("bc-fastlane-sessionId",t,n)}removeStorageSessionId(){vt.remove("bc-fastlane-sessionId")}getStorageSessionId(){return vt.get("bc-fastlane-sessionId")||""}mapPayPalFastlaneProfileToBcCustomerData(t,e){var n,r,i;const{authenticationState:o,profileData:a}=e,s=null===(i=null===(r=null===(n=null==a?void 0:a.card)||void 0===n?void 0:n.paymentSource)||void 0===r?void 0:r.card)||void 0===i?void 0:i.billingAddress,u=null==a?void 0:a.shippingAddress,c=null==a?void 0:a.name,l=null==a?void 0:a.card,d=u?this.mapPayPalToBcAddress(u.address,u.name,u.phoneNumber):void 0,p=s&&c?this.mapPayPalToBcAddress(s,c,null==u?void 0:u.phoneNumber):void 0,h=l?this.mapPayPalToBcInstrument(t,l):[],f=this.filterAddresses([d,p]);return{authenticationState:o||mt.UNRECOGNIZED,addresses:f,billingAddress:p,shippingAddress:d,instruments:h}}mapPayPalToBcInstrument(t,e){const{id:n,paymentSource:r}=e,{brand:i,expiry:o,lastDigits:a}=r.card,[s,u]=o.split("-");return[{bigpayToken:n,brand:i,defaultInstrument:!1,expiryMonth:u,expiryYear:s,iin:"",last4:a,method:t,provider:t,trustedShippingAddress:!1,untrustedShippingCardVerificationMode:ct.PAN,type:"card"}]}mapBcToPayPalAddress(t){return{company:(null==t?void 0:t.company)||"",addressLine1:(null==t?void 0:t.address1)||"",addressLine2:(null==t?void 0:t.address2)||"",adminArea1:(null==t?void 0:t.stateOrProvinceCode)||(null==t?void 0:t.stateOrProvince)||"",adminArea2:(null==t?void 0:t.city)||"",postalCode:(null==t?void 0:t.postalCode)||"",countryCode:(null==t?void 0:t.countryCode)||""}}mapPayPalToBcAddress(t,e,n,r){const[i,o]=e.fullName.split(" "),a=(null==n?void 0:n.nationalNumber)||"",s=(null==n?void 0:n.countryCode)||"";return{id:Date.now(),type:"paypal-address",firstName:e.firstName||i||"",lastName:e.lastName||o||"",company:t.company||"",address1:t.addressLine1,address2:t.addressLine2||"",city:t.adminArea2,stateOrProvince:t.adminArea1,stateOrProvinceCode:t.adminArea1,country:t.countryCode||"",countryCode:t.countryCode||"",postalCode:t.postalCode,phone:s+a,customFields:r||[]}}filterAddresses(t){return t.reduce((t,e)=>e?t.some(t=>this.isEqualAddresses(t,e))?t:[...t,e]:t,[])}isEqualAddresses(t,e){return(0,y.isEqual)(this.normalizeAddress(t),this.normalizeAddress(e))}normalizeAddress(t){return(0,y.omit)(t,["id","phone"])}}function St(){return new wt}!function(t){t.CardCode="cardCode",t.CardCodeVerification="cardCodeVerification",t.CardExpiry="cardExpiry",t.CardName="cardName",t.CardNumber="cardNumber",t.CardNumberVerification="cardNumberVerification",t.CardExpiryVerification="cardExpiryVerification"}(gt||(gt={}));const _t=gt;function It(t){return _t.CardNumber in t&&_t.CardName in t&&_t.CardExpiry in t}function Ct(t){return _t.CardNumberVerification in t&&_t.CardCodeVerification in t&&_t.CardExpiryVerification in t}class Pt extends o{constructor(t){super(t||"Unable to proceed because the client library of a payment method has thrown an unexpected error."),this.name="PaymentMethodFailedError",this.type="payment_method_client_invalid"}}var Ot;!function(t){t[t.CheckoutButtonNotInitialized=0]="CheckoutButtonNotInitialized",t[t.CustomerNotInitialized=1]="CustomerNotInitialized",t[t.PaymentNotInitialized=2]="PaymentNotInitialized",t[t.ShippingNotInitialized=3]="ShippingNotInitialized",t[t.SpamProtectionNotInitialized=4]="SpamProtectionNotInitialized"}(Ot||(Ot={}));class At extends o{constructor(t){super(function(t){switch(t){case Ot.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case Ot.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case Ot.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case Ot.SpamProtectionNotInitialized:return"Unable to proceed because the checkout spam protection has not been initialized.";default:return"Unable to proceed because the required component has not been initialized."}}(t)),this.subtype=t,this.name="NotInitializedError",this.type="not_initialized"}}class kt extends o{constructor(t,e){super(e||"Unable to proceed because the payment form contains invalid data."),this.details=t,this.name="PaymentInvalidFormError",this.type="payment_invalid_form"}}var Et=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class jt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalCommerceSdk=n,this.paypalCommerceFastlaneUtils=r}initialize(t){return Et(this,void 0,void 0,function*(){const{methodId:e,paypalcommercecreditcards:n,paypalcommerce:r}=t,i=n||r,{form:o,onCreditCardFieldsRenderingError:a,onLoadComplete:s}=i||{};if(!e)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!o)throw new N('Unable to proceed because "options.paypalcommercecreditcards.form" argument is not provided.');this.hostedFormOptions=o,this.isCreditCardForm=It(o.fields),this.isCreditCardVaultedForm=Ct(o.fields)&&!this.hasUndefinedValues(),yield this.paymentIntegrationService.loadPaymentMethod(e),yield this.paypalCommerceIntegrationService.loadPayPalSdk(e,void 0,!0,!0),null==s||s(),(this.isCreditCardForm||this.isCreditCardVaultedForm)&&(yield this.initializeFields(o,a)),this.shouldInitializePayPalFastlane(e)&&(yield this.initializePayPalFastlaneOrThrow(e))})}execute(t,e){return Et(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{methodId:i,paymentData:o}=n||{};if(!n||!i)throw new R(["payment"]);if(this.executionPaymentData=o,this.isCreditCardForm||this.isCreditCardVaultedForm)yield this.validateHostedFormOrThrow(),yield this.submitHostedForm();else{const{orderId:t}=yield this.paypalCommerceIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",this.getInstrumentParams());this.returnedOrderId=t}const a=this.preparePaymentPayload(i,o,this.returnedOrderId,this.returnedVaultedToken);yield this.paymentIntegrationService.submitOrder(r,e),yield this.paymentIntegrationService.submitPayment(a)})}finalize(){return Promise.reject(new V)}deinitialize(){var t,e,n,r;return Et(this,void 0,void 0,function*(){return yield null===(t=this.cvvField)||void 0===t?void 0:t.close(),yield null===(e=this.expiryField)||void 0===e?void 0:e.close(),yield null===(n=this.numberField)||void 0===n?void 0:n.close(),yield null===(r=this.nameField)||void 0===r?void 0:r.close(),Promise.resolve()})}preparePaymentPayload(t,e,n,r){const{shouldSaveInstrument:i=!1,shouldSetAsDefaultInstrument:o=!1}=q(e)?e:{},a=e&&$(e)?e.instrumentId:void 0,s=(0,y.omitBy)({verification_nonce:r,token:a},y.isNil);return{methodId:t,paymentData:{shouldSaveInstrument:i,shouldSetAsDefaultInstrument:o,instrumentId:a,formattedPayload:Object.assign(Object.assign({},r||a?{bigpay_token:s}:{}),n?{card_with_order:{order_id:n}}:{})}}}initializeFields(t,e){return Et(this,void 0,void 0,function*(){const{fields:n,styles:r}=t,i=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),o=this.getExecuteCallback(n),a=Object.assign({style:this.getInputStyles(r),onApprove:({orderID:t,vaultSetupToken:e,liabilityShift:n})=>{if(n===w.No||n===w.Unknown)throw new Error;return this.handleApprove({orderID:t,vaultSetupToken:e})},onError:()=>{throw new Pt},inputEvents:{onChange:e=>this.onChangeHandler(t,e),onFocus:e=>this.onFocusHandler(t,e),onBlur:e=>this.onBlurHandler(t,e),onInputSubmitRequest:e=>this.onInputSubmitRequest(t,e)}},o);if(this.cardFields=yield i.CardFields(a),!this.cardFields.isEligible())throw new At(Ot.PaymentNotInitialized);try{this.stylizeInputContainers(n),It(n)&&(yield this.renderFields(n)),Ct(n)&&(yield this.renderVaultedFields(n))}catch(t){"function"==typeof e&&e(t)}})}getExecuteCallback(t){return Ct(t)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>Et(this,void 0,void 0,function*(){const{setupToken:t}=(yield this.paypalCommerceIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",Object.assign(Object.assign({},this.getInstrumentParams()),{setupToken:!0})))||{};return t})}}createOrderCallback(){return{createOrder:()=>Et(this,void 0,void 0,function*(){const{orderId:t}=(yield this.paypalCommerceIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",this.getInstrumentParams()))||{};return t})}}handleApprove({orderID:t,vaultSetupToken:e}){t&&(this.returnedOrderId=t),e&&(this.returnedVaultedToken=e)}renderFields(t){var e,n,r,i;return Et(this,void 0,void 0,function*(){const o=this.getCardFieldsOrThrow();(null===(e=t.cardCode)||void 0===e?void 0:e.containerId)&&(this.cvvField=o.CVVField({placeholder:""}),yield this.cvvField.render(`#${t.cardCode.containerId}`)),(null===(n=t.cardExpiry)||void 0===n?void 0:n.containerId)&&(this.expiryField=o.ExpiryField(),yield this.expiryField.render(`#${t.cardExpiry.containerId}`)),(null===(r=t.cardName)||void 0===r?void 0:r.containerId)&&(this.nameField=o.NameField({placeholder:""}),yield this.nameField.render(`#${t.cardName.containerId}`)),(null===(i=t.cardNumber)||void 0===i?void 0:i.containerId)&&(this.numberField=o.NumberField({placeholder:""}),yield this.numberField.render(`#${t.cardNumber.containerId}`))})}renderVaultedFields(t){var e,n,r;return Et(this,void 0,void 0,function*(){const i=this.getCardFieldsOrThrow();(null===(e=t.cardCodeVerification)||void 0===e?void 0:e.containerId)&&(this.cvvField=i.CVVField({placeholder:""}),yield this.cvvField.render(`#${t.cardCodeVerification.containerId}`)),(null===(n=t.cardExpiryVerification)||void 0===n?void 0:n.containerId)&&(this.expiryField=i.ExpiryField(),yield this.expiryField.render(`#${t.cardExpiryVerification.containerId}`)),(null===(r=t.cardNumberVerification)||void 0===r?void 0:r.containerId)&&(this.numberField=i.NumberField({placeholder:""}),yield this.numberField.render(`#${t.cardNumberVerification.containerId}`))})}getInstrumentParams(){if(!this.executionPaymentData)return{};if(q(this.executionPaymentData)){const{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}=this.executionPaymentData;return{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}}if($(this.executionPaymentData)){const{instrumentId:t}=this.executionPaymentData;return{instrumentId:t}}return{}}getFieldTypeByEmittedField({emittedBy:t}){return{fieldType:this.mapFieldType(t)}}submitHostedForm(){return Et(this,void 0,void 0,function*(){const t=this.getCardFieldsOrThrow(),e=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),n={billingAddress:{company:e.company,addressLine1:e.address1,addressLine2:e.address2,adminArea1:e.stateOrProvinceCode,adminArea2:e.city,postalCode:e.postalCode,countryCode:e.countryCode}};try{this.isCreditCardVaultedForm?yield t.submit():yield t.submit(n)}catch(t){throw new Pt("Failed authentication. Please try to authorize again.")}})}validateHostedFormOrThrow(){var t,e;return Et(this,void 0,void 0,function*(){const n=this.getCardFieldsOrThrow(),r=yield n.getState().then(t=>t),i=this.getValidityData(r);if(!i.isValid)throw null===(e=null===(t=this.hostedFormOptions)||void 0===t?void 0:t.onValidate)||void 0===e||e.call(t,i),new kt(this.mapValidationErrors(i.errors))})}getValidityData({fields:t}){const e=Object.assign({},t);delete e.cardNameField;const n=Object.keys(e);return{isValid:n.every(t=>{var n;return null===(n=e[t])||void 0===n?void 0:n.isValid}),errors:n.reduce((t,n)=>{var r;const i=this.mapFieldType(n);return Object.assign(Object.assign({},t),{[i]:(null===(r=e[n])||void 0===r?void 0:r.isValid)?void 0:[this.getInvalidErrorByFieldType(i)]})},{})}}getInvalidErrorByFieldType(t){switch(t){case _t.CardCode:case _t.CardCodeVerification:return{fieldType:t,message:"Invalid card code",type:"invalid_card_code"};case _t.CardNumber:case _t.CardNumberVerification:return{fieldType:t,message:"Invalid card number",type:"invalid_card_number"};case _t.CardExpiry:case _t.CardExpiryVerification:return{fieldType:t,message:"Invalid card expiry",type:"invalid_card_expiry"};default:return{fieldType:t,message:"Invalid field",type:"invalid"}}}mapValidationErrors(t={}){const e={};return Object.keys(t).forEach(n=>{var r,i;e[n]=[{message:(null===(i=null===(r=t[n])||void 0===r?void 0:r[0])||void 0===i?void 0:i.message)||"",type:n}]}),e}mapFieldType(t){switch(t){case"name":return _t.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?_t.CardNumber:_t.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?_t.CardExpiry:_t.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?_t.CardCode:_t.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new At(Ot.PaymentNotInitialized);return this.cardFields}getInputStyles(t){var e,n,r;const i={"font-size":(null===(e=null==t?void 0:t.default)||void 0===e?void 0:e.fontSize)||"1rem","font-family":(null===(n=null==t?void 0:t.default)||void 0===n?void 0:n.fontFamily)||"Montserrat, Arial, Helvetica, sans-serif","font-weight":(null===(r=null==t?void 0:t.default)||void 0===r?void 0:r.fontWeight)||"400",outline:"none",padding:"9px 13px"},o=Object.assign(Object.assign({},i),{color:"#333333"});return{input:o,".invalid":Object.assign(Object.assign({},i),{color:"red"}),".valid":o,":focus":o}}stylizeInputContainers(t){Object.values(t||{}).forEach(t=>{const e=document.getElementById(`${(null==t?void 0:t.containerId)||""}`);e&&(e.style.padding="0px",e.style.boxShadow="none",e.style.border="none",e.style.background="transparent",e.style.marginBottom="10px",e.style.marginLeft="-5px")})}hasUndefinedValues(){return!this.hostedFormOptions||Object.values(this.hostedFormOptions.fields).some(t=>void 0===t)}onChangeHandler(t,e){var n;null===(n=null==t?void 0:t.onValidate)||void 0===n||n.call(t,this.getValidityData(e))}onFocusHandler(t,e){var n;null===(n=null==t?void 0:t.onFocus)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}onBlurHandler(t,e){var n;null===(n=null==t?void 0:t.onBlur)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}onInputSubmitRequest(t,e){var n;null===(n=null==t?void 0:t.onEnter)||void 0===n||n.call(t,this.getFieldTypeByEmittedField(e))}shouldInitializePayPalFastlane(t){var e,n;const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(t),o=r.getPaymentProviderCustomer(),a=(s=o)&&("authenticationState"in s||"addresses"in s||"instruments"in s)?o:{};var s;return(null===(e=null==i?void 0:i.initializationData)||void 0===e?void 0:e.isAcceleratedCheckoutEnabled)&&(null===(n=null==i?void 0:i.initializationData)||void 0===n?void 0:n.isPayPalCommerceAnalyticsV2Enabled)&&!(null==a?void 0:a.authenticationState)}initializePayPalFastlaneOrThrow(t){return Et(this,void 0,void 0,function*(){try{const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow(),r=e.getPaymentMethodOrThrow(t),{initializationData:i}=r;if(!(null==i?void 0:i.connectClientToken))return;const o=yield this.paypalCommerceSdk.getPayPalFastlaneSdk(r,n.currency.code,n.id);yield this.paypalCommerceFastlaneUtils.initializePayPalFastlane(o,!!(null==i?void 0:i.isDeveloperModeApplicable))}catch(t){}})}}const xt=i(t=>new jt(t,M(t),J(),St()),[{id:"paypalcommercecreditcards"}]);var Tt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class zt{constructor(t,e,n,r=3e3,i=3e5){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=y.noop}initialize(t){return Tt(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,paypalcommerceratepay:r}=t;if(!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new N('Unable to initialize payment because "options.paypalcommerceratepay" argument is not provided.');const{legalTextContainer:i,container:o,loadingContainerId:a}=r;if(!o)throw new N('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new N('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new N('Unable to initialize payment because "options.loadingContainerId" argument is not provided.');this.loadingIndicatorContainer=a;const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(n,e),{merchantId:u}=s.initializationData||{};if(!u)throw new N("Unable to initialize payment because merchantId argument is not provided.");this.paypalcommerceratepay=r,yield this.paypalCommerceIntegrationService.loadPayPalSdk(n),this.createFraudNetScript(u,n,e),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(t,e){return Tt(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]),{getFieldsValues:i}=this.paypalcommerceratepay||{};if(!n)throw new R(["payment"]);if(!i||"function"!=typeof i)throw new N('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const t=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout",{metadataId:this.guid}),{ratepayBirthDate:o,ratepayPhoneNumber:a,ratepayPhoneCountryCode:s}=i(),u={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:n.methodId,rate_pay:{birth_date:this.normalizeDate(o),phone:{national_number:a,country_code:s.split("+")[1]}},paypal_account:{order_id:t}}};return yield this.paymentIntegrationService.submitOrder(r,e),yield this.paymentIntegrationService.submitPayment({methodId:n.methodId,paymentData:u}),yield new Promise((t,e)=>{this.initializePollingMechanism(n.methodId,t,e,n.gatewayId)})}catch(t){return this.handleError(t),new Promise((t,e)=>e())}})}finalize(){return Promise.reject(new V)}deinitialize(){const{legalTextContainer:t}=this.paypalcommerceratepay||{},e=document.querySelectorAll('[data-id="fraudnetScript"]')[0],n=document.querySelectorAll('[data-id="fraudnetConfig"]')[0];if(this.deinitializePollingMechanism(),e.remove(),n.remove(),t){const e=document.getElementById(t);null==e||e.remove()}return Promise.resolve()}normalizeDate(t){const e=this.formatDate(t.getDate()),n=this.formatDate(t.getMonth()+1);return`${t.getFullYear()}-${n}-${e}`}formatDate(t){return`${t<10?0:""}${t}`}renderLegalText(t,e){const n=t,r=e.split("#")[1],i=document.getElementById(r),o=null==i?void 0:i.parentNode,a=document.createElement("div");a.style.marginBottom="20px",a.setAttribute("id",n),null==o||o.prepend(a);const s=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),u=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new N('Unable to initialize payment because "legalTextContainerElement" argument is not found.');u.render(`#${n}`)}handleError(t){const{onError:e}=this.paypalcommerceratepay||{};this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}createFraudNetScript(t,e,n){const r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e,n),{testMode:i}=r.config,o=document.createElement("script");o.setAttribute("type","application/json"),o.setAttribute("fncls","fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99"),o.setAttribute("data-id","fraudnetScript"),this.guid=this.generateGUID();const a={f:this.guid,s:`${t}_checkout-page`,sandbox:i};o.innerHTML=JSON.stringify(a),document.body.appendChild(o)}generateGUID(){let t="";for(let e=0;e<32;e+=1)t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(62*Math.random())];return t}loadFraudnetConfig(){const t=document.createElement("script");t.setAttribute("data-id","fraudnetConfig"),t.src="https://c.paypal.com/da/r/fb.js",document.body.appendChild(t)}reinitializeStrategy(t){return Tt(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}initializePollingMechanism(t,e,n,r){return Tt(this,void 0,void 0,function*(){yield new Promise((t,e)=>{const n=setTimeout(t,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),e())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.paypalCommerceIntegrationService.getOrderStatus("paypalcommercealternativemethods",{params:{useMetadata:!0}}),o=i===O.PollingStop,a=i===O.PollingError;if(o)return this.deinitializePollingMechanism(),e();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(t,e,n,r);yield this.reinitializeStrategy({methodId:t,gatewayId:r,paypalcommerceratepay:this.paypalcommerceratepay}),this.handleError(new it)}catch(t){this.handleError(t),n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const Ft=i(t=>new zt(t,M(t),new p({containerStyles:Object.assign(Object.assign({},U),{position:"fixed"})})),[{gateway:"paypalcommercealternativemethods",id:"ratepay"}]);function Bt(t){return"string"!=typeof t}function Dt(t,e){if(e||t)return function(t){var e,n;const r={},i=(0,y.omitBy)(t.root,Bt),o=(0,y.omitBy)(t.input,Bt),a=(0,y.omitBy)(t.toggle,Bt),s=(0,y.omitBy)(null===(e=t.text)||void 0===e?void 0:e.body,Bt),u=(0,y.omitBy)(null===(n=t.text)||void 0===n?void 0:n.caption,Bt),c=t.branding;return Object.keys(i).length&&(r.root=i),Object.keys(o).length&&(r.input=o),Object.keys(a).length&&(r.toggle=a),Object.keys(s).length&&(r.text={},r.text.body=s),Object.keys(u).length&&(r.text=Object.assign({},r.text),r.text.caption=u),c&&(r.branding=c),r}(function(t,e){var n,r,i,o,a,s,u,c,l,d,p,h,f,y,m,v,g,b,w,S,_,I;return{root:{backgroundColorPrimary:(null==t?void 0:t.fastlaneRootSettingsBackgroundColor)||(null===(n=null==e?void 0:e.root)||void 0===n?void 0:n.backgroundColorPrimary),errorColor:(null==t?void 0:t.fastlaneRootSettingsErrorColor)||(null===(r=null==e?void 0:e.root)||void 0===r?void 0:r.errorColor),fontFamily:(null==t?void 0:t.fastlaneRootSettingsFontFamily)||(null===(i=null==e?void 0:e.root)||void 0===i?void 0:i.fontFamily),fontSizeBase:(null==t?void 0:t.fastlaneRootSettingsFontSize)||(null===(o=null==e?void 0:e.root)||void 0===o?void 0:o.fontSizeBase),padding:(null==t?void 0:t.fastlaneRootSettingsPadding)||(null===(a=null==e?void 0:e.root)||void 0===a?void 0:a.padding),primaryColor:(null==t?void 0:t.fastlaneRootSettingsPrimaryColor)||(null===(s=null==e?void 0:e.root)||void 0===s?void 0:s.primaryColor)},input:{borderRadius:(null==t?void 0:t.fastlaneInputSettingsBorderRadius)||(null===(u=null==e?void 0:e.input)||void 0===u?void 0:u.borderRadius),borderColor:(null==t?void 0:t.fastlaneInputSettingsBorderColor)||(null===(c=null==e?void 0:e.input)||void 0===c?void 0:c.borderColor),focusBorderColor:(null==t?void 0:t.fastlaneInputSettingsFocusBorderBase)||(null===(l=null==e?void 0:e.input)||void 0===l?void 0:l.focusBorderColor),backgroundColor:(null==t?void 0:t.fastlaneInputSettingsBackgroundColor)||(null===(d=null==e?void 0:e.input)||void 0===d?void 0:d.backgroundColor),borderWidth:(null==t?void 0:t.fastlaneInputSettingsBorderWidth)||(null===(p=null==e?void 0:e.input)||void 0===p?void 0:p.borderWidth),textColorBase:(null==t?void 0:t.fastlaneInputSettingsTextColorBase)||(null===(h=null==e?void 0:e.input)||void 0===h?void 0:h.textColorBase)},toggle:{colorPrimary:(null==t?void 0:t.fastlaneToggleSettingsColorPrimary)||(null===(f=null==e?void 0:e.toggle)||void 0===f?void 0:f.colorPrimary),colorSecondary:(null==t?void 0:t.fastlaneToggleSettingsColorSecondary)||(null===(y=null==e?void 0:e.toggle)||void 0===y?void 0:y.colorSecondary)},text:{body:{color:(null==t?void 0:t.fastlaneTextBodySettingsColor)||(null===(v=null===(m=null==e?void 0:e.text)||void 0===m?void 0:m.body)||void 0===v?void 0:v.color),fontSize:(null==t?void 0:t.fastlaneTextBodySettingsFontSize)||(null===(b=null===(g=null==e?void 0:e.text)||void 0===g?void 0:g.body)||void 0===b?void 0:b.fontSize)},caption:{color:(null==t?void 0:t.fastlaneTextCaptionSettingsColor)||(null===(S=null===(w=null==e?void 0:e.text)||void 0===w?void 0:w.caption)||void 0===S?void 0:S.color),fontSize:(null==t?void 0:t.fastlaneTextCaptionSettingsFontSize)||(null===(I=null===(_=null==e?void 0:e.text)||void 0===_?void 0:_.caption)||void 0===I?void 0:I.fontSize)}},branding:(null==t?void 0:t.fastlaneBrandingSettings)||(null==e?void 0:e.branding)}}(t,e))}function Mt(t){return!!t&&("authenticationState"in t||"addresses"in t||"instruments"in t)}var Ut=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Nt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.paypalCommerceRequestSender=e,this.paypalCommerceSdk=n,this.paypalCommerceFastlaneUtils=r}initialize(t){var e,n;return Ut(this,void 0,void 0,function*(){const{methodId:r,paypalcommercefastlane:i}=t;if(this.methodId=r,this.paypalcommercefastlane=i,!r)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new N('Unable to initialize payment because "options.paypalcommercefastlane" argument is not provided.');if(!i.onInit||"function"!=typeof i.onInit)throw new N('Unable to initialize payment because "options.paypalcommercefastlane.onInit" argument is not provided or it is not a function.');if(!i.onChange||"function"!=typeof i.onChange)throw new N('Unable to initialize payment because "options.paypalcommercefastlane.onChange" argument is not provided or it is not a function.');yield this.paymentIntegrationService.loadPaymentMethod(r);const o=this.paymentIntegrationService.getState(),a=o.getCartOrThrow(),s=o.getPaymentMethodOrThrow(r),{isDeveloperModeApplicable:u,isFastlaneStylingEnabled:c}=s.initializationData||{};this.threeDSVerificationMethod=null===(e=s.initializationData)||void 0===e?void 0:e.threeDSVerificationMethod,this.paypalFastlaneSdk=yield this.paypalCommerceSdk.getPayPalFastlaneSdk(s,a.currency.code,a.id);const l=Dt(c?null===(n=null==s?void 0:s.initializationData)||void 0===n?void 0:n.fastlaneStyles:{},null==i?void 0:i.styles);yield this.paypalCommerceFastlaneUtils.initializePayPalFastlane(this.paypalFastlaneSdk,!!u,l),this.shouldRunAuthenticationFlow()&&(yield this.runPayPalAuthenticationFlowOrThrow(r)),yield this.initializePayPalPaymentComponent(),i.onInit(t=>this.renderPayPalPaymentComponent(t)),i.onChange(()=>this.handlePayPalStoredInstrumentChange(r))})}execute(t,e){return Ut(this,void 0,void 0,function*(){const{payment:n}=t,r=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 i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(t,["payment"]);if(!n)throw new R(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&$(i);try{yield this.paymentIntegrationService.submitOrder(r,e);const t=a?yield this.prepareVaultedInstrumentPaymentPayload(o,i):yield this.preparePaymentPayload(o,i);yield this.paymentIntegrationService.submitPayment(t),this.paypalCommerceFastlaneUtils.removeStorageSessionId()}catch(t){if(function(t){return"object"==typeof t&&null!==t&&"message"in t&&"response"in t&&"body"in t.response&&"name"in t.response.body}(t)&&"INVALID_REQUEST"===t.response.body.name){const t={translationKey:"payment.errors.invalid_request_error"};return this.handleError(t),Promise.reject()}if(t instanceof Error&&"FastlaneError"!==t.name)throw t;return Promise.reject()}})}finalize(){return Promise.reject(new V)}deinitialize(){return Ut(this,void 0,void 0,function*(){return Promise.resolve()})}shouldRunAuthenticationFlow(){const t=this.paymentIntegrationService.getState(),e=t.getCartOrThrow(),n=t.getCustomerOrThrow(),r=t.getPaymentProviderCustomer(),i=Mt(r)?r:{},o=this.paypalCommerceFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===mt.CANCELED||(null==i?void 0:i.authenticationState)||o!==e.id)}runPayPalAuthenticationFlowOrThrow(t){return Ut(this,void 0,void 0,function*(){try{const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow(),r=e.getCustomer(),i=e.getBillingAddress(),o=(null==r?void 0:r.email)||(null==i?void 0:i.email)||"",{customerContextId:a}=yield this.paypalCommerceFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalCommerceFastlaneUtils.triggerAuthenticationFlowOrThrow(a),{authenticationState:u,addresses:c,instruments:l}=this.paypalCommerceFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:u,addresses:c,instruments:l}),s.authenticationState===mt.CANCELED?this.paypalCommerceFastlaneUtils.removeStorageSessionId():this.paypalCommerceFastlaneUtils.updateStorageSessionId(n.id)}catch(t){}})}initializePayPalPaymentComponent(){return Ut(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),e=t.phone,n=`${t.firstName} ${t.lastName}`.trim(),r=this.paypalCommerceFastlaneUtils.getPayPalFastlaneOrThrow(),i={fields:Object.assign({cardholderName:{prefill:n,enabled:!0}},e&&{phoneNumber:{prefill:e}})};this.paypalComponentMethods=yield r.FastlaneCardComponent(i)})}renderPayPalPaymentComponent(t){const e=this.getPayPalComponentMethodsOrThrow();if(!t)throw new N('Unable to render card component because "container" argument is not provided.');e.render(t)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new a;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(t,e){return Ut(this,void 0,void 0,function*(){const{instrumentId:n}=e,r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),i=this.isPaypalCommerceFastlaneThreeDSAvailable()&&r.config.is3dsEnabled;i||(yield this.createOrder(n));const o=i?yield this.get3DSNonce(n):n;return{methodId:t,paymentData:{formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:o}}}}})}preparePaymentPayload(t,e){return Ut(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getBillingAddressOrThrow(),i=n.getPaymentMethodOrThrow(t),o=`${r.firstName} ${r.lastName}`.trim(),{getPaymentToken:a}=this.getPayPalComponentMethodsOrThrow(),{id:s}=yield a({name:{fullName:o},billingAddress:this.paypalCommerceFastlaneUtils.mapBcToPayPalAddress(r)}),u=this.isPaypalCommerceFastlaneThreeDSAvailable()&&i.config.is3dsEnabled;u||(yield this.createOrder(s));const c=u?yield this.get3DSNonce(s):s,{shouldSaveInstrument:l=!1,shouldSetAsDefaultInstrument:d=!1}=q(e)?e:{};return{methodId:t,paymentData:Object.assign(Object.assign({},e),{shouldSaveInstrument:l,shouldSetAsDefaultInstrument:d,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:c}}})}})}createOrder(t){return Ut(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState().getCartOrThrow().id;if(this.methodId){const{orderId:n}=yield this.paypalCommerceRequestSender.createOrder(this.methodId,{cartId:e,fastlaneToken:t});this.orderId=n}})}get3DSNonce(t){var e;return Ut(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),o=n.getStoreConfigOrThrow().links.checkoutLink,s=null===(e=this.paypalFastlaneSdk)||void 0===e?void 0:e.ThreeDomainSecureClient;if(!s)throw new a;const u={amount:i.orderAmount.toFixed(2),currency:r.currency.code,nonce:t,threeDSRequested:"SCA_ALWAYS"===this.threeDSVerificationMethod,transactionContext:{experience_context:{locale:"en-US",return_url:o,cancel_url:o}}};if(yield s.isEligible(u)){const{liabilityShift:t,authenticationState:e,nonce:n}=yield s.show();if(t===w.No||t===w.Unknown||e===dt.Errored||e===dt.Cancelled)throw new L;if(e===dt.Succeeded)return yield this.createOrder(n),n}return t})}handlePayPalStoredInstrumentChange(t){return Ut(this,void 0,void 0,function*(){const e=this.paypalCommerceFastlaneUtils.getPayPalFastlaneOrThrow(),{selectionChanged:n,selectedCard:r}=yield e.profile.showCardSelector();if(n){const e=this.paymentIntegrationService.getState().getPaymentProviderCustomer(),n=Mt(e)?e:{},i=this.paypalCommerceFastlaneUtils.mapPayPalToBcInstrument(t,r)[0];return yield this.paymentIntegrationService.updatePaymentProviderCustomer(Object.assign(Object.assign({},n),{instruments:[i]})),i}})}isPaypalCommerceFastlaneThreeDSAvailable(){return ot(this.paymentIntegrationService.getState().getStoreConfigOrThrow().checkoutSettings.features,"PROJECT-7080.paypalcommerce_fastlane_three_ds")}handleError(t){var e;(null===(e=this.paypalcommercefastlane)||void 0===e?void 0:e.onError)&&"function"==typeof this.paypalcommercefastlane.onError&&this.paypalcommercefastlane.onError(t)}}const Rt=i(t=>{const{getHost:e}=t.getState();return new Nt(t,new F((0,f.createRequestSender)({host:e()})),J(),St())},[{id:"paypalcommerceacceleratedcheckout"}]);var Lt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Vt{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.onError=y.noop}initialize(t){return Lt(this,void 0,void 0,function*(){const{paypalcommerce:e,methodId:n}=t;if(!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(!e.container)throw new N('Unable to initialize payment because "options.paypalcommerce.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new N('Unable to initialize payment because "options.paypalcommerce.onClick" argument is not a function.');this.onError=e.onError||y.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return Lt(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signInCustomer(t,e),Promise.resolve()})}signOut(t){return Lt(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signOutCustomer(t),Promise.resolve()})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){var n,r;const{container:i,onClick:o,onComplete:a}=e,s=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:c,paymentButtonStyles:l,isAppSwitchEnabled:d}=u.initializationData||{},{checkoutTopButtonStyles:p}=l||{},h=Object.assign(Object.assign(Object.assign({},this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommerce"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)}),o&&{onClick:()=>o()}),f=Object.assign(Object.assign({},!d&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,a)}),y=Object.assign(Object.assign({fundingSource:s.FUNDING.PAYPAL,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},p),{height:36}))},h),c&&f),m=s.Buttons(y);m.isEligible()?(null===(n=m.hasReturned)||void 0===n?void 0:n.call(m))&&this.isPaypalCommerceAppSwitchEnabled(t)?null===(r=m.resume)||void 0===r||r.call(m):m.render(`#${i}`):this.paypalCommerceIntegrationService.removeElement(i)}onHostedCheckoutApprove(e,n,r,i){return Lt(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),o.lineItems.physicalItems.length>0){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalCommerceIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return Lt(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}onShippingOptionsChange(t){return Lt(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}}const qt=i(t=>new Vt(t,M(t)),[{id:"paypalcommerce"}]);var $t=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Wt{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.onError=y.noop}initialize(t){return $t(this,void 0,void 0,function*(){const{paypalcommercecredit:e,methodId:n}=t;if(!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(!e.container)throw new N('Unable to initialize payment because "options.paypalcommercecredit.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new N('Unable to initialize payment because "options.paypalcommercecredit.onClick" argument is not a function.');this.onError=e.onError||y.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return $t(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return $t(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){const{container:n,onComplete:r,onClick:i}=e,o=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:s,paymentButtonStyles:u,isAppSwitchEnabled:c}=a.initializationData||{},{checkoutTopButtonStyles:l}=u||{},d=Object.assign({createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},i&&{onClick:()=>i()}),p=Object.assign(Object.assign({},!c&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,r)}),h=[o.FUNDING.PAYLATER,o.FUNDING.CREDIT];let f=!1;h.forEach(t=>{if(!f){const e=Object.assign(Object.assign({fundingSource:t,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},l),{height:36}))},d),s&&p),r=o.Buttons(e);r.isEligible()&&(r.render(`#${n}`),f=!0)}}),f||this.paypalCommerceIntegrationService.removeElement(n)}onHostedCheckoutApprove(e,n,r,i){return $t(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),o.lineItems.physicalItems.length>0){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalCommerceIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return $t(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}onShippingOptionsChange(t){return $t(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}}const Ht=i(t=>new Wt(t,M(t)),[{id:"paypalcommercecredit"}]);var Gt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Yt{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return Gt(this,void 0,void 0,function*(){const{paypalcommercevenmo:e,methodId:n}=t;if(!n)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(!e.container)throw new N('Unable to initialize payment because "options.paypalcommercevenmo.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new N('Unable to initialize payment because "options.paypalcommercevenmo.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(t,e){return Gt(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return Gt(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){var e;return null===(e=null==t?void 0:t.continueWithCheckoutCallback)||void 0===e||e.call(t),Promise.resolve()}renderButton(t,e){const{container:n,onClick:r}=e,i=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:a}=o.initializationData||{},{checkoutTopButtonStyles:s}=a||{},u=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},s),{height:36})),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},r&&{onClick:()=>r()}),c=i.Buttons(u);c.isEligible()?c.render(`#${n}`):this.paypalCommerceIntegrationService.removeElement(n)}}const Kt=i(t=>new Yt(t,M(t)),[{id:"paypalcommercevenmo"}]);var Jt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class Zt{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalCommerceSdk=e,this.paypalCommerceFastlaneUtils=n}initialize(t){var e;return Jt(this,void 0,void 0,function*(){const{methodId:n,paypalcommercefastlane:r}=t;if(!n)throw new N('Unable to proceed because "methodId" argument is not provided.');try{yield this.paymentIntegrationService.loadPaymentMethod(n);const t=this.paymentIntegrationService.getState(),i=t.getCartOrThrow(),o=t.getPaymentMethodOrThrow(n),a=!!(null===(e=o.initializationData)||void 0===e?void 0:e.isDeveloperModeApplicable),s=yield this.paypalCommerceSdk.getPayPalFastlaneSdk(o,i.currency.code,i.id);yield this.paypalCommerceFastlaneUtils.initializePayPalFastlane(s,a,this.getFastlaneStyles(n,r))}catch(t){}return Promise.resolve()})}deinitialize(){return Jt(this,void 0,void 0,function*(){return Promise.resolve()})}signIn(t,e){return Jt(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(t,e)})}signOut(t){return Jt(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(t)})}executePaymentMethodCheckout(t){return Jt(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:e,continueWithCheckoutCallback:n,methodId:r}=t||{};if(!r)throw new N('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new N('Unable to proceed because "continueWithCheckoutCallback" argument is not provided and it must be a function.');if(this.paymentIntegrationService.getState().getCustomerOrThrow().isGuest){e&&"function"==typeof e&&e();try{yield this.runPayPalAuthenticationFlowOrThrow(r)}catch(t){}}n()})}runPayPalAuthenticationFlowOrThrow(t){return Jt(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState(),n=e.getCartOrThrow().id,r=e.getCustomer(),i=e.getBillingAddress(),o=(null==r?void 0:r.email)||(null==i?void 0:i.email)||"",{customerContextId:a}=yield this.paypalCommerceFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalCommerceFastlaneUtils.triggerAuthenticationFlowOrThrow(a),u=s.authenticationState===mt.CANCELED;yield this.updateCustomerDataState(t,s),u?this.paypalCommerceFastlaneUtils.removeStorageSessionId():this.paypalCommerceFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(t,e){var n;return Jt(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:u}=this.paypalCommerceFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,e);if(yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:i,addresses:o,instruments:u}),a&&(yield this.paymentIntegrationService.updateBillingAddress(a)),s&&r.lineItems.physicalItems.length>0){const e=yield this.paymentIntegrationService.updateShippingAddress(s),r=e.getPaymentMethodOrThrow(t),{isFastlaneShippingOptionAutoSelectEnabled:i}=r.initializationData||{},o=e.getConsignments()||[],a=(null===(n=o[0])||void 0===n?void 0:n.availableShippingOptions)||[],u=a[0],c=a.find(t=>t.isRecommended);if((c||u)&&i){const t=(null==c?void 0:c.id)||u.id;yield this.paymentIntegrationService.selectShippingOption(t)}}})}getFastlaneStyles(t,e){const n=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{fastlaneStyles:r,isFastlaneStylingEnabled:i}=n.initializationData||{};return Dt(i?r:{},null==e?void 0:e.styles)}}const Xt=i(t=>new Zt(t,J(),St()),[{id:"paypalcommerceacceleratedcheckout"},{id:"paypalcommercecreditcards"}]);var Qt=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class te{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){var e;return Qt(this,void 0,void 0,function*(){const{paypalcommerce:n,containerId:r,methodId:i}=t,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new N('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new N('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(o&&!n.currencyCode)throw new N('Unable to initialize payment because "options.paypalcommerce.currencyCode" argument is not provided.');if(o&&"function"!=typeof(null===(e=n.buyNowInitializeOptions)||void 0===e?void 0:e.getBuyNowCartRequestBody))throw new N('Unable to initialize payment because "options.paypalcommerce.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');o||(yield this.paymentIntegrationService.loadDefaultCheckout());const a=o?n.currencyCode:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(i,a,!1),this.renderButton(r,i,n,o)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n,r){var i,o;const{buyNowInitializeOptions:a,style:s,onComplete:u,onEligibilityFailure:c}=n,l=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),d=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:p,isAppSwitchEnabled:h}=d.initializationData||{},f=Object.assign(Object.assign({},!r&&this.isPaypalCommerceAppSwitchEnabled(e)&&{appSwitchWhenAvailable:!0}),{createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommerce"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)}),y={onClick:()=>this.handleClick(a),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},m=Object.assign(Object.assign({},!h&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,u)}),v=Object.assign(Object.assign(Object.assign({fundingSource:l.FUNDING.PAYPAL,style:this.paypalCommerceIntegrationService.getValidButtonStyle(s)},f),a&&y),p&&m),g=l.Buttons(v);g.isEligible()?(null===(i=g.hasReturned)||void 0===i?void 0:i.call(g))&&this.isPaypalCommerceAppSwitchEnabled(e)?null===(o=g.resume)||void 0===o||o.call(g):g.render(`#${t}`):c&&"function"==typeof c?c():this.paypalCommerceIntegrationService.removeElement(t)}handleClick(t){return Qt(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(e,n,r,i){return Qt(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),o.lineItems.physicalItems.length>0){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalCommerceIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t){return Qt(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingOptionsChange(t){return Qt(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}isPaypalCommerceAppSwitchEnabled(t){var e;return(null===(e=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t).initializationData)||void 0===e?void 0:e.isAppSwitchEnabled)||!1}}const ee=i(t=>new te(t,M(t)),[{id:"paypalcommerce"}]);var ne=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class re{constructor(t,e,n){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e,this.paypalCommerceSdk=n}initialize(t){var e;return ne(this,void 0,void 0,function*(){const{paypalcommercecredit:n,containerId:r,methodId:i}=t,{buyNowInitializeOptions:o,currencyCode:a,messagingContainerId:s}=n||{},u=!!o;if(!i)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new N('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new N('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(u&&!a)throw new N('Unable to initialize payment because "options.paypalcommercecredit.currencyCode" argument is not provided.');if(u&&"function"!=typeof(null==o?void 0:o.getBuyNowCartRequestBody))throw new N('Unable to initialize payment because "options.paypalcommercecredit.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');u||(yield this.paymentIntegrationService.loadDefaultCheckout());const c=this.paymentIntegrationService.getState(),l=u?a:c.getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(i,l,!1),this.renderButton(r,i,n);const d=c.getStoreConfigOrThrow().checkoutSettings.features;if(null!==(e=d["PAYPAL-5557.Hide_ppc_banner_implementation"])&&void 0!==e&&e)return;const p=s&&document.getElementById(s);if(l&&p){const t=c.getPaymentMethodOrThrow(i),{paypalBNPLConfiguration:e=[]}=t.initializationData||{},n=e&&e.find(({id:t})=>"cart"===t);if(!(null==n?void 0:n.status))return;p.removeAttribute("data-pp-style-logo-type"),p.removeAttribute("data-pp-style-logo-position"),p.removeAttribute("data-pp-style-text-color"),p.removeAttribute("data-pp-style-text-size");const r=yield this.paypalCommerceSdk.getPayPalMessages(t,l);this.renderMessages(r,s,n)}})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:c,isAppSwitchEnabled:l}=u.initializationData||{},d={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},p={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h=Object.assign(Object.assign({},!l&&{onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,o)}),f=[s.FUNDING.PAYLATER,s.FUNDING.CREDIT];let y=!1;f.forEach(e=>{if(!y){const n=Object.assign(Object.assign(Object.assign({fundingSource:e,style:this.paypalCommerceIntegrationService.getValidButtonStyle(i)},d),r&&p),c&&h),o=s.Buttons(n);o.isEligible()?(o.render(`#${t}`),y=!0):a&&"function"==typeof a&&a()}}),y||this.paypalCommerceIntegrationService.removeElement(t)}handleClick(t){return ne(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(e,n,r,i){return ne(this,void 0,void 0,function*(){if(!e.orderID)throw new s(t.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),a=yield n.order.get();try{const t=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(a);if(yield this.paymentIntegrationService.updateBillingAddress(t),o.lineItems.physicalItems.length>0){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(a);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.paypalCommerceIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.paypalCommerceIntegrationService.submitPayment(r,e.orderID),i&&"function"==typeof i&&i(),!0}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingAddressChange(t){return ne(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getAddress({city:t.shippingAddress.city,countryCode:t.shippingAddress.countryCode,postalCode:t.shippingAddress.postalCode,stateOrProvinceCode:t.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(e),yield this.paymentIntegrationService.updateShippingAddress(e);const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}onShippingOptionsChange(t){return ne(this,void 0,void 0,function*(){const e=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}renderMessages(t,e,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"cart",style:W(n)};t.Messages(r).render(`#${e}`)}}const ie=i(t=>new re(t,M(t),J()),[{id:"paypalcommercecredit"}]);var oe=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ae{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return oe(this,void 0,void 0,function*(){const{paypalcommercevenmo:e,containerId:n,methodId:r}=t,{buyNowInitializeOptions:i,currencyCode:o}=e||{},a=!!i;if(!r)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new N('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(a&&!o)throw new N('Unable to initialize payment because "options.paypalcommercevenmo.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new N('Unable to initialize payment because "options.paypalcommercevenmo.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');a||(yield this.paymentIntegrationService.loadDefaultCheckout());const s=a?o:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(r,s,!1),this.renderButton(n,r,e)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onEligibilityFailure:o}=n,a=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),s=a.FUNDING.VENMO,u={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},c={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:s,style:this.getValidVenmoButtonStyles(i)},u),r&&c),d=a.Buttons(l);d.isEligible()?d.render(`#${t}`):o&&"function"==typeof o?o():this.paypalCommerceIntegrationService.removeElement(t)}getValidVenmoButtonStyles(t){const e=this.paypalCommerceIntegrationService.getValidButtonStyle(t);return e.color===I.gold?Object.assign(Object.assign({},e),{color:void 0}):e}handleClick(t){return oe(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const se=i(t=>new ae(t,M(t)),[{id:"paypalcommercevenmo"}]);var ue=function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((r=r.apply(t,e||[])).next())})};class ce{constructor(t,e){this.paymentIntegrationService=t,this.paypalCommerceIntegrationService=e}initialize(t){return ue(this,void 0,void 0,function*(){const{paypalcommercealternativemethods:e,containerId:n,methodId:r}=t,{apm:i,buyNowInitializeOptions:o,currencyCode:a}=e||{},s=!!o;if(!r)throw new N('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new N('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');if(!i)throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods.apm" argument is not provided.');if(s&&!a)throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods.currencyCode" argument is not provided.');if(s&&"function"!=typeof(null==o?void 0:o.getBuyNowCartRequestBody))throw new N('Unable to initialize payment because "options.paypalcommercealternativemethods.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');s||(yield this.paymentIntegrationService.loadDefaultCheckout());const u=s?a:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(r,u,!1),this.renderButton(n,r,e)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{apm:r,buyNowInitializeOptions:i,style:o,onEligibilityFailure:a}=n,s=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow();if(!Object.values(s.FUNDING).includes(r))throw new N('Unable to initialize PayPal button because "options.paypalcommercealternativemethods.apm" argument is not valid funding source.');const u={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethod"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},c={onClick:()=>this.handleClick(i),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:r,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o)},u),i&&c),d=s.Buttons(l);d.isEligible()?d.render(`#${t}`):a&&"function"==typeof a?a():this.paypalCommerceIntegrationService.removeElement(t)}handleClick(t){return ue(this,void 0,void 0,function*(){if(t){const e=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const le=i(t=>new ce(t,M(t)),[{id:"paypalcommercealternativemethods"}])})(),module.exports=r})();
|
|
3
3
|
//# sourceMappingURL=paypal-commerce.js.map
|