@bigcommerce/checkout-sdk 1.889.0 → 1.889.1

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 e={35:(e,t,n)=>{e=n.nmd(e);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",a="[object Function]",s="[object Object]",c=/^\[object .+?Constructor\]$/,u=/^(?: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=t&&!t.nodeType&&t,v=g&&e&&!e.nodeType&&e,b=v&&v.exports===g,_=b&&f.process,w=function(){try{return v&&v.require&&v.require("util").types||_&&_.binding&&_.binding("util")}catch(e){}}(),P=w&&w.isTypedArray,S=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,M=(z&&z.allocUnsafe,h=Object.getPrototypeOf,p=Object,function(e){return h(p(e))}),D=Object.create,U=C.propertyIsEnumerable,N=S.splice,R=B?B.toStringTag:void 0,L=function(){try{var e=se(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),V=z?z.isBuffer:void 0,q=Math.max,$=Date.now,H=se(y,"Map"),W=se(Object,"create"),G=function(){function e(){}return function(t){if(!be(t))return{};if(D)return D(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function K(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Y(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function J(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Z(e){var t=this.__data__=new Y(e);this.size=t.size}function X(e,t,n){(void 0!==n&&!he(e[t],n)||void 0===n&&!(t in e))&&te(e,t,n)}function Q(e,t,n){var r=e[t];k.call(e,t)&&he(r,n)&&(void 0!==n||t in e)||te(e,t,n)}function ee(e,t){for(var n=e.length;n--;)if(he(e[n][0],t))return n;return-1}function te(e,t,n){"__proto__"==t&&L?L(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}K.prototype.clear=function(){this.__data__=W?W(null):{},this.size=0},K.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},K.prototype.get=function(e){var t=this.__data__;if(W){var n=t[e];return n===r?void 0:n}return k.call(t,e)?t[e]:void 0},K.prototype.has=function(e){var t=this.__data__;return W?void 0!==t[e]:k.call(t,e)},K.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=W&&void 0===t?r:t,this},Y.prototype.clear=function(){this.__data__=[],this.size=0},Y.prototype.delete=function(e){var t=this.__data__,n=ee(t,e);return!(n<0||(n==t.length-1?t.pop():N.call(t,n,1),--this.size,0))},Y.prototype.get=function(e){var t=this.__data__,n=ee(t,e);return n<0?void 0:t[n][1]},Y.prototype.has=function(e){return ee(this.__data__,e)>-1},Y.prototype.set=function(e,t){var n=this.__data__,r=ee(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},J.prototype.clear=function(){this.size=0,this.__data__={hash:new K,map:new(H||Y),string:new K}},J.prototype.delete=function(e){var t=ae(this,e).delete(e);return this.size-=t?1:0,t},J.prototype.get=function(e){return ae(this,e).get(e)},J.prototype.has=function(e){return ae(this,e).has(e)},J.prototype.set=function(e,t){var n=ae(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Z.prototype.clear=function(){this.__data__=new Y,this.size=0},Z.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Z.prototype.get=function(e){return this.__data__.get(e)},Z.prototype.has=function(e){return this.__data__.has(e)},Z.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Y){var r=n.__data__;if(!H||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new J(r)}return n.set(e,t),this.size=n.size,this};function ne(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":R&&R in Object(e)?function(e){var t=k.call(e,R),n=e[R];try{e[R]=void 0;var r=!0}catch(e){}var i=j.call(e);return r&&(t?e[R]=n:delete e[R]),i}(e):function(e){return j.call(e)}(e)}function re(e){return _e(e)&&ne(e)==o}function ie(e,t,n,r,i){e!==t&&function(e,t,n){for(var r=-1,i=Object(e),o=n(e),a=o.length;a--;){var s=o[++r];if(!1===t(i[s],s,i))break}}(t,function(o,a){if(i||(i=new Z),be(o))!function(e,t,n,r,i,o,a){var c=le(e,n),u=le(t,n),l=a.get(u);if(l)X(e,n,l);else{var d,h,p,f,m,y=o?o(c,u,n+"",e,t,a):void 0,g=void 0===y;if(g){var v=fe(u),b=!v&&ye(u),_=!v&&!b&&we(u);y=u,v||b||_?fe(c)?y=c:_e(m=c)&&me(m)?y=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(c):b?(g=!1,y=function(e){return e.slice()}(u)):_?(g=!1,f=new(p=(d=u).buffer).constructor(p.byteLength),new F(f).set(new F(p)),h=f,y=new d.constructor(h,d.byteOffset,d.length)):y=[]:function(e){if(!_e(e)||ne(e)!=s)return!1;var t=M(e);if(null===t)return!0;var n=k.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&A.call(n)==x}(u)||pe(u)?(y=c,pe(c)?y=function(e){return function(e,t,n){var r=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),r?te(n,a,s):Q(n,a,s)}return n}(e,Pe(e))}(c):be(c)&&!ge(c)||(y=function(e){return"function"!=typeof e.constructor||ue(e)?{}:G(M(e))}(u))):g=!1}g&&(a.set(u,y),i(y,u,r,o,a),a.delete(u)),X(e,n,y)}}(e,t,a,n,ie,r,i);else{var c=r?r(le(e,a),o,a+"",e,t,i):void 0;void 0===c&&(c=o),X(e,a,c)}},Pe)}var oe=L?function(e,t){return L(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:Ce;function ae(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function se(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!be(e)||function(e){return!!E&&E in e}(e))&&(ge(e)?T:c).test(function(e){if(null!=e){try{return A.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}(n)?n:void 0}function ce(e,t){var n=typeof e;return!!(t=null==t?i:t)&&("number"==n||"symbol"!=n&&u.test(e))&&e>-1&&e%1==0&&e<t}function ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||C)}function le(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var de=function(e){var t=0,n=0;return function(){var r=$(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(oe);function he(e,t){return e===t||e!=e&&t!=t}var pe=re(function(){return arguments}())?re:function(e){return _e(e)&&k.call(e,"callee")&&!U.call(e,"callee")},fe=Array.isArray;function me(e){return null!=e&&ve(e.length)&&!ge(e)}var ye=V||function(){return!1};function ge(e){if(!be(e))return!1;var t=ne(e);return t==a||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ve(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function be(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function _e(e){return null!=e&&"object"==typeof e}var we=P?function(e){return function(t){return e(t)}}(P):function(e){return _e(e)&&ve(e.length)&&!!l[ne(e)]};function Pe(e){return me(e)?function(e,t){var n=fe(e),r=!n&&pe(e),i=!n&&!r&&ye(e),o=!n&&!r&&!i&&we(e),a=n||r||i||o,s=a?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=s.length;for(var u in e)!t&&!k.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ce(u,c))||s.push(u);return s}(e,!0):function(e){if(!be(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=ue(e),n=[];for(var r in e)("constructor"!=r||!t&&k.call(e,r))&&n.push(r);return n}(e)}var Se,Ie=(Se=function(e,t,n){ie(e,t,n)},function(e,t){return de(function(e,t,n){return t=q(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=q(r.length-t,0),a=Array(o);++i<o;)a[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,Ce),e+"")}(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(i=Se.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(e,t,n){if(!be(n))return!1;var r=typeof t;return!!("number"==r?me(n)&&ce(t,n.length):"string"==r&&t in n)&&he(n[t],e)}(t[0],t[1],o)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var a=t[n];a&&Se(e,a,n)}return e}));function Ce(e){return e}e.exports=Ie},168:e=>{var t;t=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({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(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var c in o)o[c]&&(s+="; "+c,!0!==o[c]&&(s+="="+o[c].split(";")[0]));return document.cookie=t+"="+n+s}}function a(e,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("="),c=s.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var u=t(s[0]);if(c=(r.read||r)(c,u)||t(c),n)try{c=JSON.parse(c)}catch(e){}if(i[u]=c,e===u)break}catch(e){}}return e?i[e]:i}}return i.set=o,i.get=function(e){return a(e,!1)},i.getJSON=function(e){return a(e,!0)},i.remove=function(t,n){o(t,"",e(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}(function(){})},"function"==typeof define&&define.amd&&define(t),e.exports=t()},282:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(9722);t.default=function(){return r||(r=i.default()),r}},315:(e,t,n)=>{"use strict";n(4886).default;var r=n(471);t.Hb=r.default;var i=n(5895);t.vQ=i.default,n(7995).default,n(9722).default,n(282).default},321:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(168),i=n(1675),o=n(5861),a=n(4670);function s(e){return new a.A(new o.A,new i.A,r,e)}},471:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(4886);t.default=function(){return new o.default(new i.default,r.createRequestSender())}},710:(e,t,n)=>{"use strict";function r(e){return"object"!=typeof e||null===e?e:Object.keys(e).filter(function(t){return void 0!==e[t]}).map(function(t){var n=e[t];return"string"==typeof n?t+"="+encodeURIComponent(n):t+"="+encodeURIComponent(JSON.stringify(n)||"")}).join("&")}n.d(t,{A:()=>r})},803:e=>{"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},1675:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(4321),i=n(710),o=/application\/(\w+\+)?json/,a=/application\/x-www-form-urlencoded/;const s=function(){function e(){}return e.prototype.toRequestBody=function(e){var t=e.headers?this._getHeader(e.headers,"Content-Type"):"";if(e.body){if(o.test(t))return JSON.stringify(e.body);if(a.test(t))return(0,i.A)(e.body)}return e.body},e.prototype.toResponse=function(e){var t=this._parseResponseHeaders(e.getAllResponseHeaders());return{body:this._parseResponseBody("response"in e?e.response:e.responseText,t),headers:t,status:e.status,statusText:e.statusText}},e.prototype._parseResponseBody=function(e,t){var n=this._getHeader(t,"Content-Type");return e&&o.test(n)?JSON.parse(e):e},e.prototype._parseResponseHeaders=function(e){return(e?e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/):[]).reduce(function(e,t){var n,i=t.split(":"),o=(i.shift()||"").trim();return o?(0,r.Cl)((0,r.Cl)({},e),((n={})[o.toLowerCase()]=i.join(":").trim(),n)):e},{})},e.prototype._getHeader=function(e,t){return e&&t&&(e[t]||e[t.toLowerCase()])||""},e}()},1915:e=>{"use strict";var t="%[a-f0-9]{2}",n=new RegExp("("+t+")|([^%]+?)","gi"),r=new RegExp("("+t+")+","gi");function i(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function o(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(n)||[],r=1;r<t.length;r++)t=(e=i(t,r).join("")).match(n)||[];return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=r.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var i=o(n[0]);i!==n[0]&&(t[n[0]]=i)}n=r.exec(e)}t["%C2"]="�";for(var a=Object.keys(t),s=0;s<a.length;s++){var c=a[s];e=e.replace(new RegExp(c,"g"),t[c])}return e}(e)}}},2024:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});const r=function(){function e(e){var t=this;this._delay=e,this._resolve=function(){},this._promise=new Promise(function(e){t._resolve=e})}return e.prototype.onComplete=function(e){this._promise.then(e)},e.prototype.complete=function(){this._resolve(),this._timeoutToken&&window.clearTimeout(this._timeoutToken)},e.prototype.start=function(){var e=this;this._delay&&(this._timeoutToken=window.setTimeout(function(){return e.complete()},this._delay))},e}()},4043:(e,t,n)=>{"use strict";n.r(t),n.d(t,{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:(e,t,n)=>{"use strict";n.d(t,{Cl:()=>r});var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)}},4325:(e,t,n)=>{"use strict";n.d(t,{g:()=>i});var r=n(5889),i=function(){function e(){this._cache={}}return e.prototype.read=function(e,t){var n=this.getKey(e,t.params);return this._cache[n]||null},e.prototype.write=function(e,t,n){var r=this.getKey(e,t.params);this._cache[r]=n},e.prototype.getKey=function(e,t){return void 0===t&&(t={}),0===Object.keys(t).length?e:e+"?"+r.As(t)},e}()},4475:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,i){for(var o,a,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var u in o=Object(arguments[c]))n.call(o,u)&&(s[u]=o[u]);if(t){a=t(o);for(var l=0;l<a.length;l++)r.call(o,a[l])&&(s[a[l]]=o[a[l]])}}return s}},4670:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});var r=n(4321),i=n(35),o=n.n(i),a=n(4325),s=n(4843),c=n(2024);const u=function(){function e(e,t,n,r){void 0===r&&(r={}),this._requestFactory=e,this._payloadTransformer=t,this._cookie=n,this._options=r,this._cache=this._options.cache||new a.g}return e.prototype.sendRequest=function(e,t){var n=this,r=this._mergeDefaultOptions(e,t),i=this._getCachedRequest(e,r);if(i)return Promise.resolve(i);var o=this._requestFactory.createRequest(this._prependHost(e),r);return new Promise(function(t,i){var a=function(){var a=n._payloadTransformer.toResponse(o);a.status>=200&&a.status<300?(n._cacheRequest(e,r,a),t(a)):i(a)};o.onload=a,o.onerror=a,o.onabort=a,o.ontimeout=a,r.timeout instanceof c.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))})},e.prototype.get=function(e,t){return this.sendRequest(e,(0,r.Cl)((0,r.Cl)({},t),{method:"GET"}))},e.prototype.post=function(e,t){return this.sendRequest(e,(0,r.Cl)((0,r.Cl)({},t),{method:"POST"}))},e.prototype.put=function(e,t){return this.sendRequest(e,(0,r.Cl)((0,r.Cl)({},t),{method:"PUT"}))},e.prototype.patch=function(e,t){return this.sendRequest(e,(0,r.Cl)((0,r.Cl)({},t),{method:"PATCH"}))},e.prototype.delete=function(e,t){return this.sendRequest(e,(0,r.Cl)((0,r.Cl)({},t),{method:"DELETE"}))},e.prototype._mergeDefaultOptions=function(e,t){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(e,t)&&this._isLocalRequest(e)&&(n.headers["X-XSRF-TOKEN"]=r),t&&t.body&&n.headers&&(n.headers["Content-Type"]="application/json"),o()({},n,t)},e.prototype._prependHost=function(e){return!this._options.host||/^https?:\/\//.test(e)?e:this._options.host.replace(/\/$/,"")+"/"+e.replace(/^\//,"")},e.prototype._shouldCacheRequest=function(e){return"GET"===(e.method||"GET").toUpperCase()&&Boolean(e.cache)},e.prototype._getCachedRequest=function(e,t){return this._shouldCacheRequest(t)?this._cache.read(e,t):null},e.prototype._cacheRequest=function(e,t,n){this._shouldCacheRequest(t)&&this._cache.write(e,t,n)},e.prototype._isAssetRequest=function(e,t){return(!t||!t.method||"GET"===t.method.toUpperCase())&&/\.(png|gif|jpe?g|css|js|json|svg|html?)$/.test(e.split("?")[0])},e.prototype._isLocalRequest=function(e){return!!e.match(new RegExp("^(https?:)?//"+window.location.hostname))||!e.match(new RegExp("^(https?:)?//"))},e}()},4843:(e,t,n)=>{"use strict";function r(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}n.d(t,{A:()=>r})},4886:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._browserSupport=e,this._requestSender=t,this._scripts={},this._preloadedScripts={}}return e.prototype.loadScript=function(e,t){var n=this;return this._scripts[e]||(this._scripts[e]=new Promise(function(r,i){var o=document.createElement("script"),a=t||{},s=a.async,c=void 0!==s&&s,u=a.attributes,l=void 0===u?{}:u;Object.keys(l).forEach(function(e){o.setAttribute(e,l[e])}),o.onload=function(){return r()},o.onreadystatechange=function(){return r()},o.onerror=function(t){delete n._scripts[e],i(t)},o.async=c,o.src=e,document.body.appendChild(o)})),this._scripts[e]},e.prototype.loadScripts=function(e,t){var n=this;return Promise.all(e.map(function(e){return n.loadScript(e,t)})).then(function(){})},e.prototype.preloadScript=function(e,t){var n=this;return this._preloadedScripts[e]||(this._preloadedScripts[e]=new Promise(function(r,i){var o=(t||{}).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=e,s.onload=function(){r()},s.onerror=function(){delete n._preloadedScripts[e],i()},document.head.appendChild(s)}else n._requestSender.get(e,{credentials:!1,headers:{Accept:"application/javascript"}}).then(function(){return r()}).catch(i)})),this._preloadedScripts[e]},e.prototype.preloadScripts=function(e,t){var n=this;return Promise.all(e.map(function(e){return n.preloadScript(e,t)})).then(function(){})},e}();t.default=n},5470:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9783),i=function(){function e(e,t){this._formBuilder=e,this._options=t}return e.prototype.postForm=function(e,t,n,r){var i=this._formBuilder.build(this._prependHost(e),t,r);window.addEventListener("unload",function e(){window.removeEventListener("unload",e),n&&n()}),document.body.appendChild(i),i.submit()},e.prototype._prependHost=function(e){return this._options&&this._options.host&&!(0,r.isAbsoluteUrl)(e)?(0,r.joinPaths)(this._options.host,e):e},e}();t.default=i},5477:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.canSupportRel=function(e){var t=document.createElement("link");return!!(t.relList&&t.relList.supports&&t.relList.supports(e))},e}();t.default=n},5861:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(5889);const i=function(){function e(){}return e.prototype.createRequest=function(e,t){var n=new XMLHttpRequest;return this._configureRequest(n,e,t),n},e.prototype._configureRequest=function(e,t,n){void 0===n&&(n={}),e.open(n.method||"GET",this._formatUrl(t,n.params,n.encodeParams),!0),n.headers&&this._configureRequestHeaders(e,n.headers),"boolean"==typeof n.credentials&&(e.withCredentials=n.credentials),"number"==typeof n.timeout&&(e.timeout=n.timeout)},e.prototype._configureRequestHeaders=function(e,t){Object.keys(t).filter(function(e){return null!==t[e]}).forEach(function(n){e.setRequestHeader(n,t[n])})},e.prototype._formatUrl=function(e,t,n){return void 0===n&&(n=!0),t&&0!==Object.keys(t).length?e+"?"+r.As(t,{encode:n}):e},e}()},5889:(e,t,n)=>{"use strict";var r=n(803),i=n(4475);n(1915);function o(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}t.As=function(e,t){!1===(t=i({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=function(){});var n=function(e){switch(e.arrayFormat){case"index":return function(t,n,r){return null===n?[o(t,e),"[",r,"]"].join(""):[o(t,e),"[",o(r,e),"]=",o(n,e)].join("")};case"bracket":return function(t,n){return null===n?o(t,e):[o(t,e),"[]=",o(n,e)].join("")};default:return function(t,n){return null===n?o(t,e):[o(t,e),"=",o(n,e)].join("")}}}(t);return e?Object.keys(e).sort(t.sort).map(function(r){var i=e[r];if(void 0===i)return"";if(null===i)return o(r,t);if(Array.isArray(i)){var a=[];return i.slice().forEach(function(e){void 0!==e&&a.push(n(r,e,a.length))}),a.join("&")}return o(r,t)+"="+o(i,t)}).filter(function(e){return e.length>0}).join("&"):""}},5895:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(471);t.default=function(){return r||(r=i.default()),r}},6889:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(2024);function i(e){return new r.A(e)}},7995:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._browserSupport=e,this._requestSender=t,this._stylesheets={},this._preloadedStylesheets={}}return e.prototype.loadStylesheet=function(e,t){var n=this;return this._stylesheets[e]||(this._stylesheets[e]=new Promise(function(r,i){var o=document.createElement("link"),a=t||{},s=a.prepend,c=void 0!==s&&s,u=a.attributes,l=void 0===u?{}:u;Object.keys(l).forEach(function(e){o.setAttribute(e,l[e])}),o.onload=function(){return r()},o.onerror=function(t){delete n._stylesheets[e],i(t)},o.rel="stylesheet",o.href=e,c&&document.head.children[0]?document.head.insertBefore(o,document.head.children[0]):document.head.appendChild(o)})),this._stylesheets[e]},e.prototype.loadStylesheets=function(e,t){var n=this;return Promise.all(e.map(function(e){return n.loadStylesheet(e,t)})).then(function(){})},e.prototype.preloadStylesheet=function(e,t){var n=this;return this._preloadedStylesheets[e]||(this._preloadedStylesheets[e]=new Promise(function(r,i){var o=(t||{}).prefetch,a=void 0!==o&&o,s=a?"prefetch":"preload";if(n._browserSupport.canSupportRel(s)){var c=document.createElement("link");c.as="style",c.rel=a?"prefetch":"preload",c.href=e,c.onload=function(){r()},c.onerror=function(t){delete n._preloadedStylesheets[e],i(t)},document.head.appendChild(c)}else n._requestSender.get(e,{credentials:!1,headers:{Accept:"text/css"}}).then(function(){return r()}).catch(i)})),this._preloadedStylesheets[e]},e.prototype.preloadStylesheets=function(e,t){var n=this;return Promise.all(e.map(function(e){return n.preloadStylesheet(e,t)})).then(function(){})},e}();t.default=n},8686:(e,t,n)=>{"use strict";t.createFormPoster=void 0;var r=n(9165);Object.defineProperty(t,"createFormPoster",{enumerable:!0,get:function(){return r.default}});n(5470)},9165:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9828),i=n(5470);t.default=function(e){var t=new r.default;return new i.default(t,e)}},9440:function(e,t,n){e=n.nmd(e),function(){var r,i="Expected a function",o="__lodash_hash_undefined__",a="__lodash_placeholder__",s=32,c=128,u=1/0,l=9007199254740991,d=NaN,h=4294967295,p=[["ary",c],["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]",P="[object Number]",S="[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]",M="[object Int32Array]",D="[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),K=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),ne=/^\s+/,re=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,le=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,pe=/^0b[01]+$/i,fe=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,be=/['\n\r\u2028\u2029\\]/g,_e="\\ud800-\\udfff",we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pe="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",Ce="\\ufe0e\\ufe0f",Oe="\\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",Ae="["+_e+"]",ke="["+Oe+"]",Ee="["+we+"]",je="\\d+",xe="["+Pe+"]",Te="["+Se+"]",ze="[^"+_e+Oe+je+Pe+Se+Ie+"]",Be="\\ud83c[\\udffb-\\udfff]",Fe="[^"+_e+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",De="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+Ie+"]",Ne="\\u200d",Re="(?:"+Te+"|"+ze+")",Le="(?:"+Ue+"|"+ze+")",Ve="(?:['’](?:d|ll|m|re|s|t|ve))?",qe="(?:['’](?:D|LL|M|RE|S|T|VE))?",$e="(?:"+Ee+"|"+Be+")?",He="["+Ce+"]?",We=He+$e+"(?:"+Ne+"(?:"+[Fe,Me,De].join("|")+")"+He+$e+")*",Ge="(?:"+[xe,Me,De].join("|")+")"+We,Ke="(?:"+[Fe+Ee+"?",Ee,Me,De,Ae].join("|")+")",Ye=RegExp("['’]","g"),Je=RegExp(Ee,"g"),Ze=RegExp(Be+"(?="+Be+")|"+Ke+We,"g"),Xe=RegExp([Ue+"?"+Te+"+"+Ve+"(?="+[ke,Ue,"$"].join("|")+")",Le+"+"+qe+"(?="+[ke,Ue+Re,"$"].join("|")+")",Ue+"?"+Re+"+"+Ve,Ue+"+"+qe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",je,Ge].join("|"),"g"),Qe=RegExp("["+Ne+_e+we+Ce+"]"),et=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,tt=["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"],nt=-1,rt={};rt[T]=rt[z]=rt[B]=rt[F]=rt[M]=rt[D]=rt[U]=rt[N]=rt[R]=!0,rt[f]=rt[m]=rt[j]=rt[y]=rt[x]=rt[g]=rt[v]=rt[b]=rt[w]=rt[P]=rt[S]=rt[C]=rt[O]=rt[A]=rt[E]=!1;var it={};it[f]=it[m]=it[j]=it[x]=it[y]=it[g]=it[T]=it[z]=it[B]=it[F]=it[M]=it[w]=it[P]=it[S]=it[C]=it[O]=it[A]=it[k]=it[D]=it[U]=it[N]=it[R]=!0,it[v]=it[b]=it[E]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},at=parseFloat,st=parseInt,ct="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ut="object"==typeof self&&self&&self.Object===Object&&self,lt=ct||ut||Function("return this")(),dt=t&&!t.nodeType&&t,ht=dt&&e&&!e.nodeType&&e,pt=ht&&ht.exports===dt,ft=pt&&ct.process,mt=function(){try{return ht&&ht.require&&ht.require("util").types||ft&&ft.binding&&ft.binding("util")}catch(e){}}(),yt=mt&&mt.isArrayBuffer,gt=mt&&mt.isDate,vt=mt&&mt.isMap,bt=mt&&mt.isRegExp,_t=mt&&mt.isSet,wt=mt&&mt.isTypedArray;function Pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function St(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(r,a,n(a),e)}return r}function It(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Ct(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Ot(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function At(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function kt(e,t){return!(null==e||!e.length)&&Ut(e,t,0)>-1}function Et(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function jt(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function xt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Tt(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function zt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Bt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Ft=Vt("length");function Mt(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function Dt(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function Ut(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Dt(e,Rt,n)}function Nt(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Rt(e){return e!=e}function Lt(e,t){var n=null==e?0:e.length;return n?Ht(e,t)/n:d}function Vt(e){return function(t){return null==t?r:t[e]}}function qt(e){return function(t){return null==e?r:e[t]}}function $t(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}function Ht(e,t){for(var n,i=-1,o=e.length;++i<o;){var a=t(e[i]);a!==r&&(n=n===r?a:n+a)}return n}function Wt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Gt(e){return e?e.slice(0,dn(e)+1).replace(ne,""):e}function Kt(e){return function(t){return e(t)}}function Yt(e,t){return jt(t,function(t){return e[t]})}function Jt(e,t){return e.has(t)}function Zt(e,t){for(var n=-1,r=e.length;++n<r&&Ut(t,e[n],0)>-1;);return n}function Xt(e,t){for(var n=e.length;n--&&Ut(t,e[n],0)>-1;);return n}var Qt=qt({À:"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"}),en=qt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function tn(e){return"\\"+ot[e]}function nn(e){return Qe.test(e)}function rn(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function on(e,t){return function(n){return e(t(n))}}function an(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];s!==t&&s!==a||(e[n]=a,o[i++]=n)}return o}function sn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function cn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function un(e){return nn(e)?function(e){for(var t=Ze.lastIndex=0;Ze.test(e);)++t;return t}(e):Ft(e)}function ln(e){return nn(e)?function(e){return e.match(Ze)||[]}(e):function(e){return e.split("")}(e)}function dn(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var hn=qt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),pn=function e(t){var n,re=(t=null==t?lt:pn.defaults(lt.Object(),t,pn.pick(lt,tt))).Array,_e=t.Date,we=t.Error,Pe=t.Function,Se=t.Math,Ie=t.Object,Ce=t.RegExp,Oe=t.String,Ae=t.TypeError,ke=re.prototype,Ee=Pe.prototype,je=Ie.prototype,xe=t["__core-js_shared__"],Te=Ee.toString,ze=je.hasOwnProperty,Be=0,Fe=(n=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Me=je.toString,De=Te.call(Ie),Ue=lt._,Ne=Ce("^"+Te.call(ze).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=pt?t.Buffer:r,Le=t.Symbol,Ve=t.Uint8Array,qe=Re?Re.allocUnsafe:r,$e=on(Ie.getPrototypeOf,Ie),He=Ie.create,We=je.propertyIsEnumerable,Ge=ke.splice,Ke=Le?Le.isConcatSpreadable:r,Ze=Le?Le.iterator:r,Qe=Le?Le.toStringTag:r,ot=function(){try{var e=co(Ie,"defineProperty");return e({},"",{}),e}catch(e){}}(),ct=t.clearTimeout!==lt.clearTimeout&&t.clearTimeout,ut=_e&&_e.now!==lt.Date.now&&_e.now,dt=t.setTimeout!==lt.setTimeout&&t.setTimeout,ht=Se.ceil,ft=Se.floor,mt=Ie.getOwnPropertySymbols,Ft=Re?Re.isBuffer:r,qt=t.isFinite,fn=ke.join,mn=on(Ie.keys,Ie),yn=Se.max,gn=Se.min,vn=_e.now,bn=t.parseInt,_n=Se.random,wn=ke.reverse,Pn=co(t,"DataView"),Sn=co(t,"Map"),In=co(t,"Promise"),Cn=co(t,"Set"),On=co(t,"WeakMap"),An=co(Ie,"create"),kn=On&&new On,En={},jn=Do(Pn),xn=Do(Sn),Tn=Do(In),zn=Do(Cn),Bn=Do(On),Fn=Le?Le.prototype:r,Mn=Fn?Fn.valueOf:r,Dn=Fn?Fn.toString:r;function Un(e){if(es(e)&&!qa(e)&&!(e instanceof Vn)){if(e instanceof Ln)return e;if(ze.call(e,"__wrapped__"))return Uo(e)}return new Ln(e)}var Nn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function Rn(){}function Ln(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function Vn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function $n(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Hn;++t<n;)this.add(e[t])}function Gn(e){var t=this.__data__=new $n(e);this.size=t.size}function Kn(e,t){var n=qa(e),r=!n&&Va(e),i=!n&&!r&&Ga(e),o=!n&&!r&&!i&&cs(e),a=n||r||i||o,s=a?Wt(e.length,Oe):[],c=s.length;for(var u in e)!t&&!ze.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||yo(u,c))||s.push(u);return s}function Yn(e){var t=e.length;return t?e[Hr(0,t-1)]:r}function Jn(e,t){return To(Oi(e),or(t,0,e.length))}function Zn(e){return To(Oi(e))}function Xn(e,t,n){(n!==r&&!Na(e[t],n)||n===r&&!(t in e))&&rr(e,t,n)}function Qn(e,t,n){var i=e[t];ze.call(e,t)&&Na(i,n)&&(n!==r||t in e)||rr(e,t,n)}function er(e,t){for(var n=e.length;n--;)if(Na(e[n][0],t))return n;return-1}function tr(e,t,n,r){return lr(e,function(e,i,o){t(r,e,n(e),o)}),r}function nr(e,t){return e&&Ai(t,js(t),e)}function rr(e,t,n){"__proto__"==t&&ot?ot(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ir(e,t){for(var n=-1,i=t.length,o=re(i),a=null==e;++n<i;)o[n]=a?r:Cs(e,t[n]);return o}function or(e,t,n){return e==e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function ar(e,t,n,i,o,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=o?n(e,i,o,a):n(e)),s!==r)return s;if(!Qa(e))return e;var d=qa(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ze.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!c)return Oi(e,s)}else{var h=ho(e),p=h==b||h==_;if(Ga(e))return _i(e,c);if(h==S||h==f||p&&!o){if(s=u||p?{}:fo(e),!c)return u?function(e,t){return Ai(e,lo(e),t)}(e,function(e,t){return e&&Ai(t,xs(t),e)}(s,e)):function(e,t){return Ai(e,uo(e),t)}(e,nr(s,e))}else{if(!it[h])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case j:return wi(e);case y:case g:return new i(+e);case x:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case T:case z:case B:case F:case M:case D:case U:case N:case R:return Pi(e,n);case w:return new i;case P:case A:return new i(e);case C:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case O:return new i;case k:return r=e,Mn?Ie(Mn.call(r)):{}}}(e,h,c)}}a||(a=new Gn);var m=a.get(e);if(m)return m;a.set(e,s),os(e)?e.forEach(function(r){s.add(ar(r,t,n,r,e,a))}):ts(e)&&e.forEach(function(r,i){s.set(i,ar(r,t,n,i,e,a))});var v=d?r:(l?u?to:eo:u?xs:js)(e);return It(v||e,function(r,i){v&&(r=e[i=r]),Qn(s,i,ar(r,t,n,i,e,a))}),s}function sr(e,t,n){var i=n.length;if(null==e)return!i;for(e=Ie(e);i--;){var o=n[i],a=t[o],s=e[o];if(s===r&&!(o in e)||!a(s))return!1}return!0}function cr(e,t,n){if("function"!=typeof e)throw new Ae(i);return ko(function(){e.apply(r,n)},t)}function ur(e,t,n,r){var i=-1,o=kt,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=jt(t,Kt(n))),r?(o=Et,a=!1):t.length>=200&&(o=Jt,a=!1,t=new Wn(t));e:for(;++i<s;){var l=e[i],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var h=u;h--;)if(t[h]===d)continue e;c.push(l)}else o(t,d,r)||c.push(l)}return c}Un.templateSettings={escape:K,evaluate:Y,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(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},qn.prototype.get=function(e){var t=this.__data__;if(An){var n=t[e];return n===o?r:n}return ze.call(t,e)?t[e]:r},qn.prototype.has=function(e){var t=this.__data__;return An?t[e]!==r:ze.call(t,e)},qn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=An&&t===r?o:t,this},$n.prototype.clear=function(){this.__data__=[],this.size=0},$n.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():Ge.call(t,n,1),--this.size,0))},$n.prototype.get=function(e){var t=this.__data__,n=er(t,e);return n<0?r:t[n][1]},$n.prototype.has=function(e){return er(this.__data__,e)>-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(Sn||$n),string:new qn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(e){return this.__data__.set(e,o),this},Wn.prototype.has=function(e){return this.__data__.has(e)},Gn.prototype.clear=function(){this.__data__=new $n,this.size=0},Gn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Gn.prototype.get=function(e){return this.__data__.get(e)},Gn.prototype.has=function(e){return this.__data__.has(e)},Gn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var lr=ji(vr),dr=ji(br,!0);function hr(e,t){var n=!0;return lr(e,function(e,r,i){return n=!!t(e,r,i)}),n}function pr(e,t,n){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(c===r?s==s&&!ss(s):n(s,c)))var c=s,u=a}return u}function fr(e,t){var n=[];return lr(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function mr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=mo),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?mr(s,t-1,n,r,i):xt(i,s):r||(i[i.length]=s)}return i}var yr=xi(),gr=xi(!0);function vr(e,t){return e&&yr(e,t,js)}function br(e,t){return e&&gr(e,t,js)}function _r(e,t){return At(t,function(t){return Ja(e[t])})}function wr(e,t){for(var n=0,i=(t=yi(t,e)).length;null!=e&&n<i;)e=e[Mo(t[n++])];return n&&n==i?e:r}function Pr(e,t,n){var r=t(e);return qa(e)?r:xt(r,n(e))}function Sr(e){return null==e?e===r?"[object Undefined]":"[object Null]":Qe&&Qe in Ie(e)?function(e){var t=ze.call(e,Qe),n=e[Qe];try{e[Qe]=r;var i=!0}catch(e){}var o=Me.call(e);return i&&(t?e[Qe]=n:delete e[Qe]),o}(e):function(e){return Me.call(e)}(e)}function Ir(e,t){return e>t}function Cr(e,t){return null!=e&&ze.call(e,t)}function Or(e,t){return null!=e&&t in Ie(e)}function Ar(e,t,n){for(var i=n?Et:kt,o=e[0].length,a=e.length,s=a,c=re(a),u=1/0,l=[];s--;){var d=e[s];s&&t&&(d=jt(d,Kt(t))),u=gn(d.length,u),c[s]=!n&&(t||o>=120&&d.length>=120)?new Wn(s&&d):r}d=e[0];var h=-1,p=c[0];e:for(;++h<o&&l.length<u;){var f=d[h],m=t?t(f):f;if(f=n||0!==f?f:0,!(p?Jt(p,m):i(l,m,n))){for(s=a;--s;){var y=c[s];if(!(y?Jt(y,m):i(e[s],m,n)))continue e}p&&p.push(m),l.push(f)}}return l}function kr(e,t,n){var i=null==(e=Co(e,t=yi(t,e)))?e:e[Mo(Yo(t))];return null==i?r:Pt(i,e,n)}function Er(e){return es(e)&&Sr(e)==f}function jr(e,t,n,i,o){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,n,i,o,a){var s=qa(e),c=qa(t),u=s?m:ho(e),l=c?m:ho(t),d=(u=u==f?S:u)==S,h=(l=l==f?S:l)==S,p=u==l;if(p&&Ga(e)){if(!Ga(t))return!1;s=!0,d=!1}if(p&&!d)return a||(a=new Gn),s||cs(e)?Xi(e,t,n,i,o,a):function(e,t,n,r,i,o,a){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case j:return!(e.byteLength!=t.byteLength||!o(new Ve(e),new Ve(t)));case y:case g:case P:return Na(+e,+t);case v:return e.name==t.name&&e.message==t.message;case C:case A:return e==t+"";case w:var s=rn;case O:var c=1&r;if(s||(s=sn),e.size!=t.size&&!c)return!1;var u=a.get(e);if(u)return u==t;r|=2,a.set(e,t);var l=Xi(s(e),s(t),r,i,o,a);return a.delete(e),l;case k:if(Mn)return Mn.call(e)==Mn.call(t)}return!1}(e,t,u,n,i,o,a);if(!(1&n)){var b=d&&ze.call(e,"__wrapped__"),_=h&&ze.call(t,"__wrapped__");if(b||_){var I=b?e.value():e,E=_?t.value():t;return a||(a=new Gn),o(I,E,n,i,a)}}return!!p&&(a||(a=new Gn),function(e,t,n,i,o,a){var s=1&n,c=eo(e),u=c.length;if(u!=eo(t).length&&!s)return!1;for(var l=u;l--;){var d=c[l];if(!(s?d in t:ze.call(t,d)))return!1}var h=a.get(e),p=a.get(t);if(h&&p)return h==t&&p==e;var f=!0;a.set(e,t),a.set(t,e);for(var m=s;++l<u;){var y=e[d=c[l]],g=t[d];if(i)var v=s?i(g,y,d,t,e,a):i(y,g,d,e,t,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=e.constructor,_=t.constructor;b==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(f=!1)}return a.delete(e),a.delete(t),f}(e,t,n,i,o,a))}(e,t,n,i,jr,o))}function xr(e,t,n,i){var o=n.length,a=o,s=!i;if(null==e)return!a;for(e=Ie(e);o--;){var c=n[o];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++o<a;){var u=(c=n[o])[0],l=e[u],d=c[1];if(s&&c[2]){if(l===r&&!(u in e))return!1}else{var h=new Gn;if(i)var p=i(l,d,u,e,t,h);if(!(p===r?jr(d,l,3,i,h):p))return!1}}return!0}function Tr(e){return!(!Qa(e)||(t=e,Fe&&Fe in t))&&(Ja(e)?Ne:fe).test(Do(e));var t}function zr(e){return"function"==typeof e?e:null==e?nc:"object"==typeof e?qa(e)?Ur(e[0],e[1]):Dr(e):dc(e)}function Br(e){if(!wo(e))return mn(e);var t=[];for(var n in Ie(e))ze.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Fr(e,t){return e<t}function Mr(e,t){var n=-1,r=Ha(e)?re(e.length):[];return lr(e,function(e,i,o){r[++n]=t(e,i,o)}),r}function Dr(e){var t=so(e);return 1==t.length&&t[0][2]?So(t[0][0],t[0][1]):function(n){return n===e||xr(n,e,t)}}function Ur(e,t){return vo(e)&&Po(t)?So(Mo(e),t):function(n){var i=Cs(n,e);return i===r&&i===t?Os(n,e):jr(t,i,3)}}function Nr(e,t,n,i,o){e!==t&&yr(t,function(a,s){if(o||(o=new Gn),Qa(a))!function(e,t,n,i,o,a,s){var c=Oo(e,n),u=Oo(t,n),l=s.get(u);if(l)Xn(e,n,l);else{var d=a?a(c,u,n+"",e,t,s):r,h=d===r;if(h){var p=qa(u),f=!p&&Ga(u),m=!p&&!f&&cs(u);d=u,p||f||m?qa(c)?d=c:Wa(c)?d=Oi(c):f?(h=!1,d=_i(u,!0)):m?(h=!1,d=Pi(u,!0)):d=[]:rs(u)||Va(u)?(d=c,Va(c)?d=ys(c):Qa(c)&&!Ja(c)||(d=fo(u))):h=!1}h&&(s.set(u,d),o(d,u,i,a,s),s.delete(u)),Xn(e,n,d)}}(e,t,s,n,Nr,i,o);else{var c=i?i(Oo(e,s),a,s+"",e,t,o):r;c===r&&(c=a),Xn(e,s,c)}},xs)}function Rr(e,t){var n=e.length;if(n)return yo(t+=t<0?n:0,n)?e[t]:r}function Lr(e,t,n){t=t.length?jt(t,function(e){return qa(e)?function(t){return wr(t,1===e.length?e[0]:e)}:e}):[nc];var r=-1;t=jt(t,Kt(oo()));var i=Mr(e,function(e,n,i){var o=jt(t,function(t){return t(e)});return{criteria:o,index:++r,value:e}});return function(e){var t=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var c=Si(i[r],o[r]);if(c)return r>=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)});t--;)e[t]=e[t].value;return e}(i)}function Vr(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=wr(e,a);n(s,a)&&Jr(o,yi(a,e),s)}return o}function qr(e,t,n,r){var i=r?Nt:Ut,o=-1,a=t.length,s=e;for(e===t&&(t=Oi(t)),n&&(s=jt(e,Kt(n)));++o<a;)for(var c=0,u=t[o],l=n?n(u):u;(c=i(s,l,c,r))>-1;)s!==e&&Ge.call(s,c,1),Ge.call(e,c,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;yo(i)?Ge.call(e,i,1):ci(e,i)}}return e}function Hr(e,t){return e+ft(_n()*(t-e+1))}function Wr(e,t){var n="";if(!e||t<1||t>l)return n;do{t%2&&(n+=e),(t=ft(t/2))&&(e+=e)}while(t);return n}function Gr(e,t){return Eo(Io(e,t,nc),e+"")}function Kr(e){return Yn(Ns(e))}function Yr(e,t){var n=Ns(e);return To(n,or(t,0,n.length))}function Jr(e,t,n,i){if(!Qa(e))return e;for(var o=-1,a=(t=yi(t,e)).length,s=a-1,c=e;null!=c&&++o<a;){var u=Mo(t[o]),l=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(o!=s){var d=c[u];(l=i?i(d,u,c):r)===r&&(l=Qa(d)?d:yo(t[o+1])?[]:{})}Qn(c,u,l),c=c[u]}return e}var Zr=kn?function(e,t){return kn.set(e,t),e}:nc,Xr=ot?function(e,t){return ot(e,"toString",{configurable:!0,enumerable:!1,value:Qs(t),writable:!0})}:nc;function Qr(e){return To(Ns(e))}function ei(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=re(i);++r<i;)o[r]=e[r+t];return o}function ti(e,t){var n;return lr(e,function(e,r,i){return!(n=t(e,r,i))}),!!n}function ni(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=e[o];null!==a&&!ss(a)&&(n?a<=t:a<t)?r=o+1:i=o}return i}return ri(e,t,nc,n)}function ri(e,t,n,i){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=n(t))!=t,c=null===t,u=ss(t),l=t===r;o<a;){var d=ft((o+a)/2),h=n(e[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):c?m&&p&&(i||!f):u?m&&p&&!f&&(i||!y):!f&&!y&&(i?h<=t:h<t);g?o=d+1:a=d}return gn(a,4294967294)}function ii(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!Na(s,c)){var c=s;o[i++]=0===a?0:a}}return o}function oi(e){return"number"==typeof e?e:ss(e)?d:+e}function ai(e){if("string"==typeof e)return e;if(qa(e))return jt(e,ai)+"";if(ss(e))return Dn?Dn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,n){var r=-1,i=kt,o=e.length,a=!0,s=[],c=s;if(n)a=!1,i=Et;else if(o>=200){var u=t?null:Wi(e);if(u)return sn(u);a=!1,i=Jt,c=new Wn}else c=t?[]:s;e:for(;++r<o;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var h=c.length;h--;)if(c[h]===d)continue e;t&&c.push(d),s.push(l)}else i(c,d,n)||(c!==s&&c.push(d),s.push(l))}return s}function ci(e,t){return null==(e=Co(e,t=yi(t,e)))||delete e[Mo(Yo(t))]}function ui(e,t,n,r){return Jr(e,t,n(wr(e,t)),r)}function li(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?ei(e,r?0:o,r?o+1:i):ei(e,r?o+1:0,r?i:o)}function di(e,t){var n=e;return n instanceof Vn&&(n=n.value()),Tt(t,function(e,t){return t.func.apply(t.thisArg,xt([e],t.args))},n)}function hi(e,t,n){var r=e.length;if(r<2)return r?si(e[0]):[];for(var i=-1,o=re(r);++i<r;)for(var a=e[i],s=-1;++s<r;)s!=i&&(o[i]=ur(o[i]||a,e[s],t,n));return si(mr(o,1),t,n)}function pi(e,t,n){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var c=i<a?t[i]:r;n(s,e[i],c)}return s}function fi(e){return Wa(e)?e:[]}function mi(e){return"function"==typeof e?e:nc}function yi(e,t){return qa(e)?e:vo(e,t)?[e]:Fo(gs(e))}var gi=Gr;function vi(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:ei(e,t,n)}var bi=ct||function(e){return lt.clearTimeout(e)};function _i(e,t){if(t)return e.slice();var n=e.length,r=qe?qe(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function Pi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Si(e,t){if(e!==t){var n=e!==r,i=null===e,o=e==e,a=ss(e),s=t!==r,c=null===t,u=t==t,l=ss(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||i&&s&&u||!n&&u||!o)return 1;if(!i&&!a&&!l&&e<t||l&&n&&o&&!i&&!a||c&&n&&o||!s&&o||!u)return-1}return 0}function Ii(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,c=t.length,u=yn(o-a,0),l=re(c+u),d=!r;++s<c;)l[s]=t[s];for(;++i<a;)(d||i<o)&&(l[n[i]]=e[i]);for(;u--;)l[s++]=e[i++];return l}function Ci(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,c=-1,u=t.length,l=yn(o-s,0),d=re(l+u),h=!r;++i<l;)d[i]=e[i];for(var p=i;++c<u;)d[p+c]=t[c];for(;++a<s;)(h||i<o)&&(d[p+n[a]]=e[i++]);return d}function Oi(e,t){var n=-1,r=e.length;for(t||(t=re(r));++n<r;)t[n]=e[n];return t}function Ai(e,t,n,i){var o=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var c=t[a],u=i?i(n[c],e[c],c,n,e):r;u===r&&(u=e[c]),o?rr(n,c,u):Qn(n,c,u)}return n}function ki(e,t){return function(n,r){var i=qa(n)?St:tr,o=t?t():{};return i(n,e,oo(r,2),o)}}function Ei(e){return Gr(function(t,n){var i=-1,o=n.length,a=o>1?n[o-1]:r,s=o>2?n[2]:r;for(a=e.length>3&&"function"==typeof a?(o--,a):r,s&&go(n[0],n[1],s)&&(a=o<3?r:a,o=1),t=Ie(t);++i<o;){var c=n[i];c&&e(t,c,i,a)}return t})}function ji(e,t){return function(n,r){if(null==n)return n;if(!Ha(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Ie(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function xi(e){return function(t,n,r){for(var i=-1,o=Ie(t),a=r(t),s=a.length;s--;){var c=a[e?s:++i];if(!1===n(o[c],c,o))break}return t}}function Ti(e){return function(t){var n=nn(t=gs(t))?ln(t):r,i=n?n[0]:t.charAt(0),o=n?vi(n,1).join(""):t.slice(1);return i[e]()+o}}function zi(e){return function(t){return Tt(Js(Vs(t).replace(Ye,"")),e,"")}}function Bi(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Nn(e.prototype),r=e.apply(n,t);return Qa(r)?r:n}}function Fi(e){return function(t,n,i){var o=Ie(t);if(!Ha(t)){var a=oo(n,3);t=js(t),n=function(e){return a(o[e],e,o)}}var s=e(t,n,i);return s>-1?o[a?t[s]:s]:r}}function Mi(e){return Qi(function(t){var n=t.length,o=n,a=Ln.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Ae(i);if(a&&!c&&"wrapper"==ro(s))var c=new Ln([],!0)}for(o=c?o:n;++o<n;){var u=ro(s=t[o]),l="wrapper"==u?no(s):r;c=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[ro(l[0])].apply(c,l[3]):1==s.length&&bo(s)?c[u]():c.thru(s)}return function(){var e=arguments,r=e[0];if(c&&1==e.length&&qa(r))return c.plant(r).value();for(var i=0,o=n?t[i].apply(this,e):r;++i<n;)o=t[i].call(this,o);return o}})}function Di(e,t,n,i,o,a,s,u,l,d){var h=t&c,p=1&t,f=2&t,m=24&t,y=512&t,g=f?r:Bi(e);return function c(){for(var v=arguments.length,b=re(v),_=v;_--;)b[_]=arguments[_];if(m)var w=io(c),P=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(b,w);if(i&&(b=Ii(b,i,o,m)),a&&(b=Ci(b,a,s,m)),v-=P,m&&v<d){var S=an(b,w);return $i(e,t,Di,c.placeholder,n,b,S,u,l,d-v)}var I=p?n:this,C=f?I[e]:e;return v=b.length,u?b=function(e,t){for(var n=e.length,i=gn(t.length,n),o=Oi(e);i--;){var a=t[i];e[i]=yo(a,n)?o[a]:r}return e}(b,u):y&&v>1&&b.reverse(),h&&l<v&&(b.length=l),this&&this!==lt&&this instanceof c&&(C=g||Bi(C)),C.apply(I,b)}}function Ui(e,t){return function(n,r){return function(e,t,n,r){return vr(e,function(e,i,o){t(r,n(e),i,o)}),r}(n,e,t(r),{})}}function Ni(e,t){return function(n,i){var o;if(n===r&&i===r)return t;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=e(n,i)}return o}}function Ri(e){return Qi(function(t){return t=jt(t,Kt(oo())),Gr(function(n){var r=this;return e(t,function(e){return Pt(e,r,n)})})})}function Li(e,t){var n=(t=t===r?" ":ai(t)).length;if(n<2)return n?Wr(t,e):t;var i=Wr(t,ht(e/un(t)));return nn(t)?vi(ln(i),0,e).join(""):i.slice(0,e)}function Vi(e){return function(t,n,i){return i&&"number"!=typeof i&&go(t,n,i)&&(n=i=r),t=hs(t),n===r?(n=t,t=0):n=hs(n),function(e,t,n,r){for(var i=-1,o=yn(ht((t-e)/(n||1)),0),a=re(o);o--;)a[r?o:++i]=e,e+=n;return a}(t,n,i=i===r?t<n?1:-1:hs(i),e)}}function qi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ms(t),n=ms(n)),e(t,n)}}function $i(e,t,n,i,o,a,c,u,l,d){var h=8&t;t|=h?s:64,4&(t&=~(h?64:s))||(t&=-4);var p=[e,t,o,h?a:r,h?c:r,h?r:a,h?r:c,u,l,d],f=n.apply(r,p);return bo(e)&&Ao(f,p),f.placeholder=i,jo(f,e,t)}function Hi(e){var t=Se[e];return function(e,n){if(e=ms(e),(n=null==n?0:gn(ps(n),292))&&qt(e)){var r=(gs(e)+"e").split("e");return+((r=(gs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Wi=Cn&&1/sn(new Cn([,-0]))[1]==u?function(e){return new Cn(e)}:sc;function Gi(e){return function(t){var n=ho(t);return n==w?rn(t):n==O?cn(t):function(e,t){return jt(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ki(e,t,n,o,u,l,d,h){var p=2&t;if(!p&&"function"!=typeof e)throw new Ae(i);var f=o?o.length:0;if(f||(t&=-97,o=u=r),d=d===r?d:yn(ps(d),0),h=h===r?h:ps(h),f-=u?u.length:0,64&t){var m=o,y=u;o=u=r}var g=p?r:no(e),v=[e,t,n,o,u,m,y,l,d,h];if(g&&function(e,t){var n=e[1],r=t[1],i=n|r,o=i<131,s=r==c&&8==n||r==c&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!o&&!s)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var l=e[3];e[3]=l?Ii(l,u,t[4]):u,e[4]=l?an(e[3],a):t[4]}(u=t[5])&&(l=e[5],e[5]=l?Ci(l,u,t[6]):u,e[6]=l?an(e[5],a):t[6]),(u=t[7])&&(e[7]=u),r&c&&(e[8]=null==e[8]?t[8]:gn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(v,g),e=v[0],t=v[1],n=v[2],o=v[3],u=v[4],!(h=v[9]=v[9]===r?p?0:e.length:yn(v[9]-f,0))&&24&t&&(t&=-25),t&&1!=t)b=8==t||16==t?function(e,t,n){var i=Bi(e);return function o(){for(var a=arguments.length,s=re(a),c=a,u=io(o);c--;)s[c]=arguments[c];var l=a<3&&s[0]!==u&&s[a-1]!==u?[]:an(s,u);return(a-=l.length)<n?$i(e,t,Di,o.placeholder,r,s,l,r,r,n-a):Pt(this&&this!==lt&&this instanceof o?i:e,this,s)}}(e,t,h):t!=s&&33!=t||u.length?Di.apply(r,v):function(e,t,n,r){var i=1&t,o=Bi(e);return function t(){for(var a=-1,s=arguments.length,c=-1,u=r.length,l=re(u+s),d=this&&this!==lt&&this instanceof t?o:e;++c<u;)l[c]=r[c];for(;s--;)l[c++]=arguments[++a];return Pt(d,i?n:this,l)}}(e,t,n,o);else var b=function(e,t,n){var r=1&t,i=Bi(e);return function t(){return(this&&this!==lt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,n);return jo((g?Zr:Ao)(b,v),e,t)}function Yi(e,t,n,i){return e===r||Na(e,je[n])&&!ze.call(i,n)?t:e}function Ji(e,t,n,i,o,a){return Qa(e)&&Qa(t)&&(a.set(t,e),Nr(e,t,r,Ji,a),a.delete(t)),e}function Zi(e){return rs(e)?r:e}function Xi(e,t,n,i,o,a){var s=1&n,c=e.length,u=t.length;if(c!=u&&!(s&&u>c))return!1;var l=a.get(e),d=a.get(t);if(l&&d)return l==t&&d==e;var h=-1,p=!0,f=2&n?new Wn:r;for(a.set(e,t),a.set(t,e);++h<c;){var m=e[h],y=t[h];if(i)var g=s?i(y,m,h,t,e,a):i(m,y,h,e,t,a);if(g!==r){if(g)continue;p=!1;break}if(f){if(!Bt(t,function(e,t){if(!Jt(f,t)&&(m===e||o(m,e,n,i,a)))return f.push(t)})){p=!1;break}}else if(m!==y&&!o(m,y,n,i,a)){p=!1;break}}return a.delete(e),a.delete(t),p}function Qi(e){return Eo(Io(e,r,$o),e+"")}function eo(e){return Pr(e,js,uo)}function to(e){return Pr(e,xs,lo)}var no=kn?function(e){return kn.get(e)}:sc;function ro(e){for(var t=e.name+"",n=En[t],r=ze.call(En,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function io(e){return(ze.call(Un,"placeholder")?Un:e).placeholder}function oo(){var e=Un.iteratee||rc;return e=e===rc?zr:e,arguments.length?e(arguments[0],arguments[1]):e}function ao(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function so(e){for(var t=js(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Po(i)]}return t}function co(e,t){var n=function(e,t){return null==e?r:e[t]}(e,t);return Tr(n)?n:r}var uo=mt?function(e){return null==e?[]:(e=Ie(e),At(mt(e),function(t){return We.call(e,t)}))}:fc,lo=mt?function(e){for(var t=[];e;)xt(t,uo(e)),e=$e(e);return t}:fc,ho=Sr;function po(e,t,n){for(var r=-1,i=(t=yi(t,e)).length,o=!1;++r<i;){var a=Mo(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Xa(i)&&yo(a,i)&&(qa(e)||Va(e))}function fo(e){return"function"!=typeof e.constructor||wo(e)?{}:Nn($e(e))}function mo(e){return qa(e)||Va(e)||!!(Ke&&e&&e[Ke])}function yo(e,t){var n=typeof e;return!!(t=null==t?l:t)&&("number"==n||"symbol"!=n&&ye.test(e))&&e>-1&&e%1==0&&e<t}function go(e,t,n){if(!Qa(n))return!1;var r=typeof t;return!!("number"==r?Ha(n)&&yo(t,n.length):"string"==r&&t in n)&&Na(n[t],e)}function vo(e,t){if(qa(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ss(e))||X.test(e)||!Z.test(e)||null!=t&&e in Ie(t)}function bo(e){var t=ro(e),n=Un[t];if("function"!=typeof n||!(t in Vn.prototype))return!1;if(e===n)return!0;var r=no(n);return!!r&&e===r[0]}(Pn&&ho(new Pn(new ArrayBuffer(1)))!=x||Sn&&ho(new Sn)!=w||In&&ho(In.resolve())!=I||Cn&&ho(new Cn)!=O||On&&ho(new On)!=E)&&(ho=function(e){var t=Sr(e),n=t==S?e.constructor:r,i=n?Do(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 t});var _o=xe?Ja:mc;function wo(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||je)}function Po(e){return e==e&&!Qa(e)}function So(e,t){return function(n){return null!=n&&n[e]===t&&(t!==r||e in Ie(n))}}function Io(e,t,n){return t=yn(t===r?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=yn(r.length-t,0),a=re(o);++i<o;)a[i]=r[t+i];i=-1;for(var s=re(t+1);++i<t;)s[i]=r[i];return s[t]=n(a),Pt(e,this,s)}}function Co(e,t){return t.length<2?e:wr(e,ei(t,0,-1))}function Oo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ao=xo(Zr),ko=dt||function(e,t){return lt.setTimeout(e,t)},Eo=xo(Xr);function jo(e,t,n){var r=t+"";return Eo(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return It(p,function(n){var r="_."+n[0];t&n[1]&&!kt(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ae):[]}(r),n)))}function xo(e){var t=0,n=0;return function(){var i=vn(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function To(e,t){var n=-1,i=e.length,o=i-1;for(t=t===r?i:t;++n<t;){var a=Hr(n,o),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var zo,Bo,Fo=(zo=za(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Q,function(e,n,r,i){t.push(r?i.replace(ue,"$1"):n||e)}),t},function(e){return 500===Bo.size&&Bo.clear(),e}),Bo=zo.cache,zo);function Mo(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Do(e){if(null!=e){try{return Te.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Uo(e){if(e instanceof Vn)return e.clone();var t=new Ln(e.__wrapped__,e.__chain__);return t.__actions__=Oi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var No=Gr(function(e,t){return Wa(e)?ur(e,mr(t,1,Wa,!0)):[]}),Ro=Gr(function(e,t){var n=Yo(t);return Wa(n)&&(n=r),Wa(e)?ur(e,mr(t,1,Wa,!0),oo(n,2)):[]}),Lo=Gr(function(e,t){var n=Yo(t);return Wa(n)&&(n=r),Wa(e)?ur(e,mr(t,1,Wa,!0),r,n):[]});function Vo(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ps(n);return i<0&&(i=yn(r+i,0)),Dt(e,oo(t,3),i)}function qo(e,t,n){var i=null==e?0:e.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)),Dt(e,oo(t,3),o,!0)}function $o(e){return null!=e&&e.length?mr(e,1):[]}function Ho(e){return e&&e.length?e[0]:r}var Wo=Gr(function(e){var t=jt(e,fi);return t.length&&t[0]===e[0]?Ar(t):[]}),Go=Gr(function(e){var t=Yo(e),n=jt(e,fi);return t===Yo(n)?t=r:n.pop(),n.length&&n[0]===e[0]?Ar(n,oo(t,2)):[]}),Ko=Gr(function(e){var t=Yo(e),n=jt(e,fi);return(t="function"==typeof t?t:r)&&n.pop(),n.length&&n[0]===e[0]?Ar(n,r,t):[]});function Yo(e){var t=null==e?0:e.length;return t?e[t-1]:r}var Jo=Gr(Zo);function Zo(e,t){return e&&e.length&&t&&t.length?qr(e,t):e}var Xo=Qi(function(e,t){var n=null==e?0:e.length,r=ir(e,t);return $r(e,jt(t,function(e){return yo(e,n)?+e:e}).sort(Si)),r});function Qo(e){return null==e?e:wn.call(e)}var ea=Gr(function(e){return si(mr(e,1,Wa,!0))}),ta=Gr(function(e){var t=Yo(e);return Wa(t)&&(t=r),si(mr(e,1,Wa,!0),oo(t,2))}),na=Gr(function(e){var t=Yo(e);return t="function"==typeof t?t:r,si(mr(e,1,Wa,!0),r,t)});function ra(e){if(!e||!e.length)return[];var t=0;return e=At(e,function(e){if(Wa(e))return t=yn(e.length,t),!0}),Wt(t,function(t){return jt(e,Vt(t))})}function ia(e,t){if(!e||!e.length)return[];var n=ra(e);return null==t?n:jt(n,function(e){return Pt(t,r,e)})}var oa=Gr(function(e,t){return Wa(e)?ur(e,t):[]}),aa=Gr(function(e){return hi(At(e,Wa))}),sa=Gr(function(e){var t=Yo(e);return Wa(t)&&(t=r),hi(At(e,Wa),oo(t,2))}),ca=Gr(function(e){var t=Yo(e);return t="function"==typeof t?t:r,hi(At(e,Wa),r,t)}),ua=Gr(ra),la=Gr(function(e){var t=e.length,n=t>1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,ia(e,n)});function da(e){var t=Un(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var pa=Qi(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Vn&&yo(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:r}),new Ln(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(o)}),fa=ki(function(e,t,n){ze.call(e,n)?++e[n]:rr(e,n,1)}),ma=Fi(Vo),ya=Fi(qo);function ga(e,t){return(qa(e)?It:lr)(e,oo(t,3))}function va(e,t){return(qa(e)?Ct:dr)(e,oo(t,3))}var ba=ki(function(e,t,n){ze.call(e,n)?e[n].push(t):rr(e,n,[t])}),_a=Gr(function(e,t,n){var r=-1,i="function"==typeof t,o=Ha(e)?re(e.length):[];return lr(e,function(e){o[++r]=i?Pt(t,e,n):kr(e,t,n)}),o}),wa=ki(function(e,t,n){rr(e,n,t)});function Pa(e,t){return(qa(e)?jt:Mr)(e,oo(t,3))}var Sa=ki(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Ia=Gr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&go(e,t[0],t[1])?t=[]:n>2&&go(t[0],t[1],t[2])&&(t=[t[0]]),Lr(e,mr(t,1),[])}),Ca=ut||function(){return lt.Date.now()};function Oa(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Ki(e,c,r,r,r,r,t)}function Aa(e,t){var n;if("function"!=typeof t)throw new Ae(i);return e=ps(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var ka=Gr(function(e,t,n){var r=1;if(n.length){var i=an(n,io(ka));r|=s}return Ki(e,r,t,n,i)}),Ea=Gr(function(e,t,n){var r=3;if(n.length){var i=an(n,io(Ea));r|=s}return Ki(t,r,e,n,i)});function ja(e,t,n){var o,a,s,c,u,l,d=0,h=!1,p=!1,f=!0;if("function"!=typeof e)throw new Ae(i);function m(t){var n=o,i=a;return o=a=r,d=t,c=e.apply(i,n)}function y(e){var n=e-l;return l===r||n>=t||n<0||p&&e-d>=s}function g(){var e=Ca();if(y(e))return v(e);u=ko(g,function(e){var n=t-(e-l);return p?gn(n,s-(e-d)):n}(e))}function v(e){return u=r,f&&o?m(e):(o=a=r,c)}function b(){var e=Ca(),n=y(e);if(o=arguments,a=this,l=e,n){if(u===r)return function(e){return d=e,u=ko(g,t),h?m(e):c}(l);if(p)return bi(u),u=ko(g,t),m(l)}return u===r&&(u=ko(g,t)),c}return t=ms(t)||0,Qa(n)&&(h=!!n.leading,s=(p="maxWait"in n)?yn(ms(n.maxWait)||0,t):s,f="trailing"in n?!!n.trailing:f),b.cancel=function(){u!==r&&bi(u),d=0,o=l=a=u=r},b.flush=function(){return u===r?c:v(Ca())},b}var xa=Gr(function(e,t){return cr(e,1,t)}),Ta=Gr(function(e,t,n){return cr(e,ms(t)||0,n)});function za(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ae(i);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(za.Cache||Hn),n}function Ba(e){if("function"!=typeof e)throw new Ae(i);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}za.Cache=Hn;var Fa=gi(function(e,t){var n=(t=1==t.length&&qa(t[0])?jt(t[0],Kt(oo())):jt(mr(t,1),Kt(oo()))).length;return Gr(function(r){for(var i=-1,o=gn(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return Pt(e,this,r)})}),Ma=Gr(function(e,t){var n=an(t,io(Ma));return Ki(e,s,r,t,n)}),Da=Gr(function(e,t){var n=an(t,io(Da));return Ki(e,64,r,t,n)}),Ua=Qi(function(e,t){return Ki(e,256,r,r,r,t)});function Na(e,t){return e===t||e!=e&&t!=t}var Ra=qi(Ir),La=qi(function(e,t){return e>=t}),Va=Er(function(){return arguments}())?Er:function(e){return es(e)&&ze.call(e,"callee")&&!We.call(e,"callee")},qa=re.isArray,$a=yt?Kt(yt):function(e){return es(e)&&Sr(e)==j};function Ha(e){return null!=e&&Xa(e.length)&&!Ja(e)}function Wa(e){return es(e)&&Ha(e)}var Ga=Ft||mc,Ka=gt?Kt(gt):function(e){return es(e)&&Sr(e)==g};function Ya(e){if(!es(e))return!1;var t=Sr(e);return t==v||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Ja(e){if(!Qa(e))return!1;var t=Sr(e);return t==b||t==_||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==ps(e)}function Xa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=l}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=vt?Kt(vt):function(e){return es(e)&&ho(e)==w};function ns(e){return"number"==typeof e||es(e)&&Sr(e)==P}function rs(e){if(!es(e)||Sr(e)!=S)return!1;var t=$e(e);if(null===t)return!0;var n=ze.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Te.call(n)==De}var is=bt?Kt(bt):function(e){return es(e)&&Sr(e)==C},os=_t?Kt(_t):function(e){return es(e)&&ho(e)==O};function as(e){return"string"==typeof e||!qa(e)&&es(e)&&Sr(e)==A}function ss(e){return"symbol"==typeof e||es(e)&&Sr(e)==k}var cs=wt?Kt(wt):function(e){return es(e)&&Xa(e.length)&&!!rt[Sr(e)]},us=qi(Fr),ls=qi(function(e,t){return e<=t});function ds(e){if(!e)return[];if(Ha(e))return as(e)?ln(e):Oi(e);if(Ze&&e[Ze])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ze]());var t=ho(e);return(t==w?rn:t==O?sn:Ns)(e)}function hs(e){return e?(e=ms(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ps(e){var t=hs(e),n=t%1;return t==t?n?t-n:t:0}function fs(e){return e?or(ps(e),0,h):0}function ms(e){if("number"==typeof e)return e;if(ss(e))return d;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Gt(e);var n=pe.test(e);return n||me.test(e)?st(e.slice(2),n?2:8):he.test(e)?d:+e}function ys(e){return Ai(e,xs(e))}function gs(e){return null==e?"":ai(e)}var vs=Ei(function(e,t){if(wo(t)||Ha(t))Ai(t,js(t),e);else for(var n in t)ze.call(t,n)&&Qn(e,n,t[n])}),bs=Ei(function(e,t){Ai(t,xs(t),e)}),_s=Ei(function(e,t,n,r){Ai(t,xs(t),e,r)}),ws=Ei(function(e,t,n,r){Ai(t,js(t),e,r)}),Ps=Qi(ir),Ss=Gr(function(e,t){e=Ie(e);var n=-1,i=t.length,o=i>2?t[2]:r;for(o&&go(t[0],t[1],o)&&(i=1);++n<i;)for(var a=t[n],s=xs(a),c=-1,u=s.length;++c<u;){var l=s[c],d=e[l];(d===r||Na(d,je[l])&&!ze.call(e,l))&&(e[l]=a[l])}return e}),Is=Gr(function(e){return e.push(r,Ji),Pt(zs,r,e)});function Cs(e,t,n){var i=null==e?r:wr(e,t);return i===r?n:i}function Os(e,t){return null!=e&&po(e,t,Or)}var As=Ui(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Me.call(t)),e[t]=n},Qs(nc)),ks=Ui(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Me.call(t)),ze.call(e,t)?e[t].push(n):e[t]=[n]},oo),Es=Gr(kr);function js(e){return Ha(e)?Kn(e):Br(e)}function xs(e){return Ha(e)?Kn(e,!0):function(e){if(!Qa(e))return function(e){var t=[];if(null!=e)for(var n in Ie(e))t.push(n);return t}(e);var t=wo(e),n=[];for(var r in e)("constructor"!=r||!t&&ze.call(e,r))&&n.push(r);return n}(e)}var Ts=Ei(function(e,t,n){Nr(e,t,n)}),zs=Ei(function(e,t,n,r){Nr(e,t,n,r)}),Bs=Qi(function(e,t){var n={};if(null==e)return n;var r=!1;t=jt(t,function(t){return t=yi(t,e),r||(r=t.length>1),t}),Ai(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)ci(n,t[i]);return n}),Fs=Qi(function(e,t){return null==e?{}:function(e,t){return Vr(e,t,function(t,n){return Os(e,n)})}(e,t)});function Ms(e,t){if(null==e)return{};var n=jt(to(e),function(e){return[e]});return t=oo(t),Vr(e,n,function(e,n){return t(e,n[0])})}var Ds=Gi(js),Us=Gi(xs);function Ns(e){return null==e?[]:Yt(e,js(e))}var Rs=zi(function(e,t,n){return t=t.toLowerCase(),e+(n?Ls(t):t)});function Ls(e){return Ys(gs(e).toLowerCase())}function Vs(e){return(e=gs(e))&&e.replace(ge,Qt).replace(Je,"")}var qs=zi(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),$s=zi(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Hs=Ti("toLowerCase"),Ws=zi(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Gs=zi(function(e,t,n){return e+(n?" ":"")+Ys(t)}),Ks=zi(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ys=Ti("toUpperCase");function Js(e,t,n){return e=gs(e),(t=n?r:t)===r?function(e){return et.test(e)}(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zs=Gr(function(e,t){try{return Pt(e,r,t)}catch(e){return Ya(e)?e:new we(e)}}),Xs=Qi(function(e,t){return It(t,function(t){t=Mo(t),rr(e,t,ka(e[t],e))}),e});function Qs(e){return function(){return e}}var ec=Mi(),tc=Mi(!0);function nc(e){return e}function rc(e){return zr("function"==typeof e?e:ar(e,1))}var ic=Gr(function(e,t){return function(n){return kr(n,e,t)}}),oc=Gr(function(e,t){return function(n){return kr(e,n,t)}});function ac(e,t,n){var r=js(t),i=_r(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=_r(t,js(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ja(e);return It(i,function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Oi(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,xt([this.value()],arguments))})}),e}function sc(){}var cc=Ri(jt),uc=Ri(Ot),lc=Ri(Bt);function dc(e){return vo(e)?Vt(Mo(e)):function(e){return function(t){return wr(t,e)}}(e)}var hc=Vi(),pc=Vi(!0);function fc(){return[]}function mc(){return!1}var yc,gc=Ni(function(e,t){return e+t},0),vc=Hi("ceil"),bc=Ni(function(e,t){return e/t},1),_c=Hi("floor"),wc=Ni(function(e,t){return e*t},1),Pc=Hi("round"),Sc=Ni(function(e,t){return e-t},0);return Un.after=function(e,t){if("function"!=typeof t)throw new Ae(i);return e=ps(e),function(){if(--e<1)return t.apply(this,arguments)}},Un.ary=Oa,Un.assign=vs,Un.assignIn=bs,Un.assignInWith=_s,Un.assignWith=ws,Un.at=Ps,Un.before=Aa,Un.bind=ka,Un.bindAll=Xs,Un.bindKey=Ea,Un.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return qa(e)?e:[e]},Un.chain=da,Un.chunk=function(e,t,n){t=(n?go(e,t,n):t===r)?1:yn(ps(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=re(ht(i/t));o<i;)s[a++]=ei(e,o,o+=t);return s},Un.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i},Un.concat=function(){var e=arguments.length;if(!e)return[];for(var t=re(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return xt(qa(n)?Oi(n):[n],mr(t,1))},Un.cond=function(e){var t=null==e?0:e.length,n=oo();return e=t?jt(e,function(e){if("function"!=typeof e[1])throw new Ae(i);return[n(e[0]),e[1]]}):[],Gr(function(n){for(var r=-1;++r<t;){var i=e[r];if(Pt(i[0],this,n))return Pt(i[1],this,n)}})},Un.conforms=function(e){return function(e){var t=js(e);return function(n){return sr(n,e,t)}}(ar(e,1))},Un.constant=Qs,Un.countBy=fa,Un.create=function(e,t){var n=Nn(e);return null==t?n:nr(n,t)},Un.curry=function e(t,n,i){var o=Ki(t,8,r,r,r,r,r,n=i?r:n);return o.placeholder=e.placeholder,o},Un.curryRight=function e(t,n,i){var o=Ki(t,16,r,r,r,r,r,n=i?r:n);return o.placeholder=e.placeholder,o},Un.debounce=ja,Un.defaults=Ss,Un.defaultsDeep=Is,Un.defer=xa,Un.delay=Ta,Un.difference=No,Un.differenceBy=Ro,Un.differenceWith=Lo,Un.drop=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,(t=n||t===r?1:ps(t))<0?0:t,i):[]},Un.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,0,(t=i-(t=n||t===r?1:ps(t)))<0?0:t):[]},Un.dropRightWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!0,!0):[]},Un.dropWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!0):[]},Un.fill=function(e,t,n,i){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&go(e,t,n)&&(n=0,i=o),function(e,t,n,i){var o=e.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;)e[n++]=t;return e}(e,t,n,i)):[]},Un.filter=function(e,t){return(qa(e)?At:fr)(e,oo(t,3))},Un.flatMap=function(e,t){return mr(Pa(e,t),1)},Un.flatMapDeep=function(e,t){return mr(Pa(e,t),u)},Un.flatMapDepth=function(e,t,n){return n=n===r?1:ps(n),mr(Pa(e,t),n)},Un.flatten=$o,Un.flattenDeep=function(e){return null!=e&&e.length?mr(e,u):[]},Un.flattenDepth=function(e,t){return null!=e&&e.length?mr(e,t=t===r?1:ps(t)):[]},Un.flip=function(e){return Ki(e,512)},Un.flow=ec,Un.flowRight=tc,Un.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Un.functions=function(e){return null==e?[]:_r(e,js(e))},Un.functionsIn=function(e){return null==e?[]:_r(e,xs(e))},Un.groupBy=ba,Un.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Un.intersection=Wo,Un.intersectionBy=Go,Un.intersectionWith=Ko,Un.invert=As,Un.invertBy=ks,Un.invokeMap=_a,Un.iteratee=rc,Un.keyBy=wa,Un.keys=js,Un.keysIn=xs,Un.map=Pa,Un.mapKeys=function(e,t){var n={};return t=oo(t,3),vr(e,function(e,r,i){rr(n,t(e,r,i),e)}),n},Un.mapValues=function(e,t){var n={};return t=oo(t,3),vr(e,function(e,r,i){rr(n,r,t(e,r,i))}),n},Un.matches=function(e){return Dr(ar(e,1))},Un.matchesProperty=function(e,t){return Ur(e,ar(t,1))},Un.memoize=za,Un.merge=Ts,Un.mergeWith=zs,Un.method=ic,Un.methodOf=oc,Un.mixin=ac,Un.negate=Ba,Un.nthArg=function(e){return e=ps(e),Gr(function(t){return Rr(t,e)})},Un.omit=Bs,Un.omitBy=function(e,t){return Ms(e,Ba(oo(t)))},Un.once=function(e){return Aa(2,e)},Un.orderBy=function(e,t,n,i){return null==e?[]:(qa(t)||(t=null==t?[]:[t]),qa(n=i?r:n)||(n=null==n?[]:[n]),Lr(e,t,n))},Un.over=cc,Un.overArgs=Fa,Un.overEvery=uc,Un.overSome=lc,Un.partial=Ma,Un.partialRight=Da,Un.partition=Sa,Un.pick=Fs,Un.pickBy=Ms,Un.property=dc,Un.propertyOf=function(e){return function(t){return null==e?r:wr(e,t)}},Un.pull=Jo,Un.pullAll=Zo,Un.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?qr(e,t,oo(n,2)):e},Un.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?qr(e,t,r,n):e},Un.pullAt=Xo,Un.range=hc,Un.rangeRight=pc,Un.rearg=Ua,Un.reject=function(e,t){return(qa(e)?At:fr)(e,Ba(oo(t,3)))},Un.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=oo(t,3);++r<o;){var a=e[r];t(a,r,e)&&(n.push(a),i.push(r))}return $r(e,i),n},Un.rest=function(e,t){if("function"!=typeof e)throw new Ae(i);return Gr(e,t=t===r?t:ps(t))},Un.reverse=Qo,Un.sampleSize=function(e,t,n){return t=(n?go(e,t,n):t===r)?1:ps(t),(qa(e)?Jn:Yr)(e,t)},Un.set=function(e,t,n){return null==e?e:Jr(e,t,n)},Un.setWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Jr(e,t,n,i)},Un.shuffle=function(e){return(qa(e)?Zn:Qr)(e)},Un.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&go(e,t,n)?(t=0,n=i):(t=null==t?0:ps(t),n=n===r?i:ps(n)),ei(e,t,n)):[]},Un.sortBy=Ia,Un.sortedUniq=function(e){return e&&e.length?ii(e):[]},Un.sortedUniqBy=function(e,t){return e&&e.length?ii(e,oo(t,2)):[]},Un.split=function(e,t,n){return n&&"number"!=typeof n&&go(e,t,n)&&(t=n=r),(n=n===r?h:n>>>0)?(e=gs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=ai(t))&&nn(e)?vi(ln(e),0,n):e.split(t,n):[]},Un.spread=function(e,t){if("function"!=typeof e)throw new Ae(i);return t=null==t?0:yn(ps(t),0),Gr(function(n){var r=n[t],i=vi(n,0,t);return r&&xt(i,r),Pt(e,this,i)})},Un.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Un.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===r?1:ps(t))<0?0:t):[]},Un.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,(t=i-(t=n||t===r?1:ps(t)))<0?0:t,i):[]},Un.takeRightWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!1,!0):[]},Un.takeWhile=function(e,t){return e&&e.length?li(e,oo(t,3)):[]},Un.tap=function(e,t){return t(e),e},Un.throttle=function(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new Ae(i);return Qa(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),ja(e,t,{leading:r,maxWait:t,trailing:o})},Un.thru=ha,Un.toArray=ds,Un.toPairs=Ds,Un.toPairsIn=Us,Un.toPath=function(e){return qa(e)?jt(e,Mo):ss(e)?[e]:Oi(Fo(gs(e)))},Un.toPlainObject=ys,Un.transform=function(e,t,n){var r=qa(e),i=r||Ga(e)||cs(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ja(o)?Nn($e(e)):{}}return(i?It:vr)(e,function(e,r,i){return t(n,e,r,i)}),n},Un.unary=function(e){return Oa(e,1)},Un.union=ea,Un.unionBy=ta,Un.unionWith=na,Un.uniq=function(e){return e&&e.length?si(e):[]},Un.uniqBy=function(e,t){return e&&e.length?si(e,oo(t,2)):[]},Un.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?si(e,r,t):[]},Un.unset=function(e,t){return null==e||ci(e,t)},Un.unzip=ra,Un.unzipWith=ia,Un.update=function(e,t,n){return null==e?e:ui(e,t,mi(n))},Un.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:ui(e,t,mi(n),i)},Un.values=Ns,Un.valuesIn=function(e){return null==e?[]:Yt(e,xs(e))},Un.without=oa,Un.words=Js,Un.wrap=function(e,t){return Ma(mi(t),e)},Un.xor=aa,Un.xorBy=sa,Un.xorWith=ca,Un.zip=ua,Un.zipObject=function(e,t){return pi(e||[],t||[],Qn)},Un.zipObjectDeep=function(e,t){return pi(e||[],t||[],Jr)},Un.zipWith=la,Un.entries=Ds,Un.entriesIn=Us,Un.extend=bs,Un.extendWith=_s,ac(Un,Un),Un.add=gc,Un.attempt=Zs,Un.camelCase=Rs,Un.capitalize=Ls,Un.ceil=vc,Un.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=ms(n))==n?n:0),t!==r&&(t=(t=ms(t))==t?t:0),or(ms(e),t,n)},Un.clone=function(e){return ar(e,4)},Un.cloneDeep=function(e){return ar(e,5)},Un.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:r)},Un.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:r)},Un.conformsTo=function(e,t){return null==t||sr(e,t,js(t))},Un.deburr=Vs,Un.defaultTo=function(e,t){return null==e||e!=e?t:e},Un.divide=bc,Un.endsWith=function(e,t,n){e=gs(e),t=ai(t);var i=e.length,o=n=n===r?i:or(ps(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},Un.eq=Na,Un.escape=function(e){return(e=gs(e))&&G.test(e)?e.replace(H,en):e},Un.escapeRegExp=function(e){return(e=gs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Un.every=function(e,t,n){var i=qa(e)?Ot:hr;return n&&go(e,t,n)&&(t=r),i(e,oo(t,3))},Un.find=ma,Un.findIndex=Vo,Un.findKey=function(e,t){return Mt(e,oo(t,3),vr)},Un.findLast=ya,Un.findLastIndex=qo,Un.findLastKey=function(e,t){return Mt(e,oo(t,3),br)},Un.floor=_c,Un.forEach=ga,Un.forEachRight=va,Un.forIn=function(e,t){return null==e?e:yr(e,oo(t,3),xs)},Un.forInRight=function(e,t){return null==e?e:gr(e,oo(t,3),xs)},Un.forOwn=function(e,t){return e&&vr(e,oo(t,3))},Un.forOwnRight=function(e,t){return e&&br(e,oo(t,3))},Un.get=Cs,Un.gt=Ra,Un.gte=La,Un.has=function(e,t){return null!=e&&po(e,t,Cr)},Un.hasIn=Os,Un.head=Ho,Un.identity=nc,Un.includes=function(e,t,n,r){e=Ha(e)?e:Ns(e),n=n&&!r?ps(n):0;var i=e.length;return n<0&&(n=yn(i+n,0)),as(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ut(e,t,n)>-1},Un.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ps(n);return i<0&&(i=yn(r+i,0)),Ut(e,t,i)},Un.inRange=function(e,t,n){return t=hs(t),n===r?(n=t,t=0):n=hs(n),function(e,t,n){return e>=gn(t,n)&&e<yn(t,n)}(e=ms(e),t,n)},Un.invoke=Es,Un.isArguments=Va,Un.isArray=qa,Un.isArrayBuffer=$a,Un.isArrayLike=Ha,Un.isArrayLikeObject=Wa,Un.isBoolean=function(e){return!0===e||!1===e||es(e)&&Sr(e)==y},Un.isBuffer=Ga,Un.isDate=Ka,Un.isElement=function(e){return es(e)&&1===e.nodeType&&!rs(e)},Un.isEmpty=function(e){if(null==e)return!0;if(Ha(e)&&(qa(e)||"string"==typeof e||"function"==typeof e.splice||Ga(e)||cs(e)||Va(e)))return!e.length;var t=ho(e);if(t==w||t==O)return!e.size;if(wo(e))return!Br(e).length;for(var n in e)if(ze.call(e,n))return!1;return!0},Un.isEqual=function(e,t){return jr(e,t)},Un.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:r)?n(e,t):r;return i===r?jr(e,t,r,n):!!i},Un.isError=Ya,Un.isFinite=function(e){return"number"==typeof e&&qt(e)},Un.isFunction=Ja,Un.isInteger=Za,Un.isLength=Xa,Un.isMap=ts,Un.isMatch=function(e,t){return e===t||xr(e,t,so(t))},Un.isMatchWith=function(e,t,n){return n="function"==typeof n?n:r,xr(e,t,so(t),n)},Un.isNaN=function(e){return ns(e)&&e!=+e},Un.isNative=function(e){if(_o(e))throw new we("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Tr(e)},Un.isNil=function(e){return null==e},Un.isNull=function(e){return null===e},Un.isNumber=ns,Un.isObject=Qa,Un.isObjectLike=es,Un.isPlainObject=rs,Un.isRegExp=is,Un.isSafeInteger=function(e){return Za(e)&&e>=-9007199254740991&&e<=l},Un.isSet=os,Un.isString=as,Un.isSymbol=ss,Un.isTypedArray=cs,Un.isUndefined=function(e){return e===r},Un.isWeakMap=function(e){return es(e)&&ho(e)==E},Un.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Sr(e)},Un.join=function(e,t){return null==e?"":fn.call(e,t)},Un.kebabCase=qs,Un.last=Yo,Un.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=ps(n))<0?yn(i+o,0):gn(o,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Dt(e,Rt,o,!0)},Un.lowerCase=$s,Un.lowerFirst=Hs,Un.lt=us,Un.lte=ls,Un.max=function(e){return e&&e.length?pr(e,nc,Ir):r},Un.maxBy=function(e,t){return e&&e.length?pr(e,oo(t,2),Ir):r},Un.mean=function(e){return Lt(e,nc)},Un.meanBy=function(e,t){return Lt(e,oo(t,2))},Un.min=function(e){return e&&e.length?pr(e,nc,Fr):r},Un.minBy=function(e,t){return e&&e.length?pr(e,oo(t,2),Fr):r},Un.stubArray=fc,Un.stubFalse=mc,Un.stubObject=function(){return{}},Un.stubString=function(){return""},Un.stubTrue=function(){return!0},Un.multiply=wc,Un.nth=function(e,t){return e&&e.length?Rr(e,ps(t)):r},Un.noConflict=function(){return lt._===this&&(lt._=Ue),this},Un.noop=sc,Un.now=Ca,Un.pad=function(e,t,n){e=gs(e);var r=(t=ps(t))?un(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Li(ft(i),n)+e+Li(ht(i),n)},Un.padEnd=function(e,t,n){e=gs(e);var r=(t=ps(t))?un(e):0;return t&&r<t?e+Li(t-r,n):e},Un.padStart=function(e,t,n){e=gs(e);var r=(t=ps(t))?un(e):0;return t&&r<t?Li(t-r,n)+e:e},Un.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),bn(gs(e).replace(ne,""),t||0)},Un.random=function(e,t,n){if(n&&"boolean"!=typeof n&&go(e,t,n)&&(t=n=r),n===r&&("boolean"==typeof t?(n=t,t=r):"boolean"==typeof e&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=hs(e),t===r?(t=e,e=0):t=hs(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var o=_n();return gn(e+o*(t-e+at("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Un.reduce=function(e,t,n){var r=qa(e)?Tt:$t,i=arguments.length<3;return r(e,oo(t,4),n,i,lr)},Un.reduceRight=function(e,t,n){var r=qa(e)?zt:$t,i=arguments.length<3;return r(e,oo(t,4),n,i,dr)},Un.repeat=function(e,t,n){return t=(n?go(e,t,n):t===r)?1:ps(t),Wr(gs(e),t)},Un.replace=function(){var e=arguments,t=gs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Un.result=function(e,t,n){var i=-1,o=(t=yi(t,e)).length;for(o||(o=1,e=r);++i<o;){var a=null==e?r:e[Mo(t[i])];a===r&&(i=o,a=n),e=Ja(a)?a.call(e):a}return e},Un.round=Pc,Un.runInContext=e,Un.sample=function(e){return(qa(e)?Yn:Kr)(e)},Un.size=function(e){if(null==e)return 0;if(Ha(e))return as(e)?un(e):e.length;var t=ho(e);return t==w||t==O?e.size:Br(e).length},Un.snakeCase=Ws,Un.some=function(e,t,n){var i=qa(e)?Bt:ti;return n&&go(e,t,n)&&(t=r),i(e,oo(t,3))},Un.sortedIndex=function(e,t){return ni(e,t)},Un.sortedIndexBy=function(e,t,n){return ri(e,t,oo(n,2))},Un.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ni(e,t);if(r<n&&Na(e[r],t))return r}return-1},Un.sortedLastIndex=function(e,t){return ni(e,t,!0)},Un.sortedLastIndexBy=function(e,t,n){return ri(e,t,oo(n,2),!0)},Un.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ni(e,t,!0)-1;if(Na(e[n],t))return n}return-1},Un.startCase=Gs,Un.startsWith=function(e,t,n){return e=gs(e),n=null==n?0:or(ps(n),0,e.length),t=ai(t),e.slice(n,n+t.length)==t},Un.subtract=Sc,Un.sum=function(e){return e&&e.length?Ht(e,nc):0},Un.sumBy=function(e,t){return e&&e.length?Ht(e,oo(t,2)):0},Un.template=function(e,t,n){var i=Un.templateSettings;n&&go(e,t,n)&&(t=r),e=gs(e),t=_s({},t,i,Yi);var o,a,s=_s({},t.imports,i.imports,Yi),c=js(s),u=Yt(s,c),l=0,d=t.interpolate||ve,h="__p += '",p=Ce((t.escape||ve).source+"|"+d.source+"|"+(d===J?le:ve).source+"|"+(t.evaluate||ve).source+"|$","g"),f="//# sourceURL="+(ze.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++nt+"]")+"\n";e.replace(p,function(t,n,r,i,s,c){return r||(r=i),h+=e.slice(l,c).replace(be,tn),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=c+t.length,t}),h+="';\n";var m=ze.call(t,"variable")&&t.variable;if(m){if(ce.test(m))throw new we("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 Pe(c,f+"return "+h).apply(r,u)});if(y.source=h,Ya(y))throw y;return y},Un.times=function(e,t){if((e=ps(e))<1||e>l)return[];var n=h,r=gn(e,h);t=oo(t),e-=h;for(var i=Wt(r,t);++n<e;)t(n);return i},Un.toFinite=hs,Un.toInteger=ps,Un.toLength=fs,Un.toLower=function(e){return gs(e).toLowerCase()},Un.toNumber=ms,Un.toSafeInteger=function(e){return e?or(ps(e),-9007199254740991,l):0===e?e:0},Un.toString=gs,Un.toUpper=function(e){return gs(e).toUpperCase()},Un.trim=function(e,t,n){if((e=gs(e))&&(n||t===r))return Gt(e);if(!e||!(t=ai(t)))return e;var i=ln(e),o=ln(t);return vi(i,Zt(i,o),Xt(i,o)+1).join("")},Un.trimEnd=function(e,t,n){if((e=gs(e))&&(n||t===r))return e.slice(0,dn(e)+1);if(!e||!(t=ai(t)))return e;var i=ln(e);return vi(i,0,Xt(i,ln(t))+1).join("")},Un.trimStart=function(e,t,n){if((e=gs(e))&&(n||t===r))return e.replace(ne,"");if(!e||!(t=ai(t)))return e;var i=ln(e);return vi(i,Zt(i,ln(t))).join("")},Un.truncate=function(e,t){var n=30,i="...";if(Qa(t)){var o="separator"in t?t.separator:o;n="length"in t?ps(t.length):n,i="omission"in t?ai(t.omission):i}var a=(e=gs(e)).length;if(nn(e)){var s=ln(e);a=s.length}if(n>=a)return e;var c=n-un(i);if(c<1)return i;var u=s?vi(s,0,c).join(""):e.slice(0,c);if(o===r)return u+i;if(s&&(c+=u.length-c),is(o)){if(e.slice(c).search(o)){var l,d=u;for(o.global||(o=Ce(o.source,gs(de.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var h=l.index;u=u.slice(0,h===r?c:h)}}else if(e.indexOf(ai(o),c)!=c){var p=u.lastIndexOf(o);p>-1&&(u=u.slice(0,p))}return u+i},Un.unescape=function(e){return(e=gs(e))&&W.test(e)?e.replace($,hn):e},Un.uniqueId=function(e){var t=++Be;return gs(e)+t},Un.upperCase=Ks,Un.upperFirst=Ys,Un.each=ga,Un.eachRight=va,Un.first=Ho,ac(Un,(yc={},vr(Un,function(e,t){ze.call(Un.prototype,t)||(yc[t]=e)}),yc),{chain:!1}),Un.VERSION="4.17.21",It(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Un[e].placeholder=Un}),It(["drop","take"],function(e,t){Vn.prototype[e]=function(n){n=n===r?1:yn(ps(n),0);var i=this.__filtered__&&!t?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=gn(n,i.__takeCount__):i.__views__.push({size:gn(n,h),type:e+(i.__dir__<0?"Right":"")}),i},Vn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),It(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;Vn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),It(["head","last"],function(e,t){var n="take"+(t?"Right":"");Vn.prototype[e]=function(){return this[n](1).value()[0]}}),It(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Vn.prototype[e]=function(){return this.__filtered__?new Vn(this):this[n](1)}}),Vn.prototype.compact=function(){return this.filter(nc)},Vn.prototype.find=function(e){return this.filter(e).head()},Vn.prototype.findLast=function(e){return this.reverse().find(e)},Vn.prototype.invokeMap=Gr(function(e,t){return"function"==typeof e?new Vn(this):this.map(function(n){return kr(n,e,t)})}),Vn.prototype.reject=function(e){return this.filter(Ba(oo(e)))},Vn.prototype.slice=function(e,t){e=ps(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Vn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=ps(t))<0?n.dropRight(-t):n.take(t-e)),n)},Vn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vn.prototype.toArray=function(){return this.take(h)},vr(Vn.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Un[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Un.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof Vn,u=s[0],l=c||qa(t),d=function(e){var t=o.apply(Un,xt([e],s));return i&&h?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var h=this.__chain__,p=!!this.__actions__.length,f=a&&!h,m=c&&!p;if(!a&&l){t=m?t:new Vn(this);var y=e.apply(t,s);return y.__actions__.push({func:ha,args:[d],thisArg:r}),new Ln(y,h)}return f&&m?e.apply(this,s):(y=this.thru(d),f?i?y.value()[0]:y.value():y)})}),It(["pop","push","shift","sort","splice","unshift"],function(e){var t=ke[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Un.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(qa(i)?i:[],e)}return this[n](function(n){return t.apply(qa(n)?n:[],e)})}}),vr(Vn.prototype,function(e,t){var n=Un[t];if(n){var r=n.name+"";ze.call(En,r)||(En[r]=[]),En[r].push({name:t,func:n})}}),En[Di(r,2).name]=[{name:"wrapper",func:r}],Vn.prototype.clone=function(){var e=new Vn(this.__wrapped__);return e.__actions__=Oi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Oi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Oi(this.__views__),e},Vn.prototype.reverse=function(){if(this.__filtered__){var e=new Vn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=qa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=gn(t,e+a);break;case"takeRight":e=yn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,c=s-a,u=r?s:a-1,l=this.__iteratees__,d=l.length,h=0,p=gn(c,this.__takeCount__);if(!n||!r&&i==c&&p==c)return di(e,this.__actions__);var f=[];e:for(;c--&&h<p;){for(var m=-1,y=e[u+=t];++m<d;){var g=l[m],v=g.iteratee,b=g.type,_=v(y);if(2==b)y=_;else if(!_){if(1==b)continue e;break e}}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 e=this.__index__>=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},Un.prototype.plant=function(e){for(var t,n=this;n instanceof Rn;){var i=Uo(n);i.__index__=0,i.__values__=r,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},Un.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vn){var t=e;return this.__actions__.length&&(t=new Vn(this)),(t=t.reverse()).__actions__.push({func:ha,args:[Qo],thisArg:r}),new Ln(t,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,Ze&&(Un.prototype[Ze]=function(){return this}),Un}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(lt._=pn,define(function(){return pn})):ht?((ht.exports=pn)._=pn,dt._=pn):lt._=pn}.call(this)},9722:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(7995);t.default=function(){return new o.default(new i.default,r.createRequestSender())}},9783:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.joinPaths=t.isAbsoluteUrl=void 0,t.isAbsoluteUrl=function(e){return/^https?:\/\//.test(e)},t.joinPaths=function(e,t){return"".concat((n=e,n.replace(/\/$/,"")),"/").concat(function(e){return e.replace(/^\//,"")}(t));var n}},9828:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.build=function(e,t,n){var r=this,i=document.createElement("form");return i.style.display="none",i.setAttribute("action",e),i.setAttribute("method","POST"),i.setAttribute("target",n||"_top"),Object.keys(t).forEach(function(e){var n=t[e];i.appendChild(r._createInput(n,e))}),i},e.prototype._createInput=function(e,t){var n=document.createElement("input");return n.setAttribute("name",t),n.setAttribute("type","hidden"),n.setAttribute("value",e),n},e}();t.default=n}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";n.r(r),n.d(r,{createBigCommercePaymentsAlternativeMethodsButtonStrategy:()=>lt,createBigCommercePaymentsAlternativeMethodsPaymentStrategy:()=>Ue,createBigCommercePaymentsButtonStrategy:()=>it,createBigCommercePaymentsCreditCardsPaymentStrategy:()=>Fe,createBigCommercePaymentsCustomerStrategy:()=>We,createBigCommercePaymentsFastlaneCustomerStrategy:()=>Ye,createBigCommercePaymentsFastlanePaymentStrategy:()=>ye,createBigCommercePaymentsPayLaterButtonStrategy:()=>st,createBigCommercePaymentsPayLaterCustomerStrategy:()=>Xe,createBigCommercePaymentsPayLaterPaymentStrategy:()=>_e,createBigCommercePaymentsPaymentStrategy:()=>J,createBigCommercePaymentsRatePayPayPaymentStrategy:()=>Ie,createBigCommercePaymentsRedirectAlternativeMethodsPaymentStrategy:()=>Re,createBigCommercePaymentsVenmoButtonStrategy:()=>pt,createBigCommercePaymentsVenmoCustomerStrategy:()=>tt,createBigCommercePaymentsVenmoPaymentStrategy:()=>qe});var e,t=n(315);class i extends Error{constructor(e){var t;super(e||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",t=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class o extends i{constructor(e){super(e||"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(e){e[e.MissingBillingAddress=0]="MissingBillingAddress",e[e.MissingCart=1]="MissingCart",e[e.MissingCheckout=2]="MissingCheckout",e[e.MissingConsignments=3]="MissingConsignments",e[e.MissingCustomer=4]="MissingCustomer",e[e.MissingCheckoutConfig=5]="MissingCheckoutConfig",e[e.MissingOrder=6]="MissingOrder",e[e.MissingOrderConfig=7]="MissingOrderConfig",e[e.MissingOrderId=8]="MissingOrderId",e[e.MissingPayment=9]="MissingPayment",e[e.MissingPaymentId=10]="MissingPaymentId",e[e.MissingPaymentInstrument=11]="MissingPaymentInstrument",e[e.MissingPaymentMethod=12]="MissingPaymentMethod",e[e.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",e[e.MissingPaymentStatus=14]="MissingPaymentStatus",e[e.MissingPaymentToken=15]="MissingPaymentToken",e[e.MissingShippingAddress=16]="MissingShippingAddress"}(e||(e={}));class a extends i{constructor(t){super(function(t){switch(t){case e.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case e.MissingCart:return"Unable to proceed because cart data is unavailable.";case e.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case e.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case e.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case e.MissingCheckoutConfig:case e.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case e.MissingOrder:return"Unable to proceed because order data is unavailable.";case e.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case e.MissingPayment:return"Unable to proceed because payment data is unavailable.";case e.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case e.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case e.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"}}var s=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class c{constructor(e){this.scriptLoader=e,this.window=window}getPayPalFastlaneSdk(e,t,n){return s(this,void 0,void 0,function*(){if(!this.window.bigCommercePaymentsFastlaneSdk){const r=this.getPayPalFastlaneSdkConfiguration(e,t,n);if(yield this.loadPayPalSdk(r),!this.window.bigCommercePaymentsFastlaneSdk)throw new o}return this.window.bigCommercePaymentsFastlaneSdk})}getPayPalGooglePaySdk(e,t,n,r){return s(this,void 0,void 0,function*(){if(!this.window.bigCommercePaymentsGooglePay||r){const r=this.getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n);yield this.loadPayPalSdk(r)}if(!this.window.bigCommercePaymentsGooglePay)throw new o;return this.window.bigCommercePaymentsGooglePay})}getPayPalApmsSdk(e,t){return s(this,void 0,void 0,function*(){if(!this.window.bigCommercePaymentsApms){const n=this.getPayPalApmSdkConfiguration(e,t);if(yield this.loadPayPalSdk(n),!this.window.bigCommercePaymentsApms)throw new o}return this.window.bigCommercePaymentsApms})}getPayPalMessages(e,t){return s(this,void 0,void 0,function*(){if(!this.window.bigCommercePaymentsMessages){const n=this.getPayPalSdkMessagesConfiguration(e,t);yield this.loadPayPalSdk(n)}if(!this.window.bigCommercePaymentsMessages)throw new o;return this.window.bigCommercePaymentsMessages})}loadPayPalSdk({options:e,attributes:t}){return s(this,void 0,void 0,function*(){const n=this.transformConfig(e),r=this.transformConfig(t),i=`https://www.paypal.com/sdk/js?${new URLSearchParams(n).toString()}`;yield this.scriptLoader.loadScript(i,{async:!0,attributes:r})})}getPayPalFastlaneSdkConfiguration(t,n,r){const{clientToken:i,initializationData:o}=t;if(!o||!o.clientId)throw new a(e.MissingPaymentMethod);const{intent:s,clientId:c,merchantId:u,attributionId:l}=o;return{options:{"client-id":c,"merchant-id":u,commit:!0,components:["fastlane","three-domain-secure"],currency:n,intent:s},attributes:{"data-client-metadata-id":r.replace(/-/g,""),"data-namespace":"bigCommercePaymentsFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":i}}}getPayPalGooglePaySdkScriptConfigOrThrow(t,n,r=!0){const{clientToken:i,initializationData:o}=t;if(!o||!o.clientId)throw new a(e.MissingPaymentMethod);const{intent:s,clientId:c,merchantId:u,buyerCountry:l,attributionId:d,isHostedCheckoutEnabled:h,isDeveloperModeApplicable:p}=o,f=h||r;return{options:Object.assign({"client-id":c,"merchant-id":u,commit:f,components:["googlepay"],currency:n,intent:s},p&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":i,"data-namespace":"bigCommercePaymentsGooglePay"}}}getPayPalApmSdkConfiguration(t,n){const{initializationData:r}=t;if(!r||!r.clientId)throw new a(e.MissingPaymentMethod);const{intent:i,clientId:o,merchantId:s,buyerCountry:c,attributionId:u,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:h=[]}=r,p=this.filterFundingOptions(h),f=this.filterFundingOptions(d.filter(e=>!h.includes(e)));return{options:Object.assign({"client-id":o,"merchant-id":s,"enable-funding":p.length>0?p:void 0,"disable-funding":f.length>0?f:void 0,commit:!0,components:["buttons","payment-fields"],currency:n,intent:i},l&&{"buyer-country":c}),attributes:{"data-partner-attribution-id":u,"data-namespace":"bigCommercePaymentsApms"}}}getPayPalSdkMessagesConfiguration(t,n){const{initializationData:r}=t;if(!r||!r.clientId)throw new a(e.MissingPaymentMethod);const{clientId:i,merchantId:o,attributionId:s,isDeveloperModeApplicable:c,buyerCountry:u}=r;return{options:Object.assign({"client-id":i,"merchant-id":o,components:["messages"],currency:n},c&&{"buyer-country":u}),attributes:{"data-namespace":"bigCommercePaymentsMessages","data-partner-attribution-id":s}}}filterFundingOptions(e){const t=["klarna","afterpay"];return e?e.filter(e=>!t.includes(e)):[]}transformConfig(e){let t={};return Object.keys(e).forEach(n=>{const r=e[n];null==r||""===r||Array.isArray(r)&&0===r.length||(t=Object.assign(Object.assign({},t),{[n]:Array.isArray(r)?r.join(","):r}))}),t}}function u(){return new c((0,t.Hb)())}function l(e,t){return Object.assign(e,{resolveIds:t})}const d={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},h="embedded-checkout-loading-indicator-rotation";class p{constructor(e){this.styles=Object.assign(Object.assign({},d),e&&e.styles),this.containerStyles=Object.assign({},e&&e.containerStyles),this.defineAnimation(),this.container=this.buildContainer(),this.indicator=this.buildIndicator(),this.container.appendChild(this.indicator)}show(e){if(e){const t=document.getElementById(e);if(!t)throw new Error("Unable to attach the loading indicator because the parent ID is not valid.");t.appendChild(this.container)}this.container.style.visibility="visible",this.container.style.opacity="1"}hide(){const e=()=>{this.container.style.visibility="hidden",this.container.removeEventListener("transitionend",e)};this.container.addEventListener("transitionend",e),this.container.style.opacity="0"}buildContainer(){const e=document.createElement("div");return e.style.display="block",e.style.bottom="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.position="absolute",e.style.right="0",e.style.top="0",e.style.transition="all 250ms ease-out",e.style.opacity="0",this.setStyleAttribute(e,this.containerStyles),e}buildIndicator(){const e=document.createElement("div");return e.style.display="block",e.style.width=`${this.styles.size}px`,e.style.height=`${this.styles.size}px`,e.style.borderRadius=`${this.styles.size}px`,e.style.border="solid 1px",e.style.borderColor=`${this.styles.backgroundColor} ${this.styles.backgroundColor} ${this.styles.color} ${this.styles.color}`,e.style.margin="0 auto",e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="50%",e.style.transform="translateY(-50%) rotate(0deg)",e.style.transformStyle="preserve-3d",e.style.animation=`${h} 500ms infinite cubic-bezier(0.69, 0.31, 0.56, 0.83)`,e}setStyleAttribute(e,t){Object.keys(t).forEach(n=>{e.style.setProperty(n,t[n])})}defineAnimation(){var e;if(document.getElementById(h))return;const t=document.createElement("style");t.id=h,null===(e=document.head)||void 0===e||e.appendChild(t),t.sheet instanceof CSSStyleSheet&&t.sheet.insertRule(`\n @keyframes ${h} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}const f={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};var m=n(8686),y=n(4043),g=n(9440);class v extends i{constructor(e){super(e||"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 b={body:{},headers:{},status:0};class _ extends i{constructor(e,{message:t,errors:n}={}){const{body:r,headers:i,status:o}=e||b;super(t||"An unexpected error has occurred."),this.name="RequestError",this.type="request",this.body=r,this.headers=i,this.status=o,this.errors=n||[]}}var w,P,S,I,C,O,A,k;!function(e){e.BuyNow="BUY_NOW"}(w||(w={})),function(e){e.Possible="POSSIBLE",e.No="NO",e.Unknown="UNKNOWN",e.Yes="YES"}(P||(P={})),function(e){e.AUTHORIZE="authorize",e.CAPTURE="capture"}(S||(S={})),function(e){e.paypal="paypal",e.checkout="checkout",e.buynow="buynow",e.pay="pay",e.installment="installment"}(I||(I={})),function(e){e.gold="gold",e.blue="blue",e.silver="silver",e.black="black",e.white="white"}(C||(C={})),function(e){e.pill="pill",e.rect="rect"}(O||(O={})),function(e){e.OXXO="oxxo"}(A||(A={})),function(e){e.Approved="APPROVED",e.Created="CREATED",e.PayerActionRequired="PAYER_ACTION_REQUIRED",e.PollingStop="POLLING_STOP",e.PollingError="POLLING_ERROR"}(k||(k={}));var E=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class j{constructor(e,t,n,r){this.formPoster=e,this.paymentIntegrationService=t,this.bigCommercePaymentsRequestSender=n,this.bigCommercePaymentsScriptLoader=r}loadPayPalSdk(e,t,n,r){return E(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=t||i.getCartOrThrow().currency.code,a=i.getPaymentMethodOrThrow(e);return this.paypalSdk=yield this.bigCommercePaymentsScriptLoader.getPayPalSDK(a,o,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new o;return this.paypalSdk}createBuyNowCartOrThrow(t){return E(this,void 0,void 0,function*(){const n=t.getBuyNowCartRequestBody();if(!n)throw new a(e.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(n)}catch(e){throw new v}})}createOrder(e,t){return E(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.bigCommercePaymentsRequestSender.createOrder(e,Object.assign({cartId:n},t));return r})}createOrderCardFields(e,t){return E(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.bigCommercePaymentsRequestSender.createOrder(e,Object.assign({cartId:n},t));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(){return E(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState(),t=e.getCartOrThrow(),n=e.getConsignmentsOrThrow()[0];try{yield this.bigCommercePaymentsRequestSender.updateOrder({availableShippingOptions:n.availableShippingOptions,cartId:t.id,selectedShippingOption:n.selectedShippingOption})}catch(e){throw new _}})}getOrderStatus(e,t){return E(this,void 0,void 0,function*(){try{const{status:n}=yield this.bigCommercePaymentsRequestSender.getOrderStatus(e,t);return n}catch(e){throw new _}})}tokenizePayment(t,n){const r=this.paymentIntegrationService.getState().getCartOrThrow();if(!n)throw new a(e.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:t,order_id:n},r.source===w.BuyNow&&{cart_id:r.id}))}submitPayment(e,t,n){return E(this,void 0,void 0,function*(){const r={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:e,paypal_account:{order_id:t}}};yield this.paymentIntegrationService.submitPayment(Object.assign({methodId:e,paymentData:r},n?{gatewayId:n}:{}))})}getShippingOptionOrThrow(e){const t=this.paymentIntegrationService.getState().getConsignmentsOrThrow()[0],n=t.availableShippingOptions||[],r=n.find(e=>e.isRecommended),i=(e?n.find(t=>t.id===e):n.find(e=>{var n;return e.id===(null===(n=t.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(e){return{firstName:(null==e?void 0:e.firstName)||"",lastName:(null==e?void 0:e.lastName)||"",email:(null==e?void 0:e.email)||"",phone:(null==e?void 0:e.phone)||"",company:"",address1:(null==e?void 0:e.address1)||"",address2:(null==e?void 0:e.address2)||"",city:(null==e?void 0:e.city)||"",countryCode:(null==e?void 0:e.countryCode)||"",postalCode:(null==e?void 0:e.postalCode)||"",stateOrProvince:"",stateOrProvinceCode:(null==e?void 0:e.stateOrProvinceCode)||"",customFields:[]}}getBillingAddressFromOrderDetails({payer:e}){var t,n;return this.getAddress({firstName:e.name.given_name,lastName:e.name.surname,email:e.email_address,address1:e.address.address_line_1,address2:e.address.address_line_2,city:e.address.admin_area_2,countryCode:e.address.country_code,postalCode:e.address.postal_code,stateOrProvinceCode:e.address.admin_area_1,phone:null===(n=null===(t=e.phone)||void 0===t?void 0:t.phone_number)||void 0===n?void 0:n.national_number})}getShippingAddressFromOrderDetails(e){const{payer:t,purchase_units:n}=e,{address:r,name:{full_name:i}}=n[0].shipping,[o,...a]=i.split(" ");return this.getAddress({firstName:o,lastName:a.join(" "),email:t.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(e){const{color:t,height:n,label:r,shape:i}=e||{},o={color:t&&C[t]?t:void 0,height:this.getValidHeight(n),label:r&&I[r]?r:void 0,shape:i&&O[i]?i:void 0};return(0,g.omitBy)(o,g.isNil)}getValidHeight(e){return e&&"number"==typeof e?e>55?55:e<25?25:e:40}removeElement(e){const t=e&&document.getElementById(e);t&&(t.style.display="none")}}const x="This API endpoint is for internal use only and may change in the future";var T;!function(e){e.Json="application/json",e.JsonV1="application/vnd.bc.v1+json"}(T||(T={}));const z=T,B={"X-Checkout-SDK-Version":"1.889.0"};var F=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class M{constructor(e){this.requestSender=e}createOrder(e,t){return F(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${e}`,r=t,i=Object.assign({"X-API-INTERNAL":x,"Content-Type":z.Json},B);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(e){return F(this,void 0,void 0,function*(){const t=e,n=Object.assign({"X-API-INTERNAL":x,"Content-Type":z.Json},B);return(yield this.requestSender.put("/api/storefront/initialization/bigcommerce_payments",{headers:n,body:t})).body})}getOrderStatus(e="bigcommerce_payments",t){return F(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${e}`,r=Object.assign({"X-API-INTERNAL":x,"Content-Type":z.Json},B);return(yield this.requestSender.get(n,Object.assign({headers:r},t))).body})}}var D=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class U{constructor(e){this.scriptLoader=e,this.window=window}getPayPalSDK(e,t,n,r){return D(this,void 0,void 0,function*(){const i=this.getPayPalSdkScriptConfigOrThrow(e,t,n);return this.loadPayPalSDK(i,r)})}loadPayPalSDK(e,t=!1){return D(this,void 0,void 0,function*(){if(!this.window.bigCommercePaymentsPayPalSDK||t){const t=this.transformConfig(e.options),n=this.transformConfig(e.attributes),r=`https://www.paypal.com/sdk/js?${new URLSearchParams(t).toString()}`;yield this.scriptLoader.loadScript(r,{async:!0,attributes:n})}if(!this.window.bigCommercePaymentsPayPalSDK)throw new o;return this.window.bigCommercePaymentsPayPalSDK})}getPayPalSdkScriptConfigOrThrow(t,n,r=!0){const{id:i,clientToken:o,initializationData:s}=t;if(!(null==s?void 0:s.clientId))throw new a(e.MissingPaymentMethod);const{intent:c,clientId:u,merchantId:l,buyerCountry:d,attributionId:h,isVenmoEnabled:p,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:m,isDeveloperModeApplicable:y,availableAlternativePaymentMethods:g=[],enabledAlternativePaymentMethods:v=[],isGooglePayEnabled:b}=s,_=f||r,w="bigcommerce_payments_creditcards"===i,P=w?["card"]:[],S=w?[]:["card"],I=m?["credit","paylater"]:[],C=m?[]:["credit","paylater"],O=p?["venmo"]:[],A=p?[]:["venmo"],k=g.filter(e=>!v.includes(e)),E=b?["googlepay"]:[],j=r?["card-fields"]:[],x=this.filterFundingOptions([...S,...C,...A,...k]),T=this.filterFundingOptions([...P,...I,...O,...v]);return{options:Object.assign({"client-id":u,"merchant-id":l,"enable-funding":T.length>0?T:void 0,"disable-funding":x.length>0?x:void 0,commit:_,components:["buttons","hosted-fields","payment-fields","legal",...E,...j],currency:n,intent:c},y&&{"buyer-country":d}),attributes:{"data-partner-attribution-id":h,"data-client-token":o,"data-namespace":"bigCommercePaymentsPayPalSDK"}}}filterFundingOptions(e){const t=["klarna","afterpay"];return e?e.filter(e=>!t.includes(e)):[]}transformConfig(e){let t={};return Object.keys(e).forEach(n=>{const r=e[n];null==r||""===r||Array.isArray(r)&&0===r.length||(t=Object.assign(Object.assign({},t),{[n]:Array.isArray(r)?r.join(","):r}))}),t}}const N=e=>{const{getHost:n}=e.getState();return new j((0,m.createFormPoster)(),e,new M((0,y.createRequestSender)({host:n()})),new U((0,t.vQ)()))},R=function({styles:e}){const t={};return e.color&&(t.color=e.color),e.layout&&(t.layout=e.layout),(e["logo-type"]||e["logo-position"])&&(t.logo={},e["logo-type"]&&(t.logo.type=e["logo-type"]),e["logo-position"]&&(t.logo.position=e["logo-position"])),e.ratio&&(t.ratio=e.ratio),(e["text-color"]||e["text-size"])&&(t.text={},e["text-color"]&&(t.text.color=e["text-color"]),e["text-size"]&&(t.text.size=+e["text-size"])),t};class L extends i{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class V extends L{constructor(e){let t="Unable to submit payment for the order because the payload is invalid.";e&&(t=`${t} Make sure the following fields are provided correctly: ${e.join(", ")}.`),super(t),this.name="PaymentArgumentInvalidError"}}class q extends _{constructor(e){super(e,{message:"There is a problem processing your payment. Please try again later."}),this.name="PaymentMethodInvalidError",this.type="payment_method_invalid"}}class $ extends i{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function H(e){return!("object"!=typeof e||null===e||void 0!==e.shouldSaveInstrument&&"boolean"!=typeof e.shouldSaveInstrument||void 0!==e.shouldSetAsDefaultInstrument&&"boolean"!=typeof e.shouldSetAsDefaultInstrument)}function W(e){return Boolean(e.instrumentId)}function G(e){return"object"==typeof e&&null!==e&&"bigpayToken"in e&&"defaultInstrument"in e&&"provider"in e&&"trustedShippingAddress"in e&&"method"in e&&"type"in e}var K=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Y{constructor(e,t,n,r){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.paypalSdkHelper=n,this.loadingIndicator=r}initialize(e){return K(this,void 0,void 0,function*(){const{methodId:t,bigcommerce_payments:n}=e||{};if(this.bigcommerce_payments=n,!t)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(t);const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(t),{container:o,bannerContainerId:a}=n,{orderId:s,paypalBNPLConfiguration:c=[],isPayPalCreditAvailable:u}=i.initializationData||{};if(void 0!==a){if(!document.getElementById(a))return void console.error("Unable to create banner without valid banner container ID.");const e=null==c?void 0:c.find(({id:e})=>"checkout"===e);if(u||!(null==e?void 0:e.status))return;const t=yield this.paypalSdkHelper.getPayPalMessages(i,r.getCartOrThrow().currency.code);return t&&"function"==typeof(null==t?void 0:t.Messages)?this.renderMessages(t,a,e):void console.error("[BC PayPalCommerce PayLater]: banner could not be rendered, due to issues with loading PayPal SDK")}s?this.orderId=s:(this.loadingIndicatorContainer=null==o?void 0:o.split("#")[1],yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(t),n.onInit&&"function"==typeof n.onInit&&n.onInit(()=>this.renderButton(t,n)),(void 0===n.shouldRenderPayPalButtonOnInitialization||n.shouldRenderPayPalButtonOnInitialization)&&this.renderButton(t,n))})}execute(e,t){return K(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]),{onError:i}=this.bigcommerce_payments||{};if(!n)throw new V(["payment"]);const{methodId:o,paymentData:a}=n;if(this.isPayPalVaultedInstrumentPaymentData(a)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new q;const s=this.isPayPalVaultedInstrumentPaymentData(a)?this.prepareVaultedInstrumentPaymentPayload(o,this.orderId,a):this.preparePaymentPayload(o,this.orderId,a);try{yield this.paymentIntegrationService.submitOrder(r,t),yield this.paymentIntegrationService.submitPayment(s)}catch(e){return this.isProviderError(e)&&(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n.methodId),yield new Promise((e,t)=>{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)),t()})),this.handleError(e,i),Promise.reject()}})}finalize(){return Promise.reject(new $)}deinitialize(){var e;return this.orderId=void 0,null===(e=this.paypalButton)||void 0===e||e.close(),Promise.resolve()}prepareVaultedInstrumentPaymentPayload(e,t,n){const{instrumentId:r,shouldSetAsDefaultInstrument:i}=n,o=!this.isTrustedVaultingFlow(n);return o?{methodId:e,paymentData:{shouldSaveInstrument:o,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:t}}}}:{methodId:e,paymentData:{instrumentId:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:t},bigpay_token:{token:r}}}}}preparePaymentPayload(e,t,n){const{shouldSaveInstrument:r=!1,shouldSetAsDefaultInstrument:i=!1}=H(n)?n:{};return{methodId:e,paymentData:{shouldSaveInstrument:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:t}}}}}renderButton(e,t){var n,r,i,o;const a=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:c}=s.initializationData||{},{checkoutPaymentButtonStyles:u}=c||{},{container:l,onError:d,onRenderButton:h,onValidate:p,submitForm:f}=t;if(!l)throw new L('Unable to initialize payment because "container" argument is not provided.');const m=Object.assign(Object.assign({},this.isAppSwitchEnabled(e)&&{appSwitchWhenAvailable:!0}),{fundingSource:a.FUNDING.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(u),createOrder:()=>this.createOrder(),onClick:(e,t)=>this.handleClick(t,p),onApprove:e=>this.handleApprove(e,f),onError:e=>this.handleError(e,d),onCancel:()=>this.toggleLoadingIndicator(!1)});this.paypalButton=a.Buttons(m),this.paypalButton.isEligible()&&(h&&"function"==typeof h&&h(),(null===(r=(n=this.paypalButton).hasReturned)||void 0===r?void 0:r.call(n))&&this.isAppSwitchEnabled(e)?null===(o=(i=this.paypalButton).resume)||void 0===o||o.call(i):this.paypalButton.render(l))}handleClick(e,t){return K(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;yield null==t?void 0:t(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:e},t){this.orderId=e,null==t||t()}handleError(e,t){this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}createOrder(){return K(this,void 0,void 0,function*(){const e=this.getFieldsValues();return this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_paymentscheckout",{shouldSaveInstrument:(null==e?void 0:e.shouldSaveInstrument)||!1})})}getFieldsValues(){const{getFieldsValues:e}=this.bigcommerce_payments||{};return"function"==typeof e?e():void 0}isTrustedVaultingFlow(e){if(e&&W(e)){const t=this.paymentIntegrationService.getState().getInstruments(),n=null==t?void 0:t.find(t=>G(t)&&t.bigpayToken===e.instrumentId);return!(G(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(e){return!!e&&W(e)&&H(e)}renderMessages(e,t,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:R(n)};e.Messages(r).render(`#${t}`)}isProviderError(e){var t,n,r;return!!function(e){return"object"==typeof e&&null!==e&&"errors"in e}(e)&&"INSTRUMENT_DECLINED"===(null===(r=null===(n=((null===(t=null==e?void 0:e.errors)||void 0===t?void 0:t.filter(e=>e.provider_error))||[])[0])||void 0===n?void 0:n.provider_error)||void 0===r?void 0:r.code)}isAppSwitchEnabled(e){var t,n;return null!==(n=null===(t=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e).initializationData)||void 0===t?void 0:t.isAppSwitchEnabled)&&void 0!==n&&n}}const J=l(e=>new Y(e,N(e),u(),new p({containerStyles:f})),[{id:"bigcommerce_payments"}]);var Z,X,Q,ee,te,ne,re,ie,oe;!function(e){e.CVV="cvv",e.PAN="pan"}(Z||(Z={}));class ae{static get(e){const t=`${encodeURIComponent(`${e}`)}=`,n=document.cookie;let r=null;const i=n.indexOf(t);if(i>-1){let e=n.indexOf(";",i);-1===e&&(e=n.length),r=decodeURIComponent(n.substring(i+t.length,e))}return r}static set(e,t,n={secure:!0}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;const{expires:i,path:o,domain:a,secure:s}=n;if(i)r+=`; expires=${i.toUTCString()}`;else{const e=new Date,t=60;e.setTime(e.getTime()+60*t*1e3),r+=`; expires=${e.toUTCString()}`}o&&(r+=`; path=${o}`),a&&(r+=`; domain=${a}`),s&&(r+="; secure"),document.cookie=r}static remove(e,t){ae.set(e,"",Object.assign({expires:new Date(0)},t))}}!function(e){e.AUTHORIZE="authorize",e.CAPTURE="capture"}(X||(X={})),function(e){e.Possible="POSSIBLE",e.No="NO",e.Unknown="UNKNOWN",e.Yes="YES"}(Q||(Q={})),function(e){e.Always="SCA_ALWAYS"}(ee||(ee={})),function(e){e.Succeeded="succeeded",e.Cancelled="cancelled",e.Errored="errored"}(te||(te={})),function(e){e.paypal="paypal",e.checkout="checkout",e.buynow="buynow",e.pay="pay",e.installment="installment"}(ne||(ne={})),function(e){e.gold="gold",e.blue="blue",e.silver="silver",e.black="black",e.white="white"}(re||(re={})),function(e){e.pill="pill",e.rect="rect"}(ie||(ie={})),function(e){e.SUCCEEDED="succeeded",e.FAILED="failed",e.CANCELED="canceled",e.UNRECOGNIZED="unrecognized"}(oe||(oe={}));var se=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class ce{constructor(){this.window=window}initializePayPalFastlane(e,t,n){return se(this,void 0,void 0,function*(){if(t&&(window.localStorage.setItem("fastlaneEnv","sandbox"),window.localStorage.setItem("axoEnv","sandbox")),!this.window.bigCommercePaymentsFastlane){const t={root:{backgroundColorPrimary:"transparent"}};this.window.bigCommercePaymentsFastlane=yield e.Fastlane({styles:n||t})}return this.window.bigCommercePaymentsFastlane})}getPayPalFastlaneOrThrow(){if(!this.window.bigCommercePaymentsFastlane)throw new o;return this.window.bigCommercePaymentsFastlane}lookupCustomerOrThrow(e){return se(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(e)})}triggerAuthenticationFlowOrThrow(e){return se(this,void 0,void 0,function*(){return e?this.getPayPalFastlaneOrThrow().identity.triggerAuthenticationFlow(e):{}})}updateStorageSessionId(e){const t=new Date;t.setDate(t.getDate()+14);const n={expires:t,secure:!0};ae.set("bc-fastlane-sessionId",e,n)}removeStorageSessionId(){ae.remove("bc-fastlane-sessionId")}getStorageSessionId(){return ae.get("bc-fastlane-sessionId")||""}mapPayPalFastlaneProfileToBcCustomerData(e,t){var n,r,i;const{authenticationState:o,profileData:a}=t,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,c=null==a?void 0:a.shippingAddress,u=null==a?void 0:a.name,l=null==a?void 0:a.card,d=c?this.mapPayPalToBcAddress(c.address,c.name,c.phoneNumber):void 0,h=s&&u?this.mapPayPalToBcAddress(s,u,null==c?void 0:c.phoneNumber):void 0,p=l?this.mapPayPalToBcInstrument(e,l):[],f=this.filterAddresses([d,h]);return{authenticationState:o||oe.UNRECOGNIZED,addresses:f,billingAddress:h,shippingAddress:d,instruments:p}}mapPayPalToBcInstrument(e,t){const{id:n,paymentSource:r}=t,{brand:i,expiry:o,lastDigits:a}=r.card,[s,c]=o.split("-");return[{bigpayToken:n,brand:i,defaultInstrument:!1,expiryMonth:c,expiryYear:s,iin:"",last4:a,method:e,provider:e,trustedShippingAddress:!1,untrustedShippingCardVerificationMode:Z.PAN,type:"card"}]}mapBcToPayPalAddress(e){return{company:(null==e?void 0:e.company)||"",addressLine1:(null==e?void 0:e.address1)||"",addressLine2:(null==e?void 0:e.address2)||"",adminArea1:(null==e?void 0:e.stateOrProvinceCode)||(null==e?void 0:e.stateOrProvince)||"",adminArea2:(null==e?void 0:e.city)||"",postalCode:(null==e?void 0:e.postalCode)||"",countryCode:(null==e?void 0:e.countryCode)||""}}mapPayPalToBcAddress(e,t,n,r){const[i,o]=t.fullName.split(" "),a=(null==n?void 0:n.nationalNumber)||"",s=(null==n?void 0:n.countryCode)||"";return{id:Date.now(),type:"paypal-address",firstName:t.firstName||i||"",lastName:t.lastName||o||"",company:e.company||"",address1:e.addressLine1,address2:e.addressLine2||"",city:e.adminArea2,stateOrProvince:e.adminArea1,stateOrProvinceCode:e.adminArea1,country:e.countryCode||"",countryCode:e.countryCode||"",postalCode:e.postalCode,phone:s+a,customFields:r||[]}}filterAddresses(e){return e.reduce((e,t)=>t?e.some(e=>this.isEqualAddresses(e,t))?e:[...e,t]:e,[])}isEqualAddresses(e,t){return(0,g.isEqual)(this.normalizeAddress(e),this.normalizeAddress(t))}normalizeAddress(e){return(0,g.omit)(e,["id","phone"])}}function ue(){return new ce}function le(e){return"string"!=typeof e}function de(e,t){if(t||e)return function(e){var t,n;const r={},i=(0,g.omitBy)(e.root,le),o=(0,g.omitBy)(e.input,le),a=(0,g.omitBy)(e.toggle,le),s=(0,g.omitBy)(null===(t=e.text)||void 0===t?void 0:t.body,le),c=(0,g.omitBy)(null===(n=e.text)||void 0===n?void 0:n.caption,le),u=e.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(c).length&&(r.text=Object.assign({},r.text),r.text.caption=c),u&&(r.branding=u),r}(function(e,t){var n,r,i,o,a,s,c,u,l,d,h,p,f,m,y,g,v,b,_,w,P,S;return{root:{backgroundColorPrimary:(null==e?void 0:e.fastlaneRootSettingsBackgroundColor)||(null===(n=null==t?void 0:t.root)||void 0===n?void 0:n.backgroundColorPrimary),errorColor:(null==e?void 0:e.fastlaneRootSettingsErrorColor)||(null===(r=null==t?void 0:t.root)||void 0===r?void 0:r.errorColor),fontFamily:(null==e?void 0:e.fastlaneRootSettingsFontFamily)||(null===(i=null==t?void 0:t.root)||void 0===i?void 0:i.fontFamily),fontSizeBase:(null==e?void 0:e.fastlaneRootSettingsFontSize)||(null===(o=null==t?void 0:t.root)||void 0===o?void 0:o.fontSizeBase),padding:(null==e?void 0:e.fastlaneRootSettingsPadding)||(null===(a=null==t?void 0:t.root)||void 0===a?void 0:a.padding),primaryColor:(null==e?void 0:e.fastlaneRootSettingsPrimaryColor)||(null===(s=null==t?void 0:t.root)||void 0===s?void 0:s.primaryColor)},input:{borderRadius:(null==e?void 0:e.fastlaneInputSettingsBorderRadius)||(null===(c=null==t?void 0:t.input)||void 0===c?void 0:c.borderRadius),borderColor:(null==e?void 0:e.fastlaneInputSettingsBorderColor)||(null===(u=null==t?void 0:t.input)||void 0===u?void 0:u.borderColor),focusBorderColor:(null==e?void 0:e.fastlaneInputSettingsFocusBorderBase)||(null===(l=null==t?void 0:t.input)||void 0===l?void 0:l.focusBorderColor),backgroundColor:(null==e?void 0:e.fastlaneInputSettingsBackgroundColor)||(null===(d=null==t?void 0:t.input)||void 0===d?void 0:d.backgroundColor),borderWidth:(null==e?void 0:e.fastlaneInputSettingsBorderWidth)||(null===(h=null==t?void 0:t.input)||void 0===h?void 0:h.borderWidth),textColorBase:(null==e?void 0:e.fastlaneInputSettingsTextColorBase)||(null===(p=null==t?void 0:t.input)||void 0===p?void 0:p.textColorBase)},toggle:{colorPrimary:(null==e?void 0:e.fastlaneToggleSettingsColorPrimary)||(null===(f=null==t?void 0:t.toggle)||void 0===f?void 0:f.colorPrimary),colorSecondary:(null==e?void 0:e.fastlaneToggleSettingsColorSecondary)||(null===(m=null==t?void 0:t.toggle)||void 0===m?void 0:m.colorSecondary)},text:{body:{color:(null==e?void 0:e.fastlaneTextBodySettingsColor)||(null===(g=null===(y=null==t?void 0:t.text)||void 0===y?void 0:y.body)||void 0===g?void 0:g.color),fontSize:(null==e?void 0:e.fastlaneTextBodySettingsFontSize)||(null===(b=null===(v=null==t?void 0:t.text)||void 0===v?void 0:v.body)||void 0===b?void 0:b.fontSize)},caption:{color:(null==e?void 0:e.fastlaneTextCaptionSettingsColor)||(null===(w=null===(_=null==t?void 0:t.text)||void 0===_?void 0:_.caption)||void 0===w?void 0:w.color),fontSize:(null==e?void 0:e.fastlaneTextCaptionSettingsFontSize)||(null===(S=null===(P=null==t?void 0:t.text)||void 0===P?void 0:P.caption)||void 0===S?void 0:S.fontSize)}},branding:(null==e?void 0:e.fastlaneBrandingSettings)||(null==t?void 0:t.branding)}}(e,t))}function he(e){return!!e&&("authenticationState"in e||"addresses"in e||"instruments"in e)}function pe(e,t,n=!0){var r;return null!==(r=e[t])&&void 0!==r?r:n}var fe=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class me{constructor(e,t,n,r){this.paymentIntegrationService=e,this.bigCommercePaymentsRequestSender=t,this.bigCommercePaymentsSdk=n,this.bigCommercePaymentsFastlaneUtils=r}initialize(e){var t,n;return fe(this,void 0,void 0,function*(){const{methodId:r,bigcommerce_payments_fastlane:i}=e;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(this.methodId=r,!i)throw new L('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 L('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 L('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:c,isFastlaneStylingEnabled:u}=s.initializationData||{};this.threeDSVerificationMethod=null===(t=s.initializationData)||void 0===t?void 0:t.threeDSVerificationMethod,this.paypalFastlaneSdk=yield this.bigCommercePaymentsSdk.getPayPalFastlaneSdk(s,a.currency.code,a.id);const l=de(u?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,!!c,l),this.shouldRunAuthenticationFlow()&&(yield this.runPayPalAuthenticationFlowOrThrow(r)),yield this.initializePayPalPaymentComponent(),i.onInit(e=>this.renderPayPalPaymentComponent(e)),i.onChange(()=>this.handlePayPalStoredInstrumentChange(r))})}execute(e,t){return fe(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]);if(!n)throw new V(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&W(i);try{yield this.paymentIntegrationService.submitOrder(r,t);const e=a?yield this.prepareVaultedInstrumentPaymentPayload(o,i):yield this.preparePaymentPayload(o,i);yield this.paymentIntegrationService.submitPayment(e),this.bigCommercePaymentsFastlaneUtils.removeStorageSessionId()}catch(e){if(function(e){return"object"==typeof e&&null!==e&&"message"in e&&"response"in e&&"name"in e.response}(e)&&"INVALID_REQUEST"===e.response.name){const e={translationKey:"payment.errors.invalid_request_error"};return this.handleError(e),Promise.reject()}if(e instanceof Error&&"FastlaneError"!==e.name)throw e;return Promise.reject()}})}finalize(){return Promise.reject(new $)}deinitialize(){return fe(this,void 0,void 0,function*(){return Promise.resolve()})}shouldRunAuthenticationFlow(){const e=this.paymentIntegrationService.getState(),t=e.getCartOrThrow(),n=e.getCustomerOrThrow(),r=e.getPaymentProviderCustomer(),i=he(r)?r:{},o=this.bigCommercePaymentsFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===oe.CANCELED||(null==i?void 0:i.authenticationState)||o!==t.id)}runPayPalAuthenticationFlowOrThrow(e){return fe(this,void 0,void 0,function*(){try{const t=this.paymentIntegrationService.getState(),n=t.getCartOrThrow(),r=t.getCustomer(),i=t.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:c,addresses:u,instruments:l}=this.bigCommercePaymentsFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(e,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:c,addresses:u,instruments:l}),s.authenticationState===oe.CANCELED?this.bigCommercePaymentsFastlaneUtils.removeStorageSessionId():this.bigCommercePaymentsFastlaneUtils.updateStorageSessionId(n.id)}catch(e){}})}initializePayPalPaymentComponent(){return fe(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),t=e.phone,n=`${e.firstName} ${e.lastName}`.trim(),r=this.bigCommercePaymentsFastlaneUtils.getPayPalFastlaneOrThrow(),i={fields:Object.assign({cardholderName:{prefill:n,enabled:!0}},t&&{phoneNumber:{prefill:t}})};this.paypalComponentMethods=yield r.FastlaneCardComponent(i)})}renderPayPalPaymentComponent(e){const t=this.getPayPalComponentMethodsOrThrow();if(!e)throw new L('Unable to render card component because "container" argument is not provided.');t.render(e)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new o;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(e,t){return fe(this,void 0,void 0,function*(){const{instrumentId:n}=t,r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),i=this.isBigcommercePaymentsFastlaneThreeDSAvailable()&&r.config.is3dsEnabled?yield this.get3DSNonce(n):n;return yield this.createOrder(i),{methodId:e,paymentData:{formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:i}}}}})}preparePaymentPayload(e,t){return fe(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getBillingAddressOrThrow(),i=n.getPaymentMethodOrThrow(e),o=`${r.firstName} ${r.lastName}`.trim(),{getPaymentToken:a}=this.getPayPalComponentMethodsOrThrow(),{id:s}=yield a({name:{fullName:o},billingAddress:this.bigCommercePaymentsFastlaneUtils.mapBcToPayPalAddress(r)}),c=this.isBigcommercePaymentsFastlaneThreeDSAvailable()&&i.config.is3dsEnabled,{shouldSaveInstrument:u=!1,shouldSetAsDefaultInstrument:l=!1}=H(t)?t:{},d=c?yield this.get3DSNonce(s):s;return yield this.createOrder(d),{methodId:e,paymentData:Object.assign(Object.assign({},t),{shouldSaveInstrument:u,shouldSetAsDefaultInstrument:l,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:d}}})}})}createOrder(e){return fe(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getCartOrThrow().id;if(this.methodId){const{orderId:n}=yield this.bigCommercePaymentsRequestSender.createOrder(this.methodId,{cartId:t,fastlaneToken:e});this.orderId=n}})}get3DSNonce(e){var t;return fe(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),a=n.getStoreConfigOrThrow().links.checkoutLink,s=null===(t=this.paypalFastlaneSdk)||void 0===t?void 0:t.ThreeDomainSecureClient;if(!s)throw new o;const c={amount:i.orderAmount.toFixed(2),currency:r.currency.code,nonce:e,threeDSRequested:this.threeDSVerificationMethod===ee.Always,transactionContext:{experience_context:{locale:"en-US",return_url:a,cancel_url:a}}},u=yield s.isEligible(c);if(this.threeDSVerificationMethod===ee.Always&&!u)throw new q;if(u){const{liabilityShift:e,authenticationState:t,nonce:n}=yield s.show();if(e===P.No||e===P.Unknown||t===te.Errored||t===te.Cancelled)throw new q;if(t===te.Succeeded&&[P.Yes,P.Possible].includes(e))return n}return e})}handlePayPalStoredInstrumentChange(e){return fe(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsFastlaneUtils.getPayPalFastlaneOrThrow(),{selectionChanged:n,selectedCard:r}=yield t.profile.showCardSelector();if(n){const t=this.paymentIntegrationService.getState().getPaymentProviderCustomer(),n=he(t)?t:{},i=this.bigCommercePaymentsFastlaneUtils.mapPayPalToBcInstrument(e,r)[0];return yield this.paymentIntegrationService.updatePaymentProviderCustomer(Object.assign(Object.assign({},n),{instruments:[i]})),i}})}isBigcommercePaymentsFastlaneThreeDSAvailable(){return pe(this.paymentIntegrationService.getState().getStoreConfigOrThrow().checkoutSettings.features,"PROJECT-7080.bcp_fastlane_three_ds")}handleError(e){var t;(null===(t=this.bigcommerce_payments_fastlane)||void 0===t?void 0:t.onError)&&"function"==typeof this.bigcommerce_payments_fastlane.onError&&this.bigcommerce_payments_fastlane.onError(e)}}const ye=l(e=>{const{getHost:t}=e.getState();return new me(e,new M((0,y.createRequestSender)({host:t()})),u(),ue())},[{id:"bigcommerce_payments_fastlane"}]);class ge extends i{constructor(e){super(e||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}var ve=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class be{constructor(e,t,n,r){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.loadingIndicator=n,this.paypalSdkHelper=r}initialize(e){return ve(this,void 0,void 0,function*(){const{methodId:t,bigcommerce_payments_paylater:n}=e||{};if(!t)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(t);const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(t),{paypalBNPLConfiguration:o=[],orderId:a}=i.initializationData||{},{bannerContainerId:s,container:c}=n;if(void 0!==s){if(!document.getElementById(s))return void console.error("Unable to create banner without valid banner container ID.");const e=o&&o.find(({id:e})=>"checkout"===e);if(!(null==e?void 0:e.status))return;const t=yield this.paypalSdkHelper.getPayPalMessages(i,r.getCartOrThrow().currency.code);return this.renderMessages(t,s,e)}a?this.orderId=a:(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(t),this.loadingIndicatorContainer=null==c?void 0:c.split("#")[1],this.renderButton(t,n))})}execute(e,t){return ve(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]);if(!n)throw new V(["payment"]);if(!this.orderId)throw new q;yield this.paymentIntegrationService.submitOrder(r,t),yield this.bigCommercePaymentsIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new $)}deinitialize(){var e;return this.orderId=void 0,null===(e=this.bigCommercePaymentsButtons)||void 0===e||e.close(),Promise.resolve()}renderButton(e,t){if(!(null==t?void 0:t.container))throw new L('Unable to initialize payment because "container" argument is not provided.');const n=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:c,onValidate:u,submitForm:l}=t,d=[n.FUNDING.PAYLATER,n.FUNDING.CREDIT];let h=!1;d.forEach(e=>{if(h)return;const t={fundingSource:e,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),onClick:(e,t)=>this.handleClick(t,u),onApprove:e=>this.handleApprove(e,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:e=>this.handleError(e,s)};if(this.bigCommercePaymentsButtons=n.Buttons(t),this.bigCommercePaymentsButtons.isEligible()||e!==n.FUNDING.PAYLATER){if(!this.bigCommercePaymentsButtons.isEligible()&&e===n.FUNDING.CREDIT)throw new ge(`BigCommercePayments ${e} is not available for your region. Please use BigCommercePayments Checkout instead.`);c&&"function"==typeof c&&c(),this.bigCommercePaymentsButtons.render(a),h=!0}})}handleClick(e,t){return ve(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;t&&"function"==typeof t&&(yield t(()=>(this.toggleLoadingIndicator(!0),n()),r))})}handleApprove({orderID:e},t){this.orderId=e,t&&"function"==typeof t&&t()}handleError(e,t){this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}renderMessages(e,t,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:R(n)};e.Messages(r).render(`#${t}`)}}const _e=l(e=>new be(e,N(e),new p({containerStyles:f}),u()),[{id:"bigcommerce_payments_paylater"}]);class we extends _{constructor(e){super(e,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}var Pe=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Se{constructor(e,t,n,r=3e3,i=3e5){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=g.noop}initialize(e){return Pe(this,void 0,void 0,function*(){const{gatewayId:t,methodId:n,bigcommerce_payments_ratepay:r}=e;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new L('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 L('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new L('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new L('Unable to initialize payment because "options.loadingContainerId" argument is not provided.');this.loadingIndicatorContainer=a;const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(n,t),{merchantId:c}=s.initializationData||{};if(!c)throw new L("Unable to initialize payment because merchantId argument is not provided.");this.bigcommerce_payments_ratepay=r,yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n),this.createFraudNetScript(c,n,t),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(e,t){return Pe(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]),{getFieldsValues:i}=this.bigcommerce_payments_ratepay||{};if(!n)throw new V(["payment"]);if(!i||"function"!=typeof i)throw new L('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const e=yield this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apmscheckout",{metadataId:this.guid}),{ratepayBirthDate:o,ratepayPhoneNumber:a,ratepayPhoneCountryCode:s}=i(),c={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:e}}};return yield this.paymentIntegrationService.submitOrder(r,t),yield this.paymentIntegrationService.submitPayment({methodId:n.methodId,paymentData:c}),yield new Promise((e,t)=>{this.initializePollingMechanism(n.methodId,e,t,n.gatewayId)})}catch(e){return this.handleError(e),new Promise((e,t)=>t())}})}finalize(){return Promise.reject(new $)}deinitialize(){const{legalTextContainer:e}=this.bigcommerce_payments_ratepay||{},t=document.querySelectorAll('[data-id="fraudnetScript"]')[0],n=document.querySelectorAll('[data-id="fraudnetConfig"]')[0];if(this.deinitializePollingMechanism(),t.remove(),n.remove(),e){const t=document.getElementById(e);null==t||t.remove()}return Promise.resolve()}normalizeDate(e){const t=this.formatDate(e.getDate()),n=this.formatDate(e.getMonth()+1);return`${e.getFullYear()}-${n}-${t}`}formatDate(e){return`${e<10?0:""}${e}`}renderLegalText(e,t){const n=e,r=t.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(),c=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new L('Unable to initialize payment because "legalTextContainerElement" argument is not found.');c.render(`#${n}`)}handleError(e){const{onError:t}=this.bigcommerce_payments_ratepay||{};this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}createFraudNetScript(e,t,n){const r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t,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:`${e}_checkout-page`,sandbox:i};o.innerHTML=JSON.stringify(a),document.body.appendChild(o)}generateGUID(){let e="";for(let t=0;t<32;t+=1)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(62*Math.random())];return e}loadFraudnetConfig(){const e=document.createElement("script");e.setAttribute("data-id","fraudnetConfig"),e.src="https://c.paypal.com/da/r/fb.js",document.body.appendChild(e)}reinitializeStrategy(e){return Pe(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(e)})}initializePollingMechanism(e,t,n,r){return Pe(this,void 0,void 0,function*(){yield new Promise((e,t)=>{const n=setTimeout(e,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),t())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.bigCommercePaymentsIntegrationService.getOrderStatus("bigcommerce_payments_apms",{params:{useMetadata:!0}}),o=i===k.PollingStop,a=i===k.PollingError;if(o)return this.deinitializePollingMechanism(),t();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(e,t,n,r);yield this.reinitializeStrategy({methodId:e,gatewayId:r,bigcommerce_payments_ratepay:this.bigcommerce_payments_ratepay}),this.handleError(new we)}catch(e){this.handleError(e),n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const Ie=l(e=>new Se(e,N(e),new p({containerStyles:Object.assign(Object.assign({},f),{position:"fixed"})})),[{gateway:"bigcommerce_payments_apms",id:"ratepay"}]);var Ce;!function(e){e.CardCode="cardCode",e.CardCodeVerification="cardCodeVerification",e.CardExpiry="cardExpiry",e.CardName="cardName",e.CardNumber="cardNumber",e.CardNumberVerification="cardNumberVerification",e.CardExpiryVerification="cardExpiryVerification"}(Ce||(Ce={}));const Oe=Ce;function Ae(e){return Oe.CardNumber in e&&Oe.CardName in e&&Oe.CardExpiry in e}function ke(e){return Oe.CardNumberVerification in e&&Oe.CardCodeVerification in e&&Oe.CardExpiryVerification in e}class Ee extends i{constructor(e){super(e||"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 je;!function(e){e[e.CheckoutButtonNotInitialized=0]="CheckoutButtonNotInitialized",e[e.CustomerNotInitialized=1]="CustomerNotInitialized",e[e.PaymentNotInitialized=2]="PaymentNotInitialized",e[e.ShippingNotInitialized=3]="ShippingNotInitialized",e[e.SpamProtectionNotInitialized=4]="SpamProtectionNotInitialized"}(je||(je={}));class xe extends i{constructor(e){super(function(e){switch(e){case je.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case je.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case je.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case je.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."}}(e)),this.subtype=e,this.name="NotInitializedError",this.type="not_initialized"}}class Te extends i{constructor(e,t){super(t||"Unable to proceed because the payment form contains invalid data."),this.details=e,this.name="PaymentInvalidFormError",this.type="payment_invalid_form"}}var ze=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Be{constructor(e,t,n,r){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.bigCommercePaymentsSdk=n,this.bigCommercePaymentsFastlaneUtils=r}initialize(e){return ze(this,void 0,void 0,function*(){const{methodId:t,bigcommerce_payments_creditcards:n}=e,r=n,{form:i,onCreditCardFieldsRenderingError:o,onLoadComplete:a}=r||{};if(!t)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new L('Unable to proceed because "options.bigcommerce_payments_creditcards.form" argument is not provided.');this.hostedFormOptions=i,this.isCreditCardForm=Ae(i.fields),this.isCreditCardVaultedForm=ke(i.fields)&&!this.hasUndefinedValues(),yield this.paymentIntegrationService.loadPaymentMethod(t),yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(t,void 0,!0,!0),(this.isCreditCardForm||this.isCreditCardVaultedForm)&&(yield this.initializeFields(i,o)),null==a||a(),this.shouldInitializePayPalFastlane(t)&&(yield this.initializePayPalFastlaneOrThrow(t))})}execute(e,t){return ze(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]),{methodId:i,paymentData:o}=n||{};if(!n||!i)throw new V(["payment"]);if(this.executionPaymentData=o,this.isCreditCardForm||this.isCreditCardVaultedForm)yield this.validateHostedFormOrThrow(),yield this.submitHostedForm();else{const{orderId:e}=yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",this.getInstrumentParams());this.returnedOrderId=e}const a=this.preparePaymentPayload(i,o,this.returnedOrderId,this.returnedVaultedToken);yield this.paymentIntegrationService.submitOrder(r,t),yield this.paymentIntegrationService.submitPayment(a)})}finalize(){return Promise.reject(new $)}deinitialize(){var e,t,n,r;return ze(this,void 0,void 0,function*(){return yield null===(e=this.cvvField)||void 0===e?void 0:e.close(),yield null===(t=this.expiryField)||void 0===t?void 0:t.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(e,t,n,r){const{shouldSaveInstrument:i=!1,shouldSetAsDefaultInstrument:o=!1}=H(t)?t:{},a=t&&W(t)?t.instrumentId:void 0,s=(0,g.omitBy)({verification_nonce:r,token:a},g.isNil);return{methodId:e,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(e,t){return ze(this,void 0,void 0,function*(){const{fields:n,styles:r}=e,i=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),o=this.getExecuteCallback(n),a=Object.assign({style:this.getInputStyles(r),onApprove:({orderID:e,vaultSetupToken:t,liabilityShift:n})=>{if(n===P.No||n===P.Unknown)throw new Error;return this.handleApprove({orderID:e,vaultSetupToken:t})},onError:()=>{throw new Ee},inputEvents:{onChange:t=>this.onChangeHandler(e,t),onFocus:t=>this.onFocusHandler(e,t),onBlur:t=>this.onBlurHandler(e,t),onInputSubmitRequest:t=>this.onInputSubmitRequest(e,t)}},o);if(this.cardFields=yield i.CardFields(a),!this.cardFields.isEligible())throw new xe(je.PaymentNotInitialized);try{this.stylizeInputContainers(n),Ae(n)&&(yield this.renderFields(n)),ke(n)&&(yield this.renderVaultedFields(n))}catch(e){"function"==typeof t&&t(e)}})}getExecuteCallback(e){return ke(e)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>ze(this,void 0,void 0,function*(){const{setupToken:e}=(yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",Object.assign(Object.assign({},this.getInstrumentParams()),{setupToken:!0})))||{};return e})}}createOrderCallback(){return{createOrder:()=>ze(this,void 0,void 0,function*(){const{orderId:e}=(yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",this.getInstrumentParams()))||{};return e})}}handleApprove({orderID:e,vaultSetupToken:t}){e&&(this.returnedOrderId=e),t&&(this.returnedVaultedToken=t)}renderFields(e){var t,n,r,i;return ze(this,void 0,void 0,function*(){const o=this.getCardFieldsOrThrow();(null===(t=e.cardCode)||void 0===t?void 0:t.containerId)&&(this.cvvField=o.CVVField({placeholder:""}),yield this.cvvField.render(`#${e.cardCode.containerId}`)),(null===(n=e.cardExpiry)||void 0===n?void 0:n.containerId)&&(this.expiryField=o.ExpiryField(),yield this.expiryField.render(`#${e.cardExpiry.containerId}`)),(null===(r=e.cardName)||void 0===r?void 0:r.containerId)&&(this.nameField=o.NameField({placeholder:""}),yield this.nameField.render(`#${e.cardName.containerId}`)),(null===(i=e.cardNumber)||void 0===i?void 0:i.containerId)&&(this.numberField=o.NumberField({placeholder:""}),yield this.numberField.render(`#${e.cardNumber.containerId}`))})}renderVaultedFields(e){var t,n,r;return ze(this,void 0,void 0,function*(){const i=this.getCardFieldsOrThrow();(null===(t=e.cardCodeVerification)||void 0===t?void 0:t.containerId)&&(this.cvvField=i.CVVField({placeholder:""}),yield this.cvvField.render(`#${e.cardCodeVerification.containerId}`)),(null===(n=e.cardExpiryVerification)||void 0===n?void 0:n.containerId)&&(this.expiryField=i.ExpiryField(),yield this.expiryField.render(`#${e.cardExpiryVerification.containerId}`)),(null===(r=e.cardNumberVerification)||void 0===r?void 0:r.containerId)&&(this.numberField=i.NumberField({placeholder:""}),yield this.numberField.render(`#${e.cardNumberVerification.containerId}`))})}getInstrumentParams(){if(!this.executionPaymentData)return{};if(H(this.executionPaymentData)){const{shouldSaveInstrument:e,shouldSetAsDefaultInstrument:t}=this.executionPaymentData;return{shouldSaveInstrument:e,shouldSetAsDefaultInstrument:t}}if(W(this.executionPaymentData)){const{instrumentId:e}=this.executionPaymentData;return{instrumentId:e}}return{}}getFieldTypeByEmittedField({emittedBy:e}){return{fieldType:this.mapFieldType(e)}}submitHostedForm(){return ze(this,void 0,void 0,function*(){const e=this.getCardFieldsOrThrow(),t=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),n={billingAddress:{company:t.company,addressLine1:t.address1,addressLine2:t.address2,adminArea1:t.stateOrProvinceCode,adminArea2:t.city,postalCode:t.postalCode,countryCode:t.countryCode}};try{this.isCreditCardVaultedForm?yield e.submit():yield e.submit(n)}catch(e){throw new Ee("Failed authentication. Please try to authorize again.")}})}validateHostedFormOrThrow(){var e,t;return ze(this,void 0,void 0,function*(){const n=this.getCardFieldsOrThrow(),r=yield n.getState().then(e=>e),i=this.getValidityData(r);if(!i.isValid)throw null===(t=null===(e=this.hostedFormOptions)||void 0===e?void 0:e.onValidate)||void 0===t||t.call(e,i),new Te(this.mapValidationErrors(i.errors))})}getValidityData({fields:e}){const t=Object.assign({},e);delete t.cardNameField;const n=Object.keys(t);return{isValid:n.every(e=>{var n;return null===(n=t[e])||void 0===n?void 0:n.isValid}),errors:n.reduce((e,n)=>{var r;const i=this.mapFieldType(n);return Object.assign(Object.assign({},e),{[i]:(null===(r=t[n])||void 0===r?void 0:r.isValid)?void 0:[this.getInvalidErrorByFieldType(i)]})},{})}}getInvalidErrorByFieldType(e){switch(e){case Oe.CardCode:case Oe.CardCodeVerification:return{fieldType:e,message:"Invalid card code",type:"invalid_card_code"};case Oe.CardNumber:case Oe.CardNumberVerification:return{fieldType:e,message:"Invalid card number",type:"invalid_card_number"};case Oe.CardExpiry:case Oe.CardExpiryVerification:return{fieldType:e,message:"Invalid card expiry",type:"invalid_card_expiry"};default:return{fieldType:e,message:"Invalid field",type:"invalid"}}}mapValidationErrors(e={}){const t={};return Object.keys(e).forEach(n=>{var r,i;t[n]=[{message:(null===(i=null===(r=e[n])||void 0===r?void 0:r[0])||void 0===i?void 0:i.message)||"",type:n}]}),t}mapFieldType(e){switch(e){case"name":return Oe.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?Oe.CardNumber:Oe.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?Oe.CardExpiry:Oe.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?Oe.CardCode:Oe.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new xe(je.PaymentNotInitialized);return this.cardFields}getInputStyles(e){var t,n,r;const i={"font-size":(null===(t=null==e?void 0:e.default)||void 0===t?void 0:t.fontSize)||"1rem","font-family":(null===(n=null==e?void 0:e.default)||void 0===n?void 0:n.fontFamily)||"Montserrat, Arial, Helvetica, sans-serif","font-weight":(null===(r=null==e?void 0:e.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(e){Object.values(e||{}).forEach(e=>{const t=document.getElementById(`${(null==e?void 0:e.containerId)||""}`);t&&(t.style.padding="0px",t.style.boxShadow="none",t.style.border="none",t.style.background="transparent",t.style.marginBottom="10px",t.style.marginLeft="-5px")})}hasUndefinedValues(){return!this.hostedFormOptions||Object.values(this.hostedFormOptions.fields).some(e=>void 0===e)}onChangeHandler(e,t){var n;null===(n=null==e?void 0:e.onValidate)||void 0===n||n.call(e,this.getValidityData(t))}onFocusHandler(e,t){var n;null===(n=null==e?void 0:e.onFocus)||void 0===n||n.call(e,this.getFieldTypeByEmittedField(t))}onBlurHandler(e,t){var n;null===(n=null==e?void 0:e.onBlur)||void 0===n||n.call(e,this.getFieldTypeByEmittedField(t))}onInputSubmitRequest(e,t){var n;null===(n=null==e?void 0:e.onEnter)||void 0===n||n.call(e,this.getFieldTypeByEmittedField(t))}shouldInitializePayPalFastlane(e){var t,n;const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(e),o=r.getPaymentProviderCustomer(),a=(s=o)&&("authenticationState"in s||"addresses"in s||"instruments"in s)?o:{};var s;return(null===(t=null==i?void 0:i.initializationData)||void 0===t?void 0:t.isAcceleratedCheckoutEnabled)&&(null===(n=null==i?void 0:i.initializationData)||void 0===n?void 0:n.isBigCommercePaymentsAnalyticsV2Enabled)&&!(null==a?void 0:a.authenticationState)}initializePayPalFastlaneOrThrow(e){return ze(this,void 0,void 0,function*(){try{const t=this.paymentIntegrationService.getState(),n=t.getCartOrThrow(),r=t.getPaymentMethodOrThrow(e),{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(e){}})}}const Fe=l(e=>new Be(e,N(e),u(),ue()),[{id:"bigcommerce_payments_creditcards"}]);var Me=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class De{constructor(e,t,n,r,i=3e3,o=3e5){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.bigCommercePaymentsSdkHelper=n,this.loadingIndicator=r,this.pollingInterval=i,this.maxPollingIntervalTime=o,this.pollingTimer=0,this.stopPolling=g.noop,this.isPollingEnabled=!1}initialize(e){return Me(this,void 0,void 0,function*(){const{gatewayId:t,methodId:n,bigcommerce_payments_apms:r}=e;if(this.bigCommercePaymentsAlternativeMethods=r,!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new L('Unable to initialize payment because "options.bigcommerce_payments_apms" argument is not provided.');const i=this.paymentIntegrationService.getState(),o=i.getPaymentMethodOrThrow(n,t),{orderId:a,shouldRenderFields:s}=o.initializationData||{},c=i.getStoreConfigOrThrow().checkoutSettings.features;this.isPollingEnabled=pe(c,"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,t,r),s&&this.renderFields(n,r))})}execute(e,t){return Me(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]);if(!n)throw new V(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new q;this.isPollingEnabled&&"ideal"===i&&(yield new Promise((e,t)=>{this.initializePollingMechanism(i,e,t,o)})),this.isNonInstantPaymentMethod(i)||(yield this.paymentIntegrationService.submitOrder(r,t)),yield this.bigCommercePaymentsIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new $)}deinitialize(){var e;return this.orderId=void 0,this.isPollingEnabled&&this.resetPollingMechanism(),null===(e=this.bigCommercePaymentsButton)||void 0===e||e.close(),Promise.resolve()}initializePollingMechanism(e,t,n,r){return Me(this,void 0,void 0,function*(){yield new Promise((e,t)=>{const n=setTimeout(e,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),t())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.bigCommercePaymentsIntegrationService.getOrderStatus(r),o=i===k.Approved,a=i===k.PollingError;if(o)return this.deInitializePollingMechanism(),t();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(e,t,n,r);yield this.reinitializeStrategy({methodId:e,gatewayId:r,bigCommercePaymentsAlternativeMethods:this.bigCommercePaymentsAlternativeMethods}),this.handleError(new we)}catch(e){n()}})}deInitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deInitializePollingMechanism()}reinitializeStrategy(e){return Me(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(e)})}handleError(e){const{onError:t}=this.bigCommercePaymentsAlternativeMethods||{};this.isPollingEnabled&&this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}renderButton(e,t,n){const r=this.getPaypalAmpsSdkOrThrow(),i=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e,t),{buttonStyle:o}=i.initializationData||{},{container:a,onError:s,onRenderButton:c,submitForm:u}=n,l={fundingSource:e,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),onInit:(e,t)=>n.onInitButton(t),createOrder:()=>this.onCreateOrder(e,t,n),onApprove:e=>this.handleApprove(e,u),onCancel:()=>{this.toggleLoadingIndicator(!1),this.deInitializePollingMechanism()},onError:e=>{this.deInitializePollingMechanism(),this.handleFailure(e,s)},onClick:(e,t)=>Me(this,void 0,void 0,function*(){return n.onValidate(t.resolve,t.reject)})};this.bigCommercePaymentsButton=r.Buttons(l),this.bigCommercePaymentsButton.isEligible()&&(c&&"function"==typeof c&&c(),this.bigCommercePaymentsButton.render(a))}onCreateOrder(e,t,n){return Me(this,void 0,void 0,function*(){const{onValidate:r}=n;yield r(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),g.noop);const i=yield this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apms");if(this.isNonInstantPaymentMethod(e)){const n={useStoreCredit:!1},r={params:{methodId:e,gatewayId:t}};yield this.paymentIntegrationService.submitOrder(n,r),yield this.bigCommercePaymentsIntegrationService.submitPayment(e,i,t)}return i})}handleApprove({orderID:e},t){this.orderId=e,t()}handleFailure(e,t){this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}renderFields(e,t){const n=this.getPaypalAmpsSdkOrThrow(),r=this.paymentIntegrationService.getState(),{firstName:i,lastName:o,email:a}=r.getBillingAddressOrThrow(),{apmFieldsContainer:s,apmFieldsStyles:c}=t;if(!s)throw new L('Unable to initialize payment because "options.bigcommerce_payments_apms" argument should contain "apmFieldsContainer".');const u=document.querySelector(s);u&&(u.innerHTML="");const l={fundingSource:e,style:c||{},fields:{name:{value:`${i} ${o}`},email:{value:a}}};n.PaymentFields(l).render(s)}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isNonInstantPaymentMethod(e){return e.toUpperCase()in A}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new o;return this.paypalApms}}const Ue=l(e=>new De(e,N(e),u(),new p({containerStyles:f})),[{gateway:"bigcommerce_payments_apms"}]);class Ne{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t}initialize(e){const{gatewayId:t,methodId:n,bigcommerce_payments_apms:r}=e;if(this.bigCommercePaymentsAlternativeMethods=r,!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.gatewayId" argument is not provided.');return Promise.resolve()}execute(e,t){return n=this,r=void 0,o=function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]);if(!n)throw new V(["payment"]);const{methodId:i,gatewayId:o}=n;try{const e={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:i,paypal_account:{order_id:yield this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apms",{gatewayId:"bigcommerce_payments_apms",methodId:i})}}};yield this.paymentIntegrationService.submitOrder(r,t),yield this.paymentIntegrationService.submitPayment({methodId:i,gatewayId:o,paymentData:e})}catch(e){if(function(e){var t,n;return(e=>"object"==typeof e&&null!==e&&"body"in e)(e)&&(null===(n=null===(t=e.body)||void 0===t?void 0:t.additional_action_required)||void 0===n?void 0:n.data.redirect_url)}(e)){const t=e.body.additional_action_required.data.redirect_url;return new Promise((e,n)=>{window.location.replace(t),n()})}return this.handleError(e),Promise.reject(e)}},new((i=void 0)||(i=Promise))(function(e,t){function a(e){try{c(o.next(e))}catch(e){t(e)}}function s(e){try{c(o.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i(function(e){e(n)})).then(a,s)}c((o=o.apply(n,r||[])).next())});var n,r,i,o}finalize(){return Promise.reject(new $)}deinitialize(){return Promise.resolve()}handleError(e){const{onError:t}=this.bigCommercePaymentsAlternativeMethods||{};t&&"function"==typeof t&&t(e)}}const Re=l(e=>new Ne(e,N(e)),[{gateway:"bigcommerce_payments_apms",id:"klarna"},{gateway:"bigcommerce_payments_apms",id:"afterpay"}]);var Le=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Ve{constructor(e,t,n){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.loadingIndicator=n}initialize(e){var t,n;return Le(this,void 0,void 0,function*(){const{methodId:r,bigcommerce_payments_venmo:i}=e||{};if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new L('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===(t=o.initializationData)||void 0===t?void 0:t.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(e,t){return Le(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]);if(!n)throw new V(["payment"]);if(!this.orderId)throw new q;yield this.paymentIntegrationService.submitOrder(r,t),yield this.bigCommercePaymentsIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new $)}deinitialize(){var e;return this.orderId=void 0,null===(e=this.paypalButton)||void 0===e||e.close(),Promise.resolve()}renderButton(e,t){const n=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:c,onValidate:u,submitForm:l}=t,d={fundingSource:n.FUNDING.VENMO,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmocheckout"),onClick:(e,t)=>this.handleClick(t,u),onApprove:e=>this.handleApprove(e,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:e=>this.handleError(e,s)};if(this.paypalButton=n.Buttons(d),!this.paypalButton.isEligible())throw new ge("Venmo is not available for your region. Please another payment method instead.");c&&"function"==typeof c&&c(),this.paypalButton.render(a)}handleClick(e,t){return Le(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;yield t(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:e},t){this.orderId=e,t(),this.toggleLoadingIndicator(!1)}handleError(e,t){this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const qe=l(e=>new Ve(e,N(e),new p({styles:{backgroundColor:"black"}})),[{id:"bigcommerce_payments_venmo"}]);var $e=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class He{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.onError=g.noop}initialize(e){return $e(this,void 0,void 0,function*(){const{bigcommerce_payments:t,methodId:n}=e;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');if(!t.container)throw new L('Unable to initialize payment because "options.bigcommerce_payments.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new L('Unable to initialize payment because "options.bigcommerce_payments.onClick" argument is not a function.');this.onError=t.onError||g.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,t):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(e,t){return $e(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signInCustomer(e,t),Promise.resolve()})}signOut(e){return $e(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signOutCustomer(e),Promise.resolve()})}executePaymentMethodCheckout(e){var t;return null===(t=null==e?void 0:e.continueWithCheckoutCallback)||void 0===t||t.call(e),Promise.resolve()}renderButton(e,t){var n,r;const{container:i,onClick:o,onComplete:a}=t,s=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:u,paymentButtonStyles:l,isAppSwitchEnabled:d=!1}=c.initializationData||{},{checkoutTopButtonStyles:h}=l||{},p=Object.assign(Object.assign(Object.assign({},d&&{appSwitchWhenAvailable:!0}),{createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)}),o&&{onClick:()=>o()}),f=Object.assign(Object.assign({},!d&&{onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,a)}),m=Object.assign(Object.assign({fundingSource:s.FUNDING.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},h),{height:40}))},p),u&&f),y=s.Buttons(m);y.isEligible()?(null===(n=y.hasReturned)||void 0===n?void 0:n.call(y))&&d?null===(r=y.resume)||void 0===r||r.call(y):y.render(`#${i}`):this.bigCommercePaymentsIntegrationService.removeElement(i)}onHostedCheckoutApprove(t,n,r,i){return $e(this,void 0,void 0,function*(){if(!t.orderID)throw new a(e.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),s=yield n.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(s);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const e=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(s);yield this.paymentIntegrationService.updateShippingAddress(e),yield this.bigCommercePaymentsIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(r,t.orderID),i&&"function"==typeof i&&i()}catch(e){this.handleError(e)}})}onShippingAddressChange(e){return $e(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getAddress({city:e.shippingAddress.city,countryCode:e.shippingAddress.countryCode,postalCode:e.shippingAddress.postalCode,stateOrProvinceCode:e.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(t),yield this.paymentIntegrationService.updateShippingAddress(t);const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}onShippingOptionsChange(e){return $e(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}handleError(e){if("function"!=typeof this.onError)throw e;this.onError(e)}}const We=l(e=>new He(e,N(e)),[{id:"bigcommerce_payments"}]);var Ge=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Ke{constructor(e,t,n){this.paymentIntegrationService=e,this.bigCommercePaymentsSdk=t,this.bigCommercePaymentsFastlaneUtils=n}initialize(e){var t;return Ge(this,void 0,void 0,function*(){const{methodId:n,bigcommerce_payments_fastlane:r}=e;if(!n)throw new L('Unable to proceed because "methodId" argument is not provided.');try{yield this.paymentIntegrationService.loadPaymentMethod(n);const e=this.paymentIntegrationService.getState(),i=e.getCartOrThrow(),o=e.getPaymentMethodOrThrow(n),a=!!(null===(t=o.initializationData)||void 0===t?void 0:t.isDeveloperModeApplicable),s=yield this.bigCommercePaymentsSdk.getPayPalFastlaneSdk(o,i.currency.code,i.id);yield this.bigCommercePaymentsFastlaneUtils.initializePayPalFastlane(s,a,this.getFastlaneStyles(n,r))}catch(e){}return Promise.resolve()})}deinitialize(){return Ge(this,void 0,void 0,function*(){return Promise.resolve()})}signIn(e,t){return Ge(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t)})}signOut(e){return Ge(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(e)})}executePaymentMethodCheckout(e){return Ge(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:t,continueWithCheckoutCallback:n,methodId:r}=e||{};if(!r)throw new L('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new L('Unable to proceed because "continueWithCheckoutCallback" argument is not provided and it must be a function.');if(this.paymentIntegrationService.getState().getCustomerOrThrow().isGuest){t&&"function"==typeof t&&t();try{yield this.runPayPalAuthenticationFlowOrThrow(r)}catch(e){}}n()})}runPayPalAuthenticationFlowOrThrow(e){return Ge(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState(),n=t.getCartOrThrow().id,r=t.getCustomer(),i=t.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),c=s.authenticationState===oe.CANCELED;yield this.updateCustomerDataState(e,s),c?this.bigCommercePaymentsFastlaneUtils.removeStorageSessionId():this.bigCommercePaymentsFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(e,t){var n;return Ge(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:c}=this.bigCommercePaymentsFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(e,t);if(yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:i,addresses:o,instruments:c}),a&&(yield this.paymentIntegrationService.updateBillingAddress(a)),s&&r.lineItems.physicalItems.length>0){const t=yield this.paymentIntegrationService.updateShippingAddress(s),r=t.getPaymentMethodOrThrow(e),{isFastlaneShippingOptionAutoSelectEnabled:i}=r.initializationData||{},o=t.getConsignments()||[],a=(null===(n=o[0])||void 0===n?void 0:n.availableShippingOptions)||[],c=a[0],u=a.find(e=>e.isRecommended);if((u||c)&&i){const e=(null==u?void 0:u.id)||c.id;yield this.paymentIntegrationService.selectShippingOption(e)}}})}getFastlaneStyles(e,t){const n=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{fastlaneStyles:r,isFastlaneStylingEnabled:i}=n.initializationData||{};return de(i?r:{},null==t?void 0:t.styles)}}const Ye=l(e=>new Ke(e,u(),ue()),[{id:"bigcommerce_payments_fastlane"},{id:"bigcommerce_payments_creditcards"}]);var Je=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Ze{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.onError=g.noop}initialize(e){return Je(this,void 0,void 0,function*(){const{bigcommerce_payments_paylater:t,methodId:n}=e;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');if(!t.container)throw new L('Unable to initialize payment because "options.bigcommerce_payments_paylater.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new L('Unable to initialize payment because "options.bigcommerce_payments_paylater.onClick" argument is not a function.');this.onError=t.onError||g.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,t):console.error("[BC BigCommercePayments PayLater]: button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(e,t){return Je(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t)})}signOut(e){return Je(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(e)})}executePaymentMethodCheckout(e){var t;return null===(t=null==e?void 0:e.continueWithCheckoutCallback)||void 0===t||t.call(e),Promise.resolve()}renderButton(e,t){const{container:n,onComplete:r,onClick:i}=t,o=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:s,paymentButtonStyles:c}=a.initializationData||{},{checkoutTopButtonStyles:u}=c||{},l=Object.assign({createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)},i&&{onClick:()=>i()}),d={onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e),onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,r)},h=[o.FUNDING.PAYLATER,o.FUNDING.CREDIT];let p=!1;h.forEach(e=>{if(!p){const t=Object.assign(Object.assign({fundingSource:e,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},u),{height:40}))},l),s&&d),r=o.Buttons(t);r.isEligible()&&(r.render(`#${n}`),p=!0)}}),p||this.bigCommercePaymentsIntegrationService.removeElement(n)}onHostedCheckoutApprove(t,n,r,i){return Je(this,void 0,void 0,function*(){if(!t.orderID)throw new a(e.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),s=yield n.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(s);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const e=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(s);yield this.paymentIntegrationService.updateShippingAddress(e),yield this.bigCommercePaymentsIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(r,t.orderID),i&&"function"==typeof i&&i()}catch(e){this.handleError(e)}})}onShippingAddressChange(e){return Je(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getAddress({city:e.shippingAddress.city,countryCode:e.shippingAddress.countryCode,postalCode:e.shippingAddress.postalCode,stateOrProvinceCode:e.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(t),yield this.paymentIntegrationService.updateShippingAddress(t);const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}onShippingOptionsChange(e){return Je(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}handleError(e){if("function"!=typeof this.onError)throw e;this.onError(e)}}const Xe=l(e=>new Ze(e,N(e)),[{id:"bigcommerce_payments_paylater"}]);var Qe=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class et{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t}initialize(e){return Qe(this,void 0,void 0,function*(){const{bigcommerce_payments_venmo:t,methodId:n}=e;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments_venmo" argument is not provided.');if(!t.container)throw new L('Unable to initialize payment because "options.bigcommerce_payments_venmo.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new L('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,t):console.error("[BC Payments Venmo]: Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(e,t){return Qe(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t)})}signOut(e){return Qe(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(e)})}executePaymentMethodCheckout(e){var t;return null===(t=null==e?void 0:e.continueWithCheckoutCallback)||void 0===t||t.call(e),Promise.resolve()}renderButton(e,t){const{container:n,onClick:r}=t,i=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:a}=o.initializationData||{},{checkoutTopButtonStyles:s}=a||{},c=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},s),{height:40})),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmo"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)},r&&{onClick:()=>r()}),u=i.Buttons(c);u.isEligible()?u.render(`#${n}`):this.bigCommercePaymentsIntegrationService.removeElement(n)}}const tt=l(e=>new et(e,N(e)),[{id:"bigcommerce_payments_venmo"}]);var nt=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class rt{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t}initialize(e){var t;return nt(this,void 0,void 0,function*(){const{bigcommerce_payments:n,containerId:r,methodId:i}=e,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');if(o&&!n.currencyCode)throw new L('Unable to initialize payment because "options.bigcommerce_payments.currencyCode" argument is not provided.');if(o&&"function"!=typeof(null===(t=n.buyNowInitializeOptions)||void 0===t?void 0:t.getBuyNowCartRequestBody))throw new L('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,o)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n,r){var i,o;const{buyNowInitializeOptions:a,style:s,onComplete:c,onEligibilityFailure:u}=n,l=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),d=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:h,isAppSwitchEnabled:p}=d.initializationData||{},f=Object.assign(Object.assign({},!r&&this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)}),m={onClick:()=>this.handleClick(a),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},y=Object.assign(Object.assign({},!p&&{onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,c)}),g=Object.assign(Object.assign(Object.assign({fundingSource:l.FUNDING.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(s)},f),a&&m),h&&y),v=l.Buttons(g);v.isEligible()?(null===(i=v.hasReturned)||void 0===i?void 0:i.call(v))&&this.isPaypalCommerceAppSwitchEnabled(t)?null===(o=v.resume)||void 0===o||o.call(v):v.render(`#${e}`):u&&"function"==typeof u?u():this.bigCommercePaymentsIntegrationService.removeElement(e)}handleClick(e){return nt(this,void 0,void 0,function*(){if(e){const t=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}onHostedCheckoutApprove(t,n,r,i){return nt(this,void 0,void 0,function*(){if(!t.orderID)throw new a(e.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),s=yield n.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(s);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const e=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(s);yield this.paymentIntegrationService.updateShippingAddress(e),yield this.bigCommercePaymentsIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(r,t.orderID),i&&"function"==typeof i&&i(),!0}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingAddressChange(e){return nt(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getAddress({city:e.shippingAddress.city,countryCode:e.shippingAddress.countryCode,postalCode:e.shippingAddress.postalCode,stateOrProvinceCode:e.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(t),yield this.paymentIntegrationService.updateShippingAddress(t);const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingOptionsChange(e){return nt(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}isPaypalCommerceAppSwitchEnabled(e){var t,n;return null!==(n=null===(t=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e).initializationData)||void 0===t?void 0:t.isAppSwitchEnabled)&&void 0!==n&&n}}const it=l(e=>new rt(e,N(e)),[{id:"bigcommerce_payments"}]);var ot=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class at{constructor(e,t,n){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.payPalSdkHelper=n}initialize(e){return ot(this,void 0,void 0,function*(){const{bigcommerce_payments_paylater:t,containerId:n,methodId:r}=e,{buyNowInitializeOptions:i,currencyCode:o,messagingContainerId:a}=t||{},s=!!i;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');if(s&&!o)throw new L('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 L('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 c=this.paymentIntegrationService.getState(),u=s?o:c.getCartOrThrow().currency.code;yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(r,u,!1),this.renderButton(n,r,t);const l=a&&document.getElementById(a);if(u&&l){const e=c.getPaymentMethodOrThrow(r),{paypalBNPLConfiguration:t=[]}=e.initializationData||{},n=t&&t.find(({id:e})=>"cart"===e);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(e,u);this.renderMessages(i,a,n)}})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:u}=c.initializationData||{},l={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},d={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h={onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e),onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,o)},p=[s.FUNDING.PAYLATER,s.FUNDING.CREDIT];let f=!1;p.forEach(t=>{if(!f){const n=Object.assign(Object.assign(Object.assign({fundingSource:t,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(i)},l),r&&d),u&&h),o=s.Buttons(n);o.isEligible()?(o.render(`#${e}`),f=!0):a&&"function"==typeof a&&a()}}),f||this.bigCommercePaymentsIntegrationService.removeElement(e)}handleClick(e){return ot(this,void 0,void 0,function*(){if(e){const t=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}onHostedCheckoutApprove(t,n,r,i){return ot(this,void 0,void 0,function*(){if(!t.orderID)throw new a(e.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),s=yield n.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(s);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const e=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(s);yield this.paymentIntegrationService.updateShippingAddress(e),yield this.bigCommercePaymentsIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(r,t.orderID),i&&"function"==typeof i&&i(),!0}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingAddressChange(e){return ot(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getAddress({city:e.shippingAddress.city,countryCode:e.shippingAddress.countryCode,postalCode:e.shippingAddress.postalCode,stateOrProvinceCode:e.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(t),yield this.paymentIntegrationService.updateShippingAddress(t);const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingOptionsChange(e){return ot(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}renderMessages(e,t,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"cart",style:R(n)};e.Messages(r).render(`#${t}`)}}const st=l(e=>new at(e,N(e),u()),[{id:"bigcommerce_payments_paylater"}]);var ct=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class ut{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t}initialize(e){return ct(this,void 0,void 0,function*(){const{bigcommerce_payments_apms:t,containerId:n,methodId:r}=e,{apm:i,buyNowInitializeOptions:o,currencyCode:a}=t||{},s=!!o;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments_apms" argument is not provided.');if(!i)throw new L('Unable to initialize payment because "options.bigcommerce_payments_apms.apm" argument is not provided.');if(s&&!a)throw new L('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 L('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 c=s?a:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(r,c,!1),this.renderButton(n,r,t)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{apm:r,buyNowInitializeOptions:i,style:o,onEligibilityFailure:a}=n,s=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow();if(!Object.values(s.FUNDING).includes(r))throw new L('Unable to initialize PayPal button because "options.bigcommerce_payments_apms.apm" argument is not valid funding source.');const c={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apms"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},u={onClick:()=>this.handleClick(i),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:r,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o)},c),i&&u),d=s.Buttons(l);d.isEligible()?d.render(`#${e}`):a&&"function"==typeof a?a():this.bigCommercePaymentsIntegrationService.removeElement(e)}handleClick(e){return ct(this,void 0,void 0,function*(){if(e){const t=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}}const lt=l(e=>new ut(e,N(e)),[{id:"bigcommerce_payments_apms"}]);var dt=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class ht{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t}initialize(e){return dt(this,void 0,void 0,function*(){const{bigcommerce_payments_venmo:t,containerId:n,methodId:r}=e,{buyNowInitializeOptions:i,currencyCode:o}=t||{},a=!!i;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments_venmo" argument is not provided.');if(a&&!o)throw new L('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 L('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,t)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{buyNowInitializeOptions:r,style:i,onEligibilityFailure:o}=n,a=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),s=a.FUNDING.VENMO,c={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmo"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},u={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:s,style:this.getValidVenmoButtonStyles(i)},c),r&&u),d=a.Buttons(l);d.isEligible()?d.render(`#${e}`):o&&"function"==typeof o?o():this.bigCommercePaymentsIntegrationService.removeElement(e)}getValidVenmoButtonStyles(e){const t=this.bigCommercePaymentsIntegrationService.getValidButtonStyle(e);return t.color===C.gold?Object.assign(Object.assign({},t),{color:void 0}):t}handleClick(e){return dt(this,void 0,void 0,function*(){if(e){const t=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}}const pt=l(e=>new ht(e,N(e)),[{id:"bigcommerce_payments_venmo"}])})(),module.exports=r})();
2
+ (()=>{var e={35:(e,t,n)=>{e=n.nmd(e);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",a="[object Function]",s="[object Object]",c=/^\[object .+?Constructor\]$/,u=/^(?: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=t&&!t.nodeType&&t,v=g&&e&&!e.nodeType&&e,b=v&&v.exports===g,_=b&&f.process,w=function(){try{return v&&v.require&&v.require("util").types||_&&_.binding&&_.binding("util")}catch(e){}}(),P=w&&w.isTypedArray,S=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,M=(z&&z.allocUnsafe,h=Object.getPrototypeOf,p=Object,function(e){return h(p(e))}),D=Object.create,U=C.propertyIsEnumerable,N=S.splice,R=B?B.toStringTag:void 0,L=function(){try{var e=se(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),V=z?z.isBuffer:void 0,q=Math.max,$=Date.now,H=se(y,"Map"),W=se(Object,"create"),G=function(){function e(){}return function(t){if(!be(t))return{};if(D)return D(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function K(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Y(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function J(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Z(e){var t=this.__data__=new Y(e);this.size=t.size}function X(e,t,n){(void 0!==n&&!he(e[t],n)||void 0===n&&!(t in e))&&te(e,t,n)}function Q(e,t,n){var r=e[t];k.call(e,t)&&he(r,n)&&(void 0!==n||t in e)||te(e,t,n)}function ee(e,t){for(var n=e.length;n--;)if(he(e[n][0],t))return n;return-1}function te(e,t,n){"__proto__"==t&&L?L(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}K.prototype.clear=function(){this.__data__=W?W(null):{},this.size=0},K.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},K.prototype.get=function(e){var t=this.__data__;if(W){var n=t[e];return n===r?void 0:n}return k.call(t,e)?t[e]:void 0},K.prototype.has=function(e){var t=this.__data__;return W?void 0!==t[e]:k.call(t,e)},K.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=W&&void 0===t?r:t,this},Y.prototype.clear=function(){this.__data__=[],this.size=0},Y.prototype.delete=function(e){var t=this.__data__,n=ee(t,e);return!(n<0||(n==t.length-1?t.pop():N.call(t,n,1),--this.size,0))},Y.prototype.get=function(e){var t=this.__data__,n=ee(t,e);return n<0?void 0:t[n][1]},Y.prototype.has=function(e){return ee(this.__data__,e)>-1},Y.prototype.set=function(e,t){var n=this.__data__,r=ee(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},J.prototype.clear=function(){this.size=0,this.__data__={hash:new K,map:new(H||Y),string:new K}},J.prototype.delete=function(e){var t=ae(this,e).delete(e);return this.size-=t?1:0,t},J.prototype.get=function(e){return ae(this,e).get(e)},J.prototype.has=function(e){return ae(this,e).has(e)},J.prototype.set=function(e,t){var n=ae(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Z.prototype.clear=function(){this.__data__=new Y,this.size=0},Z.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Z.prototype.get=function(e){return this.__data__.get(e)},Z.prototype.has=function(e){return this.__data__.has(e)},Z.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Y){var r=n.__data__;if(!H||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new J(r)}return n.set(e,t),this.size=n.size,this};function ne(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":R&&R in Object(e)?function(e){var t=k.call(e,R),n=e[R];try{e[R]=void 0;var r=!0}catch(e){}var i=j.call(e);return r&&(t?e[R]=n:delete e[R]),i}(e):function(e){return j.call(e)}(e)}function re(e){return _e(e)&&ne(e)==o}function ie(e,t,n,r,i){e!==t&&function(e,t,n){for(var r=-1,i=Object(e),o=n(e),a=o.length;a--;){var s=o[++r];if(!1===t(i[s],s,i))break}}(t,function(o,a){if(i||(i=new Z),be(o))!function(e,t,n,r,i,o,a){var c=le(e,n),u=le(t,n),l=a.get(u);if(l)X(e,n,l);else{var d,h,p,f,m,y=o?o(c,u,n+"",e,t,a):void 0,g=void 0===y;if(g){var v=fe(u),b=!v&&ye(u),_=!v&&!b&&we(u);y=u,v||b||_?fe(c)?y=c:_e(m=c)&&me(m)?y=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(c):b?(g=!1,y=function(e){return e.slice()}(u)):_?(g=!1,f=new(p=(d=u).buffer).constructor(p.byteLength),new F(f).set(new F(p)),h=f,y=new d.constructor(h,d.byteOffset,d.length)):y=[]:function(e){if(!_e(e)||ne(e)!=s)return!1;var t=M(e);if(null===t)return!0;var n=k.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&A.call(n)==x}(u)||pe(u)?(y=c,pe(c)?y=function(e){return function(e,t,n){var r=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),r?te(n,a,s):Q(n,a,s)}return n}(e,Pe(e))}(c):be(c)&&!ge(c)||(y=function(e){return"function"!=typeof e.constructor||ue(e)?{}:G(M(e))}(u))):g=!1}g&&(a.set(u,y),i(y,u,r,o,a),a.delete(u)),X(e,n,y)}}(e,t,a,n,ie,r,i);else{var c=r?r(le(e,a),o,a+"",e,t,i):void 0;void 0===c&&(c=o),X(e,a,c)}},Pe)}var oe=L?function(e,t){return L(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:Ce;function ae(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function se(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!be(e)||function(e){return!!E&&E in e}(e))&&(ge(e)?T:c).test(function(e){if(null!=e){try{return A.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}(n)?n:void 0}function ce(e,t){var n=typeof e;return!!(t=null==t?i:t)&&("number"==n||"symbol"!=n&&u.test(e))&&e>-1&&e%1==0&&e<t}function ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||C)}function le(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var de=function(e){var t=0,n=0;return function(){var r=$(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(oe);function he(e,t){return e===t||e!=e&&t!=t}var pe=re(function(){return arguments}())?re:function(e){return _e(e)&&k.call(e,"callee")&&!U.call(e,"callee")},fe=Array.isArray;function me(e){return null!=e&&ve(e.length)&&!ge(e)}var ye=V||function(){return!1};function ge(e){if(!be(e))return!1;var t=ne(e);return t==a||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ve(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function be(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function _e(e){return null!=e&&"object"==typeof e}var we=P?function(e){return function(t){return e(t)}}(P):function(e){return _e(e)&&ve(e.length)&&!!l[ne(e)]};function Pe(e){return me(e)?function(e,t){var n=fe(e),r=!n&&pe(e),i=!n&&!r&&ye(e),o=!n&&!r&&!i&&we(e),a=n||r||i||o,s=a?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],c=s.length;for(var u in e)!t&&!k.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||ce(u,c))||s.push(u);return s}(e,!0):function(e){if(!be(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=ue(e),n=[];for(var r in e)("constructor"!=r||!t&&k.call(e,r))&&n.push(r);return n}(e)}var Se,Ie=(Se=function(e,t,n){ie(e,t,n)},function(e,t){return de(function(e,t,n){return t=q(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=q(r.length-t,0),a=Array(o);++i<o;)a[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,Ce),e+"")}(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,o=r>2?t[2]:void 0;for(i=Se.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(e,t,n){if(!be(n))return!1;var r=typeof t;return!!("number"==r?me(n)&&ce(t,n.length):"string"==r&&t in n)&&he(n[t],e)}(t[0],t[1],o)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var a=t[n];a&&Se(e,a,n)}return e}));function Ce(e){return e}e.exports=Ie},168:e=>{var t;t=function(){function e(){for(var e=0,t={};e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}function t(e){return e.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(r){function i(){}function o(t,n,o){if("undefined"!=typeof document){"number"==typeof(o=e({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(e){}n=r.write?r.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=encodeURIComponent(String(t)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var c in o)o[c]&&(s+="; "+c,!0!==o[c]&&(s+="="+o[c].split(";")[0]));return document.cookie=t+"="+n+s}}function a(e,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("="),c=s.slice(1).join("=");n||'"'!==c.charAt(0)||(c=c.slice(1,-1));try{var u=t(s[0]);if(c=(r.read||r)(c,u)||t(c),n)try{c=JSON.parse(c)}catch(e){}if(i[u]=c,e===u)break}catch(e){}}return e?i[e]:i}}return i.set=o,i.get=function(e){return a(e,!1)},i.getJSON=function(e){return a(e,!0)},i.remove=function(t,n){o(t,"",e(n,{expires:-1}))},i.defaults={},i.withConverter=n,i}(function(){})},"function"==typeof define&&define.amd&&define(t),e.exports=t()},282:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(9722);t.default=function(){return r||(r=i.default()),r}},315:(e,t,n)=>{"use strict";n(4886).default;var r=n(471);t.Hb=r.default;var i=n(5895);t.vQ=i.default,n(7995).default,n(9722).default,n(282).default},321:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(168),i=n(1675),o=n(5861),a=n(4670);function s(e){return new a.A(new o.A,new i.A,r,e)}},471:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(4886);t.default=function(){return new o.default(new i.default,r.createRequestSender())}},710:(e,t,n)=>{"use strict";function r(e){return"object"!=typeof e||null===e?e:Object.keys(e).filter(function(t){return void 0!==e[t]}).map(function(t){var n=e[t];return"string"==typeof n?t+"="+encodeURIComponent(n):t+"="+encodeURIComponent(JSON.stringify(n)||"")}).join("&")}n.d(t,{A:()=>r})},803:e=>{"use strict";e.exports=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}},1675:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(4321),i=n(710),o=/application\/(\w+\+)?json/,a=/application\/x-www-form-urlencoded/;const s=function(){function e(){}return e.prototype.toRequestBody=function(e){var t=e.headers?this._getHeader(e.headers,"Content-Type"):"";if(e.body){if(o.test(t))return JSON.stringify(e.body);if(a.test(t))return(0,i.A)(e.body)}return e.body},e.prototype.toResponse=function(e){var t=this._parseResponseHeaders(e.getAllResponseHeaders());return{body:this._parseResponseBody("response"in e?e.response:e.responseText,t),headers:t,status:e.status,statusText:e.statusText}},e.prototype._parseResponseBody=function(e,t){var n=this._getHeader(t,"Content-Type");return e&&o.test(n)?JSON.parse(e):e},e.prototype._parseResponseHeaders=function(e){return(e?e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/):[]).reduce(function(e,t){var n,i=t.split(":"),o=(i.shift()||"").trim();return o?(0,r.Cl)((0,r.Cl)({},e),((n={})[o.toLowerCase()]=i.join(":").trim(),n)):e},{})},e.prototype._getHeader=function(e,t){return e&&t&&(e[t]||e[t.toLowerCase()])||""},e}()},1915:e=>{"use strict";var t="%[a-f0-9]{2}",n=new RegExp("("+t+")|([^%]+?)","gi"),r=new RegExp("("+t+")+","gi");function i(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function o(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(n)||[],r=1;r<t.length;r++)t=(e=i(t,r).join("")).match(n)||[];return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=r.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var i=o(n[0]);i!==n[0]&&(t[n[0]]=i)}n=r.exec(e)}t["%C2"]="�";for(var a=Object.keys(t),s=0;s<a.length;s++){var c=a[s];e=e.replace(new RegExp(c,"g"),t[c])}return e}(e)}}},2024:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});const r=function(){function e(e){var t=this;this._delay=e,this._resolve=function(){},this._promise=new Promise(function(e){t._resolve=e})}return e.prototype.onComplete=function(e){this._promise.then(e)},e.prototype.complete=function(){this._resolve(),this._timeoutToken&&window.clearTimeout(this._timeoutToken)},e.prototype.start=function(){var e=this;this._delay&&(this._timeoutToken=window.setTimeout(function(){return e.complete()},this._delay))},e}()},4043:(e,t,n)=>{"use strict";n.r(t),n.d(t,{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:(e,t,n)=>{"use strict";n.d(t,{Cl:()=>r});var r=function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)}},4325:(e,t,n)=>{"use strict";n.d(t,{g:()=>i});var r=n(5889),i=function(){function e(){this._cache={}}return e.prototype.read=function(e,t){var n=this.getKey(e,t.params);return this._cache[n]||null},e.prototype.write=function(e,t,n){var r=this.getKey(e,t.params);this._cache[r]=n},e.prototype.getKey=function(e,t){return void 0===t&&(t={}),0===Object.keys(t).length?e:e+"?"+r.As(t)},e}()},4475:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,i){for(var o,a,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),c=1;c<arguments.length;c++){for(var u in o=Object(arguments[c]))n.call(o,u)&&(s[u]=o[u]);if(t){a=t(o);for(var l=0;l<a.length;l++)r.call(o,a[l])&&(s[a[l]]=o[a[l]])}}return s}},4670:(e,t,n)=>{"use strict";n.d(t,{A:()=>u});var r=n(4321),i=n(35),o=n.n(i),a=n(4325),s=n(4843),c=n(2024);const u=function(){function e(e,t,n,r){void 0===r&&(r={}),this._requestFactory=e,this._payloadTransformer=t,this._cookie=n,this._options=r,this._cache=this._options.cache||new a.g}return e.prototype.sendRequest=function(e,t){var n=this,r=this._mergeDefaultOptions(e,t),i=this._getCachedRequest(e,r);if(i)return Promise.resolve(i);var o=this._requestFactory.createRequest(this._prependHost(e),r);return new Promise(function(t,i){var a=function(){var a=n._payloadTransformer.toResponse(o);a.status>=200&&a.status<300?(n._cacheRequest(e,r,a),t(a)):i(a)};o.onload=a,o.onerror=a,o.onabort=a,o.ontimeout=a,r.timeout instanceof c.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))})},e.prototype.get=function(e,t){return this.sendRequest(e,(0,r.Cl)((0,r.Cl)({},t),{method:"GET"}))},e.prototype.post=function(e,t){return this.sendRequest(e,(0,r.Cl)((0,r.Cl)({},t),{method:"POST"}))},e.prototype.put=function(e,t){return this.sendRequest(e,(0,r.Cl)((0,r.Cl)({},t),{method:"PUT"}))},e.prototype.patch=function(e,t){return this.sendRequest(e,(0,r.Cl)((0,r.Cl)({},t),{method:"PATCH"}))},e.prototype.delete=function(e,t){return this.sendRequest(e,(0,r.Cl)((0,r.Cl)({},t),{method:"DELETE"}))},e.prototype._mergeDefaultOptions=function(e,t){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(e,t)&&this._isLocalRequest(e)&&(n.headers["X-XSRF-TOKEN"]=r),t&&t.body&&n.headers&&(n.headers["Content-Type"]="application/json"),o()({},n,t)},e.prototype._prependHost=function(e){return!this._options.host||/^https?:\/\//.test(e)?e:this._options.host.replace(/\/$/,"")+"/"+e.replace(/^\//,"")},e.prototype._shouldCacheRequest=function(e){return"GET"===(e.method||"GET").toUpperCase()&&Boolean(e.cache)},e.prototype._getCachedRequest=function(e,t){return this._shouldCacheRequest(t)?this._cache.read(e,t):null},e.prototype._cacheRequest=function(e,t,n){this._shouldCacheRequest(t)&&this._cache.write(e,t,n)},e.prototype._isAssetRequest=function(e,t){return(!t||!t.method||"GET"===t.method.toUpperCase())&&/\.(png|gif|jpe?g|css|js|json|svg|html?)$/.test(e.split("?")[0])},e.prototype._isLocalRequest=function(e){return!!e.match(new RegExp("^(https?:)?//"+window.location.hostname))||!e.match(new RegExp("^(https?:)?//"))},e}()},4843:(e,t,n)=>{"use strict";function r(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}n.d(t,{A:()=>r})},4886:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._browserSupport=e,this._requestSender=t,this._scripts={},this._preloadedScripts={}}return e.prototype.loadScript=function(e,t){var n=this;return this._scripts[e]||(this._scripts[e]=new Promise(function(r,i){var o=document.createElement("script"),a=t||{},s=a.async,c=void 0!==s&&s,u=a.attributes,l=void 0===u?{}:u;Object.keys(l).forEach(function(e){o.setAttribute(e,l[e])}),o.onload=function(){return r()},o.onreadystatechange=function(){return r()},o.onerror=function(t){delete n._scripts[e],i(t)},o.async=c,o.src=e,document.body.appendChild(o)})),this._scripts[e]},e.prototype.loadScripts=function(e,t){var n=this;return Promise.all(e.map(function(e){return n.loadScript(e,t)})).then(function(){})},e.prototype.preloadScript=function(e,t){var n=this;return this._preloadedScripts[e]||(this._preloadedScripts[e]=new Promise(function(r,i){var o=(t||{}).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=e,s.onload=function(){r()},s.onerror=function(){delete n._preloadedScripts[e],i()},document.head.appendChild(s)}else n._requestSender.get(e,{credentials:!1,headers:{Accept:"application/javascript"}}).then(function(){return r()}).catch(i)})),this._preloadedScripts[e]},e.prototype.preloadScripts=function(e,t){var n=this;return Promise.all(e.map(function(e){return n.preloadScript(e,t)})).then(function(){})},e}();t.default=n},5470:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9783),i=function(){function e(e,t){this._formBuilder=e,this._options=t}return e.prototype.postForm=function(e,t,n,r){var i=this._formBuilder.build(this._prependHost(e),t,r);window.addEventListener("unload",function e(){window.removeEventListener("unload",e),n&&n()}),document.body.appendChild(i),i.submit()},e.prototype._prependHost=function(e){return this._options&&this._options.host&&!(0,r.isAbsoluteUrl)(e)?(0,r.joinPaths)(this._options.host,e):e},e}();t.default=i},5477:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.canSupportRel=function(e){var t=document.createElement("link");return!!(t.relList&&t.relList.supports&&t.relList.supports(e))},e}();t.default=n},5861:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(5889);const i=function(){function e(){}return e.prototype.createRequest=function(e,t){var n=new XMLHttpRequest;return this._configureRequest(n,e,t),n},e.prototype._configureRequest=function(e,t,n){void 0===n&&(n={}),e.open(n.method||"GET",this._formatUrl(t,n.params,n.encodeParams),!0),n.headers&&this._configureRequestHeaders(e,n.headers),"boolean"==typeof n.credentials&&(e.withCredentials=n.credentials),"number"==typeof n.timeout&&(e.timeout=n.timeout)},e.prototype._configureRequestHeaders=function(e,t){Object.keys(t).filter(function(e){return null!==t[e]}).forEach(function(n){e.setRequestHeader(n,t[n])})},e.prototype._formatUrl=function(e,t,n){return void 0===n&&(n=!0),t&&0!==Object.keys(t).length?e+"?"+r.As(t,{encode:n}):e},e}()},5889:(e,t,n)=>{"use strict";var r=n(803),i=n(4475);n(1915);function o(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}t.As=function(e,t){!1===(t=i({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=function(){});var n=function(e){switch(e.arrayFormat){case"index":return function(t,n,r){return null===n?[o(t,e),"[",r,"]"].join(""):[o(t,e),"[",o(r,e),"]=",o(n,e)].join("")};case"bracket":return function(t,n){return null===n?o(t,e):[o(t,e),"[]=",o(n,e)].join("")};default:return function(t,n){return null===n?o(t,e):[o(t,e),"=",o(n,e)].join("")}}}(t);return e?Object.keys(e).sort(t.sort).map(function(r){var i=e[r];if(void 0===i)return"";if(null===i)return o(r,t);if(Array.isArray(i)){var a=[];return i.slice().forEach(function(e){void 0!==e&&a.push(n(r,e,a.length))}),a.join("&")}return o(r,t)+"="+o(i,t)}).filter(function(e){return e.length>0}).join("&"):""}},5895:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,i=n(471);t.default=function(){return r||(r=i.default()),r}},6889:(e,t,n)=>{"use strict";n.d(t,{A:()=>i});var r=n(2024);function i(e){return new r.A(e)}},7995:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._browserSupport=e,this._requestSender=t,this._stylesheets={},this._preloadedStylesheets={}}return e.prototype.loadStylesheet=function(e,t){var n=this;return this._stylesheets[e]||(this._stylesheets[e]=new Promise(function(r,i){var o=document.createElement("link"),a=t||{},s=a.prepend,c=void 0!==s&&s,u=a.attributes,l=void 0===u?{}:u;Object.keys(l).forEach(function(e){o.setAttribute(e,l[e])}),o.onload=function(){return r()},o.onerror=function(t){delete n._stylesheets[e],i(t)},o.rel="stylesheet",o.href=e,c&&document.head.children[0]?document.head.insertBefore(o,document.head.children[0]):document.head.appendChild(o)})),this._stylesheets[e]},e.prototype.loadStylesheets=function(e,t){var n=this;return Promise.all(e.map(function(e){return n.loadStylesheet(e,t)})).then(function(){})},e.prototype.preloadStylesheet=function(e,t){var n=this;return this._preloadedStylesheets[e]||(this._preloadedStylesheets[e]=new Promise(function(r,i){var o=(t||{}).prefetch,a=void 0!==o&&o,s=a?"prefetch":"preload";if(n._browserSupport.canSupportRel(s)){var c=document.createElement("link");c.as="style",c.rel=a?"prefetch":"preload",c.href=e,c.onload=function(){r()},c.onerror=function(t){delete n._preloadedStylesheets[e],i(t)},document.head.appendChild(c)}else n._requestSender.get(e,{credentials:!1,headers:{Accept:"text/css"}}).then(function(){return r()}).catch(i)})),this._preloadedStylesheets[e]},e.prototype.preloadStylesheets=function(e,t){var n=this;return Promise.all(e.map(function(e){return n.preloadStylesheet(e,t)})).then(function(){})},e}();t.default=n},8686:(e,t,n)=>{"use strict";t.createFormPoster=void 0;var r=n(9165);Object.defineProperty(t,"createFormPoster",{enumerable:!0,get:function(){return r.default}});n(5470)},9165:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(9828),i=n(5470);t.default=function(e){var t=new r.default;return new i.default(t,e)}},9440:function(e,t,n){e=n.nmd(e),function(){var r,i="Expected a function",o="__lodash_hash_undefined__",a="__lodash_placeholder__",s=32,c=128,u=1/0,l=9007199254740991,d=NaN,h=4294967295,p=[["ary",c],["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]",P="[object Number]",S="[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]",M="[object Int32Array]",D="[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),K=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),ne=/^\s+/,re=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,le=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,pe=/^0b[01]+$/i,fe=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ye=/^(?:0|[1-9]\d*)$/,ge=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,be=/['\n\r\u2028\u2029\\]/g,_e="\\ud800-\\udfff",we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Pe="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",Ce="\\ufe0e\\ufe0f",Oe="\\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",Ae="["+_e+"]",ke="["+Oe+"]",Ee="["+we+"]",je="\\d+",xe="["+Pe+"]",Te="["+Se+"]",ze="[^"+_e+Oe+je+Pe+Se+Ie+"]",Be="\\ud83c[\\udffb-\\udfff]",Fe="[^"+_e+"]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",De="[\\ud800-\\udbff][\\udc00-\\udfff]",Ue="["+Ie+"]",Ne="\\u200d",Re="(?:"+Te+"|"+ze+")",Le="(?:"+Ue+"|"+ze+")",Ve="(?:['’](?:d|ll|m|re|s|t|ve))?",qe="(?:['’](?:D|LL|M|RE|S|T|VE))?",$e="(?:"+Ee+"|"+Be+")?",He="["+Ce+"]?",We=He+$e+"(?:"+Ne+"(?:"+[Fe,Me,De].join("|")+")"+He+$e+")*",Ge="(?:"+[xe,Me,De].join("|")+")"+We,Ke="(?:"+[Fe+Ee+"?",Ee,Me,De,Ae].join("|")+")",Ye=RegExp("['’]","g"),Je=RegExp(Ee,"g"),Ze=RegExp(Be+"(?="+Be+")|"+Ke+We,"g"),Xe=RegExp([Ue+"?"+Te+"+"+Ve+"(?="+[ke,Ue,"$"].join("|")+")",Le+"+"+qe+"(?="+[ke,Ue+Re,"$"].join("|")+")",Ue+"?"+Re+"+"+Ve,Ue+"+"+qe,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",je,Ge].join("|"),"g"),Qe=RegExp("["+Ne+_e+we+Ce+"]"),et=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,tt=["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"],nt=-1,rt={};rt[T]=rt[z]=rt[B]=rt[F]=rt[M]=rt[D]=rt[U]=rt[N]=rt[R]=!0,rt[f]=rt[m]=rt[j]=rt[y]=rt[x]=rt[g]=rt[v]=rt[b]=rt[w]=rt[P]=rt[S]=rt[C]=rt[O]=rt[A]=rt[E]=!1;var it={};it[f]=it[m]=it[j]=it[x]=it[y]=it[g]=it[T]=it[z]=it[B]=it[F]=it[M]=it[w]=it[P]=it[S]=it[C]=it[O]=it[A]=it[k]=it[D]=it[U]=it[N]=it[R]=!0,it[v]=it[b]=it[E]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},at=parseFloat,st=parseInt,ct="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ut="object"==typeof self&&self&&self.Object===Object&&self,lt=ct||ut||Function("return this")(),dt=t&&!t.nodeType&&t,ht=dt&&e&&!e.nodeType&&e,pt=ht&&ht.exports===dt,ft=pt&&ct.process,mt=function(){try{return ht&&ht.require&&ht.require("util").types||ft&&ft.binding&&ft.binding("util")}catch(e){}}(),yt=mt&&mt.isArrayBuffer,gt=mt&&mt.isDate,vt=mt&&mt.isMap,bt=mt&&mt.isRegExp,_t=mt&&mt.isSet,wt=mt&&mt.isTypedArray;function Pt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function St(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(r,a,n(a),e)}return r}function It(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function Ct(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Ot(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function At(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function kt(e,t){return!(null==e||!e.length)&&Ut(e,t,0)>-1}function Et(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function jt(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function xt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Tt(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function zt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Bt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Ft=Vt("length");function Mt(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function Dt(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function Ut(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Dt(e,Rt,n)}function Nt(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Rt(e){return e!=e}function Lt(e,t){var n=null==e?0:e.length;return n?Ht(e,t)/n:d}function Vt(e){return function(t){return null==t?r:t[e]}}function qt(e){return function(t){return null==e?r:e[t]}}function $t(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}function Ht(e,t){for(var n,i=-1,o=e.length;++i<o;){var a=t(e[i]);a!==r&&(n=n===r?a:n+a)}return n}function Wt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Gt(e){return e?e.slice(0,dn(e)+1).replace(ne,""):e}function Kt(e){return function(t){return e(t)}}function Yt(e,t){return jt(t,function(t){return e[t]})}function Jt(e,t){return e.has(t)}function Zt(e,t){for(var n=-1,r=e.length;++n<r&&Ut(t,e[n],0)>-1;);return n}function Xt(e,t){for(var n=e.length;n--&&Ut(t,e[n],0)>-1;);return n}var Qt=qt({À:"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"}),en=qt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function tn(e){return"\\"+ot[e]}function nn(e){return Qe.test(e)}function rn(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function on(e,t){return function(n){return e(t(n))}}function an(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];s!==t&&s!==a||(e[n]=a,o[i++]=n)}return o}function sn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function cn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function un(e){return nn(e)?function(e){for(var t=Ze.lastIndex=0;Ze.test(e);)++t;return t}(e):Ft(e)}function ln(e){return nn(e)?function(e){return e.match(Ze)||[]}(e):function(e){return e.split("")}(e)}function dn(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var hn=qt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),pn=function e(t){var n,re=(t=null==t?lt:pn.defaults(lt.Object(),t,pn.pick(lt,tt))).Array,_e=t.Date,we=t.Error,Pe=t.Function,Se=t.Math,Ie=t.Object,Ce=t.RegExp,Oe=t.String,Ae=t.TypeError,ke=re.prototype,Ee=Pe.prototype,je=Ie.prototype,xe=t["__core-js_shared__"],Te=Ee.toString,ze=je.hasOwnProperty,Be=0,Fe=(n=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Me=je.toString,De=Te.call(Ie),Ue=lt._,Ne=Ce("^"+Te.call(ze).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=pt?t.Buffer:r,Le=t.Symbol,Ve=t.Uint8Array,qe=Re?Re.allocUnsafe:r,$e=on(Ie.getPrototypeOf,Ie),He=Ie.create,We=je.propertyIsEnumerable,Ge=ke.splice,Ke=Le?Le.isConcatSpreadable:r,Ze=Le?Le.iterator:r,Qe=Le?Le.toStringTag:r,ot=function(){try{var e=co(Ie,"defineProperty");return e({},"",{}),e}catch(e){}}(),ct=t.clearTimeout!==lt.clearTimeout&&t.clearTimeout,ut=_e&&_e.now!==lt.Date.now&&_e.now,dt=t.setTimeout!==lt.setTimeout&&t.setTimeout,ht=Se.ceil,ft=Se.floor,mt=Ie.getOwnPropertySymbols,Ft=Re?Re.isBuffer:r,qt=t.isFinite,fn=ke.join,mn=on(Ie.keys,Ie),yn=Se.max,gn=Se.min,vn=_e.now,bn=t.parseInt,_n=Se.random,wn=ke.reverse,Pn=co(t,"DataView"),Sn=co(t,"Map"),In=co(t,"Promise"),Cn=co(t,"Set"),On=co(t,"WeakMap"),An=co(Ie,"create"),kn=On&&new On,En={},jn=Do(Pn),xn=Do(Sn),Tn=Do(In),zn=Do(Cn),Bn=Do(On),Fn=Le?Le.prototype:r,Mn=Fn?Fn.valueOf:r,Dn=Fn?Fn.toString:r;function Un(e){if(es(e)&&!qa(e)&&!(e instanceof Vn)){if(e instanceof Ln)return e;if(ze.call(e,"__wrapped__"))return Uo(e)}return new Ln(e)}var Nn=function(){function e(){}return function(t){if(!Qa(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function Rn(){}function Ln(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function Vn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function $n(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Hn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Hn;++t<n;)this.add(e[t])}function Gn(e){var t=this.__data__=new $n(e);this.size=t.size}function Kn(e,t){var n=qa(e),r=!n&&Va(e),i=!n&&!r&&Ga(e),o=!n&&!r&&!i&&cs(e),a=n||r||i||o,s=a?Wt(e.length,Oe):[],c=s.length;for(var u in e)!t&&!ze.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||yo(u,c))||s.push(u);return s}function Yn(e){var t=e.length;return t?e[Hr(0,t-1)]:r}function Jn(e,t){return To(Oi(e),or(t,0,e.length))}function Zn(e){return To(Oi(e))}function Xn(e,t,n){(n!==r&&!Na(e[t],n)||n===r&&!(t in e))&&rr(e,t,n)}function Qn(e,t,n){var i=e[t];ze.call(e,t)&&Na(i,n)&&(n!==r||t in e)||rr(e,t,n)}function er(e,t){for(var n=e.length;n--;)if(Na(e[n][0],t))return n;return-1}function tr(e,t,n,r){return lr(e,function(e,i,o){t(r,e,n(e),o)}),r}function nr(e,t){return e&&Ai(t,js(t),e)}function rr(e,t,n){"__proto__"==t&&ot?ot(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ir(e,t){for(var n=-1,i=t.length,o=re(i),a=null==e;++n<i;)o[n]=a?r:Cs(e,t[n]);return o}function or(e,t,n){return e==e&&(n!==r&&(e=e<=n?e:n),t!==r&&(e=e>=t?e:t)),e}function ar(e,t,n,i,o,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=o?n(e,i,o,a):n(e)),s!==r)return s;if(!Qa(e))return e;var d=qa(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&ze.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!c)return Oi(e,s)}else{var h=ho(e),p=h==b||h==_;if(Ga(e))return _i(e,c);if(h==S||h==f||p&&!o){if(s=u||p?{}:fo(e),!c)return u?function(e,t){return Ai(e,lo(e),t)}(e,function(e,t){return e&&Ai(t,xs(t),e)}(s,e)):function(e,t){return Ai(e,uo(e),t)}(e,nr(s,e))}else{if(!it[h])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case j:return wi(e);case y:case g:return new i(+e);case x:return function(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case T:case z:case B:case F:case M:case D:case U:case N:case R:return Pi(e,n);case w:return new i;case P:case A:return new i(e);case C:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case O:return new i;case k:return r=e,Mn?Ie(Mn.call(r)):{}}}(e,h,c)}}a||(a=new Gn);var m=a.get(e);if(m)return m;a.set(e,s),os(e)?e.forEach(function(r){s.add(ar(r,t,n,r,e,a))}):ts(e)&&e.forEach(function(r,i){s.set(i,ar(r,t,n,i,e,a))});var v=d?r:(l?u?to:eo:u?xs:js)(e);return It(v||e,function(r,i){v&&(r=e[i=r]),Qn(s,i,ar(r,t,n,i,e,a))}),s}function sr(e,t,n){var i=n.length;if(null==e)return!i;for(e=Ie(e);i--;){var o=n[i],a=t[o],s=e[o];if(s===r&&!(o in e)||!a(s))return!1}return!0}function cr(e,t,n){if("function"!=typeof e)throw new Ae(i);return ko(function(){e.apply(r,n)},t)}function ur(e,t,n,r){var i=-1,o=kt,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=jt(t,Kt(n))),r?(o=Et,a=!1):t.length>=200&&(o=Jt,a=!1,t=new Wn(t));e:for(;++i<s;){var l=e[i],d=null==n?l:n(l);if(l=r||0!==l?l:0,a&&d==d){for(var h=u;h--;)if(t[h]===d)continue e;c.push(l)}else o(t,d,r)||c.push(l)}return c}Un.templateSettings={escape:K,evaluate:Y,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(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},qn.prototype.get=function(e){var t=this.__data__;if(An){var n=t[e];return n===o?r:n}return ze.call(t,e)?t[e]:r},qn.prototype.has=function(e){var t=this.__data__;return An?t[e]!==r:ze.call(t,e)},qn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=An&&t===r?o:t,this},$n.prototype.clear=function(){this.__data__=[],this.size=0},$n.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():Ge.call(t,n,1),--this.size,0))},$n.prototype.get=function(e){var t=this.__data__,n=er(t,e);return n<0?r:t[n][1]},$n.prototype.has=function(e){return er(this.__data__,e)>-1},$n.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new qn,map:new(Sn||$n),string:new qn}},Hn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return ao(this,e).get(e)},Hn.prototype.has=function(e){return ao(this,e).has(e)},Hn.prototype.set=function(e,t){var n=ao(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Wn.prototype.add=Wn.prototype.push=function(e){return this.__data__.set(e,o),this},Wn.prototype.has=function(e){return this.__data__.has(e)},Gn.prototype.clear=function(){this.__data__=new $n,this.size=0},Gn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Gn.prototype.get=function(e){return this.__data__.get(e)},Gn.prototype.has=function(e){return this.__data__.has(e)},Gn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof $n){var r=n.__data__;if(!Sn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var lr=ji(vr),dr=ji(br,!0);function hr(e,t){var n=!0;return lr(e,function(e,r,i){return n=!!t(e,r,i)}),n}function pr(e,t,n){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(c===r?s==s&&!ss(s):n(s,c)))var c=s,u=a}return u}function fr(e,t){var n=[];return lr(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function mr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=mo),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?mr(s,t-1,n,r,i):xt(i,s):r||(i[i.length]=s)}return i}var yr=xi(),gr=xi(!0);function vr(e,t){return e&&yr(e,t,js)}function br(e,t){return e&&gr(e,t,js)}function _r(e,t){return At(t,function(t){return Ja(e[t])})}function wr(e,t){for(var n=0,i=(t=yi(t,e)).length;null!=e&&n<i;)e=e[Mo(t[n++])];return n&&n==i?e:r}function Pr(e,t,n){var r=t(e);return qa(e)?r:xt(r,n(e))}function Sr(e){return null==e?e===r?"[object Undefined]":"[object Null]":Qe&&Qe in Ie(e)?function(e){var t=ze.call(e,Qe),n=e[Qe];try{e[Qe]=r;var i=!0}catch(e){}var o=Me.call(e);return i&&(t?e[Qe]=n:delete e[Qe]),o}(e):function(e){return Me.call(e)}(e)}function Ir(e,t){return e>t}function Cr(e,t){return null!=e&&ze.call(e,t)}function Or(e,t){return null!=e&&t in Ie(e)}function Ar(e,t,n){for(var i=n?Et:kt,o=e[0].length,a=e.length,s=a,c=re(a),u=1/0,l=[];s--;){var d=e[s];s&&t&&(d=jt(d,Kt(t))),u=gn(d.length,u),c[s]=!n&&(t||o>=120&&d.length>=120)?new Wn(s&&d):r}d=e[0];var h=-1,p=c[0];e:for(;++h<o&&l.length<u;){var f=d[h],m=t?t(f):f;if(f=n||0!==f?f:0,!(p?Jt(p,m):i(l,m,n))){for(s=a;--s;){var y=c[s];if(!(y?Jt(y,m):i(e[s],m,n)))continue e}p&&p.push(m),l.push(f)}}return l}function kr(e,t,n){var i=null==(e=Co(e,t=yi(t,e)))?e:e[Mo(Yo(t))];return null==i?r:Pt(i,e,n)}function Er(e){return es(e)&&Sr(e)==f}function jr(e,t,n,i,o){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,n,i,o,a){var s=qa(e),c=qa(t),u=s?m:ho(e),l=c?m:ho(t),d=(u=u==f?S:u)==S,h=(l=l==f?S:l)==S,p=u==l;if(p&&Ga(e)){if(!Ga(t))return!1;s=!0,d=!1}if(p&&!d)return a||(a=new Gn),s||cs(e)?Xi(e,t,n,i,o,a):function(e,t,n,r,i,o,a){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case j:return!(e.byteLength!=t.byteLength||!o(new Ve(e),new Ve(t)));case y:case g:case P:return Na(+e,+t);case v:return e.name==t.name&&e.message==t.message;case C:case A:return e==t+"";case w:var s=rn;case O:var c=1&r;if(s||(s=sn),e.size!=t.size&&!c)return!1;var u=a.get(e);if(u)return u==t;r|=2,a.set(e,t);var l=Xi(s(e),s(t),r,i,o,a);return a.delete(e),l;case k:if(Mn)return Mn.call(e)==Mn.call(t)}return!1}(e,t,u,n,i,o,a);if(!(1&n)){var b=d&&ze.call(e,"__wrapped__"),_=h&&ze.call(t,"__wrapped__");if(b||_){var I=b?e.value():e,E=_?t.value():t;return a||(a=new Gn),o(I,E,n,i,a)}}return!!p&&(a||(a=new Gn),function(e,t,n,i,o,a){var s=1&n,c=eo(e),u=c.length;if(u!=eo(t).length&&!s)return!1;for(var l=u;l--;){var d=c[l];if(!(s?d in t:ze.call(t,d)))return!1}var h=a.get(e),p=a.get(t);if(h&&p)return h==t&&p==e;var f=!0;a.set(e,t),a.set(t,e);for(var m=s;++l<u;){var y=e[d=c[l]],g=t[d];if(i)var v=s?i(g,y,d,t,e,a):i(y,g,d,e,t,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=e.constructor,_=t.constructor;b==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(f=!1)}return a.delete(e),a.delete(t),f}(e,t,n,i,o,a))}(e,t,n,i,jr,o))}function xr(e,t,n,i){var o=n.length,a=o,s=!i;if(null==e)return!a;for(e=Ie(e);o--;){var c=n[o];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++o<a;){var u=(c=n[o])[0],l=e[u],d=c[1];if(s&&c[2]){if(l===r&&!(u in e))return!1}else{var h=new Gn;if(i)var p=i(l,d,u,e,t,h);if(!(p===r?jr(d,l,3,i,h):p))return!1}}return!0}function Tr(e){return!(!Qa(e)||(t=e,Fe&&Fe in t))&&(Ja(e)?Ne:fe).test(Do(e));var t}function zr(e){return"function"==typeof e?e:null==e?nc:"object"==typeof e?qa(e)?Ur(e[0],e[1]):Dr(e):dc(e)}function Br(e){if(!wo(e))return mn(e);var t=[];for(var n in Ie(e))ze.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Fr(e,t){return e<t}function Mr(e,t){var n=-1,r=Ha(e)?re(e.length):[];return lr(e,function(e,i,o){r[++n]=t(e,i,o)}),r}function Dr(e){var t=so(e);return 1==t.length&&t[0][2]?So(t[0][0],t[0][1]):function(n){return n===e||xr(n,e,t)}}function Ur(e,t){return vo(e)&&Po(t)?So(Mo(e),t):function(n){var i=Cs(n,e);return i===r&&i===t?Os(n,e):jr(t,i,3)}}function Nr(e,t,n,i,o){e!==t&&yr(t,function(a,s){if(o||(o=new Gn),Qa(a))!function(e,t,n,i,o,a,s){var c=Oo(e,n),u=Oo(t,n),l=s.get(u);if(l)Xn(e,n,l);else{var d=a?a(c,u,n+"",e,t,s):r,h=d===r;if(h){var p=qa(u),f=!p&&Ga(u),m=!p&&!f&&cs(u);d=u,p||f||m?qa(c)?d=c:Wa(c)?d=Oi(c):f?(h=!1,d=_i(u,!0)):m?(h=!1,d=Pi(u,!0)):d=[]:rs(u)||Va(u)?(d=c,Va(c)?d=ys(c):Qa(c)&&!Ja(c)||(d=fo(u))):h=!1}h&&(s.set(u,d),o(d,u,i,a,s),s.delete(u)),Xn(e,n,d)}}(e,t,s,n,Nr,i,o);else{var c=i?i(Oo(e,s),a,s+"",e,t,o):r;c===r&&(c=a),Xn(e,s,c)}},xs)}function Rr(e,t){var n=e.length;if(n)return yo(t+=t<0?n:0,n)?e[t]:r}function Lr(e,t,n){t=t.length?jt(t,function(e){return qa(e)?function(t){return wr(t,1===e.length?e[0]:e)}:e}):[nc];var r=-1;t=jt(t,Kt(oo()));var i=Mr(e,function(e,n,i){var o=jt(t,function(t){return t(e)});return{criteria:o,index:++r,value:e}});return function(e){var t=e.length;for(e.sort(function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var c=Si(i[r],o[r]);if(c)return r>=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)});t--;)e[t]=e[t].value;return e}(i)}function Vr(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=wr(e,a);n(s,a)&&Jr(o,yi(a,e),s)}return o}function qr(e,t,n,r){var i=r?Nt:Ut,o=-1,a=t.length,s=e;for(e===t&&(t=Oi(t)),n&&(s=jt(e,Kt(n)));++o<a;)for(var c=0,u=t[o],l=n?n(u):u;(c=i(s,l,c,r))>-1;)s!==e&&Ge.call(s,c,1),Ge.call(e,c,1);return e}function $r(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;yo(i)?Ge.call(e,i,1):ci(e,i)}}return e}function Hr(e,t){return e+ft(_n()*(t-e+1))}function Wr(e,t){var n="";if(!e||t<1||t>l)return n;do{t%2&&(n+=e),(t=ft(t/2))&&(e+=e)}while(t);return n}function Gr(e,t){return Eo(Io(e,t,nc),e+"")}function Kr(e){return Yn(Ns(e))}function Yr(e,t){var n=Ns(e);return To(n,or(t,0,n.length))}function Jr(e,t,n,i){if(!Qa(e))return e;for(var o=-1,a=(t=yi(t,e)).length,s=a-1,c=e;null!=c&&++o<a;){var u=Mo(t[o]),l=n;if("__proto__"===u||"constructor"===u||"prototype"===u)return e;if(o!=s){var d=c[u];(l=i?i(d,u,c):r)===r&&(l=Qa(d)?d:yo(t[o+1])?[]:{})}Qn(c,u,l),c=c[u]}return e}var Zr=kn?function(e,t){return kn.set(e,t),e}:nc,Xr=ot?function(e,t){return ot(e,"toString",{configurable:!0,enumerable:!1,value:Qs(t),writable:!0})}:nc;function Qr(e){return To(Ns(e))}function ei(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=re(i);++r<i;)o[r]=e[r+t];return o}function ti(e,t){var n;return lr(e,function(e,r,i){return!(n=t(e,r,i))}),!!n}function ni(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=e[o];null!==a&&!ss(a)&&(n?a<=t:a<t)?r=o+1:i=o}return i}return ri(e,t,nc,n)}function ri(e,t,n,i){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=n(t))!=t,c=null===t,u=ss(t),l=t===r;o<a;){var d=ft((o+a)/2),h=n(e[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):c?m&&p&&(i||!f):u?m&&p&&!f&&(i||!y):!f&&!y&&(i?h<=t:h<t);g?o=d+1:a=d}return gn(a,4294967294)}function ii(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!Na(s,c)){var c=s;o[i++]=0===a?0:a}}return o}function oi(e){return"number"==typeof e?e:ss(e)?d:+e}function ai(e){if("string"==typeof e)return e;if(qa(e))return jt(e,ai)+"";if(ss(e))return Dn?Dn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,n){var r=-1,i=kt,o=e.length,a=!0,s=[],c=s;if(n)a=!1,i=Et;else if(o>=200){var u=t?null:Wi(e);if(u)return sn(u);a=!1,i=Jt,c=new Wn}else c=t?[]:s;e:for(;++r<o;){var l=e[r],d=t?t(l):l;if(l=n||0!==l?l:0,a&&d==d){for(var h=c.length;h--;)if(c[h]===d)continue e;t&&c.push(d),s.push(l)}else i(c,d,n)||(c!==s&&c.push(d),s.push(l))}return s}function ci(e,t){return null==(e=Co(e,t=yi(t,e)))||delete e[Mo(Yo(t))]}function ui(e,t,n,r){return Jr(e,t,n(wr(e,t)),r)}function li(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?ei(e,r?0:o,r?o+1:i):ei(e,r?o+1:0,r?i:o)}function di(e,t){var n=e;return n instanceof Vn&&(n=n.value()),Tt(t,function(e,t){return t.func.apply(t.thisArg,xt([e],t.args))},n)}function hi(e,t,n){var r=e.length;if(r<2)return r?si(e[0]):[];for(var i=-1,o=re(r);++i<r;)for(var a=e[i],s=-1;++s<r;)s!=i&&(o[i]=ur(o[i]||a,e[s],t,n));return si(mr(o,1),t,n)}function pi(e,t,n){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var c=i<a?t[i]:r;n(s,e[i],c)}return s}function fi(e){return Wa(e)?e:[]}function mi(e){return"function"==typeof e?e:nc}function yi(e,t){return qa(e)?e:vo(e,t)?[e]:Fo(gs(e))}var gi=Gr;function vi(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:ei(e,t,n)}var bi=ct||function(e){return lt.clearTimeout(e)};function _i(e,t){if(t)return e.slice();var n=e.length,r=qe?qe(n):new e.constructor(n);return e.copy(r),r}function wi(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function Pi(e,t){var n=t?wi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Si(e,t){if(e!==t){var n=e!==r,i=null===e,o=e==e,a=ss(e),s=t!==r,c=null===t,u=t==t,l=ss(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||i&&s&&u||!n&&u||!o)return 1;if(!i&&!a&&!l&&e<t||l&&n&&o&&!i&&!a||c&&n&&o||!s&&o||!u)return-1}return 0}function Ii(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,c=t.length,u=yn(o-a,0),l=re(c+u),d=!r;++s<c;)l[s]=t[s];for(;++i<a;)(d||i<o)&&(l[n[i]]=e[i]);for(;u--;)l[s++]=e[i++];return l}function Ci(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,c=-1,u=t.length,l=yn(o-s,0),d=re(l+u),h=!r;++i<l;)d[i]=e[i];for(var p=i;++c<u;)d[p+c]=t[c];for(;++a<s;)(h||i<o)&&(d[p+n[a]]=e[i++]);return d}function Oi(e,t){var n=-1,r=e.length;for(t||(t=re(r));++n<r;)t[n]=e[n];return t}function Ai(e,t,n,i){var o=!n;n||(n={});for(var a=-1,s=t.length;++a<s;){var c=t[a],u=i?i(n[c],e[c],c,n,e):r;u===r&&(u=e[c]),o?rr(n,c,u):Qn(n,c,u)}return n}function ki(e,t){return function(n,r){var i=qa(n)?St:tr,o=t?t():{};return i(n,e,oo(r,2),o)}}function Ei(e){return Gr(function(t,n){var i=-1,o=n.length,a=o>1?n[o-1]:r,s=o>2?n[2]:r;for(a=e.length>3&&"function"==typeof a?(o--,a):r,s&&go(n[0],n[1],s)&&(a=o<3?r:a,o=1),t=Ie(t);++i<o;){var c=n[i];c&&e(t,c,i,a)}return t})}function ji(e,t){return function(n,r){if(null==n)return n;if(!Ha(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Ie(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function xi(e){return function(t,n,r){for(var i=-1,o=Ie(t),a=r(t),s=a.length;s--;){var c=a[e?s:++i];if(!1===n(o[c],c,o))break}return t}}function Ti(e){return function(t){var n=nn(t=gs(t))?ln(t):r,i=n?n[0]:t.charAt(0),o=n?vi(n,1).join(""):t.slice(1);return i[e]()+o}}function zi(e){return function(t){return Tt(Js(Vs(t).replace(Ye,"")),e,"")}}function Bi(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Nn(e.prototype),r=e.apply(n,t);return Qa(r)?r:n}}function Fi(e){return function(t,n,i){var o=Ie(t);if(!Ha(t)){var a=oo(n,3);t=js(t),n=function(e){return a(o[e],e,o)}}var s=e(t,n,i);return s>-1?o[a?t[s]:s]:r}}function Mi(e){return Qi(function(t){var n=t.length,o=n,a=Ln.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Ae(i);if(a&&!c&&"wrapper"==ro(s))var c=new Ln([],!0)}for(o=c?o:n;++o<n;){var u=ro(s=t[o]),l="wrapper"==u?no(s):r;c=l&&bo(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?c[ro(l[0])].apply(c,l[3]):1==s.length&&bo(s)?c[u]():c.thru(s)}return function(){var e=arguments,r=e[0];if(c&&1==e.length&&qa(r))return c.plant(r).value();for(var i=0,o=n?t[i].apply(this,e):r;++i<n;)o=t[i].call(this,o);return o}})}function Di(e,t,n,i,o,a,s,u,l,d){var h=t&c,p=1&t,f=2&t,m=24&t,y=512&t,g=f?r:Bi(e);return function c(){for(var v=arguments.length,b=re(v),_=v;_--;)b[_]=arguments[_];if(m)var w=io(c),P=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(b,w);if(i&&(b=Ii(b,i,o,m)),a&&(b=Ci(b,a,s,m)),v-=P,m&&v<d){var S=an(b,w);return $i(e,t,Di,c.placeholder,n,b,S,u,l,d-v)}var I=p?n:this,C=f?I[e]:e;return v=b.length,u?b=function(e,t){for(var n=e.length,i=gn(t.length,n),o=Oi(e);i--;){var a=t[i];e[i]=yo(a,n)?o[a]:r}return e}(b,u):y&&v>1&&b.reverse(),h&&l<v&&(b.length=l),this&&this!==lt&&this instanceof c&&(C=g||Bi(C)),C.apply(I,b)}}function Ui(e,t){return function(n,r){return function(e,t,n,r){return vr(e,function(e,i,o){t(r,n(e),i,o)}),r}(n,e,t(r),{})}}function Ni(e,t){return function(n,i){var o;if(n===r&&i===r)return t;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=e(n,i)}return o}}function Ri(e){return Qi(function(t){return t=jt(t,Kt(oo())),Gr(function(n){var r=this;return e(t,function(e){return Pt(e,r,n)})})})}function Li(e,t){var n=(t=t===r?" ":ai(t)).length;if(n<2)return n?Wr(t,e):t;var i=Wr(t,ht(e/un(t)));return nn(t)?vi(ln(i),0,e).join(""):i.slice(0,e)}function Vi(e){return function(t,n,i){return i&&"number"!=typeof i&&go(t,n,i)&&(n=i=r),t=hs(t),n===r?(n=t,t=0):n=hs(n),function(e,t,n,r){for(var i=-1,o=yn(ht((t-e)/(n||1)),0),a=re(o);o--;)a[r?o:++i]=e,e+=n;return a}(t,n,i=i===r?t<n?1:-1:hs(i),e)}}function qi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ms(t),n=ms(n)),e(t,n)}}function $i(e,t,n,i,o,a,c,u,l,d){var h=8&t;t|=h?s:64,4&(t&=~(h?64:s))||(t&=-4);var p=[e,t,o,h?a:r,h?c:r,h?r:a,h?r:c,u,l,d],f=n.apply(r,p);return bo(e)&&Ao(f,p),f.placeholder=i,jo(f,e,t)}function Hi(e){var t=Se[e];return function(e,n){if(e=ms(e),(n=null==n?0:gn(ps(n),292))&&qt(e)){var r=(gs(e)+"e").split("e");return+((r=(gs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Wi=Cn&&1/sn(new Cn([,-0]))[1]==u?function(e){return new Cn(e)}:sc;function Gi(e){return function(t){var n=ho(t);return n==w?rn(t):n==O?cn(t):function(e,t){return jt(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ki(e,t,n,o,u,l,d,h){var p=2&t;if(!p&&"function"!=typeof e)throw new Ae(i);var f=o?o.length:0;if(f||(t&=-97,o=u=r),d=d===r?d:yn(ps(d),0),h=h===r?h:ps(h),f-=u?u.length:0,64&t){var m=o,y=u;o=u=r}var g=p?r:no(e),v=[e,t,n,o,u,m,y,l,d,h];if(g&&function(e,t){var n=e[1],r=t[1],i=n|r,o=i<131,s=r==c&&8==n||r==c&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!o&&!s)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var l=e[3];e[3]=l?Ii(l,u,t[4]):u,e[4]=l?an(e[3],a):t[4]}(u=t[5])&&(l=e[5],e[5]=l?Ci(l,u,t[6]):u,e[6]=l?an(e[5],a):t[6]),(u=t[7])&&(e[7]=u),r&c&&(e[8]=null==e[8]?t[8]:gn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(v,g),e=v[0],t=v[1],n=v[2],o=v[3],u=v[4],!(h=v[9]=v[9]===r?p?0:e.length:yn(v[9]-f,0))&&24&t&&(t&=-25),t&&1!=t)b=8==t||16==t?function(e,t,n){var i=Bi(e);return function o(){for(var a=arguments.length,s=re(a),c=a,u=io(o);c--;)s[c]=arguments[c];var l=a<3&&s[0]!==u&&s[a-1]!==u?[]:an(s,u);return(a-=l.length)<n?$i(e,t,Di,o.placeholder,r,s,l,r,r,n-a):Pt(this&&this!==lt&&this instanceof o?i:e,this,s)}}(e,t,h):t!=s&&33!=t||u.length?Di.apply(r,v):function(e,t,n,r){var i=1&t,o=Bi(e);return function t(){for(var a=-1,s=arguments.length,c=-1,u=r.length,l=re(u+s),d=this&&this!==lt&&this instanceof t?o:e;++c<u;)l[c]=r[c];for(;s--;)l[c++]=arguments[++a];return Pt(d,i?n:this,l)}}(e,t,n,o);else var b=function(e,t,n){var r=1&t,i=Bi(e);return function t(){return(this&&this!==lt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,n);return jo((g?Zr:Ao)(b,v),e,t)}function Yi(e,t,n,i){return e===r||Na(e,je[n])&&!ze.call(i,n)?t:e}function Ji(e,t,n,i,o,a){return Qa(e)&&Qa(t)&&(a.set(t,e),Nr(e,t,r,Ji,a),a.delete(t)),e}function Zi(e){return rs(e)?r:e}function Xi(e,t,n,i,o,a){var s=1&n,c=e.length,u=t.length;if(c!=u&&!(s&&u>c))return!1;var l=a.get(e),d=a.get(t);if(l&&d)return l==t&&d==e;var h=-1,p=!0,f=2&n?new Wn:r;for(a.set(e,t),a.set(t,e);++h<c;){var m=e[h],y=t[h];if(i)var g=s?i(y,m,h,t,e,a):i(m,y,h,e,t,a);if(g!==r){if(g)continue;p=!1;break}if(f){if(!Bt(t,function(e,t){if(!Jt(f,t)&&(m===e||o(m,e,n,i,a)))return f.push(t)})){p=!1;break}}else if(m!==y&&!o(m,y,n,i,a)){p=!1;break}}return a.delete(e),a.delete(t),p}function Qi(e){return Eo(Io(e,r,$o),e+"")}function eo(e){return Pr(e,js,uo)}function to(e){return Pr(e,xs,lo)}var no=kn?function(e){return kn.get(e)}:sc;function ro(e){for(var t=e.name+"",n=En[t],r=ze.call(En,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function io(e){return(ze.call(Un,"placeholder")?Un:e).placeholder}function oo(){var e=Un.iteratee||rc;return e=e===rc?zr:e,arguments.length?e(arguments[0],arguments[1]):e}function ao(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function so(e){for(var t=js(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Po(i)]}return t}function co(e,t){var n=function(e,t){return null==e?r:e[t]}(e,t);return Tr(n)?n:r}var uo=mt?function(e){return null==e?[]:(e=Ie(e),At(mt(e),function(t){return We.call(e,t)}))}:fc,lo=mt?function(e){for(var t=[];e;)xt(t,uo(e)),e=$e(e);return t}:fc,ho=Sr;function po(e,t,n){for(var r=-1,i=(t=yi(t,e)).length,o=!1;++r<i;){var a=Mo(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Xa(i)&&yo(a,i)&&(qa(e)||Va(e))}function fo(e){return"function"!=typeof e.constructor||wo(e)?{}:Nn($e(e))}function mo(e){return qa(e)||Va(e)||!!(Ke&&e&&e[Ke])}function yo(e,t){var n=typeof e;return!!(t=null==t?l:t)&&("number"==n||"symbol"!=n&&ye.test(e))&&e>-1&&e%1==0&&e<t}function go(e,t,n){if(!Qa(n))return!1;var r=typeof t;return!!("number"==r?Ha(n)&&yo(t,n.length):"string"==r&&t in n)&&Na(n[t],e)}function vo(e,t){if(qa(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ss(e))||X.test(e)||!Z.test(e)||null!=t&&e in Ie(t)}function bo(e){var t=ro(e),n=Un[t];if("function"!=typeof n||!(t in Vn.prototype))return!1;if(e===n)return!0;var r=no(n);return!!r&&e===r[0]}(Pn&&ho(new Pn(new ArrayBuffer(1)))!=x||Sn&&ho(new Sn)!=w||In&&ho(In.resolve())!=I||Cn&&ho(new Cn)!=O||On&&ho(new On)!=E)&&(ho=function(e){var t=Sr(e),n=t==S?e.constructor:r,i=n?Do(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 t});var _o=xe?Ja:mc;function wo(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||je)}function Po(e){return e==e&&!Qa(e)}function So(e,t){return function(n){return null!=n&&n[e]===t&&(t!==r||e in Ie(n))}}function Io(e,t,n){return t=yn(t===r?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=yn(r.length-t,0),a=re(o);++i<o;)a[i]=r[t+i];i=-1;for(var s=re(t+1);++i<t;)s[i]=r[i];return s[t]=n(a),Pt(e,this,s)}}function Co(e,t){return t.length<2?e:wr(e,ei(t,0,-1))}function Oo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ao=xo(Zr),ko=dt||function(e,t){return lt.setTimeout(e,t)},Eo=xo(Xr);function jo(e,t,n){var r=t+"";return Eo(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return It(p,function(n){var r="_."+n[0];t&n[1]&&!kt(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ae):[]}(r),n)))}function xo(e){var t=0,n=0;return function(){var i=vn(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function To(e,t){var n=-1,i=e.length,o=i-1;for(t=t===r?i:t;++n<t;){var a=Hr(n,o),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var zo,Bo,Fo=(zo=za(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Q,function(e,n,r,i){t.push(r?i.replace(ue,"$1"):n||e)}),t},function(e){return 500===Bo.size&&Bo.clear(),e}),Bo=zo.cache,zo);function Mo(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Do(e){if(null!=e){try{return Te.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Uo(e){if(e instanceof Vn)return e.clone();var t=new Ln(e.__wrapped__,e.__chain__);return t.__actions__=Oi(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var No=Gr(function(e,t){return Wa(e)?ur(e,mr(t,1,Wa,!0)):[]}),Ro=Gr(function(e,t){var n=Yo(t);return Wa(n)&&(n=r),Wa(e)?ur(e,mr(t,1,Wa,!0),oo(n,2)):[]}),Lo=Gr(function(e,t){var n=Yo(t);return Wa(n)&&(n=r),Wa(e)?ur(e,mr(t,1,Wa,!0),r,n):[]});function Vo(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ps(n);return i<0&&(i=yn(r+i,0)),Dt(e,oo(t,3),i)}function qo(e,t,n){var i=null==e?0:e.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)),Dt(e,oo(t,3),o,!0)}function $o(e){return null!=e&&e.length?mr(e,1):[]}function Ho(e){return e&&e.length?e[0]:r}var Wo=Gr(function(e){var t=jt(e,fi);return t.length&&t[0]===e[0]?Ar(t):[]}),Go=Gr(function(e){var t=Yo(e),n=jt(e,fi);return t===Yo(n)?t=r:n.pop(),n.length&&n[0]===e[0]?Ar(n,oo(t,2)):[]}),Ko=Gr(function(e){var t=Yo(e),n=jt(e,fi);return(t="function"==typeof t?t:r)&&n.pop(),n.length&&n[0]===e[0]?Ar(n,r,t):[]});function Yo(e){var t=null==e?0:e.length;return t?e[t-1]:r}var Jo=Gr(Zo);function Zo(e,t){return e&&e.length&&t&&t.length?qr(e,t):e}var Xo=Qi(function(e,t){var n=null==e?0:e.length,r=ir(e,t);return $r(e,jt(t,function(e){return yo(e,n)?+e:e}).sort(Si)),r});function Qo(e){return null==e?e:wn.call(e)}var ea=Gr(function(e){return si(mr(e,1,Wa,!0))}),ta=Gr(function(e){var t=Yo(e);return Wa(t)&&(t=r),si(mr(e,1,Wa,!0),oo(t,2))}),na=Gr(function(e){var t=Yo(e);return t="function"==typeof t?t:r,si(mr(e,1,Wa,!0),r,t)});function ra(e){if(!e||!e.length)return[];var t=0;return e=At(e,function(e){if(Wa(e))return t=yn(e.length,t),!0}),Wt(t,function(t){return jt(e,Vt(t))})}function ia(e,t){if(!e||!e.length)return[];var n=ra(e);return null==t?n:jt(n,function(e){return Pt(t,r,e)})}var oa=Gr(function(e,t){return Wa(e)?ur(e,t):[]}),aa=Gr(function(e){return hi(At(e,Wa))}),sa=Gr(function(e){var t=Yo(e);return Wa(t)&&(t=r),hi(At(e,Wa),oo(t,2))}),ca=Gr(function(e){var t=Yo(e);return t="function"==typeof t?t:r,hi(At(e,Wa),r,t)}),ua=Gr(ra),la=Gr(function(e){var t=e.length,n=t>1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,ia(e,n)});function da(e){var t=Un(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var pa=Qi(function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Vn&&yo(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:r}),new Ln(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(o)}),fa=ki(function(e,t,n){ze.call(e,n)?++e[n]:rr(e,n,1)}),ma=Fi(Vo),ya=Fi(qo);function ga(e,t){return(qa(e)?It:lr)(e,oo(t,3))}function va(e,t){return(qa(e)?Ct:dr)(e,oo(t,3))}var ba=ki(function(e,t,n){ze.call(e,n)?e[n].push(t):rr(e,n,[t])}),_a=Gr(function(e,t,n){var r=-1,i="function"==typeof t,o=Ha(e)?re(e.length):[];return lr(e,function(e){o[++r]=i?Pt(t,e,n):kr(e,t,n)}),o}),wa=ki(function(e,t,n){rr(e,n,t)});function Pa(e,t){return(qa(e)?jt:Mr)(e,oo(t,3))}var Sa=ki(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Ia=Gr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&go(e,t[0],t[1])?t=[]:n>2&&go(t[0],t[1],t[2])&&(t=[t[0]]),Lr(e,mr(t,1),[])}),Ca=ut||function(){return lt.Date.now()};function Oa(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Ki(e,c,r,r,r,r,t)}function Aa(e,t){var n;if("function"!=typeof t)throw new Ae(i);return e=ps(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var ka=Gr(function(e,t,n){var r=1;if(n.length){var i=an(n,io(ka));r|=s}return Ki(e,r,t,n,i)}),Ea=Gr(function(e,t,n){var r=3;if(n.length){var i=an(n,io(Ea));r|=s}return Ki(t,r,e,n,i)});function ja(e,t,n){var o,a,s,c,u,l,d=0,h=!1,p=!1,f=!0;if("function"!=typeof e)throw new Ae(i);function m(t){var n=o,i=a;return o=a=r,d=t,c=e.apply(i,n)}function y(e){var n=e-l;return l===r||n>=t||n<0||p&&e-d>=s}function g(){var e=Ca();if(y(e))return v(e);u=ko(g,function(e){var n=t-(e-l);return p?gn(n,s-(e-d)):n}(e))}function v(e){return u=r,f&&o?m(e):(o=a=r,c)}function b(){var e=Ca(),n=y(e);if(o=arguments,a=this,l=e,n){if(u===r)return function(e){return d=e,u=ko(g,t),h?m(e):c}(l);if(p)return bi(u),u=ko(g,t),m(l)}return u===r&&(u=ko(g,t)),c}return t=ms(t)||0,Qa(n)&&(h=!!n.leading,s=(p="maxWait"in n)?yn(ms(n.maxWait)||0,t):s,f="trailing"in n?!!n.trailing:f),b.cancel=function(){u!==r&&bi(u),d=0,o=l=a=u=r},b.flush=function(){return u===r?c:v(Ca())},b}var xa=Gr(function(e,t){return cr(e,1,t)}),Ta=Gr(function(e,t,n){return cr(e,ms(t)||0,n)});function za(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Ae(i);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(za.Cache||Hn),n}function Ba(e){if("function"!=typeof e)throw new Ae(i);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}za.Cache=Hn;var Fa=gi(function(e,t){var n=(t=1==t.length&&qa(t[0])?jt(t[0],Kt(oo())):jt(mr(t,1),Kt(oo()))).length;return Gr(function(r){for(var i=-1,o=gn(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return Pt(e,this,r)})}),Ma=Gr(function(e,t){var n=an(t,io(Ma));return Ki(e,s,r,t,n)}),Da=Gr(function(e,t){var n=an(t,io(Da));return Ki(e,64,r,t,n)}),Ua=Qi(function(e,t){return Ki(e,256,r,r,r,t)});function Na(e,t){return e===t||e!=e&&t!=t}var Ra=qi(Ir),La=qi(function(e,t){return e>=t}),Va=Er(function(){return arguments}())?Er:function(e){return es(e)&&ze.call(e,"callee")&&!We.call(e,"callee")},qa=re.isArray,$a=yt?Kt(yt):function(e){return es(e)&&Sr(e)==j};function Ha(e){return null!=e&&Xa(e.length)&&!Ja(e)}function Wa(e){return es(e)&&Ha(e)}var Ga=Ft||mc,Ka=gt?Kt(gt):function(e){return es(e)&&Sr(e)==g};function Ya(e){if(!es(e))return!1;var t=Sr(e);return t==v||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Ja(e){if(!Qa(e))return!1;var t=Sr(e);return t==b||t==_||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==ps(e)}function Xa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=l}function Qa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=vt?Kt(vt):function(e){return es(e)&&ho(e)==w};function ns(e){return"number"==typeof e||es(e)&&Sr(e)==P}function rs(e){if(!es(e)||Sr(e)!=S)return!1;var t=$e(e);if(null===t)return!0;var n=ze.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Te.call(n)==De}var is=bt?Kt(bt):function(e){return es(e)&&Sr(e)==C},os=_t?Kt(_t):function(e){return es(e)&&ho(e)==O};function as(e){return"string"==typeof e||!qa(e)&&es(e)&&Sr(e)==A}function ss(e){return"symbol"==typeof e||es(e)&&Sr(e)==k}var cs=wt?Kt(wt):function(e){return es(e)&&Xa(e.length)&&!!rt[Sr(e)]},us=qi(Fr),ls=qi(function(e,t){return e<=t});function ds(e){if(!e)return[];if(Ha(e))return as(e)?ln(e):Oi(e);if(Ze&&e[Ze])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Ze]());var t=ho(e);return(t==w?rn:t==O?sn:Ns)(e)}function hs(e){return e?(e=ms(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ps(e){var t=hs(e),n=t%1;return t==t?n?t-n:t:0}function fs(e){return e?or(ps(e),0,h):0}function ms(e){if("number"==typeof e)return e;if(ss(e))return d;if(Qa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Qa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Gt(e);var n=pe.test(e);return n||me.test(e)?st(e.slice(2),n?2:8):he.test(e)?d:+e}function ys(e){return Ai(e,xs(e))}function gs(e){return null==e?"":ai(e)}var vs=Ei(function(e,t){if(wo(t)||Ha(t))Ai(t,js(t),e);else for(var n in t)ze.call(t,n)&&Qn(e,n,t[n])}),bs=Ei(function(e,t){Ai(t,xs(t),e)}),_s=Ei(function(e,t,n,r){Ai(t,xs(t),e,r)}),ws=Ei(function(e,t,n,r){Ai(t,js(t),e,r)}),Ps=Qi(ir),Ss=Gr(function(e,t){e=Ie(e);var n=-1,i=t.length,o=i>2?t[2]:r;for(o&&go(t[0],t[1],o)&&(i=1);++n<i;)for(var a=t[n],s=xs(a),c=-1,u=s.length;++c<u;){var l=s[c],d=e[l];(d===r||Na(d,je[l])&&!ze.call(e,l))&&(e[l]=a[l])}return e}),Is=Gr(function(e){return e.push(r,Ji),Pt(zs,r,e)});function Cs(e,t,n){var i=null==e?r:wr(e,t);return i===r?n:i}function Os(e,t){return null!=e&&po(e,t,Or)}var As=Ui(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Me.call(t)),e[t]=n},Qs(nc)),ks=Ui(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Me.call(t)),ze.call(e,t)?e[t].push(n):e[t]=[n]},oo),Es=Gr(kr);function js(e){return Ha(e)?Kn(e):Br(e)}function xs(e){return Ha(e)?Kn(e,!0):function(e){if(!Qa(e))return function(e){var t=[];if(null!=e)for(var n in Ie(e))t.push(n);return t}(e);var t=wo(e),n=[];for(var r in e)("constructor"!=r||!t&&ze.call(e,r))&&n.push(r);return n}(e)}var Ts=Ei(function(e,t,n){Nr(e,t,n)}),zs=Ei(function(e,t,n,r){Nr(e,t,n,r)}),Bs=Qi(function(e,t){var n={};if(null==e)return n;var r=!1;t=jt(t,function(t){return t=yi(t,e),r||(r=t.length>1),t}),Ai(e,to(e),n),r&&(n=ar(n,7,Zi));for(var i=t.length;i--;)ci(n,t[i]);return n}),Fs=Qi(function(e,t){return null==e?{}:function(e,t){return Vr(e,t,function(t,n){return Os(e,n)})}(e,t)});function Ms(e,t){if(null==e)return{};var n=jt(to(e),function(e){return[e]});return t=oo(t),Vr(e,n,function(e,n){return t(e,n[0])})}var Ds=Gi(js),Us=Gi(xs);function Ns(e){return null==e?[]:Yt(e,js(e))}var Rs=zi(function(e,t,n){return t=t.toLowerCase(),e+(n?Ls(t):t)});function Ls(e){return Ys(gs(e).toLowerCase())}function Vs(e){return(e=gs(e))&&e.replace(ge,Qt).replace(Je,"")}var qs=zi(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),$s=zi(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Hs=Ti("toLowerCase"),Ws=zi(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Gs=zi(function(e,t,n){return e+(n?" ":"")+Ys(t)}),Ks=zi(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ys=Ti("toUpperCase");function Js(e,t,n){return e=gs(e),(t=n?r:t)===r?function(e){return et.test(e)}(e)?function(e){return e.match(Xe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zs=Gr(function(e,t){try{return Pt(e,r,t)}catch(e){return Ya(e)?e:new we(e)}}),Xs=Qi(function(e,t){return It(t,function(t){t=Mo(t),rr(e,t,ka(e[t],e))}),e});function Qs(e){return function(){return e}}var ec=Mi(),tc=Mi(!0);function nc(e){return e}function rc(e){return zr("function"==typeof e?e:ar(e,1))}var ic=Gr(function(e,t){return function(n){return kr(n,e,t)}}),oc=Gr(function(e,t){return function(n){return kr(e,n,t)}});function ac(e,t,n){var r=js(t),i=_r(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=_r(t,js(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Ja(e);return It(i,function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__);return(n.__actions__=Oi(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,xt([this.value()],arguments))})}),e}function sc(){}var cc=Ri(jt),uc=Ri(Ot),lc=Ri(Bt);function dc(e){return vo(e)?Vt(Mo(e)):function(e){return function(t){return wr(t,e)}}(e)}var hc=Vi(),pc=Vi(!0);function fc(){return[]}function mc(){return!1}var yc,gc=Ni(function(e,t){return e+t},0),vc=Hi("ceil"),bc=Ni(function(e,t){return e/t},1),_c=Hi("floor"),wc=Ni(function(e,t){return e*t},1),Pc=Hi("round"),Sc=Ni(function(e,t){return e-t},0);return Un.after=function(e,t){if("function"!=typeof t)throw new Ae(i);return e=ps(e),function(){if(--e<1)return t.apply(this,arguments)}},Un.ary=Oa,Un.assign=vs,Un.assignIn=bs,Un.assignInWith=_s,Un.assignWith=ws,Un.at=Ps,Un.before=Aa,Un.bind=ka,Un.bindAll=Xs,Un.bindKey=Ea,Un.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return qa(e)?e:[e]},Un.chain=da,Un.chunk=function(e,t,n){t=(n?go(e,t,n):t===r)?1:yn(ps(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=re(ht(i/t));o<i;)s[a++]=ei(e,o,o+=t);return s},Un.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i},Un.concat=function(){var e=arguments.length;if(!e)return[];for(var t=re(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return xt(qa(n)?Oi(n):[n],mr(t,1))},Un.cond=function(e){var t=null==e?0:e.length,n=oo();return e=t?jt(e,function(e){if("function"!=typeof e[1])throw new Ae(i);return[n(e[0]),e[1]]}):[],Gr(function(n){for(var r=-1;++r<t;){var i=e[r];if(Pt(i[0],this,n))return Pt(i[1],this,n)}})},Un.conforms=function(e){return function(e){var t=js(e);return function(n){return sr(n,e,t)}}(ar(e,1))},Un.constant=Qs,Un.countBy=fa,Un.create=function(e,t){var n=Nn(e);return null==t?n:nr(n,t)},Un.curry=function e(t,n,i){var o=Ki(t,8,r,r,r,r,r,n=i?r:n);return o.placeholder=e.placeholder,o},Un.curryRight=function e(t,n,i){var o=Ki(t,16,r,r,r,r,r,n=i?r:n);return o.placeholder=e.placeholder,o},Un.debounce=ja,Un.defaults=Ss,Un.defaultsDeep=Is,Un.defer=xa,Un.delay=Ta,Un.difference=No,Un.differenceBy=Ro,Un.differenceWith=Lo,Un.drop=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,(t=n||t===r?1:ps(t))<0?0:t,i):[]},Un.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,0,(t=i-(t=n||t===r?1:ps(t)))<0?0:t):[]},Un.dropRightWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!0,!0):[]},Un.dropWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!0):[]},Un.fill=function(e,t,n,i){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&go(e,t,n)&&(n=0,i=o),function(e,t,n,i){var o=e.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;)e[n++]=t;return e}(e,t,n,i)):[]},Un.filter=function(e,t){return(qa(e)?At:fr)(e,oo(t,3))},Un.flatMap=function(e,t){return mr(Pa(e,t),1)},Un.flatMapDeep=function(e,t){return mr(Pa(e,t),u)},Un.flatMapDepth=function(e,t,n){return n=n===r?1:ps(n),mr(Pa(e,t),n)},Un.flatten=$o,Un.flattenDeep=function(e){return null!=e&&e.length?mr(e,u):[]},Un.flattenDepth=function(e,t){return null!=e&&e.length?mr(e,t=t===r?1:ps(t)):[]},Un.flip=function(e){return Ki(e,512)},Un.flow=ec,Un.flowRight=tc,Un.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Un.functions=function(e){return null==e?[]:_r(e,js(e))},Un.functionsIn=function(e){return null==e?[]:_r(e,xs(e))},Un.groupBy=ba,Un.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Un.intersection=Wo,Un.intersectionBy=Go,Un.intersectionWith=Ko,Un.invert=As,Un.invertBy=ks,Un.invokeMap=_a,Un.iteratee=rc,Un.keyBy=wa,Un.keys=js,Un.keysIn=xs,Un.map=Pa,Un.mapKeys=function(e,t){var n={};return t=oo(t,3),vr(e,function(e,r,i){rr(n,t(e,r,i),e)}),n},Un.mapValues=function(e,t){var n={};return t=oo(t,3),vr(e,function(e,r,i){rr(n,r,t(e,r,i))}),n},Un.matches=function(e){return Dr(ar(e,1))},Un.matchesProperty=function(e,t){return Ur(e,ar(t,1))},Un.memoize=za,Un.merge=Ts,Un.mergeWith=zs,Un.method=ic,Un.methodOf=oc,Un.mixin=ac,Un.negate=Ba,Un.nthArg=function(e){return e=ps(e),Gr(function(t){return Rr(t,e)})},Un.omit=Bs,Un.omitBy=function(e,t){return Ms(e,Ba(oo(t)))},Un.once=function(e){return Aa(2,e)},Un.orderBy=function(e,t,n,i){return null==e?[]:(qa(t)||(t=null==t?[]:[t]),qa(n=i?r:n)||(n=null==n?[]:[n]),Lr(e,t,n))},Un.over=cc,Un.overArgs=Fa,Un.overEvery=uc,Un.overSome=lc,Un.partial=Ma,Un.partialRight=Da,Un.partition=Sa,Un.pick=Fs,Un.pickBy=Ms,Un.property=dc,Un.propertyOf=function(e){return function(t){return null==e?r:wr(e,t)}},Un.pull=Jo,Un.pullAll=Zo,Un.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?qr(e,t,oo(n,2)):e},Un.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?qr(e,t,r,n):e},Un.pullAt=Xo,Un.range=hc,Un.rangeRight=pc,Un.rearg=Ua,Un.reject=function(e,t){return(qa(e)?At:fr)(e,Ba(oo(t,3)))},Un.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=oo(t,3);++r<o;){var a=e[r];t(a,r,e)&&(n.push(a),i.push(r))}return $r(e,i),n},Un.rest=function(e,t){if("function"!=typeof e)throw new Ae(i);return Gr(e,t=t===r?t:ps(t))},Un.reverse=Qo,Un.sampleSize=function(e,t,n){return t=(n?go(e,t,n):t===r)?1:ps(t),(qa(e)?Jn:Yr)(e,t)},Un.set=function(e,t,n){return null==e?e:Jr(e,t,n)},Un.setWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Jr(e,t,n,i)},Un.shuffle=function(e){return(qa(e)?Zn:Qr)(e)},Un.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&go(e,t,n)?(t=0,n=i):(t=null==t?0:ps(t),n=n===r?i:ps(n)),ei(e,t,n)):[]},Un.sortBy=Ia,Un.sortedUniq=function(e){return e&&e.length?ii(e):[]},Un.sortedUniqBy=function(e,t){return e&&e.length?ii(e,oo(t,2)):[]},Un.split=function(e,t,n){return n&&"number"!=typeof n&&go(e,t,n)&&(t=n=r),(n=n===r?h:n>>>0)?(e=gs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=ai(t))&&nn(e)?vi(ln(e),0,n):e.split(t,n):[]},Un.spread=function(e,t){if("function"!=typeof e)throw new Ae(i);return t=null==t?0:yn(ps(t),0),Gr(function(n){var r=n[t],i=vi(n,0,t);return r&&xt(i,r),Pt(e,this,i)})},Un.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Un.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===r?1:ps(t))<0?0:t):[]},Un.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,(t=i-(t=n||t===r?1:ps(t)))<0?0:t,i):[]},Un.takeRightWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!1,!0):[]},Un.takeWhile=function(e,t){return e&&e.length?li(e,oo(t,3)):[]},Un.tap=function(e,t){return t(e),e},Un.throttle=function(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new Ae(i);return Qa(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),ja(e,t,{leading:r,maxWait:t,trailing:o})},Un.thru=ha,Un.toArray=ds,Un.toPairs=Ds,Un.toPairsIn=Us,Un.toPath=function(e){return qa(e)?jt(e,Mo):ss(e)?[e]:Oi(Fo(gs(e)))},Un.toPlainObject=ys,Un.transform=function(e,t,n){var r=qa(e),i=r||Ga(e)||cs(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Ja(o)?Nn($e(e)):{}}return(i?It:vr)(e,function(e,r,i){return t(n,e,r,i)}),n},Un.unary=function(e){return Oa(e,1)},Un.union=ea,Un.unionBy=ta,Un.unionWith=na,Un.uniq=function(e){return e&&e.length?si(e):[]},Un.uniqBy=function(e,t){return e&&e.length?si(e,oo(t,2)):[]},Un.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?si(e,r,t):[]},Un.unset=function(e,t){return null==e||ci(e,t)},Un.unzip=ra,Un.unzipWith=ia,Un.update=function(e,t,n){return null==e?e:ui(e,t,mi(n))},Un.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:ui(e,t,mi(n),i)},Un.values=Ns,Un.valuesIn=function(e){return null==e?[]:Yt(e,xs(e))},Un.without=oa,Un.words=Js,Un.wrap=function(e,t){return Ma(mi(t),e)},Un.xor=aa,Un.xorBy=sa,Un.xorWith=ca,Un.zip=ua,Un.zipObject=function(e,t){return pi(e||[],t||[],Qn)},Un.zipObjectDeep=function(e,t){return pi(e||[],t||[],Jr)},Un.zipWith=la,Un.entries=Ds,Un.entriesIn=Us,Un.extend=bs,Un.extendWith=_s,ac(Un,Un),Un.add=gc,Un.attempt=Zs,Un.camelCase=Rs,Un.capitalize=Ls,Un.ceil=vc,Un.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=ms(n))==n?n:0),t!==r&&(t=(t=ms(t))==t?t:0),or(ms(e),t,n)},Un.clone=function(e){return ar(e,4)},Un.cloneDeep=function(e){return ar(e,5)},Un.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:r)},Un.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:r)},Un.conformsTo=function(e,t){return null==t||sr(e,t,js(t))},Un.deburr=Vs,Un.defaultTo=function(e,t){return null==e||e!=e?t:e},Un.divide=bc,Un.endsWith=function(e,t,n){e=gs(e),t=ai(t);var i=e.length,o=n=n===r?i:or(ps(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},Un.eq=Na,Un.escape=function(e){return(e=gs(e))&&G.test(e)?e.replace(H,en):e},Un.escapeRegExp=function(e){return(e=gs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Un.every=function(e,t,n){var i=qa(e)?Ot:hr;return n&&go(e,t,n)&&(t=r),i(e,oo(t,3))},Un.find=ma,Un.findIndex=Vo,Un.findKey=function(e,t){return Mt(e,oo(t,3),vr)},Un.findLast=ya,Un.findLastIndex=qo,Un.findLastKey=function(e,t){return Mt(e,oo(t,3),br)},Un.floor=_c,Un.forEach=ga,Un.forEachRight=va,Un.forIn=function(e,t){return null==e?e:yr(e,oo(t,3),xs)},Un.forInRight=function(e,t){return null==e?e:gr(e,oo(t,3),xs)},Un.forOwn=function(e,t){return e&&vr(e,oo(t,3))},Un.forOwnRight=function(e,t){return e&&br(e,oo(t,3))},Un.get=Cs,Un.gt=Ra,Un.gte=La,Un.has=function(e,t){return null!=e&&po(e,t,Cr)},Un.hasIn=Os,Un.head=Ho,Un.identity=nc,Un.includes=function(e,t,n,r){e=Ha(e)?e:Ns(e),n=n&&!r?ps(n):0;var i=e.length;return n<0&&(n=yn(i+n,0)),as(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ut(e,t,n)>-1},Un.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ps(n);return i<0&&(i=yn(r+i,0)),Ut(e,t,i)},Un.inRange=function(e,t,n){return t=hs(t),n===r?(n=t,t=0):n=hs(n),function(e,t,n){return e>=gn(t,n)&&e<yn(t,n)}(e=ms(e),t,n)},Un.invoke=Es,Un.isArguments=Va,Un.isArray=qa,Un.isArrayBuffer=$a,Un.isArrayLike=Ha,Un.isArrayLikeObject=Wa,Un.isBoolean=function(e){return!0===e||!1===e||es(e)&&Sr(e)==y},Un.isBuffer=Ga,Un.isDate=Ka,Un.isElement=function(e){return es(e)&&1===e.nodeType&&!rs(e)},Un.isEmpty=function(e){if(null==e)return!0;if(Ha(e)&&(qa(e)||"string"==typeof e||"function"==typeof e.splice||Ga(e)||cs(e)||Va(e)))return!e.length;var t=ho(e);if(t==w||t==O)return!e.size;if(wo(e))return!Br(e).length;for(var n in e)if(ze.call(e,n))return!1;return!0},Un.isEqual=function(e,t){return jr(e,t)},Un.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:r)?n(e,t):r;return i===r?jr(e,t,r,n):!!i},Un.isError=Ya,Un.isFinite=function(e){return"number"==typeof e&&qt(e)},Un.isFunction=Ja,Un.isInteger=Za,Un.isLength=Xa,Un.isMap=ts,Un.isMatch=function(e,t){return e===t||xr(e,t,so(t))},Un.isMatchWith=function(e,t,n){return n="function"==typeof n?n:r,xr(e,t,so(t),n)},Un.isNaN=function(e){return ns(e)&&e!=+e},Un.isNative=function(e){if(_o(e))throw new we("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Tr(e)},Un.isNil=function(e){return null==e},Un.isNull=function(e){return null===e},Un.isNumber=ns,Un.isObject=Qa,Un.isObjectLike=es,Un.isPlainObject=rs,Un.isRegExp=is,Un.isSafeInteger=function(e){return Za(e)&&e>=-9007199254740991&&e<=l},Un.isSet=os,Un.isString=as,Un.isSymbol=ss,Un.isTypedArray=cs,Un.isUndefined=function(e){return e===r},Un.isWeakMap=function(e){return es(e)&&ho(e)==E},Un.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Sr(e)},Un.join=function(e,t){return null==e?"":fn.call(e,t)},Un.kebabCase=qs,Un.last=Yo,Un.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=ps(n))<0?yn(i+o,0):gn(o,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Dt(e,Rt,o,!0)},Un.lowerCase=$s,Un.lowerFirst=Hs,Un.lt=us,Un.lte=ls,Un.max=function(e){return e&&e.length?pr(e,nc,Ir):r},Un.maxBy=function(e,t){return e&&e.length?pr(e,oo(t,2),Ir):r},Un.mean=function(e){return Lt(e,nc)},Un.meanBy=function(e,t){return Lt(e,oo(t,2))},Un.min=function(e){return e&&e.length?pr(e,nc,Fr):r},Un.minBy=function(e,t){return e&&e.length?pr(e,oo(t,2),Fr):r},Un.stubArray=fc,Un.stubFalse=mc,Un.stubObject=function(){return{}},Un.stubString=function(){return""},Un.stubTrue=function(){return!0},Un.multiply=wc,Un.nth=function(e,t){return e&&e.length?Rr(e,ps(t)):r},Un.noConflict=function(){return lt._===this&&(lt._=Ue),this},Un.noop=sc,Un.now=Ca,Un.pad=function(e,t,n){e=gs(e);var r=(t=ps(t))?un(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Li(ft(i),n)+e+Li(ht(i),n)},Un.padEnd=function(e,t,n){e=gs(e);var r=(t=ps(t))?un(e):0;return t&&r<t?e+Li(t-r,n):e},Un.padStart=function(e,t,n){e=gs(e);var r=(t=ps(t))?un(e):0;return t&&r<t?Li(t-r,n)+e:e},Un.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),bn(gs(e).replace(ne,""),t||0)},Un.random=function(e,t,n){if(n&&"boolean"!=typeof n&&go(e,t,n)&&(t=n=r),n===r&&("boolean"==typeof t?(n=t,t=r):"boolean"==typeof e&&(n=e,e=r)),e===r&&t===r?(e=0,t=1):(e=hs(e),t===r?(t=e,e=0):t=hs(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var o=_n();return gn(e+o*(t-e+at("1e-"+((o+"").length-1))),t)}return Hr(e,t)},Un.reduce=function(e,t,n){var r=qa(e)?Tt:$t,i=arguments.length<3;return r(e,oo(t,4),n,i,lr)},Un.reduceRight=function(e,t,n){var r=qa(e)?zt:$t,i=arguments.length<3;return r(e,oo(t,4),n,i,dr)},Un.repeat=function(e,t,n){return t=(n?go(e,t,n):t===r)?1:ps(t),Wr(gs(e),t)},Un.replace=function(){var e=arguments,t=gs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Un.result=function(e,t,n){var i=-1,o=(t=yi(t,e)).length;for(o||(o=1,e=r);++i<o;){var a=null==e?r:e[Mo(t[i])];a===r&&(i=o,a=n),e=Ja(a)?a.call(e):a}return e},Un.round=Pc,Un.runInContext=e,Un.sample=function(e){return(qa(e)?Yn:Kr)(e)},Un.size=function(e){if(null==e)return 0;if(Ha(e))return as(e)?un(e):e.length;var t=ho(e);return t==w||t==O?e.size:Br(e).length},Un.snakeCase=Ws,Un.some=function(e,t,n){var i=qa(e)?Bt:ti;return n&&go(e,t,n)&&(t=r),i(e,oo(t,3))},Un.sortedIndex=function(e,t){return ni(e,t)},Un.sortedIndexBy=function(e,t,n){return ri(e,t,oo(n,2))},Un.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ni(e,t);if(r<n&&Na(e[r],t))return r}return-1},Un.sortedLastIndex=function(e,t){return ni(e,t,!0)},Un.sortedLastIndexBy=function(e,t,n){return ri(e,t,oo(n,2),!0)},Un.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ni(e,t,!0)-1;if(Na(e[n],t))return n}return-1},Un.startCase=Gs,Un.startsWith=function(e,t,n){return e=gs(e),n=null==n?0:or(ps(n),0,e.length),t=ai(t),e.slice(n,n+t.length)==t},Un.subtract=Sc,Un.sum=function(e){return e&&e.length?Ht(e,nc):0},Un.sumBy=function(e,t){return e&&e.length?Ht(e,oo(t,2)):0},Un.template=function(e,t,n){var i=Un.templateSettings;n&&go(e,t,n)&&(t=r),e=gs(e),t=_s({},t,i,Yi);var o,a,s=_s({},t.imports,i.imports,Yi),c=js(s),u=Yt(s,c),l=0,d=t.interpolate||ve,h="__p += '",p=Ce((t.escape||ve).source+"|"+d.source+"|"+(d===J?le:ve).source+"|"+(t.evaluate||ve).source+"|$","g"),f="//# sourceURL="+(ze.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++nt+"]")+"\n";e.replace(p,function(t,n,r,i,s,c){return r||(r=i),h+=e.slice(l,c).replace(be,tn),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=c+t.length,t}),h+="';\n";var m=ze.call(t,"variable")&&t.variable;if(m){if(ce.test(m))throw new we("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 Pe(c,f+"return "+h).apply(r,u)});if(y.source=h,Ya(y))throw y;return y},Un.times=function(e,t){if((e=ps(e))<1||e>l)return[];var n=h,r=gn(e,h);t=oo(t),e-=h;for(var i=Wt(r,t);++n<e;)t(n);return i},Un.toFinite=hs,Un.toInteger=ps,Un.toLength=fs,Un.toLower=function(e){return gs(e).toLowerCase()},Un.toNumber=ms,Un.toSafeInteger=function(e){return e?or(ps(e),-9007199254740991,l):0===e?e:0},Un.toString=gs,Un.toUpper=function(e){return gs(e).toUpperCase()},Un.trim=function(e,t,n){if((e=gs(e))&&(n||t===r))return Gt(e);if(!e||!(t=ai(t)))return e;var i=ln(e),o=ln(t);return vi(i,Zt(i,o),Xt(i,o)+1).join("")},Un.trimEnd=function(e,t,n){if((e=gs(e))&&(n||t===r))return e.slice(0,dn(e)+1);if(!e||!(t=ai(t)))return e;var i=ln(e);return vi(i,0,Xt(i,ln(t))+1).join("")},Un.trimStart=function(e,t,n){if((e=gs(e))&&(n||t===r))return e.replace(ne,"");if(!e||!(t=ai(t)))return e;var i=ln(e);return vi(i,Zt(i,ln(t))).join("")},Un.truncate=function(e,t){var n=30,i="...";if(Qa(t)){var o="separator"in t?t.separator:o;n="length"in t?ps(t.length):n,i="omission"in t?ai(t.omission):i}var a=(e=gs(e)).length;if(nn(e)){var s=ln(e);a=s.length}if(n>=a)return e;var c=n-un(i);if(c<1)return i;var u=s?vi(s,0,c).join(""):e.slice(0,c);if(o===r)return u+i;if(s&&(c+=u.length-c),is(o)){if(e.slice(c).search(o)){var l,d=u;for(o.global||(o=Ce(o.source,gs(de.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var h=l.index;u=u.slice(0,h===r?c:h)}}else if(e.indexOf(ai(o),c)!=c){var p=u.lastIndexOf(o);p>-1&&(u=u.slice(0,p))}return u+i},Un.unescape=function(e){return(e=gs(e))&&W.test(e)?e.replace($,hn):e},Un.uniqueId=function(e){var t=++Be;return gs(e)+t},Un.upperCase=Ks,Un.upperFirst=Ys,Un.each=ga,Un.eachRight=va,Un.first=Ho,ac(Un,(yc={},vr(Un,function(e,t){ze.call(Un.prototype,t)||(yc[t]=e)}),yc),{chain:!1}),Un.VERSION="4.17.21",It(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Un[e].placeholder=Un}),It(["drop","take"],function(e,t){Vn.prototype[e]=function(n){n=n===r?1:yn(ps(n),0);var i=this.__filtered__&&!t?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=gn(n,i.__takeCount__):i.__views__.push({size:gn(n,h),type:e+(i.__dir__<0?"Right":"")}),i},Vn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),It(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;Vn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oo(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),It(["head","last"],function(e,t){var n="take"+(t?"Right":"");Vn.prototype[e]=function(){return this[n](1).value()[0]}}),It(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Vn.prototype[e]=function(){return this.__filtered__?new Vn(this):this[n](1)}}),Vn.prototype.compact=function(){return this.filter(nc)},Vn.prototype.find=function(e){return this.filter(e).head()},Vn.prototype.findLast=function(e){return this.reverse().find(e)},Vn.prototype.invokeMap=Gr(function(e,t){return"function"==typeof e?new Vn(this):this.map(function(n){return kr(n,e,t)})}),Vn.prototype.reject=function(e){return this.filter(Ba(oo(e)))},Vn.prototype.slice=function(e,t){e=ps(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Vn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=ps(t))<0?n.dropRight(-t):n.take(t-e)),n)},Vn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vn.prototype.toArray=function(){return this.take(h)},vr(Vn.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Un[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Un.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof Vn,u=s[0],l=c||qa(t),d=function(e){var t=o.apply(Un,xt([e],s));return i&&h?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var h=this.__chain__,p=!!this.__actions__.length,f=a&&!h,m=c&&!p;if(!a&&l){t=m?t:new Vn(this);var y=e.apply(t,s);return y.__actions__.push({func:ha,args:[d],thisArg:r}),new Ln(y,h)}return f&&m?e.apply(this,s):(y=this.thru(d),f?i?y.value()[0]:y.value():y)})}),It(["pop","push","shift","sort","splice","unshift"],function(e){var t=ke[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Un.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(qa(i)?i:[],e)}return this[n](function(n){return t.apply(qa(n)?n:[],e)})}}),vr(Vn.prototype,function(e,t){var n=Un[t];if(n){var r=n.name+"";ze.call(En,r)||(En[r]=[]),En[r].push({name:t,func:n})}}),En[Di(r,2).name]=[{name:"wrapper",func:r}],Vn.prototype.clone=function(){var e=new Vn(this.__wrapped__);return e.__actions__=Oi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Oi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Oi(this.__views__),e},Vn.prototype.reverse=function(){if(this.__filtered__){var e=new Vn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=qa(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=gn(t,e+a);break;case"takeRight":e=yn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,c=s-a,u=r?s:a-1,l=this.__iteratees__,d=l.length,h=0,p=gn(c,this.__takeCount__);if(!n||!r&&i==c&&p==c)return di(e,this.__actions__);var f=[];e:for(;c--&&h<p;){for(var m=-1,y=e[u+=t];++m<d;){var g=l[m],v=g.iteratee,b=g.type,_=v(y);if(2==b)y=_;else if(!_){if(1==b)continue e;break e}}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 e=this.__index__>=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},Un.prototype.plant=function(e){for(var t,n=this;n instanceof Rn;){var i=Uo(n);i.__index__=0,i.__values__=r,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},Un.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vn){var t=e;return this.__actions__.length&&(t=new Vn(this)),(t=t.reverse()).__actions__.push({func:ha,args:[Qo],thisArg:r}),new Ln(t,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,Ze&&(Un.prototype[Ze]=function(){return this}),Un}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(lt._=pn,define(function(){return pn})):ht?((ht.exports=pn)._=pn,dt._=pn):lt._=pn}.call(this)},9722:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(4043),i=n(5477),o=n(7995);t.default=function(){return new o.default(new i.default,r.createRequestSender())}},9783:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.joinPaths=t.isAbsoluteUrl=void 0,t.isAbsoluteUrl=function(e){return/^https?:\/\//.test(e)},t.joinPaths=function(e,t){return"".concat((n=e,n.replace(/\/$/,"")),"/").concat(function(e){return e.replace(/^\//,"")}(t));var n}},9828:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e.prototype.build=function(e,t,n){var r=this,i=document.createElement("form");return i.style.display="none",i.setAttribute("action",e),i.setAttribute("method","POST"),i.setAttribute("target",n||"_top"),Object.keys(t).forEach(function(e){var n=t[e];i.appendChild(r._createInput(n,e))}),i},e.prototype._createInput=function(e,t){var n=document.createElement("input");return n.setAttribute("name",t),n.setAttribute("type","hidden"),n.setAttribute("value",e),n},e}();t.default=n}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";n.r(r),n.d(r,{createBigCommercePaymentsAlternativeMethodsButtonStrategy:()=>lt,createBigCommercePaymentsAlternativeMethodsPaymentStrategy:()=>Ue,createBigCommercePaymentsButtonStrategy:()=>it,createBigCommercePaymentsCreditCardsPaymentStrategy:()=>Fe,createBigCommercePaymentsCustomerStrategy:()=>We,createBigCommercePaymentsFastlaneCustomerStrategy:()=>Ye,createBigCommercePaymentsFastlanePaymentStrategy:()=>ye,createBigCommercePaymentsPayLaterButtonStrategy:()=>st,createBigCommercePaymentsPayLaterCustomerStrategy:()=>Xe,createBigCommercePaymentsPayLaterPaymentStrategy:()=>_e,createBigCommercePaymentsPaymentStrategy:()=>J,createBigCommercePaymentsRatePayPayPaymentStrategy:()=>Ie,createBigCommercePaymentsRedirectAlternativeMethodsPaymentStrategy:()=>Re,createBigCommercePaymentsVenmoButtonStrategy:()=>pt,createBigCommercePaymentsVenmoCustomerStrategy:()=>tt,createBigCommercePaymentsVenmoPaymentStrategy:()=>qe});var e,t=n(315);class i extends Error{constructor(e){var t;super(e||"An unexpected error has occurred."),this.name="StandardError",this.type="standard",t=new.target.prototype,Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,new.target):this.stack=new Error(this.message).stack}}class o extends i{constructor(e){super(e||"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(e){e[e.MissingBillingAddress=0]="MissingBillingAddress",e[e.MissingCart=1]="MissingCart",e[e.MissingCheckout=2]="MissingCheckout",e[e.MissingConsignments=3]="MissingConsignments",e[e.MissingCustomer=4]="MissingCustomer",e[e.MissingCheckoutConfig=5]="MissingCheckoutConfig",e[e.MissingOrder=6]="MissingOrder",e[e.MissingOrderConfig=7]="MissingOrderConfig",e[e.MissingOrderId=8]="MissingOrderId",e[e.MissingPayment=9]="MissingPayment",e[e.MissingPaymentId=10]="MissingPaymentId",e[e.MissingPaymentInstrument=11]="MissingPaymentInstrument",e[e.MissingPaymentMethod=12]="MissingPaymentMethod",e[e.MissingPaymentRedirectUrl=13]="MissingPaymentRedirectUrl",e[e.MissingPaymentStatus=14]="MissingPaymentStatus",e[e.MissingPaymentToken=15]="MissingPaymentToken",e[e.MissingShippingAddress=16]="MissingShippingAddress"}(e||(e={}));class a extends i{constructor(t){super(function(t){switch(t){case e.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case e.MissingCart:return"Unable to proceed because cart data is unavailable.";case e.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case e.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case e.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case e.MissingCheckoutConfig:case e.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case e.MissingOrder:return"Unable to proceed because order data is unavailable.";case e.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case e.MissingPayment:return"Unable to proceed because payment data is unavailable.";case e.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case e.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case e.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"}}var s=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class c{constructor(e){this.scriptLoader=e,this.window=window}getPayPalFastlaneSdk(e,t,n){return s(this,void 0,void 0,function*(){if(!this.window.bigCommercePaymentsFastlaneSdk){const r=this.getPayPalFastlaneSdkConfiguration(e,t,n);if(yield this.loadPayPalSdk(r),!this.window.bigCommercePaymentsFastlaneSdk)throw new o}return this.window.bigCommercePaymentsFastlaneSdk})}getPayPalGooglePaySdk(e,t,n,r){return s(this,void 0,void 0,function*(){if(!this.window.bigCommercePaymentsGooglePay||r){const r=this.getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n);yield this.loadPayPalSdk(r)}if(!this.window.bigCommercePaymentsGooglePay)throw new o;return this.window.bigCommercePaymentsGooglePay})}getPayPalApmsSdk(e,t){return s(this,void 0,void 0,function*(){if(!this.window.bigCommercePaymentsApms){const n=this.getPayPalApmSdkConfiguration(e,t);if(yield this.loadPayPalSdk(n),!this.window.bigCommercePaymentsApms)throw new o}return this.window.bigCommercePaymentsApms})}getPayPalMessages(e,t){return s(this,void 0,void 0,function*(){if(!this.window.bigCommercePaymentsMessages){const n=this.getPayPalSdkMessagesConfiguration(e,t);yield this.loadPayPalSdk(n)}if(!this.window.bigCommercePaymentsMessages)throw new o;return this.window.bigCommercePaymentsMessages})}loadPayPalSdk({options:e,attributes:t}){return s(this,void 0,void 0,function*(){const n=this.transformConfig(e),r=this.transformConfig(t),i=`https://www.paypal.com/sdk/js?${new URLSearchParams(n).toString()}`;yield this.scriptLoader.loadScript(i,{async:!0,attributes:r})})}getPayPalFastlaneSdkConfiguration(t,n,r){const{clientToken:i,initializationData:o}=t;if(!o||!o.clientId)throw new a(e.MissingPaymentMethod);const{intent:s,clientId:c,merchantId:u,attributionId:l}=o;return{options:{"client-id":c,"merchant-id":u,commit:!0,components:["fastlane","three-domain-secure"],currency:n,intent:s},attributes:{"data-client-metadata-id":r.replace(/-/g,""),"data-namespace":"bigCommercePaymentsFastlaneSdk","data-partner-attribution-id":l,"data-sdk-client-token":i}}}getPayPalGooglePaySdkScriptConfigOrThrow(t,n,r=!0){const{clientToken:i,initializationData:o}=t;if(!o||!o.clientId)throw new a(e.MissingPaymentMethod);const{intent:s,clientId:c,merchantId:u,buyerCountry:l,attributionId:d,isHostedCheckoutEnabled:h,isDeveloperModeApplicable:p}=o,f=h||r;return{options:Object.assign({"client-id":c,"merchant-id":u,commit:f,components:["googlepay"],currency:n,intent:s},p&&{"buyer-country":l}),attributes:{"data-partner-attribution-id":d,"data-client-token":i,"data-namespace":"bigCommercePaymentsGooglePay"}}}getPayPalApmSdkConfiguration(t,n){const{initializationData:r}=t;if(!r||!r.clientId)throw new a(e.MissingPaymentMethod);const{intent:i,clientId:o,merchantId:s,buyerCountry:c,attributionId:u,isDeveloperModeApplicable:l,availableAlternativePaymentMethods:d=[],enabledAlternativePaymentMethods:h=[]}=r,p=this.filterFundingOptions(h),f=this.filterFundingOptions(d.filter(e=>!h.includes(e)));return{options:Object.assign({"client-id":o,"merchant-id":s,"enable-funding":p.length>0?p:void 0,"disable-funding":f.length>0?f:void 0,commit:!0,components:["buttons","payment-fields"],currency:n,intent:i},l&&{"buyer-country":c}),attributes:{"data-partner-attribution-id":u,"data-namespace":"bigCommercePaymentsApms"}}}getPayPalSdkMessagesConfiguration(t,n){const{initializationData:r}=t;if(!r||!r.clientId)throw new a(e.MissingPaymentMethod);const{clientId:i,merchantId:o,attributionId:s,isDeveloperModeApplicable:c,buyerCountry:u}=r;return{options:Object.assign({"client-id":i,"merchant-id":o,components:["messages"],currency:n},c&&{"buyer-country":u}),attributes:{"data-namespace":"bigCommercePaymentsMessages","data-partner-attribution-id":s}}}filterFundingOptions(e){const t=["klarna","afterpay"];return e?e.filter(e=>!t.includes(e)):[]}transformConfig(e){let t={};return Object.keys(e).forEach(n=>{const r=e[n];null==r||""===r||Array.isArray(r)&&0===r.length||(t=Object.assign(Object.assign({},t),{[n]:Array.isArray(r)?r.join(","):r}))}),t}}function u(){return new c((0,t.Hb)())}function l(e,t){return Object.assign(e,{resolveIds:t})}const d={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},h="embedded-checkout-loading-indicator-rotation";class p{constructor(e){this.styles=Object.assign(Object.assign({},d),e&&e.styles),this.containerStyles=Object.assign({},e&&e.containerStyles),this.defineAnimation(),this.container=this.buildContainer(),this.indicator=this.buildIndicator(),this.container.appendChild(this.indicator)}show(e){if(e){const t=document.getElementById(e);if(!t)throw new Error("Unable to attach the loading indicator because the parent ID is not valid.");t.appendChild(this.container)}this.container.style.visibility="visible",this.container.style.opacity="1"}hide(){const e=()=>{this.container.style.visibility="hidden",this.container.removeEventListener("transitionend",e)};this.container.addEventListener("transitionend",e),this.container.style.opacity="0"}buildContainer(){const e=document.createElement("div");return e.style.display="block",e.style.bottom="0",e.style.left="0",e.style.height="100%",e.style.width="100%",e.style.position="absolute",e.style.right="0",e.style.top="0",e.style.transition="all 250ms ease-out",e.style.opacity="0",this.setStyleAttribute(e,this.containerStyles),e}buildIndicator(){const e=document.createElement("div");return e.style.display="block",e.style.width=`${this.styles.size}px`,e.style.height=`${this.styles.size}px`,e.style.borderRadius=`${this.styles.size}px`,e.style.border="solid 1px",e.style.borderColor=`${this.styles.backgroundColor} ${this.styles.backgroundColor} ${this.styles.color} ${this.styles.color}`,e.style.margin="0 auto",e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="50%",e.style.transform="translateY(-50%) rotate(0deg)",e.style.transformStyle="preserve-3d",e.style.animation=`${h} 500ms infinite cubic-bezier(0.69, 0.31, 0.56, 0.83)`,e}setStyleAttribute(e,t){Object.keys(t).forEach(n=>{e.style.setProperty(n,t[n])})}defineAnimation(){var e;if(document.getElementById(h))return;const t=document.createElement("style");t.id=h,null===(e=document.head)||void 0===e||e.appendChild(t),t.sheet instanceof CSSStyleSheet&&t.sheet.insertRule(`\n @keyframes ${h} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}const f={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};var m=n(8686),y=n(4043),g=n(9440);class v extends i{constructor(e){super(e||"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 b={body:{},headers:{},status:0};class _ extends i{constructor(e,{message:t,errors:n}={}){const{body:r,headers:i,status:o}=e||b;super(t||"An unexpected error has occurred."),this.name="RequestError",this.type="request",this.body=r,this.headers=i,this.status=o,this.errors=n||[]}}var w,P,S,I,C,O,A,k;!function(e){e.BuyNow="BUY_NOW"}(w||(w={})),function(e){e.Possible="POSSIBLE",e.No="NO",e.Unknown="UNKNOWN",e.Yes="YES"}(P||(P={})),function(e){e.AUTHORIZE="authorize",e.CAPTURE="capture"}(S||(S={})),function(e){e.paypal="paypal",e.checkout="checkout",e.buynow="buynow",e.pay="pay",e.installment="installment"}(I||(I={})),function(e){e.gold="gold",e.blue="blue",e.silver="silver",e.black="black",e.white="white"}(C||(C={})),function(e){e.pill="pill",e.rect="rect"}(O||(O={})),function(e){e.OXXO="oxxo"}(A||(A={})),function(e){e.Approved="APPROVED",e.Created="CREATED",e.PayerActionRequired="PAYER_ACTION_REQUIRED",e.PollingStop="POLLING_STOP",e.PollingError="POLLING_ERROR"}(k||(k={}));var E=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class j{constructor(e,t,n,r){this.formPoster=e,this.paymentIntegrationService=t,this.bigCommercePaymentsRequestSender=n,this.bigCommercePaymentsScriptLoader=r}loadPayPalSdk(e,t,n,r){return E(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=t||i.getCartOrThrow().currency.code,a=i.getPaymentMethodOrThrow(e);return this.paypalSdk=yield this.bigCommercePaymentsScriptLoader.getPayPalSDK(a,o,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new o;return this.paypalSdk}createBuyNowCartOrThrow(t){return E(this,void 0,void 0,function*(){const n=t.getBuyNowCartRequestBody();if(!n)throw new a(e.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(n)}catch(e){throw new v}})}createOrder(e,t){return E(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.bigCommercePaymentsRequestSender.createOrder(e,Object.assign({cartId:n},t));return r})}createOrderCardFields(e,t){return E(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.bigCommercePaymentsRequestSender.createOrder(e,Object.assign({cartId:n},t));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(){return E(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState(),t=e.getCartOrThrow(),n=e.getConsignmentsOrThrow()[0];try{yield this.bigCommercePaymentsRequestSender.updateOrder({availableShippingOptions:n.availableShippingOptions,cartId:t.id,selectedShippingOption:n.selectedShippingOption})}catch(e){throw new _}})}getOrderStatus(e,t){return E(this,void 0,void 0,function*(){try{const{status:n}=yield this.bigCommercePaymentsRequestSender.getOrderStatus(e,t);return n}catch(e){throw new _}})}tokenizePayment(t,n){const r=this.paymentIntegrationService.getState().getCartOrThrow();if(!n)throw new a(e.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:t,order_id:n},r.source===w.BuyNow&&{cart_id:r.id}))}submitPayment(e,t,n){return E(this,void 0,void 0,function*(){const r={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:e,paypal_account:{order_id:t}}};yield this.paymentIntegrationService.submitPayment(Object.assign({methodId:e,paymentData:r},n?{gatewayId:n}:{}))})}getShippingOptionOrThrow(e){const t=this.paymentIntegrationService.getState().getConsignmentsOrThrow()[0],n=t.availableShippingOptions||[],r=n.find(e=>e.isRecommended),i=(e?n.find(t=>t.id===e):n.find(e=>{var n;return e.id===(null===(n=t.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(e){return{firstName:(null==e?void 0:e.firstName)||"",lastName:(null==e?void 0:e.lastName)||"",email:(null==e?void 0:e.email)||"",phone:(null==e?void 0:e.phone)||"",company:"",address1:(null==e?void 0:e.address1)||"",address2:(null==e?void 0:e.address2)||"",city:(null==e?void 0:e.city)||"",countryCode:(null==e?void 0:e.countryCode)||"",postalCode:(null==e?void 0:e.postalCode)||"",stateOrProvince:"",stateOrProvinceCode:(null==e?void 0:e.stateOrProvinceCode)||"",customFields:[]}}getBillingAddressFromOrderDetails({payer:e}){var t,n;return this.getAddress({firstName:e.name.given_name,lastName:e.name.surname,email:e.email_address,address1:e.address.address_line_1,address2:e.address.address_line_2,city:e.address.admin_area_2,countryCode:e.address.country_code,postalCode:e.address.postal_code,stateOrProvinceCode:e.address.admin_area_1,phone:null===(n=null===(t=e.phone)||void 0===t?void 0:t.phone_number)||void 0===n?void 0:n.national_number})}getShippingAddressFromOrderDetails(e){const{payer:t,purchase_units:n}=e,{address:r,name:{full_name:i}}=n[0].shipping,[o,...a]=i.split(" ");return this.getAddress({firstName:o,lastName:a.join(" "),email:t.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(e){const{color:t,height:n,label:r,shape:i}=e||{},o={color:t&&C[t]?t:void 0,height:this.getValidHeight(n),label:r&&I[r]?r:void 0,shape:i&&O[i]?i:void 0};return(0,g.omitBy)(o,g.isNil)}getValidHeight(e){return e&&"number"==typeof e?e>55?55:e<25?25:e:40}removeElement(e){const t=e&&document.getElementById(e);t&&(t.style.display="none")}}const x="This API endpoint is for internal use only and may change in the future";var T;!function(e){e.Json="application/json",e.JsonV1="application/vnd.bc.v1+json"}(T||(T={}));const z=T,B={"X-Checkout-SDK-Version":"1.889.1"};var F=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class M{constructor(e){this.requestSender=e}createOrder(e,t){return F(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${e}`,r=t,i=Object.assign({"X-API-INTERNAL":x,"Content-Type":z.Json},B);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(e){return F(this,void 0,void 0,function*(){const t=e,n=Object.assign({"X-API-INTERNAL":x,"Content-Type":z.Json},B);return(yield this.requestSender.put("/api/storefront/initialization/bigcommerce_payments",{headers:n,body:t})).body})}getOrderStatus(e="bigcommerce_payments",t){return F(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${e}`,r=Object.assign({"X-API-INTERNAL":x,"Content-Type":z.Json},B);return(yield this.requestSender.get(n,Object.assign({headers:r},t))).body})}}var D=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class U{constructor(e){this.scriptLoader=e,this.window=window}getPayPalSDK(e,t,n,r){return D(this,void 0,void 0,function*(){const i=this.getPayPalSdkScriptConfigOrThrow(e,t,n);return this.loadPayPalSDK(i,r)})}loadPayPalSDK(e,t=!1){return D(this,void 0,void 0,function*(){if(!this.window.bigCommercePaymentsPayPalSDK||t){const t=this.transformConfig(e.options),n=this.transformConfig(e.attributes),r=`https://www.paypal.com/sdk/js?${new URLSearchParams(t).toString()}`;yield this.scriptLoader.loadScript(r,{async:!0,attributes:n})}if(!this.window.bigCommercePaymentsPayPalSDK)throw new o;return this.window.bigCommercePaymentsPayPalSDK})}getPayPalSdkScriptConfigOrThrow(t,n,r=!0){const{id:i,clientToken:o,initializationData:s}=t;if(!(null==s?void 0:s.clientId))throw new a(e.MissingPaymentMethod);const{intent:c,clientId:u,merchantId:l,buyerCountry:d,attributionId:h,isVenmoEnabled:p,isHostedCheckoutEnabled:f,isPayPalCreditAvailable:m,isDeveloperModeApplicable:y,availableAlternativePaymentMethods:g=[],enabledAlternativePaymentMethods:v=[],isGooglePayEnabled:b}=s,_=f||r,w="bigcommerce_payments_creditcards"===i,P=w?["card"]:[],S=w?[]:["card"],I=m?["credit","paylater"]:[],C=m?[]:["credit","paylater"],O=p?["venmo"]:[],A=p?[]:["venmo"],k=g.filter(e=>!v.includes(e)),E=b?["googlepay"]:[],j=r?["card-fields"]:[],x=this.filterFundingOptions([...S,...C,...A,...k]),T=this.filterFundingOptions([...P,...I,...O,...v]);return{options:Object.assign({"client-id":u,"merchant-id":l,"enable-funding":T.length>0?T:void 0,"disable-funding":x.length>0?x:void 0,commit:_,components:["buttons","hosted-fields","payment-fields","legal",...E,...j],currency:n,intent:c},y&&{"buyer-country":d}),attributes:{"data-partner-attribution-id":h,"data-client-token":o,"data-namespace":"bigCommercePaymentsPayPalSDK"}}}filterFundingOptions(e){const t=["klarna","afterpay"];return e?e.filter(e=>!t.includes(e)):[]}transformConfig(e){let t={};return Object.keys(e).forEach(n=>{const r=e[n];null==r||""===r||Array.isArray(r)&&0===r.length||(t=Object.assign(Object.assign({},t),{[n]:Array.isArray(r)?r.join(","):r}))}),t}}const N=e=>{const{getHost:n}=e.getState();return new j((0,m.createFormPoster)(),e,new M((0,y.createRequestSender)({host:n()})),new U((0,t.vQ)()))},R=function({styles:e}){const t={};return e.color&&(t.color=e.color),e.layout&&(t.layout=e.layout),(e["logo-type"]||e["logo-position"])&&(t.logo={},e["logo-type"]&&(t.logo.type=e["logo-type"]),e["logo-position"]&&(t.logo.position=e["logo-position"])),e.ratio&&(t.ratio=e.ratio),(e["text-color"]||e["text-size"])&&(t.text={},e["text-color"]&&(t.text.color=e["text-color"]),e["text-size"]&&(t.text.size=+e["text-size"])),t};class L extends i{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class V extends L{constructor(e){let t="Unable to submit payment for the order because the payload is invalid.";e&&(t=`${t} Make sure the following fields are provided correctly: ${e.join(", ")}.`),super(t),this.name="PaymentArgumentInvalidError"}}class q extends _{constructor(e){super(e,{message:"There is a problem processing your payment. Please try again later."}),this.name="PaymentMethodInvalidError",this.type="payment_method_invalid"}}class $ extends i{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function H(e){return!("object"!=typeof e||null===e||void 0!==e.shouldSaveInstrument&&"boolean"!=typeof e.shouldSaveInstrument||void 0!==e.shouldSetAsDefaultInstrument&&"boolean"!=typeof e.shouldSetAsDefaultInstrument)}function W(e){return Boolean(e.instrumentId)}function G(e){return"object"==typeof e&&null!==e&&"bigpayToken"in e&&"defaultInstrument"in e&&"provider"in e&&"trustedShippingAddress"in e&&"method"in e&&"type"in e}var K=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Y{constructor(e,t,n,r){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.paypalSdkHelper=n,this.loadingIndicator=r}initialize(e){return K(this,void 0,void 0,function*(){const{methodId:t,bigcommerce_payments:n}=e||{};if(this.bigcommerce_payments=n,!t)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(t);const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(t),{container:o,bannerContainerId:a}=n,{orderId:s,paypalBNPLConfiguration:c=[],isPayPalCreditAvailable:u}=i.initializationData||{};if(void 0!==a){if(!document.getElementById(a))return void console.error("Unable to create banner without valid banner container ID.");const e=null==c?void 0:c.find(({id:e})=>"checkout"===e);if(u||!(null==e?void 0:e.status))return;const t=yield this.paypalSdkHelper.getPayPalMessages(i,r.getCartOrThrow().currency.code);return t&&"function"==typeof(null==t?void 0:t.Messages)?this.renderMessages(t,a,e):void console.error("[BC PayPalCommerce PayLater]: banner could not be rendered, due to issues with loading PayPal SDK")}s?this.orderId=s:(this.loadingIndicatorContainer=null==o?void 0:o.split("#")[1],yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(t),n.onInit&&"function"==typeof n.onInit&&n.onInit(()=>this.renderButton(t,n)),(void 0===n.shouldRenderPayPalButtonOnInitialization||n.shouldRenderPayPalButtonOnInitialization)&&this.renderButton(t,n))})}execute(e,t){return K(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]),{onError:i}=this.bigcommerce_payments||{};if(!n)throw new V(["payment"]);const{methodId:o,paymentData:a}=n;if(this.isPayPalVaultedInstrumentPaymentData(a)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new q;const s=this.isPayPalVaultedInstrumentPaymentData(a)?this.prepareVaultedInstrumentPaymentPayload(o,this.orderId,a):this.preparePaymentPayload(o,this.orderId,a);try{yield this.paymentIntegrationService.submitOrder(r,t),yield this.paymentIntegrationService.submitPayment(s)}catch(e){return this.isProviderError(e)&&(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n.methodId),yield new Promise((e,t)=>{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)),t()})),this.handleError(e,i),Promise.reject()}})}finalize(){return Promise.reject(new $)}deinitialize(){var e;return this.orderId=void 0,null===(e=this.paypalButton)||void 0===e||e.close(),Promise.resolve()}prepareVaultedInstrumentPaymentPayload(e,t,n){const{instrumentId:r,shouldSetAsDefaultInstrument:i}=n,o=!this.isTrustedVaultingFlow(n);return o?{methodId:e,paymentData:{shouldSaveInstrument:o,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:t}}}}:{methodId:e,paymentData:{instrumentId:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:t},bigpay_token:{token:r}}}}}preparePaymentPayload(e,t,n){const{shouldSaveInstrument:r=!1,shouldSetAsDefaultInstrument:i=!1}=H(n)?n:{};return{methodId:e,paymentData:{shouldSaveInstrument:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:t}}}}}renderButton(e,t){var n,r,i,o;const a=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:c}=s.initializationData||{},{checkoutPaymentButtonStyles:u}=c||{},{container:l,onError:d,onRenderButton:h,onValidate:p,submitForm:f}=t;if(!l)throw new L('Unable to initialize payment because "container" argument is not provided.');const m=Object.assign(Object.assign({},this.isAppSwitchEnabled(e)&&{appSwitchWhenAvailable:!0}),{fundingSource:a.FUNDING.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(u),createOrder:()=>this.createOrder(),onClick:(e,t)=>this.handleClick(t,p),onApprove:e=>this.handleApprove(e,f),onError:e=>this.handleError(e,d),onCancel:()=>this.toggleLoadingIndicator(!1)});this.paypalButton=a.Buttons(m),this.paypalButton.isEligible()&&(h&&"function"==typeof h&&h(),(null===(r=(n=this.paypalButton).hasReturned)||void 0===r?void 0:r.call(n))&&this.isAppSwitchEnabled(e)?null===(o=(i=this.paypalButton).resume)||void 0===o||o.call(i):this.paypalButton.render(l))}handleClick(e,t){return K(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;yield null==t?void 0:t(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:e},t){this.orderId=e,null==t||t()}handleError(e,t){this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}createOrder(){return K(this,void 0,void 0,function*(){const e=this.getFieldsValues();return this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_paymentscheckout",{shouldSaveInstrument:(null==e?void 0:e.shouldSaveInstrument)||!1})})}getFieldsValues(){const{getFieldsValues:e}=this.bigcommerce_payments||{};return"function"==typeof e?e():void 0}isTrustedVaultingFlow(e){if(e&&W(e)){const t=this.paymentIntegrationService.getState().getInstruments(),n=null==t?void 0:t.find(t=>G(t)&&t.bigpayToken===e.instrumentId);return!(G(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(e){return!!e&&W(e)&&H(e)}renderMessages(e,t,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:R(n)};e.Messages(r).render(`#${t}`)}isProviderError(e){var t,n,r;return!!function(e){return"object"==typeof e&&null!==e&&"errors"in e}(e)&&"INSTRUMENT_DECLINED"===(null===(r=null===(n=((null===(t=null==e?void 0:e.errors)||void 0===t?void 0:t.filter(e=>e.provider_error))||[])[0])||void 0===n?void 0:n.provider_error)||void 0===r?void 0:r.code)}isAppSwitchEnabled(e){var t,n;return null!==(n=null===(t=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e).initializationData)||void 0===t?void 0:t.isAppSwitchEnabled)&&void 0!==n&&n}}const J=l(e=>new Y(e,N(e),u(),new p({containerStyles:f})),[{id:"bigcommerce_payments"}]);var Z,X,Q,ee,te,ne,re,ie,oe;!function(e){e.CVV="cvv",e.PAN="pan"}(Z||(Z={}));class ae{static get(e){const t=`${encodeURIComponent(`${e}`)}=`,n=document.cookie;let r=null;const i=n.indexOf(t);if(i>-1){let e=n.indexOf(";",i);-1===e&&(e=n.length),r=decodeURIComponent(n.substring(i+t.length,e))}return r}static set(e,t,n={secure:!0}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;const{expires:i,path:o,domain:a,secure:s}=n;if(i)r+=`; expires=${i.toUTCString()}`;else{const e=new Date,t=60;e.setTime(e.getTime()+60*t*1e3),r+=`; expires=${e.toUTCString()}`}o&&(r+=`; path=${o}`),a&&(r+=`; domain=${a}`),s&&(r+="; secure"),document.cookie=r}static remove(e,t){ae.set(e,"",Object.assign({expires:new Date(0)},t))}}!function(e){e.AUTHORIZE="authorize",e.CAPTURE="capture"}(X||(X={})),function(e){e.Possible="POSSIBLE",e.No="NO",e.Unknown="UNKNOWN",e.Yes="YES"}(Q||(Q={})),function(e){e.Always="SCA_ALWAYS"}(ee||(ee={})),function(e){e.Succeeded="succeeded",e.Cancelled="cancelled",e.Errored="errored"}(te||(te={})),function(e){e.paypal="paypal",e.checkout="checkout",e.buynow="buynow",e.pay="pay",e.installment="installment"}(ne||(ne={})),function(e){e.gold="gold",e.blue="blue",e.silver="silver",e.black="black",e.white="white"}(re||(re={})),function(e){e.pill="pill",e.rect="rect"}(ie||(ie={})),function(e){e.SUCCEEDED="succeeded",e.FAILED="failed",e.CANCELED="canceled",e.UNRECOGNIZED="unrecognized"}(oe||(oe={}));var se=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class ce{constructor(){this.window=window}initializePayPalFastlane(e,t,n){return se(this,void 0,void 0,function*(){if(t&&(window.localStorage.setItem("fastlaneEnv","sandbox"),window.localStorage.setItem("axoEnv","sandbox")),!this.window.bigCommercePaymentsFastlane){const t={root:{backgroundColorPrimary:"transparent"}};this.window.bigCommercePaymentsFastlane=yield e.Fastlane({styles:n||t})}return this.window.bigCommercePaymentsFastlane})}getPayPalFastlaneOrThrow(){if(!this.window.bigCommercePaymentsFastlane)throw new o;return this.window.bigCommercePaymentsFastlane}lookupCustomerOrThrow(e){return se(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(e)})}triggerAuthenticationFlowOrThrow(e){return se(this,void 0,void 0,function*(){return e?this.getPayPalFastlaneOrThrow().identity.triggerAuthenticationFlow(e):{}})}updateStorageSessionId(e){const t=new Date;t.setDate(t.getDate()+14);const n={expires:t,secure:!0};ae.set("bc-fastlane-sessionId",e,n)}removeStorageSessionId(){ae.remove("bc-fastlane-sessionId")}getStorageSessionId(){return ae.get("bc-fastlane-sessionId")||""}mapPayPalFastlaneProfileToBcCustomerData(e,t){var n,r,i;const{authenticationState:o,profileData:a}=t,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,c=null==a?void 0:a.shippingAddress,u=null==a?void 0:a.name,l=null==a?void 0:a.card,d=c?this.mapPayPalToBcAddress(c.address,c.name,c.phoneNumber):void 0,h=s&&u?this.mapPayPalToBcAddress(s,u,null==c?void 0:c.phoneNumber):void 0,p=l?this.mapPayPalToBcInstrument(e,l):[],f=this.filterAddresses([d,h]);return{authenticationState:o||oe.UNRECOGNIZED,addresses:f,billingAddress:h,shippingAddress:d,instruments:p}}mapPayPalToBcInstrument(e,t){const{id:n,paymentSource:r}=t,{brand:i,expiry:o,lastDigits:a}=r.card,[s,c]=o.split("-");return[{bigpayToken:n,brand:i,defaultInstrument:!1,expiryMonth:c,expiryYear:s,iin:"",last4:a,method:e,provider:e,trustedShippingAddress:!1,untrustedShippingCardVerificationMode:Z.PAN,type:"card"}]}mapBcToPayPalAddress(e){return{company:(null==e?void 0:e.company)||"",addressLine1:(null==e?void 0:e.address1)||"",addressLine2:(null==e?void 0:e.address2)||"",adminArea1:(null==e?void 0:e.stateOrProvinceCode)||(null==e?void 0:e.stateOrProvince)||"",adminArea2:(null==e?void 0:e.city)||"",postalCode:(null==e?void 0:e.postalCode)||"",countryCode:(null==e?void 0:e.countryCode)||""}}mapPayPalToBcAddress(e,t,n,r){const[i,o]=t.fullName.split(" "),a=(null==n?void 0:n.nationalNumber)||"",s=(null==n?void 0:n.countryCode)||"";return{id:Date.now(),type:"paypal-address",firstName:t.firstName||i||"",lastName:t.lastName||o||"",company:e.company||"",address1:e.addressLine1,address2:e.addressLine2||"",city:e.adminArea2,stateOrProvince:e.adminArea1,stateOrProvinceCode:e.adminArea1,country:e.countryCode||"",countryCode:e.countryCode||"",postalCode:e.postalCode,phone:s+a,customFields:r||[]}}filterAddresses(e){return e.reduce((e,t)=>t?e.some(e=>this.isEqualAddresses(e,t))?e:[...e,t]:e,[])}isEqualAddresses(e,t){return(0,g.isEqual)(this.normalizeAddress(e),this.normalizeAddress(t))}normalizeAddress(e){return(0,g.omit)(e,["id","phone"])}}function ue(){return new ce}function le(e){return"string"!=typeof e}function de(e,t){if(t||e)return function(e){var t,n;const r={},i=(0,g.omitBy)(e.root,le),o=(0,g.omitBy)(e.input,le),a=(0,g.omitBy)(e.toggle,le),s=(0,g.omitBy)(null===(t=e.text)||void 0===t?void 0:t.body,le),c=(0,g.omitBy)(null===(n=e.text)||void 0===n?void 0:n.caption,le),u=e.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(c).length&&(r.text=Object.assign({},r.text),r.text.caption=c),u&&(r.branding=u),r}(function(e,t){var n,r,i,o,a,s,c,u,l,d,h,p,f,m,y,g,v,b,_,w,P,S;return{root:{backgroundColorPrimary:(null==e?void 0:e.fastlaneRootSettingsBackgroundColor)||(null===(n=null==t?void 0:t.root)||void 0===n?void 0:n.backgroundColorPrimary),errorColor:(null==e?void 0:e.fastlaneRootSettingsErrorColor)||(null===(r=null==t?void 0:t.root)||void 0===r?void 0:r.errorColor),fontFamily:(null==e?void 0:e.fastlaneRootSettingsFontFamily)||(null===(i=null==t?void 0:t.root)||void 0===i?void 0:i.fontFamily),fontSizeBase:(null==e?void 0:e.fastlaneRootSettingsFontSize)||(null===(o=null==t?void 0:t.root)||void 0===o?void 0:o.fontSizeBase),padding:(null==e?void 0:e.fastlaneRootSettingsPadding)||(null===(a=null==t?void 0:t.root)||void 0===a?void 0:a.padding),primaryColor:(null==e?void 0:e.fastlaneRootSettingsPrimaryColor)||(null===(s=null==t?void 0:t.root)||void 0===s?void 0:s.primaryColor)},input:{borderRadius:(null==e?void 0:e.fastlaneInputSettingsBorderRadius)||(null===(c=null==t?void 0:t.input)||void 0===c?void 0:c.borderRadius),borderColor:(null==e?void 0:e.fastlaneInputSettingsBorderColor)||(null===(u=null==t?void 0:t.input)||void 0===u?void 0:u.borderColor),focusBorderColor:(null==e?void 0:e.fastlaneInputSettingsFocusBorderBase)||(null===(l=null==t?void 0:t.input)||void 0===l?void 0:l.focusBorderColor),backgroundColor:(null==e?void 0:e.fastlaneInputSettingsBackgroundColor)||(null===(d=null==t?void 0:t.input)||void 0===d?void 0:d.backgroundColor),borderWidth:(null==e?void 0:e.fastlaneInputSettingsBorderWidth)||(null===(h=null==t?void 0:t.input)||void 0===h?void 0:h.borderWidth),textColorBase:(null==e?void 0:e.fastlaneInputSettingsTextColorBase)||(null===(p=null==t?void 0:t.input)||void 0===p?void 0:p.textColorBase)},toggle:{colorPrimary:(null==e?void 0:e.fastlaneToggleSettingsColorPrimary)||(null===(f=null==t?void 0:t.toggle)||void 0===f?void 0:f.colorPrimary),colorSecondary:(null==e?void 0:e.fastlaneToggleSettingsColorSecondary)||(null===(m=null==t?void 0:t.toggle)||void 0===m?void 0:m.colorSecondary)},text:{body:{color:(null==e?void 0:e.fastlaneTextBodySettingsColor)||(null===(g=null===(y=null==t?void 0:t.text)||void 0===y?void 0:y.body)||void 0===g?void 0:g.color),fontSize:(null==e?void 0:e.fastlaneTextBodySettingsFontSize)||(null===(b=null===(v=null==t?void 0:t.text)||void 0===v?void 0:v.body)||void 0===b?void 0:b.fontSize)},caption:{color:(null==e?void 0:e.fastlaneTextCaptionSettingsColor)||(null===(w=null===(_=null==t?void 0:t.text)||void 0===_?void 0:_.caption)||void 0===w?void 0:w.color),fontSize:(null==e?void 0:e.fastlaneTextCaptionSettingsFontSize)||(null===(S=null===(P=null==t?void 0:t.text)||void 0===P?void 0:P.caption)||void 0===S?void 0:S.fontSize)}},branding:(null==e?void 0:e.fastlaneBrandingSettings)||(null==t?void 0:t.branding)}}(e,t))}function he(e){return!!e&&("authenticationState"in e||"addresses"in e||"instruments"in e)}function pe(e,t,n=!0){var r;return null!==(r=e[t])&&void 0!==r?r:n}var fe=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class me{constructor(e,t,n,r){this.paymentIntegrationService=e,this.bigCommercePaymentsRequestSender=t,this.bigCommercePaymentsSdk=n,this.bigCommercePaymentsFastlaneUtils=r}initialize(e){var t,n;return fe(this,void 0,void 0,function*(){const{methodId:r,bigcommerce_payments_fastlane:i}=e;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(this.methodId=r,!i)throw new L('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 L('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 L('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:c,isFastlaneStylingEnabled:u}=s.initializationData||{};this.threeDSVerificationMethod=null===(t=s.initializationData)||void 0===t?void 0:t.threeDSVerificationMethod,this.paypalFastlaneSdk=yield this.bigCommercePaymentsSdk.getPayPalFastlaneSdk(s,a.currency.code,a.id);const l=de(u?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,!!c,l),this.shouldRunAuthenticationFlow()&&(yield this.runPayPalAuthenticationFlowOrThrow(r)),yield this.initializePayPalPaymentComponent(),i.onInit(e=>this.renderPayPalPaymentComponent(e)),i.onChange(()=>this.handlePayPalStoredInstrumentChange(r))})}execute(e,t){return fe(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]);if(!n)throw new V(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&W(i);try{yield this.paymentIntegrationService.submitOrder(r,t);const e=a?yield this.prepareVaultedInstrumentPaymentPayload(o,i):yield this.preparePaymentPayload(o,i);yield this.paymentIntegrationService.submitPayment(e),this.bigCommercePaymentsFastlaneUtils.removeStorageSessionId()}catch(e){if(function(e){return"object"==typeof e&&null!==e&&"message"in e&&"response"in e&&"name"in e.response}(e)&&"INVALID_REQUEST"===e.response.name){const e={translationKey:"payment.errors.invalid_request_error"};return this.handleError(e),Promise.reject()}if(e instanceof Error&&"FastlaneError"!==e.name)throw e;return Promise.reject()}})}finalize(){return Promise.reject(new $)}deinitialize(){return fe(this,void 0,void 0,function*(){return Promise.resolve()})}shouldRunAuthenticationFlow(){const e=this.paymentIntegrationService.getState(),t=e.getCartOrThrow(),n=e.getCustomerOrThrow(),r=e.getPaymentProviderCustomer(),i=he(r)?r:{},o=this.bigCommercePaymentsFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===oe.CANCELED||(null==i?void 0:i.authenticationState)||o!==t.id)}runPayPalAuthenticationFlowOrThrow(e){return fe(this,void 0,void 0,function*(){try{const t=this.paymentIntegrationService.getState(),n=t.getCartOrThrow(),r=t.getCustomer(),i=t.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:c,addresses:u,instruments:l}=this.bigCommercePaymentsFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(e,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:c,addresses:u,instruments:l}),s.authenticationState===oe.CANCELED?this.bigCommercePaymentsFastlaneUtils.removeStorageSessionId():this.bigCommercePaymentsFastlaneUtils.updateStorageSessionId(n.id)}catch(e){}})}initializePayPalPaymentComponent(){return fe(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),t=e.phone,n=`${e.firstName} ${e.lastName}`.trim(),r=this.bigCommercePaymentsFastlaneUtils.getPayPalFastlaneOrThrow(),i={fields:Object.assign({cardholderName:{prefill:n,enabled:!0}},t&&{phoneNumber:{prefill:t}})};this.paypalComponentMethods=yield r.FastlaneCardComponent(i)})}renderPayPalPaymentComponent(e){const t=this.getPayPalComponentMethodsOrThrow();if(!e)throw new L('Unable to render card component because "container" argument is not provided.');t.render(e)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new o;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(e,t){return fe(this,void 0,void 0,function*(){const{instrumentId:n}=t,r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),i=this.isBigcommercePaymentsFastlaneThreeDSAvailable()&&r.config.is3dsEnabled?yield this.get3DSNonce(n):n;return yield this.createOrder(i),{methodId:e,paymentData:{formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:i}}}}})}preparePaymentPayload(e,t){return fe(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getBillingAddressOrThrow(),i=n.getPaymentMethodOrThrow(e),o=`${r.firstName} ${r.lastName}`.trim(),{getPaymentToken:a}=this.getPayPalComponentMethodsOrThrow(),{id:s}=yield a({name:{fullName:o},billingAddress:this.bigCommercePaymentsFastlaneUtils.mapBcToPayPalAddress(r)}),c=this.isBigcommercePaymentsFastlaneThreeDSAvailable()&&i.config.is3dsEnabled,{shouldSaveInstrument:u=!1,shouldSetAsDefaultInstrument:l=!1}=H(t)?t:{},d=c?yield this.get3DSNonce(s):s;return yield this.createOrder(d),{methodId:e,paymentData:Object.assign(Object.assign({},t),{shouldSaveInstrument:u,shouldSetAsDefaultInstrument:l,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:d}}})}})}createOrder(e){return fe(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getCartOrThrow().id;if(this.methodId){const{orderId:n}=yield this.bigCommercePaymentsRequestSender.createOrder(this.methodId,{cartId:t,fastlaneToken:e});this.orderId=n}})}get3DSNonce(e){var t;return fe(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),a=n.getStoreConfigOrThrow().links.checkoutLink,s=null===(t=this.paypalFastlaneSdk)||void 0===t?void 0:t.ThreeDomainSecureClient;if(!s)throw new o;const c={amount:i.orderAmount.toFixed(2),currency:r.currency.code,nonce:e,threeDSRequested:this.threeDSVerificationMethod===ee.Always,transactionContext:{experience_context:{locale:"en-US",return_url:a,cancel_url:a}}},u=yield s.isEligible(c);if(this.threeDSVerificationMethod===ee.Always&&!u)throw new q;if(u){const{liabilityShift:e,authenticationState:t,nonce:n}=yield s.show();if(e===P.No||e===P.Unknown||t===te.Errored||t===te.Cancelled)throw new q;if(t===te.Succeeded&&[P.Yes,P.Possible].includes(e))return n}return e})}handlePayPalStoredInstrumentChange(e){return fe(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsFastlaneUtils.getPayPalFastlaneOrThrow(),{selectionChanged:n,selectedCard:r}=yield t.profile.showCardSelector();if(n){const t=this.paymentIntegrationService.getState().getPaymentProviderCustomer(),n=he(t)?t:{},i=this.bigCommercePaymentsFastlaneUtils.mapPayPalToBcInstrument(e,r)[0];return yield this.paymentIntegrationService.updatePaymentProviderCustomer(Object.assign(Object.assign({},n),{instruments:[i]})),i}})}isBigcommercePaymentsFastlaneThreeDSAvailable(){return pe(this.paymentIntegrationService.getState().getStoreConfigOrThrow().checkoutSettings.features,"PROJECT-7080.bcp_fastlane_three_ds")}handleError(e){var t;(null===(t=this.bigcommerce_payments_fastlane)||void 0===t?void 0:t.onError)&&"function"==typeof this.bigcommerce_payments_fastlane.onError&&this.bigcommerce_payments_fastlane.onError(e)}}const ye=l(e=>{const{getHost:t}=e.getState();return new me(e,new M((0,y.createRequestSender)({host:t()})),u(),ue())},[{id:"bigcommerce_payments_fastlane"}]);class ge extends i{constructor(e){super(e||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}var ve=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class be{constructor(e,t,n,r){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.loadingIndicator=n,this.paypalSdkHelper=r}initialize(e){return ve(this,void 0,void 0,function*(){const{methodId:t,bigcommerce_payments_paylater:n}=e||{};if(!t)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(t);const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(t),{paypalBNPLConfiguration:o=[],orderId:a}=i.initializationData||{},{bannerContainerId:s,container:c}=n;if(void 0!==s){if(!document.getElementById(s))return void console.error("Unable to create banner without valid banner container ID.");const e=o&&o.find(({id:e})=>"checkout"===e);if(!(null==e?void 0:e.status))return;const t=yield this.paypalSdkHelper.getPayPalMessages(i,r.getCartOrThrow().currency.code);return this.renderMessages(t,s,e)}a?this.orderId=a:(yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(t),this.loadingIndicatorContainer=null==c?void 0:c.split("#")[1],this.renderButton(t,n))})}execute(e,t){return ve(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]);if(!n)throw new V(["payment"]);if(!this.orderId)throw new q;yield this.paymentIntegrationService.submitOrder(r,t),yield this.bigCommercePaymentsIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new $)}deinitialize(){var e;return this.orderId=void 0,null===(e=this.bigCommercePaymentsButtons)||void 0===e||e.close(),Promise.resolve()}renderButton(e,t){if(!(null==t?void 0:t.container))throw new L('Unable to initialize payment because "container" argument is not provided.');const n=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:c,onValidate:u,submitForm:l}=t,d=[n.FUNDING.PAYLATER,n.FUNDING.CREDIT];let h=!1;d.forEach(e=>{if(h)return;const t={fundingSource:e,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),onClick:(e,t)=>this.handleClick(t,u),onApprove:e=>this.handleApprove(e,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:e=>this.handleError(e,s)};if(this.bigCommercePaymentsButtons=n.Buttons(t),this.bigCommercePaymentsButtons.isEligible()||e!==n.FUNDING.PAYLATER){if(!this.bigCommercePaymentsButtons.isEligible()&&e===n.FUNDING.CREDIT)throw new ge(`BigCommercePayments ${e} is not available for your region. Please use BigCommercePayments Checkout instead.`);c&&"function"==typeof c&&c(),this.bigCommercePaymentsButtons.render(a),h=!0}})}handleClick(e,t){return ve(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;t&&"function"==typeof t&&(yield t(()=>(this.toggleLoadingIndicator(!0),n()),r))})}handleApprove({orderID:e},t){this.orderId=e,t&&"function"==typeof t&&t()}handleError(e,t){this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}renderMessages(e,t,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:R(n)};e.Messages(r).render(`#${t}`)}}const _e=l(e=>new be(e,N(e),new p({containerStyles:f}),u()),[{id:"bigcommerce_payments_paylater"}]);class we extends _{constructor(e){super(e,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}var Pe=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Se{constructor(e,t,n,r=3e3,i=3e5){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=g.noop}initialize(e){return Pe(this,void 0,void 0,function*(){const{gatewayId:t,methodId:n,bigcommerce_payments_ratepay:r}=e;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new L('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 L('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new L('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new L('Unable to initialize payment because "options.loadingContainerId" argument is not provided.');this.loadingIndicatorContainer=a;const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(n,t),{merchantId:c}=s.initializationData||{};if(!c)throw new L("Unable to initialize payment because merchantId argument is not provided.");this.bigcommerce_payments_ratepay=r,yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(n),this.createFraudNetScript(c,n,t),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(e,t){return Pe(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]),{getFieldsValues:i}=this.bigcommerce_payments_ratepay||{};if(!n)throw new V(["payment"]);if(!i||"function"!=typeof i)throw new L('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const e=yield this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apmscheckout",{metadataId:this.guid}),{ratepayBirthDate:o,ratepayPhoneNumber:a,ratepayPhoneCountryCode:s}=i(),c={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:e}}};return yield this.paymentIntegrationService.submitOrder(r,t),yield this.paymentIntegrationService.submitPayment({methodId:n.methodId,paymentData:c}),yield new Promise((e,t)=>{this.initializePollingMechanism(n.methodId,e,t,n.gatewayId)})}catch(e){return this.handleError(e),new Promise((e,t)=>t())}})}finalize(){return Promise.reject(new $)}deinitialize(){const{legalTextContainer:e}=this.bigcommerce_payments_ratepay||{},t=document.querySelectorAll('[data-id="fraudnetScript"]')[0],n=document.querySelectorAll('[data-id="fraudnetConfig"]')[0];if(this.deinitializePollingMechanism(),t.remove(),n.remove(),e){const t=document.getElementById(e);null==t||t.remove()}return Promise.resolve()}normalizeDate(e){const t=this.formatDate(e.getDate()),n=this.formatDate(e.getMonth()+1);return`${e.getFullYear()}-${n}-${t}`}formatDate(e){return`${e<10?0:""}${e}`}renderLegalText(e,t){const n=e,r=t.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(),c=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new L('Unable to initialize payment because "legalTextContainerElement" argument is not found.');c.render(`#${n}`)}handleError(e){const{onError:t}=this.bigcommerce_payments_ratepay||{};this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}createFraudNetScript(e,t,n){const r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t,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:`${e}_checkout-page`,sandbox:i};o.innerHTML=JSON.stringify(a),document.body.appendChild(o)}generateGUID(){let e="";for(let t=0;t<32;t+=1)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"[Math.floor(62*Math.random())];return e}loadFraudnetConfig(){const e=document.createElement("script");e.setAttribute("data-id","fraudnetConfig"),e.src="https://c.paypal.com/da/r/fb.js",document.body.appendChild(e)}reinitializeStrategy(e){return Pe(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(e)})}initializePollingMechanism(e,t,n,r){return Pe(this,void 0,void 0,function*(){yield new Promise((e,t)=>{const n=setTimeout(e,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),t())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.bigCommercePaymentsIntegrationService.getOrderStatus("bigcommerce_payments_apms",{params:{useMetadata:!0}}),o=i===k.PollingStop,a=i===k.PollingError;if(o)return this.deinitializePollingMechanism(),t();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(e,t,n,r);yield this.reinitializeStrategy({methodId:e,gatewayId:r,bigcommerce_payments_ratepay:this.bigcommerce_payments_ratepay}),this.handleError(new we)}catch(e){this.handleError(e),n()}})}deinitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deinitializePollingMechanism()}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const Ie=l(e=>new Se(e,N(e),new p({containerStyles:Object.assign(Object.assign({},f),{position:"fixed"})})),[{gateway:"bigcommerce_payments_apms",id:"ratepay"}]);var Ce;!function(e){e.CardCode="cardCode",e.CardCodeVerification="cardCodeVerification",e.CardExpiry="cardExpiry",e.CardName="cardName",e.CardNumber="cardNumber",e.CardNumberVerification="cardNumberVerification",e.CardExpiryVerification="cardExpiryVerification"}(Ce||(Ce={}));const Oe=Ce;function Ae(e){return Oe.CardNumber in e&&Oe.CardName in e&&Oe.CardExpiry in e}function ke(e){return Oe.CardNumberVerification in e&&Oe.CardCodeVerification in e&&Oe.CardExpiryVerification in e}class Ee extends i{constructor(e){super(e||"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 je;!function(e){e[e.CheckoutButtonNotInitialized=0]="CheckoutButtonNotInitialized",e[e.CustomerNotInitialized=1]="CustomerNotInitialized",e[e.PaymentNotInitialized=2]="PaymentNotInitialized",e[e.ShippingNotInitialized=3]="ShippingNotInitialized",e[e.SpamProtectionNotInitialized=4]="SpamProtectionNotInitialized"}(je||(je={}));class xe extends i{constructor(e){super(function(e){switch(e){case je.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case je.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case je.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case je.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."}}(e)),this.subtype=e,this.name="NotInitializedError",this.type="not_initialized"}}class Te extends i{constructor(e,t){super(t||"Unable to proceed because the payment form contains invalid data."),this.details=e,this.name="PaymentInvalidFormError",this.type="payment_invalid_form"}}var ze=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Be{constructor(e,t,n,r){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.bigCommercePaymentsSdk=n,this.bigCommercePaymentsFastlaneUtils=r}initialize(e){return ze(this,void 0,void 0,function*(){const{methodId:t,bigcommerce_payments_creditcards:n}=e,r=n,{form:i,onCreditCardFieldsRenderingError:o,onLoadComplete:a}=r||{};if(!t)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new L('Unable to proceed because "options.bigcommerce_payments_creditcards.form" argument is not provided.');this.hostedFormOptions=i,this.isCreditCardForm=Ae(i.fields),this.isCreditCardVaultedForm=ke(i.fields)&&!this.hasUndefinedValues(),yield this.paymentIntegrationService.loadPaymentMethod(t),yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(t,void 0,!0,!0),(this.isCreditCardForm||this.isCreditCardVaultedForm)&&(yield this.initializeFields(i,o)),null==a||a(),this.shouldInitializePayPalFastlane(t)&&(yield this.initializePayPalFastlaneOrThrow(t))})}execute(e,t){return ze(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]),{methodId:i,paymentData:o}=n||{};if(!n||!i)throw new V(["payment"]);if(this.executionPaymentData=o,this.isCreditCardForm||this.isCreditCardVaultedForm)yield this.validateHostedFormOrThrow(),yield this.submitHostedForm();else{const{orderId:e}=yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",this.getInstrumentParams());this.returnedOrderId=e}const a=this.preparePaymentPayload(i,o,this.returnedOrderId,this.returnedVaultedToken);yield this.paymentIntegrationService.submitOrder(r,t),yield this.paymentIntegrationService.submitPayment(a)})}finalize(){return Promise.reject(new $)}deinitialize(){var e,t,n,r;return ze(this,void 0,void 0,function*(){return yield null===(e=this.cvvField)||void 0===e?void 0:e.close(),yield null===(t=this.expiryField)||void 0===t?void 0:t.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(e,t,n,r){const{shouldSaveInstrument:i=!1,shouldSetAsDefaultInstrument:o=!1}=H(t)?t:{},a=t&&W(t)?t.instrumentId:void 0,s=(0,g.omitBy)({verification_nonce:r,token:a},g.isNil);return{methodId:e,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(e,t){return ze(this,void 0,void 0,function*(){const{fields:n,styles:r}=e,i=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),o=this.getExecuteCallback(n),a=Object.assign({style:this.getInputStyles(r),onApprove:({orderID:e,vaultSetupToken:t,liabilityShift:n})=>{if(n===P.No||n===P.Unknown)throw new Error;return this.handleApprove({orderID:e,vaultSetupToken:t})},onError:()=>{throw new Ee},inputEvents:{onChange:t=>this.onChangeHandler(e,t),onFocus:t=>this.onFocusHandler(e,t),onBlur:t=>this.onBlurHandler(e,t),onInputSubmitRequest:t=>this.onInputSubmitRequest(e,t)}},o);if(this.cardFields=yield i.CardFields(a),!this.cardFields.isEligible())throw new xe(je.PaymentNotInitialized);try{this.stylizeInputContainers(n),Ae(n)&&(yield this.renderFields(n)),ke(n)&&(yield this.renderVaultedFields(n))}catch(e){"function"==typeof t&&t(e)}})}getExecuteCallback(e){return ke(e)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>ze(this,void 0,void 0,function*(){const{setupToken:e}=(yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",Object.assign(Object.assign({},this.getInstrumentParams()),{setupToken:!0})))||{};return e})}}createOrderCallback(){return{createOrder:()=>ze(this,void 0,void 0,function*(){const{orderId:e}=(yield this.bigCommercePaymentsIntegrationService.createOrderCardFields("bigcommerce_payments_creditcardscheckout",this.getInstrumentParams()))||{};return e})}}handleApprove({orderID:e,vaultSetupToken:t}){e&&(this.returnedOrderId=e),t&&(this.returnedVaultedToken=t)}renderFields(e){var t,n,r,i;return ze(this,void 0,void 0,function*(){const o=this.getCardFieldsOrThrow();(null===(t=e.cardCode)||void 0===t?void 0:t.containerId)&&(this.cvvField=o.CVVField({placeholder:""}),yield this.cvvField.render(`#${e.cardCode.containerId}`)),(null===(n=e.cardExpiry)||void 0===n?void 0:n.containerId)&&(this.expiryField=o.ExpiryField(),yield this.expiryField.render(`#${e.cardExpiry.containerId}`)),(null===(r=e.cardName)||void 0===r?void 0:r.containerId)&&(this.nameField=o.NameField({placeholder:""}),yield this.nameField.render(`#${e.cardName.containerId}`)),(null===(i=e.cardNumber)||void 0===i?void 0:i.containerId)&&(this.numberField=o.NumberField({placeholder:""}),yield this.numberField.render(`#${e.cardNumber.containerId}`))})}renderVaultedFields(e){var t,n,r;return ze(this,void 0,void 0,function*(){const i=this.getCardFieldsOrThrow();(null===(t=e.cardCodeVerification)||void 0===t?void 0:t.containerId)&&(this.cvvField=i.CVVField({placeholder:""}),yield this.cvvField.render(`#${e.cardCodeVerification.containerId}`)),(null===(n=e.cardExpiryVerification)||void 0===n?void 0:n.containerId)&&(this.expiryField=i.ExpiryField(),yield this.expiryField.render(`#${e.cardExpiryVerification.containerId}`)),(null===(r=e.cardNumberVerification)||void 0===r?void 0:r.containerId)&&(this.numberField=i.NumberField({placeholder:""}),yield this.numberField.render(`#${e.cardNumberVerification.containerId}`))})}getInstrumentParams(){if(!this.executionPaymentData)return{};if(H(this.executionPaymentData)){const{shouldSaveInstrument:e,shouldSetAsDefaultInstrument:t}=this.executionPaymentData;return{shouldSaveInstrument:e,shouldSetAsDefaultInstrument:t}}if(W(this.executionPaymentData)){const{instrumentId:e}=this.executionPaymentData;return{instrumentId:e}}return{}}getFieldTypeByEmittedField({emittedBy:e}){return{fieldType:this.mapFieldType(e)}}submitHostedForm(){return ze(this,void 0,void 0,function*(){const e=this.getCardFieldsOrThrow(),t=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),n={billingAddress:{company:t.company,addressLine1:t.address1,addressLine2:t.address2,adminArea1:t.stateOrProvinceCode,adminArea2:t.city,postalCode:t.postalCode,countryCode:t.countryCode}};try{this.isCreditCardVaultedForm?yield e.submit():yield e.submit(n)}catch(e){throw new Ee("Failed authentication. Please try to authorize again.")}})}validateHostedFormOrThrow(){var e,t;return ze(this,void 0,void 0,function*(){const n=this.getCardFieldsOrThrow(),r=yield n.getState().then(e=>e),i=this.getValidityData(r);if(!i.isValid)throw null===(t=null===(e=this.hostedFormOptions)||void 0===e?void 0:e.onValidate)||void 0===t||t.call(e,i),new Te(this.mapValidationErrors(i.errors))})}getValidityData({fields:e}){const t=Object.assign({},e);delete t.cardNameField;const n=Object.keys(t);return{isValid:n.every(e=>{var n;return null===(n=t[e])||void 0===n?void 0:n.isValid}),errors:n.reduce((e,n)=>{var r;const i=this.mapFieldType(n);return Object.assign(Object.assign({},e),{[i]:(null===(r=t[n])||void 0===r?void 0:r.isValid)?void 0:[this.getInvalidErrorByFieldType(i)]})},{})}}getInvalidErrorByFieldType(e){switch(e){case Oe.CardCode:case Oe.CardCodeVerification:return{fieldType:e,message:"Invalid card code",type:"invalid_card_code"};case Oe.CardNumber:case Oe.CardNumberVerification:return{fieldType:e,message:"Invalid card number",type:"invalid_card_number"};case Oe.CardExpiry:case Oe.CardExpiryVerification:return{fieldType:e,message:"Invalid card expiry",type:"invalid_card_expiry"};default:return{fieldType:e,message:"Invalid field",type:"invalid"}}}mapValidationErrors(e={}){const t={};return Object.keys(e).forEach(n=>{var r,i;t[n]=[{message:(null===(i=null===(r=e[n])||void 0===r?void 0:r[0])||void 0===i?void 0:i.message)||"",type:n}]}),t}mapFieldType(e){switch(e){case"name":return Oe.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?Oe.CardNumber:Oe.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?Oe.CardExpiry:Oe.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?Oe.CardCode:Oe.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new xe(je.PaymentNotInitialized);return this.cardFields}getInputStyles(e){var t,n,r;const i={"font-size":(null===(t=null==e?void 0:e.default)||void 0===t?void 0:t.fontSize)||"1rem","font-family":(null===(n=null==e?void 0:e.default)||void 0===n?void 0:n.fontFamily)||"Montserrat, Arial, Helvetica, sans-serif","font-weight":(null===(r=null==e?void 0:e.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(e){Object.values(e||{}).forEach(e=>{const t=document.getElementById(`${(null==e?void 0:e.containerId)||""}`);t&&(t.style.padding="0px",t.style.boxShadow="none",t.style.border="none",t.style.background="transparent",t.style.marginBottom="10px",t.style.marginLeft="-5px")})}hasUndefinedValues(){return!this.hostedFormOptions||Object.values(this.hostedFormOptions.fields).some(e=>void 0===e)}onChangeHandler(e,t){var n;null===(n=null==e?void 0:e.onValidate)||void 0===n||n.call(e,this.getValidityData(t))}onFocusHandler(e,t){var n;null===(n=null==e?void 0:e.onFocus)||void 0===n||n.call(e,this.getFieldTypeByEmittedField(t))}onBlurHandler(e,t){var n;null===(n=null==e?void 0:e.onBlur)||void 0===n||n.call(e,this.getFieldTypeByEmittedField(t))}onInputSubmitRequest(e,t){var n;null===(n=null==e?void 0:e.onEnter)||void 0===n||n.call(e,this.getFieldTypeByEmittedField(t))}shouldInitializePayPalFastlane(e){var t,n;const r=this.paymentIntegrationService.getState(),i=r.getPaymentMethodOrThrow(e),o=r.getPaymentProviderCustomer(),a=(s=o)&&("authenticationState"in s||"addresses"in s||"instruments"in s)?o:{};var s;return(null===(t=null==i?void 0:i.initializationData)||void 0===t?void 0:t.isAcceleratedCheckoutEnabled)&&(null===(n=null==i?void 0:i.initializationData)||void 0===n?void 0:n.isBigCommercePaymentsAnalyticsV2Enabled)&&!(null==a?void 0:a.authenticationState)}initializePayPalFastlaneOrThrow(e){return ze(this,void 0,void 0,function*(){try{const t=this.paymentIntegrationService.getState(),n=t.getCartOrThrow(),r=t.getPaymentMethodOrThrow(e),{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(e){}})}}const Fe=l(e=>new Be(e,N(e),u(),ue()),[{id:"bigcommerce_payments_creditcards"}]);var Me=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class De{constructor(e,t,n,r,i=3e3,o=3e5){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.bigCommercePaymentsSdkHelper=n,this.loadingIndicator=r,this.pollingInterval=i,this.maxPollingIntervalTime=o,this.pollingTimer=0,this.stopPolling=g.noop,this.isPollingEnabled=!1}initialize(e){return Me(this,void 0,void 0,function*(){const{gatewayId:t,methodId:n,bigcommerce_payments_apms:r}=e;if(this.bigCommercePaymentsAlternativeMethods=r,!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new L('Unable to initialize payment because "options.bigcommerce_payments_apms" argument is not provided.');const i=this.paymentIntegrationService.getState(),o=i.getPaymentMethodOrThrow(n,t),{orderId:a,shouldRenderFields:s}=o.initializationData||{},c=i.getStoreConfigOrThrow().checkoutSettings.features;this.isPollingEnabled=pe(c,"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,t,r),s&&this.renderFields(n,r))})}execute(e,t){return Me(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]);if(!n)throw new V(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new q;this.isPollingEnabled&&"ideal"===i&&(yield new Promise((e,t)=>{this.initializePollingMechanism(i,e,t,o)})),this.isNonInstantPaymentMethod(i)||(yield this.paymentIntegrationService.submitOrder(r,t)),yield this.bigCommercePaymentsIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new $)}deinitialize(){var e;return this.orderId=void 0,this.isPollingEnabled&&this.resetPollingMechanism(),null===(e=this.bigCommercePaymentsButton)||void 0===e||e.close(),Promise.resolve()}initializePollingMechanism(e,t,n,r){return Me(this,void 0,void 0,function*(){yield new Promise((e,t)=>{const n=setTimeout(e,this.pollingInterval);this.stopPolling=()=>(clearTimeout(n),this.toggleLoadingIndicator(!1),t())});try{this.pollingTimer+=this.pollingInterval;const i=yield this.bigCommercePaymentsIntegrationService.getOrderStatus(r),o=i===k.Approved,a=i===k.PollingError;if(o)return this.deInitializePollingMechanism(),t();if(a)return n();if(!o&&this.pollingTimer<this.maxPollingIntervalTime)return yield this.initializePollingMechanism(e,t,n,r);yield this.reinitializeStrategy({methodId:e,gatewayId:r,bigCommercePaymentsAlternativeMethods:this.bigCommercePaymentsAlternativeMethods}),this.handleError(new we)}catch(e){n()}})}deInitializePollingMechanism(){this.stopPolling(),this.pollingTimer=0}resetPollingMechanism(){this.deInitializePollingMechanism()}reinitializeStrategy(e){return Me(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(e)})}handleError(e){const{onError:t}=this.bigCommercePaymentsAlternativeMethods||{};this.isPollingEnabled&&this.resetPollingMechanism(),this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}renderButton(e,t,n){const r=this.getPaypalAmpsSdkOrThrow(),i=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e,t),{buttonStyle:o}=i.initializationData||{},{container:a,onError:s,onRenderButton:c,submitForm:u}=n,l={fundingSource:e,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),onInit:(e,t)=>n.onInitButton(t),createOrder:()=>this.onCreateOrder(e,t,n),onApprove:e=>this.handleApprove(e,u),onCancel:()=>{this.toggleLoadingIndicator(!1),this.deInitializePollingMechanism()},onError:e=>{this.deInitializePollingMechanism(),this.handleFailure(e,s)},onClick:(e,t)=>Me(this,void 0,void 0,function*(){return n.onValidate(t.resolve,t.reject)})};this.bigCommercePaymentsButton=r.Buttons(l),this.bigCommercePaymentsButton.isEligible()&&(c&&"function"==typeof c&&c(),this.bigCommercePaymentsButton.render(a))}onCreateOrder(e,t,n){return Me(this,void 0,void 0,function*(){const{onValidate:r}=n;yield r(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),g.noop);const i=yield this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apms");if(this.isNonInstantPaymentMethod(e)){const n={useStoreCredit:!1},r={params:{methodId:e,gatewayId:t}};yield this.paymentIntegrationService.submitOrder(n,r),yield this.bigCommercePaymentsIntegrationService.submitPayment(e,i,t)}return i})}handleApprove({orderID:e},t){this.orderId=e,t()}handleFailure(e,t){this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}renderFields(e,t){const n=this.getPaypalAmpsSdkOrThrow(),r=this.paymentIntegrationService.getState(),{firstName:i,lastName:o,email:a}=r.getBillingAddressOrThrow(),{apmFieldsContainer:s,apmFieldsStyles:c}=t;if(!s)throw new L('Unable to initialize payment because "options.bigcommerce_payments_apms" argument should contain "apmFieldsContainer".');const u=document.querySelector(s);u&&(u.innerHTML="");const l={fundingSource:e,style:c||{},fields:{name:{value:`${i} ${o}`},email:{value:a}}};n.PaymentFields(l).render(s)}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isNonInstantPaymentMethod(e){return e.toUpperCase()in A}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new o;return this.paypalApms}}const Ue=l(e=>new De(e,N(e),u(),new p({containerStyles:f})),[{gateway:"bigcommerce_payments_apms"}]);class Ne{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t}initialize(e){const{gatewayId:t,methodId:n,bigcommerce_payments_apms:r}=e;if(this.bigCommercePaymentsAlternativeMethods=r,!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.gatewayId" argument is not provided.');return Promise.resolve()}execute(e,t){return n=this,r=void 0,o=function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]);if(!n)throw new V(["payment"]);const{methodId:i,gatewayId:o}=n;try{const e={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:i,paypal_account:{order_id:yield this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apms",{gatewayId:"bigcommerce_payments_apms",methodId:i})}}};yield this.paymentIntegrationService.submitOrder(r,t),yield this.paymentIntegrationService.submitPayment({methodId:i,gatewayId:o,paymentData:e})}catch(e){if(function(e){var t,n;return(e=>"object"==typeof e&&null!==e&&"body"in e)(e)&&(null===(n=null===(t=e.body)||void 0===t?void 0:t.additional_action_required)||void 0===n?void 0:n.data.redirect_url)}(e)){const t=e.body.additional_action_required.data.redirect_url;return new Promise((e,n)=>{window.location.replace(t),n()})}return this.handleError(e),Promise.reject(e)}},new((i=void 0)||(i=Promise))(function(e,t){function a(e){try{c(o.next(e))}catch(e){t(e)}}function s(e){try{c(o.throw(e))}catch(e){t(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i(function(e){e(n)})).then(a,s)}c((o=o.apply(n,r||[])).next())});var n,r,i,o}finalize(){return Promise.reject(new $)}deinitialize(){return Promise.resolve()}handleError(e){const{onError:t}=this.bigCommercePaymentsAlternativeMethods||{};t&&"function"==typeof t&&t(e)}}const Re=l(e=>new Ne(e,N(e)),[{gateway:"bigcommerce_payments_apms",id:"klarna"},{gateway:"bigcommerce_payments_apms",id:"afterpay"}]);var Le=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Ve{constructor(e,t,n){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.loadingIndicator=n}initialize(e){var t,n;return Le(this,void 0,void 0,function*(){const{methodId:r,bigcommerce_payments_venmo:i}=e||{};if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new L('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===(t=o.initializationData)||void 0===t?void 0:t.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(e,t){return Le(this,void 0,void 0,function*(){const{payment:n}=e,r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["payment"]);if(!n)throw new V(["payment"]);if(!this.orderId)throw new q;yield this.paymentIntegrationService.submitOrder(r,t),yield this.bigCommercePaymentsIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new $)}deinitialize(){var e;return this.orderId=void 0,null===(e=this.paypalButton)||void 0===e||e.close(),Promise.resolve()}renderButton(e,t){const n=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:c,onValidate:u,submitForm:l}=t,d={fundingSource:n.FUNDING.VENMO,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmocheckout"),onClick:(e,t)=>this.handleClick(t,u),onApprove:e=>this.handleApprove(e,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:e=>this.handleError(e,s)};if(this.paypalButton=n.Buttons(d),!this.paypalButton.isEligible())throw new ge("Venmo is not available for your region. Please another payment method instead.");c&&"function"==typeof c&&c(),this.paypalButton.render(a)}handleClick(e,t){return Le(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;yield t(()=>(this.toggleLoadingIndicator(!0),n()),r)})}handleApprove({orderID:e},t){this.orderId=e,t(),this.toggleLoadingIndicator(!1)}handleError(e,t){this.toggleLoadingIndicator(!1),t&&"function"==typeof t&&t(e)}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}}const qe=l(e=>new Ve(e,N(e),new p({styles:{backgroundColor:"black"}})),[{id:"bigcommerce_payments_venmo"}]);var $e=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class He{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.onError=g.noop}initialize(e){return $e(this,void 0,void 0,function*(){const{bigcommerce_payments:t,methodId:n}=e;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');if(!t.container)throw new L('Unable to initialize payment because "options.bigcommerce_payments.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new L('Unable to initialize payment because "options.bigcommerce_payments.onClick" argument is not a function.');this.onError=t.onError||g.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,t):console.error("[BC PayPal]: PayPal Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(e,t){return $e(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signInCustomer(e,t),Promise.resolve()})}signOut(e){return $e(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signOutCustomer(e),Promise.resolve()})}executePaymentMethodCheckout(e){var t;return null===(t=null==e?void 0:e.continueWithCheckoutCallback)||void 0===t||t.call(e),Promise.resolve()}renderButton(e,t){var n,r;const{container:i,onClick:o,onComplete:a}=t,s=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:u,paymentButtonStyles:l,isAppSwitchEnabled:d=!1}=c.initializationData||{},{checkoutTopButtonStyles:h}=l||{},p=Object.assign(Object.assign(Object.assign({},d&&{appSwitchWhenAvailable:!0}),{createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)}),o&&{onClick:()=>o()}),f=Object.assign(Object.assign({},!d&&{onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,a)}),m=Object.assign(Object.assign({fundingSource:s.FUNDING.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},h),{height:40}))},p),u&&f),y=s.Buttons(m);y.isEligible()?(null===(n=y.hasReturned)||void 0===n?void 0:n.call(y))&&d?null===(r=y.resume)||void 0===r||r.call(y):y.render(`#${i}`):this.bigCommercePaymentsIntegrationService.removeElement(i)}onHostedCheckoutApprove(t,n,r,i){return $e(this,void 0,void 0,function*(){if(!t.orderID)throw new a(e.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),s=yield n.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(s);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const e=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(s);yield this.paymentIntegrationService.updateShippingAddress(e),yield this.bigCommercePaymentsIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(r,t.orderID),i&&"function"==typeof i&&i()}catch(e){this.handleError(e)}})}onShippingAddressChange(e){return $e(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getAddress({city:e.shippingAddress.city,countryCode:e.shippingAddress.countryCode,postalCode:e.shippingAddress.postalCode,stateOrProvinceCode:e.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(t),yield this.paymentIntegrationService.updateShippingAddress(t);const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}onShippingOptionsChange(e){return $e(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}handleError(e){if("function"!=typeof this.onError)throw e;this.onError(e)}}const We=l(e=>new He(e,N(e)),[{id:"bigcommerce_payments"}]);var Ge=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Ke{constructor(e,t,n){this.paymentIntegrationService=e,this.bigCommercePaymentsSdk=t,this.bigCommercePaymentsFastlaneUtils=n}initialize(e){var t;return Ge(this,void 0,void 0,function*(){const{methodId:n,bigcommerce_payments_fastlane:r}=e;if(!n)throw new L('Unable to proceed because "methodId" argument is not provided.');try{yield this.paymentIntegrationService.loadPaymentMethod(n);const e=this.paymentIntegrationService.getState(),i=e.getCartOrThrow(),o=e.getPaymentMethodOrThrow(n),a=!!(null===(t=o.initializationData)||void 0===t?void 0:t.isDeveloperModeApplicable),s=yield this.bigCommercePaymentsSdk.getPayPalFastlaneSdk(o,i.currency.code,i.id);yield this.bigCommercePaymentsFastlaneUtils.initializePayPalFastlane(s,a,this.getFastlaneStyles(n,r))}catch(e){}return Promise.resolve()})}deinitialize(){return Ge(this,void 0,void 0,function*(){return Promise.resolve()})}signIn(e,t){return Ge(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t)})}signOut(e){return Ge(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(e)})}executePaymentMethodCheckout(e){return Ge(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:t,continueWithCheckoutCallback:n,methodId:r}=e||{};if(!r)throw new L('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new L('Unable to proceed because "continueWithCheckoutCallback" argument is not provided and it must be a function.');if(this.paymentIntegrationService.getState().getCustomerOrThrow().isGuest){t&&"function"==typeof t&&t();try{yield this.runPayPalAuthenticationFlowOrThrow(r)}catch(e){}}n()})}runPayPalAuthenticationFlowOrThrow(e){return Ge(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState(),n=t.getCartOrThrow().id,r=t.getCustomer(),i=t.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),c=s.authenticationState===oe.CANCELED;yield this.updateCustomerDataState(e,s),c?this.bigCommercePaymentsFastlaneUtils.removeStorageSessionId():this.bigCommercePaymentsFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(e,t){var n;return Ge(this,void 0,void 0,function*(){const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:c}=this.bigCommercePaymentsFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(e,t);if(yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:i,addresses:o,instruments:c}),a&&(yield this.paymentIntegrationService.updateBillingAddress(a)),s&&r.lineItems.physicalItems.length>0){const t=yield this.paymentIntegrationService.updateShippingAddress(s),r=t.getPaymentMethodOrThrow(e),{isFastlaneShippingOptionAutoSelectEnabled:i}=r.initializationData||{},o=t.getConsignments()||[],a=(null===(n=o[0])||void 0===n?void 0:n.availableShippingOptions)||[],c=a[0],u=a.find(e=>e.isRecommended);if((u||c)&&i){const e=(null==u?void 0:u.id)||c.id;yield this.paymentIntegrationService.selectShippingOption(e)}}})}getFastlaneStyles(e,t){const n=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{fastlaneStyles:r,isFastlaneStylingEnabled:i}=n.initializationData||{};return de(i?r:{},null==t?void 0:t.styles)}}const Ye=l(e=>new Ke(e,u(),ue()),[{id:"bigcommerce_payments_fastlane"},{id:"bigcommerce_payments_creditcards"}]);var Je=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class Ze{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.onError=g.noop}initialize(e){return Je(this,void 0,void 0,function*(){const{bigcommerce_payments_paylater:t,methodId:n}=e;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');if(!t.container)throw new L('Unable to initialize payment because "options.bigcommerce_payments_paylater.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new L('Unable to initialize payment because "options.bigcommerce_payments_paylater.onClick" argument is not a function.');this.onError=t.onError||g.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,t):console.error("[BC BigCommercePayments PayLater]: button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(e,t){return Je(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t)})}signOut(e){return Je(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(e)})}executePaymentMethodCheckout(e){var t;return null===(t=null==e?void 0:e.continueWithCheckoutCallback)||void 0===t||t.call(e),Promise.resolve()}renderButton(e,t){const{container:n,onComplete:r,onClick:i}=t,o=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:s,paymentButtonStyles:c}=a.initializationData||{},{checkoutTopButtonStyles:u}=c||{},l=Object.assign({createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)},i&&{onClick:()=>i()}),d={onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e),onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,r)},h=[o.FUNDING.PAYLATER,o.FUNDING.CREDIT];let p=!1;h.forEach(e=>{if(!p){const t=Object.assign(Object.assign({fundingSource:e,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},u),{height:40}))},l),s&&d),r=o.Buttons(t);r.isEligible()&&(r.render(`#${n}`),p=!0)}}),p||this.bigCommercePaymentsIntegrationService.removeElement(n)}onHostedCheckoutApprove(t,n,r,i){return Je(this,void 0,void 0,function*(){if(!t.orderID)throw new a(e.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),s=yield n.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(s);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const e=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(s);yield this.paymentIntegrationService.updateShippingAddress(e),yield this.bigCommercePaymentsIntegrationService.updateOrder()}yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(r,t.orderID),i&&"function"==typeof i&&i()}catch(e){this.handleError(e)}})}onShippingAddressChange(e){return Je(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getAddress({city:e.shippingAddress.city,countryCode:e.shippingAddress.countryCode,postalCode:e.shippingAddress.postalCode,stateOrProvinceCode:e.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(t),yield this.paymentIntegrationService.updateShippingAddress(t);const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}onShippingOptionsChange(e){return Je(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}handleError(e){if("function"!=typeof this.onError)throw e;this.onError(e)}}const Xe=l(e=>new Ze(e,N(e)),[{id:"bigcommerce_payments_paylater"}]);var Qe=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class et{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t}initialize(e){return Qe(this,void 0,void 0,function*(){const{bigcommerce_payments_venmo:t,methodId:n}=e;if(!n)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments_venmo" argument is not provided.');if(!t.container)throw new L('Unable to initialize payment because "options.bigcommerce_payments_venmo.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new L('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,t):console.error("[BC Payments Venmo]: Button could not be rendered, due to issues with loading PayPal SDK")})}deinitialize(){return Promise.resolve()}signIn(e,t){return Qe(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t)})}signOut(e){return Qe(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(e)})}executePaymentMethodCheckout(e){var t;return null===(t=null==e?void 0:e.continueWithCheckoutCallback)||void 0===t||t.call(e),Promise.resolve()}renderButton(e,t){const{container:n,onClick:r}=t,i=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:a}=o.initializationData||{},{checkoutTopButtonStyles:s}=a||{},c=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},s),{height:40})),createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmo"),onApprove:({orderID:t})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(e,t)},r&&{onClick:()=>r()}),u=i.Buttons(c);u.isEligible()?u.render(`#${n}`):this.bigCommercePaymentsIntegrationService.removeElement(n)}}const tt=l(e=>new et(e,N(e)),[{id:"bigcommerce_payments_venmo"}]);var nt=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class rt{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t}initialize(e){var t;return nt(this,void 0,void 0,function*(){const{bigcommerce_payments:n,containerId:r,methodId:i}=e,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.bigcommerce_payments" argument is not provided.');if(o&&!n.currencyCode)throw new L('Unable to initialize payment because "options.bigcommerce_payments.currencyCode" argument is not provided.');if(o&&"function"!=typeof(null===(t=n.buyNowInitializeOptions)||void 0===t?void 0:t.getBuyNowCartRequestBody))throw new L('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,o)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n,r){var i,o;const{buyNowInitializeOptions:a,style:s,onComplete:c,onEligibilityFailure:u}=n,l=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),d=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:h,isAppSwitchEnabled:p}=d.initializationData||{},f=Object.assign(Object.assign({},!r&&this.isPaypalCommerceAppSwitchEnabled(t)&&{appSwitchWhenAvailable:!0}),{createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)}),m={onClick:()=>this.handleClick(a),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},y=Object.assign(Object.assign({},!p&&{onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,c)}),g=Object.assign(Object.assign(Object.assign({fundingSource:l.FUNDING.PAYPAL,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(s)},f),a&&m),h&&y),v=l.Buttons(g);v.isEligible()?(null===(i=v.hasReturned)||void 0===i?void 0:i.call(v))&&this.isPaypalCommerceAppSwitchEnabled(t)?null===(o=v.resume)||void 0===o||o.call(v):v.render(`#${e}`):u&&"function"==typeof u?u():this.bigCommercePaymentsIntegrationService.removeElement(e)}handleClick(e){return nt(this,void 0,void 0,function*(){if(e){const t=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}onHostedCheckoutApprove(t,n,r,i){return nt(this,void 0,void 0,function*(){if(!t.orderID)throw new a(e.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),s=yield n.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(s);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const e=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(s);yield this.paymentIntegrationService.updateShippingAddress(e),yield this.bigCommercePaymentsIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(r,t.orderID),i&&"function"==typeof i&&i(),!0}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingAddressChange(e){return nt(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getAddress({city:e.shippingAddress.city,countryCode:e.shippingAddress.countryCode,postalCode:e.shippingAddress.postalCode,stateOrProvinceCode:e.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(t),yield this.paymentIntegrationService.updateShippingAddress(t);const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingOptionsChange(e){return nt(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}isPaypalCommerceAppSwitchEnabled(e){var t,n;return null!==(n=null===(t=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e).initializationData)||void 0===t?void 0:t.isAppSwitchEnabled)&&void 0!==n&&n}}const it=l(e=>new rt(e,N(e)),[{id:"bigcommerce_payments"}]);var ot=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class at{constructor(e,t,n){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t,this.payPalSdkHelper=n}initialize(e){return ot(this,void 0,void 0,function*(){const{bigcommerce_payments_paylater:t,containerId:n,methodId:r}=e,{buyNowInitializeOptions:i,currencyCode:o,messagingContainerId:a}=t||{},s=!!i;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments_paylater" argument is not provided.');if(s&&!o)throw new L('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 L('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 c=this.paymentIntegrationService.getState(),u=s?o:c.getCartOrThrow().currency.code;yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(r,u,!1),this.renderButton(n,r,t);const l=a&&document.getElementById(a);if(u&&l){const e=c.getPaymentMethodOrThrow(r),{paypalBNPLConfiguration:t=[]}=e.initializationData||{},n=t&&t.find(({id:e})=>"cart"===e);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(e,u);this.renderMessages(i,a,n)}})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:u}=c.initializationData||{},l={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_paylater"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},d={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h={onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e),onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,o)},p=[s.FUNDING.PAYLATER,s.FUNDING.CREDIT];let f=!1;p.forEach(t=>{if(!f){const n=Object.assign(Object.assign(Object.assign({fundingSource:t,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(i)},l),r&&d),u&&h),o=s.Buttons(n);o.isEligible()?(o.render(`#${e}`),f=!0):a&&"function"==typeof a&&a()}}),f||this.bigCommercePaymentsIntegrationService.removeElement(e)}handleClick(e){return ot(this,void 0,void 0,function*(){if(e){const t=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}onHostedCheckoutApprove(t,n,r,i){return ot(this,void 0,void 0,function*(){if(!t.orderID)throw new a(e.MissingOrderId);const o=this.paymentIntegrationService.getState().getCartOrThrow(),s=yield n.order.get();try{const e=this.bigCommercePaymentsIntegrationService.getBillingAddressFromOrderDetails(s);if(yield this.paymentIntegrationService.updateBillingAddress(e),o.lineItems.physicalItems.length>0){const e=this.bigCommercePaymentsIntegrationService.getShippingAddressFromOrderDetails(s);yield this.paymentIntegrationService.updateShippingAddress(e),yield this.bigCommercePaymentsIntegrationService.updateOrder()}return yield this.paymentIntegrationService.submitOrder({},{params:{methodId:r}}),yield this.bigCommercePaymentsIntegrationService.submitPayment(r,t.orderID),i&&"function"==typeof i&&i(),!0}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingAddressChange(e){return ot(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getAddress({city:e.shippingAddress.city,countryCode:e.shippingAddress.countryCode,postalCode:e.shippingAddress.postalCode,stateOrProvinceCode:e.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(t),yield this.paymentIntegrationService.updateShippingAddress(t);const e=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingOptionsChange(e){return ot(this,void 0,void 0,function*(){const t=this.bigCommercePaymentsIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.bigCommercePaymentsIntegrationService.updateOrder()}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}renderMessages(e,t,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"cart",style:R(n)};e.Messages(r).render(`#${t}`)}}const st=l(e=>new at(e,N(e),u()),[{id:"bigcommerce_payments_paylater"}]);var ct=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class ut{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t}initialize(e){return ct(this,void 0,void 0,function*(){const{bigcommerce_payments_apms:t,containerId:n,methodId:r}=e,{apm:i,buyNowInitializeOptions:o,currencyCode:a}=t||{},s=!!o;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments_apms" argument is not provided.');if(!i)throw new L('Unable to initialize payment because "options.bigcommerce_payments_apms.apm" argument is not provided.');if(s&&!a)throw new L('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 L('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 c=s?a:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.bigCommercePaymentsIntegrationService.loadPayPalSdk(r,c,!1),this.renderButton(n,r,t)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{apm:r,buyNowInitializeOptions:i,style:o,onEligibilityFailure:a}=n,s=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow();if(!Object.values(s.FUNDING).includes(r))throw new L('Unable to initialize PayPal button because "options.bigcommerce_payments_apms.apm" argument is not valid funding source.');const c={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_apms"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},u={onClick:()=>this.handleClick(i),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:r,style:this.bigCommercePaymentsIntegrationService.getValidButtonStyle(o)},c),i&&u),d=s.Buttons(l);d.isEligible()?d.render(`#${e}`):a&&"function"==typeof a?a():this.bigCommercePaymentsIntegrationService.removeElement(e)}handleClick(e){return ct(this,void 0,void 0,function*(){if(e){const t=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}}const lt=l(e=>new ut(e,N(e)),[{id:"bigcommerce_payments_apms"}]);var dt=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}c((r=r.apply(e,t||[])).next())})};class ht{constructor(e,t){this.paymentIntegrationService=e,this.bigCommercePaymentsIntegrationService=t}initialize(e){return dt(this,void 0,void 0,function*(){const{bigcommerce_payments_venmo:t,containerId:n,methodId:r}=e,{buyNowInitializeOptions:i,currencyCode:o}=t||{},a=!!i;if(!r)throw new L('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new L('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new L('Unable to initialize payment because "options.bigcommerce_payments_venmo" argument is not provided.');if(a&&!o)throw new L('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 L('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,t)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{buyNowInitializeOptions:r,style:i,onEligibilityFailure:o}=n,a=this.bigCommercePaymentsIntegrationService.getPayPalSdkOrThrow(),s=a.FUNDING.VENMO,c={createOrder:()=>this.bigCommercePaymentsIntegrationService.createOrder("bigcommerce_payments_venmo"),onApprove:({orderID:e})=>this.bigCommercePaymentsIntegrationService.tokenizePayment(t,e)},u={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:s,style:this.getValidVenmoButtonStyles(i)},c),r&&u),d=a.Buttons(l);d.isEligible()?d.render(`#${e}`):o&&"function"==typeof o?o():this.bigCommercePaymentsIntegrationService.removeElement(e)}getValidVenmoButtonStyles(e){const t=this.bigCommercePaymentsIntegrationService.getValidButtonStyle(e);return t.color===C.gold?Object.assign(Object.assign({},t),{color:void 0}):t}handleClick(e){return dt(this,void 0,void 0,function*(){if(e){const t=yield this.bigCommercePaymentsIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}}const pt=l(e=>new ht(e,N(e)),[{id:"bigcommerce_payments_venmo"}])})(),module.exports=r})();
3
3
  //# sourceMappingURL=bigcommerce-payments.js.map