@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.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see bigcommerce-payments.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,h,p,f="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,m="object"==typeof self&&self&&self.Object===Object&&self,y=f||m||Function("return this")(),g=e&&!e.nodeType&&e,v=g&&t&&!t.nodeType&&t,b=v&&v.exports===g,_=b&&f.process,w=function(){try{return v&&v.require&&v.require("util").types||_&&_.binding&&_.binding("util")}catch(t){}}(),S=w&&w.isTypedArray,P=Array.prototype,I=Function.prototype,C=Object.prototype,O=y["__core-js_shared__"],A=I.toString,k=C.hasOwnProperty,E=(d=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+d:"",j=C.toString,x=A.call(Object),T=RegExp("^"+A.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z=b?y.Buffer:void 0,B=y.Symbol,F=y.Uint8Array,D=(z&&z.allocUnsafe,h=Object.getPrototypeOf,p=Object,function(t){return h(p(t))}),M=Object.create,U=C.propertyIsEnumerable,N=P.splice,R=B?B.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,H=st(y,"Map"),W=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&&!ht(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)&&ht(r,n)&&(void 0!==n||e in t)||et(t,e,n)}function tt(t,e){for(var n=t.length;n--;)if(ht(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__=W?W(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(W){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 W?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]=W&&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(H||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(!H||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 _t(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,h,p,f,m,y=o?o(u,c,n+"",t,e,a):void 0,g=void 0===y;if(g){var v=ft(c),b=!v&&yt(c),_=!v&&!b&&wt(c);y=c,v||b||_?ft(u)?y=u:_t(m=u)&&mt(m)?y=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(u):b?(g=!1,y=function(t){return t.slice()}(c)):_?(g=!1,f=new(p=(d=c).buffer).constructor(p.byteLength),new F(f).set(new F(p)),h=f,y=new d.constructor(h,d.byteOffset,d.length)):y=[]:function(t){if(!_t(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)||pt(c)?(y=u,pt(u)?y=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,St(t))}(u):bt(u)&&!gt(u)||(y=function(t){return"function"!=typeof t.constructor||ct(t)?{}:G(D(t))}(c))):g=!1}g&&(a.set(c,y),i(y,c,r,o,a),a.delete(c)),X(t,n,y)}}(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)}},St)}var ot=L?function(t,e){return L(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Ct;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))&&(gt(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||C)}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 ht(t,e){return t===e||t!=t&&e!=e}var pt=rt(function(){return arguments}())?rt:function(t){return _t(t)&&k.call(t,"callee")&&!U.call(t,"callee")},ft=Array.isArray;function mt(t){return null!=t&&vt(t.length)&&!gt(t)}var yt=V||function(){return!1};function gt(t){if(!bt(t))return!1;var e=nt(t);return e==a||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function vt(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 _t(t){return null!=t&&"object"==typeof t}var wt=S?function(t){return function(e){return t(e)}}(S):function(t){return _t(t)&&vt(t.length)&&!!l[nt(t)]};function St(t){return mt(t)?function(t,e){var n=ft(t),r=!n&&pt(t),i=!n&&!r&&yt(t),o=!n&&!r&&!i&&wt(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 Pt,It=(Pt=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,Ct),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=Pt.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?mt(n)&&ut(e,n.length):"string"==r&&e in n)&&ht(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&&Pt(t,a,n)}return t}));function Ct(t){return t}t.exports=It},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,h=4294967295,p=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],f="[object Arguments]",m="[object Array]",y="[object Boolean]",g="[object Date]",v="[object Error]",b="[object Function]",_="[object GeneratorFunction]",w="[object Map]",S="[object Number]",P="[object Object]",I="[object Promise]",C="[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]",B="[object Int8Array]",F="[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,H=/[&<>"']/g,W=RegExp($.source),G=RegExp(H.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*$/,ht=/^[-+]0x[0-9a-f]+$/i,pt=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,_t="\\ud800-\\udfff",wt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",St="\\u2700-\\u27bf",Pt="a-z\\xdf-\\xf6\\xf8-\\xff",It="A-Z\\xc0-\\xd6\\xd8-\\xde",Ct="\\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="["+_t+"]",kt="["+Ot+"]",Et="["+wt+"]",jt="\\d+",xt="["+St+"]",Tt="["+Pt+"]",zt="[^"+_t+Ot+jt+St+Pt+It+"]",Bt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+_t+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ut="["+It+"]",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+"|"+Bt+")?",Ht="["+Ct+"]?",Wt=Ht+$t+"(?:"+Nt+"(?:"+[Ft,Dt,Mt].join("|")+")"+Ht+$t+")*",Gt="(?:"+[xt,Dt,Mt].join("|")+")"+Wt,Yt="(?:"+[Ft+Et+"?",Et,Dt,Mt,At].join("|")+")",Kt=RegExp("['’]","g"),Jt=RegExp(Et,"g"),Zt=RegExp(Bt+"(?="+Bt+")|"+Yt+Wt,"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+_t+wt+Ct+"]"),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[B]=re[F]=re[D]=re[M]=re[U]=re[N]=re[R]=!0,re[f]=re[m]=re[j]=re[y]=re[x]=re[g]=re[v]=re[b]=re[w]=re[S]=re[P]=re[C]=re[O]=re[A]=re[E]=!1;var ie={};ie[f]=ie[m]=ie[j]=ie[x]=ie[y]=ie[g]=ie[T]=ie[z]=ie[B]=ie[F]=ie[D]=ie[w]=ie[S]=ie[P]=ie[C]=ie[O]=ie[A]=ie[k]=ie[M]=ie[U]=ie[N]=ie[R]=!0,ie[v]=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,he=de&&t&&!t.nodeType&&t,pe=he&&he.exports===de,fe=pe&&ue.process,me=function(){try{return he&&he.require&&he.require("util").types||fe&&fe.binding&&fe.binding("util")}catch(t){}}(),ye=me&&me.isArrayBuffer,ge=me&&me.isDate,ve=me&&me.isMap,be=me&&me.isRegExp,_e=me&&me.isSet,we=me&&me.isTypedArray;function Se(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 Pe(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 Ie(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Ce(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 Be(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 Fe=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?He(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 He(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 We(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({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});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):Fe(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 hn=qe({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),pn=function t(e){var n,rt=(e=null==e?le:pn.defaults(le.Object(),e,pn.pick(le,ee))).Array,_t=e.Date,wt=e.Error,St=e.Function,Pt=e.Math,It=e.Object,Ct=e.RegExp,Ot=e.String,At=e.TypeError,kt=rt.prototype,Et=St.prototype,jt=It.prototype,xt=e["__core-js_shared__"],Tt=Et.toString,zt=jt.hasOwnProperty,Bt=0,Ft=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Dt=jt.toString,Mt=Tt.call(It),Ut=le._,Nt=Ct("^"+Tt.call(zt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Rt=pe?e.Buffer:r,Lt=e.Symbol,Vt=e.Uint8Array,qt=Rt?Rt.allocUnsafe:r,$t=on(It.getPrototypeOf,It),Ht=It.create,Wt=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(It,"defineProperty");return t({},"",{}),t}catch(t){}}(),ue=e.clearTimeout!==le.clearTimeout&&e.clearTimeout,ce=_t&&_t.now!==le.Date.now&&_t.now,de=e.setTimeout!==le.setTimeout&&e.setTimeout,he=Pt.ceil,fe=Pt.floor,me=It.getOwnPropertySymbols,Fe=Rt?Rt.isBuffer:r,qe=e.isFinite,fn=kt.join,mn=on(It.keys,It),yn=Pt.max,gn=Pt.min,vn=_t.now,bn=e.parseInt,_n=Pt.random,wn=kt.reverse,Sn=uo(e,"DataView"),Pn=uo(e,"Map"),In=uo(e,"Promise"),Cn=uo(e,"Set"),On=uo(e,"WeakMap"),An=uo(It,"create"),kn=On&&new On,En={},jn=Mo(Sn),xn=Mo(Pn),Tn=Mo(In),zn=Mo(Cn),Bn=Mo(On),Fn=Lt?Lt.prototype:r,Dn=Fn?Fn.valueOf:r,Mn=Fn?Fn.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(Ht)return Ht(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__=h,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 Hn(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.__data__=new Hn;++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?We(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)||yo(c,u))||s.push(c);return s}function Kn(t){var e=t.length;return e?t[Hr(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:Cs(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 h=ho(t),p=h==b||h==_;if(Ga(t))return _i(t,u);if(h==P||h==f||p&&!o){if(s=c||p?{}: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[h])return o?t:{};s=function(t,e,n){var r,i=t.constructor;switch(e){case j:return wi(t);case y:case g:return new i(+t);case x:return function(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case T:case z:case B:case F:case D:case M:case U:case N:case R:return Si(t,n);case w:return new i;case S:case A:return new i(t);case C: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?It(Dn.call(r)):{}}}(t,h,u)}}a||(a=new Gn);var m=a.get(t);if(m)return m;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 v=d?r:(l?c?eo:to:c?xs:js)(t);return Ie(v||t,function(r,i){v&&(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=It(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 Wn(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 h=c;h--;)if(e[h]===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},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(Pn||$n),string:new qn}},Hn.prototype.delete=function(t){var e=ao(this,t).delete(t);return this.size-=e?1:0,e},Hn.prototype.get=function(t){return ao(this,t).get(t)},Hn.prototype.has=function(t){return ao(this,t).has(t)},Hn.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},Wn.prototype.add=Wn.prototype.push=function(t){return this.__data__.set(t,o),this},Wn.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(!Pn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(t,e),this.size=n.size,this};var lr=ji(vr),dr=ji(br,!0);function hr(t,e){var n=!0;return lr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function pr(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 mr(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=mo),i||(i=[]);++o<a;){var s=t[o];e>0&&n(s)?e>1?mr(s,e-1,n,r,i):xe(i,s):r||(i[i.length]=s)}return i}var yr=xi(),gr=xi(!0);function vr(t,e){return t&&yr(t,e,js)}function br(t,e){return t&&gr(t,e,js)}function _r(t,e){return Ae(e,function(e){return Ja(t[e])})}function wr(t,e){for(var n=0,i=(e=yi(e,t)).length;null!=t&&n<i;)t=t[Do(e[n++])];return n&&n==i?t:r}function Sr(t,e,n){var r=e(t);return qa(t)?r:xe(r,n(t))}function Pr(t){return null==t?t===r?"[object Undefined]":"[object Null]":Qt&&Qt in It(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 Ir(t,e){return t>e}function Cr(t,e){return null!=t&&zt.call(t,e)}function Or(t,e){return null!=t&&e in It(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=gn(d.length,c),u[s]=!n&&(e||o>=120&&d.length>=120)?new Wn(s&&d):r}d=t[0];var h=-1,p=u[0];t:for(;++h<o&&l.length<c;){var f=d[h],m=e?e(f):f;if(f=n||0!==f?f:0,!(p?Je(p,m):i(l,m,n))){for(s=a;--s;){var y=u[s];if(!(y?Je(y,m):i(t[s],m,n)))continue t}p&&p.push(m),l.push(f)}}return l}function kr(t,e,n){var i=null==(t=Co(t,e=yi(e,t)))?t:t[Do(Ko(e))];return null==i?r:Se(i,t,n)}function Er(t){return ts(t)&&Pr(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?m:ho(t),l=u?m:ho(e),d=(c=c==f?P:c)==P,h=(l=l==f?P:l)==P,p=c==l;if(p&&Ga(t)){if(!Ga(e))return!1;s=!0,d=!1}if(p&&!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 y:case g:case S:return Na(+t,+e);case v:return t.name==e.name&&t.message==e.message;case C:case A:return t==e+"";case w: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__"),_=h&&zt.call(e,"__wrapped__");if(b||_){var I=b?t.value():t,E=_?e.value():e;return a||(a=new Gn),o(I,E,n,i,a)}}return!!p&&(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 h=a.get(t),p=a.get(e);if(h&&p)return h==e&&p==t;var f=!0;a.set(t,e),a.set(e,t);for(var m=s;++l<c;){var y=t[d=u[l]],g=e[d];if(i)var v=s?i(g,y,d,e,t,a):i(y,g,d,t,e,a);if(!(v===r?y===g||o(y,g,n,i,a):v)){f=!1;break}m||(m="constructor"==d)}if(f&&!m){var b=t.constructor,_=e.constructor;b==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(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=It(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 h=new Gn;if(i)var p=i(l,d,c,t,e,h);if(!(p===r?jr(d,l,3,i,h):p))return!1}}return!0}function Tr(t){return!(!Qa(t)||(e=t,Ft&&Ft 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 Br(t){if(!wo(t))return mn(t);var e=[];for(var n in It(t))zt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Fr(t,e){return t<e}function Dr(t,e){var n=-1,r=Ha(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]?Po(e[0][0],e[0][1]):function(n){return n===t||xr(n,t,e)}}function Ur(t,e){return vo(t)&&So(e)?Po(Do(t),e):function(n){var i=Cs(n,t);return i===r&&i===e?Os(n,t):jr(e,i,3)}}function Nr(t,e,n,i,o){t!==e&&yr(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,h=d===r;if(h){var p=qa(c),f=!p&&Ga(c),m=!p&&!f&&us(c);d=c,p||f||m?qa(u)?d=u:Wa(u)?d=Oi(u):f?(h=!1,d=_i(c,!0)):m?(h=!1,d=Si(c,!0)):d=[]:rs(c)||Va(c)?(d=u,Va(u)?d=ys(u):Qa(u)&&!Ja(u)||(d=fo(c))):h=!1}h&&(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 yo(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 wr(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=Pi(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=wr(t,a);n(s,a)&&Jr(o,yi(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;yo(i)?Gt.call(t,i,1):ui(t,i)}}return t}function Hr(t,e){return t+fe(_n()*(e-t+1))}function Wr(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(Io(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=yi(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:yo(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),h=n(t[d]),p=h!==r,f=null===h,m=h==h,y=ss(h);if(s)var g=i||m;else g=l?m&&(i||p):u?m&&p&&(i||!f):c?m&&p&&!f&&(i||!y):!f&&!y&&(i?h<=e:h<e);g?o=d+1:a=d}return gn(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:Wi(t);if(c)return sn(c);a=!1,i=Je,u=new Wn}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 h=u.length;h--;)if(u[h]===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=Co(t,e=yi(e,t)))||delete t[Do(Ko(e))]}function ci(t,e,n,r){return Jr(t,e,n(wr(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 hi(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(mr(o,1),e,n)}function pi(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 Wa(t)?t:[]}function mi(t){return"function"==typeof t?t:nu}function yi(t,e){return qa(t)?t:vo(t,e)?[t]:Fo(gs(t))}var gi=Gr;function vi(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 _i(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 wi(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}function Si(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Pi(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 Ii(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,u=e.length,c=yn(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 Ci(t,e,n,r){for(var i=-1,o=t.length,a=-1,s=n.length,u=-1,c=e.length,l=yn(o-s,0),d=rt(l+c),h=!r;++i<l;)d[i]=t[i];for(var p=i;++u<c;)d[p+u]=e[u];for(;++a<s;)(h||i<o)&&(d[p+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)?Pe: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&&go(n[0],n[1],s)&&(a=o<3?r:a,o=1),e=It(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(!Ha(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=It(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=It(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=gs(e))?ln(e):r,i=n?n[0]:e.charAt(0),o=n?vi(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 Bi(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 Fi(t){return function(e,n,i){var o=It(e);if(!Ha(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 h=e&u,p=1&e,f=2&e,m=24&e,y=512&e,g=f?r:Bi(t);return function u(){for(var v=arguments.length,b=rt(v),_=v;_--;)b[_]=arguments[_];if(m)var w=io(u),S=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,w);if(i&&(b=Ii(b,i,o,m)),a&&(b=Ci(b,a,s,m)),v-=S,m&&v<d){var P=an(b,w);return $i(t,e,Mi,u.placeholder,n,b,P,c,l,d-v)}var I=p?n:this,C=f?I[t]:t;return v=b.length,c?b=function(t,e){for(var n=t.length,i=gn(e.length,n),o=Oi(t);i--;){var a=e[i];t[i]=yo(a,n)?o[a]:r}return t}(b,c):y&&v>1&&b.reverse(),h&&l<v&&(b.length=l),this&&this!==le&&this instanceof u&&(C=g||Bi(C)),C.apply(I,b)}}function Ui(t,e){return function(n,r){return function(t,e,n,r){return vr(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 Se(t,r,n)})})})}function Li(t,e){var n=(e=e===r?" ":ai(e)).length;if(n<2)return n?Wr(e,t):e;var i=Wr(e,he(t/cn(e)));return nn(e)?vi(ln(i),0,t).join(""):i.slice(0,t)}function Vi(t){return function(e,n,i){return i&&"number"!=typeof i&&go(e,n,i)&&(n=i=r),e=hs(e),n===r?(n=e,e=0):n=hs(n),function(t,e,n,r){for(var i=-1,o=yn(he((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:hs(i),t)}}function qi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ms(e),n=ms(n)),t(e,n)}}function $i(t,e,n,i,o,a,u,c,l,d){var h=8&e;e|=h?s:64,4&(e&=~(h?64:s))||(e&=-4);var p=[t,e,o,h?a:r,h?u:r,h?r:a,h?r:u,c,l,d],f=n.apply(r,p);return bo(t)&&Ao(f,p),f.placeholder=i,jo(f,t,e)}function Hi(t){var e=Pt[t];return function(t,n){if(t=ms(t),(n=null==n?0:gn(ps(n),292))&&qe(t)){var r=(gs(t)+"e").split("e");return+((r=(gs(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Wi=Cn&&1/sn(new Cn([,-0]))[1]==c?function(t){return new Cn(t)}:su;function Gi(t){return function(e){var n=ho(e);return n==w?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,h){var p=2&e;if(!p&&"function"!=typeof t)throw new At(i);var f=o?o.length:0;if(f||(e&=-97,o=c=r),d=d===r?d:yn(ps(d),0),h=h===r?h:ps(h),f-=c?c.length:0,64&e){var m=o,y=c;o=c=r}var g=p?r:no(t),v=[t,e,n,o,c,m,y,l,d,h];if(g&&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?Ii(l,c,e[4]):c,t[4]=l?an(t[3],a):e[4]}(c=e[5])&&(l=t[5],t[5]=l?Ci(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]:gn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(v,g),t=v[0],e=v[1],n=v[2],o=v[3],c=v[4],!(h=v[9]=v[9]===r?p?0:t.length:yn(v[9]-f,0))&&24&e&&(e&=-25),e&&1!=e)b=8==e||16==e?function(t,e,n){var i=Bi(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):Se(this&&this!==le&&this instanceof o?i:t,this,s)}}(t,e,h):e!=s&&33!=e||c.length?Mi.apply(r,v):function(t,e,n,r){var i=1&e,o=Bi(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 Se(d,i?n:this,l)}}(t,e,n,o);else var b=function(t,e,n){var r=1&e,i=Bi(t);return function e(){return(this&&this!==le&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return jo((g?Zr:Ao)(b,v),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 h=-1,p=!0,f=2&n?new Wn:r;for(a.set(t,e),a.set(e,t);++h<u;){var m=t[h],y=e[h];if(i)var g=s?i(y,m,h,e,t,a):i(m,y,h,t,e,a);if(g!==r){if(g)continue;p=!1;break}if(f){if(!Be(e,function(t,e){if(!Je(f,e)&&(m===t||o(m,t,n,i,a)))return f.push(e)})){p=!1;break}}else if(m!==y&&!o(m,y,n,i,a)){p=!1;break}}return a.delete(t),a.delete(e),p}function Qi(t){return Eo(Io(t,r,$o),t+"")}function to(t){return Sr(t,js,co)}function eo(t){return Sr(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,So(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=me?function(t){return null==t?[]:(t=It(t),Ae(me(t),function(e){return Wt.call(t,e)}))}:fu,lo=me?function(t){for(var e=[];t;)xe(e,co(t)),t=$t(t);return e}:fu,ho=Pr;function po(t,e,n){for(var r=-1,i=(e=yi(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)&&yo(a,i)&&(qa(t)||Va(t))}function fo(t){return"function"!=typeof t.constructor||wo(t)?{}:Nn($t(t))}function mo(t){return qa(t)||Va(t)||!!(Yt&&t&&t[Yt])}function yo(t,e){var n=typeof t;return!!(e=null==e?l:e)&&("number"==n||"symbol"!=n&&yt.test(t))&&t>-1&&t%1==0&&t<e}function go(t,e,n){if(!Qa(n))return!1;var r=typeof e;return!!("number"==r?Ha(n)&&yo(e,n.length):"string"==r&&e in n)&&Na(n[e],t)}function vo(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 It(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]}(Sn&&ho(new Sn(new ArrayBuffer(1)))!=x||Pn&&ho(new Pn)!=w||In&&ho(In.resolve())!=I||Cn&&ho(new Cn)!=O||On&&ho(new On)!=E)&&(ho=function(t){var e=Pr(t),n=e==P?t.constructor:r,i=n?Mo(n):"";if(i)switch(i){case jn:return x;case xn:return w;case Tn:return I;case zn:return O;case Bn:return E}return e});var _o=xt?Ja:mu;function wo(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function So(t){return t==t&&!Qa(t)}function Po(t,e){return function(n){return null!=n&&n[t]===e&&(e!==r||t in It(n))}}function Io(t,e,n){return e=yn(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=yn(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),Se(t,this,s)}}function Co(t,e){return e.length<2?t:wr(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 Ie(p,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=vn(),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=Hr(n,o),s=t[a];t[a]=t[n],t[n]=s}return t.length=e,t}var zo,Bo,Fo=(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===Bo.size&&Bo.clear(),t}),Bo=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 Wa(t)?cr(t,mr(e,1,Wa,!0)):[]}),Ro=Gr(function(t,e){var n=Ko(e);return Wa(n)&&(n=r),Wa(t)?cr(t,mr(e,1,Wa,!0),oo(n,2)):[]}),Lo=Gr(function(t,e){var n=Ko(e);return Wa(n)&&(n=r),Wa(t)?cr(t,mr(e,1,Wa,!0),r,n):[]});function Vo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ps(n);return i<0&&(i=yn(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=ps(n),o=n<0?yn(i+o,0):gn(o,i-1)),Me(t,oo(e,3),o,!0)}function $o(t){return null!=t&&t.length?mr(t,1):[]}function Ho(t){return t&&t.length?t[0]:r}var Wo=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 yo(t,n)?+t:t}).sort(Pi)),r});function Qo(t){return null==t?t:wn.call(t)}var ta=Gr(function(t){return si(mr(t,1,Wa,!0))}),ea=Gr(function(t){var e=Ko(t);return Wa(e)&&(e=r),si(mr(t,1,Wa,!0),oo(e,2))}),na=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,si(mr(t,1,Wa,!0),r,e)});function ra(t){if(!t||!t.length)return[];var e=0;return t=Ae(t,function(t){if(Wa(t))return e=yn(t.length,e),!0}),We(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 Se(e,r,t)})}var oa=Gr(function(t,e){return Wa(t)?cr(t,e):[]}),aa=Gr(function(t){return hi(Ae(t,Wa))}),sa=Gr(function(t){var e=Ko(t);return Wa(e)&&(e=r),hi(Ae(t,Wa),oo(e,2))}),ua=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,hi(Ae(t,Wa),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 ha(t,e){return e(t)}var pa=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&&yo(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:ha,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)}),ma=Fi(Vo),ya=Fi(qo);function ga(t,e){return(qa(t)?Ie:lr)(t,oo(e,3))}function va(t,e){return(qa(t)?Ce:dr)(t,oo(e,3))}var ba=ki(function(t,e,n){zt.call(t,n)?t[n].push(e):rr(t,n,[e])}),_a=Gr(function(t,e,n){var r=-1,i="function"==typeof e,o=Ha(t)?rt(t.length):[];return lr(t,function(t){o[++r]=i?Se(e,t,n):kr(t,e,n)}),o}),wa=ki(function(t,e,n){rr(t,n,e)});function Sa(t,e){return(qa(t)?je:Dr)(t,oo(e,3))}var Pa=ki(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),Ia=Gr(function(t,e){if(null==t)return[];var n=e.length;return n>1&&go(t,e[0],e[1])?e=[]:n>2&&go(e[0],e[1],e[2])&&(e=[e[0]]),Lr(t,mr(e,1),[])}),Ca=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=ps(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,h=!1,p=!1,f=!0;if("function"!=typeof t)throw new At(i);function m(e){var n=o,i=a;return o=a=r,d=e,u=t.apply(i,n)}function y(t){var n=t-l;return l===r||n>=e||n<0||p&&t-d>=s}function g(){var t=Ca();if(y(t))return v(t);c=ko(g,function(t){var n=e-(t-l);return p?gn(n,s-(t-d)):n}(t))}function v(t){return c=r,f&&o?m(t):(o=a=r,u)}function b(){var t=Ca(),n=y(t);if(o=arguments,a=this,l=t,n){if(c===r)return function(t){return d=t,c=ko(g,e),h?m(t):u}(l);if(p)return bi(c),c=ko(g,e),m(l)}return c===r&&(c=ko(g,e)),u}return e=ms(e)||0,Qa(n)&&(h=!!n.leading,s=(p="maxWait"in n)?yn(ms(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:v(Ca())},b}var xa=Gr(function(t,e){return ur(t,1,e)}),Ta=Gr(function(t,e,n){return ur(t,ms(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||Hn),n}function Ba(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=Hn;var Fa=gi(function(t,e){var n=(e=1==e.length&&qa(e[0])?je(e[0],Ye(oo())):je(mr(e,1),Ye(oo()))).length;return Gr(function(r){for(var i=-1,o=gn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return Se(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(Ir),La=qi(function(t,e){return t>=e}),Va=Er(function(){return arguments}())?Er:function(t){return ts(t)&&zt.call(t,"callee")&&!Wt.call(t,"callee")},qa=rt.isArray,$a=ye?Ye(ye):function(t){return ts(t)&&Pr(t)==j};function Ha(t){return null!=t&&Xa(t.length)&&!Ja(t)}function Wa(t){return ts(t)&&Ha(t)}var Ga=Fe||mu,Ya=ge?Ye(ge):function(t){return ts(t)&&Pr(t)==g};function Ka(t){if(!ts(t))return!1;var e=Pr(t);return e==v||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!rs(t)}function Ja(t){if(!Qa(t))return!1;var e=Pr(t);return e==b||e==_||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Za(t){return"number"==typeof t&&t==ps(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=ve?Ye(ve):function(t){return ts(t)&&ho(t)==w};function ns(t){return"number"==typeof t||ts(t)&&Pr(t)==S}function rs(t){if(!ts(t)||Pr(t)!=P)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)&&Pr(t)==C},os=_e?Ye(_e):function(t){return ts(t)&&ho(t)==O};function as(t){return"string"==typeof t||!qa(t)&&ts(t)&&Pr(t)==A}function ss(t){return"symbol"==typeof t||ts(t)&&Pr(t)==k}var us=we?Ye(we):function(t){return ts(t)&&Xa(t.length)&&!!re[Pr(t)]},cs=qi(Fr),ls=qi(function(t,e){return t<=e});function ds(t){if(!t)return[];if(Ha(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=ho(t);return(e==w?rn:e==O?sn:Ns)(t)}function hs(t){return t?(t=ms(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ps(t){var e=hs(t),n=e%1;return e==e?n?e-n:e:0}function fs(t){return t?or(ps(t),0,h):0}function ms(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=pt.test(t);return n||mt.test(t)?se(t.slice(2),n?2:8):ht.test(t)?d:+t}function ys(t){return Ai(t,xs(t))}function gs(t){return null==t?"":ai(t)}var vs=Ei(function(t,e){if(wo(e)||Ha(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)}),_s=Ei(function(t,e,n,r){Ai(e,xs(e),t,r)}),ws=Ei(function(t,e,n,r){Ai(e,js(e),t,r)}),Ss=Qi(ir),Ps=Gr(function(t,e){t=It(t);var n=-1,i=e.length,o=i>2?e[2]:r;for(o&&go(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}),Is=Gr(function(t){return t.push(r,Ji),Se(zs,r,t)});function Cs(t,e,n){var i=null==t?r:wr(t,e);return i===r?n:i}function Os(t,e){return null!=t&&po(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 Ha(t)?Yn(t):Br(t)}function xs(t){return Ha(t)?Yn(t,!0):function(t){if(!Qa(t))return function(t){var e=[];if(null!=t)for(var n in It(t))e.push(n);return e}(t);var e=wo(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)}),Bs=Qi(function(t,e){var n={};if(null==t)return n;var r=!1;e=je(e,function(e){return e=yi(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}),Fs=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(gs(t).toLowerCase())}function Vs(t){return(t=gs(t))&&t.replace(gt,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()}),Hs=Ti("toLowerCase"),Ws=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=gs(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 Se(t,r,e)}catch(t){return Ka(t)?t:new wt(t)}}),Xs=Qi(function(t,e){return Ie(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=_r(e,r);null!=n||Qa(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=_r(e,js(e)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ja(t);return Ie(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(Be);function du(t){return vo(t)?Ve(Do(t)):function(t){return function(e){return wr(e,t)}}(t)}var hu=Vi(),pu=Vi(!0);function fu(){return[]}function mu(){return!1}var yu,gu=Ni(function(t,e){return t+e},0),vu=Hi("ceil"),bu=Ni(function(t,e){return t/e},1),_u=Hi("floor"),wu=Ni(function(t,e){return t*e},1),Su=Hi("round"),Pu=Ni(function(t,e){return t-e},0);return Un.after=function(t,e){if("function"!=typeof e)throw new At(i);return t=ps(t),function(){if(--t<1)return e.apply(this,arguments)}},Un.ary=Oa,Un.assign=vs,Un.assignIn=bs,Un.assignInWith=_s,Un.assignWith=ws,Un.at=Ss,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?go(t,e,n):e===r)?1:yn(ps(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,a=0,s=rt(he(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],mr(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(Se(i[0],this,n))return Se(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=Ps,Un.defaultsDeep=Is,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:ps(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:ps(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&&go(t,e,n)&&(n=0,i=o),function(t,e,n,i){var o=t.length;for((n=ps(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:ps(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 mr(Sa(t,e),1)},Un.flatMapDeep=function(t,e){return mr(Sa(t,e),c)},Un.flatMapDepth=function(t,e,n){return n=n===r?1:ps(n),mr(Sa(t,e),n)},Un.flatten=$o,Un.flattenDeep=function(t){return null!=t&&t.length?mr(t,c):[]},Un.flattenDepth=function(t,e){return null!=t&&t.length?mr(t,e=e===r?1:ps(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?[]:_r(t,js(t))},Un.functionsIn=function(t){return null==t?[]:_r(t,xs(t))},Un.groupBy=ba,Un.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Un.intersection=Wo,Un.intersectionBy=Go,Un.intersectionWith=Yo,Un.invert=As,Un.invertBy=ks,Un.invokeMap=_a,Un.iteratee=ru,Un.keyBy=wa,Un.keys=js,Un.keysIn=xs,Un.map=Sa,Un.mapKeys=function(t,e){var n={};return e=oo(e,3),vr(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),vr(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=Ba,Un.nthArg=function(t){return t=ps(t),Gr(function(e){return Rr(e,t)})},Un.omit=Bs,Un.omitBy=function(t,e){return Ds(t,Ba(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=Fa,Un.overEvery=cu,Un.overSome=lu,Un.partial=Da,Un.partialRight=Ma,Un.partition=Pa,Un.pick=Fs,Un.pickBy=Ds,Un.property=du,Un.propertyOf=function(t){return function(e){return null==t?r:wr(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=hu,Un.rangeRight=pu,Un.rearg=Ua,Un.reject=function(t,e){return(qa(t)?Ae:fr)(t,Ba(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:ps(e))},Un.reverse=Qo,Un.sampleSize=function(t,e,n){return e=(n?go(t,e,n):e===r)?1:ps(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&&go(t,e,n)?(e=0,n=i):(e=null==e?0:ps(e),n=n===r?i:ps(n)),ti(t,e,n)):[]},Un.sortBy=Ia,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&&go(t,e,n)&&(e=n=r),(n=n===r?h:n>>>0)?(t=gs(t))&&("string"==typeof e||null!=e&&!is(e))&&!(e=ai(e))&&nn(t)?vi(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:yn(ps(e),0),Gr(function(n){var r=n[e],i=vi(n,0,e);return r&&xe(i,r),Se(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:ps(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:ps(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=ha,Un.toArray=ds,Un.toPairs=Ms,Un.toPairsIn=Us,Un.toPath=function(t){return qa(t)?je(t,Do):ss(t)?[t]:Oi(Fo(gs(t)))},Un.toPlainObject=ys,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?Ie:vr)(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,mi(n))},Un.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:ci(t,e,mi(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(mi(e),t)},Un.xor=aa,Un.xorBy=sa,Un.xorWith=ua,Un.zip=ca,Un.zipObject=function(t,e){return pi(t||[],e||[],Qn)},Un.zipObjectDeep=function(t,e){return pi(t||[],e||[],Jr)},Un.zipWith=la,Un.entries=Ms,Un.entriesIn=Us,Un.extend=bs,Un.extendWith=_s,au(Un,Un),Un.add=gu,Un.attempt=Zs,Un.camelCase=Rs,Un.capitalize=Ls,Un.ceil=vu,Un.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=ms(n))==n?n:0),e!==r&&(e=(e=ms(e))==e?e:0),or(ms(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=gs(t),e=ai(e);var i=t.length,o=n=n===r?i:or(ps(n),0,i);return(n-=e.length)>=0&&t.slice(n,o)==e},Un.eq=Na,Un.escape=function(t){return(t=gs(t))&&G.test(t)?t.replace(H,tn):t},Un.escapeRegExp=function(t){return(t=gs(t))&&et.test(t)?t.replace(tt,"\\$&"):t},Un.every=function(t,e,n){var i=qa(t)?Oe:hr;return n&&go(t,e,n)&&(e=r),i(t,oo(e,3))},Un.find=ma,Un.findIndex=Vo,Un.findKey=function(t,e){return De(t,oo(e,3),vr)},Un.findLast=ya,Un.findLastIndex=qo,Un.findLastKey=function(t,e){return De(t,oo(e,3),br)},Un.floor=_u,Un.forEach=ga,Un.forEachRight=va,Un.forIn=function(t,e){return null==t?t:yr(t,oo(e,3),xs)},Un.forInRight=function(t,e){return null==t?t:gr(t,oo(e,3),xs)},Un.forOwn=function(t,e){return t&&vr(t,oo(e,3))},Un.forOwnRight=function(t,e){return t&&br(t,oo(e,3))},Un.get=Cs,Un.gt=Ra,Un.gte=La,Un.has=function(t,e){return null!=t&&po(t,e,Cr)},Un.hasIn=Os,Un.head=Ho,Un.identity=nu,Un.includes=function(t,e,n,r){t=Ha(t)?t:Ns(t),n=n&&!r?ps(n):0;var i=t.length;return n<0&&(n=yn(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:ps(n);return i<0&&(i=yn(r+i,0)),Ue(t,e,i)},Un.inRange=function(t,e,n){return e=hs(e),n===r?(n=e,e=0):n=hs(n),function(t,e,n){return t>=gn(e,n)&&t<yn(e,n)}(t=ms(t),e,n)},Un.invoke=Es,Un.isArguments=Va,Un.isArray=qa,Un.isArrayBuffer=$a,Un.isArrayLike=Ha,Un.isArrayLikeObject=Wa,Un.isBoolean=function(t){return!0===t||!1===t||ts(t)&&Pr(t)==y},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(Ha(t)&&(qa(t)||"string"==typeof t||"function"==typeof t.splice||Ga(t)||us(t)||Va(t)))return!t.length;var e=ho(t);if(e==w||e==O)return!t.size;if(wo(t))return!Br(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(_o(t))throw new wt("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)&&ho(t)==E},Un.isWeakSet=function(t){return ts(t)&&"[object WeakSet]"==Pr(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=ps(n))<0?yn(i+o,0):gn(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=Hs,Un.lt=cs,Un.lte=ls,Un.max=function(t){return t&&t.length?pr(t,nu,Ir):r},Un.maxBy=function(t,e){return t&&t.length?pr(t,oo(e,2),Ir):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?pr(t,nu,Fr):r},Un.minBy=function(t,e){return t&&t.length?pr(t,oo(e,2),Fr):r},Un.stubArray=fu,Un.stubFalse=mu,Un.stubObject=function(){return{}},Un.stubString=function(){return""},Un.stubTrue=function(){return!0},Un.multiply=wu,Un.nth=function(t,e){return t&&t.length?Rr(t,ps(e)):r},Un.noConflict=function(){return le._===this&&(le._=Ut),this},Un.noop=su,Un.now=Ca,Un.pad=function(t,e,n){t=gs(t);var r=(e=ps(e))?cn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Li(fe(i),n)+t+Li(he(i),n)},Un.padEnd=function(t,e,n){t=gs(t);var r=(e=ps(e))?cn(t):0;return e&&r<e?t+Li(e-r,n):t},Un.padStart=function(t,e,n){t=gs(t);var r=(e=ps(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(gs(t).replace(nt,""),e||0)},Un.random=function(t,e,n){if(n&&"boolean"!=typeof n&&go(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=hs(t),e===r?(e=t,t=0):e=hs(e)),t>e){var i=t;t=e,e=i}if(n||t%1||e%1){var o=_n();return gn(t+o*(e-t+ae("1e-"+((o+"").length-1))),e)}return Hr(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?go(t,e,n):e===r)?1:ps(e),Wr(gs(t),e)},Un.replace=function(){var t=arguments,e=gs(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Un.result=function(t,e,n){var i=-1,o=(e=yi(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=Su,Un.runInContext=t,Un.sample=function(t){return(qa(t)?Kn:Yr)(t)},Un.size=function(t){if(null==t)return 0;if(Ha(t))return as(t)?cn(t):t.length;var e=ho(t);return e==w||e==O?t.size:Br(t).length},Un.snakeCase=Ws,Un.some=function(t,e,n){var i=qa(t)?Be:ei;return n&&go(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=gs(t),n=null==n?0:or(ps(n),0,t.length),e=ai(e),t.slice(n,n+e.length)==e},Un.subtract=Pu,Un.sum=function(t){return t&&t.length?He(t,nu):0},Un.sumBy=function(t,e){return t&&t.length?He(t,oo(e,2)):0},Un.template=function(t,e,n){var i=Un.templateSettings;n&&go(t,e,n)&&(e=r),t=gs(t),e=_s({},e,i,Ki);var o,a,s=_s({},e.imports,i.imports,Ki),u=js(s),c=Ke(s,u),l=0,d=e.interpolate||vt,h="__p += '",p=Ct((e.escape||vt).source+"|"+d.source+"|"+(d===J?lt:vt).source+"|"+(e.evaluate||vt).source+"|$","g"),f="//# sourceURL="+(zt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ne+"]")+"\n";t.replace(p,function(e,n,r,i,s,u){return r||(r=i),h+=t.slice(l,u).replace(bt,en),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),h+="';\n";var m=zt.call(e,"variable")&&e.variable;if(m){if(ut.test(m))throw new wt("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(a?h.replace(L,""):h).replace(V,"$1").replace(q,"$1;"),h="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var y=Zs(function(){return St(u,f+"return "+h).apply(r,c)});if(y.source=h,Ka(y))throw y;return y},Un.times=function(t,e){if((t=ps(t))<1||t>l)return[];var n=h,r=gn(t,h);e=oo(e),t-=h;for(var i=We(r,e);++n<t;)e(n);return i},Un.toFinite=hs,Un.toInteger=ps,Un.toLength=fs,Un.toLower=function(t){return gs(t).toLowerCase()},Un.toNumber=ms,Un.toSafeInteger=function(t){return t?or(ps(t),-9007199254740991,l):0===t?t:0},Un.toString=gs,Un.toUpper=function(t){return gs(t).toUpperCase()},Un.trim=function(t,e,n){if((t=gs(t))&&(n||e===r))return Ge(t);if(!t||!(e=ai(e)))return t;var i=ln(t),o=ln(e);return vi(i,Ze(i,o),Xe(i,o)+1).join("")},Un.trimEnd=function(t,e,n){if((t=gs(t))&&(n||e===r))return t.slice(0,dn(t)+1);if(!t||!(e=ai(e)))return t;var i=ln(t);return vi(i,0,Xe(i,ln(e))+1).join("")},Un.trimStart=function(t,e,n){if((t=gs(t))&&(n||e===r))return t.replace(nt,"");if(!t||!(e=ai(e)))return t;var i=ln(t);return vi(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?ps(e.length):n,i="omission"in e?ai(e.omission):i}var a=(t=gs(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?vi(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=Ct(o.source,gs(dt.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var h=l.index;c=c.slice(0,h===r?u:h)}}else if(t.indexOf(ai(o),u)!=u){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+i},Un.unescape=function(t){return(t=gs(t))&&W.test(t)?t.replace($,hn):t},Un.uniqueId=function(t){var e=++Bt;return gs(t)+e},Un.upperCase=Ys,Un.upperFirst=Ks,Un.each=ga,Un.eachRight=va,Un.first=Ho,au(Un,(yu={},vr(Un,function(t,e){zt.call(Un.prototype,e)||(yu[e]=t)}),yu),{chain:!1}),Un.VERSION="4.17.21",Ie(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){Un[t].placeholder=Un}),Ie(["drop","take"],function(t,e){Vn.prototype[t]=function(n){n=n===r?1:yn(ps(n),0);var i=this.__filtered__&&!e?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=gn(n,i.__takeCount__):i.__views__.push({size:gn(n,h),type:t+(i.__dir__<0?"Right":"")}),i},Vn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ie(["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}}),Ie(["head","last"],function(t,e){var n="take"+(e?"Right":"");Vn.prototype[t]=function(){return this[n](1).value()[0]}}),Ie(["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(Ba(oo(t)))},Vn.prototype.slice=function(t,e){t=ps(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=ps(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(h)},vr(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&&h?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var h=this.__chain__,p=!!this.__actions__.length,f=a&&!h,m=u&&!p;if(!a&&l){e=m?e:new Vn(this);var y=t.apply(e,s);return y.__actions__.push({func:ha,args:[d],thisArg:r}),new Ln(y,h)}return f&&m?t.apply(this,s):(y=this.thru(d),f?i?y.value()[0]:y.value():y)})}),Ie(["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)})}}),vr(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=gn(e,t+a);break;case"takeRight":t=yn(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,h=0,p=gn(u,this.__takeCount__);if(!n||!r&&i==u&&p==u)return di(t,this.__actions__);var f=[];t:for(;u--&&h<p;){for(var m=-1,y=t[c+=e];++m<d;){var g=l[m],v=g.iteratee,b=g.type,_=v(y);if(2==b)y=_;else if(!_){if(1==b)continue t;break t}}f[h++]=y}return f},Un.prototype.at=pa,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:ha,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._=pn,define(function(){return pn})):he?((he.exports=pn)._=pn,de._=pn):le._=pn}.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";function t(t,e){return Object.assign(t,{resolveIds:e})}n.r(r),n.d(r,{createBigCommercePaymentsAlternativeMethodsButtonStrategy:()=>se,createBigCommercePaymentsAlternativeMethodsPaymentStrategy:()=>Mt,createBigCommercePaymentsButtonStrategy:()=>ee,createBigCommercePaymentsCreditCardsPaymentStrategy:()=>Bt,createBigCommercePaymentsCustomerStrategy:()=>qt,createBigCommercePaymentsFastlaneCustomerStrategy:()=>Wt,createBigCommercePaymentsFastlanePaymentStrategy:()=>ft,createBigCommercePaymentsPayLaterButtonStrategy:()=>ie,createBigCommercePaymentsPayLaterCustomerStrategy:()=>Kt,createBigCommercePaymentsPayLaterPaymentStrategy:()=>bt,createBigCommercePaymentsPaymentStrategy:()=>W,createBigCommercePaymentsRatePayPayPaymentStrategy:()=>Pt,createBigCommercePaymentsVenmoButtonStrategy:()=>le,createBigCommercePaymentsVenmoCustomerStrategy:()=>Xt,createBigCommercePaymentsVenmoPaymentStrategy:()=>Rt});const e={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},i="embedded-checkout-loading-indicator-rotation";class o{constructor(t){this.styles=Object.assign(Object.assign({},e),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=`${i} 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(i))return;const e=document.createElement("style");e.id=i,null===(t=document.head)||void 0===t||t.appendChild(e),e.sheet instanceof CSSStyleSheet&&e.sheet.insertRule(`\n @keyframes ${i} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}const a={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};var s,u=n(8686),c=n(4043),l=n(315),d=n(9440);class h 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 p extends h{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"}(s||(s={}));class f extends h{constructor(t){super(function(t){switch(t){case s.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case s.MissingCart:return"Unable to proceed because cart data is unavailable.";case s.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case s.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case s.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case s.MissingCheckoutConfig:case s.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case s.MissingOrder:return"Unable to proceed because order data is unavailable.";case s.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case s.MissingPayment:return"Unable to proceed because payment data is unavailable.";case s.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case s.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case s.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(t)),this.subtype=t,this.name="MissingDataError",this.type="missing_data"}}class m extends h{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 y={body:{},headers:{},status:0};class g extends h{constructor(t,{message:e,errors:n}={}){const{body:r,headers:i,status:o}=t||y;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 v,b,_,w,S,P,I,C;!function(t){t.BuyNow="BUY_NOW"}(v||(v={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(b||(b={})),function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(_||(_={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(w||(w={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(S||(S={})),function(t){t.pill="pill",t.rect="rect"}(P||(P={})),function(t){t.OXXO="oxxo"}(I||(I={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(C||(C={}));var O=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 A{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.bigCommercePaymentsRequestSender=n,this.bigCommercePaymentsScriptLoader=r}loadPayPalSdk(t,e,n,r){return O(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.bigCommercePaymentsScriptLoader.getPayPalSDK(a,o,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new p;return this.paypalSdk}createBuyNowCartOrThrow(t){return O(this,void 0,void 0,function*(){const e=t.getBuyNowCartRequestBody();if(!e)throw new f(s.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(e)}catch(t){throw new m}})}createOrder(t,e){return O(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.bigCommercePaymentsRequestSender.createOrder(t,Object.assign({cartId:n},e));return r})}createOrderCardFields(t,e){return O(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.bigCommercePaymentsRequestSender.createOrder(t,Object.assign({cartId:n},e));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(){return O(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState(),e=t.getCartOrThrow(),n=t.getConsignmentsOrThrow()[0];try{yield this.bigCommercePaymentsRequestSender.updateOrder({availableShippingOptions:n.availableShippingOptions,cartId:e.id,selectedShippingOption:n.selectedShippingOption})}catch(t){throw new g}})}getOrderStatus(t,e){return O(this,void 0,void 0,function*(){try{const{status:n}=yield this.bigCommercePaymentsRequestSender.getOrderStatus(t,e);return n}catch(t){throw new g}})}tokenizePayment(t,e){const n=this.paymentIntegrationService.getState().getCartOrThrow();if(!e)throw new f(s.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:t,order_id:e},n.source===v.BuyNow&&{cart_id:n.id}))}submitPayment(t,e,n){return O(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&&S[e]?e:void 0,height:this.getValidHeight(n),label:r&&w[r]?r:void 0,shape:i&&P[i]?i:void 0};return(0,d.omitBy)(o,d.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 k="This API endpoint is for internal use only and may change in the future";var E;!function(t){t.Json="application/json",t.JsonV1="application/vnd.bc.v1+json"}(E||(E={}));const j=E,x={"X-Checkout-SDK-Version":"1.817.0"};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 z{constructor(t){this.requestSender=t}createOrder(t,e){return T(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":k,"Content-Type":j.Json},x);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t){return T(this,void 0,void 0,function*(){const e=t,n=Object.assign({"X-API-INTERNAL":k,"Content-Type":j.Json},x);return(yield this.requestSender.put("/api/storefront/initialization/bigcommerce_payments",{headers:n,body:e})).body})}getOrderStatus(t="bigcommerce_payments",e){return T(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":k,"Content-Type":j.Json},x);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 F{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 p;return this.window.paypal})}getPayPalSdkScriptConfigOrThrow(t,e,n=!0){const{id:r,clientToken:i,initializationData:o}=t;if(!(null==o?void 0:o.clientId))throw new f(s.MissingPaymentMethod);const{intent:a,clientId:u,merchantId:c,buyerCountry:l,attributionId:d,isVenmoEnabled:h,isHostedCheckoutEnabled:p,isPayPalCreditAvailable:m,isDeveloperModeApplicable:y,availableAlternativePaymentMethods:g=[],enabledAlternativePaymentMethods:v=[],isGooglePayEnabled:b}=o,_=p||n,w="bigcommerce_payments_creditcards"===r,S=w?["card"]:[],P=w?[]:["card"],I=m?["credit","paylater"]:[],C=m?[]:["credit","paylater"],O=n||!_,A=h?["venmo"]:[],k=h?[]:["venmo"],E=O?v:[],j=O?g.filter(t=>!v.includes(t)):g,x=b?["googlepay"]:[],T=n?["card-fields"]:[],z=this.filterFundingOptions([...P,...C,...k,...j]),B=this.filterFundingOptions([...S,...I,...A,...E]);return{options:Object.assign({"client-id":u,"merchant-id":c,"enable-funding":B.length>0?B:void 0,"disable-funding":z.length>0?z:void 0,commit:_,components:["buttons","hosted-fields","payment-fields","legal",...x,...T],currency:e,intent:a},y&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":i}}}filterFundingOptions(t){const e=["klarna"];return t?t.filter(t=>!e.includes(t)):[]}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 D=t=>{const{getHost:e}=t.getState();return new A((0,u.createFormPoster)(),t,new z((0,c.createRequestSender)({host:e()})),new F((0,l.vQ)()))};class M extends h{constructor(t){super(t||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class U extends M{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 N 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 R extends h{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function L(t){return!("object"!=typeof t||null===t||void 0!==t.shouldSaveInstrument&&"boolean"!=typeof t.shouldSaveInstrument||void 0!==t.shouldSetAsDefaultInstrument&&"boolean"!=typeof t.shouldSetAsDefaultInstrument)}function V(t){return Boolean(t.instrumentId)}function q(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 $=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 H{constructor(t,e,n){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.loadingIndicator=n}initialize(t){var e,n;return $(this,void 0,void 0,function*(){const{methodId:r,bigcommerce_payments:i}=t||{};if(this.bigcommerce_payments=i,!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new M('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(r);const o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(r);this.loadingIndicatorContainer=i.container.split("#")[1],(null===(e=o.initializationData)||void 0===e?void 0:e.orderId)?this.orderId=null===(n=o.initializationData)||void 0===n?void 0:n.orderId:(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(r),i.onInit&&"function"==typeof i.onInit&&i.onInit(()=>this.renderButton(r,i)),(void 0===i.shouldRenderPayPalButtonOnInitialization||i.shouldRenderPayPalButtonOnInitialization)&&this.renderButton(r,i))})}execute(t,e){return $(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"]),{onError:i}=this.bigcommerce_payments||{};if(!n)throw new U(["payment"]);const{methodId:o,paymentData:a}=n;if(this.isPayPalVaultedInstrumentPaymentData(a)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new N;const s=this.isPayPalVaultedInstrumentPaymentData(a)?this.prepareVaultedInstrumentPaymentPayload(o,this.orderId,a):this.preparePaymentPayload(o,this.orderId,a);try{yield this.paymentIntegrationService.submitOrder(r,e),yield this.paymentIntegrationService.submitPayment(s)}catch(t){return this.isProviderError(t)&&(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n.methodId),yield new Promise((t,e)=>{var r;this.bigcommerce_payments&&(null===(r=this.paypalButton)||void 0===r||r.close(),this.renderButton(n.methodId,this.bigcommerce_payments),this.handleError(new Error("INSTRUMENT_DECLINED"),i)),e()})),this.handleError(t,i),Promise.reject()}})}finalize(){return Promise.reject(new R)}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}=L(n)?n:{};return{methodId:t,paymentData:{shouldSaveInstrument:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e}}}}}renderButton(t,e){const n=this.bigCommercePaymentsIntegrationService.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.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),createOrder:()=>this.createOrder(),onClick:(t,e)=>this.handleClick(e,c),onApprove:t=>this.handleApprove(t,l),onError:t=>this.handleError(t,s),onCancel:()=>this.toggleLoadingIndicator(!1)};this.paypalButton=n.Buttons(d),this.paypalButton.isEligible()&&(u&&"function"==typeof u&&u(),this.paypalButton.render(a))}handleClick(t,e){return $(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;yield e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,e()}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}createOrder(){return $(this,void 0,void 0,function*(){const t=this.getFieldsValues();return this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_paymentscheckout",{shouldSaveInstrument:(null==t?void 0:t.shouldSaveInstrument)||!1})})}getFieldsValues(){const{getFieldsValues:t}=this.bigcommerce_payments||{};return"function"==typeof t?t():void 0}isTrustedVaultingFlow(t){if(t&&V(t)){const e=this.paymentIntegrationService.getState().getInstruments(),n=null==e?void 0:e.find(e=>q(e)&&e.bigpayToken===t.instrumentId);return!(q(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(t){return!!t&&V(t)&&L(t)}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)}}const W=t(t=>new H(t,D(t),new o({containerStyles:a})),[{id:"bigcommerce_payments"}]);var G,Y,K,J,Z,X,Q,tt,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){this.scriptLoader=t,this.window=window}getPayPalFastlaneSdk(t,e,n){return et(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 p}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(t,e,n,r){return et(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 p;return this.window.paypalGooglePay})}getPayPalApmsSdk(t,e){return et(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 p}return this.window.paypalApms})}getPayPalMessages(t,e){return et(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 p;return this.window.paypalMessages})}loadPayPalSdk({options:t,attributes:e}){return et(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(t,e,n){const{clientToken:r,initializationData:i}=t;if(!i||!i.clientId)throw new f(s.MissingPaymentMethod);const{intent:o,clientId:a,merchantId:u,attributionId:c}=i;return{options:{"client-id":a,"merchant-id":u,commit:!0,components:["fastlane","three-domain-secure"],currency:e,intent:o},attributes:{"data-client-metadata-id":n.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":c,"data-sdk-client-token":r}}}getPayPalGooglePaySdkScriptConfigOrThrow(t,e,n=!0){const{clientToken:r,initializationData:i}=t;if(!i||!i.clientId)throw new f(s.MissingPaymentMethod);const{intent:o,clientId:a,merchantId:u,buyerCountry:c,attributionId:l,isHostedCheckoutEnabled:d,isDeveloperModeApplicable:h}=i,p=d||n;return{options:Object.assign({"client-id":a,"merchant-id":u,commit:p,components:["googlepay"],currency:e,intent:o},h&&{"buyer-country":c}),attributes:{"data-partner-attribution-id":l,"data-client-token":r,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(t,e){const{initializationData:n}=t;if(!n||!n.clientId)throw new f(s.MissingPaymentMethod);const{intent:r,clientId:i,merchantId:o,buyerCountry:a,attributionId:u,isDeveloperModeApplicable:c,availableAlternativePaymentMethods:l=[],enabledAlternativePaymentMethods:d=[]}=n,h=this.filterFundingOptions(d),p=this.filterFundingOptions(l.filter(t=>!d.includes(t)));return{options:Object.assign({"client-id":i,"merchant-id":o,"enable-funding":h.length>0?h:void 0,"disable-funding":p.length>0?p:void 0,commit:!0,components:["buttons","payment-fields"],currency:e,intent:r},c&&{"buyer-country":a}),attributes:{"data-partner-attribution-id":u,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(t,e){const{initializationData:n}=t;if(!n||!n.clientId)throw new f(s.MissingPaymentMethod);const{clientId:r,merchantId:i,attributionId:o,isDeveloperModeApplicable:a,buyerCountry:u}=n;return{options:Object.assign({"client-id":r,"merchant-id":i,components:["messages"],currency:e},a&&{"buyer-country":u}),attributes:{"data-namespace":"paypalMessages","data-partner-attribution-id":o}}}filterFundingOptions(t){const e=["klarna"];return t?t.filter(t=>!e.includes(t)):[]}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}}function rt(){return new nt((0,l.Hb)())}!function(t){t.CVV="cvv",t.PAN="pan"}(G||(G={}));class it{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){it.set(t,"",Object.assign({expires:new Date(0)},e))}}!function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(Y||(Y={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(K||(K={})),function(t){t.Succeeded="succeeded",t.Cancelled="cancelled",t.Errored="errored"}(J||(J={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(Z||(Z={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(X||(X={})),function(t){t.pill="pill",t.rect="rect"}(Q||(Q={})),function(t){t.SUCCEEDED="succeeded",t.FAILED="failed",t.CANCELED="canceled",t.UNRECOGNIZED="unrecognized"}(tt||(tt={}));var ot=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 at{constructor(){this.window=window}initializePayPalFastlane(t,e,n){return ot(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 p;return this.window.paypalFastlane}lookupCustomerOrThrow(t){return ot(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(t)})}triggerAuthenticationFlowOrThrow(t){return ot(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};it.set("bc-fastlane-sessionId",t,n)}removeStorageSessionId(){it.remove("bc-fastlane-sessionId")}getStorageSessionId(){return it.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,h=s&&c?this.mapPayPalToBcAddress(s,c,null==u?void 0:u.phoneNumber):void 0,p=l?this.mapPayPalToBcInstrument(t,l):[],f=this.filterAddresses([d,h]);return{authenticationState:o||tt.UNRECOGNIZED,addresses:f,billingAddress:h,shippingAddress:d,instruments:p}}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:G.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,d.isEqual)(this.normalizeAddress(t),this.normalizeAddress(e))}normalizeAddress(t){return(0,d.omit)(t,["id","phone"])}}function st(){return new at}function ut(t){return"string"!=typeof t}function ct(t,e){if(e||t)return function(t){var e,n;const r={},i=(0,d.omitBy)(t.root,ut),o=(0,d.omitBy)(t.input,ut),a=(0,d.omitBy)(t.toggle,ut),s=(0,d.omitBy)(null===(e=t.text)||void 0===e?void 0:e.body,ut),u=(0,d.omitBy)(null===(n=t.text)||void 0===n?void 0:n.caption,ut),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,h,p,f,m,y,g,v,b,_,w,S,P;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===(h=null==e?void 0:e.input)||void 0===h?void 0:h.borderWidth),textColorBase:(null==t?void 0:t.fastlaneInputSettingsTextColorBase)||(null===(p=null==e?void 0:e.input)||void 0===p?void 0:p.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===(m=null==e?void 0:e.toggle)||void 0===m?void 0:m.colorSecondary)},text:{body:{color:(null==t?void 0:t.fastlaneTextBodySettingsColor)||(null===(g=null===(y=null==e?void 0:e.text)||void 0===y?void 0:y.body)||void 0===g?void 0:g.color),fontSize:(null==t?void 0:t.fastlaneTextBodySettingsFontSize)||(null===(b=null===(v=null==e?void 0:e.text)||void 0===v?void 0:v.body)||void 0===b?void 0:b.fontSize)},caption:{color:(null==t?void 0:t.fastlaneTextCaptionSettingsColor)||(null===(w=null===(_=null==e?void 0:e.text)||void 0===_?void 0:_.caption)||void 0===w?void 0:w.color),fontSize:(null==t?void 0:t.fastlaneTextCaptionSettingsFontSize)||(null===(P=null===(S=null==e?void 0:e.text)||void 0===S?void 0:S.caption)||void 0===P?void 0:P.fontSize)}},branding:(null==t?void 0:t.fastlaneBrandingSettings)||(null==e?void 0:e.branding)}}(t,e))}function lt(t){return!!t&&("authenticationState"in t||"addresses"in t||"instruments"in t)}function dt(t,e,n=!0){var r;return null!==(r=t[e])&&void 0!==r?r:n}var ht=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 pt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.bigCommercePaymentsRequestSender=e,this.bigCommercePaymentsSdk=n,this.bigCommercePaymentsFastlaneUtils=r}initialize(t){var e,n;return ht(this,void 0,void 0,function*(){const{methodId:r,bigcommerce_payments_fastlane:i}=t;if(!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(this.methodId=r,!i)throw new M('Unable to initialize payment because "options.bigcommerce_payments_fastlane" argument is not provided.');if(this.bigcommerce_payments_fastlane=i,!i.onInit||"function"!=typeof i.onInit)throw new M('Unable to initialize payment because "options.bigcommerce_payments_fastlane.onInit" argument is not provided or it is not a function.');if(!i.onChange||"function"!=typeof i.onChange)throw new M('Unable to initialize payment because "options.bigcommerce_payments_fastlane.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.bigCommercePaymentsSdk.getPayPalFastlaneSdk(s,a.currency.code,a.id);const l=ct(c?null===(n=null==s?void 0:s.initializationData)||void 0===n?void 0:n.fastlaneStyles:{},null==i?void 0:i.styles);yield this.bigCommercePaymentsFastlaneUtils.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 ht(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 U(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&V(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.bigCommercePaymentsFastlaneUtils.removeStorageSessionId()}catch(t){if(function(t){return"object"==typeof t&&null!==t&&"message"in t&&"response"in t&&"name"in t.response}(t)&&"INVALID_REQUEST"===t.response.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 R)}deinitialize(){return ht(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=lt(r)?r:{},o=this.bigCommercePaymentsFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===tt.CANCELED||(null==i?void 0:i.authenticationState)||o!==e.id)}runPayPalAuthenticationFlowOrThrow(t){return ht(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.bigCommercePaymentsFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.bigCommercePaymentsFastlaneUtils.triggerAuthenticationFlowOrThrow(a),{authenticationState:u,addresses:c,instruments:l}=this.bigCommercePaymentsFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:u,addresses:c,instruments:l}),s.authenticationState===tt.CANCELED?this.bigCommercePaymentsFastlaneUtils.removeStorageSessionId():this.bigCommercePaymentsFastlaneUtils.updateStorageSessionId(n.id)}catch(t){}})}initializePayPalPaymentComponent(){return ht(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),e=t.phone,n=`${t.firstName} ${t.lastName}`.trim(),r=this.bigCommercePaymentsFastlaneUtils.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 M('Unable to render card component because "container" argument is not provided.');e.render(t)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new p;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(t,e){return ht(this,void 0,void 0,function*(){const{instrumentId:n}=e,r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),i=this.isBigcommercePaymentsFastlaneThreeDSAvailable()&&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 ht(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.bigCommercePaymentsFastlaneUtils.mapBcToPayPalAddress(r)}),u=this.isBigcommercePaymentsFastlaneThreeDSAvailable()&&i.config.is3dsEnabled;u||(yield this.createOrder(s));const{shouldSaveInstrument:c=!1,shouldSetAsDefaultInstrument:l=!1}=L(e)?e:{},d=u?yield this.get3DSNonce(s):s;return{methodId:t,paymentData:Object.assign(Object.assign({},e),{shouldSaveInstrument:c,shouldSetAsDefaultInstrument:l,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:d}}})}})}createOrder(t){return ht(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState().getCartOrThrow().id;if(this.methodId){const{orderId:n}=yield this.bigCommercePaymentsRequestSender.createOrder(this.methodId,{cartId:e,fastlaneToken:t});this.orderId=n}})}get3DSNonce(t){var e;return ht(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),o=n.getStoreConfigOrThrow().links.checkoutLink,a=null===(e=this.paypalFastlaneSdk)||void 0===e?void 0:e.ThreeDomainSecureClient;if(!a)throw new p;const s={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 a.isEligible(s)){const{liabilityShift:e,authenticationState:n,nonce:r}=yield a.show();if(e===b.No||e===b.Unknown)throw new N;if(yield this.createOrder(t),n===J.Succeeded)return r;if(n===J.Errored)throw new N;if(n===J.Cancelled)throw console.error("3DS check was canceled"),new N}return t})}handlePayPalStoredInstrumentChange(t){return ht(this,void 0,void 0,function*(){const e=this.bigCommercePaymentsFastlaneUtils.getPayPalFastlaneOrThrow(),{selectionChanged:n,selectedCard:r}=yield e.profile.showCardSelector();if(n){const e=this.paymentIntegrationService.getState().getPaymentProviderCustomer(),n=lt(e)?e:{},i=this.bigCommercePaymentsFastlaneUtils.mapPayPalToBcInstrument(t,r)[0];return yield this.paymentIntegrationService.updatePaymentProviderCustomer(Object.assign(Object.assign({},n),{instruments:[i]})),i}})}isBigcommercePaymentsFastlaneThreeDSAvailable(){return dt(this.paymentIntegrationService.getState().getStoreConfigOrThrow().checkoutSettings.features,"PROJECT-7080.bcp_fastlane_three_ds")}handleError(t){var e;(null===(e=this.bigcommerce_payments_fastlane)||void 0===e?void 0:e.onError)&&"function"==typeof this.bigcommerce_payments_fastlane.onError&&this.bigcommerce_payments_fastlane.onError(t)}}const ft=t(t=>{const{getHost:e}=t.getState();return new pt(t,new z((0,c.createRequestSender)({host:e()})),rt(),st())},[{id:"bigcommerce_payments_fastlane"}]),mt=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};class yt extends h{constructor(t){super(t||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}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 vt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.loadingIndicator=n,this.paypalSdkHelper=r}initialize(t){return gt(this,void 0,void 0,function*(){const{methodId:e,bigcommerce_payments_paylater:n}=t||{};if(!e)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(e);const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(e),{paypalBNPLConfiguration:o=[],orderId:a}=i.initializationData||{},{bannerContainerId:s,container:u}=n;if(void 0!==s){if(!document.getElementById(s))return void console.error("Unable to create banner without valid banner container ID.");const t=o&&o.find(({id:t})=>"checkout"===t);if(!(null==t?void 0:t.status))return;const e=yield this.paypalSdkHelper.getPayPalMessages(i,r.getCartOrThrow().currency.code);return this.renderMessages(e,s,t)}a?this.orderId=a:(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(e),this.loadingIndicatorContainer=null==u?void 0:u.split("#")[1],this.renderButton(e,n))})}execute(t,e){return gt(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 U(["payment"]);if(!this.orderId)throw new N;yield this.paymentIntegrationService.submitOrder(r,e),yield this.bigCommercePaymentsIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new R)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.bigCommercePaymentsButtons)||void 0===t||t.close(),Promise.resolve()}renderButton(t,e){if(!(null==e?void 0:e.container))throw new M('Unable to initialize payment because "container" argument is not provided.');const n=this.bigCommercePaymentsIntegrationService.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 h=!1;d.forEach(t=>{if(h)return;const e={fundingSource:t,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),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.bigCommercePaymentsButtons=n.Buttons(e),this.bigCommercePaymentsButtons.isEligible()||t!==n.FUNDING.PAYLATER){if(!this.bigCommercePaymentsButtons.isEligible()&&t===n.FUNDING.CREDIT)throw new yt(`BigCommercePayments ${t} is not available for your region. Please use BigCommercePayments Checkout instead.`);u&&"function"==typeof u&&u(),this.bigCommercePaymentsButtons.render(a),h=!0}})}handleClick(t,e){return gt(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;e&&"function"==typeof e&&(yield 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:mt(n)};t.Messages(r).render(`#${e}`)}}const bt=t(t=>new vt(t,D(t),new o({containerStyles:a}),rt()),[{id:"bigcommerce_payments_paylater"}]);class _t extends g{constructor(t){super(t,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}var wt=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=3e3,i=3e5){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=d.noop}initialize(t){return wt(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,bigcommerce_payments_ratepay:r}=t;if(!n)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new M('Unable to initialize payment because "options.bigcommerce_payments_ratepay" argument is not provided.');const{legalTextContainer:i,container:o,loadingContainerId:a}=r;if(!o)throw new M('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new M('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new M('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 M("Unable to initialize payment because merchantId argument is not provided.");this.bigcommerce_payments_ratepay=r,yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n),this.createFraudNetScript(u,n,e),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(t,e){return wt(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.bigcommerce_payments_ratepay||{};if(!n)throw new U(["payment"]);if(!i||"function"!=typeof i)throw new M('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const t=yield this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apmscheckout",{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 R)}deinitialize(){const{legalTextContainer:t}=this.bigcommerce_payments_ratepay||{},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.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),u=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new M('Unable to initialize payment because "legalTextContainerElement" argument is not found.');u.render(`#${n}`)}handleError(t){const{onError:e}=this.bigcommerce_payments_ratepay||{};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 wt(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}initializePollingMechanism(t,e,n,r){return wt(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.bigCommercePaymentsIntegrationService.getOrderStatus("bigcommerce_payments_apms",{params:{useMetadata:!0}}),o=i===C.PollingStop,a=i===C.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,bigcommerce_payments_ratepay:this.bigcommerce_payments_ratepay}),this.handleError(new _t)}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 Pt=t(t=>new St(t,D(t),new o({containerStyles:Object.assign(Object.assign({},a),{position:"fixed"})})),[{gateway:"bigcommerce_payments_apms",id:"ratepay"}]);var It;!function(t){t.CardCode="cardCode",t.CardCodeVerification="cardCodeVerification",t.CardExpiry="cardExpiry",t.CardName="cardName",t.CardNumber="cardNumber",t.CardNumberVerification="cardNumberVerification",t.CardExpiryVerification="cardExpiryVerification"}(It||(It={}));const Ct=It;function Ot(t){return Ct.CardNumber in t&&Ct.CardName in t&&Ct.CardExpiry in t}function At(t){return Ct.CardNumberVerification in t&&Ct.CardCodeVerification in t&&Ct.CardExpiryVerification in t}class kt extends h{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 Et;!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"}(Et||(Et={}));class jt extends h{constructor(t){super(function(t){switch(t){case Et.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case Et.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case Et.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case Et.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 xt extends h{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 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){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.bigCommercePaymentsSdk=n,this.bigCommercePaymentsFastlaneUtils=r}initialize(t){return Tt(this,void 0,void 0,function*(){const{methodId:e,bigcommerce_payments_creditcards:n}=t,r=n,{form:i,onCreditCardFieldsRenderingError:o,onLoadComplete:a}=r||{};if(!e)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new M('Unable to proceed because "options.bigcommerce_payments_creditcards.form" argument is not provided.');this.hostedFormOptions=i,this.isCreditCardForm=Ot(i.fields),this.isCreditCardVaultedForm=At(i.fields)&&!this.hasUndefinedValues(),yield this.paymentIntegrationService.loadPaymentMethod(e),yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(e,void 0,!0,!0),null==a||a(),(this.isCreditCardForm||this.isCreditCardVaultedForm)&&(yield this.initializeFields(i,o)),this.shouldInitializePayPalFastlane(e)&&(yield this.initializePayPalFastlaneOrThrow(e))})}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"]),{methodId:i,paymentData:o}=n||{};if(!n||!i)throw new U(["payment"]);if(this.executionPaymentData=o,this.isCreditCardForm||this.isCreditCardVaultedForm)yield this.validateHostedFormOrThrow(),yield this.submitHostedForm();else{const{orderId:t}=yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",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 R)}deinitialize(){var t,e,n,r;return Tt(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}=L(e)?e:{},a=e&&V(e)?e.instrumentId:void 0,s=(0,d.omitBy)({verification_nonce:r,token:a},d.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 Tt(this,void 0,void 0,function*(){const{fields:n,styles:r}=t,i=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),o=this.getExecuteCallback(n),a=Object.assign({style:this.getInputStyles(r),onApprove:({orderID:t,vaultSetupToken:e,liabilityShift:n})=>{if(n===b.No||n===b.Unknown)throw new Error;return this.handleApprove({orderID:t,vaultSetupToken:e})},onError:()=>{throw new kt},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 jt(Et.PaymentNotInitialized);try{this.stylizeInputContainers(n),Ot(n)&&(yield this.renderFields(n)),At(n)&&(yield this.renderVaultedFields(n))}catch(t){"function"==typeof e&&e(t)}})}getExecuteCallback(t){return At(t)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>Tt(this,void 0,void 0,function*(){const{setupToken:t}=(yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",Object.assign(Object.assign({},this.getInstrumentParams()),{setupToken:!0})))||{};return t})}}createOrderCallback(){return{createOrder:()=>Tt(this,void 0,void 0,function*(){const{orderId:t}=(yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",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 Tt(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 Tt(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(L(this.executionPaymentData)){const{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}=this.executionPaymentData;return{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}}if(V(this.executionPaymentData)){const{instrumentId:t}=this.executionPaymentData;return{instrumentId:t}}return{}}getFieldTypeByEmittedField({emittedBy:t}){return{fieldType:this.mapFieldType(t)}}submitHostedForm(){return Tt(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 kt("Failed authentication. Please try to authorize again.")}})}validateHostedFormOrThrow(){var t,e;return Tt(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 xt(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 Ct.CardCode:case Ct.CardCodeVerification:return{fieldType:t,message:"Invalid card code",type:"invalid_card_code"};case Ct.CardNumber:case Ct.CardNumberVerification:return{fieldType:t,message:"Invalid card number",type:"invalid_card_number"};case Ct.CardExpiry:case Ct.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 Ct.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?Ct.CardNumber:Ct.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?Ct.CardExpiry:Ct.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?Ct.CardCode:Ct.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new jt(Et.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.isBigCommercePaymentsAnalyticsV2Enabled)&&!(null==a?void 0:a.authenticationState)}initializePayPalFastlaneOrThrow(t){return Tt(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.bigCommercePaymentsSdk.getPayPalFastlaneSdk(r,n.currency.code,n.id);yield this.bigCommercePaymentsFastlaneUtils.initializePayPalFastlane(o,!!(null==i?void 0:i.isDeveloperModeApplicable))}catch(t){}})}}const Bt=t(t=>new zt(t,D(t),rt(),st()),[{id:"bigcommerce_payments_creditcards"}]);var Ft=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 Dt{constructor(t,e,n,r,i=3e3,o=3e5){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.bigCommercePaymentsSdkHelper=n,this.loadingIndicator=r,this.pollingInterval=i,this.maxPollingIntervalTime=o,this.pollingTimer=0,this.stopPolling=d.noop,this.isPollingEnabled=!1}initialize(t){return Ft(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,bigcommerce_payments_apms:r}=t;if(this.bigCommercePaymentsAlternativeMethods=r,!n)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new M('Unable to initialize payment because "options.bigcommerce_payments_apms" argument is not provided.');const i=this.paymentIntegrationService.getState(),o=i.getPaymentMethodOrThrow(n,e),{orderId:a,shouldRenderFields:s}=o.initializationData||{},u=i.getStoreConfigOrThrow().checkoutSettings.features;this.isPollingEnabled=dt(u,"PAYPAL-5624.bcp_ideal_polling"),a?this.orderId=a:(this.paypalApms=yield this.bigCommercePaymentsSdkHelper.getPayPalApmsSdk(o,i.getCartOrThrow().currency.code),this.loadingIndicatorContainer=r.container.split("#")[1],this.renderButton(n,e,r),s&&this.renderFields(n,r))})}execute(t,e){return Ft(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 U(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new N;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.bigCommercePaymentsIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new R)}deinitialize(){var t;return this.orderId=void 0,this.isPollingEnabled&&this.resetPollingMechanism(),null===(t=this.bigCommercePaymentsButton)||void 0===t||t.close(),Promise.resolve()}initializePollingMechanism(t,e,n,r){return Ft(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.bigCommercePaymentsIntegrationService.getOrderStatus(r),o=i===C.Approved,a=i===C.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,bigCommercePaymentsAlternativeMethods:this.bigCommercePaymentsAlternativeMethods}),this.handleError(new _t)}catch(t){n()}})}deInitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deInitializePollingMechanism()}reinitializeStrategy(t){return Ft(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}handleError(t){const{onError:e}=this.bigCommercePaymentsAlternativeMethods||{};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.bigCommercePaymentsIntegrationService.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)=>Ft(this,void 0,void 0,function*(){return n.onValidate(e.resolve,e.reject)})};this.bigCommercePaymentsButton=r.Buttons(l),this.bigCommercePaymentsButton.isEligible()&&(u&&"function"==typeof u&&u(),this.bigCommercePaymentsButton.render(a))}onCreateOrder(t,e,n){return Ft(this,void 0,void 0,function*(){const{onValidate:r}=n;yield r(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),d.noop);const i=yield this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apms");if(this.isNonInstantPaymentMethod(t)){const n={useStoreCredit:!1},r={params:{methodId:t,gatewayId:e}};yield this.paymentIntegrationService.submitOrder(n,r),yield this.bigCommercePaymentsIntegrationService.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 M('Unable to initialize payment because "options.bigcommerce_payments_apms" 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 I}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new p;return this.paypalApms}}const Mt=t(t=>new Dt(t,D(t),rt(),new o({containerStyles:a})),[{gateway:"bigcommerce_payments_apms"}]);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){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.loadingIndicator=n}initialize(t){var e,n;return Ut(this,void 0,void 0,function*(){const{methodId:r,bigcommerce_payments_venmo:i}=t||{};if(!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(r);const o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(r);(null===(e=o.initializationData)||void 0===e?void 0:e.orderId)?this.orderId=null===(n=o.initializationData)||void 0===n?void 0:n.orderId:(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(r),this.loadingIndicatorContainer=i.container.split("#")[1],this.renderButton(r,i))})}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 U(["payment"]);if(!this.orderId)throw new N;yield this.paymentIntegrationService.submitOrder(r,e),yield this.bigCommercePaymentsIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new R)}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.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmo_checkout"),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 yt("Venmo is not available for your region. Please another payment method instead.");u&&"function"==typeof u&&u(),this.paypalButton.render(a)}handleClick(t,e){return Ut(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;yield 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=t(t=>new Nt(t,D(t),new o({styles:{backgroundColor:"black"}})),[{id:"bigcommerce_payments_venmo"}]);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.bigCommercePaymentsIntegrationService=e,this.onError=d.noop}initialize(t){return Lt(this,void 0,void 0,function*(){const{bigcommerce_payments:e,methodId:n}=t;if(!n)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');if(!e.container)throw new M('Unable to initialize payment because "options.bigcommerce_payments.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new M('Unable to initialize payment because "options.bigcommerce_payments.onClick" argument is not a function.');this.onError=e.onError||d.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.bigCommercePaymentsIntegrationService.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){const{container:n,onClick:r,onComplete:i}=e,o=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:s,paymentButtonStyles:u}=a.initializationData||{},{checkoutTopButtonStyles:c}=u||{},l=Object.assign({createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},r&&{onClick:()=>r()}),d={onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t),onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,i)},h=Object.assign(Object.assign({fundingSource:o.FUNDING.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},c),{height:36}))},l),s&&d),p=o.Buttons(h);p.isEligible()?p.render(`#${n}`):this.bigCommercePaymentsIntegrationService.removeElement(n)}onHostedCheckoutApprove(t,e,n,r){return Lt(this,void 0,void 0,function*(){if(!t.orderID)throw new f(s.MissingOrderId);const i=this.paymentIntegrationService.getState().getCartOrThrow(),o=yield e.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(o);if(yield this.paymentIntegrationService.updateBillingAddress(e),i.lineItems.physicalItems.length>0){const t=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(o);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.bigCommercePaymentsIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return Lt(this,void 0,void 0,function*(){const e=this.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}onShippingOptionsChange(t){return Lt(this,void 0,void 0,function*(){const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}}const qt=t(t=>new Vt(t,D(t)),[{id:"bigcommerce_payments"}]);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 Ht{constructor(t,e,n){this.paymentIntegrationService=t,this.bigCommercePaymentsSdk=e,this.bigCommercePaymentsFastlaneUtils=n}initialize(t){var e;return $t(this,void 0,void 0,function*(){const{methodId:n,bigcommerce_payments_fastlane:r}=t;if(!n)throw new M('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.bigCommercePaymentsSdk.getPayPalFastlaneSdk(o,i.currency.code,i.id);yield this.bigCommercePaymentsFastlaneUtils.initializePayPalFastlane(s,a,this.getFastlaneStyles(n,r))}catch(t){}return Promise.resolve()})}deinitialize(){return $t(this,void 0,void 0,function*(){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){return $t(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:e,continueWithCheckoutCallback:n,methodId:r}=t||{};if(!r)throw new M('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new M('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 $t(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.bigCommercePaymentsFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.bigCommercePaymentsFastlaneUtils.triggerAuthenticationFlowOrThrow(a),u=s.authenticationState===tt.CANCELED;yield this.updateCustomerDataState(t,s),u?this.bigCommercePaymentsFastlaneUtils.removeStorageSessionId():this.bigCommercePaymentsFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(t,e){var n;return $t(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:u}=this.bigCommercePaymentsFastlaneUtils.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 ct(i?r:{},null==e?void 0:e.styles)}}const Wt=t(t=>new Ht(t,rt(),st()),[{id:"bigcommerce_payments_fastlane"},{id:"bigcommerce_payments_creditcards"}]);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.bigCommercePaymentsIntegrationService=e,this.onError=d.noop}initialize(t){return Gt(this,void 0,void 0,function*(){const{bigcommerce_payments_paylater:e,methodId:n}=t;if(!n)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');if(!e.container)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater.onClick" argument is not a function.');this.onError=e.onError||d.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC BigCommercePayments PayLater]: 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,onComplete:r,onClick:i}=e,o=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:s,paymentButtonStyles:u}=a.initializationData||{},{checkoutTopButtonStyles:c}=u||{},l=Object.assign({createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},i&&{onClick:()=>i()}),d={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 p=!1;h.forEach(t=>{if(!p){const e=Object.assign(Object.assign({fundingSource:t,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},c),{height:36}))},l),s&&d),r=o.Buttons(e);r.isEligible()&&(r.render(`#${n}`),p=!0)}}),p||this.bigCommercePaymentsIntegrationService.removeElement(n)}onHostedCheckoutApprove(t,e,n,r){return Gt(this,void 0,void 0,function*(){if(!t.orderID)throw new f(s.MissingOrderId);const i=this.paymentIntegrationService.getState().getCartOrThrow(),o=yield e.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(o);if(yield this.paymentIntegrationService.updateBillingAddress(e),i.lineItems.physicalItems.length>0){const t=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(o);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.bigCommercePaymentsIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return Gt(this,void 0,void 0,function*(){const e=this.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}onShippingOptionsChange(t){return Gt(this,void 0,void 0,function*(){const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}}const Kt=t(t=>new Yt(t,D(t)),[{id:"bigcommerce_payments_paylater"}]);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){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e}initialize(t){return Jt(this,void 0,void 0,function*(){const{bigcommerce_payments_venmo:e,methodId:n}=t;if(!n)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo" argument is not provided.');if(!e.container)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC Payments Venmo]: Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){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){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.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:a}=o.initializationData||{},{checkoutTopButtonStyles:s}=a||{},u=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},s),{height:36})),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmo"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},r&&{onClick:()=>r()}),c=i.Buttons(u);c.isEligible()?c.render(`#${n}`):this.bigCommercePaymentsIntegrationService.removeElement(n)}}const Xt=t(t=>new Zt(t,D(t)),[{id:"bigcommerce_payments_venmo"}]);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.bigCommercePaymentsIntegrationService=e}initialize(t){var e;return Qt(this,void 0,void 0,function*(){const{bigcommerce_payments:n,containerId:r,methodId:i}=t,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new M('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new M('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');if(o&&!n.currencyCode)throw new M('Unable to initialize payment because "options.bigcommerce_payments.currencyCode" argument is not provided.');if(o&&"function"!=typeof(null===(e=n.buyNowInitializeOptions)||void 0===e?void 0:e.getBuyNowCartRequestBody))throw new M('Unable to initialize payment because "options.bigcommerce_payments.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.bigCommercePaymentsIntegrationService.loadPayPalSdk(i,a,!1),this.renderButton(r,i,n)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:c}=u.initializationData||{},l={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)},d={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h={onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t),onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,o)},p=Object.assign(Object.assign(Object.assign({fundingSource:s.FUNDING.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(i)},l),r&&d),c&&h),f=s.Buttons(p);f.isEligible()?f.render(`#${t}`):a&&"function"==typeof a?a():this.bigCommercePaymentsIntegrationService.removeElement(t)}handleClick(t){return Qt(this,void 0,void 0,function*(){if(t){const e=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(t,e,n,r){return Qt(this,void 0,void 0,function*(){if(!t.orderID)throw new f(s.MissingOrderId);const i=this.paymentIntegrationService.getState().getCartOrThrow(),o=yield e.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(o);if(yield this.paymentIntegrationService.updateBillingAddress(e),i.lineItems.physicalItems.length>0){const t=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(o);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.bigCommercePaymentsIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r(),!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.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}}const ee=t(t=>new te(t,D(t)),[{id:"bigcommerce_payments"}]);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.bigCommercePaymentsIntegrationService=e,this.payPalSdkHelper=n}initialize(t){return ne(this,void 0,void 0,function*(){const{bigcommerce_payments_paylater:e,containerId:n,methodId:r}=t,{buyNowInitializeOptions:i,currencyCode:o,messagingContainerId:a}=e||{},s=!!i;if(!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new M('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');if(s&&!o)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater.currencyCode" argument is not provided.');if(s&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');s||(yield this.paymentIntegrationService.loadDefaultCheckout());const u=this.paymentIntegrationService.getState(),c=s?o:u.getCartOrThrow().currency.code;yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(r,c,!1),this.renderButton(n,r,e);const l=a&&document.getElementById(a);if(c&&l){const t=u.getPaymentMethodOrThrow(r),{paypalBNPLConfiguration:e=[]}=t.initializationData||{},n=e&&e.find(({id:t})=>"cart"===t);if(!(null==n?void 0:n.status))return;l.removeAttribute("data-pp-style-logo-type"),l.removeAttribute("data-pp-style-logo-position"),l.removeAttribute("data-pp-style-text-color"),l.removeAttribute("data-pp-style-text-size");const i=yield this.payPalSdkHelper.getPayPalMessages(t,c);this.renderMessages(i,a,n)}})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:c}=u.initializationData||{},l={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)},d={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h={onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t),onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,o)},p=[s.FUNDING.PAYLATER,s.FUNDING.CREDIT];let f=!1;p.forEach(e=>{if(!f){const n=Object.assign(Object.assign(Object.assign({fundingSource:e,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(i)},l),r&&d),c&&h),o=s.Buttons(n);o.isEligible()?(o.render(`#${t}`),f=!0):a&&"function"==typeof a&&a()}}),f||this.bigCommercePaymentsIntegrationService.removeElement(t)}handleClick(t){return ne(this,void 0,void 0,function*(){if(t){const e=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(t,e,n,r){return ne(this,void 0,void 0,function*(){if(!t.orderID)throw new f(s.MissingOrderId);const i=this.paymentIntegrationService.getState().getCartOrThrow(),o=yield e.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(o);if(yield this.paymentIntegrationService.updateBillingAddress(e),i.lineItems.physicalItems.length>0){const t=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(o);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.bigCommercePaymentsIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r(),!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.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.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:mt(n)};t.Messages(r).render(`#${e}`)}}const ie=t(t=>new re(t,D(t),rt()),[{id:"bigcommerce_payments_paylater"}]);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.bigCommercePaymentsIntegrationService=e}initialize(t){return oe(this,void 0,void 0,function*(){const{bigcommerce_payments_apms:e,containerId:n,methodId:r}=t,{apm:i,buyNowInitializeOptions:o,currencyCode:a}=e||{},s=!!o;if(!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new M('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments_apms" argument is not provided.');if(!i)throw new M('Unable to initialize payment because "options.bigcommerce_payments_apms.apm" argument is not provided.');if(s&&!a)throw new M('Unable to initialize payment because "options.bigcommerce_payments_apms.currencyCode" argument is not provided.');if(s&&"function"!=typeof(null==o?void 0:o.getBuyNowCartRequestBody))throw new M('Unable to initialize payment because "options.bigcommerce_payments_apms.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.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow();if(!Object.values(s.FUNDING).includes(r))throw new M('Unable to initialize PayPal button because "options.bigcommerce_payments_apms.apm" argument is not valid funding source.');const u={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apms"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)},c={onClick:()=>this.handleClick(i),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:r,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o)},u),i&&c),d=s.Buttons(l);d.isEligible()?d.render(`#${t}`):a&&"function"==typeof a?a():this.bigCommercePaymentsIntegrationService.removeElement(t)}handleClick(t){return oe(this,void 0,void 0,function*(){if(t){const e=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const se=t(t=>new ae(t,D(t)),[{id:"bigcommerce_payments_apms"}]);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.bigCommercePaymentsIntegrationService=e}initialize(t){return ue(this,void 0,void 0,function*(){const{bigcommerce_payments_venmo:e,containerId:n,methodId:r}=t,{buyNowInitializeOptions:i,currencyCode:o}=e||{},a=!!i;if(!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new M('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo" argument is not provided.');if(a&&!o)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo.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.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),s=a.FUNDING.VENMO,u={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmo"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.removeElement(t)}getValidVenmoButtonStyles(t){const e=this.bigCommercePaymentsIntegrationService.getValidButtonStyle(t);return e.color===S.gold?Object.assign(Object.assign({},e),{color:void 0}):e}handleClick(t){return ue(this,void 0,void 0,function*(){if(t){const e=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const le=t(t=>new ce(t,D(t)),[{id:"bigcommerce_payments_venmo"}])})(),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,h,p,f="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,m="object"==typeof self&&self&&self.Object===Object&&self,y=f||m||Function("return this")(),g=e&&!e.nodeType&&e,v=g&&t&&!t.nodeType&&t,b=v&&v.exports===g,_=b&&f.process,w=function(){try{return v&&v.require&&v.require("util").types||_&&_.binding&&_.binding("util")}catch(t){}}(),S=w&&w.isTypedArray,P=Array.prototype,I=Function.prototype,C=Object.prototype,O=y["__core-js_shared__"],A=I.toString,k=C.hasOwnProperty,E=(d=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+d:"",j=C.toString,x=A.call(Object),T=RegExp("^"+A.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z=b?y.Buffer:void 0,B=y.Symbol,F=y.Uint8Array,D=(z&&z.allocUnsafe,h=Object.getPrototypeOf,p=Object,function(t){return h(p(t))}),M=Object.create,U=C.propertyIsEnumerable,N=P.splice,R=B?B.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,H=st(y,"Map"),W=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&&!ht(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)&&ht(r,n)&&(void 0!==n||e in t)||et(t,e,n)}function tt(t,e){for(var n=t.length;n--;)if(ht(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__=W?W(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(W){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 W?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]=W&&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(H||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(!H||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 _t(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,h,p,f,m,y=o?o(u,c,n+"",t,e,a):void 0,g=void 0===y;if(g){var v=ft(c),b=!v&&yt(c),_=!v&&!b&&wt(c);y=c,v||b||_?ft(u)?y=u:_t(m=u)&&mt(m)?y=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(u):b?(g=!1,y=function(t){return t.slice()}(c)):_?(g=!1,f=new(p=(d=c).buffer).constructor(p.byteLength),new F(f).set(new F(p)),h=f,y=new d.constructor(h,d.byteOffset,d.length)):y=[]:function(t){if(!_t(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)||pt(c)?(y=u,pt(u)?y=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,St(t))}(u):bt(u)&&!gt(u)||(y=function(t){return"function"!=typeof t.constructor||ct(t)?{}:G(D(t))}(c))):g=!1}g&&(a.set(c,y),i(y,c,r,o,a),a.delete(c)),X(t,n,y)}}(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)}},St)}var ot=L?function(t,e){return L(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:Ct;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))&&(gt(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||C)}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 ht(t,e){return t===e||t!=t&&e!=e}var pt=rt(function(){return arguments}())?rt:function(t){return _t(t)&&k.call(t,"callee")&&!U.call(t,"callee")},ft=Array.isArray;function mt(t){return null!=t&&vt(t.length)&&!gt(t)}var yt=V||function(){return!1};function gt(t){if(!bt(t))return!1;var e=nt(t);return e==a||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}function vt(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 _t(t){return null!=t&&"object"==typeof t}var wt=S?function(t){return function(e){return t(e)}}(S):function(t){return _t(t)&&vt(t.length)&&!!l[nt(t)]};function St(t){return mt(t)?function(t,e){var n=ft(t),r=!n&&pt(t),i=!n&&!r&&yt(t),o=!n&&!r&&!i&&wt(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 Pt,It=(Pt=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,Ct),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=Pt.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?mt(n)&&ut(e,n.length):"string"==r&&e in n)&&ht(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&&Pt(t,a,n)}return t}));function Ct(t){return t}t.exports=It},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,h=4294967295,p=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],f="[object Arguments]",m="[object Array]",y="[object Boolean]",g="[object Date]",v="[object Error]",b="[object Function]",_="[object GeneratorFunction]",w="[object Map]",S="[object Number]",P="[object Object]",I="[object Promise]",C="[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]",B="[object Int8Array]",F="[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,H=/[&<>"']/g,W=RegExp($.source),G=RegExp(H.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*$/,ht=/^[-+]0x[0-9a-f]+$/i,pt=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,_t="\\ud800-\\udfff",wt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",St="\\u2700-\\u27bf",Pt="a-z\\xdf-\\xf6\\xf8-\\xff",It="A-Z\\xc0-\\xd6\\xd8-\\xde",Ct="\\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="["+_t+"]",kt="["+Ot+"]",Et="["+wt+"]",jt="\\d+",xt="["+St+"]",Tt="["+Pt+"]",zt="[^"+_t+Ot+jt+St+Pt+It+"]",Bt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+_t+"]",Dt="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ut="["+It+"]",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+"|"+Bt+")?",Ht="["+Ct+"]?",Wt=Ht+$t+"(?:"+Nt+"(?:"+[Ft,Dt,Mt].join("|")+")"+Ht+$t+")*",Gt="(?:"+[xt,Dt,Mt].join("|")+")"+Wt,Yt="(?:"+[Ft+Et+"?",Et,Dt,Mt,At].join("|")+")",Kt=RegExp("['’]","g"),Jt=RegExp(Et,"g"),Zt=RegExp(Bt+"(?="+Bt+")|"+Yt+Wt,"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+_t+wt+Ct+"]"),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[B]=re[F]=re[D]=re[M]=re[U]=re[N]=re[R]=!0,re[f]=re[m]=re[j]=re[y]=re[x]=re[g]=re[v]=re[b]=re[w]=re[S]=re[P]=re[C]=re[O]=re[A]=re[E]=!1;var ie={};ie[f]=ie[m]=ie[j]=ie[x]=ie[y]=ie[g]=ie[T]=ie[z]=ie[B]=ie[F]=ie[D]=ie[w]=ie[S]=ie[P]=ie[C]=ie[O]=ie[A]=ie[k]=ie[M]=ie[U]=ie[N]=ie[R]=!0,ie[v]=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,he=de&&t&&!t.nodeType&&t,pe=he&&he.exports===de,fe=pe&&ue.process,me=function(){try{return he&&he.require&&he.require("util").types||fe&&fe.binding&&fe.binding("util")}catch(t){}}(),ye=me&&me.isArrayBuffer,ge=me&&me.isDate,ve=me&&me.isMap,be=me&&me.isRegExp,_e=me&&me.isSet,we=me&&me.isTypedArray;function Se(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 Pe(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 Ie(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}function Ce(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 Be(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 Fe=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?He(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 He(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 We(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({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});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):Fe(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 hn=qe({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),pn=function t(e){var n,rt=(e=null==e?le:pn.defaults(le.Object(),e,pn.pick(le,ee))).Array,_t=e.Date,wt=e.Error,St=e.Function,Pt=e.Math,It=e.Object,Ct=e.RegExp,Ot=e.String,At=e.TypeError,kt=rt.prototype,Et=St.prototype,jt=It.prototype,xt=e["__core-js_shared__"],Tt=Et.toString,zt=jt.hasOwnProperty,Bt=0,Ft=(n=/[^.]+$/.exec(xt&&xt.keys&&xt.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Dt=jt.toString,Mt=Tt.call(It),Ut=le._,Nt=Ct("^"+Tt.call(zt).replace(tt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Rt=pe?e.Buffer:r,Lt=e.Symbol,Vt=e.Uint8Array,qt=Rt?Rt.allocUnsafe:r,$t=on(It.getPrototypeOf,It),Ht=It.create,Wt=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(It,"defineProperty");return t({},"",{}),t}catch(t){}}(),ue=e.clearTimeout!==le.clearTimeout&&e.clearTimeout,ce=_t&&_t.now!==le.Date.now&&_t.now,de=e.setTimeout!==le.setTimeout&&e.setTimeout,he=Pt.ceil,fe=Pt.floor,me=It.getOwnPropertySymbols,Fe=Rt?Rt.isBuffer:r,qe=e.isFinite,fn=kt.join,mn=on(It.keys,It),yn=Pt.max,gn=Pt.min,vn=_t.now,bn=e.parseInt,_n=Pt.random,wn=kt.reverse,Sn=uo(e,"DataView"),Pn=uo(e,"Map"),In=uo(e,"Promise"),Cn=uo(e,"Set"),On=uo(e,"WeakMap"),An=uo(It,"create"),kn=On&&new On,En={},jn=Mo(Sn),xn=Mo(Pn),Tn=Mo(In),zn=Mo(Cn),Bn=Mo(On),Fn=Lt?Lt.prototype:r,Dn=Fn?Fn.valueOf:r,Mn=Fn?Fn.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(Ht)return Ht(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__=h,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 Hn(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.__data__=new Hn;++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?We(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)||yo(c,u))||s.push(c);return s}function Kn(t){var e=t.length;return e?t[Hr(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:Cs(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 h=ho(t),p=h==b||h==_;if(Ga(t))return _i(t,u);if(h==P||h==f||p&&!o){if(s=c||p?{}: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[h])return o?t:{};s=function(t,e,n){var r,i=t.constructor;switch(e){case j:return wi(t);case y:case g:return new i(+t);case x:return function(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,n);case T:case z:case B:case F:case D:case M:case U:case N:case R:return Si(t,n);case w:return new i;case S:case A:return new i(t);case C: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?It(Dn.call(r)):{}}}(t,h,u)}}a||(a=new Gn);var m=a.get(t);if(m)return m;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 v=d?r:(l?c?eo:to:c?xs:js)(t);return Ie(v||t,function(r,i){v&&(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=It(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 Wn(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 h=c;h--;)if(e[h]===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},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(Pn||$n),string:new qn}},Hn.prototype.delete=function(t){var e=ao(this,t).delete(t);return this.size-=e?1:0,e},Hn.prototype.get=function(t){return ao(this,t).get(t)},Hn.prototype.has=function(t){return ao(this,t).has(t)},Hn.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},Wn.prototype.add=Wn.prototype.push=function(t){return this.__data__.set(t,o),this},Wn.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(!Pn||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(t,e),this.size=n.size,this};var lr=ji(vr),dr=ji(br,!0);function hr(t,e){var n=!0;return lr(t,function(t,r,i){return n=!!e(t,r,i)}),n}function pr(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 mr(t,e,n,r,i){var o=-1,a=t.length;for(n||(n=mo),i||(i=[]);++o<a;){var s=t[o];e>0&&n(s)?e>1?mr(s,e-1,n,r,i):xe(i,s):r||(i[i.length]=s)}return i}var yr=xi(),gr=xi(!0);function vr(t,e){return t&&yr(t,e,js)}function br(t,e){return t&&gr(t,e,js)}function _r(t,e){return Ae(e,function(e){return Ja(t[e])})}function wr(t,e){for(var n=0,i=(e=yi(e,t)).length;null!=t&&n<i;)t=t[Do(e[n++])];return n&&n==i?t:r}function Sr(t,e,n){var r=e(t);return qa(t)?r:xe(r,n(t))}function Pr(t){return null==t?t===r?"[object Undefined]":"[object Null]":Qt&&Qt in It(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 Ir(t,e){return t>e}function Cr(t,e){return null!=t&&zt.call(t,e)}function Or(t,e){return null!=t&&e in It(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=gn(d.length,c),u[s]=!n&&(e||o>=120&&d.length>=120)?new Wn(s&&d):r}d=t[0];var h=-1,p=u[0];t:for(;++h<o&&l.length<c;){var f=d[h],m=e?e(f):f;if(f=n||0!==f?f:0,!(p?Je(p,m):i(l,m,n))){for(s=a;--s;){var y=u[s];if(!(y?Je(y,m):i(t[s],m,n)))continue t}p&&p.push(m),l.push(f)}}return l}function kr(t,e,n){var i=null==(t=Co(t,e=yi(e,t)))?t:t[Do(Ko(e))];return null==i?r:Se(i,t,n)}function Er(t){return ts(t)&&Pr(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?m:ho(t),l=u?m:ho(e),d=(c=c==f?P:c)==P,h=(l=l==f?P:l)==P,p=c==l;if(p&&Ga(t)){if(!Ga(e))return!1;s=!0,d=!1}if(p&&!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 y:case g:case S:return Na(+t,+e);case v:return t.name==e.name&&t.message==e.message;case C:case A:return t==e+"";case w: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__"),_=h&&zt.call(e,"__wrapped__");if(b||_){var I=b?t.value():t,E=_?e.value():e;return a||(a=new Gn),o(I,E,n,i,a)}}return!!p&&(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 h=a.get(t),p=a.get(e);if(h&&p)return h==e&&p==t;var f=!0;a.set(t,e),a.set(e,t);for(var m=s;++l<c;){var y=t[d=u[l]],g=e[d];if(i)var v=s?i(g,y,d,e,t,a):i(y,g,d,t,e,a);if(!(v===r?y===g||o(y,g,n,i,a):v)){f=!1;break}m||(m="constructor"==d)}if(f&&!m){var b=t.constructor,_=e.constructor;b==_||!("constructor"in t)||!("constructor"in e)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(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=It(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 h=new Gn;if(i)var p=i(l,d,c,t,e,h);if(!(p===r?jr(d,l,3,i,h):p))return!1}}return!0}function Tr(t){return!(!Qa(t)||(e=t,Ft&&Ft 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 Br(t){if(!wo(t))return mn(t);var e=[];for(var n in It(t))zt.call(t,n)&&"constructor"!=n&&e.push(n);return e}function Fr(t,e){return t<e}function Dr(t,e){var n=-1,r=Ha(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]?Po(e[0][0],e[0][1]):function(n){return n===t||xr(n,t,e)}}function Ur(t,e){return vo(t)&&So(e)?Po(Do(t),e):function(n){var i=Cs(n,t);return i===r&&i===e?Os(n,t):jr(e,i,3)}}function Nr(t,e,n,i,o){t!==e&&yr(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,h=d===r;if(h){var p=qa(c),f=!p&&Ga(c),m=!p&&!f&&us(c);d=c,p||f||m?qa(u)?d=u:Wa(u)?d=Oi(u):f?(h=!1,d=_i(c,!0)):m?(h=!1,d=Si(c,!0)):d=[]:rs(c)||Va(c)?(d=u,Va(u)?d=ys(u):Qa(u)&&!Ja(u)||(d=fo(c))):h=!1}h&&(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 yo(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 wr(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=Pi(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=wr(t,a);n(s,a)&&Jr(o,yi(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;yo(i)?Gt.call(t,i,1):ui(t,i)}}return t}function Hr(t,e){return t+fe(_n()*(e-t+1))}function Wr(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(Io(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=yi(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:yo(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),h=n(t[d]),p=h!==r,f=null===h,m=h==h,y=ss(h);if(s)var g=i||m;else g=l?m&&(i||p):u?m&&p&&(i||!f):c?m&&p&&!f&&(i||!y):!f&&!y&&(i?h<=e:h<e);g?o=d+1:a=d}return gn(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:Wi(t);if(c)return sn(c);a=!1,i=Je,u=new Wn}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 h=u.length;h--;)if(u[h]===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=Co(t,e=yi(e,t)))||delete t[Do(Ko(e))]}function ci(t,e,n,r){return Jr(t,e,n(wr(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 hi(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(mr(o,1),e,n)}function pi(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 Wa(t)?t:[]}function mi(t){return"function"==typeof t?t:nu}function yi(t,e){return qa(t)?t:vo(t,e)?[t]:Fo(gs(t))}var gi=Gr;function vi(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 _i(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 wi(t){var e=new t.constructor(t.byteLength);return new Vt(e).set(new Vt(t)),e}function Si(t,e){var n=e?wi(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function Pi(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 Ii(t,e,n,r){for(var i=-1,o=t.length,a=n.length,s=-1,u=e.length,c=yn(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 Ci(t,e,n,r){for(var i=-1,o=t.length,a=-1,s=n.length,u=-1,c=e.length,l=yn(o-s,0),d=rt(l+c),h=!r;++i<l;)d[i]=t[i];for(var p=i;++u<c;)d[p+u]=e[u];for(;++a<s;)(h||i<o)&&(d[p+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)?Pe: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&&go(n[0],n[1],s)&&(a=o<3?r:a,o=1),e=It(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(!Ha(n))return t(n,r);for(var i=n.length,o=e?i:-1,a=It(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=It(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=gs(e))?ln(e):r,i=n?n[0]:e.charAt(0),o=n?vi(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 Bi(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 Fi(t){return function(e,n,i){var o=It(e);if(!Ha(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 h=e&u,p=1&e,f=2&e,m=24&e,y=512&e,g=f?r:Bi(t);return function u(){for(var v=arguments.length,b=rt(v),_=v;_--;)b[_]=arguments[_];if(m)var w=io(u),S=function(t,e){for(var n=t.length,r=0;n--;)t[n]===e&&++r;return r}(b,w);if(i&&(b=Ii(b,i,o,m)),a&&(b=Ci(b,a,s,m)),v-=S,m&&v<d){var P=an(b,w);return $i(t,e,Mi,u.placeholder,n,b,P,c,l,d-v)}var I=p?n:this,C=f?I[t]:t;return v=b.length,c?b=function(t,e){for(var n=t.length,i=gn(e.length,n),o=Oi(t);i--;){var a=e[i];t[i]=yo(a,n)?o[a]:r}return t}(b,c):y&&v>1&&b.reverse(),h&&l<v&&(b.length=l),this&&this!==le&&this instanceof u&&(C=g||Bi(C)),C.apply(I,b)}}function Ui(t,e){return function(n,r){return function(t,e,n,r){return vr(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 Se(t,r,n)})})})}function Li(t,e){var n=(e=e===r?" ":ai(e)).length;if(n<2)return n?Wr(e,t):e;var i=Wr(e,he(t/cn(e)));return nn(e)?vi(ln(i),0,t).join(""):i.slice(0,t)}function Vi(t){return function(e,n,i){return i&&"number"!=typeof i&&go(e,n,i)&&(n=i=r),e=hs(e),n===r?(n=e,e=0):n=hs(n),function(t,e,n,r){for(var i=-1,o=yn(he((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:hs(i),t)}}function qi(t){return function(e,n){return"string"==typeof e&&"string"==typeof n||(e=ms(e),n=ms(n)),t(e,n)}}function $i(t,e,n,i,o,a,u,c,l,d){var h=8&e;e|=h?s:64,4&(e&=~(h?64:s))||(e&=-4);var p=[t,e,o,h?a:r,h?u:r,h?r:a,h?r:u,c,l,d],f=n.apply(r,p);return bo(t)&&Ao(f,p),f.placeholder=i,jo(f,t,e)}function Hi(t){var e=Pt[t];return function(t,n){if(t=ms(t),(n=null==n?0:gn(ps(n),292))&&qe(t)){var r=(gs(t)+"e").split("e");return+((r=(gs(e(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}var Wi=Cn&&1/sn(new Cn([,-0]))[1]==c?function(t){return new Cn(t)}:su;function Gi(t){return function(e){var n=ho(e);return n==w?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,h){var p=2&e;if(!p&&"function"!=typeof t)throw new At(i);var f=o?o.length:0;if(f||(e&=-97,o=c=r),d=d===r?d:yn(ps(d),0),h=h===r?h:ps(h),f-=c?c.length:0,64&e){var m=o,y=c;o=c=r}var g=p?r:no(t),v=[t,e,n,o,c,m,y,l,d,h];if(g&&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?Ii(l,c,e[4]):c,t[4]=l?an(t[3],a):e[4]}(c=e[5])&&(l=t[5],t[5]=l?Ci(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]:gn(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(v,g),t=v[0],e=v[1],n=v[2],o=v[3],c=v[4],!(h=v[9]=v[9]===r?p?0:t.length:yn(v[9]-f,0))&&24&e&&(e&=-25),e&&1!=e)b=8==e||16==e?function(t,e,n){var i=Bi(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):Se(this&&this!==le&&this instanceof o?i:t,this,s)}}(t,e,h):e!=s&&33!=e||c.length?Mi.apply(r,v):function(t,e,n,r){var i=1&e,o=Bi(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 Se(d,i?n:this,l)}}(t,e,n,o);else var b=function(t,e,n){var r=1&e,i=Bi(t);return function e(){return(this&&this!==le&&this instanceof e?i:t).apply(r?n:this,arguments)}}(t,e,n);return jo((g?Zr:Ao)(b,v),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 h=-1,p=!0,f=2&n?new Wn:r;for(a.set(t,e),a.set(e,t);++h<u;){var m=t[h],y=e[h];if(i)var g=s?i(y,m,h,e,t,a):i(m,y,h,t,e,a);if(g!==r){if(g)continue;p=!1;break}if(f){if(!Be(e,function(t,e){if(!Je(f,e)&&(m===t||o(m,t,n,i,a)))return f.push(e)})){p=!1;break}}else if(m!==y&&!o(m,y,n,i,a)){p=!1;break}}return a.delete(t),a.delete(e),p}function Qi(t){return Eo(Io(t,r,$o),t+"")}function to(t){return Sr(t,js,co)}function eo(t){return Sr(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,So(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=me?function(t){return null==t?[]:(t=It(t),Ae(me(t),function(e){return Wt.call(t,e)}))}:fu,lo=me?function(t){for(var e=[];t;)xe(e,co(t)),t=$t(t);return e}:fu,ho=Pr;function po(t,e,n){for(var r=-1,i=(e=yi(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)&&yo(a,i)&&(qa(t)||Va(t))}function fo(t){return"function"!=typeof t.constructor||wo(t)?{}:Nn($t(t))}function mo(t){return qa(t)||Va(t)||!!(Yt&&t&&t[Yt])}function yo(t,e){var n=typeof t;return!!(e=null==e?l:e)&&("number"==n||"symbol"!=n&&yt.test(t))&&t>-1&&t%1==0&&t<e}function go(t,e,n){if(!Qa(n))return!1;var r=typeof e;return!!("number"==r?Ha(n)&&yo(e,n.length):"string"==r&&e in n)&&Na(n[e],t)}function vo(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 It(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]}(Sn&&ho(new Sn(new ArrayBuffer(1)))!=x||Pn&&ho(new Pn)!=w||In&&ho(In.resolve())!=I||Cn&&ho(new Cn)!=O||On&&ho(new On)!=E)&&(ho=function(t){var e=Pr(t),n=e==P?t.constructor:r,i=n?Mo(n):"";if(i)switch(i){case jn:return x;case xn:return w;case Tn:return I;case zn:return O;case Bn:return E}return e});var _o=xt?Ja:mu;function wo(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||jt)}function So(t){return t==t&&!Qa(t)}function Po(t,e){return function(n){return null!=n&&n[t]===e&&(e!==r||t in It(n))}}function Io(t,e,n){return e=yn(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=yn(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),Se(t,this,s)}}function Co(t,e){return e.length<2?t:wr(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 Ie(p,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=vn(),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=Hr(n,o),s=t[a];t[a]=t[n],t[n]=s}return t.length=e,t}var zo,Bo,Fo=(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===Bo.size&&Bo.clear(),t}),Bo=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 Wa(t)?cr(t,mr(e,1,Wa,!0)):[]}),Ro=Gr(function(t,e){var n=Ko(e);return Wa(n)&&(n=r),Wa(t)?cr(t,mr(e,1,Wa,!0),oo(n,2)):[]}),Lo=Gr(function(t,e){var n=Ko(e);return Wa(n)&&(n=r),Wa(t)?cr(t,mr(e,1,Wa,!0),r,n):[]});function Vo(t,e,n){var r=null==t?0:t.length;if(!r)return-1;var i=null==n?0:ps(n);return i<0&&(i=yn(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=ps(n),o=n<0?yn(i+o,0):gn(o,i-1)),Me(t,oo(e,3),o,!0)}function $o(t){return null!=t&&t.length?mr(t,1):[]}function Ho(t){return t&&t.length?t[0]:r}var Wo=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 yo(t,n)?+t:t}).sort(Pi)),r});function Qo(t){return null==t?t:wn.call(t)}var ta=Gr(function(t){return si(mr(t,1,Wa,!0))}),ea=Gr(function(t){var e=Ko(t);return Wa(e)&&(e=r),si(mr(t,1,Wa,!0),oo(e,2))}),na=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,si(mr(t,1,Wa,!0),r,e)});function ra(t){if(!t||!t.length)return[];var e=0;return t=Ae(t,function(t){if(Wa(t))return e=yn(t.length,e),!0}),We(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 Se(e,r,t)})}var oa=Gr(function(t,e){return Wa(t)?cr(t,e):[]}),aa=Gr(function(t){return hi(Ae(t,Wa))}),sa=Gr(function(t){var e=Ko(t);return Wa(e)&&(e=r),hi(Ae(t,Wa),oo(e,2))}),ua=Gr(function(t){var e=Ko(t);return e="function"==typeof e?e:r,hi(Ae(t,Wa),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 ha(t,e){return e(t)}var pa=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&&yo(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:ha,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)}),ma=Fi(Vo),ya=Fi(qo);function ga(t,e){return(qa(t)?Ie:lr)(t,oo(e,3))}function va(t,e){return(qa(t)?Ce:dr)(t,oo(e,3))}var ba=ki(function(t,e,n){zt.call(t,n)?t[n].push(e):rr(t,n,[e])}),_a=Gr(function(t,e,n){var r=-1,i="function"==typeof e,o=Ha(t)?rt(t.length):[];return lr(t,function(t){o[++r]=i?Se(e,t,n):kr(t,e,n)}),o}),wa=ki(function(t,e,n){rr(t,n,e)});function Sa(t,e){return(qa(t)?je:Dr)(t,oo(e,3))}var Pa=ki(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),Ia=Gr(function(t,e){if(null==t)return[];var n=e.length;return n>1&&go(t,e[0],e[1])?e=[]:n>2&&go(e[0],e[1],e[2])&&(e=[e[0]]),Lr(t,mr(e,1),[])}),Ca=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=ps(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,h=!1,p=!1,f=!0;if("function"!=typeof t)throw new At(i);function m(e){var n=o,i=a;return o=a=r,d=e,u=t.apply(i,n)}function y(t){var n=t-l;return l===r||n>=e||n<0||p&&t-d>=s}function g(){var t=Ca();if(y(t))return v(t);c=ko(g,function(t){var n=e-(t-l);return p?gn(n,s-(t-d)):n}(t))}function v(t){return c=r,f&&o?m(t):(o=a=r,u)}function b(){var t=Ca(),n=y(t);if(o=arguments,a=this,l=t,n){if(c===r)return function(t){return d=t,c=ko(g,e),h?m(t):u}(l);if(p)return bi(c),c=ko(g,e),m(l)}return c===r&&(c=ko(g,e)),u}return e=ms(e)||0,Qa(n)&&(h=!!n.leading,s=(p="maxWait"in n)?yn(ms(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:v(Ca())},b}var xa=Gr(function(t,e){return ur(t,1,e)}),Ta=Gr(function(t,e,n){return ur(t,ms(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||Hn),n}function Ba(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=Hn;var Fa=gi(function(t,e){var n=(e=1==e.length&&qa(e[0])?je(e[0],Ye(oo())):je(mr(e,1),Ye(oo()))).length;return Gr(function(r){for(var i=-1,o=gn(r.length,n);++i<o;)r[i]=e[i].call(this,r[i]);return Se(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(Ir),La=qi(function(t,e){return t>=e}),Va=Er(function(){return arguments}())?Er:function(t){return ts(t)&&zt.call(t,"callee")&&!Wt.call(t,"callee")},qa=rt.isArray,$a=ye?Ye(ye):function(t){return ts(t)&&Pr(t)==j};function Ha(t){return null!=t&&Xa(t.length)&&!Ja(t)}function Wa(t){return ts(t)&&Ha(t)}var Ga=Fe||mu,Ya=ge?Ye(ge):function(t){return ts(t)&&Pr(t)==g};function Ka(t){if(!ts(t))return!1;var e=Pr(t);return e==v||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!rs(t)}function Ja(t){if(!Qa(t))return!1;var e=Pr(t);return e==b||e==_||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Za(t){return"number"==typeof t&&t==ps(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=ve?Ye(ve):function(t){return ts(t)&&ho(t)==w};function ns(t){return"number"==typeof t||ts(t)&&Pr(t)==S}function rs(t){if(!ts(t)||Pr(t)!=P)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)&&Pr(t)==C},os=_e?Ye(_e):function(t){return ts(t)&&ho(t)==O};function as(t){return"string"==typeof t||!qa(t)&&ts(t)&&Pr(t)==A}function ss(t){return"symbol"==typeof t||ts(t)&&Pr(t)==k}var us=we?Ye(we):function(t){return ts(t)&&Xa(t.length)&&!!re[Pr(t)]},cs=qi(Fr),ls=qi(function(t,e){return t<=e});function ds(t){if(!t)return[];if(Ha(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=ho(t);return(e==w?rn:e==O?sn:Ns)(t)}function hs(t){return t?(t=ms(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function ps(t){var e=hs(t),n=e%1;return e==e?n?e-n:e:0}function fs(t){return t?or(ps(t),0,h):0}function ms(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=pt.test(t);return n||mt.test(t)?se(t.slice(2),n?2:8):ht.test(t)?d:+t}function ys(t){return Ai(t,xs(t))}function gs(t){return null==t?"":ai(t)}var vs=Ei(function(t,e){if(wo(e)||Ha(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)}),_s=Ei(function(t,e,n,r){Ai(e,xs(e),t,r)}),ws=Ei(function(t,e,n,r){Ai(e,js(e),t,r)}),Ss=Qi(ir),Ps=Gr(function(t,e){t=It(t);var n=-1,i=e.length,o=i>2?e[2]:r;for(o&&go(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}),Is=Gr(function(t){return t.push(r,Ji),Se(zs,r,t)});function Cs(t,e,n){var i=null==t?r:wr(t,e);return i===r?n:i}function Os(t,e){return null!=t&&po(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 Ha(t)?Yn(t):Br(t)}function xs(t){return Ha(t)?Yn(t,!0):function(t){if(!Qa(t))return function(t){var e=[];if(null!=t)for(var n in It(t))e.push(n);return e}(t);var e=wo(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)}),Bs=Qi(function(t,e){var n={};if(null==t)return n;var r=!1;e=je(e,function(e){return e=yi(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}),Fs=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(gs(t).toLowerCase())}function Vs(t){return(t=gs(t))&&t.replace(gt,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()}),Hs=Ti("toLowerCase"),Ws=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=gs(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 Se(t,r,e)}catch(t){return Ka(t)?t:new wt(t)}}),Xs=Qi(function(t,e){return Ie(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=_r(e,r);null!=n||Qa(e)&&(i.length||!r.length)||(n=e,e=t,t=this,i=_r(e,js(e)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ja(t);return Ie(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(Be);function du(t){return vo(t)?Ve(Do(t)):function(t){return function(e){return wr(e,t)}}(t)}var hu=Vi(),pu=Vi(!0);function fu(){return[]}function mu(){return!1}var yu,gu=Ni(function(t,e){return t+e},0),vu=Hi("ceil"),bu=Ni(function(t,e){return t/e},1),_u=Hi("floor"),wu=Ni(function(t,e){return t*e},1),Su=Hi("round"),Pu=Ni(function(t,e){return t-e},0);return Un.after=function(t,e){if("function"!=typeof e)throw new At(i);return t=ps(t),function(){if(--t<1)return e.apply(this,arguments)}},Un.ary=Oa,Un.assign=vs,Un.assignIn=bs,Un.assignInWith=_s,Un.assignWith=ws,Un.at=Ss,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?go(t,e,n):e===r)?1:yn(ps(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var o=0,a=0,s=rt(he(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],mr(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(Se(i[0],this,n))return Se(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=Ps,Un.defaultsDeep=Is,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:ps(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:ps(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&&go(t,e,n)&&(n=0,i=o),function(t,e,n,i){var o=t.length;for((n=ps(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:ps(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 mr(Sa(t,e),1)},Un.flatMapDeep=function(t,e){return mr(Sa(t,e),c)},Un.flatMapDepth=function(t,e,n){return n=n===r?1:ps(n),mr(Sa(t,e),n)},Un.flatten=$o,Un.flattenDeep=function(t){return null!=t&&t.length?mr(t,c):[]},Un.flattenDepth=function(t,e){return null!=t&&t.length?mr(t,e=e===r?1:ps(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?[]:_r(t,js(t))},Un.functionsIn=function(t){return null==t?[]:_r(t,xs(t))},Un.groupBy=ba,Un.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Un.intersection=Wo,Un.intersectionBy=Go,Un.intersectionWith=Yo,Un.invert=As,Un.invertBy=ks,Un.invokeMap=_a,Un.iteratee=ru,Un.keyBy=wa,Un.keys=js,Un.keysIn=xs,Un.map=Sa,Un.mapKeys=function(t,e){var n={};return e=oo(e,3),vr(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),vr(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=Ba,Un.nthArg=function(t){return t=ps(t),Gr(function(e){return Rr(e,t)})},Un.omit=Bs,Un.omitBy=function(t,e){return Ds(t,Ba(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=Fa,Un.overEvery=cu,Un.overSome=lu,Un.partial=Da,Un.partialRight=Ma,Un.partition=Pa,Un.pick=Fs,Un.pickBy=Ds,Un.property=du,Un.propertyOf=function(t){return function(e){return null==t?r:wr(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=hu,Un.rangeRight=pu,Un.rearg=Ua,Un.reject=function(t,e){return(qa(t)?Ae:fr)(t,Ba(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:ps(e))},Un.reverse=Qo,Un.sampleSize=function(t,e,n){return e=(n?go(t,e,n):e===r)?1:ps(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&&go(t,e,n)?(e=0,n=i):(e=null==e?0:ps(e),n=n===r?i:ps(n)),ti(t,e,n)):[]},Un.sortBy=Ia,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&&go(t,e,n)&&(e=n=r),(n=n===r?h:n>>>0)?(t=gs(t))&&("string"==typeof e||null!=e&&!is(e))&&!(e=ai(e))&&nn(t)?vi(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:yn(ps(e),0),Gr(function(n){var r=n[e],i=vi(n,0,e);return r&&xe(i,r),Se(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:ps(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:ps(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=ha,Un.toArray=ds,Un.toPairs=Ms,Un.toPairsIn=Us,Un.toPath=function(t){return qa(t)?je(t,Do):ss(t)?[t]:Oi(Fo(gs(t)))},Un.toPlainObject=ys,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?Ie:vr)(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,mi(n))},Un.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:ci(t,e,mi(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(mi(e),t)},Un.xor=aa,Un.xorBy=sa,Un.xorWith=ua,Un.zip=ca,Un.zipObject=function(t,e){return pi(t||[],e||[],Qn)},Un.zipObjectDeep=function(t,e){return pi(t||[],e||[],Jr)},Un.zipWith=la,Un.entries=Ms,Un.entriesIn=Us,Un.extend=bs,Un.extendWith=_s,au(Un,Un),Un.add=gu,Un.attempt=Zs,Un.camelCase=Rs,Un.capitalize=Ls,Un.ceil=vu,Un.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=ms(n))==n?n:0),e!==r&&(e=(e=ms(e))==e?e:0),or(ms(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=gs(t),e=ai(e);var i=t.length,o=n=n===r?i:or(ps(n),0,i);return(n-=e.length)>=0&&t.slice(n,o)==e},Un.eq=Na,Un.escape=function(t){return(t=gs(t))&&G.test(t)?t.replace(H,tn):t},Un.escapeRegExp=function(t){return(t=gs(t))&&et.test(t)?t.replace(tt,"\\$&"):t},Un.every=function(t,e,n){var i=qa(t)?Oe:hr;return n&&go(t,e,n)&&(e=r),i(t,oo(e,3))},Un.find=ma,Un.findIndex=Vo,Un.findKey=function(t,e){return De(t,oo(e,3),vr)},Un.findLast=ya,Un.findLastIndex=qo,Un.findLastKey=function(t,e){return De(t,oo(e,3),br)},Un.floor=_u,Un.forEach=ga,Un.forEachRight=va,Un.forIn=function(t,e){return null==t?t:yr(t,oo(e,3),xs)},Un.forInRight=function(t,e){return null==t?t:gr(t,oo(e,3),xs)},Un.forOwn=function(t,e){return t&&vr(t,oo(e,3))},Un.forOwnRight=function(t,e){return t&&br(t,oo(e,3))},Un.get=Cs,Un.gt=Ra,Un.gte=La,Un.has=function(t,e){return null!=t&&po(t,e,Cr)},Un.hasIn=Os,Un.head=Ho,Un.identity=nu,Un.includes=function(t,e,n,r){t=Ha(t)?t:Ns(t),n=n&&!r?ps(n):0;var i=t.length;return n<0&&(n=yn(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:ps(n);return i<0&&(i=yn(r+i,0)),Ue(t,e,i)},Un.inRange=function(t,e,n){return e=hs(e),n===r?(n=e,e=0):n=hs(n),function(t,e,n){return t>=gn(e,n)&&t<yn(e,n)}(t=ms(t),e,n)},Un.invoke=Es,Un.isArguments=Va,Un.isArray=qa,Un.isArrayBuffer=$a,Un.isArrayLike=Ha,Un.isArrayLikeObject=Wa,Un.isBoolean=function(t){return!0===t||!1===t||ts(t)&&Pr(t)==y},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(Ha(t)&&(qa(t)||"string"==typeof t||"function"==typeof t.splice||Ga(t)||us(t)||Va(t)))return!t.length;var e=ho(t);if(e==w||e==O)return!t.size;if(wo(t))return!Br(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(_o(t))throw new wt("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)&&ho(t)==E},Un.isWeakSet=function(t){return ts(t)&&"[object WeakSet]"==Pr(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=ps(n))<0?yn(i+o,0):gn(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=Hs,Un.lt=cs,Un.lte=ls,Un.max=function(t){return t&&t.length?pr(t,nu,Ir):r},Un.maxBy=function(t,e){return t&&t.length?pr(t,oo(e,2),Ir):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?pr(t,nu,Fr):r},Un.minBy=function(t,e){return t&&t.length?pr(t,oo(e,2),Fr):r},Un.stubArray=fu,Un.stubFalse=mu,Un.stubObject=function(){return{}},Un.stubString=function(){return""},Un.stubTrue=function(){return!0},Un.multiply=wu,Un.nth=function(t,e){return t&&t.length?Rr(t,ps(e)):r},Un.noConflict=function(){return le._===this&&(le._=Ut),this},Un.noop=su,Un.now=Ca,Un.pad=function(t,e,n){t=gs(t);var r=(e=ps(e))?cn(t):0;if(!e||r>=e)return t;var i=(e-r)/2;return Li(fe(i),n)+t+Li(he(i),n)},Un.padEnd=function(t,e,n){t=gs(t);var r=(e=ps(e))?cn(t):0;return e&&r<e?t+Li(e-r,n):t},Un.padStart=function(t,e,n){t=gs(t);var r=(e=ps(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(gs(t).replace(nt,""),e||0)},Un.random=function(t,e,n){if(n&&"boolean"!=typeof n&&go(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=hs(t),e===r?(e=t,t=0):e=hs(e)),t>e){var i=t;t=e,e=i}if(n||t%1||e%1){var o=_n();return gn(t+o*(e-t+ae("1e-"+((o+"").length-1))),e)}return Hr(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?go(t,e,n):e===r)?1:ps(e),Wr(gs(t),e)},Un.replace=function(){var t=arguments,e=gs(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Un.result=function(t,e,n){var i=-1,o=(e=yi(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=Su,Un.runInContext=t,Un.sample=function(t){return(qa(t)?Kn:Yr)(t)},Un.size=function(t){if(null==t)return 0;if(Ha(t))return as(t)?cn(t):t.length;var e=ho(t);return e==w||e==O?t.size:Br(t).length},Un.snakeCase=Ws,Un.some=function(t,e,n){var i=qa(t)?Be:ei;return n&&go(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=gs(t),n=null==n?0:or(ps(n),0,t.length),e=ai(e),t.slice(n,n+e.length)==e},Un.subtract=Pu,Un.sum=function(t){return t&&t.length?He(t,nu):0},Un.sumBy=function(t,e){return t&&t.length?He(t,oo(e,2)):0},Un.template=function(t,e,n){var i=Un.templateSettings;n&&go(t,e,n)&&(e=r),t=gs(t),e=_s({},e,i,Ki);var o,a,s=_s({},e.imports,i.imports,Ki),u=js(s),c=Ke(s,u),l=0,d=e.interpolate||vt,h="__p += '",p=Ct((e.escape||vt).source+"|"+d.source+"|"+(d===J?lt:vt).source+"|"+(e.evaluate||vt).source+"|$","g"),f="//# sourceURL="+(zt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ne+"]")+"\n";t.replace(p,function(e,n,r,i,s,u){return r||(r=i),h+=t.slice(l,u).replace(bt,en),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=u+e.length,e}),h+="';\n";var m=zt.call(e,"variable")&&e.variable;if(m){if(ut.test(m))throw new wt("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(a?h.replace(L,""):h).replace(V,"$1").replace(q,"$1;"),h="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var y=Zs(function(){return St(u,f+"return "+h).apply(r,c)});if(y.source=h,Ka(y))throw y;return y},Un.times=function(t,e){if((t=ps(t))<1||t>l)return[];var n=h,r=gn(t,h);e=oo(e),t-=h;for(var i=We(r,e);++n<t;)e(n);return i},Un.toFinite=hs,Un.toInteger=ps,Un.toLength=fs,Un.toLower=function(t){return gs(t).toLowerCase()},Un.toNumber=ms,Un.toSafeInteger=function(t){return t?or(ps(t),-9007199254740991,l):0===t?t:0},Un.toString=gs,Un.toUpper=function(t){return gs(t).toUpperCase()},Un.trim=function(t,e,n){if((t=gs(t))&&(n||e===r))return Ge(t);if(!t||!(e=ai(e)))return t;var i=ln(t),o=ln(e);return vi(i,Ze(i,o),Xe(i,o)+1).join("")},Un.trimEnd=function(t,e,n){if((t=gs(t))&&(n||e===r))return t.slice(0,dn(t)+1);if(!t||!(e=ai(e)))return t;var i=ln(t);return vi(i,0,Xe(i,ln(e))+1).join("")},Un.trimStart=function(t,e,n){if((t=gs(t))&&(n||e===r))return t.replace(nt,"");if(!t||!(e=ai(e)))return t;var i=ln(t);return vi(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?ps(e.length):n,i="omission"in e?ai(e.omission):i}var a=(t=gs(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?vi(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=Ct(o.source,gs(dt.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var h=l.index;c=c.slice(0,h===r?u:h)}}else if(t.indexOf(ai(o),u)!=u){var p=c.lastIndexOf(o);p>-1&&(c=c.slice(0,p))}return c+i},Un.unescape=function(t){return(t=gs(t))&&W.test(t)?t.replace($,hn):t},Un.uniqueId=function(t){var e=++Bt;return gs(t)+e},Un.upperCase=Ys,Un.upperFirst=Ks,Un.each=ga,Un.eachRight=va,Un.first=Ho,au(Un,(yu={},vr(Un,function(t,e){zt.call(Un.prototype,e)||(yu[e]=t)}),yu),{chain:!1}),Un.VERSION="4.17.21",Ie(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){Un[t].placeholder=Un}),Ie(["drop","take"],function(t,e){Vn.prototype[t]=function(n){n=n===r?1:yn(ps(n),0);var i=this.__filtered__&&!e?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=gn(n,i.__takeCount__):i.__views__.push({size:gn(n,h),type:t+(i.__dir__<0?"Right":"")}),i},Vn.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ie(["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}}),Ie(["head","last"],function(t,e){var n="take"+(e?"Right":"");Vn.prototype[t]=function(){return this[n](1).value()[0]}}),Ie(["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(Ba(oo(t)))},Vn.prototype.slice=function(t,e){t=ps(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=ps(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(h)},vr(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&&h?e[0]:e};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var h=this.__chain__,p=!!this.__actions__.length,f=a&&!h,m=u&&!p;if(!a&&l){e=m?e:new Vn(this);var y=t.apply(e,s);return y.__actions__.push({func:ha,args:[d],thisArg:r}),new Ln(y,h)}return f&&m?t.apply(this,s):(y=this.thru(d),f?i?y.value()[0]:y.value():y)})}),Ie(["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)})}}),vr(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=gn(e,t+a);break;case"takeRight":t=yn(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,h=0,p=gn(u,this.__takeCount__);if(!n||!r&&i==u&&p==u)return di(t,this.__actions__);var f=[];t:for(;u--&&h<p;){for(var m=-1,y=t[c+=e];++m<d;){var g=l[m],v=g.iteratee,b=g.type,_=v(y);if(2==b)y=_;else if(!_){if(1==b)continue t;break t}}f[h++]=y}return f},Un.prototype.at=pa,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:ha,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._=pn,define(function(){return pn})):he?((he.exports=pn)._=pn,de._=pn):le._=pn}.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";function t(t,e){return Object.assign(t,{resolveIds:e})}n.r(r),n.d(r,{createBigCommercePaymentsAlternativeMethodsButtonStrategy:()=>se,createBigCommercePaymentsAlternativeMethodsPaymentStrategy:()=>Mt,createBigCommercePaymentsButtonStrategy:()=>ee,createBigCommercePaymentsCreditCardsPaymentStrategy:()=>Bt,createBigCommercePaymentsCustomerStrategy:()=>qt,createBigCommercePaymentsFastlaneCustomerStrategy:()=>Wt,createBigCommercePaymentsFastlanePaymentStrategy:()=>ft,createBigCommercePaymentsPayLaterButtonStrategy:()=>ie,createBigCommercePaymentsPayLaterCustomerStrategy:()=>Kt,createBigCommercePaymentsPayLaterPaymentStrategy:()=>bt,createBigCommercePaymentsPaymentStrategy:()=>W,createBigCommercePaymentsRatePayPayPaymentStrategy:()=>Pt,createBigCommercePaymentsVenmoButtonStrategy:()=>le,createBigCommercePaymentsVenmoCustomerStrategy:()=>Xt,createBigCommercePaymentsVenmoPaymentStrategy:()=>Rt});const e={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},i="embedded-checkout-loading-indicator-rotation";class o{constructor(t){this.styles=Object.assign(Object.assign({},e),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=`${i} 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(i))return;const e=document.createElement("style");e.id=i,null===(t=document.head)||void 0===t||t.appendChild(e),e.sheet instanceof CSSStyleSheet&&e.sheet.insertRule(`\n @keyframes ${i} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}const a={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};var s,u=n(8686),c=n(4043),l=n(315),d=n(9440);class h 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 p extends h{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"}(s||(s={}));class f extends h{constructor(t){super(function(t){switch(t){case s.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case s.MissingCart:return"Unable to proceed because cart data is unavailable.";case s.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case s.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case s.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case s.MissingCheckoutConfig:case s.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case s.MissingOrder:return"Unable to proceed because order data is unavailable.";case s.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case s.MissingPayment:return"Unable to proceed because payment data is unavailable.";case s.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case s.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case s.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(t)),this.subtype=t,this.name="MissingDataError",this.type="missing_data"}}class m extends h{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 y={body:{},headers:{},status:0};class g extends h{constructor(t,{message:e,errors:n}={}){const{body:r,headers:i,status:o}=t||y;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 v,b,_,w,S,P,I,C;!function(t){t.BuyNow="BUY_NOW"}(v||(v={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(b||(b={})),function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(_||(_={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(w||(w={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(S||(S={})),function(t){t.pill="pill",t.rect="rect"}(P||(P={})),function(t){t.OXXO="oxxo"}(I||(I={})),function(t){t.Approved="APPROVED",t.Created="CREATED",t.PayerActionRequired="PAYER_ACTION_REQUIRED",t.PollingStop="POLLING_STOP",t.PollingError="POLLING_ERROR"}(C||(C={}));var O=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 A{constructor(t,e,n,r){this.formPoster=t,this.paymentIntegrationService=e,this.bigCommercePaymentsRequestSender=n,this.bigCommercePaymentsScriptLoader=r}loadPayPalSdk(t,e,n,r){return O(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.bigCommercePaymentsScriptLoader.getPayPalSDK(a,o,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new p;return this.paypalSdk}createBuyNowCartOrThrow(t){return O(this,void 0,void 0,function*(){const e=t.getBuyNowCartRequestBody();if(!e)throw new f(s.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(e)}catch(t){throw new m}})}createOrder(t,e){return O(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.bigCommercePaymentsRequestSender.createOrder(t,Object.assign({cartId:n},e));return r})}createOrderCardFields(t,e){return O(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.bigCommercePaymentsRequestSender.createOrder(t,Object.assign({cartId:n},e));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(){return O(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState(),e=t.getCartOrThrow(),n=t.getConsignmentsOrThrow()[0];try{yield this.bigCommercePaymentsRequestSender.updateOrder({availableShippingOptions:n.availableShippingOptions,cartId:e.id,selectedShippingOption:n.selectedShippingOption})}catch(t){throw new g}})}getOrderStatus(t,e){return O(this,void 0,void 0,function*(){try{const{status:n}=yield this.bigCommercePaymentsRequestSender.getOrderStatus(t,e);return n}catch(t){throw new g}})}tokenizePayment(t,e){const n=this.paymentIntegrationService.getState().getCartOrThrow();if(!e)throw new f(s.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:t,order_id:e},n.source===v.BuyNow&&{cart_id:n.id}))}submitPayment(t,e,n){return O(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&&S[e]?e:void 0,height:this.getValidHeight(n),label:r&&w[r]?r:void 0,shape:i&&P[i]?i:void 0};return(0,d.omitBy)(o,d.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 k="This API endpoint is for internal use only and may change in the future";var E;!function(t){t.Json="application/json",t.JsonV1="application/vnd.bc.v1+json"}(E||(E={}));const j=E,x={"X-Checkout-SDK-Version":"1.818.0"};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 z{constructor(t){this.requestSender=t}createOrder(t,e){return T(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${t}`,r=e,i=Object.assign({"X-API-INTERNAL":k,"Content-Type":j.Json},x);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(t){return T(this,void 0,void 0,function*(){const e=t,n=Object.assign({"X-API-INTERNAL":k,"Content-Type":j.Json},x);return(yield this.requestSender.put("/api/storefront/initialization/bigcommerce_payments",{headers:n,body:e})).body})}getOrderStatus(t="bigcommerce_payments",e){return T(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${t}`,r=Object.assign({"X-API-INTERNAL":k,"Content-Type":j.Json},x);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 F{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 p;return this.window.paypal})}getPayPalSdkScriptConfigOrThrow(t,e,n=!0){const{id:r,clientToken:i,initializationData:o}=t;if(!(null==o?void 0:o.clientId))throw new f(s.MissingPaymentMethod);const{intent:a,clientId:u,merchantId:c,buyerCountry:l,attributionId:d,isVenmoEnabled:h,isHostedCheckoutEnabled:p,isPayPalCreditAvailable:m,isDeveloperModeApplicable:y,availableAlternativePaymentMethods:g=[],enabledAlternativePaymentMethods:v=[],isGooglePayEnabled:b}=o,_=p||n,w="bigcommerce_payments_creditcards"===r,S=w?["card"]:[],P=w?[]:["card"],I=m?["credit","paylater"]:[],C=m?[]:["credit","paylater"],O=n||!_,A=h?["venmo"]:[],k=h?[]:["venmo"],E=O?v:[],j=O?g.filter(t=>!v.includes(t)):g,x=b?["googlepay"]:[],T=n?["card-fields"]:[],z=this.filterFundingOptions([...P,...C,...k,...j]),B=this.filterFundingOptions([...S,...I,...A,...E]);return{options:Object.assign({"client-id":u,"merchant-id":c,"enable-funding":B.length>0?B:void 0,"disable-funding":z.length>0?z:void 0,commit:_,components:["buttons","hosted-fields","payment-fields","legal",...x,...T],currency:e,intent:a},y&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":i}}}filterFundingOptions(t){const e=["klarna"];return t?t.filter(t=>!e.includes(t)):[]}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 D=t=>{const{getHost:e}=t.getState();return new A((0,u.createFormPoster)(),t,new z((0,c.createRequestSender)({host:e()})),new F((0,l.vQ)()))};class M extends h{constructor(t){super(t||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class U extends M{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 N 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 R extends h{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function L(t){return!("object"!=typeof t||null===t||void 0!==t.shouldSaveInstrument&&"boolean"!=typeof t.shouldSaveInstrument||void 0!==t.shouldSetAsDefaultInstrument&&"boolean"!=typeof t.shouldSetAsDefaultInstrument)}function V(t){return Boolean(t.instrumentId)}function q(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 $=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 H{constructor(t,e,n){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.loadingIndicator=n}initialize(t){var e,n;return $(this,void 0,void 0,function*(){const{methodId:r,bigcommerce_payments:i}=t||{};if(this.bigcommerce_payments=i,!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new M('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(r);const o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(r);this.loadingIndicatorContainer=i.container.split("#")[1],(null===(e=o.initializationData)||void 0===e?void 0:e.orderId)?this.orderId=null===(n=o.initializationData)||void 0===n?void 0:n.orderId:(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(r),i.onInit&&"function"==typeof i.onInit&&i.onInit(()=>this.renderButton(r,i)),(void 0===i.shouldRenderPayPalButtonOnInitialization||i.shouldRenderPayPalButtonOnInitialization)&&this.renderButton(r,i))})}execute(t,e){return $(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"]),{onError:i}=this.bigcommerce_payments||{};if(!n)throw new U(["payment"]);const{methodId:o,paymentData:a}=n;if(this.isPayPalVaultedInstrumentPaymentData(a)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new N;const s=this.isPayPalVaultedInstrumentPaymentData(a)?this.prepareVaultedInstrumentPaymentPayload(o,this.orderId,a):this.preparePaymentPayload(o,this.orderId,a);try{yield this.paymentIntegrationService.submitOrder(r,e),yield this.paymentIntegrationService.submitPayment(s)}catch(t){return this.isProviderError(t)&&(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n.methodId),yield new Promise((t,e)=>{var r;this.bigcommerce_payments&&(null===(r=this.paypalButton)||void 0===r||r.close(),this.renderButton(n.methodId,this.bigcommerce_payments),this.handleError(new Error("INSTRUMENT_DECLINED"),i)),e()})),this.handleError(t,i),Promise.reject()}})}finalize(){return Promise.reject(new R)}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}=L(n)?n:{};return{methodId:t,paymentData:{shouldSaveInstrument:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:e}}}}}renderButton(t,e){const n=this.bigCommercePaymentsIntegrationService.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.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),createOrder:()=>this.createOrder(),onClick:(t,e)=>this.handleClick(e,c),onApprove:t=>this.handleApprove(t,l),onError:t=>this.handleError(t,s),onCancel:()=>this.toggleLoadingIndicator(!1)};this.paypalButton=n.Buttons(d),this.paypalButton.isEligible()&&(u&&"function"==typeof u&&u(),this.paypalButton.render(a))}handleClick(t,e){return $(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;yield e(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:t},e){this.orderId=t,e()}handleError(t,e){this.toggleLoadingIndicator(!1),e&&"function"==typeof e&&e(t)}createOrder(){return $(this,void 0,void 0,function*(){const t=this.getFieldsValues();return this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_paymentscheckout",{shouldSaveInstrument:(null==t?void 0:t.shouldSaveInstrument)||!1})})}getFieldsValues(){const{getFieldsValues:t}=this.bigcommerce_payments||{};return"function"==typeof t?t():void 0}isTrustedVaultingFlow(t){if(t&&V(t)){const e=this.paymentIntegrationService.getState().getInstruments(),n=null==e?void 0:e.find(e=>q(e)&&e.bigpayToken===t.instrumentId);return!(q(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(t){t&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(t){return!!t&&V(t)&&L(t)}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)}}const W=t(t=>new H(t,D(t),new o({containerStyles:a})),[{id:"bigcommerce_payments"}]);var G,Y,K,J,Z,X,Q,tt,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){this.scriptLoader=t,this.window=window}getPayPalFastlaneSdk(t,e,n){return et(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 p}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(t,e,n,r){return et(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 p;return this.window.paypalGooglePay})}getPayPalApmsSdk(t,e){return et(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 p}return this.window.paypalApms})}getPayPalMessages(t,e){return et(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 p;return this.window.paypalMessages})}loadPayPalSdk({options:t,attributes:e}){return et(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(t,e,n){const{clientToken:r,initializationData:i}=t;if(!i||!i.clientId)throw new f(s.MissingPaymentMethod);const{intent:o,clientId:a,merchantId:u,attributionId:c}=i;return{options:{"client-id":a,"merchant-id":u,commit:!0,components:["fastlane","three-domain-secure"],currency:e,intent:o},attributes:{"data-client-metadata-id":n.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":c,"data-sdk-client-token":r}}}getPayPalGooglePaySdkScriptConfigOrThrow(t,e,n=!0){const{clientToken:r,initializationData:i}=t;if(!i||!i.clientId)throw new f(s.MissingPaymentMethod);const{intent:o,clientId:a,merchantId:u,buyerCountry:c,attributionId:l,isHostedCheckoutEnabled:d,isDeveloperModeApplicable:h}=i,p=d||n;return{options:Object.assign({"client-id":a,"merchant-id":u,commit:p,components:["googlepay"],currency:e,intent:o},h&&{"buyer-country":c}),attributes:{"data-partner-attribution-id":l,"data-client-token":r,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(t,e){const{initializationData:n}=t;if(!n||!n.clientId)throw new f(s.MissingPaymentMethod);const{intent:r,clientId:i,merchantId:o,buyerCountry:a,attributionId:u,isDeveloperModeApplicable:c,availableAlternativePaymentMethods:l=[],enabledAlternativePaymentMethods:d=[]}=n,h=this.filterFundingOptions(d),p=this.filterFundingOptions(l.filter(t=>!d.includes(t)));return{options:Object.assign({"client-id":i,"merchant-id":o,"enable-funding":h.length>0?h:void 0,"disable-funding":p.length>0?p:void 0,commit:!0,components:["buttons","payment-fields"],currency:e,intent:r},c&&{"buyer-country":a}),attributes:{"data-partner-attribution-id":u,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(t,e){const{initializationData:n}=t;if(!n||!n.clientId)throw new f(s.MissingPaymentMethod);const{clientId:r,merchantId:i,attributionId:o,isDeveloperModeApplicable:a,buyerCountry:u}=n;return{options:Object.assign({"client-id":r,"merchant-id":i,components:["messages"],currency:e},a&&{"buyer-country":u}),attributes:{"data-namespace":"paypalMessages","data-partner-attribution-id":o}}}filterFundingOptions(t){const e=["klarna"];return t?t.filter(t=>!e.includes(t)):[]}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}}function rt(){return new nt((0,l.Hb)())}!function(t){t.CVV="cvv",t.PAN="pan"}(G||(G={}));class it{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){it.set(t,"",Object.assign({expires:new Date(0)},e))}}!function(t){t.AUTHORIZE="authorize",t.CAPTURE="capture"}(Y||(Y={})),function(t){t.Possible="POSSIBLE",t.No="NO",t.Unknown="UNKNOWN",t.Yes="YES"}(K||(K={})),function(t){t.Succeeded="succeeded",t.Cancelled="cancelled",t.Errored="errored"}(J||(J={})),function(t){t.paypal="paypal",t.checkout="checkout",t.buynow="buynow",t.pay="pay",t.installment="installment"}(Z||(Z={})),function(t){t.gold="gold",t.blue="blue",t.silver="silver",t.black="black",t.white="white"}(X||(X={})),function(t){t.pill="pill",t.rect="rect"}(Q||(Q={})),function(t){t.SUCCEEDED="succeeded",t.FAILED="failed",t.CANCELED="canceled",t.UNRECOGNIZED="unrecognized"}(tt||(tt={}));var ot=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 at{constructor(){this.window=window}initializePayPalFastlane(t,e,n){return ot(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 p;return this.window.paypalFastlane}lookupCustomerOrThrow(t){return ot(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(t)})}triggerAuthenticationFlowOrThrow(t){return ot(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};it.set("bc-fastlane-sessionId",t,n)}removeStorageSessionId(){it.remove("bc-fastlane-sessionId")}getStorageSessionId(){return it.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,h=s&&c?this.mapPayPalToBcAddress(s,c,null==u?void 0:u.phoneNumber):void 0,p=l?this.mapPayPalToBcInstrument(t,l):[],f=this.filterAddresses([d,h]);return{authenticationState:o||tt.UNRECOGNIZED,addresses:f,billingAddress:h,shippingAddress:d,instruments:p}}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:G.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,d.isEqual)(this.normalizeAddress(t),this.normalizeAddress(e))}normalizeAddress(t){return(0,d.omit)(t,["id","phone"])}}function st(){return new at}function ut(t){return"string"!=typeof t}function ct(t,e){if(e||t)return function(t){var e,n;const r={},i=(0,d.omitBy)(t.root,ut),o=(0,d.omitBy)(t.input,ut),a=(0,d.omitBy)(t.toggle,ut),s=(0,d.omitBy)(null===(e=t.text)||void 0===e?void 0:e.body,ut),u=(0,d.omitBy)(null===(n=t.text)||void 0===n?void 0:n.caption,ut),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,h,p,f,m,y,g,v,b,_,w,S,P;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===(h=null==e?void 0:e.input)||void 0===h?void 0:h.borderWidth),textColorBase:(null==t?void 0:t.fastlaneInputSettingsTextColorBase)||(null===(p=null==e?void 0:e.input)||void 0===p?void 0:p.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===(m=null==e?void 0:e.toggle)||void 0===m?void 0:m.colorSecondary)},text:{body:{color:(null==t?void 0:t.fastlaneTextBodySettingsColor)||(null===(g=null===(y=null==e?void 0:e.text)||void 0===y?void 0:y.body)||void 0===g?void 0:g.color),fontSize:(null==t?void 0:t.fastlaneTextBodySettingsFontSize)||(null===(b=null===(v=null==e?void 0:e.text)||void 0===v?void 0:v.body)||void 0===b?void 0:b.fontSize)},caption:{color:(null==t?void 0:t.fastlaneTextCaptionSettingsColor)||(null===(w=null===(_=null==e?void 0:e.text)||void 0===_?void 0:_.caption)||void 0===w?void 0:w.color),fontSize:(null==t?void 0:t.fastlaneTextCaptionSettingsFontSize)||(null===(P=null===(S=null==e?void 0:e.text)||void 0===S?void 0:S.caption)||void 0===P?void 0:P.fontSize)}},branding:(null==t?void 0:t.fastlaneBrandingSettings)||(null==e?void 0:e.branding)}}(t,e))}function lt(t){return!!t&&("authenticationState"in t||"addresses"in t||"instruments"in t)}function dt(t,e,n=!0){var r;return null!==(r=t[e])&&void 0!==r?r:n}var ht=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 pt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.bigCommercePaymentsRequestSender=e,this.bigCommercePaymentsSdk=n,this.bigCommercePaymentsFastlaneUtils=r}initialize(t){var e,n;return ht(this,void 0,void 0,function*(){const{methodId:r,bigcommerce_payments_fastlane:i}=t;if(!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(this.methodId=r,!i)throw new M('Unable to initialize payment because "options.bigcommerce_payments_fastlane" argument is not provided.');if(this.bigcommerce_payments_fastlane=i,!i.onInit||"function"!=typeof i.onInit)throw new M('Unable to initialize payment because "options.bigcommerce_payments_fastlane.onInit" argument is not provided or it is not a function.');if(!i.onChange||"function"!=typeof i.onChange)throw new M('Unable to initialize payment because "options.bigcommerce_payments_fastlane.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.bigCommercePaymentsSdk.getPayPalFastlaneSdk(s,a.currency.code,a.id);const l=ct(c?null===(n=null==s?void 0:s.initializationData)||void 0===n?void 0:n.fastlaneStyles:{},null==i?void 0:i.styles);yield this.bigCommercePaymentsFastlaneUtils.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 ht(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 U(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&V(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.bigCommercePaymentsFastlaneUtils.removeStorageSessionId()}catch(t){if(function(t){return"object"==typeof t&&null!==t&&"message"in t&&"response"in t&&"name"in t.response}(t)&&"INVALID_REQUEST"===t.response.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 R)}deinitialize(){return ht(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=lt(r)?r:{},o=this.bigCommercePaymentsFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===tt.CANCELED||(null==i?void 0:i.authenticationState)||o!==e.id)}runPayPalAuthenticationFlowOrThrow(t){return ht(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.bigCommercePaymentsFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.bigCommercePaymentsFastlaneUtils.triggerAuthenticationFlowOrThrow(a),{authenticationState:u,addresses:c,instruments:l}=this.bigCommercePaymentsFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(t,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:u,addresses:c,instruments:l}),s.authenticationState===tt.CANCELED?this.bigCommercePaymentsFastlaneUtils.removeStorageSessionId():this.bigCommercePaymentsFastlaneUtils.updateStorageSessionId(n.id)}catch(t){}})}initializePayPalPaymentComponent(){return ht(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),e=t.phone,n=`${t.firstName} ${t.lastName}`.trim(),r=this.bigCommercePaymentsFastlaneUtils.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 M('Unable to render card component because "container" argument is not provided.');e.render(t)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new p;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(t,e){return ht(this,void 0,void 0,function*(){const{instrumentId:n}=e,r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),i=this.isBigcommercePaymentsFastlaneThreeDSAvailable()&&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 ht(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.bigCommercePaymentsFastlaneUtils.mapBcToPayPalAddress(r)}),u=this.isBigcommercePaymentsFastlaneThreeDSAvailable()&&i.config.is3dsEnabled;u||(yield this.createOrder(s));const{shouldSaveInstrument:c=!1,shouldSetAsDefaultInstrument:l=!1}=L(e)?e:{},d=u?yield this.get3DSNonce(s):s;return{methodId:t,paymentData:Object.assign(Object.assign({},e),{shouldSaveInstrument:c,shouldSetAsDefaultInstrument:l,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:d}}})}})}createOrder(t){return ht(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState().getCartOrThrow().id;if(this.methodId){const{orderId:n}=yield this.bigCommercePaymentsRequestSender.createOrder(this.methodId,{cartId:e,fastlaneToken:t});this.orderId=n}})}get3DSNonce(t){var e;return ht(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),o=n.getStoreConfigOrThrow().links.checkoutLink,a=null===(e=this.paypalFastlaneSdk)||void 0===e?void 0:e.ThreeDomainSecureClient;if(!a)throw new p;const s={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 a.isEligible(s)){const{liabilityShift:e,authenticationState:n,nonce:r}=yield a.show();if(e===b.No||e===b.Unknown)throw new N;if(yield this.createOrder(t),n===J.Succeeded)return r;if(n===J.Errored)throw new N;if(n===J.Cancelled)throw console.error("3DS check was canceled"),new N}return t})}handlePayPalStoredInstrumentChange(t){return ht(this,void 0,void 0,function*(){const e=this.bigCommercePaymentsFastlaneUtils.getPayPalFastlaneOrThrow(),{selectionChanged:n,selectedCard:r}=yield e.profile.showCardSelector();if(n){const e=this.paymentIntegrationService.getState().getPaymentProviderCustomer(),n=lt(e)?e:{},i=this.bigCommercePaymentsFastlaneUtils.mapPayPalToBcInstrument(t,r)[0];return yield this.paymentIntegrationService.updatePaymentProviderCustomer(Object.assign(Object.assign({},n),{instruments:[i]})),i}})}isBigcommercePaymentsFastlaneThreeDSAvailable(){return dt(this.paymentIntegrationService.getState().getStoreConfigOrThrow().checkoutSettings.features,"PROJECT-7080.bcp_fastlane_three_ds")}handleError(t){var e;(null===(e=this.bigcommerce_payments_fastlane)||void 0===e?void 0:e.onError)&&"function"==typeof this.bigcommerce_payments_fastlane.onError&&this.bigcommerce_payments_fastlane.onError(t)}}const ft=t(t=>{const{getHost:e}=t.getState();return new pt(t,new z((0,c.createRequestSender)({host:e()})),rt(),st())},[{id:"bigcommerce_payments_fastlane"}]),mt=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};class yt extends h{constructor(t){super(t||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}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 vt{constructor(t,e,n,r){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.loadingIndicator=n,this.paypalSdkHelper=r}initialize(t){return gt(this,void 0,void 0,function*(){const{methodId:e,bigcommerce_payments_paylater:n}=t||{};if(!e)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(e);const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(e),{paypalBNPLConfiguration:o=[],orderId:a}=i.initializationData||{},{bannerContainerId:s,container:u}=n;if(void 0!==s){if(!document.getElementById(s))return void console.error("Unable to create banner without valid banner container ID.");const t=o&&o.find(({id:t})=>"checkout"===t);if(!(null==t?void 0:t.status))return;const e=yield this.paypalSdkHelper.getPayPalMessages(i,r.getCartOrThrow().currency.code);return this.renderMessages(e,s,t)}a?this.orderId=a:(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(e),this.loadingIndicatorContainer=null==u?void 0:u.split("#")[1],this.renderButton(e,n))})}execute(t,e){return gt(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 U(["payment"]);if(!this.orderId)throw new N;yield this.paymentIntegrationService.submitOrder(r,e),yield this.bigCommercePaymentsIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new R)}deinitialize(){var t;return this.orderId=void 0,null===(t=this.bigCommercePaymentsButtons)||void 0===t||t.close(),Promise.resolve()}renderButton(t,e){if(!(null==e?void 0:e.container))throw new M('Unable to initialize payment because "container" argument is not provided.');const n=this.bigCommercePaymentsIntegrationService.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 h=!1;d.forEach(t=>{if(h)return;const e={fundingSource:t,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),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.bigCommercePaymentsButtons=n.Buttons(e),this.bigCommercePaymentsButtons.isEligible()||t!==n.FUNDING.PAYLATER){if(!this.bigCommercePaymentsButtons.isEligible()&&t===n.FUNDING.CREDIT)throw new yt(`BigCommercePayments ${t} is not available for your region. Please use BigCommercePayments Checkout instead.`);u&&"function"==typeof u&&u(),this.bigCommercePaymentsButtons.render(a),h=!0}})}handleClick(t,e){return gt(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;e&&"function"==typeof e&&(yield 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:mt(n)};t.Messages(r).render(`#${e}`)}}const bt=t(t=>new vt(t,D(t),new o({containerStyles:a}),rt()),[{id:"bigcommerce_payments_paylater"}]);class _t extends g{constructor(t){super(t,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}var wt=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=3e3,i=3e5){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=d.noop}initialize(t){return wt(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,bigcommerce_payments_ratepay:r}=t;if(!n)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new M('Unable to initialize payment because "options.bigcommerce_payments_ratepay" argument is not provided.');const{legalTextContainer:i,container:o,loadingContainerId:a}=r;if(!o)throw new M('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new M('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new M('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 M("Unable to initialize payment because merchantId argument is not provided.");this.bigcommerce_payments_ratepay=r,yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n),this.createFraudNetScript(u,n,e),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(t,e){return wt(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.bigcommerce_payments_ratepay||{};if(!n)throw new U(["payment"]);if(!i||"function"!=typeof i)throw new M('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const t=yield this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apmscheckout",{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 R)}deinitialize(){const{legalTextContainer:t}=this.bigcommerce_payments_ratepay||{},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.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),u=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new M('Unable to initialize payment because "legalTextContainerElement" argument is not found.');u.render(`#${n}`)}handleError(t){const{onError:e}=this.bigcommerce_payments_ratepay||{};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 wt(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}initializePollingMechanism(t,e,n,r){return wt(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.bigCommercePaymentsIntegrationService.getOrderStatus("bigcommerce_payments_apms",{params:{useMetadata:!0}}),o=i===C.PollingStop,a=i===C.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,bigcommerce_payments_ratepay:this.bigcommerce_payments_ratepay}),this.handleError(new _t)}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 Pt=t(t=>new St(t,D(t),new o({containerStyles:Object.assign(Object.assign({},a),{position:"fixed"})})),[{gateway:"bigcommerce_payments_apms",id:"ratepay"}]);var It;!function(t){t.CardCode="cardCode",t.CardCodeVerification="cardCodeVerification",t.CardExpiry="cardExpiry",t.CardName="cardName",t.CardNumber="cardNumber",t.CardNumberVerification="cardNumberVerification",t.CardExpiryVerification="cardExpiryVerification"}(It||(It={}));const Ct=It;function Ot(t){return Ct.CardNumber in t&&Ct.CardName in t&&Ct.CardExpiry in t}function At(t){return Ct.CardNumberVerification in t&&Ct.CardCodeVerification in t&&Ct.CardExpiryVerification in t}class kt extends h{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 Et;!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"}(Et||(Et={}));class jt extends h{constructor(t){super(function(t){switch(t){case Et.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case Et.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case Et.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case Et.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 xt extends h{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 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){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.bigCommercePaymentsSdk=n,this.bigCommercePaymentsFastlaneUtils=r}initialize(t){return Tt(this,void 0,void 0,function*(){const{methodId:e,bigcommerce_payments_creditcards:n}=t,r=n,{form:i,onCreditCardFieldsRenderingError:o,onLoadComplete:a}=r||{};if(!e)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new M('Unable to proceed because "options.bigcommerce_payments_creditcards.form" argument is not provided.');this.hostedFormOptions=i,this.isCreditCardForm=Ot(i.fields),this.isCreditCardVaultedForm=At(i.fields)&&!this.hasUndefinedValues(),yield this.paymentIntegrationService.loadPaymentMethod(e),yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(e,void 0,!0,!0),null==a||a(),(this.isCreditCardForm||this.isCreditCardVaultedForm)&&(yield this.initializeFields(i,o)),this.shouldInitializePayPalFastlane(e)&&(yield this.initializePayPalFastlaneOrThrow(e))})}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"]),{methodId:i,paymentData:o}=n||{};if(!n||!i)throw new U(["payment"]);if(this.executionPaymentData=o,this.isCreditCardForm||this.isCreditCardVaultedForm)yield this.validateHostedFormOrThrow(),yield this.submitHostedForm();else{const{orderId:t}=yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",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 R)}deinitialize(){var t,e,n,r;return Tt(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}=L(e)?e:{},a=e&&V(e)?e.instrumentId:void 0,s=(0,d.omitBy)({verification_nonce:r,token:a},d.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 Tt(this,void 0,void 0,function*(){const{fields:n,styles:r}=t,i=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),o=this.getExecuteCallback(n),a=Object.assign({style:this.getInputStyles(r),onApprove:({orderID:t,vaultSetupToken:e,liabilityShift:n})=>{if(n===b.No||n===b.Unknown)throw new Error;return this.handleApprove({orderID:t,vaultSetupToken:e})},onError:()=>{throw new kt},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 jt(Et.PaymentNotInitialized);try{this.stylizeInputContainers(n),Ot(n)&&(yield this.renderFields(n)),At(n)&&(yield this.renderVaultedFields(n))}catch(t){"function"==typeof e&&e(t)}})}getExecuteCallback(t){return At(t)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>Tt(this,void 0,void 0,function*(){const{setupToken:t}=(yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",Object.assign(Object.assign({},this.getInstrumentParams()),{setupToken:!0})))||{};return t})}}createOrderCallback(){return{createOrder:()=>Tt(this,void 0,void 0,function*(){const{orderId:t}=(yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",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 Tt(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 Tt(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(L(this.executionPaymentData)){const{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}=this.executionPaymentData;return{shouldSaveInstrument:t,shouldSetAsDefaultInstrument:e}}if(V(this.executionPaymentData)){const{instrumentId:t}=this.executionPaymentData;return{instrumentId:t}}return{}}getFieldTypeByEmittedField({emittedBy:t}){return{fieldType:this.mapFieldType(t)}}submitHostedForm(){return Tt(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 kt("Failed authentication. Please try to authorize again.")}})}validateHostedFormOrThrow(){var t,e;return Tt(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 xt(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 Ct.CardCode:case Ct.CardCodeVerification:return{fieldType:t,message:"Invalid card code",type:"invalid_card_code"};case Ct.CardNumber:case Ct.CardNumberVerification:return{fieldType:t,message:"Invalid card number",type:"invalid_card_number"};case Ct.CardExpiry:case Ct.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 Ct.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?Ct.CardNumber:Ct.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?Ct.CardExpiry:Ct.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?Ct.CardCode:Ct.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new jt(Et.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.isBigCommercePaymentsAnalyticsV2Enabled)&&!(null==a?void 0:a.authenticationState)}initializePayPalFastlaneOrThrow(t){return Tt(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.bigCommercePaymentsSdk.getPayPalFastlaneSdk(r,n.currency.code,n.id);yield this.bigCommercePaymentsFastlaneUtils.initializePayPalFastlane(o,!!(null==i?void 0:i.isDeveloperModeApplicable))}catch(t){}})}}const Bt=t(t=>new zt(t,D(t),rt(),st()),[{id:"bigcommerce_payments_creditcards"}]);var Ft=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 Dt{constructor(t,e,n,r,i=3e3,o=3e5){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.bigCommercePaymentsSdkHelper=n,this.loadingIndicator=r,this.pollingInterval=i,this.maxPollingIntervalTime=o,this.pollingTimer=0,this.stopPolling=d.noop,this.isPollingEnabled=!1}initialize(t){return Ft(this,void 0,void 0,function*(){const{gatewayId:e,methodId:n,bigcommerce_payments_apms:r}=t;if(this.bigCommercePaymentsAlternativeMethods=r,!n)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new M('Unable to initialize payment because "options.bigcommerce_payments_apms" argument is not provided.');const i=this.paymentIntegrationService.getState(),o=i.getPaymentMethodOrThrow(n,e),{orderId:a,shouldRenderFields:s}=o.initializationData||{},u=i.getStoreConfigOrThrow().checkoutSettings.features;this.isPollingEnabled=dt(u,"PAYPAL-5624.bcp_ideal_polling"),a?this.orderId=a:(this.paypalApms=yield this.bigCommercePaymentsSdkHelper.getPayPalApmsSdk(o,i.getCartOrThrow().currency.code),this.loadingIndicatorContainer=r.container.split("#")[1],this.renderButton(n,e,r),s&&this.renderFields(n,r))})}execute(t,e){return Ft(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 U(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new N;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.bigCommercePaymentsIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new R)}deinitialize(){var t;return this.orderId=void 0,this.isPollingEnabled&&this.resetPollingMechanism(),null===(t=this.bigCommercePaymentsButton)||void 0===t||t.close(),Promise.resolve()}initializePollingMechanism(t,e,n,r){return Ft(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.bigCommercePaymentsIntegrationService.getOrderStatus(r),o=i===C.Approved,a=i===C.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,bigCommercePaymentsAlternativeMethods:this.bigCommercePaymentsAlternativeMethods}),this.handleError(new _t)}catch(t){n()}})}deInitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deInitializePollingMechanism()}reinitializeStrategy(t){return Ft(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(t)})}handleError(t){const{onError:e}=this.bigCommercePaymentsAlternativeMethods||{};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.bigCommercePaymentsIntegrationService.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)=>Ft(this,void 0,void 0,function*(){return n.onValidate(e.resolve,e.reject)})};this.bigCommercePaymentsButton=r.Buttons(l),this.bigCommercePaymentsButton.isEligible()&&(u&&"function"==typeof u&&u(),this.bigCommercePaymentsButton.render(a))}onCreateOrder(t,e,n){return Ft(this,void 0,void 0,function*(){const{onValidate:r}=n;yield r(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),d.noop);const i=yield this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apms");if(this.isNonInstantPaymentMethod(t)){const n={useStoreCredit:!1},r={params:{methodId:t,gatewayId:e}};yield this.paymentIntegrationService.submitOrder(n,r),yield this.bigCommercePaymentsIntegrationService.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 M('Unable to initialize payment because "options.bigcommerce_payments_apms" 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 I}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new p;return this.paypalApms}}const Mt=t(t=>new Dt(t,D(t),rt(),new o({containerStyles:a})),[{gateway:"bigcommerce_payments_apms"}]);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){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e,this.loadingIndicator=n}initialize(t){var e,n;return Ut(this,void 0,void 0,function*(){const{methodId:r,bigcommerce_payments_venmo:i}=t||{};if(!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(r);const o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(r);(null===(e=o.initializationData)||void 0===e?void 0:e.orderId)?this.orderId=null===(n=o.initializationData)||void 0===n?void 0:n.orderId:(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(r),this.loadingIndicatorContainer=i.container.split("#")[1],this.renderButton(r,i))})}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 U(["payment"]);if(!this.orderId)throw new N;yield this.paymentIntegrationService.submitOrder(r,e),yield this.bigCommercePaymentsIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new R)}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.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmo_checkout"),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 yt("Venmo is not available for your region. Please another payment method instead.");u&&"function"==typeof u&&u(),this.paypalButton.render(a)}handleClick(t,e){return Ut(this,void 0,void 0,function*(){const{resolve:n,reject:r}=t;yield 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=t(t=>new Nt(t,D(t),new o({styles:{backgroundColor:"black"}})),[{id:"bigcommerce_payments_venmo"}]);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.bigCommercePaymentsIntegrationService=e,this.onError=d.noop}initialize(t){return Lt(this,void 0,void 0,function*(){const{bigcommerce_payments:e,methodId:n}=t;if(!n)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');if(!e.container)throw new M('Unable to initialize payment because "options.bigcommerce_payments.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new M('Unable to initialize payment because "options.bigcommerce_payments.onClick" argument is not a function.');this.onError=e.onError||d.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.bigCommercePaymentsIntegrationService.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){const{container:n,onClick:r,onComplete:i}=e,o=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:s,paymentButtonStyles:u}=a.initializationData||{},{checkoutTopButtonStyles:c}=u||{},l=Object.assign({createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},r&&{onClick:()=>r()}),d={onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t),onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,i)},h=Object.assign(Object.assign({fundingSource:o.FUNDING.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},c),{height:36}))},l),s&&d),p=o.Buttons(h);p.isEligible()?p.render(`#${n}`):this.bigCommercePaymentsIntegrationService.removeElement(n)}onHostedCheckoutApprove(t,e,n,r){return Lt(this,void 0,void 0,function*(){if(!t.orderID)throw new f(s.MissingOrderId);const i=this.paymentIntegrationService.getState().getCartOrThrow(),o=yield e.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(o);if(yield this.paymentIntegrationService.updateBillingAddress(e),i.lineItems.physicalItems.length>0){const t=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(o);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.bigCommercePaymentsIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return Lt(this,void 0,void 0,function*(){const e=this.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}onShippingOptionsChange(t){return Lt(this,void 0,void 0,function*(){const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}}const qt=t(t=>new Vt(t,D(t)),[{id:"bigcommerce_payments"}]);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 Ht{constructor(t,e,n){this.paymentIntegrationService=t,this.bigCommercePaymentsSdk=e,this.bigCommercePaymentsFastlaneUtils=n}initialize(t){var e;return $t(this,void 0,void 0,function*(){const{methodId:n,bigcommerce_payments_fastlane:r}=t;if(!n)throw new M('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.bigCommercePaymentsSdk.getPayPalFastlaneSdk(o,i.currency.code,i.id);yield this.bigCommercePaymentsFastlaneUtils.initializePayPalFastlane(s,a,this.getFastlaneStyles(n,r))}catch(t){}return Promise.resolve()})}deinitialize(){return $t(this,void 0,void 0,function*(){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){return $t(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:e,continueWithCheckoutCallback:n,methodId:r}=t||{};if(!r)throw new M('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new M('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 $t(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.bigCommercePaymentsFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.bigCommercePaymentsFastlaneUtils.triggerAuthenticationFlowOrThrow(a),u=s.authenticationState===tt.CANCELED;yield this.updateCustomerDataState(t,s),u?this.bigCommercePaymentsFastlaneUtils.removeStorageSessionId():this.bigCommercePaymentsFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(t,e){var n;return $t(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:u}=this.bigCommercePaymentsFastlaneUtils.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 ct(i?r:{},null==e?void 0:e.styles)}}const Wt=t(t=>new Ht(t,rt(),st()),[{id:"bigcommerce_payments_fastlane"},{id:"bigcommerce_payments_creditcards"}]);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.bigCommercePaymentsIntegrationService=e,this.onError=d.noop}initialize(t){return Gt(this,void 0,void 0,function*(){const{bigcommerce_payments_paylater:e,methodId:n}=t;if(!n)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');if(!e.container)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater.onClick" argument is not a function.');this.onError=e.onError||d.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC BigCommercePayments PayLater]: 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,onComplete:r,onClick:i}=e,o=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:s,paymentButtonStyles:u}=a.initializationData||{},{checkoutTopButtonStyles:c}=u||{},l=Object.assign({createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},i&&{onClick:()=>i()}),d={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 p=!1;h.forEach(t=>{if(!p){const e=Object.assign(Object.assign({fundingSource:t,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},c),{height:36}))},l),s&&d),r=o.Buttons(e);r.isEligible()&&(r.render(`#${n}`),p=!0)}}),p||this.bigCommercePaymentsIntegrationService.removeElement(n)}onHostedCheckoutApprove(t,e,n,r){return Gt(this,void 0,void 0,function*(){if(!t.orderID)throw new f(s.MissingOrderId);const i=this.paymentIntegrationService.getState().getCartOrThrow(),o=yield e.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(o);if(yield this.paymentIntegrationService.updateBillingAddress(e),i.lineItems.physicalItems.length>0){const t=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(o);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.bigCommercePaymentsIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r()}catch(t){this.handleError(t)}})}onShippingAddressChange(t){return Gt(this,void 0,void 0,function*(){const e=this.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}onShippingOptionsChange(t){return Gt(this,void 0,void 0,function*(){const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(t){this.handleError(t)}})}handleError(t){if("function"!=typeof this.onError)throw t;this.onError(t)}}const Kt=t(t=>new Yt(t,D(t)),[{id:"bigcommerce_payments_paylater"}]);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){this.paymentIntegrationService=t,this.bigCommercePaymentsIntegrationService=e}initialize(t){return Jt(this,void 0,void 0,function*(){const{bigcommerce_payments_venmo:e,methodId:n}=t;if(!n)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo" argument is not provided.');if(!e.container)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo.container" argument is not provided.');if(e.onClick&&"function"!=typeof e.onClick)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,e):console.error("[BC Payments Venmo]: Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){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){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.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{paymentButtonStyles:a}=o.initializationData||{},{checkoutTopButtonStyles:s}=a||{},u=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},s),{height:36})),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmo"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},r&&{onClick:()=>r()}),c=i.Buttons(u);c.isEligible()?c.render(`#${n}`):this.bigCommercePaymentsIntegrationService.removeElement(n)}}const Xt=t(t=>new Zt(t,D(t)),[{id:"bigcommerce_payments_venmo"}]);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.bigCommercePaymentsIntegrationService=e}initialize(t){var e;return Qt(this,void 0,void 0,function*(){const{bigcommerce_payments:n,containerId:r,methodId:i}=t,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new M('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new M('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');if(o&&!n.currencyCode)throw new M('Unable to initialize payment because "options.bigcommerce_payments.currencyCode" argument is not provided.');if(o&&"function"!=typeof(null===(e=n.buyNowInitializeOptions)||void 0===e?void 0:e.getBuyNowCartRequestBody))throw new M('Unable to initialize payment because "options.bigcommerce_payments.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.bigCommercePaymentsIntegrationService.loadPayPalSdk(i,a,!1),this.renderButton(r,i,n)})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:c}=u.initializationData||{},l={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)},d={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h={onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t),onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,o)},p=Object.assign(Object.assign(Object.assign({fundingSource:s.FUNDING.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(i)},l),r&&d),c&&h),f=s.Buttons(p);f.isEligible()?f.render(`#${t}`):a&&"function"==typeof a?a():this.bigCommercePaymentsIntegrationService.removeElement(t)}handleClick(t){return Qt(this,void 0,void 0,function*(){if(t){const e=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(t,e,n,r){return Qt(this,void 0,void 0,function*(){if(!t.orderID)throw new f(s.MissingOrderId);const i=this.paymentIntegrationService.getState().getCartOrThrow(),o=yield e.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(o);if(yield this.paymentIntegrationService.updateBillingAddress(e),i.lineItems.physicalItems.length>0){const t=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(o);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.bigCommercePaymentsIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r(),!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.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(t){if("string"==typeof t)throw new Error(t);throw t}})}}const ee=t(t=>new te(t,D(t)),[{id:"bigcommerce_payments"}]);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.bigCommercePaymentsIntegrationService=e,this.payPalSdkHelper=n}initialize(t){return ne(this,void 0,void 0,function*(){const{bigcommerce_payments_paylater:e,containerId:n,methodId:r}=t,{buyNowInitializeOptions:i,currencyCode:o,messagingContainerId:a}=e||{},s=!!i;if(!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new M('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');if(s&&!o)throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater.currencyCode" argument is not provided.');if(s&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new M('Unable to initialize payment because "options.bigcommerce_payments_paylater.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');s||(yield this.paymentIntegrationService.loadDefaultCheckout());const u=this.paymentIntegrationService.getState(),c=s?o:u.getCartOrThrow().currency.code;yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(r,c,!1),this.renderButton(n,r,e);const l=a&&document.getElementById(a);if(c&&l){const t=u.getPaymentMethodOrThrow(r),{paypalBNPLConfiguration:e=[]}=t.initializationData||{},n=e&&e.find(({id:t})=>"cart"===t);if(!(null==n?void 0:n.status))return;l.removeAttribute("data-pp-style-logo-type"),l.removeAttribute("data-pp-style-logo-position"),l.removeAttribute("data-pp-style-text-color"),l.removeAttribute("data-pp-style-text-size");const i=yield this.payPalSdkHelper.getPayPalMessages(t,c);this.renderMessages(i,a,n)}})}deinitialize(){return Promise.resolve()}renderButton(t,e,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:c}=u.initializationData||{},l={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)},d={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h={onShippingAddressChange:t=>this.onShippingAddressChange(t),onShippingOptionsChange:t=>this.onShippingOptionsChange(t),onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,o)},p=[s.FUNDING.PAYLATER,s.FUNDING.CREDIT];let f=!1;p.forEach(e=>{if(!f){const n=Object.assign(Object.assign(Object.assign({fundingSource:e,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(i)},l),r&&d),c&&h),o=s.Buttons(n);o.isEligible()?(o.render(`#${t}`),f=!0):a&&"function"==typeof a&&a()}}),f||this.bigCommercePaymentsIntegrationService.removeElement(t)}handleClick(t){return ne(this,void 0,void 0,function*(){if(t){const e=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}onHostedCheckoutApprove(t,e,n,r){return ne(this,void 0,void 0,function*(){if(!t.orderID)throw new f(s.MissingOrderId);const i=this.paymentIntegrationService.getState().getCartOrThrow(),o=yield e.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(o);if(yield this.paymentIntegrationService.updateBillingAddress(e),i.lineItems.physicalItems.length>0){const t=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(o);yield this.paymentIntegrationService.updateShippingAddress(t),yield this.bigCommercePaymentsIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(n,t.orderID),r&&"function"==typeof r&&r(),!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.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(t.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.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:mt(n)};t.Messages(r).render(`#${e}`)}}const ie=t(t=>new re(t,D(t),rt()),[{id:"bigcommerce_payments_paylater"}]);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.bigCommercePaymentsIntegrationService=e}initialize(t){return oe(this,void 0,void 0,function*(){const{bigcommerce_payments_apms:e,containerId:n,methodId:r}=t,{apm:i,buyNowInitializeOptions:o,currencyCode:a}=e||{},s=!!o;if(!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new M('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments_apms" argument is not provided.');if(!i)throw new M('Unable to initialize payment because "options.bigcommerce_payments_apms.apm" argument is not provided.');if(s&&!a)throw new M('Unable to initialize payment because "options.bigcommerce_payments_apms.currencyCode" argument is not provided.');if(s&&"function"!=typeof(null==o?void 0:o.getBuyNowCartRequestBody))throw new M('Unable to initialize payment because "options.bigcommerce_payments_apms.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.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow();if(!Object.values(s.FUNDING).includes(r))throw new M('Unable to initialize PayPal button because "options.bigcommerce_payments_apms.apm" argument is not valid funding source.');const u={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apms"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)},c={onClick:()=>this.handleClick(i),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:r,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o)},u),i&&c),d=s.Buttons(l);d.isEligible()?d.render(`#${t}`):a&&"function"==typeof a?a():this.bigCommercePaymentsIntegrationService.removeElement(t)}handleClick(t){return oe(this,void 0,void 0,function*(){if(t){const e=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const se=t(t=>new ae(t,D(t)),[{id:"bigcommerce_payments_apms"}]);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.bigCommercePaymentsIntegrationService=e}initialize(t){return ue(this,void 0,void 0,function*(){const{bigcommerce_payments_venmo:e,containerId:n,methodId:r}=t,{buyNowInitializeOptions:i,currencyCode:o}=e||{},a=!!i;if(!r)throw new M('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new M('Unable to initialize payment because "options.containerId" argument is not provided.');if(!e)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo" argument is not provided.');if(a&&!o)throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new M('Unable to initialize payment because "options.bigcommerce_payments_venmo.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.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),s=a.FUNDING.VENMO,u={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmo"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.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.bigCommercePaymentsIntegrationService.removeElement(t)}getValidVenmoButtonStyles(t){const e=this.bigCommercePaymentsIntegrationService.getValidButtonStyle(t);return e.color===S.gold?Object.assign(Object.assign({},e),{color:void 0}):e}handleClick(t){return ue(this,void 0,void 0,function*(){if(t){const e=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(t);yield this.paymentIntegrationService.loadCheckout(e.id)}})}}const le=t(t=>new ce(t,D(t)),[{id:"bigcommerce_payments_venmo"}])})(),module.exports=r})();
3
3
  //# sourceMappingURL=bigcommerce-payments.js.map