@bigcommerce/checkout-sdk 1.945.0 → 1.946.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/cjs/checkout-button.js +1 -1
  2. package/dist/cjs/checkout-sdk-essential.js +1 -1
  3. package/dist/cjs/checkout-sdk.js +1 -1
  4. package/dist/cjs/hosted-form-v2-iframe-host.js +1 -1
  5. package/dist/cjs/integrations/amazon-pay.js +1 -1
  6. package/dist/cjs/integrations/bigcommerce-payments.js +1 -1
  7. package/dist/cjs/integrations/braintree.js +1 -1
  8. package/dist/cjs/integrations/google-pay.js +1 -1
  9. package/dist/cjs/integrations/klarna.js +1 -1
  10. package/dist/cjs/integrations/paypal-commerce.js +1 -1
  11. package/dist/cjs/integrations/paypal-commerce.js.map +1 -1
  12. package/dist/cjs/integrations/paypal-express.js +1 -1
  13. package/dist/cjs/integrations/zip.js +1 -1
  14. package/dist/cjs/wallet-button.js +1 -1
  15. package/dist/cjs/wallet-button.js.map +1 -1
  16. package/dist/esm/checkout-button.js +1 -1
  17. package/dist/esm/checkout-sdk-essential.js +1 -1
  18. package/dist/esm/checkout-sdk.js +1 -1
  19. package/dist/esm/hosted-form-v2-iframe-host.js +1 -1
  20. package/dist/esm/integrations/amazon-pay.js +1 -1
  21. package/dist/esm/integrations/bigcommerce-payments.js +1 -1
  22. package/dist/esm/integrations/braintree.js +1 -1
  23. package/dist/esm/integrations/google-pay.js +1 -1
  24. package/dist/esm/integrations/klarna.js +1 -1
  25. package/dist/esm/integrations/paypal-commerce.js +1 -1
  26. package/dist/esm/integrations/paypal-commerce.js.map +1 -1
  27. package/dist/esm/integrations/paypal-express.js +1 -1
  28. package/dist/esm/integrations/zip.js +1 -1
  29. package/dist/esm/wallet-button.js +1 -1
  30. package/dist/esm/wallet-button.js.map +1 -1
  31. package/dist/types/integrations/paypal-commerce.d.ts +27 -1
  32. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- (()=>{var e={9165(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=new r.default;return new i.default(t,e)};var r=n(9828),i=n(5470)},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},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},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)},9783(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!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}},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:"".concat(e,"?").concat(r.stringify(t))},e}()},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)}},6889(e,t,n){"use strict";n.d(t,{A:()=>i});var r=n(2024);function i(e){return new r.A(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)},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})},1675(e,t,n){"use strict";n.d(t,{A:()=>s});var r=n(1635),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.__assign)((0,r.__assign)({},e),((n={})[o.toLowerCase()]=i.join(":").trim(),n)):e},{})},e.prototype._getHeader=function(e,t){return e&&t&&(e[t]||e[t.toLowerCase()])||""},e}()},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?"".concat(e,"?").concat(r.stringify(t,{encode:n})):e},e}()},4670(e,t,n){"use strict";n.d(t,{A:()=>c});var r=n(1635),i=n(35),o=n.n(i),a=n(4325),s=n(4843),u=n(2024);const c=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 u.A&&(r.timeout.onComplete(function(){return o.abort()}),r.timeout.start()),(0,s.A)(r.timeout)&&r.timeout.then(function(){return o.abort()}),o.send(n._payloadTransformer.toRequestBody(r))})},e.prototype.get=function(e,t){return this.sendRequest(e,(0,r.__assign)((0,r.__assign)({},t),{method:"GET"}))},e.prototype.post=function(e,t){return this.sendRequest(e,(0,r.__assign)((0,r.__assign)({},t),{method:"POST"}))},e.prototype.put=function(e,t){return this.sendRequest(e,(0,r.__assign)((0,r.__assign)({},t),{method:"PUT"}))},e.prototype.patch=function(e,t){return this.sendRequest(e,(0,r.__assign)((0,r.__assign)({},t),{method:"PATCH"}))},e.prototype.delete=function(e,t){return this.sendRequest(e,(0,r.__assign)((0,r.__assign)({},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:"".concat(this._options.host.replace(/\/$/,""),"/").concat(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}()},2024(e,t,n){"use strict";n.d(t,{A:()=>r});const r=function(){function e(e){var t=this;this._delay=e,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(),void 0!==this._timeoutToken&&clearTimeout(this._timeoutToken)},e.prototype.start=function(){var e=this;void 0!==this._delay&&(this._timeoutToken=setTimeout(function(){return e.complete()},this._delay))},e}()},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?"".concat(t,"=").concat(encodeURIComponent(n)):"".concat(t,"=").concat(encodeURIComponent(JSON.stringify(n)||""))}).join("&")}n.d(t,{A:()=>r})},5889(e,t,n){"use strict";const r=n(803),i=n(1915),o=n(1657),a=n(3814);function s(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function c(e,t){return t.decode?i(e):e}function l(e){return Array.isArray(e)?e.sort():"object"==typeof e?l(Object.keys(e)).sort((e,t)=>Number(e)-Number(t)).map(t=>e[t]):e}function d(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function p(e){const t=(e=d(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function h(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function f(e,t){s((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"==typeof n&&n.includes(e.arrayFormatSeparator),o="string"==typeof n&&!i&&c(n,e).includes(e.arrayFormatSeparator);n=o?c(n,e):n;const a=i||o?n.split(e.arrayFormatSeparator).map(t=>c(t,e)):null===n?n:c(n,e);r[t]=a};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const i of e.split("&")){if(""===i)continue;let[e,a]=o(t.decode?i.replace(/\+/g," "):i,"=");a=void 0===a?null:["comma","separator"].includes(t.arrayFormat)?a:c(a,t),n(c(e,t),a,r)}for(const e of Object.keys(r)){const n=r[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=h(n[e],t);else r[e]=h(n,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=l(n):e[t]=n,e},Object.create(null))}t.extract=p,t.parse=f,t.stringify=(e,t)=>{if(!e)return"";s((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[u(t,e),"[",i,"]"].join("")]:[...n,[u(t,e),"[",u(i,e),"]=",u(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[u(t,e),"[]"].join("")]:[...n,[u(t,e),"[]=",u(r,e)].join("")];case"comma":case"separator":return t=>(n,r)=>null==r||0===r.length?n:0===n.length?[[u(t,e),"=",u(r,e)].join("")]:[[n,u(r,e)].join(e.arrayFormatSeparator)];default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,u(t,e)]:[...n,[u(t,e),"=",u(r,e)].join("")]}}(t),i={};for(const t of Object.keys(e))n(t)||(i[t]=e[t]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map(n=>{const i=e[n];return void 0===i?"":null===i?u(n,t):Array.isArray(i)?i.reduce(r(n),[]).join("&"):u(n,t)+"="+u(i,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=o(e,"#");return Object.assign({url:n.split("?")[0]||"",query:f(p(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:c(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0},n);const r=d(e.url).split("?")[0]||"",i=t.extract(e.url),o=t.parse(i,{sort:!1}),a=Object.assign(o,e.query);let s=t.stringify(a,n);s&&(s=`?${s}`);let c=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(c=`#${u(e.fragmentIdentifier,n)}`),`${r}${s}${c}`},t.pick=(e,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0},r);const{url:i,query:o,fragmentIdentifier:s}=t.parseUrl(e,r);return t.stringifyUrl({url:i,query:a(o,n),fragmentIdentifier:s},r)},t.exclude=(e,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return t.pick(e,i,r)}},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},471(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return new o.default(new i.default,(0,r.createRequestSender)())};var r=n(4043),i=n(5477),o=n(4886)},9722(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return new o.default(new i.default,(0,r.createRequestSender)())};var r=n(4043),i=n(5477),o=n(7995)},5895(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return r||(r=(0,i.default)()),r};var r,i=n(471)},282(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return r||(r=(0,i.default)()),r};var r,i=n(9722)},315(e,t,n){"use strict";t.vQ=void 0;n(4886),n(471);var r=n(5895);Object.defineProperty(t,"vQ",{enumerable:!0,get:function(){return r.default}});n(7995),n(9722),n(282)},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,u=void 0!==s&&s,c=a.attributes,l=void 0===c?{}:c;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=u,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},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,u=void 0!==s&&s,c=a.attributes,l=void 0===c?{}:c;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,u&&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 u=document.createElement("link");u.as="style",u.rel=a?"prefetch":"preload",u.href=e,u.onload=function(){r()},u.onerror=function(t){delete n._preloadedStylesheets[e],i(t)},document.head.appendChild(u)}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},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 u=a[s];e=e.replace(new RegExp(u,"g"),t[u])}return e}(e)}}},3814(e){"use strict";e.exports=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),o=0;o<r.length;o++){var a=r[o],s=e[a];(i?-1!==t.indexOf(a):t(a,s,e))&&(n[a]=s)}return n}},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 u in o)o[u]&&(s+="; "+u,!0!==o[u]&&(s+="="+o[u].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("="),u=s.slice(1).join("=");n||'"'!==u.charAt(0)||(u=u.slice(1,-1));try{var c=t(s[0]);if(u=(r.read||r)(u,c)||t(u),n)try{u=JSON.parse(u)}catch(e){}if(i[c]=u,e===c)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()},35(e,t,n){e=n.nmd(e);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",a="[object Function]",s="[object Object]",u=/^\[object .+?Constructor\]$/,c=/^(?:0|[1-9]\d*)$/,l={};l["[object Float32Array]"]=l["[object Float64Array]"]=l["[object Int8Array]"]=l["[object Int16Array]"]=l["[object Int32Array]"]=l["[object Uint8Array]"]=l["[object Uint8ClampedArray]"]=l["[object Uint16Array]"]=l["[object Uint32Array]"]=!0,l[o]=l["[object Array]"]=l["[object ArrayBuffer]"]=l["[object Boolean]"]=l["[object DataView]"]=l["[object Date]"]=l["[object Error]"]=l[a]=l["[object Map]"]=l["[object Number]"]=l[s]=l["[object RegExp]"]=l["[object Set]"]=l["[object String]"]=l["[object WeakMap]"]=!1;var d,p,h,f="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,y="object"==typeof self&&self&&self.Object===Object&&self,m=f||y||Function("return this")(),v=t&&!t.nodeType&&t,g=v&&e&&!e.nodeType&&e,_=g&&g.exports===v,b=_&&f.process,S=function(){try{return g&&g.require&&g.require("util").types||b&&b.binding&&b.binding("util")}catch(e){}}(),w=S&&S.isTypedArray,I=Array.prototype,P=Function.prototype,C=Object.prototype,O=m["__core-js_shared__"],A=P.toString,E=C.hasOwnProperty,k=(d=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+d:"",z=C.toString,T=A.call(Object),j=RegExp("^"+A.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),x=_?m.Buffer:void 0,B=m.Symbol,F=m.Uint8Array,N=(x&&x.allocUnsafe,p=Object.getPrototypeOf,h=Object,function(e){return p(h(e))}),M=Object.create,D=C.propertyIsEnumerable,U=I.splice,R=B?B.toStringTag:void 0,L=function(){try{var e=se(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),V=x?x.isBuffer:void 0,G=Math.max,q=Date.now,$=se(m,"Map"),W=se(Object,"create"),H=function(){function e(){}return function(t){if(!_e(t))return{};if(M)return M(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 Z(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=this.__data__=new Y(e);this.size=t.size}function X(e,t,n){(void 0!==n&&!pe(e[t],n)||void 0===n&&!(t in e))&&te(e,t,n)}function Q(e,t,n){var r=e[t];E.call(e,t)&&pe(r,n)&&(void 0!==n||t in e)||te(e,t,n)}function ee(e,t){for(var n=e.length;n--;)if(pe(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 E.call(t,e)?t[e]:void 0},K.prototype.has=function(e){var t=this.__data__;return W?void 0!==t[e]:E.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():U.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},Z.prototype.clear=function(){this.size=0,this.__data__={hash:new K,map:new($||Y),string:new K}},Z.prototype.delete=function(e){var t=ae(this,e).delete(e);return this.size-=t?1:0,t},Z.prototype.get=function(e){return ae(this,e).get(e)},Z.prototype.has=function(e){return ae(this,e).has(e)},Z.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},J.prototype.clear=function(){this.__data__=new Y,this.size=0},J.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},J.prototype.get=function(e){return this.__data__.get(e)},J.prototype.has=function(e){return this.__data__.has(e)},J.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Y){var r=n.__data__;if(!$||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Z(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=E.call(e,R),n=e[R];try{e[R]=void 0;var r=!0}catch(e){}var i=z.call(e);return r&&(t?e[R]=n:delete e[R]),i}(e):function(e){return z.call(e)}(e)}function re(e){return be(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 J),_e(o))!function(e,t,n,r,i,o,a){var u=le(e,n),c=le(t,n),l=a.get(c);if(l)X(e,n,l);else{var d,p,h,f,y,m=o?o(u,c,n+"",e,t,a):void 0,v=void 0===m;if(v){var g=fe(c),_=!g&&me(c),b=!g&&!_&&Se(c);m=c,g||_||b?fe(u)?m=u:be(y=u)&&ye(y)?m=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(u):_?(v=!1,m=function(e){return e.slice()}(c)):b?(v=!1,f=new(h=(d=c).buffer).constructor(h.byteLength),new F(f).set(new F(h)),p=f,m=new d.constructor(p,d.byteOffset,d.length)):m=[]:function(e){if(!be(e)||ne(e)!=s)return!1;var t=N(e);if(null===t)return!0;var n=E.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&A.call(n)==T}(c)||he(c)?(m=u,he(u)?m=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,we(e))}(u):_e(u)&&!ve(u)||(m=function(e){return"function"!=typeof e.constructor||ce(e)?{}:H(N(e))}(c))):v=!1}v&&(a.set(c,m),i(m,c,r,o,a),a.delete(c)),X(e,n,m)}}(e,t,a,n,ie,r,i);else{var u=r?r(le(e,a),o,a+"",e,t,i):void 0;void 0===u&&(u=o),X(e,a,u)}},we)}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!(!_e(e)||function(e){return!!k&&k in e}(e))&&(ve(e)?j:u).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 ue(e,t){var n=typeof e;return!!(t=t??i)&&("number"==n||"symbol"!=n&&c.test(e))&&e>-1&&e%1==0&&e<t}function ce(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=q(),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 pe(e,t){return e===t||e!=e&&t!=t}var he=re(function(){return arguments}())?re:function(e){return be(e)&&E.call(e,"callee")&&!D.call(e,"callee")},fe=Array.isArray;function ye(e){return null!=e&&ge(e.length)&&!ve(e)}var me=V||function(){return!1};function ve(e){if(!_e(e))return!1;var t=ne(e);return t==a||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ge(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function _e(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function be(e){return null!=e&&"object"==typeof e}var Se=w?function(e){return function(t){return e(t)}}(w):function(e){return be(e)&&ge(e.length)&&!!l[ne(e)]};function we(e){return ye(e)?function(e,t){var n=fe(e),r=!n&&he(e),i=!n&&!r&&me(e),o=!n&&!r&&!i&&Se(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):[],u=s.length;for(var c in e)!t&&!E.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ue(c,u))||s.push(c);return s}(e,!0):function(e){if(!_e(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=ce(e),n=[];for(var r in e)("constructor"!=r||!t&&E.call(e,r))&&n.push(r);return n}(e)}var Ie,Pe=(Ie=function(e,t,n){ie(e,t,n)},function(e,t){return de(function(e,t,n){return t=G(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=G(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=Ie.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(e,t,n){if(!_e(n))return!1;var r=typeof t;return!!("number"==r?ye(n)&&ue(t,n.length):"string"==r&&t in n)&&pe(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&&Ie(e,a,n)}return e}));function Ce(e){return e}e.exports=Pe},9440(e,t,n){e=n.nmd(e),function(){var r,i="Expected a function",o="__lodash_hash_undefined__",a="__lodash_placeholder__",s=32,u=128,c=1/0,l=9007199254740991,d=NaN,p=4294967295,h=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],f="[object Arguments]",y="[object Array]",m="[object Boolean]",v="[object Date]",g="[object Error]",_="[object Function]",b="[object GeneratorFunction]",S="[object Map]",w="[object Number]",I="[object Object]",P="[object Promise]",C="[object RegExp]",O="[object Set]",A="[object String]",E="[object Symbol]",k="[object WeakMap]",z="[object ArrayBuffer]",T="[object DataView]",j="[object Float32Array]",x="[object Float64Array]",B="[object Int8Array]",F="[object Int16Array]",N="[object Int32Array]",M="[object Uint8Array]",D="[object Uint8ClampedArray]",U="[object Uint16Array]",R="[object Uint32Array]",L=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,$=/[&<>"']/g,W=RegExp(q.source),H=RegExp($.source),K=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\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,ue=/[()=,{}\[\]\/\s]/,ce=/\\(\\)?/g,le=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,fe=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,me=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ge=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,be="\\ud800-\\udfff",Se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",we="\\u2700-\\u27bf",Ie="a-z\\xdf-\\xf6\\xf8-\\xff",Pe="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="["+be+"]",Ee="["+Oe+"]",ke="["+Se+"]",ze="\\d+",Te="["+we+"]",je="["+Ie+"]",xe="[^"+be+Oe+ze+we+Ie+Pe+"]",Be="\\ud83c[\\udffb-\\udfff]",Fe="[^"+be+"]",Ne="(?:\\ud83c[\\udde6-\\uddff]){2}",Me="[\\ud800-\\udbff][\\udc00-\\udfff]",De="["+Pe+"]",Ue="\\u200d",Re="(?:"+je+"|"+xe+")",Le="(?:"+De+"|"+xe+")",Ve="(?:['’](?:d|ll|m|re|s|t|ve))?",Ge="(?:['’](?:D|LL|M|RE|S|T|VE))?",qe="(?:"+ke+"|"+Be+")?",$e="["+Ce+"]?",We=$e+qe+"(?:"+Ue+"(?:"+[Fe,Ne,Me].join("|")+")"+$e+qe+")*",He="(?:"+[Te,Ne,Me].join("|")+")"+We,Ke="(?:"+[Fe+ke+"?",ke,Ne,Me,Ae].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(ke,"g"),Je=RegExp(Be+"(?="+Be+")|"+Ke+We,"g"),Xe=RegExp([De+"?"+je+"+"+Ve+"(?="+[Ee,De,"$"].join("|")+")",Le+"+"+Ge+"(?="+[Ee,De+Re,"$"].join("|")+")",De+"?"+Re+"+"+Ve,De+"+"+Ge,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ze,He].join("|"),"g"),Qe=RegExp("["+Ue+be+Se+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[j]=rt[x]=rt[B]=rt[F]=rt[N]=rt[M]=rt[D]=rt[U]=rt[R]=!0,rt[f]=rt[y]=rt[z]=rt[m]=rt[T]=rt[v]=rt[g]=rt[_]=rt[S]=rt[w]=rt[I]=rt[C]=rt[O]=rt[A]=rt[k]=!1;var it={};it[f]=it[y]=it[z]=it[T]=it[m]=it[v]=it[j]=it[x]=it[B]=it[F]=it[N]=it[S]=it[w]=it[I]=it[C]=it[O]=it[A]=it[E]=it[M]=it[D]=it[U]=it[R]=!0,it[g]=it[_]=it[k]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},at=parseFloat,st=parseInt,ut="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,ct="object"==typeof self&&self&&self.Object===Object&&self,lt=ut||ct||Function("return this")(),dt=t&&!t.nodeType&&t,pt=dt&&e&&!e.nodeType&&e,ht=pt&&pt.exports===dt,ft=ht&&ut.process,yt=function(){try{return pt&&pt.require&&pt.require("util").types||ft&&ft.binding&&ft.binding("util")}catch(e){}}(),mt=yt&&yt.isArrayBuffer,vt=yt&&yt.isDate,gt=yt&&yt.isMap,_t=yt&&yt.isRegExp,bt=yt&&yt.isSet,St=yt&&yt.isTypedArray;function wt(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 It(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 Pt(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 Et(e,t){return!(null==e||!e.length)&&Dt(e,t,0)>-1}function kt(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 zt(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 Tt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function jt(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 xt(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 Nt(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function Mt(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 Dt(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):Mt(e,Rt,n)}function Ut(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?$t(e,t)/n:d}function Vt(e){return function(t){return null==t?r:t[e]}}function Gt(e){return function(t){return null==e?r:e[t]}}function qt(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}function $t(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 Ht(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 zt(t,function(t){return e[t]})}function Zt(e,t){return e.has(t)}function Jt(e,t){for(var n=-1,r=e.length;++n<r&&Dt(t,e[n],0)>-1;);return n}function Xt(e,t){for(var n=e.length;n--&&Dt(t,e[n],0)>-1;);return n}var Qt=Gt({À:"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=Gt({"&":"&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 un(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}function cn(e){return nn(e)?function(e){for(var t=Je.lastIndex=0;Je.test(e);)++t;return t}(e):Ft(e)}function ln(e){return nn(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.split("")}(e)}function dn(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var pn=Gt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hn=function e(t){var n,re=(t=null==t?lt:hn.defaults(lt.Object(),t,hn.pick(lt,tt))).Array,be=t.Date,Se=t.Error,we=t.Function,Ie=t.Math,Pe=t.Object,Ce=t.RegExp,Oe=t.String,Ae=t.TypeError,Ee=re.prototype,ke=we.prototype,ze=Pe.prototype,Te=t["__core-js_shared__"],je=ke.toString,xe=ze.hasOwnProperty,Be=0,Fe=(n=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ne=ze.toString,Me=je.call(Pe),De=lt._,Ue=Ce("^"+je.call(xe).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=ht?t.Buffer:r,Le=t.Symbol,Ve=t.Uint8Array,Ge=Re?Re.allocUnsafe:r,qe=on(Pe.getPrototypeOf,Pe),$e=Pe.create,We=ze.propertyIsEnumerable,He=Ee.splice,Ke=Le?Le.isConcatSpreadable:r,Je=Le?Le.iterator:r,Qe=Le?Le.toStringTag:r,ot=function(){try{var e=uo(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),ut=t.clearTimeout!==lt.clearTimeout&&t.clearTimeout,ct=be&&be.now!==lt.Date.now&&be.now,dt=t.setTimeout!==lt.setTimeout&&t.setTimeout,pt=Ie.ceil,ft=Ie.floor,yt=Pe.getOwnPropertySymbols,Ft=Re?Re.isBuffer:r,Gt=t.isFinite,fn=Ee.join,yn=on(Pe.keys,Pe),mn=Ie.max,vn=Ie.min,gn=be.now,_n=t.parseInt,bn=Ie.random,Sn=Ee.reverse,wn=uo(t,"DataView"),In=uo(t,"Map"),Pn=uo(t,"Promise"),Cn=uo(t,"Set"),On=uo(t,"WeakMap"),An=uo(Pe,"create"),En=On&&new On,kn={},zn=Mo(wn),Tn=Mo(In),jn=Mo(Pn),xn=Mo(Cn),Bn=Mo(On),Fn=Le?Le.prototype:r,Nn=Fn?Fn.valueOf:r,Mn=Fn?Fn.toString:r;function Dn(e){if(es(e)&&!Ga(e)&&!(e instanceof Vn)){if(e instanceof Ln)return e;if(xe.call(e,"__wrapped__"))return Do(e)}return new Ln(e)}var Un=function(){function e(){}return function(t){if(!Qa(t))return{};if($e)return $e(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__=p,this.__views__=[]}function Gn(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 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 Wn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new $n;++t<n;)this.add(e[t])}function Hn(e){var t=this.__data__=new qn(e);this.size=t.size}function Kn(e,t){var n=Ga(e),r=!n&&Va(e),i=!n&&!r&&Ha(e),o=!n&&!r&&!i&&us(e),a=n||r||i||o,s=a?Wt(e.length,Oe):[],u=s.length;for(var c in e)!t&&!xe.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||mo(c,u))||s.push(c);return s}function Yn(e){var t=e.length;return t?e[$r(0,t-1)]:r}function Zn(e,t){return jo(Oi(e),or(t,0,e.length))}function Jn(e){return jo(Oi(e))}function Xn(e,t,n){(n!==r&&!Ua(e[t],n)||n===r&&!(t in e))&&rr(e,t,n)}function Qn(e,t,n){var i=e[t];xe.call(e,t)&&Ua(i,n)&&(n!==r||t in e)||rr(e,t,n)}function er(e,t){for(var n=e.length;n--;)if(Ua(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,zs(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,u=1&t,c=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=Ga(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&xe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return Oi(e,s)}else{var p=po(e),h=p==_||p==b;if(Ha(e))return bi(e,u);if(p==I||p==f||h&&!o){if(s=c||h?{}:fo(e),!u)return c?function(e,t){return Ai(e,lo(e),t)}(e,function(e,t){return e&&Ai(t,Ts(t),e)}(s,e)):function(e,t){return Ai(e,co(e),t)}(e,nr(s,e))}else{if(!it[p])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case z:return Si(e);case m:case v:return new i(+e);case T:return function(e,t){var n=t?Si(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case j:case x:case B:case F:case N:case M:case D:case U:case R:return wi(e,n);case S:return new i;case w: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 E:return r=e,Nn?Pe(Nn.call(r)):{}}}(e,p,u)}}a||(a=new Hn);var y=a.get(e);if(y)return y;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 g=d?r:(l?c?to:eo:c?Ts:zs)(e);return Pt(g||e,function(r,i){g&&(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=Pe(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 ur(e,t,n){if("function"!=typeof e)throw new Ae(i);return Eo(function(){e.apply(r,n)},t)}function cr(e,t,n,r){var i=-1,o=Et,a=!0,s=e.length,u=[],c=t.length;if(!s)return u;n&&(t=zt(t,Kt(n))),r?(o=kt,a=!1):t.length>=200&&(o=Zt,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 p=c;p--;)if(t[p]===d)continue e;u.push(l)}else o(t,d,r)||u.push(l)}return u}Dn.templateSettings={escape:K,evaluate:Y,interpolate:Z,variable:"",imports:{_:Dn}},Dn.prototype=Rn.prototype,Dn.prototype.constructor=Dn,Ln.prototype=Un(Rn.prototype),Ln.prototype.constructor=Ln,Vn.prototype=Un(Rn.prototype),Vn.prototype.constructor=Vn,Gn.prototype.clear=function(){this.__data__=An?An(null):{},this.size=0},Gn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Gn.prototype.get=function(e){var t=this.__data__;if(An){var n=t[e];return n===o?r:n}return xe.call(t,e)?t[e]:r},Gn.prototype.has=function(e){var t=this.__data__;return An?t[e]!==r:xe.call(t,e)},Gn.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},qn.prototype.clear=function(){this.__data__=[],this.size=0},qn.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():He.call(t,n,1),--this.size,0))},qn.prototype.get=function(e){var t=this.__data__,n=er(t,e);return n<0?r:t[n][1]},qn.prototype.has=function(e){return er(this.__data__,e)>-1},qn.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},$n.prototype.clear=function(){this.size=0,this.__data__={hash:new Gn,map:new(In||qn),string:new Gn}},$n.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},$n.prototype.get=function(e){return ao(this,e).get(e)},$n.prototype.has=function(e){return ao(this,e).has(e)},$n.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)},Hn.prototype.clear=function(){this.__data__=new qn,this.size=0},Hn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Hn.prototype.get=function(e){return this.__data__.get(e)},Hn.prototype.has=function(e){return this.__data__.has(e)},Hn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof qn){var r=n.__data__;if(!In||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new $n(r)}return n.set(e,t),this.size=n.size,this};var lr=zi(gr),dr=zi(_r,!0);function pr(e,t){var n=!0;return lr(e,function(e,r,i){return n=!!t(e,r,i)}),n}function hr(e,t,n){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(u===r?s==s&&!ss(s):n(s,u)))var u=s,c=a}return c}function fr(e,t){var n=[];return lr(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function yr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=yo),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?yr(s,t-1,n,r,i):Tt(i,s):r||(i[i.length]=s)}return i}var mr=Ti(),vr=Ti(!0);function gr(e,t){return e&&mr(e,t,zs)}function _r(e,t){return e&&vr(e,t,zs)}function br(e,t){return At(t,function(t){return Za(e[t])})}function Sr(e,t){for(var n=0,i=(t=mi(t,e)).length;null!=e&&n<i;)e=e[No(t[n++])];return n&&n==i?e:r}function wr(e,t,n){var r=t(e);return Ga(e)?r:Tt(r,n(e))}function Ir(e){return null==e?e===r?"[object Undefined]":"[object Null]":Qe&&Qe in Pe(e)?function(e){var t=xe.call(e,Qe),n=e[Qe];try{e[Qe]=r;var i=!0}catch(e){}var o=Ne.call(e);return i&&(t?e[Qe]=n:delete e[Qe]),o}(e):function(e){return Ne.call(e)}(e)}function Pr(e,t){return e>t}function Cr(e,t){return null!=e&&xe.call(e,t)}function Or(e,t){return null!=e&&t in Pe(e)}function Ar(e,t,n){for(var i=n?kt:Et,o=e[0].length,a=e.length,s=a,u=re(a),c=1/0,l=[];s--;){var d=e[s];s&&t&&(d=zt(d,Kt(t))),c=vn(d.length,c),u[s]=!n&&(t||o>=120&&d.length>=120)?new Wn(s&&d):r}d=e[0];var p=-1,h=u[0];e:for(;++p<o&&l.length<c;){var f=d[p],y=t?t(f):f;if(f=n||0!==f?f:0,!(h?Zt(h,y):i(l,y,n))){for(s=a;--s;){var m=u[s];if(!(m?Zt(m,y):i(e[s],y,n)))continue e}h&&h.push(y),l.push(f)}}return l}function Er(e,t,n){var i=null==(e=Co(e,t=mi(t,e)))?e:e[No(Yo(t))];return null==i?r:wt(i,e,n)}function kr(e){return es(e)&&Ir(e)==f}function zr(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=Ga(e),u=Ga(t),c=s?y:po(e),l=u?y:po(t),d=(c=c==f?I:c)==I,p=(l=l==f?I:l)==I,h=c==l;if(h&&Ha(e)){if(!Ha(t))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new Hn),s||us(e)?Xi(e,t,n,i,o,a):function(e,t,n,r,i,o,a){switch(n){case T:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case z:return!(e.byteLength!=t.byteLength||!o(new Ve(e),new Ve(t)));case m:case v:case w:return Ua(+e,+t);case g:return e.name==t.name&&e.message==t.message;case C:case A:return e==t+"";case S:var s=rn;case O:var u=1&r;if(s||(s=sn),e.size!=t.size&&!u)return!1;var c=a.get(e);if(c)return c==t;r|=2,a.set(e,t);var l=Xi(s(e),s(t),r,i,o,a);return a.delete(e),l;case E:if(Nn)return Nn.call(e)==Nn.call(t)}return!1}(e,t,c,n,i,o,a);if(!(1&n)){var _=d&&xe.call(e,"__wrapped__"),b=p&&xe.call(t,"__wrapped__");if(_||b){var P=_?e.value():e,k=b?t.value():t;return a||(a=new Hn),o(P,k,n,i,a)}}return!!h&&(a||(a=new Hn),function(e,t,n,i,o,a){var s=1&n,u=eo(e),c=u.length;if(c!=eo(t).length&&!s)return!1;for(var l=c;l--;){var d=u[l];if(!(s?d in t:xe.call(t,d)))return!1}var p=a.get(e),h=a.get(t);if(p&&h)return p==t&&h==e;var f=!0;a.set(e,t),a.set(t,e);for(var y=s;++l<c;){var m=e[d=u[l]],v=t[d];if(i)var g=s?i(v,m,d,t,e,a):i(m,v,d,e,t,a);if(!(g===r?m===v||o(m,v,n,i,a):g)){f=!1;break}y||(y="constructor"==d)}if(f&&!y){var _=e.constructor,b=t.constructor;_==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof b&&b instanceof b||(f=!1)}return a.delete(e),a.delete(t),f}(e,t,n,i,o,a))}(e,t,n,i,zr,o))}function Tr(e,t,n,i){var o=n.length,a=o,s=!i;if(null==e)return!a;for(e=Pe(e);o--;){var u=n[o];if(s&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<a;){var c=(u=n[o])[0],l=e[c],d=u[1];if(s&&u[2]){if(l===r&&!(c in e))return!1}else{var p=new Hn;if(i)var h=i(l,d,c,e,t,p);if(!(h===r?zr(d,l,3,i,p):h))return!1}}return!0}function jr(e){return!(!Qa(e)||(t=e,Fe&&Fe in t))&&(Za(e)?Ue:fe).test(Mo(e));var t}function xr(e){return"function"==typeof e?e:null==e?nu:"object"==typeof e?Ga(e)?Dr(e[0],e[1]):Mr(e):du(e)}function Br(e){if(!So(e))return yn(e);var t=[];for(var n in Pe(e))xe.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Fr(e,t){return e<t}function Nr(e,t){var n=-1,r=$a(e)?re(e.length):[];return lr(e,function(e,i,o){r[++n]=t(e,i,o)}),r}function Mr(e){var t=so(e);return 1==t.length&&t[0][2]?Io(t[0][0],t[0][1]):function(n){return n===e||Tr(n,e,t)}}function Dr(e,t){return go(e)&&wo(t)?Io(No(e),t):function(n){var i=Cs(n,e);return i===r&&i===t?Os(n,e):zr(t,i,3)}}function Ur(e,t,n,i,o){e!==t&&mr(t,function(a,s){if(o||(o=new Hn),Qa(a))!function(e,t,n,i,o,a,s){var u=Oo(e,n),c=Oo(t,n),l=s.get(c);if(l)Xn(e,n,l);else{var d=a?a(u,c,n+"",e,t,s):r,p=d===r;if(p){var h=Ga(c),f=!h&&Ha(c),y=!h&&!f&&us(c);d=c,h||f||y?Ga(u)?d=u:Wa(u)?d=Oi(u):f?(p=!1,d=bi(c,!0)):y?(p=!1,d=wi(c,!0)):d=[]:rs(c)||Va(c)?(d=u,Va(u)?d=ms(u):Qa(u)&&!Za(u)||(d=fo(c))):p=!1}p&&(s.set(c,d),o(d,c,i,a,s),s.delete(c)),Xn(e,n,d)}}(e,t,s,n,Ur,i,o);else{var u=i?i(Oo(e,s),a,s+"",e,t,o):r;u===r&&(u=a),Xn(e,s,u)}},Ts)}function Rr(e,t){var n=e.length;if(n)return mo(t+=t<0?n:0,n)?e[t]:r}function Lr(e,t,n){t=t.length?zt(t,function(e){return Ga(e)?function(t){return Sr(t,1===e.length?e[0]:e)}:e}):[nu];var r=-1;t=zt(t,Kt(oo()));var i=Nr(e,function(e,n,i){var o=zt(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 u=Ii(i[r],o[r]);if(u)return r>=s?u:u*("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=Sr(e,a);n(s,a)&&Zr(o,mi(a,e),s)}return o}function Gr(e,t,n,r){var i=r?Ut:Dt,o=-1,a=t.length,s=e;for(e===t&&(t=Oi(t)),n&&(s=zt(e,Kt(n)));++o<a;)for(var u=0,c=t[o],l=n?n(c):c;(u=i(s,l,u,r))>-1;)s!==e&&He.call(s,u,1),He.call(e,u,1);return e}function qr(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;mo(i)?He.call(e,i,1):ui(e,i)}}return e}function $r(e,t){return e+ft(bn()*(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 Hr(e,t){return ko(Po(e,t,nu),e+"")}function Kr(e){return Yn(Us(e))}function Yr(e,t){var n=Us(e);return jo(n,or(t,0,n.length))}function Zr(e,t,n,i){if(!Qa(e))return e;for(var o=-1,a=(t=mi(t,e)).length,s=a-1,u=e;null!=u&&++o<a;){var c=No(t[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=s){var d=u[c];(l=i?i(d,c,u):r)===r&&(l=Qa(d)?d:mo(t[o+1])?[]:{})}Qn(u,c,l),u=u[c]}return e}var Jr=En?function(e,t){return En.set(e,t),e}:nu,Xr=ot?function(e,t){return ot(e,"toString",{configurable:!0,enumerable:!1,value:Qs(t),writable:!0})}:nu;function Qr(e){return jo(Us(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,nu,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,u=null===t,c=ss(t),l=t===r;o<a;){var d=ft((o+a)/2),p=n(e[d]),h=p!==r,f=null===p,y=p==p,m=ss(p);if(s)var v=i||y;else v=l?y&&(i||h):u?y&&h&&(i||!f):c?y&&h&&!f&&(i||!m):!f&&!m&&(i?p<=t:p<t);v?o=d+1:a=d}return vn(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||!Ua(s,u)){var u=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(Ga(e))return zt(e,ai)+"";if(ss(e))return Mn?Mn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,n){var r=-1,i=Et,o=e.length,a=!0,s=[],u=s;if(n)a=!1,i=kt;else if(o>=200){var c=t?null:Wi(e);if(c)return sn(c);a=!1,i=Zt,u=new Wn}else u=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 p=u.length;p--;)if(u[p]===d)continue e;t&&u.push(d),s.push(l)}else i(u,d,n)||(u!==s&&u.push(d),s.push(l))}return s}function ui(e,t){var n=-1,r=(t=mi(t,e)).length;if(!r)return!0;for(;++n<r;){var i=No(t[n]);if("__proto__"===i&&!xe.call(e,"__proto__"))return!1;if(("constructor"===i||"prototype"===i)&&n<r-1)return!1}var o=Co(e,t);return null==o||delete o[No(Yo(t))]}function ci(e,t,n,r){return Zr(e,t,n(Sr(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()),jt(t,function(e,t){return t.func.apply(t.thisArg,Tt([e],t.args))},n)}function pi(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]=cr(o[i]||a,e[s],t,n));return si(yr(o,1),t,n)}function hi(e,t,n){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var u=i<a?t[i]:r;n(s,e[i],u)}return s}function fi(e){return Wa(e)?e:[]}function yi(e){return"function"==typeof e?e:nu}function mi(e,t){return Ga(e)?e:go(e,t)?[e]:Fo(vs(e))}var vi=Hr;function gi(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:ei(e,t,n)}var _i=ut||function(e){return lt.clearTimeout(e)};function bi(e,t){if(t)return e.slice();var n=e.length,r=Ge?Ge(n):new e.constructor(n);return e.copy(r),r}function Si(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function wi(e,t){var n=t?Si(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ii(e,t){if(e!==t){var n=e!==r,i=null===e,o=e==e,a=ss(e),s=t!==r,u=null===t,c=t==t,l=ss(t);if(!u&&!l&&!a&&e>t||a&&s&&c&&!u&&!l||i&&s&&c||!n&&c||!o)return 1;if(!i&&!a&&!l&&e<t||l&&n&&o&&!i&&!a||u&&n&&o||!s&&o||!c)return-1}return 0}function Pi(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,u=t.length,c=mn(o-a,0),l=re(u+c),d=!r;++s<u;)l[s]=t[s];for(;++i<a;)(d||i<o)&&(l[n[i]]=e[i]);for(;c--;)l[s++]=e[i++];return l}function Ci(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,u=-1,c=t.length,l=mn(o-s,0),d=re(l+c),p=!r;++i<l;)d[i]=e[i];for(var h=i;++u<c;)d[h+u]=t[u];for(;++a<s;)(p||i<o)&&(d[h+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 u=t[a],c=i?i(n[u],e[u],u,n,e):r;c===r&&(c=e[u]),o?rr(n,u,c):Qn(n,u,c)}return n}function Ei(e,t){return function(n,r){var i=Ga(n)?It:tr,o=t?t():{};return i(n,e,oo(r,2),o)}}function ki(e){return Hr(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&&vo(n[0],n[1],s)&&(a=o<3?r:a,o=1),t=Pe(t);++i<o;){var u=n[i];u&&e(t,u,i,a)}return t})}function zi(e,t){return function(n,r){if(null==n)return n;if(!$a(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Pe(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Ti(e){return function(t,n,r){for(var i=-1,o=Pe(t),a=r(t),s=a.length;s--;){var u=a[e?s:++i];if(!1===n(o[u],u,o))break}return t}}function ji(e){return function(t){var n=nn(t=vs(t))?ln(t):r,i=n?n[0]:t.charAt(0),o=n?gi(n,1).join(""):t.slice(1);return i[e]()+o}}function xi(e){return function(t){return jt(Zs(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=Un(e.prototype),r=e.apply(n,t);return Qa(r)?r:n}}function Fi(e){return function(t,n,i){var o=Pe(t);if(!$a(t)){var a=oo(n,3);t=zs(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 Ni(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&&!u&&"wrapper"==ro(s))var u=new Ln([],!0)}for(o=u?o:n;++o<n;){var c=ro(s=t[o]),l="wrapper"==c?no(s):r;u=l&&_o(l[0])&&424==l[1]&&!l[4].length&&1==l[9]?u[ro(l[0])].apply(u,l[3]):1==s.length&&_o(s)?u[c]():u.thru(s)}return function(){var e=arguments,r=e[0];if(u&&1==e.length&&Ga(r))return u.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 Mi(e,t,n,i,o,a,s,c,l,d){var p=t&u,h=1&t,f=2&t,y=24&t,m=512&t,v=f?r:Bi(e);return function u(){for(var g=arguments.length,_=re(g),b=g;b--;)_[b]=arguments[b];if(y)var S=io(u),w=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(_,S);if(i&&(_=Pi(_,i,o,y)),a&&(_=Ci(_,a,s,y)),g-=w,y&&g<d){var I=an(_,S);return qi(e,t,Mi,u.placeholder,n,_,I,c,l,d-g)}var P=h?n:this,C=f?P[e]:e;return g=_.length,c?_=function(e,t){for(var n=e.length,i=vn(t.length,n),o=Oi(e);i--;){var a=t[i];e[i]=mo(a,n)?o[a]:r}return e}(_,c):m&&g>1&&_.reverse(),p&&l<g&&(_.length=l),this&&this!==lt&&this instanceof u&&(C=v||Bi(C)),C.apply(P,_)}}function Di(e,t){return function(n,r){return function(e,t,n,r){return gr(e,function(e,i,o){t(r,n(e),i,o)}),r}(n,e,t(r),{})}}function Ui(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=zt(t,Kt(oo())),Hr(function(n){var r=this;return e(t,function(e){return wt(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,pt(e/cn(t)));return nn(t)?gi(ln(i),0,e).join(""):i.slice(0,e)}function Vi(e){return function(t,n,i){return i&&"number"!=typeof i&&vo(t,n,i)&&(n=i=r),t=ps(t),n===r?(n=t,t=0):n=ps(n),function(e,t,n,r){for(var i=-1,o=mn(pt((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:ps(i),e)}}function Gi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ys(t),n=ys(n)),e(t,n)}}function qi(e,t,n,i,o,a,u,c,l,d){var p=8&t;t|=p?s:64,4&(t&=~(p?64:s))||(t&=-4);var h=[e,t,o,p?a:r,p?u:r,p?r:a,p?r:u,c,l,d],f=n.apply(r,h);return _o(e)&&Ao(f,h),f.placeholder=i,zo(f,e,t)}function $i(e){var t=Ie[e];return function(e,n){if(e=ys(e),(n=null==n?0:vn(hs(n),292))&&Gt(e)){var r=(vs(e)+"e").split("e");return+((r=(vs(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]==c?function(e){return new Cn(e)}:su;function Hi(e){return function(t){var n=po(t);return n==S?rn(t):n==O?un(t):function(e,t){return zt(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ki(e,t,n,o,c,l,d,p){var h=2&t;if(!h&&"function"!=typeof e)throw new Ae(i);var f=o?o.length:0;if(f||(t&=-97,o=c=r),d=d===r?d:mn(hs(d),0),p=p===r?p:hs(p),f-=c?c.length:0,64&t){var y=o,m=c;o=c=r}var v=h?r:no(e),g=[e,t,n,o,c,y,m,l,d,p];if(v&&function(e,t){var n=e[1],r=t[1],i=n|r,o=i<131,s=r==u&&8==n||r==u&&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 c=t[3];if(c){var l=e[3];e[3]=l?Pi(l,c,t[4]):c,e[4]=l?an(e[3],a):t[4]}(c=t[5])&&(l=e[5],e[5]=l?Ci(l,c,t[6]):c,e[6]=l?an(e[5],a):t[6]),(c=t[7])&&(e[7]=c),r&u&&(e[8]=null==e[8]?t[8]:vn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(g,v),e=g[0],t=g[1],n=g[2],o=g[3],c=g[4],!(p=g[9]=g[9]===r?h?0:e.length:mn(g[9]-f,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,n){var i=Bi(e);return function o(){for(var a=arguments.length,s=re(a),u=a,c=io(o);u--;)s[u]=arguments[u];var l=a<3&&s[0]!==c&&s[a-1]!==c?[]:an(s,c);return(a-=l.length)<n?qi(e,t,Mi,o.placeholder,r,s,l,r,r,n-a):wt(this&&this!==lt&&this instanceof o?i:e,this,s)}}(e,t,p):t!=s&&33!=t||c.length?Mi.apply(r,g):function(e,t,n,r){var i=1&t,o=Bi(e);return function t(){for(var a=-1,s=arguments.length,u=-1,c=r.length,l=re(c+s),d=this&&this!==lt&&this instanceof t?o:e;++u<c;)l[u]=r[u];for(;s--;)l[u++]=arguments[++a];return wt(d,i?n:this,l)}}(e,t,n,o);else var _=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 zo((v?Jr:Ao)(_,g),e,t)}function Yi(e,t,n,i){return e===r||Ua(e,ze[n])&&!xe.call(i,n)?t:e}function Zi(e,t,n,i,o,a){return Qa(e)&&Qa(t)&&(a.set(t,e),Ur(e,t,r,Zi,a),a.delete(t)),e}function Ji(e){return rs(e)?r:e}function Xi(e,t,n,i,o,a){var s=1&n,u=e.length,c=t.length;if(u!=c&&!(s&&c>u))return!1;var l=a.get(e),d=a.get(t);if(l&&d)return l==t&&d==e;var p=-1,h=!0,f=2&n?new Wn:r;for(a.set(e,t),a.set(t,e);++p<u;){var y=e[p],m=t[p];if(i)var v=s?i(m,y,p,t,e,a):i(y,m,p,e,t,a);if(v!==r){if(v)continue;h=!1;break}if(f){if(!Bt(t,function(e,t){if(!Zt(f,t)&&(y===e||o(y,e,n,i,a)))return f.push(t)})){h=!1;break}}else if(y!==m&&!o(y,m,n,i,a)){h=!1;break}}return a.delete(e),a.delete(t),h}function Qi(e){return ko(Po(e,r,qo),e+"")}function eo(e){return wr(e,zs,co)}function to(e){return wr(e,Ts,lo)}var no=En?function(e){return En.get(e)}:su;function ro(e){for(var t=e.name+"",n=kn[t],r=xe.call(kn,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(xe.call(Dn,"placeholder")?Dn:e).placeholder}function oo(){var e=Dn.iteratee||ru;return e=e===ru?xr: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=zs(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,wo(i)]}return t}function uo(e,t){var n=function(e,t){return null==e?r:e[t]}(e,t);return jr(n)?n:r}var co=yt?function(e){return null==e?[]:(e=Pe(e),At(yt(e),function(t){return We.call(e,t)}))}:fu,lo=yt?function(e){for(var t=[];e;)Tt(t,co(e)),e=qe(e);return t}:fu,po=Ir;function ho(e,t,n){for(var r=-1,i=(t=mi(t,e)).length,o=!1;++r<i;){var a=No(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)&&mo(a,i)&&(Ga(e)||Va(e))}function fo(e){return"function"!=typeof e.constructor||So(e)?{}:Un(qe(e))}function yo(e){return Ga(e)||Va(e)||!!(Ke&&e&&e[Ke])}function mo(e,t){var n=typeof e;return!!(t=t??l)&&("number"==n||"symbol"!=n&&me.test(e))&&e>-1&&e%1==0&&e<t}function vo(e,t,n){if(!Qa(n))return!1;var r=typeof t;return!!("number"==r?$a(n)&&mo(t,n.length):"string"==r&&t in n)&&Ua(n[t],e)}function go(e,t){if(Ga(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ss(e))||X.test(e)||!J.test(e)||null!=t&&e in Pe(t)}function _o(e){var t=ro(e),n=Dn[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]}(wn&&po(new wn(new ArrayBuffer(1)))!=T||In&&po(new In)!=S||Pn&&po(Pn.resolve())!=P||Cn&&po(new Cn)!=O||On&&po(new On)!=k)&&(po=function(e){var t=Ir(e),n=t==I?e.constructor:r,i=n?Mo(n):"";if(i)switch(i){case zn:return T;case Tn:return S;case jn:return P;case xn:return O;case Bn:return k}return t});var bo=Te?Za:yu;function So(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ze)}function wo(e){return e==e&&!Qa(e)}function Io(e,t){return function(n){return null!=n&&n[e]===t&&(t!==r||e in Pe(n))}}function Po(e,t,n){return t=mn(t===r?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=mn(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),wt(e,this,s)}}function Co(e,t){return t.length<2?e:Sr(e,ei(t,0,-1))}function Oo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ao=To(Jr),Eo=dt||function(e,t){return lt.setTimeout(e,t)},ko=To(Xr);function zo(e,t,n){var r=t+"";return ko(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 Pt(h,function(n){var r="_."+n[0];t&n[1]&&!Et(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ae):[]}(r),n)))}function To(e){var t=0,n=0;return function(){var i=gn(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function jo(e,t){var n=-1,i=e.length,o=i-1;for(t=t===r?i:t;++n<t;){var a=$r(n,o),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var xo,Bo,Fo=(xo=xa(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Q,function(e,n,r,i){t.push(r?i.replace(ce,"$1"):n||e)}),t},function(e){return 500===Bo.size&&Bo.clear(),e}),Bo=xo.cache,xo);function No(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Mo(e){if(null!=e){try{return je.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Do(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 Uo=Hr(function(e,t){return Wa(e)?cr(e,yr(t,1,Wa,!0)):[]}),Ro=Hr(function(e,t){var n=Yo(t);return Wa(n)&&(n=r),Wa(e)?cr(e,yr(t,1,Wa,!0),oo(n,2)):[]}),Lo=Hr(function(e,t){var n=Yo(t);return Wa(n)&&(n=r),Wa(e)?cr(e,yr(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:hs(n);return i<0&&(i=mn(r+i,0)),Mt(e,oo(t,3),i)}function Go(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return n!==r&&(o=hs(n),o=n<0?mn(i+o,0):vn(o,i-1)),Mt(e,oo(t,3),o,!0)}function qo(e){return null!=e&&e.length?yr(e,1):[]}function $o(e){return e&&e.length?e[0]:r}var Wo=Hr(function(e){var t=zt(e,fi);return t.length&&t[0]===e[0]?Ar(t):[]}),Ho=Hr(function(e){var t=Yo(e),n=zt(e,fi);return t===Yo(n)?t=r:n.pop(),n.length&&n[0]===e[0]?Ar(n,oo(t,2)):[]}),Ko=Hr(function(e){var t=Yo(e),n=zt(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 Zo=Hr(Jo);function Jo(e,t){return e&&e.length&&t&&t.length?Gr(e,t):e}var Xo=Qi(function(e,t){var n=null==e?0:e.length,r=ir(e,t);return qr(e,zt(t,function(e){return mo(e,n)?+e:e}).sort(Ii)),r});function Qo(e){return null==e?e:Sn.call(e)}var ea=Hr(function(e){return si(yr(e,1,Wa,!0))}),ta=Hr(function(e){var t=Yo(e);return Wa(t)&&(t=r),si(yr(e,1,Wa,!0),oo(t,2))}),na=Hr(function(e){var t=Yo(e);return t="function"==typeof t?t:r,si(yr(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=mn(e.length,t),!0}),Wt(t,function(t){return zt(e,Vt(t))})}function ia(e,t){if(!e||!e.length)return[];var n=ra(e);return null==t?n:zt(n,function(e){return wt(t,r,e)})}var oa=Hr(function(e,t){return Wa(e)?cr(e,t):[]}),aa=Hr(function(e){return pi(At(e,Wa))}),sa=Hr(function(e){var t=Yo(e);return Wa(t)&&(t=r),pi(At(e,Wa),oo(t,2))}),ua=Hr(function(e){var t=Yo(e);return t="function"==typeof t?t:r,pi(At(e,Wa),r,t)}),ca=Hr(ra),la=Hr(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=Dn(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=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&&mo(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:r}),new Ln(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(o)}),fa=Ei(function(e,t,n){xe.call(e,n)?++e[n]:rr(e,n,1)}),ya=Fi(Vo),ma=Fi(Go);function va(e,t){return(Ga(e)?Pt:lr)(e,oo(t,3))}function ga(e,t){return(Ga(e)?Ct:dr)(e,oo(t,3))}var _a=Ei(function(e,t,n){xe.call(e,n)?e[n].push(t):rr(e,n,[t])}),ba=Hr(function(e,t,n){var r=-1,i="function"==typeof t,o=$a(e)?re(e.length):[];return lr(e,function(e){o[++r]=i?wt(t,e,n):Er(e,t,n)}),o}),Sa=Ei(function(e,t,n){rr(e,n,t)});function wa(e,t){return(Ga(e)?zt:Nr)(e,oo(t,3))}var Ia=Ei(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Pa=Hr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&vo(e,t[0],t[1])?t=[]:n>2&&vo(t[0],t[1],t[2])&&(t=[t[0]]),Lr(e,yr(t,1),[])}),Ca=ct||function(){return lt.Date.now()};function Oa(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Ki(e,u,r,r,r,r,t)}function Aa(e,t){var n;if("function"!=typeof t)throw new Ae(i);return e=hs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var Ea=Hr(function(e,t,n){var r=1;if(n.length){var i=an(n,io(Ea));r|=s}return Ki(e,r,t,n,i)}),ka=Hr(function(e,t,n){var r=3;if(n.length){var i=an(n,io(ka));r|=s}return Ki(t,r,e,n,i)});function za(e,t,n){var o,a,s,u,c,l,d=0,p=!1,h=!1,f=!0;if("function"!=typeof e)throw new Ae(i);function y(t){var n=o,i=a;return o=a=r,d=t,u=e.apply(i,n)}function m(e){var n=e-l;return l===r||n>=t||n<0||h&&e-d>=s}function v(){var e=Ca();if(m(e))return g(e);c=Eo(v,function(e){var n=t-(e-l);return h?vn(n,s-(e-d)):n}(e))}function g(e){return c=r,f&&o?y(e):(o=a=r,u)}function _(){var e=Ca(),n=m(e);if(o=arguments,a=this,l=e,n){if(c===r)return function(e){return d=e,c=Eo(v,t),p?y(e):u}(l);if(h)return _i(c),c=Eo(v,t),y(l)}return c===r&&(c=Eo(v,t)),u}return t=ys(t)||0,Qa(n)&&(p=!!n.leading,s=(h="maxWait"in n)?mn(ys(n.maxWait)||0,t):s,f="trailing"in n?!!n.trailing:f),_.cancel=function(){c!==r&&_i(c),d=0,o=l=a=c=r},_.flush=function(){return c===r?u:g(Ca())},_}var Ta=Hr(function(e,t){return ur(e,1,t)}),ja=Hr(function(e,t,n){return ur(e,ys(t)||0,n)});function xa(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(xa.Cache||$n),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)}}xa.Cache=$n;var Fa=vi(function(e,t){var n=(t=1==t.length&&Ga(t[0])?zt(t[0],Kt(oo())):zt(yr(t,1),Kt(oo()))).length;return Hr(function(r){for(var i=-1,o=vn(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return wt(e,this,r)})}),Na=Hr(function(e,t){var n=an(t,io(Na));return Ki(e,s,r,t,n)}),Ma=Hr(function(e,t){var n=an(t,io(Ma));return Ki(e,64,r,t,n)}),Da=Qi(function(e,t){return Ki(e,256,r,r,r,t)});function Ua(e,t){return e===t||e!=e&&t!=t}var Ra=Gi(Pr),La=Gi(function(e,t){return e>=t}),Va=kr(function(){return arguments}())?kr:function(e){return es(e)&&xe.call(e,"callee")&&!We.call(e,"callee")},Ga=re.isArray,qa=mt?Kt(mt):function(e){return es(e)&&Ir(e)==z};function $a(e){return null!=e&&Xa(e.length)&&!Za(e)}function Wa(e){return es(e)&&$a(e)}var Ha=Ft||yu,Ka=vt?Kt(vt):function(e){return es(e)&&Ir(e)==v};function Ya(e){if(!es(e))return!1;var t=Ir(e);return t==g||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Za(e){if(!Qa(e))return!1;var t=Ir(e);return t==_||t==b||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ja(e){return"number"==typeof e&&e==hs(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=gt?Kt(gt):function(e){return es(e)&&po(e)==S};function ns(e){return"number"==typeof e||es(e)&&Ir(e)==w}function rs(e){if(!es(e)||Ir(e)!=I)return!1;var t=qe(e);if(null===t)return!0;var n=xe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&je.call(n)==Me}var is=_t?Kt(_t):function(e){return es(e)&&Ir(e)==C},os=bt?Kt(bt):function(e){return es(e)&&po(e)==O};function as(e){return"string"==typeof e||!Ga(e)&&es(e)&&Ir(e)==A}function ss(e){return"symbol"==typeof e||es(e)&&Ir(e)==E}var us=St?Kt(St):function(e){return es(e)&&Xa(e.length)&&!!rt[Ir(e)]},cs=Gi(Fr),ls=Gi(function(e,t){return e<=t});function ds(e){if(!e)return[];if($a(e))return as(e)?ln(e):Oi(e);if(Je&&e[Je])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Je]());var t=po(e);return(t==S?rn:t==O?sn:Us)(e)}function ps(e){return e?(e=ys(e))===c||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hs(e){var t=ps(e),n=t%1;return t==t?n?t-n:t:0}function fs(e){return e?or(hs(e),0,p):0}function ys(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=Ht(e);var n=he.test(e);return n||ye.test(e)?st(e.slice(2),n?2:8):pe.test(e)?d:+e}function ms(e){return Ai(e,Ts(e))}function vs(e){return null==e?"":ai(e)}var gs=ki(function(e,t){if(So(t)||$a(t))Ai(t,zs(t),e);else for(var n in t)xe.call(t,n)&&Qn(e,n,t[n])}),_s=ki(function(e,t){Ai(t,Ts(t),e)}),bs=ki(function(e,t,n,r){Ai(t,Ts(t),e,r)}),Ss=ki(function(e,t,n,r){Ai(t,zs(t),e,r)}),ws=Qi(ir),Is=Hr(function(e,t){e=Pe(e);var n=-1,i=t.length,o=i>2?t[2]:r;for(o&&vo(t[0],t[1],o)&&(i=1);++n<i;)for(var a=t[n],s=Ts(a),u=-1,c=s.length;++u<c;){var l=s[u],d=e[l];(d===r||Ua(d,ze[l])&&!xe.call(e,l))&&(e[l]=a[l])}return e}),Ps=Hr(function(e){return e.push(r,Zi),wt(xs,r,e)});function Cs(e,t,n){var i=null==e?r:Sr(e,t);return i===r?n:i}function Os(e,t){return null!=e&&ho(e,t,Or)}var As=Di(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),e[t]=n},Qs(nu)),Es=Di(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Ne.call(t)),xe.call(e,t)?e[t].push(n):e[t]=[n]},oo),ks=Hr(Er);function zs(e){return $a(e)?Kn(e):Br(e)}function Ts(e){return $a(e)?Kn(e,!0):function(e){if(!Qa(e))return function(e){var t=[];if(null!=e)for(var n in Pe(e))t.push(n);return t}(e);var t=So(e),n=[];for(var r in e)("constructor"!=r||!t&&xe.call(e,r))&&n.push(r);return n}(e)}var js=ki(function(e,t,n){Ur(e,t,n)}),xs=ki(function(e,t,n,r){Ur(e,t,n,r)}),Bs=Qi(function(e,t){var n={};if(null==e)return n;var r=!1;t=zt(t,function(t){return t=mi(t,e),r||(r=t.length>1),t}),Ai(e,to(e),n),r&&(n=ar(n,7,Ji));for(var i=t.length;i--;)ui(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 Ns(e,t){if(null==e)return{};var n=zt(to(e),function(e){return[e]});return t=oo(t),Vr(e,n,function(e,n){return t(e,n[0])})}var Ms=Hi(zs),Ds=Hi(Ts);function Us(e){return null==e?[]:Yt(e,zs(e))}var Rs=xi(function(e,t,n){return t=t.toLowerCase(),e+(n?Ls(t):t)});function Ls(e){return Ys(vs(e).toLowerCase())}function Vs(e){return(e=vs(e))&&e.replace(ve,Qt).replace(Ze,"")}var Gs=xi(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),qs=xi(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),$s=ji("toLowerCase"),Ws=xi(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),Hs=xi(function(e,t,n){return e+(n?" ":"")+Ys(t)}),Ks=xi(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ys=ji("toUpperCase");function Zs(e,t,n){return e=vs(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 Js=Hr(function(e,t){try{return wt(e,r,t)}catch(e){return Ya(e)?e:new Se(e)}}),Xs=Qi(function(e,t){return Pt(t,function(t){t=No(t),rr(e,t,Ea(e[t],e))}),e});function Qs(e){return function(){return e}}var eu=Ni(),tu=Ni(!0);function nu(e){return e}function ru(e){return xr("function"==typeof e?e:ar(e,1))}var iu=Hr(function(e,t){return function(n){return Er(n,e,t)}}),ou=Hr(function(e,t){return function(n){return Er(e,n,t)}});function au(e,t,n){var r=zs(t),i=br(t,r);null!=n||Qa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=br(t,zs(t)));var o=!(Qa(n)&&"chain"in n&&!n.chain),a=Za(e);return Pt(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,Tt([this.value()],arguments))})}),e}function su(){}var uu=Ri(zt),cu=Ri(Ot),lu=Ri(Bt);function du(e){return go(e)?Vt(No(e)):function(e){return function(t){return Sr(t,e)}}(e)}var pu=Vi(),hu=Vi(!0);function fu(){return[]}function yu(){return!1}var mu,vu=Ui(function(e,t){return e+t},0),gu=$i("ceil"),_u=Ui(function(e,t){return e/t},1),bu=$i("floor"),Su=Ui(function(e,t){return e*t},1),wu=$i("round"),Iu=Ui(function(e,t){return e-t},0);return Dn.after=function(e,t){if("function"!=typeof t)throw new Ae(i);return e=hs(e),function(){if(--e<1)return t.apply(this,arguments)}},Dn.ary=Oa,Dn.assign=gs,Dn.assignIn=_s,Dn.assignInWith=bs,Dn.assignWith=Ss,Dn.at=ws,Dn.before=Aa,Dn.bind=Ea,Dn.bindAll=Xs,Dn.bindKey=ka,Dn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ga(e)?e:[e]},Dn.chain=da,Dn.chunk=function(e,t,n){t=(n?vo(e,t,n):t===r)?1:mn(hs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=re(pt(i/t));o<i;)s[a++]=ei(e,o,o+=t);return s},Dn.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},Dn.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 Tt(Ga(n)?Oi(n):[n],yr(t,1))},Dn.cond=function(e){var t=null==e?0:e.length,n=oo();return e=t?zt(e,function(e){if("function"!=typeof e[1])throw new Ae(i);return[n(e[0]),e[1]]}):[],Hr(function(n){for(var r=-1;++r<t;){var i=e[r];if(wt(i[0],this,n))return wt(i[1],this,n)}})},Dn.conforms=function(e){return function(e){var t=zs(e);return function(n){return sr(n,e,t)}}(ar(e,1))},Dn.constant=Qs,Dn.countBy=fa,Dn.create=function(e,t){var n=Un(e);return null==t?n:nr(n,t)},Dn.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},Dn.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},Dn.debounce=za,Dn.defaults=Is,Dn.defaultsDeep=Ps,Dn.defer=Ta,Dn.delay=ja,Dn.difference=Uo,Dn.differenceBy=Ro,Dn.differenceWith=Lo,Dn.drop=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,(t=n||t===r?1:hs(t))<0?0:t,i):[]},Dn.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,0,(t=i-(t=n||t===r?1:hs(t)))<0?0:t):[]},Dn.dropRightWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!0,!0):[]},Dn.dropWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!0):[]},Dn.fill=function(e,t,n,i){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&vo(e,t,n)&&(n=0,i=o),function(e,t,n,i){var o=e.length;for((n=hs(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:hs(i))<0&&(i+=o),i=n>i?0:fs(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},Dn.filter=function(e,t){return(Ga(e)?At:fr)(e,oo(t,3))},Dn.flatMap=function(e,t){return yr(wa(e,t),1)},Dn.flatMapDeep=function(e,t){return yr(wa(e,t),c)},Dn.flatMapDepth=function(e,t,n){return n=n===r?1:hs(n),yr(wa(e,t),n)},Dn.flatten=qo,Dn.flattenDeep=function(e){return null!=e&&e.length?yr(e,c):[]},Dn.flattenDepth=function(e,t){return null!=e&&e.length?yr(e,t=t===r?1:hs(t)):[]},Dn.flip=function(e){return Ki(e,512)},Dn.flow=eu,Dn.flowRight=tu,Dn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];rr(r,i[0],i[1])}return r},Dn.functions=function(e){return null==e?[]:br(e,zs(e))},Dn.functionsIn=function(e){return null==e?[]:br(e,Ts(e))},Dn.groupBy=_a,Dn.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Dn.intersection=Wo,Dn.intersectionBy=Ho,Dn.intersectionWith=Ko,Dn.invert=As,Dn.invertBy=Es,Dn.invokeMap=ba,Dn.iteratee=ru,Dn.keyBy=Sa,Dn.keys=zs,Dn.keysIn=Ts,Dn.map=wa,Dn.mapKeys=function(e,t){var n={};return t=oo(t,3),gr(e,function(e,r,i){rr(n,t(e,r,i),e)}),n},Dn.mapValues=function(e,t){var n={};return t=oo(t,3),gr(e,function(e,r,i){rr(n,r,t(e,r,i))}),n},Dn.matches=function(e){return Mr(ar(e,1))},Dn.matchesProperty=function(e,t){return Dr(e,ar(t,1))},Dn.memoize=xa,Dn.merge=js,Dn.mergeWith=xs,Dn.method=iu,Dn.methodOf=ou,Dn.mixin=au,Dn.negate=Ba,Dn.nthArg=function(e){return e=hs(e),Hr(function(t){return Rr(t,e)})},Dn.omit=Bs,Dn.omitBy=function(e,t){return Ns(e,Ba(oo(t)))},Dn.once=function(e){return Aa(2,e)},Dn.orderBy=function(e,t,n,i){return null==e?[]:(Ga(t)||(t=null==t?[]:[t]),Ga(n=i?r:n)||(n=null==n?[]:[n]),Lr(e,t,n))},Dn.over=uu,Dn.overArgs=Fa,Dn.overEvery=cu,Dn.overSome=lu,Dn.partial=Na,Dn.partialRight=Ma,Dn.partition=Ia,Dn.pick=Fs,Dn.pickBy=Ns,Dn.property=du,Dn.propertyOf=function(e){return function(t){return null==e?r:Sr(e,t)}},Dn.pull=Zo,Dn.pullAll=Jo,Dn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,oo(n,2)):e},Dn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,r,n):e},Dn.pullAt=Xo,Dn.range=pu,Dn.rangeRight=hu,Dn.rearg=Da,Dn.reject=function(e,t){return(Ga(e)?At:fr)(e,Ba(oo(t,3)))},Dn.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 qr(e,i),n},Dn.rest=function(e,t){if("function"!=typeof e)throw new Ae(i);return Hr(e,t=t===r?t:hs(t))},Dn.reverse=Qo,Dn.sampleSize=function(e,t,n){return t=(n?vo(e,t,n):t===r)?1:hs(t),(Ga(e)?Zn:Yr)(e,t)},Dn.set=function(e,t,n){return null==e?e:Zr(e,t,n)},Dn.setWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Zr(e,t,n,i)},Dn.shuffle=function(e){return(Ga(e)?Jn:Qr)(e)},Dn.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&vo(e,t,n)?(t=0,n=i):(t=null==t?0:hs(t),n=n===r?i:hs(n)),ei(e,t,n)):[]},Dn.sortBy=Pa,Dn.sortedUniq=function(e){return e&&e.length?ii(e):[]},Dn.sortedUniqBy=function(e,t){return e&&e.length?ii(e,oo(t,2)):[]},Dn.split=function(e,t,n){return n&&"number"!=typeof n&&vo(e,t,n)&&(t=n=r),(n=n===r?p:n>>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=ai(t))&&nn(e)?gi(ln(e),0,n):e.split(t,n):[]},Dn.spread=function(e,t){if("function"!=typeof e)throw new Ae(i);return t=null==t?0:mn(hs(t),0),Hr(function(n){var r=n[t],i=gi(n,0,t);return r&&Tt(i,r),wt(e,this,i)})},Dn.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Dn.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===r?1:hs(t))<0?0:t):[]},Dn.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,(t=i-(t=n||t===r?1:hs(t)))<0?0:t,i):[]},Dn.takeRightWhile=function(e,t){return e&&e.length?li(e,oo(t,3),!1,!0):[]},Dn.takeWhile=function(e,t){return e&&e.length?li(e,oo(t,3)):[]},Dn.tap=function(e,t){return t(e),e},Dn.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),za(e,t,{leading:r,maxWait:t,trailing:o})},Dn.thru=pa,Dn.toArray=ds,Dn.toPairs=Ms,Dn.toPairsIn=Ds,Dn.toPath=function(e){return Ga(e)?zt(e,No):ss(e)?[e]:Oi(Fo(vs(e)))},Dn.toPlainObject=ms,Dn.transform=function(e,t,n){var r=Ga(e),i=r||Ha(e)||us(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Qa(e)&&Za(o)?Un(qe(e)):{}}return(i?Pt:gr)(e,function(e,r,i){return t(n,e,r,i)}),n},Dn.unary=function(e){return Oa(e,1)},Dn.union=ea,Dn.unionBy=ta,Dn.unionWith=na,Dn.uniq=function(e){return e&&e.length?si(e):[]},Dn.uniqBy=function(e,t){return e&&e.length?si(e,oo(t,2)):[]},Dn.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?si(e,r,t):[]},Dn.unset=function(e,t){return null==e||ui(e,t)},Dn.unzip=ra,Dn.unzipWith=ia,Dn.update=function(e,t,n){return null==e?e:ci(e,t,yi(n))},Dn.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:ci(e,t,yi(n),i)},Dn.values=Us,Dn.valuesIn=function(e){return null==e?[]:Yt(e,Ts(e))},Dn.without=oa,Dn.words=Zs,Dn.wrap=function(e,t){return Na(yi(t),e)},Dn.xor=aa,Dn.xorBy=sa,Dn.xorWith=ua,Dn.zip=ca,Dn.zipObject=function(e,t){return hi(e||[],t||[],Qn)},Dn.zipObjectDeep=function(e,t){return hi(e||[],t||[],Zr)},Dn.zipWith=la,Dn.entries=Ms,Dn.entriesIn=Ds,Dn.extend=_s,Dn.extendWith=bs,au(Dn,Dn),Dn.add=vu,Dn.attempt=Js,Dn.camelCase=Rs,Dn.capitalize=Ls,Dn.ceil=gu,Dn.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=ys(n))==n?n:0),t!==r&&(t=(t=ys(t))==t?t:0),or(ys(e),t,n)},Dn.clone=function(e){return ar(e,4)},Dn.cloneDeep=function(e){return ar(e,5)},Dn.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:r)},Dn.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:r)},Dn.conformsTo=function(e,t){return null==t||sr(e,t,zs(t))},Dn.deburr=Vs,Dn.defaultTo=function(e,t){return null==e||e!=e?t:e},Dn.divide=_u,Dn.endsWith=function(e,t,n){e=vs(e),t=ai(t);var i=e.length,o=n=n===r?i:or(hs(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},Dn.eq=Ua,Dn.escape=function(e){return(e=vs(e))&&H.test(e)?e.replace($,en):e},Dn.escapeRegExp=function(e){return(e=vs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Dn.every=function(e,t,n){var i=Ga(e)?Ot:pr;return n&&vo(e,t,n)&&(t=r),i(e,oo(t,3))},Dn.find=ya,Dn.findIndex=Vo,Dn.findKey=function(e,t){return Nt(e,oo(t,3),gr)},Dn.findLast=ma,Dn.findLastIndex=Go,Dn.findLastKey=function(e,t){return Nt(e,oo(t,3),_r)},Dn.floor=bu,Dn.forEach=va,Dn.forEachRight=ga,Dn.forIn=function(e,t){return null==e?e:mr(e,oo(t,3),Ts)},Dn.forInRight=function(e,t){return null==e?e:vr(e,oo(t,3),Ts)},Dn.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Dn.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Dn.get=Cs,Dn.gt=Ra,Dn.gte=La,Dn.has=function(e,t){return null!=e&&ho(e,t,Cr)},Dn.hasIn=Os,Dn.head=$o,Dn.identity=nu,Dn.includes=function(e,t,n,r){e=$a(e)?e:Us(e),n=n&&!r?hs(n):0;var i=e.length;return n<0&&(n=mn(i+n,0)),as(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Dt(e,t,n)>-1},Dn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=mn(r+i,0)),Dt(e,t,i)},Dn.inRange=function(e,t,n){return t=ps(t),n===r?(n=t,t=0):n=ps(n),function(e,t,n){return e>=vn(t,n)&&e<mn(t,n)}(e=ys(e),t,n)},Dn.invoke=ks,Dn.isArguments=Va,Dn.isArray=Ga,Dn.isArrayBuffer=qa,Dn.isArrayLike=$a,Dn.isArrayLikeObject=Wa,Dn.isBoolean=function(e){return!0===e||!1===e||es(e)&&Ir(e)==m},Dn.isBuffer=Ha,Dn.isDate=Ka,Dn.isElement=function(e){return es(e)&&1===e.nodeType&&!rs(e)},Dn.isEmpty=function(e){if(null==e)return!0;if($a(e)&&(Ga(e)||"string"==typeof e||"function"==typeof e.splice||Ha(e)||us(e)||Va(e)))return!e.length;var t=po(e);if(t==S||t==O)return!e.size;if(So(e))return!Br(e).length;for(var n in e)if(xe.call(e,n))return!1;return!0},Dn.isEqual=function(e,t){return zr(e,t)},Dn.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:r)?n(e,t):r;return i===r?zr(e,t,r,n):!!i},Dn.isError=Ya,Dn.isFinite=function(e){return"number"==typeof e&&Gt(e)},Dn.isFunction=Za,Dn.isInteger=Ja,Dn.isLength=Xa,Dn.isMap=ts,Dn.isMatch=function(e,t){return e===t||Tr(e,t,so(t))},Dn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:r,Tr(e,t,so(t),n)},Dn.isNaN=function(e){return ns(e)&&e!=+e},Dn.isNative=function(e){if(bo(e))throw new Se("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return jr(e)},Dn.isNil=function(e){return null==e},Dn.isNull=function(e){return null===e},Dn.isNumber=ns,Dn.isObject=Qa,Dn.isObjectLike=es,Dn.isPlainObject=rs,Dn.isRegExp=is,Dn.isSafeInteger=function(e){return Ja(e)&&e>=-9007199254740991&&e<=l},Dn.isSet=os,Dn.isString=as,Dn.isSymbol=ss,Dn.isTypedArray=us,Dn.isUndefined=function(e){return e===r},Dn.isWeakMap=function(e){return es(e)&&po(e)==k},Dn.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Ir(e)},Dn.join=function(e,t){return null==e?"":fn.call(e,t)},Dn.kebabCase=Gs,Dn.last=Yo,Dn.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=hs(n))<0?mn(i+o,0):vn(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):Mt(e,Rt,o,!0)},Dn.lowerCase=qs,Dn.lowerFirst=$s,Dn.lt=cs,Dn.lte=ls,Dn.max=function(e){return e&&e.length?hr(e,nu,Pr):r},Dn.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):r},Dn.mean=function(e){return Lt(e,nu)},Dn.meanBy=function(e,t){return Lt(e,oo(t,2))},Dn.min=function(e){return e&&e.length?hr(e,nu,Fr):r},Dn.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Fr):r},Dn.stubArray=fu,Dn.stubFalse=yu,Dn.stubObject=function(){return{}},Dn.stubString=function(){return""},Dn.stubTrue=function(){return!0},Dn.multiply=Su,Dn.nth=function(e,t){return e&&e.length?Rr(e,hs(t)):r},Dn.noConflict=function(){return lt._===this&&(lt._=De),this},Dn.noop=su,Dn.now=Ca,Dn.pad=function(e,t,n){e=vs(e);var r=(t=hs(t))?cn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Li(ft(i),n)+e+Li(pt(i),n)},Dn.padEnd=function(e,t,n){e=vs(e);var r=(t=hs(t))?cn(e):0;return t&&r<t?e+Li(t-r,n):e},Dn.padStart=function(e,t,n){e=vs(e);var r=(t=hs(t))?cn(e):0;return t&&r<t?Li(t-r,n)+e:e},Dn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),_n(vs(e).replace(ne,""),t||0)},Dn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&vo(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=ps(e),t===r?(t=e,e=0):t=ps(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var o=bn();return vn(e+o*(t-e+at("1e-"+((o+"").length-1))),t)}return $r(e,t)},Dn.reduce=function(e,t,n){var r=Ga(e)?jt:qt,i=arguments.length<3;return r(e,oo(t,4),n,i,lr)},Dn.reduceRight=function(e,t,n){var r=Ga(e)?xt:qt,i=arguments.length<3;return r(e,oo(t,4),n,i,dr)},Dn.repeat=function(e,t,n){return t=(n?vo(e,t,n):t===r)?1:hs(t),Wr(vs(e),t)},Dn.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Dn.result=function(e,t,n){var i=-1,o=(t=mi(t,e)).length;for(o||(o=1,e=r);++i<o;){var a=null==e?r:e[No(t[i])];a===r&&(i=o,a=n),e=Za(a)?a.call(e):a}return e},Dn.round=wu,Dn.runInContext=e,Dn.sample=function(e){return(Ga(e)?Yn:Kr)(e)},Dn.size=function(e){if(null==e)return 0;if($a(e))return as(e)?cn(e):e.length;var t=po(e);return t==S||t==O?e.size:Br(e).length},Dn.snakeCase=Ws,Dn.some=function(e,t,n){var i=Ga(e)?Bt:ti;return n&&vo(e,t,n)&&(t=r),i(e,oo(t,3))},Dn.sortedIndex=function(e,t){return ni(e,t)},Dn.sortedIndexBy=function(e,t,n){return ri(e,t,oo(n,2))},Dn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ni(e,t);if(r<n&&Ua(e[r],t))return r}return-1},Dn.sortedLastIndex=function(e,t){return ni(e,t,!0)},Dn.sortedLastIndexBy=function(e,t,n){return ri(e,t,oo(n,2),!0)},Dn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ni(e,t,!0)-1;if(Ua(e[n],t))return n}return-1},Dn.startCase=Hs,Dn.startsWith=function(e,t,n){return e=vs(e),n=null==n?0:or(hs(n),0,e.length),t=ai(t),e.slice(n,n+t.length)==t},Dn.subtract=Iu,Dn.sum=function(e){return e&&e.length?$t(e,nu):0},Dn.sumBy=function(e,t){return e&&e.length?$t(e,oo(t,2)):0},Dn.template=function(e,t,n){var i=Dn.templateSettings;n&&vo(e,t,n)&&(t=r),e=vs(e),t=Ss({},t,i,Yi);var o=Ss({},t.imports,i.imports,Yi),a=zs(o),s=Yt(o,a);Pt(a,function(e){if(ue.test(e))throw new Se("Invalid `imports` option passed into `_.template`")});var u,c,l=0,d=t.interpolate||ge,p="__p += '",h=Ce((t.escape||ge).source+"|"+d.source+"|"+(d===Z?le:ge).source+"|"+(t.evaluate||ge).source+"|$","g"),f="//# sourceURL="+(xe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++nt+"]")+"\n";e.replace(h,function(t,n,r,i,o,a){return r||(r=i),p+=e.slice(l,a).replace(_e,tn),n&&(u=!0,p+="' +\n__e("+n+") +\n'"),o&&(c=!0,p+="';\n"+o+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=a+t.length,t}),p+="';\n";var y=xe.call(t,"variable")&&t.variable;if(y){if(ue.test(y))throw new Se("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(c?p.replace(L,""):p).replace(V,"$1").replace(G,"$1;"),p="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(c?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=Js(function(){return we(a,f+"return "+p).apply(r,s)});if(m.source=p,Ya(m))throw m;return m},Dn.times=function(e,t){if((e=hs(e))<1||e>l)return[];var n=p,r=vn(e,p);t=oo(t),e-=p;for(var i=Wt(r,t);++n<e;)t(n);return i},Dn.toFinite=ps,Dn.toInteger=hs,Dn.toLength=fs,Dn.toLower=function(e){return vs(e).toLowerCase()},Dn.toNumber=ys,Dn.toSafeInteger=function(e){return e?or(hs(e),-9007199254740991,l):0===e?e:0},Dn.toString=vs,Dn.toUpper=function(e){return vs(e).toUpperCase()},Dn.trim=function(e,t,n){if((e=vs(e))&&(n||t===r))return Ht(e);if(!e||!(t=ai(t)))return e;var i=ln(e),o=ln(t);return gi(i,Jt(i,o),Xt(i,o)+1).join("")},Dn.trimEnd=function(e,t,n){if((e=vs(e))&&(n||t===r))return e.slice(0,dn(e)+1);if(!e||!(t=ai(t)))return e;var i=ln(e);return gi(i,0,Xt(i,ln(t))+1).join("")},Dn.trimStart=function(e,t,n){if((e=vs(e))&&(n||t===r))return e.replace(ne,"");if(!e||!(t=ai(t)))return e;var i=ln(e);return gi(i,Jt(i,ln(t))).join("")},Dn.truncate=function(e,t){var n=30,i="...";if(Qa(t)){var o="separator"in t?t.separator:o;n="length"in t?hs(t.length):n,i="omission"in t?ai(t.omission):i}var a=(e=vs(e)).length;if(nn(e)){var s=ln(e);a=s.length}if(n>=a)return e;var u=n-cn(i);if(u<1)return i;var c=s?gi(s,0,u).join(""):e.slice(0,u);if(o===r)return c+i;if(s&&(u+=c.length-u),is(o)){if(e.slice(u).search(o)){var l,d=c;for(o.global||(o=Ce(o.source,vs(de.exec(o))+"g")),o.lastIndex=0;l=o.exec(d);)var p=l.index;c=c.slice(0,p===r?u:p)}}else if(e.indexOf(ai(o),u)!=u){var h=c.lastIndexOf(o);h>-1&&(c=c.slice(0,h))}return c+i},Dn.unescape=function(e){return(e=vs(e))&&W.test(e)?e.replace(q,pn):e},Dn.uniqueId=function(e){var t=++Be;return vs(e)+t},Dn.upperCase=Ks,Dn.upperFirst=Ys,Dn.each=va,Dn.eachRight=ga,Dn.first=$o,au(Dn,(mu={},gr(Dn,function(e,t){xe.call(Dn.prototype,t)||(mu[t]=e)}),mu),{chain:!1}),Dn.VERSION="4.18.1",Pt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Dn[e].placeholder=Dn}),Pt(["drop","take"],function(e,t){Vn.prototype[e]=function(n){n=n===r?1:mn(hs(n),0);var i=this.__filtered__&&!t?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=vn(n,i.__takeCount__):i.__views__.push({size:vn(n,p),type:e+(i.__dir__<0?"Right":"")}),i},Vn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Pt(["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}}),Pt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Vn.prototype[e]=function(){return this[n](1).value()[0]}}),Pt(["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(nu)},Vn.prototype.find=function(e){return this.filter(e).head()},Vn.prototype.findLast=function(e){return this.reverse().find(e)},Vn.prototype.invokeMap=Hr(function(e,t){return"function"==typeof e?new Vn(this):this.map(function(n){return Er(n,e,t)})}),Vn.prototype.reject=function(e){return this.filter(Ba(oo(e)))},Vn.prototype.slice=function(e,t){e=hs(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=hs(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(p)},gr(Vn.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Dn[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Dn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof Vn,c=s[0],l=u||Ga(t),d=function(e){var t=o.apply(Dn,Tt([e],s));return i&&p?t[0]:t};l&&n&&"function"==typeof c&&1!=c.length&&(u=l=!1);var p=this.__chain__,h=!!this.__actions__.length,f=a&&!p,y=u&&!h;if(!a&&l){t=y?t:new Vn(this);var m=e.apply(t,s);return m.__actions__.push({func:pa,args:[d],thisArg:r}),new Ln(m,p)}return f&&y?e.apply(this,s):(m=this.thru(d),f?i?m.value()[0]:m.value():m)})}),Pt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Dn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ga(i)?i:[],e)}return this[n](function(n){return t.apply(Ga(n)?n:[],e)})}}),gr(Vn.prototype,function(e,t){var n=Dn[t];if(n){var r=n.name+"";xe.call(kn,r)||(kn[r]=[]),kn[r].push({name:t,func:n})}}),kn[Mi(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=Ga(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=vn(t,e+a);break;case"takeRight":e=mn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,c=r?s:a-1,l=this.__iteratees__,d=l.length,p=0,h=vn(u,this.__takeCount__);if(!n||!r&&i==u&&h==u)return di(e,this.__actions__);var f=[];e:for(;u--&&p<h;){for(var y=-1,m=e[c+=t];++y<d;){var v=l[y],g=v.iteratee,_=v.type,b=g(m);if(2==_)m=b;else if(!b){if(1==_)continue e;break e}}f[p++]=m}return f},Dn.prototype.at=ha,Dn.prototype.chain=function(){return da(this)},Dn.prototype.commit=function(){return new Ln(this.value(),this.__chain__)},Dn.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__++]}},Dn.prototype.plant=function(e){for(var t,n=this;n instanceof Rn;){var i=Do(n);i.__index__=0,i.__values__=r,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},Dn.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:pa,args:[Qo],thisArg:r}),new Ln(t,this.__chain__)}return this.thru(Qo)},Dn.prototype.toJSON=Dn.prototype.valueOf=Dn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Dn.prototype.first=Dn.prototype.head,Je&&(Dn.prototype[Je]=function(){return this}),Dn}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(lt._=hn,define(function(){return hn})):pt?((pt.exports=hn)._=hn,dt._=hn):lt._=hn}.call(this)},1657(e){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},803(e){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)},1635(e,t,n){"use strict";n.d(t,{__assign:()=>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)};Object.create,Object.create}},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,{createPayPalCommerceAlternativeMethodsPaymentStrategy:()=>ge,createPayPalCommerceButtonStrategy:()=>pt,createPayPalCommerceCreditButtonStrategy:()=>yt,createPayPalCommerceCreditCardsPaymentStrategy:()=>Be,createPayPalCommerceCreditCustomerStrategy:()=>it,createPayPalCommerceCreditPaymentStrategy:()=>re,createPayPalCommerceCreditWalletStrategy:()=>Ot,createPayPalCommerceCustomerStrategy:()=>Ze,createPayPalCommerceFastlaneCustomerStrategy:()=>lt,createPayPalCommerceFastlanePaymentStrategy:()=>$e,createPayPalCommercePaymentStrategy:()=>Q,createPayPalCommerceRatePayPaymentStrategy:()=>Me,createPayPalCommerceVenmoButtonStrategy:()=>gt,createPayPalCommerceVenmoCustomerStrategy:()=>st,createPayPalCommerceVenmoPaymentStrategy:()=>ae,createPayPalCommerceWalletStrategy:()=>It});var e=n(315);function t(e,t){return Object.assign(e,{resolveIds:t})}var i,o=n(8686),a=n(4043);class s 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 u extends s{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"}(i||(i={}));class c extends s{constructor(e){super(function(e){switch(e){case i.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case i.MissingCart:return"Unable to proceed because cart data is unavailable.";case i.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case i.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case i.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case i.MissingCheckoutConfig:case i.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case i.MissingOrder:return"Unable to proceed because order data is unavailable.";case i.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case i.MissingPayment:return"Unable to proceed because payment data is unavailable.";case i.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case i.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case i.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}const l={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"},d=["ar_BH","ar_DZ","ar_EG","ar_JO","ar_KW","ar_MA","ar_OM","ar_QA","ar_SA","ar_TN","ar_YE","ar_AE","bg_BG","cs_CZ","da_DK","da_FO","da_GL","de_AT","de_CH","de_DE","de_LU","el_GR","en_AD","en_AE","en_AG","en_AI","en_AL","en_AM","en_AN","en_AO","en_AT","en_AU","en_AW","en_AZ","en_BB","en_BE","en_BH","en_BJ","en_BM","en_BN","en_BS","en_BT","en_BW","en_BY","en_BZ","en_C2","en_CA","en_CD","en_CG","en_CH","en_CI","en_CK","en_CL","en_CM","en_CN","en_CO","en_CR","en_CV","en_CY","en_CZ","en_DE","en_DJ","en_DK","en_DM","en_DO","en_DZ","en_EC","en_EE","en_EG","en_ER","en_ES","en_ET","en_FI","en_FJ","en_FK","en_FM","en_FO","en_FR","en_GA","en_GB","en_GD","en_GE","en_GF","en_GI","en_GL","en_GM","en_GN","en_GP","en_GR","en_GT","en_GW","en_GY","en_HK","en_HN","en_HR","en_HU","en_ID","en_IE","en_IL","en_IN","en_IS","en_IT","en_JM","en_JO","en_JP","en_KE","en_KG","en_KH","en_KI","en_KM","en_KN","en_KR","en_KW","en_KY","en_KZ","en_LA","en_LC","en_LI","en_LK","en_LS","en_LT","en_LU","en_LV","en_MA","en_MC","en_MD","en_ME","en_MG","en_MH","en_MK","en_ML","en_MN","en_MQ","en_MR","en_MS","en_MT","en_MU","en_MV","en_MW","en_MY","en_MZ","en_NA","en_NC","en_NE","en_NF","en_NG","en_NI","en_NL","en_NO","en_NP","en_NR","en_NU","en_NZ","en_OM","en_PA","en_PE","en_PF","en_PG","en_PH","en_PL","en_PM","en_PN","en_PT","en_PW","en_PY","en_QA","en_RE","en_RO","en_RS","en_RU","en_RW","en_SA","en_SB","en_SC","en_SE","en_SG","en_SH","en_SI","en_SJ","en_SK","en_SL","en_SM","en_SN","en_SO","en_SR","en_ST","en_SV","en_SZ","en_TC","en_TD","en_TG","en_TH","en_TJ","en_TM","en_TN","en_TO","en_TR","en_TT","en_TV","en_TW","en_TZ","en_UA","en_UG","en_US","en_UY","en_VA","en_VC","en_VE","en_VG","en_VN","en_VU","en_WF","en_WS","en_YE","en_YT","en_ZA","en_ZM","en_ZW","es_AD","es_AI","es_AO","es_AR","es_AW","es_BB","es_BJ","es_BM","es_BO","es_BS","es_BZ","es_CD","es_CG","es_CK","es_CL","es_CO","es_CR","es_CV","es_DJ","es_DM","es_DO","es_DZ","es_EC","es_EG","es_ER","es_ES","es_ET","es_FJ","es_FK","es_FO","es_GA","es_GD","es_GE","es_GI","es_GL","es_GM","es_GN","es_GT","es_GW","es_GY","es_HN","es_IE","es_JM","es_JO","es_KE","es_KG","es_KI","es_KM","es_KN","es_KW","es_KY","es_KZ","es_LC","es_LI","es_LS","es_LU","es_MA","es_MG","es_MH","es_ML","es_MR","es_MS","es_MU","es_MW","es_MX","es_MZ","es_NA","es_NC","es_NE","es_NF","es_NI","es_NR","es_NU","es_NZ","es_OM","es_PA","es_PE","es_PF","es_PG","es_PM","es_PN","es_PW","es_PY","es_QA","es_RS","es_RW","es_SA","es_SB","es_SC","es_SH","es_SJ","es_SL","es_SM","es_SN","es_SO","es_SR","es_ST","es_SV","es_SZ","es_TC","es_TD","es_TG","es_TJ","es_TM","es_TN","es_TT","es_TV","es_UA","es_UG","es_US","es_UY","es_VA","es_VC","es_VE","es_VG","es_VU","es_WF","es_YE","es_ZM","et_EE","fi_FI","fr_AD","fr_AE","fr_AI","fr_AM","fr_AO","fr_AW","fr_AZ","fr_BB","fr_BE","fr_BF","fr_BI","fr_BJ","fr_BM","fr_BS","fr_BZ","fr_CA","fr_CD","fr_CG","fr_CH","fr_CI","fr_CK","fr_CM","fr_CV","fr_DJ","fr_DM","fr_DO","fr_DZ","fr_EC","fr_ER","fr_ET","fr_FJ","fr_FK","fr_FO","fr_FR","fr_GA","fr_GD","fr_GE","fr_GF","fr_GI","fr_GL","fr_GM","fr_GN","fr_GP","fr_GT","fr_GW","fr_GY","fr_HN","fr_IE","fr_JM","fr_JO","fr_KE","fr_KG","fr_KI","fr_KM","fr_KN","fr_KW","fr_KY","fr_KZ","fr_LC","fr_LI","fr_LS","fr_LU","fr_MA","fr_MC","fr_MG","fr_MH","fr_ML","fr_MQ","fr_MR","fr_MS","fr_MU","fr_MW","fr_MZ","fr_NA","fr_NC","fr_NE","fr_NF","fr_NI","fr_NR","fr_NU","fr_NZ","fr_OM","fr_PA","fr_PE","fr_PF","fr_PG","fr_PM","fr_PN","fr_PW","fr_QA","fr_RE","fr_RS","fr_RW","fr_SA","fr_SB","fr_SC","fr_SH","fr_SJ","fr_SL","fr_SM","fr_SN","fr_SO","fr_SR","fr_ST","fr_SV","fr_SZ","fr_TC","fr_TD","fr_TG","fr_TJ","fr_TM","fr_TN","fr_TT","fr_TV","fr_UA","fr_UG","fr_US","fr_UY","fr_VA","fr_VC","fr_VE","fr_VG","fr_VU","fr_WF","fr_YE","fr_YT","fr_ZA","fr_ZM","he_IL","hu_HU","id_ID","it_IT","ja_JP","ko_KR","lv_LV","lt_LT","ms_BN","ms_MY","nl_BE","nl_NL","pl_PL","pt_BR","pt_PT","ro_RO","ru_EE","ru_LT","ru_LV","ru_RU","ru_UA","si_LK","sk_SK","sl_SI","sq_AL","sv_SE","tl_PH","th_TH","tr_TR","vi_VN","zh_C2","zh_CN","zh_HK","zh_TW","zh_AD","zh_AE","zh_AI","zh_AO","zh_AW","zh_BB","zh_BH","zh_BJ","zh_BM","zh_BS","zh_BZ","zh_CD","zh_CG","zh_CK","zh_CL","zh_CO","zh_CV","zh_DJ","zh_DM","zh_DO","zh_DZ","zh_EC","zh_EG","zh_ER","zh_ET","zh_FJ","zh_FK","zh_FO","zh_GA","zh_GD","zh_GE","zh_GI","zh_GL","zh_GM","zh_GN","zh_GT","zh_GW","zh_GY","zh_HN","zh_IE","zh_JM","zh_JO","zh_KE","zh_KG","zh_KI","zh_KM","zh_KN","zh_KW","zh_KY","zh_KZ","zh_LC","zh_LI","zh_LS","zh_LT","zh_LU","zh_MA","zh_MG","zh_MH","zh_ML","zh_MR","zh_MS","zh_MU","zh_MW","zh_MZ","zh_NA","zh_NC","zh_NE","zh_NF","zh_NI","zh_NR","zh_NU","zh_NZ","zh_OM","zh_PA","zh_PE","zh_PF","zh_PG","zh_PM","zh_PN","zh_PW","zh_QA","zh_RS","zh_RW","zh_SA","zh_SB","zh_SC","zh_SH","zh_SJ","zh_SL","zh_SM","zh_SN","zh_SO","zh_SR","zh_ST","zh_SV","zh_SZ","zh_TC","zh_TD","zh_TG","zh_TJ","zh_TM","zh_TN","zh_TT","zh_TV","zh_UA","zh_UG","zh_US","zh_UY","zh_VA","zh_VC","zh_VE","zh_VG","zh_VU","zh_WF","zh_YE","zh_ZA","zh_ZM"];function p(e){if(!e)return;let t;if(e.includes("-")){const[n,r]=e.split("-");t=`${n}_${r.toUpperCase()}`}else t=`${e}_${e.toUpperCase()}`;return d.includes(t)?t:void 0}var h=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class f{constructor(e){this.scriptLoader=e,this.window=window}getPayPalSDK(e,t,n,r,i){return h(this,void 0,void 0,function*(){if(!this.window.paypal||i){const i=this.getPayPalSdkScriptConfigOrThrow(e,t,n,r);if(yield this.loadPayPalSdk(i),!this.window.paypal)throw new u}return this.window.paypal})}getPayPalFastlaneSdk(e,t,n,r){return h(this,void 0,void 0,function*(){if(!this.window.paypalFastlaneSdk){const i=this.getPayPalFastlaneSdkConfiguration(e,t,n,r);if(yield this.loadPayPalSdk(i),!this.window.paypalFastlaneSdk)throw new u}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(e,t,n,r,i){return h(this,void 0,void 0,function*(){if(!this.window.paypalGooglePay||i){const i=this.getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n,r);yield this.loadPayPalSdk(i)}if(!this.window.paypalGooglePay)throw new u;return this.window.paypalGooglePay})}getPayPalApmsSdk(e,t,n){return h(this,void 0,void 0,function*(){if(!this.window.paypalApms){const r=this.getPayPalApmSdkConfiguration(e,t,n);if(yield this.loadPayPalSdk(r),!this.window.paypalApms)throw new u}return this.window.paypalApms})}getPayPalMessages(e,t,n){return h(this,void 0,void 0,function*(){if(!this.window.paypalMessages){const r=this.getPayPalSdkMessagesConfiguration(e,t,n);yield this.loadPayPalSdk(r)}if(!this.window.paypalMessages)throw new u;return this.window.paypalMessages})}loadPayPalSdk(e){return h(this,arguments,void 0,function*({options:e,attributes:t}){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})})}getPayPalSdkScriptConfigOrThrow(e,t,n,r=!0){const{id:o,clientToken:a,initializationData:s}=e;if(!s||!s.clientId)throw new c(i.MissingPaymentMethod);const{intent:u,clientId:l,merchantId:d,buyerCountry:h,attributionId:f,isVenmoEnabled:y,isHostedCheckoutEnabled:m,isPayPalCreditAvailable:v,isDeveloperModeApplicable:g,availableAlternativePaymentMethods:_=[],enabledAlternativePaymentMethods:b=[],isGooglePayEnabled:S}=s,w=m||r,I="paypalcommercecreditcards"===o||"bigcommerce_payments_creditcards"===o,P=I?["card"]:[],C=v?["credit","paylater"]:[],O=y?["venmo"]:[],A=S?["googlepay"]:[],E=r?["card-fields"]:[],k=[...I?[]:["card"],...v?[]:["credit","paylater"],...y?[]:["venmo"],..._.filter(e=>!b.includes(e))],z=[...P,...C,...O,...b],T=p(n);return{options:Object.assign(Object.assign({"client-id":l,"merchant-id":d,"enable-funding":z.length>0?z:void 0,"disable-funding":k.length>0?k:void 0,commit:w,components:["buttons","hosted-fields","payment-fields","legal",...A,...E],currency:t,intent:u},g&&{"buyer-country":h}),T&&{locale:T}),attributes:{"data-partner-attribution-id":f,"data-client-token":a}}}getPayPalFastlaneSdkConfiguration(e,t,n,r){const{clientToken:o,initializationData:a}=e;if(!a||!a.clientId)throw new c(i.MissingPaymentMethod);const{intent:s,clientId:u,merchantId:l,attributionId:d}=a,h=p(r);return{options:Object.assign(Object.assign({"client-id":u,"merchant-id":l,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:t},h&&{locale:h}),{intent:s}),attributes:{"data-client-metadata-id":n.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":d,"data-sdk-client-token":o}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n,r=!0){const{clientToken:o,initializationData:a}=e;if(!a||!a.clientId)throw new c(i.MissingPaymentMethod);const{intent:s,clientId:u,merchantId:l,buyerCountry:d,attributionId:h,isHostedCheckoutEnabled:f,isDeveloperModeApplicable:y}=a,m=f||r,v=p(n);return{options:Object.assign(Object.assign({"client-id":u,"merchant-id":l,commit:m,components:["googlepay"],currency:t,intent:s},y&&{"buyer-country":d}),v&&{locale:v}),attributes:{"data-partner-attribution-id":h,"data-client-token":o,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(e,t,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new c(i.MissingPaymentMethod);const{intent:o,clientId:a,merchantId:s,buyerCountry:u,attributionId:l,isDeveloperModeApplicable:d,availableAlternativePaymentMethods:h=[],enabledAlternativePaymentMethods:f=[]}=r,y=f,m=h.filter(e=>!f.includes(e)),v=p(n);return{options:Object.assign(Object.assign({"client-id":a,"merchant-id":s,"enable-funding":y.length>0?y:void 0,"disable-funding":m.length>0?m:void 0,commit:!0,components:["buttons","payment-fields"],currency:t,intent:o},d&&{"buyer-country":u}),v&&{locale:v}),attributes:{"data-partner-attribution-id":l,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(e,t,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new c(i.MissingPaymentMethod);const{clientId:o,merchantId:a,attributionId:s,isDeveloperModeApplicable:u,buyerCountry:l}=r,d=p(n);return{options:Object.assign(Object.assign({"client-id":o,"merchant-id":a,components:["messages"],currency:t},u&&{"buyer-country":l}),d&&{locale:d}),attributes:{"data-namespace":"paypalMessages","data-partner-attribution-id":s}}}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 y(){return new f((0,e.vQ)())}var m=n(9440);class v extends s{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 g={body:{},headers:{},status:0};class _ extends s{constructor(e,{message:t,errors:n}={}){const{body:r,headers:i,status:o}=e||g;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 b,S,w,I,P,C,O,A,E,k,z;!function(e){e.BuyNow="BUY_NOW",e.INVOICE="B2B_INVOICE"}(b||(b={})),function(e){e.AUTHORIZE="authorize",e.CAPTURE="capture"}(S||(S={})),function(e){e.Always="SCA_ALWAYS"}(w||(w={})),function(e){e.Succeeded="succeeded",e.Cancelled="cancelled",e.Errored="errored"}(I||(I={})),function(e){e.Possible="POSSIBLE",e.No="NO",e.Unknown="UNKNOWN",e.Yes="YES"}(P||(P={})),function(e){e.paypal="paypal",e.checkout="checkout",e.buynow="buynow",e.pay="pay",e.installment="installment"}(C||(C={})),function(e){e.gold="gold",e.blue="blue",e.silver="silver",e.black="black",e.white="white"}(O||(O={})),function(e){e.pill="pill",e.rect="rect"}(A||(A={})),function(e){e.SUCCEEDED="succeeded",e.FAILED="failed",e.CANCELED="canceled",e.UNRECOGNIZED="unrecognized"}(E||(E={})),function(e){e.OXXO="oxxo"}(k||(k={})),function(e){e.Approved="APPROVED",e.Created="CREATED",e.PayerActionRequired="PAYER_ACTION_REQUIRED",e.PollingStop="POLLING_STOP",e.PollingError="POLLING_ERROR"}(z||(z={}));var T=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class j{constructor(e,t,n,r){this.formPoster=e,this.paymentIntegrationService=t,this.paypalRequestSender=n,this.paypalSdkLoader=r}loadPayPalSdk(e,t,n,r){return T(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=t||i.getCartOrThrow().currency.code,a=i.getPaymentMethodOrThrow(e),s=i.getLocale();return this.paypalSdk=yield this.paypalSdkLoader.getPayPalSDK(a,o,s,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new u;return this.paypalSdk}createBuyNowCartOrThrow(e){return T(this,void 0,void 0,function*(){const t=e.getBuyNowCartRequestBody();if(!t)throw new c(i.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(t)}catch(e){throw new v}})}createOrder(e,t){return T(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.paypalRequestSender.createOrder(e,Object.assign({cartId:n},t));return r})}createOrderCardFields(e,t){return T(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.paypalRequestSender.createOrder(e,Object.assign({cartId:n},t));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(e,t,n,r){return T(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=i.getCartOrThrow();let a;r||(a=i.getConsignmentsOrThrow()[0]);try{yield this.paypalRequestSender.updateOrder(e,Object.assign(Object.assign({availableShippingOptions:r?[]:null==a?void 0:a.availableShippingOptions,cartId:o.id,selectedShippingOption:r?null:null==a?void 0:a.selectedShippingOption},t?{methodId:t}:{}),n?{orderId:n}:{}))}catch(e){throw new _}})}getOrderStatus(e,t){return T(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalRequestSender.getOrderStatus(e,t);return n}catch(e){throw new _}})}tokenizePayment(e,t){const n=this.paymentIntegrationService.getState().getCartOrThrow();if(!t)throw new c(i.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:e,order_id:t},n.source===b.BuyNow&&{cart_id:n.id}))}submitPayment(e,t,n){return T(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=>{if(t.selectedShippingOption){const n=t.selectedShippingOption.id;return e.id===n}return!1}))||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&&O[t]?t:void 0,height:this.getValidHeight(n),label:r&&C[r]?r:void 0,shape:i&&A[i]?i:void 0};return(0,m.omitBy)(o,m.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 B;!function(e){e.Json="application/json",e.JsonV1="application/vnd.bc.v1+json"}(B||(B={}));const F=B,N={"X-Checkout-SDK-Version":"1.945.0"};var M=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class D{constructor(e){this.requestSender=e}createOrder(e,t){return M(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${e}`,r=t,i=Object.assign({"X-API-INTERNAL":x,"Content-Type":F.Json},N);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(e,t){return M(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${e}`,r=t,i=Object.assign({"X-API-INTERNAL":x,"Content-Type":F.Json},N);return(yield this.requestSender.put(n,{headers:i,body:r})).body})}getOrderStatus(e,t){return M(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${e}`,r=Object.assign({"X-API-INTERNAL":x,"Content-Type":F.Json},N);return(yield this.requestSender.get(n,Object.assign({headers:r},t))).body})}}const U=e=>{const{getHost:t}=e.getState();return new j((0,o.createFormPoster)(),e,new D((0,a.createRequestSender)({host:t()})),y())},R={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},L="embedded-checkout-loading-indicator-rotation";class V{constructor(e){this.styles=Object.assign(Object.assign({},R),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=`${L} 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(L))return;const t=document.createElement("style");t.id=L,null===(e=document.head)||void 0===e||e.appendChild(t),t.sheet instanceof CSSStyleSheet&&t.sheet.insertRule(`\n @keyframes ${L} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}class G extends s{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class q extends G{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 $ 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 W extends s{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 K(e){return Boolean(e.instrumentId)}const Y=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};function Z(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 J=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class X{constructor(e,t,n,r){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.payPalSdkScriptLoader=n,this.loadingIndicator=r}initialize(e){return J(this,void 0,void 0,function*(){var t;const{methodId:n,paypalcommerce:r}=e||{};if(this.paypalcommerce=r,!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new G('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(n);const i=this.paymentIntegrationService.getState(),o=i.getPaymentMethodOrThrow(n),{container:a,bannerContainerId:s}=r,{orderId:u,paypalBNPLConfiguration:c=[],isPayPalCreditAvailable:l}=o.initializationData||{};if(void 0!==s){if(!document.getElementById(s))return void console.error("Unable to create banner without valid banner container ID.");const e=null==c?void 0:c.find(({id:e})=>"checkout"===e);if(l||!(null==e?void 0:e.status))return;const t=yield this.payPalSdkScriptLoader.getPayPalMessages(o,i.getCartOrThrow().currency.code,i.getLocale());return t&&"function"==typeof(null==t?void 0:t.Messages)?this.renderMessages(t,s,e):void console.error("[BC PayPalCommerce PayLater]: banner could not be rendered, due to issues with loading PayPal SDK")}u?this.orderId=null===(t=o.initializationData)||void 0===t?void 0:t.orderId:(this.loadingIndicatorContainer=null==a?void 0:a.split("#")[1],yield this.paypalIntegrationService.loadPayPalSdk(n),r.onInit&&"function"==typeof r.onInit&&r.onInit(()=>this.renderButton(n,r)),(void 0===r.shouldRenderPayPalButtonOnInitialization||r.shouldRenderPayPalButtonOnInitialization)&&this.renderButton(n,r))})}execute(e,t){return J(this,void 0,void 0,function*(){var n,r;const{payment:i}=e,o=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:a}=this.paypalcommerce||{};if(!i)throw new q(["payment"]);const{methodId:s,paymentData:u}=i;if(this.isPayPalVaultedInstrumentPaymentData(u)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new $;const c=this.isPayPalVaultedInstrumentPaymentData(u)?this.prepareVaultedInstrumentPaymentPayload(s,this.orderId,u):this.preparePaymentPayload(s,this.orderId,u);try{yield this.paymentIntegrationService.submitOrder(o,t),yield this.paymentIntegrationService.submitPayment(c)}catch(e){if(function(e){var t;return(e=>"object"==typeof e&&null!==e&&"body"in e)(e)&&"offsite_redirect"===(null===(t=e.body.additional_action_required)||void 0===t?void 0:t.type)}(e)){const t=null===(r=null===(n=e.body.additional_action_required)||void 0===n?void 0:n.data)||void 0===r?void 0:r.redirect_url;return new Promise(()=>window.location.replace(t))}return this.isProviderError(e)&&(yield this.paypalIntegrationService.loadPayPalSdk(i.methodId),yield new Promise((e,t)=>{var n;this.paypalcommerce&&(null===(n=this.paypalButton)||void 0===n||n.close(),this.renderButton(i.methodId,this.paypalcommerce),this.handleError(new Error("INSTRUMENT_DECLINED"),a)),t()})),this.handleError(e,a),Promise.reject()}})}finalize(){return Promise.reject(new W)}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){const n=this.paypalIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=t;if(!a)throw new G('Unable to initialize payment because "container" argument is not provided.');const d=this.getSmartButtonContainerId(a);if(!document.getElementById(d))throw new G(`Unable to initialize payment because element with id ${d} does not exist.`);const p={fundingSource:n.FUNDING.PAYPAL,style:this.paypalIntegrationService.getValidButtonStyle(o),createOrder:()=>this.createOrder(),onClick:(e,t)=>this.handleClick(t,c),onApprove:e=>this.handleApprove(e,l),onError:e=>this.handleError(e,s),onCancel:()=>this.toggleLoadingIndicator(!1)};this.paypalButton=n.Buttons(p),this.paypalButton.isEligible()&&(u&&"function"==typeof u&&u(),this.paypalButton.render(a))}handleClick(e,t){return J(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;return 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 J(this,void 0,void 0,function*(){const e=this.getFieldsValues();return this.paypalIntegrationService.createOrder("paypalcommercecheckout",{shouldSaveInstrument:(null==e?void 0:e.shouldSaveInstrument)||!1})})}getFieldsValues(){const{getFieldsValues:e}=this.paypalcommerce||{};return"function"==typeof e?e():void 0}isTrustedVaultingFlow(e){if(e&&K(e)){const t=this.paymentIntegrationService.getState().getInstruments(),n=null==t?void 0:t.find(t=>Z(t)&&t.bigpayToken===e.instrumentId);return!(Z(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(e){return!!e&&K(e)&&H(e)}renderMessages(e,t,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:Y(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)}getSmartButtonContainerId(e){var t;return null!==(t=e.split("#")[1])&&void 0!==t?t:e}}const Q=t(t=>new X(t,U(t),new f((0,e.vQ)()),new V({containerStyles:l})),[{id:"paypalcommerce"}]);class ee extends s{constructor(e){super(e||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}var te=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class ne{constructor(e,t,n,r){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.loadingIndicator=n,this.payPalSdkScriptLoader=r}initialize(e){return te(this,void 0,void 0,function*(){const{methodId:t,paypalcommerce:n,paypalcommercecredit:r}=e||{},i=r||n;if(!t)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new G('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(t);const o=this.paymentIntegrationService.getState(),a=o.getPaymentMethodOrThrow(t),{paypalBNPLConfiguration:s=[],orderId:u}=a.initializationData||{},{bannerContainerId:c,container:l}=i;if(void 0!==c){if(!document.getElementById(c))return void console.error("Unable to create banner without valid banner container ID.");const e=s&&s.find(({id:e})=>"checkout"===e);if(!(null==e?void 0:e.status))return;const t=yield this.payPalSdkScriptLoader.getPayPalMessages(a,o.getCartOrThrow().currency.code,o.getLocale());return this.renderMessages(t,c,e)}u?this.orderId=u:(yield this.paypalIntegrationService.loadPayPalSdk(t),this.loadingIndicatorContainer=null==l?void 0:l.split("#")[1],this.renderButton(t,i))})}execute(e,t){return te(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 q(["payment"]);if(!this.orderId)throw new $;yield this.paymentIntegrationService.submitOrder(r,t),yield this.paypalIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new W)}deinitialize(){var e;return this.orderId=void 0,null===(e=this.paypalButton)||void 0===e||e.close(),Promise.resolve()}renderButton(e,t){if(!(null==t?void 0:t.container))throw new G('Unable to initialize payment because "container" argument is not provided.');const n=this.paypalIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=t,d=[n.FUNDING.PAYLATER,n.FUNDING.CREDIT];let p=!1;d.forEach(e=>{if(p)return;const t={fundingSource:e,style:this.paypalIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalIntegrationService.createOrder("paypalcommercecreditcheckout"),onClick:(e,t)=>this.handleClick(t,c),onApprove:e=>this.handleApprove(e,l),onCancel:()=>this.toggleLoadingIndicator(!1),onError:e=>this.handleError(e,s)};if(this.paypalButton=n.Buttons(t),this.paypalButton.isEligible()||e!==n.FUNDING.PAYLATER){if(!this.paypalButton.isEligible()&&e===n.FUNDING.CREDIT)throw new ee(`PayPal ${e} is not available for your region. Please use PayPal Checkout instead.`);u&&"function"==typeof u&&u(),this.paypalButton.render(a),p=!0}})}handleClick(e,t){return te(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;if(t&&"function"==typeof t)return 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:Y(n)};e.Messages(r).render(`#${t}`)}}const re=t(e=>new ne(e,U(e),new V({containerStyles:l}),y()),[{id:"paypalcommercecredit"}]);var ie=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class oe{constructor(e,t,n){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.loadingIndicator=n}initialize(e){return ie(this,void 0,void 0,function*(){var t,n;const{methodId:r,paypalcommerce:i,paypalcommercevenmo:o}=e||{},a=o||i;if(!r)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!a)throw new G('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(r);const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(r);(null===(t=s.initializationData)||void 0===t?void 0:t.orderId)?this.orderId=null===(n=s.initializationData)||void 0===n?void 0:n.orderId:(yield this.paypalIntegrationService.loadPayPalSdk(r),this.loadingIndicatorContainer=a.container.split("#")[1],this.renderButton(r,a))})}execute(e,t){return ie(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 q(["payment"]);if(!this.orderId)throw new $;yield this.paymentIntegrationService.submitOrder(r,t),yield this.paypalIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new W)}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.paypalIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:u,onValidate:c,submitForm:l}=t,d={fundingSource:n.FUNDING.VENMO,style:this.paypalIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalIntegrationService.createOrder("paypalcommercevenmocheckout"),onClick:(e,t)=>this.handleClick(t,c),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 ee("PayPal Venmo is not available for your region. Please use PayPal Checkout instead.");u&&"function"==typeof u&&u(),this.paypalButton.render(a)}handleClick(e,t){return ie(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;return 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 ae=t(e=>new oe(e,U(e),new V({containerStyles:l,styles:{backgroundColor:"black"}})),[{id:"paypalcommercevenmo"}]),se={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};class ue extends _{constructor(e){super(e,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}var ce,le,de,pe,he,fe,ye;!function(e){e.Possible="POSSIBLE",e.No="NO",e.Unknown="UNKNOWN",e.Yes="YES"}(ce||(ce={})),function(e){e.AUTHORIZE="authorize",e.CAPTURE="capture"}(le||(le={})),function(e){e.paypal="paypal",e.checkout="checkout",e.buynow="buynow",e.pay="pay",e.installment="installment"}(de||(de={})),function(e){e.gold="gold",e.blue="blue",e.silver="silver",e.black="black",e.white="white"}(pe||(pe={})),function(e){e.pill="pill",e.rect="rect"}(he||(he={})),function(e){e.OXXO="oxxo",e.IDEAL="ideal"}(fe||(fe={})),function(e){e.Approved="APPROVED",e.Created="CREATED",e.PayerActionRequired="PAYER_ACTION_REQUIRED",e.PollingStop="POLLING_STOP",e.PollingError="POLLING_ERROR"}(ye||(ye={}));var me=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class ve{constructor(e,t,n,r,i=3e3,o=3e5){this.paymentIntegrationService=e,this.paypalCommerceIntegrationService=t,this.paypalSdkScriptLoader=n,this.loadingIndicator=r,this.pollingInterval=i,this.maxPollingIntervalTime=o,this.pollingTimer=0,this.stopPolling=m.noop,this.isOrderApprovedProcessing=!1}initialize(e){return me(this,void 0,void 0,function*(){const{gatewayId:t,methodId:n,paypalcommerce:r,paypalcommercealternativemethods:i}=e,o=i||r;if(this.paypalcommercealternativemethods=i,!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!o)throw new G('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');const a=this.paymentIntegrationService.getState(),s=a.getPaymentMethodOrThrow(n,t),{orderId:u,shouldRenderFields:c}=s.initializationData||{},l=a.getStoreConfigOrThrow().checkoutSettings.features;this.isOrderApprovedProcessing=function(e,t,n=!0){var r;return null!==(r=e["PAYPAL-5431.order_approved_processing"])&&void 0!==r?r:n}(l,0,!1),u?this.orderId=u:(this.paypalApms=yield this.paypalSdkScriptLoader.getPayPalApmsSdk(s,a.getCartOrThrow().currency.code,a.getLocale()),this.loadingIndicatorContainer=o.container.split("#")[1],this.renderButton(n,t,o),c&&this.renderFields(n,o))})}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 q(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new $;this.isOrderApprovedProcessing||"ideal"!==i||(yield new Promise((e,t)=>{this.initializePollingMechanism(i,e,t,o)})),this.isNonInstantPaymentMethod(i)&&(i!==fe.IDEAL||this.isOrderApprovedProcessing)||(yield this.paymentIntegrationService.submitOrder(r,t)),yield this.paypalCommerceIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new W)}deinitialize(){var e;return this.orderId=void 0,this.isOrderApprovedProcessing||this.resetPollingMechanism(),null===(e=this.paypalButton)||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.paypalCommerceIntegrationService.getOrderStatus(null!=r?r:"paypalcommerce"),o=i===ye.Approved,a=i===ye.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,paypalcommercealternativemethods:this.paypalcommercealternativemethods}),this.handleError(new ue)}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.paypalcommercealternativemethods||{};this.isOrderApprovedProcessing||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:u,submitForm:c}=n,l={fundingSource:e,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),onInit:(e,t)=>n.onInitButton(t),createOrder:()=>this.onCreateOrder(e,t,n),onApprove:e=>this.handleApprove(e,c),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.paypalButton=r.Buttons(l),this.paypalButton.isEligible()&&(u&&"function"==typeof u&&u(),this.paypalButton.render(a))}onCreateOrder(e,t,n){return me(this,void 0,void 0,function*(){var r;const{onValidate:i}=n;yield i(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),m.noop);const o=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout");if(this.isNonInstantPaymentMethod(e)&&(e===fe.IDEAL&&this.isOrderApprovedProcessing||e===fe.OXXO)){const n={useStoreCredit:!1},i={params:{methodId:e,gatewayId:t}};if(yield this.paymentIntegrationService.submitOrder(n,i),e===fe.IDEAL){const t=null===(r=this.paymentIntegrationService.getState().getOrder())||void 0===r?void 0:r.orderId;yield this.paypalCommerceIntegrationService.updateOrder("paypalcommercealternativemethods",e,t)}yield this.paypalCommerceIntegrationService.submitPayment(e,o,t)}return o})}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:u}=t;if(!s)throw new G('Unable to initialize payment because "options.paypalcommercealternativemethods" argument should contain "apmFieldsContainer".');const c=document.querySelector(s);c&&(c.innerHTML="");const l={fundingSource:e,style:u||{},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 fe}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new u;return this.paypalApms}}const ge=t(e=>new ve(e,U(e),y(),new V({containerStyles:se})),[{gateway:"paypalcommercealternativemethods"}]);var _e;!function(e){e.CVV="cvv",e.PAN="pan"}(_e||(_e={}));class be{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){be.set(e,"",Object.assign({expires:new Date(0)},t))}}var Se,we=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class Ie{constructor(){this.window=window}initializePayPalFastlane(e,t,n){return we(this,void 0,void 0,function*(){if(t&&(window.localStorage.setItem("fastlaneEnv","sandbox"),window.localStorage.setItem("axoEnv","sandbox")),!this.window.paypalFastlane){const t={root:{backgroundColorPrimary:"transparent"}};this.window.paypalFastlane=yield e.Fastlane({styles:n||t})}return this.window.paypalFastlane})}getPayPalFastlaneOrThrow(){if(!this.window.paypalFastlane)throw new u;return this.window.paypalFastlane}lookupCustomerOrThrow(e){return we(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(e)})}triggerAuthenticationFlowOrThrow(e){return we(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};be.set("bc-fastlane-sessionId",e,n)}removeStorageSessionId(){be.remove("bc-fastlane-sessionId")}getStorageSessionId(){return be.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,u=null==a?void 0:a.shippingAddress,c=null==a?void 0:a.name,l=null==a?void 0:a.card,d=u?this.mapPayPalToBcAddress(u.address,u.name,u.phoneNumber):void 0,p=s&&c?this.mapPayPalToBcAddress(s,c,null==u?void 0:u.phoneNumber):void 0,h=l?this.mapPayPalToBcInstrument(e,l):[],f=this.filterAddresses([d,p]);return{authenticationState:o||E.UNRECOGNIZED,addresses:f,billingAddress:p,shippingAddress:d,instruments:h}}mapPayPalToBcInstrument(e,t){const{id:n,paymentSource:r}=t,{brand:i,expiry:o,lastDigits:a}=r.card,[s,u]=o.split("-");return[{bigpayToken:n,brand:i,defaultInstrument:!1,expiryMonth:u,expiryYear:s,iin:"",last4:a,method:e,provider:e,trustedShippingAddress:!1,untrustedShippingCardVerificationMode:_e.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,m.isEqual)(this.normalizeAddress(e),this.normalizeAddress(t))}normalizeAddress(e){return(0,m.omit)(e,["id","phone"])}}function Pe(){return new Ie}!function(e){e.CardCode="cardCode",e.CardCodeVerification="cardCodeVerification",e.CardExpiry="cardExpiry",e.CardName="cardName",e.CardNumber="cardNumber",e.CardNumberVerification="cardNumberVerification",e.CardExpiryVerification="cardExpiryVerification"}(Se||(Se={}));const Ce=Se;function Oe(e){return Ce.CardNumber in e&&Ce.CardName in e&&Ce.CardExpiry in e}function Ae(e){return Ce.CardNumberVerification in e&&Ce.CardCodeVerification in e&&Ce.CardExpiryVerification in e}class Ee extends s{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 ke;!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"}(ke||(ke={}));class ze extends s{constructor(e){super(function(e){switch(e){case ke.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case ke.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case ke.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case ke.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 s{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 je=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class xe{constructor(e,t,n,r){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(e){return je(this,void 0,void 0,function*(){const{methodId:t,paypalcommercecreditcards:n,paypalcommerce:r}=e,i=n||r,{form:o,onCreditCardFieldsRenderingError:a,onLoadComplete:s}=i||{};if(!t)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!o)throw new G('Unable to proceed because "options.paypalcommercecreditcards.form" argument is not provided.');this.hostedFormOptions=o,this.isCreditCardForm=Oe(o.fields),this.isCreditCardVaultedForm=Ae(o.fields)&&!this.hasUndefinedValues(),yield this.paymentIntegrationService.loadPaymentMethod(t),yield this.paypalIntegrationService.loadPayPalSdk(t,void 0,!0,!0),(this.isCreditCardForm||this.isCreditCardVaultedForm)&&(yield this.initializeFields(o,a)),null==s||s(),this.shouldInitializePayPalFastlane(t)&&(yield this.initializePayPalFastlaneOrThrow(t))})}execute(e,t){return je(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 q(["payment"]);if(this.executionPaymentData=o,this.isCreditCardForm||this.isCreditCardVaultedForm)yield this.validateHostedFormOrThrow(),yield this.submitHostedForm();else{const{orderId:e}=yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",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 W)}deinitialize(){return je(this,void 0,void 0,function*(){var e,t,n,r;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&&K(t)?t.instrumentId:void 0,s=(0,m.omitBy)({verification_nonce:r,token:a},m.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 je(this,void 0,void 0,function*(){const{fields:n,styles:r}=e,i=this.paypalIntegrationService.getPayPalSdkOrThrow(),o=this.getExecuteCallback(n),a=Object.assign({style:this.getInputStyles(r),onApprove:({orderID:e,vaultSetupToken:t,liabilityShift:n})=>{if(n===ce.No||n===ce.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 ze(ke.PaymentNotInitialized);try{this.stylizeInputContainers(n),Oe(n)&&(yield this.renderFields(n)),Ae(n)&&(yield this.renderVaultedFields(n))}catch(e){"function"==typeof t&&t(e)}})}getExecuteCallback(e){return Ae(e)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>je(this,void 0,void 0,function*(){const{setupToken:e}=(yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",Object.assign(Object.assign({},this.getInstrumentParams()),{setupToken:!0})))||{};return e})}}createOrderCallback(){return{createOrder:()=>je(this,void 0,void 0,function*(){const{orderId:e}=(yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",this.getInstrumentParams()))||{};return e})}}handleApprove({orderID:e,vaultSetupToken:t}){e&&(this.returnedOrderId=e),t&&(this.returnedVaultedToken=t)}renderFields(e){return je(this,void 0,void 0,function*(){var t,n,r,i;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){return je(this,void 0,void 0,function*(){var t,n,r;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(K(this.executionPaymentData)){const{instrumentId:e}=this.executionPaymentData;return{instrumentId:e}}return{}}getFieldTypeByEmittedField({emittedBy:e}){return{fieldType:this.mapFieldType(e)}}submitHostedForm(){return je(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(){return je(this,void 0,void 0,function*(){var e,t;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 Ce.CardCode:case Ce.CardCodeVerification:return{fieldType:e,message:"Invalid card code",type:"invalid_card_code"};case Ce.CardNumber:case Ce.CardNumberVerification:return{fieldType:e,message:"Invalid card number",type:"invalid_card_number"};case Ce.CardExpiry:case Ce.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 Ce.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?Ce.CardNumber:Ce.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?Ce.CardExpiry:Ce.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?Ce.CardCode:Ce.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new ze(ke.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.isPayPalCommerceAnalyticsV2Enabled)&&!(null==a?void 0:a.authenticationState)}initializePayPalFastlaneOrThrow(e){return je(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.paypalSdkScriptLoader.getPayPalFastlaneSdk(r,n.currency.code,n.id,t.getLocale());yield this.paypalFastlaneUtils.initializePayPalFastlane(o,!!(null==i?void 0:i.isDeveloperModeApplicable))}catch(e){}})}}const Be=t(e=>new xe(e,U(e),y(),Pe()),[{id:"paypalcommercecreditcards"}]);var Fe=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class Ne{constructor(e,t,n,r=3e3,i=3e5){this.paymentIntegrationService=e,this.paypalCommerceService=t,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=m.noop}initialize(e){return Fe(this,void 0,void 0,function*(){const{gatewayId:t,methodId:n,paypalcommerceratepay:r}=e;if(!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new G('Unable to initialize payment because "options.paypalcommerceratepay" argument is not provided.');const{legalTextContainer:i,container:o,loadingContainerId:a}=r;if(!o)throw new G('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new G('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new G('Unable to initialize payment because "options.loadingContainerId" argument is not provided.');this.loadingIndicatorContainer=a;const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(n,t),{merchantId:u}=s.initializationData||{};if(!u)throw new G("Unable to initialize payment because merchantId argument is not provided.");this.paypalcommerceratepay=r,yield this.paypalCommerceService.loadPayPalSdk(n),this.createFraudNetScript(u,n,t),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}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"]),{getFieldsValues:i}=this.paypalcommerceratepay||{};if(!n)throw new q(["payment"]);if(!i||"function"!=typeof i)throw new G('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const e=yield this.paypalCommerceService.createOrder("paypalcommercealternativemethodscheckout",{metadataId:this.guid}),{ratepayBirthDate:o,ratepayPhoneNumber:a,ratepayPhoneCountryCode:s}=i(),u={formattedPayload:{vault_payment_instrument:null,set_as_default_stored_instrument:null,device_info:null,method_id:n.methodId,rate_pay:{birth_date:this.normalizeDate(o),phone:{national_number:a,country_code:s.split("+")[1]}},paypal_account:{order_id:e}}};return yield this.paymentIntegrationService.submitOrder(r,t),yield this.paymentIntegrationService.submitPayment({methodId:n.methodId,paymentData:u}),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 W)}deinitialize(){const{legalTextContainer:e}=this.paypalcommerceratepay||{},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.paypalCommerceService.getPayPalSdkOrThrow(),u=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new G('Unable to initialize payment because "legalTextContainerElement" argument is not found.');u.render(`#${n}`)}handleError(e){const{onError:t}=this.paypalcommerceratepay||{};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 Fe(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(e)})}initializePollingMechanism(e,t,n,r){return Fe(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.paypalCommerceService.getOrderStatus("paypalcommercealternativemethods",{params:{useMetadata:!0}}),o=i===z.PollingStop,a=i===z.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,paypalcommerceratepay:this.paypalcommerceratepay}),this.handleError(new ue)}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 Me=t(e=>new Ne(e,U(e),new V({containerStyles:Object.assign(Object.assign({},l),{position:"fixed"})})),[{gateway:"paypalcommercealternativemethods",id:"ratepay"}]);var De=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class Ue{constructor(e){this.requestSender=e}createOrder(e,t){return De(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${e}`,r=t,i=Object.assign({"X-API-INTERNAL":x,"Content-Type":F.Json},N);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(e){return De(this,void 0,void 0,function*(){const t=e,n=Object.assign({"X-API-INTERNAL":x,"Content-Type":F.Json},N);return(yield this.requestSender.put("/api/storefront/initialization/paypalcommerce",{headers:n,body:t})).body})}getOrderStatus(){return De(this,arguments,void 0,function*(e="paypalcommerce",t){const n=`/api/storefront/initialization/${e}`,r=Object.assign({"X-API-INTERNAL":x,"Content-Type":F.Json},N);return(yield this.requestSender.get(n,Object.assign({headers:r},t))).body})}}function Re(e){return"string"!=typeof e}function Le(e,t){if(t||e)return function(e){var t,n;const r={},i=(0,m.omitBy)(e.root,Re),o=(0,m.omitBy)(e.input,Re),a=(0,m.omitBy)(e.toggle,Re),s=(0,m.omitBy)(null===(t=e.text)||void 0===t?void 0:t.body,Re),u=(0,m.omitBy)(null===(n=e.text)||void 0===n?void 0:n.caption,Re),c=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(u).length&&(r.text=Object.assign({},r.text),r.text.caption=u),c&&(r.branding=c),r}(function(e,t){var n,r,i,o,a,s,u,c,l,d,p,h,f,y,m,v,g,_,b,S,w,I;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===(u=null==t?void 0:t.input)||void 0===u?void 0:u.borderRadius),borderColor:(null==e?void 0:e.fastlaneInputSettingsBorderColor)||(null===(c=null==t?void 0:t.input)||void 0===c?void 0:c.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===(p=null==t?void 0:t.input)||void 0===p?void 0:p.borderWidth),textColorBase:(null==e?void 0:e.fastlaneInputSettingsTextColorBase)||(null===(h=null==t?void 0:t.input)||void 0===h?void 0:h.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===(y=null==t?void 0:t.toggle)||void 0===y?void 0:y.colorSecondary)},text:{body:{color:(null==e?void 0:e.fastlaneTextBodySettingsColor)||(null===(v=null===(m=null==t?void 0:t.text)||void 0===m?void 0:m.body)||void 0===v?void 0:v.color),fontSize:(null==e?void 0:e.fastlaneTextBodySettingsFontSize)||(null===(_=null===(g=null==t?void 0:t.text)||void 0===g?void 0:g.body)||void 0===_?void 0:_.fontSize)},caption:{color:(null==e?void 0:e.fastlaneTextCaptionSettingsColor)||(null===(S=null===(b=null==t?void 0:t.text)||void 0===b?void 0:b.caption)||void 0===S?void 0:S.color),fontSize:(null==e?void 0:e.fastlaneTextCaptionSettingsFontSize)||(null===(I=null===(w=null==t?void 0:t.text)||void 0===w?void 0:w.caption)||void 0===I?void 0:I.fontSize)}},branding:(null==e?void 0:e.fastlaneBrandingSettings)||(null==t?void 0:t.branding)}}(e,t))}function Ve(e){return!!e&&("authenticationState"in e||"addresses"in e||"instruments"in e)}var Ge=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class qe{constructor(e,t,n,r){this.paymentIntegrationService=e,this.paypalCommerceRequestSender=t,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(e){return Ge(this,void 0,void 0,function*(){var t,n;const{methodId:r,paypalcommercefastlane:i}=e;if(this.methodId=r,this.paypalcommercefastlane=i,!r)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new G('Unable to initialize payment because "options.paypalcommercefastlane" argument is not provided.');if(!i.onInit||"function"!=typeof i.onInit)throw new G('Unable to initialize payment because "options.paypalcommercefastlane.onInit" argument is not provided or it is not a function.');if(!i.onChange||"function"!=typeof i.onChange)throw new G('Unable to initialize payment because "options.paypalcommercefastlane.onChange" argument is not provided or it is not a function.');yield this.paymentIntegrationService.loadPaymentMethod(r);const o=this.paymentIntegrationService.getState(),a=o.getCartOrThrow(),s=o.getPaymentMethodOrThrow(r),{isDeveloperModeApplicable:u,isFastlaneStylingEnabled:c}=s.initializationData||{};this.threeDSVerificationMethod=null===(t=s.initializationData)||void 0===t?void 0:t.threeDSVerificationMethod,this.paypalFastlaneSdk=yield this.paypalSdkScriptLoader.getPayPalFastlaneSdk(s,a.currency.code,a.id,o.getLocale());const l=Le(c?null===(n=null==s?void 0:s.initializationData)||void 0===n?void 0:n.fastlaneStyles:{},null==i?void 0:i.styles);yield this.paypalFastlaneUtils.initializePayPalFastlane(this.paypalFastlaneSdk,!!u,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 Ge(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 q(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&K(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.paypalFastlaneUtils.removeStorageSessionId()}catch(e){if(function(e){return"object"==typeof e&&null!==e&&"message"in e&&"response"in e&&"body"in e.response&&"name"in e.response.body}(e)&&"INVALID_REQUEST"===e.response.body.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 W)}deinitialize(){return Ge(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=Ve(r)?r:{},o=this.paypalFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===E.CANCELED||(null==i?void 0:i.authenticationState)||o!==t.id)}runPayPalAuthenticationFlowOrThrow(e){return Ge(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.paypalFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalFastlaneUtils.triggerAuthenticationFlowOrThrow(a),{authenticationState:u,addresses:c,instruments:l}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(e,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:u,addresses:c,instruments:l}),s.authenticationState===E.CANCELED?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n.id)}catch(e){}})}initializePayPalPaymentComponent(){return Ge(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),t=e.phone,n=`${e.firstName} ${e.lastName}`.trim(),r=this.paypalFastlaneUtils.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 G('Unable to render card component because "container" argument is not provided.');t.render(e)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new u;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(e,t){return Ge(this,void 0,void 0,function*(){const{instrumentId:n}=t,r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e).config.is3dsEnabled?yield this.get3DSNonce(n):n;return yield this.createOrder(r),{methodId:e,paymentData:{formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:r}}}}})}preparePaymentPayload(e,t){return Ge(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.paypalFastlaneUtils.mapBcToPayPalAddress(r)}),u=i.config.is3dsEnabled?yield this.get3DSNonce(s):s;yield this.createOrder(u);const{shouldSaveInstrument:c=!1,shouldSetAsDefaultInstrument:l=!1}=H(t)?t:{};return{methodId:e,paymentData:Object.assign(Object.assign({},t),{shouldSaveInstrument:c,shouldSetAsDefaultInstrument:l,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:u}}})}})}createOrder(e){return Ge(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getCartOrThrow().id;if(this.methodId){const{orderId:n}=yield this.paypalCommerceRequestSender.createOrder(this.methodId,{cartId:t,fastlaneToken:e});this.orderId=n}})}get3DSNonce(e){return Ge(this,void 0,void 0,function*(){var t;const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),o=n.getStoreConfigOrThrow().links.checkoutLink,a=null===(t=this.paypalFastlaneSdk)||void 0===t?void 0:t.ThreeDomainSecureClient;if(!a)throw new u;const s={amount:i.orderAmount.toFixed(2),currency:r.currency.code,nonce:e,threeDSRequested:this.threeDSVerificationMethod===w.Always,transactionContext:{experience_context:{locale:"en-US",return_url:o,cancel_url:o}}},c=yield a.isEligible(s);if(this.threeDSVerificationMethod===w.Always&&!c)throw new $;if(c){const{liabilityShift:e,authenticationState:t,nonce:n}=yield a.show();if(e===ce.No||e===ce.Unknown||t===I.Errored||t===I.Cancelled)throw new $;if(t===I.Succeeded&&[ce.Yes,ce.Possible].includes(e))return n;throw new $}return e})}handlePayPalStoredInstrumentChange(e){return Ge(this,void 0,void 0,function*(){const t=this.paypalFastlaneUtils.getPayPalFastlaneOrThrow(),{selectionChanged:n,selectedCard:r}=yield t.profile.showCardSelector();if(n){const t=this.paymentIntegrationService.getState().getPaymentProviderCustomer(),n=Ve(t)?t:{},i=this.paypalFastlaneUtils.mapPayPalToBcInstrument(e,r)[0];return yield this.paymentIntegrationService.updatePaymentProviderCustomer(Object.assign(Object.assign({},n),{instruments:[i]})),i}})}handleError(e){var t;(null===(t=this.paypalcommercefastlane)||void 0===t?void 0:t.onError)&&"function"==typeof this.paypalcommercefastlane.onError&&this.paypalcommercefastlane.onError(e)}}const $e=t(e=>{const{getHost:t}=e.getState();return new qe(e,new Ue((0,a.createRequestSender)({host:t()})),y(),Pe())},[{id:"paypalcommerceacceleratedcheckout"}]);var We=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};const He=class{constructor(e,t){this.paymentIntegrationService=e,this.paypalIntegrationService=t}createPayPalButton(e,t,n,r){const{style:i,fundingSource:o,isHostedCheckoutEnabled:a,isServerSideShippingCallbacksEnabled:s,onClick:u,onCancel:c,onPaymentComplete:l,onError:d}=n;this.onError=d;const p=this.paypalIntegrationService.getPayPalSdkOrThrow();if(!Object.values(p.FUNDING).includes(o))throw new G('Unable to initialize PayPal button because "fundingSource" argument is not valid funding source.');const h=Object.assign(Object.assign({},!s&&{onShippingAddressChange:t=>this.onShippingAddressChange(t,e),onShippingOptionsChange:t=>this.onShippingOptionsChange(t,e)}),{onApprove:(n,r)=>this.onHostedCheckoutApprove(n,r,t,e,l,s)});return p.Buttons(Object.assign(Object.assign(Object.assign({fundingSource:o,style:this.paypalIntegrationService.getValidButtonStyle(i),createOrder:()=>We(this,void 0,void 0,function*(){if(r){const e=yield this.paypalIntegrationService.createBuyNowCartOrThrow(r);yield this.paymentIntegrationService.loadCheckout(e.id)}return this.paypalIntegrationService.createOrder(e)}),onApprove:({orderID:e})=>this.paypalIntegrationService.tokenizePayment(t,e)},u?{onClick:u}:{}),c?{onCancel:c}:{}),a&&h))}onHostedCheckoutApprove(e,t,n,r,o,a){return We(this,void 0,void 0,function*(){if(!e.orderID)throw new c(i.MissingOrderId);const s=this.paymentIntegrationService.getState().getCartOrThrow();try{const i=s.lineItems.physicalItems.length>0;if(!a){const e=yield t.order.get(),n=this.paypalIntegrationService.getBillingAddressFromOrderDetails(e);if(yield this.paymentIntegrationService.updateBillingAddress(n),i){const t=this.paypalIntegrationService.getShippingAddressFromOrderDetails(e);yield this.paymentIntegrationService.updateShippingAddress(t)}}i&&(yield this.paypalIntegrationService.updateOrder(r,void 0,void 0,a)),a&&(yield this.paymentIntegrationService.loadCheckout()),yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalIntegrationService.submitPayment(n,e.orderID),o&&"function"==typeof o&&o()}catch(e){this.handleError(e)}})}onShippingAddressChange(e,t){return We(this,void 0,void 0,function*(){const n=this.paypalIntegrationService.getAddress({city:e.shippingAddress.city,countryCode:e.shippingAddress.countryCode,postalCode:e.shippingAddress.postalCode,stateOrProvinceCode:e.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(n),yield this.paymentIntegrationService.updateShippingAddress(n);const e=this.paypalIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalIntegrationService.updateOrder(t)}catch(e){this.handleError(e)}})}onShippingOptionsChange(e,t){return We(this,void 0,void 0,function*(){const n=this.paypalIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(n.id),yield this.paypalIntegrationService.updateOrder(t)}catch(e){this.handleError(e)}})}handleError(e){if("function"!=typeof this.onError)throw e;this.onError(e)}};var Ke=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class Ye{constructor(e,t,n){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.paypalButtonCreationService=n}initialize(e){return Ke(this,void 0,void 0,function*(){const{paypalcommerce:t,methodId:n}=e;if(!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(!t.container)throw new G('Unable to initialize payment because "options.paypalcommerce.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new G('Unable to initialize payment because "options.paypalcommerce.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalIntegrationService.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 Ke(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signInCustomer(e,t),Promise.resolve()})}signOut(e){return Ke(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){const{container:n,onClick:r,onComplete:i,onError:o}=t,a=this.paypalIntegrationService.getPayPalSdkOrThrow(),s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:u,paymentButtonStyles:c,isServerSideShippingCallbacksEnabled:l}=s.initializationData||{},{checkoutTopButtonStyles:d}=c||{},p=Object.assign(Object.assign(Object.assign({fundingSource:a.FUNDING.PAYPAL,isServerSideShippingCallbacksEnabled:l,isHostedCheckoutEnabled:u,style:Object.assign(Object.assign({},d),{height:40})},r&&{onClick:()=>r()}),u&&i&&{onPaymentComplete:()=>i()}),{onError:o}),h=this.paypalButtonCreationService.createPayPalButton("paypalcommerce",e,p);h.isEligible()?h.render(`#${n}`):this.paypalIntegrationService.removeElement(n)}}const Ze=t(e=>{const t=U(e),n=new He(e,t);return new Ye(e,t,n)},[{id:"paypalcommerce"}]);var Je=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class Xe{constructor(e,t,n,r){this.formPoster=e,this.paymentIntegrationService=t,this.paypalCommerceRequestSender=n,this.paypalCommerceScriptLoader=r}loadPayPalSdk(e,t,n,r){return Je(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.paypalCommerceScriptLoader.getPayPalSDK(a,o,i.getLocale(),n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new u;return this.paypalSdk}createBuyNowCartOrThrow(e){return Je(this,void 0,void 0,function*(){const t=e.getBuyNowCartRequestBody();if(!t)throw new c(i.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(t)}catch(e){throw new v}})}createOrder(e,t){return Je(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.paypalCommerceRequestSender.createOrder(e,Object.assign({cartId:n},t));return r})}createOrderCardFields(e,t){return Je(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.paypalCommerceRequestSender.createOrder(e,Object.assign({cartId:n},t));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(e){return Je(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState(),n=t.getCartOrThrow(),r=t.getConsignmentsOrThrow()[0];try{yield this.paypalCommerceRequestSender.updateOrder({availableShippingOptions:e?[]:r.availableShippingOptions,cartId:n.id,selectedShippingOption:e?null:r.selectedShippingOption})}catch(e){throw new _}})}getOrderStatus(e,t){return Je(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalCommerceRequestSender.getOrderStatus(e,t);return n}catch(e){throw new _}})}tokenizePayment(e,t){const n=this.paymentIntegrationService.getState().getCartOrThrow();if(!t)throw new c(i.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:e,order_id:t},n.source===b.BuyNow&&{cart_id:n.id}))}submitPayment(e,t,n){return Je(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&&pe[t]?t:void 0,height:this.getValidHeight(n),label:r&&de[r]?r:void 0,shape:i&&he[i]?i:void 0};return(0,m.omitBy)(o,m.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")}}var Qe=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class et{constructor(e){this.scriptLoader=e,this.window=window}getPayPalSDK(e,t,n,r,i){return Qe(this,void 0,void 0,function*(){const o=this.getPayPalSdkScriptConfigOrThrow(e,t,n,r);return this.loadPayPalSDK(o,i)})}loadPayPalSDK(e){return Qe(this,arguments,void 0,function*(e,t=!1){if(!this.window.paypal||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.paypal)throw new u;return this.window.paypal})}getPayPalSdkScriptConfigOrThrow(e,t,n,r=!0){const{id:o,clientToken:a,initializationData:s}=e;if(!(null==s?void 0:s.clientId))throw new c(i.MissingPaymentMethod);const{intent:u,clientId:l,merchantId:d,buyerCountry:h,attributionId:f,isVenmoEnabled:y,isHostedCheckoutEnabled:m,isPayPalCreditAvailable:v,isDeveloperModeApplicable:g,availableAlternativePaymentMethods:_=[],enabledAlternativePaymentMethods:b=[],isGooglePayEnabled:S}=s,w=m||r,I="paypalcommercecreditcards"===o,P=I?["card"]:[],C=v?["credit","paylater"]:[],O=y?["venmo"]:[],A=S?["googlepay"]:[],E=r?["card-fields"]:[],k=[...I?[]:["card"],...v?[]:["credit","paylater"],...y?[]:["venmo"],..._.filter(e=>!b.includes(e))],z=[...P,...C,...O,...b],T=p(n);return{options:Object.assign(Object.assign({"client-id":l,"merchant-id":d,"enable-funding":z.length>0?z:void 0,"disable-funding":k.length>0?k:void 0,commit:w,components:["buttons","hosted-fields","payment-fields","legal",...A,...E],currency:t,intent:u},g&&{"buyer-country":h}),T&&{locale:T}),attributes:{"data-partner-attribution-id":f,"data-client-token":a}}}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 tt=t=>{const{getHost:n}=t.getState();return new Xe((0,o.createFormPoster)(),t,new Ue((0,a.createRequestSender)({host:n()})),new et((0,e.vQ)()))};var nt=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class rt{constructor(e,t){this.paymentIntegrationService=e,this.paypalCommerceIntegrationService=t,this.onError=m.noop}initialize(e){return nt(this,void 0,void 0,function*(){const{paypalcommercecredit:t,methodId:n}=e;if(!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(!t.container)throw new G('Unable to initialize payment because "options.paypalcommercecredit.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new G('Unable to initialize payment because "options.paypalcommercecredit.onClick" argument is not a function.');this.onError=t.onError||m.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,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 nt(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t)})}signOut(e){return nt(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.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:s,paymentButtonStyles:u,isServerSideShippingCallbacksEnabled:c}=a.initializationData||{},{checkoutTopButtonStyles:l}=u||{},d=Object.assign({createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},i&&{onClick:()=>i()}),p=Object.assign(Object.assign({},!c&&{onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,r,c)}),h=[o.FUNDING.PAYLATER,o.FUNDING.CREDIT];let f=!1;h.forEach(e=>{if(!f){const t=Object.assign(Object.assign({fundingSource:e,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},l),{height:40}))},d),s&&p),r=o.Buttons(t);r.isEligible()&&(r.render(`#${n}`),f=!0)}}),f||this.paypalCommerceIntegrationService.removeElement(n)}onHostedCheckoutApprove(e,t,n,r,o){return nt(this,void 0,void 0,function*(){if(!e.orderID)throw new c(i.MissingOrderId);const a=this.paymentIntegrationService.getState().getCartOrThrow();try{const i=a.lineItems.physicalItems.length>0;if(!o){const e=yield t.order.get(),n=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(e);if(yield this.paymentIntegrationService.updateBillingAddress(n),i){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(e);yield this.paymentIntegrationService.updateShippingAddress(t)}}i&&(yield this.paypalCommerceIntegrationService.updateOrder(o)),o&&(yield this.paymentIntegrationService.loadCheckout()),yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalCommerceIntegrationService.submitPayment(n,e.orderID),r&&"function"==typeof r&&r()}catch(e){this.handleError(e)}})}onShippingAddressChange(e){return nt(this,void 0,void 0,function*(){const t=this.paypalCommerceIntegrationService.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.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}onShippingOptionsChange(e){return nt(this,void 0,void 0,function*(){const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}handleError(e){if("function"!=typeof this.onError)throw e;this.onError(e)}}const it=t(e=>new rt(e,tt(e)),[{id:"paypalcommercecredit"}]);var ot=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class at{constructor(e,t){this.paymentIntegrationService=e,this.paypalCommerceIntegrationService=t}initialize(e){return ot(this,void 0,void 0,function*(){const{paypalcommercevenmo:t,methodId:n}=e;if(!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(!t.container)throw new G('Unable to initialize payment because "options.paypalcommercevenmo.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new G('Unable to initialize payment because "options.paypalcommercevenmo.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,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 ot(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t)})}signOut(e){return ot(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.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:a}=o.initializationData||{},{checkoutTopButtonStyles:s}=a||{},u=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},s),{height:40})),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},r&&{onClick:()=>r()}),c=i.Buttons(u);c.isEligible()?c.render(`#${n}`):this.paypalCommerceIntegrationService.removeElement(n)}}const st=t(e=>new at(e,tt(e)),[{id:"paypalcommercevenmo"}]);var ut=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class ct{constructor(e,t,n){this.paymentIntegrationService=e,this.paypalSdkScriptLoader=t,this.paypalFastlaneUtils=n}initialize(e){return ut(this,void 0,void 0,function*(){var t;const{methodId:n,paypalcommercefastlane:r}=e;if(!n)throw new G('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.paypalSdkScriptLoader.getPayPalFastlaneSdk(o,i.currency.code,i.id,e.getLocale());yield this.paypalFastlaneUtils.initializePayPalFastlane(s,a,this.getFastlaneStyles(n,r))}catch(e){}return Promise.resolve()})}deinitialize(){return ut(this,void 0,void 0,function*(){return Promise.resolve()})}signIn(e,t){return ut(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t),yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:void 0,addresses:void 0,instruments:void 0}),this.paypalFastlaneUtils.removeStorageSessionId()})}signOut(e){return ut(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(e)})}executePaymentMethodCheckout(e){return ut(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:t,continueWithCheckoutCallback:n,methodId:r}=e||{};if(!r)throw new G('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new G('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 ut(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.paypalFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalFastlaneUtils.triggerAuthenticationFlowOrThrow(a),u=s.authenticationState===E.CANCELED;yield this.updateCustomerDataState(e,s),u?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(e,t){return ut(this,void 0,void 0,function*(){var n;const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:u}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(e,t);if(yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:i,addresses:o,instruments:u}),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=(null===(n=(t.getConsignments()||[])[0])||void 0===n?void 0:n.availableShippingOptions)||[],a=o[0],u=o.find(e=>e.isRecommended);if((u||a)&&i){const e=(null==u?void 0:u.id)||a.id;yield this.paymentIntegrationService.selectShippingOption(e)}}})}getFastlaneStyles(e,t){const n=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{fastlaneStyles:r,isFastlaneStylingEnabled:i}=n.initializationData||{};return Le(i?r:{},null==t?void 0:t.styles)}}const lt=t(e=>new ct(e,y(),Pe()),[{id:"paypalcommerceacceleratedcheckout"},{id:"paypalcommercecreditcards"}]);class dt{constructor(e,t,n){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.paypalButtonCreationService=n}initialize(e){return t=this,n=void 0,i=function*(){var t;const{paypalcommerce:n,containerId:r,methodId:i}=e,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new G('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(o&&!n.currencyCode)throw new G('Unable to initialize payment because "options.paypalcommerce.currencyCode" argument is not provided.');if(o&&"function"!=typeof(null===(t=n.buyNowInitializeOptions)||void 0===t?void 0:t.getBuyNowCartRequestBody))throw new G('Unable to initialize payment because "options.paypalcommerce.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');o||(yield this.paymentIntegrationService.loadDefaultCheckout());const a=o?n.currencyCode:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(i,a,!1),this.renderButton(r,i,n)},new((r=void 0)||(r=Promise))(function(e,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r(function(e){e(n)})).then(a,s)}u((i=i.apply(t,n||[])).next())});var t,n,r,i}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.paypalIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:c,isServerSideShippingCallbacksEnabled:l}=u.initializationData||{},d={onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},p=Object.assign(Object.assign({fundingSource:s.FUNDING.PAYPAL,style:this.paypalIntegrationService.getValidButtonStyle(i),isServerSideShippingCallbacksEnabled:l,isHostedCheckoutEnabled:c},r&&d),c&&o&&{onPaymentComplete:()=>o()}),h=this.paypalButtonCreationService.createPayPalButton("paypalcommerce",t,p,r);h.isEligible()?h.render(`#${e}`):a&&"function"==typeof a?a():this.paypalIntegrationService.removeElement(e)}}const pt=t(e=>{const t=U(e),n=new He(e,t);return new dt(e,t,n)},[{id:"paypalcommerce"}]);var ht=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class ft{constructor(e,t){this.paymentIntegrationService=e,this.paypalIntegrationService=t}initialize(e){return ht(this,void 0,void 0,function*(){const{paypalcommercecredit:t,containerId:n,methodId:r}=e,{buyNowInitializeOptions:i,currencyCode:o}=t||{},a=!!i;if(!r)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(a&&!o)throw new G('Unable to initialize payment because "options.paypalcommercecredit.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new G('Unable to initialize payment because "options.paypalcommercecredit.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');a||(yield this.paymentIntegrationService.loadDefaultCheckout());const s=this.paymentIntegrationService.getState(),u=a?o:s.getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(r,u,!1),this.renderButton(n,r,t)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.paypalIntegrationService.getPayPalSdkOrThrow(),u=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:c,isServerSideShippingCallbacksEnabled:l}=u.initializationData||{},d={createOrder:()=>this.paypalIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:e})=>this.paypalIntegrationService.tokenizePayment(t,e)},p={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h=Object.assign(Object.assign({},!l&&{onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,o,l)}),f=[s.FUNDING.PAYLATER,s.FUNDING.CREDIT];let y=!1;f.forEach(t=>{if(!y){const n=Object.assign(Object.assign(Object.assign({fundingSource:t,style:this.paypalIntegrationService.getValidButtonStyle(i)},d),r&&p),c&&h),o=s.Buttons(n);o.isEligible()?(o.render(`#${e}`),y=!0):a&&"function"==typeof a&&a()}}),y||this.paypalIntegrationService.removeElement(e)}handleClick(e){return ht(this,void 0,void 0,function*(){if(e){const t=yield this.paypalIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}onHostedCheckoutApprove(e,t,n,r,o){return ht(this,void 0,void 0,function*(){if(!e.orderID)throw new c(i.MissingOrderId);const a=this.paymentIntegrationService.getState().getCartOrThrow();try{const i=a.lineItems.physicalItems.length>0;if(!o){const e=yield t.order.get(),n=this.paypalIntegrationService.getBillingAddressFromOrderDetails(e);if(yield this.paymentIntegrationService.updateBillingAddress(n),i){const t=this.paypalIntegrationService.getShippingAddressFromOrderDetails(e);yield this.paymentIntegrationService.updateShippingAddress(t)}}return i&&(yield this.paypalIntegrationService.updateOrder("paypalcommerce",void 0,void 0,o)),o&&(yield this.paymentIntegrationService.loadCheckout()),yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalIntegrationService.submitPayment(n,e.orderID),r&&"function"==typeof r&&r(),!0}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingAddressChange(e){return ht(this,void 0,void 0,function*(){const t=this.paypalIntegrationService.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.paypalIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalIntegrationService.updateOrder("paypalcommerce")}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingOptionsChange(e){return ht(this,void 0,void 0,function*(){const t=this.paypalIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalIntegrationService.updateOrder("paypalcommerce")}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}}const yt=t(e=>new ft(e,U(e)),[{id:"paypalcommercecredit"}]);var mt=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class vt{constructor(e,t){this.paymentIntegrationService=e,this.paypalCommerceIntegrationService=t}initialize(e){return mt(this,void 0,void 0,function*(){const{paypalcommercevenmo:t,containerId:n,methodId:r}=e,{buyNowInitializeOptions:i,currencyCode:o}=t||{},a=!!i;if(!r)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(a&&!o)throw new G('Unable to initialize payment because "options.paypalcommercevenmo.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new G('Unable to initialize payment because "options.paypalcommercevenmo.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');a||(yield this.paymentIntegrationService.loadDefaultCheckout());const s=a?o:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(r,s,!1),this.renderButton(n,r,t)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{buyNowInitializeOptions:r,style:i,onEligibilityFailure:o}=n,a=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),s=a.FUNDING.VENMO,u={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},c={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},l=Object.assign(Object.assign({fundingSource:s,style:this.getValidVenmoButtonStyles(i)},u),r&&c),d=a.Buttons(l);d.isEligible()?d.render(`#${e}`):o&&"function"==typeof o?o():this.paypalCommerceIntegrationService.removeElement(e)}getValidVenmoButtonStyles(e){const t=this.paypalCommerceIntegrationService.getValidButtonStyle(e);return t.color===pe.gold?Object.assign(Object.assign({},t),{color:void 0}):t}handleClick(e){return mt(this,void 0,void 0,function*(){if(e){const t=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}}const gt=t(e=>new vt(e,tt(e)),[{id:"paypalcommercevenmo"}]);var _t=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class bt{constructor(e,t){this.walletButtonIntegrationService=e,this.paypalCommerceScriptLoader=t}loadPayPalSdk(e,t,n,r){return _t(this,void 0,void 0,function*(){return this.paypalSdk=yield this.paypalCommerceScriptLoader.getPayPalSDK(e,t,void 0,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new u;return this.paypalSdk}proxyTokenizationPayment(e,t){return _t(this,void 0,void 0,function*(){var n;if(!t)throw new c(i.MissingOrderId);const r={paymentWalletData:{providerId:"paypalcommerce",providerOrderId:t},cartEntityId:e,queryParams:[{key:"payment_type",value:"paypal"},{key:"action",value:"set_external_checkout"},{key:"provider",value:"paypalcommerce"}]},o=yield this.walletButtonIntegrationService.getRedirectToCheckoutUrl(r);if(!(null===(n=o.body.redirectUrls)||void 0===n?void 0:n.externalCheckoutUrl))throw new Error("Failed to redirection to checkout page");window.location.assign(o.body.redirectUrls.externalCheckoutUrl)})}createPaymentOrderIntent(e,t,n){return _t(this,void 0,void 0,function*(){const r={cartEntityId:t,paymentWalletEntityId:e};return(yield this.walletButtonIntegrationService.createPaymentOrderIntent(r,n)).body.orderId})}addBillingAddress(e,t,n){return _t(this,void 0,void 0,function*(){return this.walletButtonIntegrationService.addBillingAddress(e,t,n)})}getValidButtonStyle(e){const{color:t,height:n,label:r,shape:i}=e||{},o={color:t&&pe[t]?t:void 0,height:this.getValidHeight(n),label:r&&de[r]?r:void 0,shape:i&&he[i]?i:void 0};return(0,m.omitBy)(o,m.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")}}var St=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class wt{constructor(e){this.paypalCommerceHeadlessWalletButtonService=e}initialize(e){return St(this,void 0,void 0,function*(){const{paypalcommercepaypal:t,containerId:n,methodId:r}=e;if(!r)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommercepaypal" argument is not provided.');let i;try{i=JSON.parse(atob(t.initializationData))}catch(e){throw new G("Failed to parse payment method 'initializationData'.")}yield this.paypalCommerceHeadlessWalletButtonService.loadPayPalSdk(i,t.currency.code,!1),this.renderButton(n,"paypalcommerce.paypal",t.cartId)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const r=this.paypalCommerceHeadlessWalletButtonService.getPayPalSdkOrThrow(),i={createOrder:()=>this.paypalCommerceHeadlessWalletButtonService.createPaymentOrderIntent(t,n),onApprove:(e,t)=>St(this,[e,t],void 0,function*({orderID:e},t){const r=yield t.order.get(),i=this.mapOrderDetailsToBillingAddress(r);yield this.paypalCommerceHeadlessWalletButtonService.addBillingAddress(n,i),yield this.paypalCommerceHeadlessWalletButtonService.proxyTokenizationPayment(n,e)})},o=Object.assign({fundingSource:r.FUNDING.PAYPAL,style:this.paypalCommerceHeadlessWalletButtonService.getValidButtonStyle()},i),a=r.Buttons(o);a.isEligible()?a.render(`#${e}`):this.paypalCommerceHeadlessWalletButtonService.removeElement(e)}mapOrderDetailsToBillingAddress(e){var t,n,r,i;const{payer:o}=e;return{firstName:o.name.given_name,lastName:o.name.surname,company:"",address1:o.address.address_line_1,address2:o.address.address_line_2,city:o.address.admin_area_2,email:o.email_address,stateOrProvince:null!==(t=o.address.admin_area_1)&&void 0!==t?t:"",stateOrProvinceCode:null!==(n=o.address.admin_area_1)&&void 0!==n?n:"",countryCode:o.address.country_code,postalCode:o.address.postal_code,phone:null!==(i=null===(r=o.phone)||void 0===r?void 0:r.phone_number.national_number)&&void 0!==i?i:"",shouldSaveAddress:!1}}}const It=t(t=>new wt(new bt(t,new et((0,e.vQ)()))),[{id:"paypalcommercepaypal"}]);var Pt=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})};class Ct{constructor(e){this.paypalCommerceHeadlessWalletButtonService=e}initialize(e){return Pt(this,void 0,void 0,function*(){var t,n;const{paypalcommercepaypalcredit:r,containerId:i,methodId:o}=e;if(!o)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!r)throw new G('Unable to initialize payment because "options.paypalcommercepaypalcredit" argument is not provided.');let a;try{a=JSON.parse(atob(r.initializationData))}catch(e){throw new G("Failed to parse payment method 'initializationData'.")}yield this.paypalCommerceHeadlessWalletButtonService.loadPayPalSdk(a,r.currency.code,!1);const s=null===(n=null===(t=a.initializationData)||void 0===t?void 0:t.paymentButtonStyles)||void 0===n?void 0:n.cartButtonStyles;this.renderButton(i,"paypalcommerce.paypalcredit",r.cartId,s)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n,r){const i=this.paypalCommerceHeadlessWalletButtonService.getPayPalSdkOrThrow(),o=[i.FUNDING.PAYLATER,i.FUNDING.CREDIT],a={createOrder:()=>this.paypalCommerceHeadlessWalletButtonService.createPaymentOrderIntent(t,n),onApprove:(e,t)=>Pt(this,[e,t],void 0,function*({orderID:e},t){const r=yield t.order.get(),i=this.mapOrderDetailsToBillingAddress(r);yield this.paypalCommerceHeadlessWalletButtonService.addBillingAddress(n,i),yield this.paypalCommerceHeadlessWalletButtonService.proxyTokenizationPayment(n,e)})};let s=!1;o.forEach(t=>{if(!s){const n=Object.assign({fundingSource:t,style:this.paypalCommerceHeadlessWalletButtonService.getValidButtonStyle(r)},a),o=i.Buttons(n);o.isEligible()&&(o.render(`#${e}`),s=!0)}}),s||this.paypalCommerceHeadlessWalletButtonService.removeElement(e)}mapOrderDetailsToBillingAddress(e){var t,n,r,i;const{payer:o}=e;return{firstName:o.name.given_name,lastName:o.name.surname,company:"",address1:o.address.address_line_1,address2:o.address.address_line_2,city:o.address.admin_area_2,email:o.email_address,stateOrProvince:null!==(t=o.address.admin_area_1)&&void 0!==t?t:"",stateOrProvinceCode:null!==(n=o.address.admin_area_1)&&void 0!==n?n:"",countryCode:o.address.country_code,postalCode:o.address.postal_code,phone:null!==(i=null===(r=o.phone)||void 0===r?void 0:r.phone_number.national_number)&&void 0!==i?i:"",shouldSaveAddress:!1}}}const Ot=t(t=>new Ct(new bt(t,new et((0,e.vQ)()))),[{id:"paypalcommercepaypalcredit"}])})(),module.exports=r})();
1
+ (()=>{var e={9165(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=new r.default;return new i.default(t,e)};var r=n(9828),i=n(5470)},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},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},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)},9783(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!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}},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:"".concat(e,"?").concat(r.stringify(t))},e}()},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)}},6889(e,t,n){"use strict";n.d(t,{A:()=>i});var r=n(2024);function i(e){return new r.A(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)},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})},1675(e,t,n){"use strict";n.d(t,{A:()=>s});var r=n(1635),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.__assign)((0,r.__assign)({},e),((n={})[o.toLowerCase()]=i.join(":").trim(),n)):e},{})},e.prototype._getHeader=function(e,t){return e&&t&&(e[t]||e[t.toLowerCase()])||""},e}()},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?"".concat(e,"?").concat(r.stringify(t,{encode:n})):e},e}()},4670(e,t,n){"use strict";n.d(t,{A:()=>l});var r=n(1635),i=n(35),o=n.n(i),a=n(4325),s=n(4843),c=n(2024);const l=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.__assign)((0,r.__assign)({},t),{method:"GET"}))},e.prototype.post=function(e,t){return this.sendRequest(e,(0,r.__assign)((0,r.__assign)({},t),{method:"POST"}))},e.prototype.put=function(e,t){return this.sendRequest(e,(0,r.__assign)((0,r.__assign)({},t),{method:"PUT"}))},e.prototype.patch=function(e,t){return this.sendRequest(e,(0,r.__assign)((0,r.__assign)({},t),{method:"PATCH"}))},e.prototype.delete=function(e,t){return this.sendRequest(e,(0,r.__assign)((0,r.__assign)({},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:"".concat(this._options.host.replace(/\/$/,""),"/").concat(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}()},2024(e,t,n){"use strict";n.d(t,{A:()=>r});const r=function(){function e(e){var t=this;this._delay=e,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(),void 0!==this._timeoutToken&&clearTimeout(this._timeoutToken)},e.prototype.start=function(){var e=this;void 0!==this._delay&&(this._timeoutToken=setTimeout(function(){return e.complete()},this._delay))},e}()},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?"".concat(t,"=").concat(encodeURIComponent(n)):"".concat(t,"=").concat(encodeURIComponent(JSON.stringify(n)||""))}).join("&")}n.d(t,{A:()=>r})},5889(e,t,n){"use strict";const r=n(803),i=n(1915),o=n(1657),a=n(3814);function s(e){if("string"!=typeof e||1!==e.length)throw new TypeError("arrayFormatSeparator must be single character string")}function c(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function l(e,t){return t.decode?i(e):e}function u(e){return Array.isArray(e)?e.sort():"object"==typeof e?u(Object.keys(e)).sort((e,t)=>Number(e)-Number(t)).map(t=>e[t]):e}function d(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function p(e){const t=(e=d(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function h(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function f(e,t){s((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};case"comma":case"separator":return(t,n,r)=>{const i="string"==typeof n&&n.includes(e.arrayFormatSeparator),o="string"==typeof n&&!i&&l(n,e).includes(e.arrayFormatSeparator);n=o?l(n,e):n;const a=i||o?n.split(e.arrayFormatSeparator).map(t=>l(t,e)):null===n?n:l(n,e);r[t]=a};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const i of e.split("&")){if(""===i)continue;let[e,a]=o(t.decode?i.replace(/\+/g," "):i,"=");a=void 0===a?null:["comma","separator"].includes(t.arrayFormat)?a:l(a,t),n(l(e,t),a,r)}for(const e of Object.keys(r)){const n=r[e];if("object"==typeof n&&null!==n)for(const e of Object.keys(n))n[e]=h(n[e],t);else r[e]=h(n,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=u(n):e[t]=n,e},Object.create(null))}t.extract=p,t.parse=f,t.stringify=(e,t)=>{if(!e)return"";s((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const n=n=>t.skipNull&&null==e[n]||t.skipEmptyString&&""===e[n],r=function(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[c(t,e),"[",i,"]"].join("")]:[...n,[c(t,e),"[",c(i,e),"]=",c(r,e)].join("")]};case"bracket":return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,[c(t,e),"[]"].join("")]:[...n,[c(t,e),"[]=",c(r,e)].join("")];case"comma":case"separator":return t=>(n,r)=>null==r||0===r.length?n:0===n.length?[[c(t,e),"=",c(r,e)].join("")]:[[n,c(r,e)].join(e.arrayFormatSeparator)];default:return t=>(n,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?n:null===r?[...n,c(t,e)]:[...n,[c(t,e),"=",c(r,e)].join("")]}}(t),i={};for(const t of Object.keys(e))n(t)||(i[t]=e[t]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map(n=>{const i=e[n];return void 0===i?"":null===i?c(n,t):Array.isArray(i)?i.reduce(r(n),[]).join("&"):c(n,t)+"="+c(i,t)}).filter(e=>e.length>0).join("&")},t.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[n,r]=o(e,"#");return Object.assign({url:n.split("?")[0]||"",query:f(p(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:l(r,t)}:{})},t.stringifyUrl=(e,n)=>{n=Object.assign({encode:!0,strict:!0},n);const r=d(e.url).split("?")[0]||"",i=t.extract(e.url),o=t.parse(i,{sort:!1}),a=Object.assign(o,e.query);let s=t.stringify(a,n);s&&(s=`?${s}`);let l=function(e){let t="";const n=e.indexOf("#");return-1!==n&&(t=e.slice(n)),t}(e.url);return e.fragmentIdentifier&&(l=`#${c(e.fragmentIdentifier,n)}`),`${r}${s}${l}`},t.pick=(e,n,r)=>{r=Object.assign({parseFragmentIdentifier:!0},r);const{url:i,query:o,fragmentIdentifier:s}=t.parseUrl(e,r);return t.stringifyUrl({url:i,query:a(o,n),fragmentIdentifier:s},r)},t.exclude=(e,n,r)=>{const i=Array.isArray(n)?e=>!n.includes(e):(e,t)=>!n(e,t);return t.pick(e,i,r)}},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},471(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return new o.default(new i.default,(0,r.createRequestSender)())};var r=n(4043),i=n(5477),o=n(4886)},9722(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return new o.default(new i.default,(0,r.createRequestSender)())};var r=n(4043),i=n(5477),o=n(7995)},5895(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return r||(r=(0,i.default)()),r};var r,i=n(471)},282(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return r||(r=(0,i.default)()),r};var r,i=n(9722)},315(e,t,n){"use strict";t.vQ=void 0;n(4886),n(471);var r=n(5895);Object.defineProperty(t,"vQ",{enumerable:!0,get:function(){return r.default}});n(7995),n(9722),n(282)},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,l=a.attributes,u=void 0===l?{}:l;Object.keys(u).forEach(function(e){o.setAttribute(e,u[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},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,l=a.attributes,u=void 0===l?{}:l;Object.keys(u).forEach(function(e){o.setAttribute(e,u[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},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)}}},3814(e){"use strict";e.exports=function(e,t){for(var n={},r=Object.keys(e),i=Array.isArray(t),o=0;o<r.length;o++){var a=r[o],s=e[a];(i?-1!==t.indexOf(a):t(a,s,e))&&(n[a]=s)}return n}},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 l=t(s[0]);if(c=(r.read||r)(c,l)||t(c),n)try{c=JSON.parse(c)}catch(e){}if(i[l]=c,e===l)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()},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\]$/,l=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[o]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u[a]=u["[object Map]"]=u["[object Number]"]=u[s]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1;var d,p,h,f="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,y="object"==typeof self&&self&&self.Object===Object&&self,m=f||y||Function("return this")(),v=t&&!t.nodeType&&t,g=v&&e&&!e.nodeType&&e,_=g&&g.exports===v,b=_&&f.process,S=function(){try{return g&&g.require&&g.require("util").types||b&&b.binding&&b.binding("util")}catch(e){}}(),w=S&&S.isTypedArray,I=Array.prototype,P=Function.prototype,C=Object.prototype,O=m["__core-js_shared__"],A=P.toString,E=C.hasOwnProperty,z=(d=/[^.]+$/.exec(O&&O.keys&&O.keys.IE_PROTO||""))?"Symbol(src)_1."+d:"",k=C.toString,T=A.call(Object),j=RegExp("^"+A.call(E).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),B=_?m.Buffer:void 0,x=m.Symbol,N=m.Uint8Array,F=(B&&B.allocUnsafe,p=Object.getPrototypeOf,h=Object,function(e){return p(h(e))}),M=Object.create,D=C.propertyIsEnumerable,U=I.splice,R=x?x.toStringTag:void 0,L=function(){try{var e=se(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),V=B?B.isBuffer:void 0,G=Math.max,q=Date.now,W=se(m,"Map"),H=se(Object,"create"),$=function(){function e(){}return function(t){if(!_e(t))return{};if(M)return M(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 Z(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=this.__data__=new Y(e);this.size=t.size}function Q(e,t,n){(void 0!==n&&!pe(e[t],n)||void 0===n&&!(t in e))&&te(e,t,n)}function X(e,t,n){var r=e[t];E.call(e,t)&&pe(r,n)&&(void 0!==n||t in e)||te(e,t,n)}function ee(e,t){for(var n=e.length;n--;)if(pe(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__=H?H(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(H){var n=t[e];return n===r?void 0:n}return E.call(t,e)?t[e]:void 0},K.prototype.has=function(e){var t=this.__data__;return H?void 0!==t[e]:E.call(t,e)},K.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=H&&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():U.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},Z.prototype.clear=function(){this.size=0,this.__data__={hash:new K,map:new(W||Y),string:new K}},Z.prototype.delete=function(e){var t=ae(this,e).delete(e);return this.size-=t?1:0,t},Z.prototype.get=function(e){return ae(this,e).get(e)},Z.prototype.has=function(e){return ae(this,e).has(e)},Z.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},J.prototype.clear=function(){this.__data__=new Y,this.size=0},J.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},J.prototype.get=function(e){return this.__data__.get(e)},J.prototype.has=function(e){return this.__data__.has(e)},J.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Y){var r=n.__data__;if(!W||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Z(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=E.call(e,R),n=e[R];try{e[R]=void 0;var r=!0}catch(e){}var i=k.call(e);return r&&(t?e[R]=n:delete e[R]),i}(e):function(e){return k.call(e)}(e)}function re(e){return be(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 J),_e(o))!function(e,t,n,r,i,o,a){var c=ue(e,n),l=ue(t,n),u=a.get(l);if(u)Q(e,n,u);else{var d,p,h,f,y,m=o?o(c,l,n+"",e,t,a):void 0,v=void 0===m;if(v){var g=fe(l),_=!g&&me(l),b=!g&&!_&&Se(l);m=l,g||_||b?fe(c)?m=c:be(y=c)&&ye(y)?m=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(c):_?(v=!1,m=function(e){return e.slice()}(l)):b?(v=!1,f=new(h=(d=l).buffer).constructor(h.byteLength),new N(f).set(new N(h)),p=f,m=new d.constructor(p,d.byteOffset,d.length)):m=[]:function(e){if(!be(e)||ne(e)!=s)return!1;var t=F(e);if(null===t)return!0;var n=E.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&A.call(n)==T}(l)||he(l)?(m=c,he(c)?m=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):X(n,a,s)}return n}(e,we(e))}(c):_e(c)&&!ve(c)||(m=function(e){return"function"!=typeof e.constructor||le(e)?{}:$(F(e))}(l))):v=!1}v&&(a.set(l,m),i(m,l,r,o,a),a.delete(l)),Q(e,n,m)}}(e,t,a,n,ie,r,i);else{var c=r?r(ue(e,a),o,a+"",e,t,i):void 0;void 0===c&&(c=o),Q(e,a,c)}},we)}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!(!_e(e)||function(e){return!!z&&z in e}(e))&&(ve(e)?j: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=t??i)&&("number"==n||"symbol"!=n&&l.test(e))&&e>-1&&e%1==0&&e<t}function le(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||C)}function ue(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=q(),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 pe(e,t){return e===t||e!=e&&t!=t}var he=re(function(){return arguments}())?re:function(e){return be(e)&&E.call(e,"callee")&&!D.call(e,"callee")},fe=Array.isArray;function ye(e){return null!=e&&ge(e.length)&&!ve(e)}var me=V||function(){return!1};function ve(e){if(!_e(e))return!1;var t=ne(e);return t==a||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function ge(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}function _e(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function be(e){return null!=e&&"object"==typeof e}var Se=w?function(e){return function(t){return e(t)}}(w):function(e){return be(e)&&ge(e.length)&&!!u[ne(e)]};function we(e){return ye(e)?function(e,t){var n=fe(e),r=!n&&he(e),i=!n&&!r&&me(e),o=!n&&!r&&!i&&Se(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 l in e)!t&&!E.call(e,l)||a&&("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||ce(l,c))||s.push(l);return s}(e,!0):function(e){if(!_e(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=le(e),n=[];for(var r in e)("constructor"!=r||!t&&E.call(e,r))&&n.push(r);return n}(e)}var Ie,Pe=(Ie=function(e,t,n){ie(e,t,n)},function(e,t){return de(function(e,t,n){return t=G(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=G(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=Ie.length>3&&"function"==typeof i?(r--,i):void 0,o&&function(e,t,n){if(!_e(n))return!1;var r=typeof t;return!!("number"==r?ye(n)&&ce(t,n.length):"string"==r&&t in n)&&pe(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&&Ie(e,a,n)}return e}));function Ce(e){return e}e.exports=Pe},9440(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,l=1/0,u=9007199254740991,d=NaN,p=4294967295,h=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],f="[object Arguments]",y="[object Array]",m="[object Boolean]",v="[object Date]",g="[object Error]",_="[object Function]",b="[object GeneratorFunction]",S="[object Map]",w="[object Number]",I="[object Object]",P="[object Promise]",C="[object RegExp]",O="[object Set]",A="[object String]",E="[object Symbol]",z="[object WeakMap]",k="[object ArrayBuffer]",T="[object DataView]",j="[object Float32Array]",B="[object Float64Array]",x="[object Int8Array]",N="[object Int16Array]",F="[object Int32Array]",M="[object Uint8Array]",D="[object Uint8ClampedArray]",U="[object Uint16Array]",R="[object Uint32Array]",L=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,G=/(__e\(.*?\)|\b__t\)) \+\n'';/g,q=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,H=RegExp(q.source),$=RegExp(W.source),K=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/,X=/[^.[\]]+|\[(?:(-?\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]/,le=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,fe=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,me=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ge=/($^)/,_e=/['\n\r\u2028\u2029\\]/g,be="\\ud800-\\udfff",Se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",we="\\u2700-\\u27bf",Ie="a-z\\xdf-\\xf6\\xf8-\\xff",Pe="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="["+be+"]",Ee="["+Oe+"]",ze="["+Se+"]",ke="\\d+",Te="["+we+"]",je="["+Ie+"]",Be="[^"+be+Oe+ke+we+Ie+Pe+"]",xe="\\ud83c[\\udffb-\\udfff]",Ne="[^"+be+"]",Fe="(?:\\ud83c[\\udde6-\\uddff]){2}",Me="[\\ud800-\\udbff][\\udc00-\\udfff]",De="["+Pe+"]",Ue="\\u200d",Re="(?:"+je+"|"+Be+")",Le="(?:"+De+"|"+Be+")",Ve="(?:['’](?:d|ll|m|re|s|t|ve))?",Ge="(?:['’](?:D|LL|M|RE|S|T|VE))?",qe="(?:"+ze+"|"+xe+")?",We="["+Ce+"]?",He=We+qe+"(?:"+Ue+"(?:"+[Ne,Fe,Me].join("|")+")"+We+qe+")*",$e="(?:"+[Te,Fe,Me].join("|")+")"+He,Ke="(?:"+[Ne+ze+"?",ze,Fe,Me,Ae].join("|")+")",Ye=RegExp("['’]","g"),Ze=RegExp(ze,"g"),Je=RegExp(xe+"(?="+xe+")|"+Ke+He,"g"),Qe=RegExp([De+"?"+je+"+"+Ve+"(?="+[Ee,De,"$"].join("|")+")",Le+"+"+Ge+"(?="+[Ee,De+Re,"$"].join("|")+")",De+"?"+Re+"+"+Ve,De+"+"+Ge,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ke,$e].join("|"),"g"),Xe=RegExp("["+Ue+be+Se+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[j]=rt[B]=rt[x]=rt[N]=rt[F]=rt[M]=rt[D]=rt[U]=rt[R]=!0,rt[f]=rt[y]=rt[k]=rt[m]=rt[T]=rt[v]=rt[g]=rt[_]=rt[S]=rt[w]=rt[I]=rt[C]=rt[O]=rt[A]=rt[z]=!1;var it={};it[f]=it[y]=it[k]=it[T]=it[m]=it[v]=it[j]=it[B]=it[x]=it[N]=it[F]=it[S]=it[w]=it[I]=it[C]=it[O]=it[A]=it[E]=it[M]=it[D]=it[U]=it[R]=!0,it[g]=it[_]=it[z]=!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,lt="object"==typeof self&&self&&self.Object===Object&&self,ut=ct||lt||Function("return this")(),dt=t&&!t.nodeType&&t,pt=dt&&e&&!e.nodeType&&e,ht=pt&&pt.exports===dt,ft=ht&&ct.process,yt=function(){try{return pt&&pt.require&&pt.require("util").types||ft&&ft.binding&&ft.binding("util")}catch(e){}}(),mt=yt&&yt.isArrayBuffer,vt=yt&&yt.isDate,gt=yt&&yt.isMap,_t=yt&&yt.isRegExp,bt=yt&&yt.isSet,St=yt&&yt.isTypedArray;function wt(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 It(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 Pt(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 Et(e,t){return!(null==e||!e.length)&&Dt(e,t,0)>-1}function zt(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 kt(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 Tt(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function jt(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 Bt(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 xt(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 Nt=Vt("length");function Ft(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function Mt(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 Dt(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):Mt(e,Rt,n)}function Ut(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?Wt(e,t)/n:d}function Vt(e){return function(t){return null==t?r:t[e]}}function Gt(e){return function(t){return null==e?r:e[t]}}function qt(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}function Wt(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 Ht(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function $t(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 kt(t,function(t){return e[t]})}function Zt(e,t){return e.has(t)}function Jt(e,t){for(var n=-1,r=e.length;++n<r&&Dt(t,e[n],0)>-1;);return n}function Qt(e,t){for(var n=e.length;n--&&Dt(t,e[n],0)>-1;);return n}var Xt=Gt({À:"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=Gt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function tn(e){return"\\"+ot[e]}function nn(e){return Xe.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 ln(e){return nn(e)?function(e){for(var t=Je.lastIndex=0;Je.test(e);)++t;return t}(e):Nt(e)}function un(e){return nn(e)?function(e){return e.match(Je)||[]}(e):function(e){return e.split("")}(e)}function dn(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var pn=Gt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hn=function e(t){var n,re=(t=null==t?ut:hn.defaults(ut.Object(),t,hn.pick(ut,tt))).Array,be=t.Date,Se=t.Error,we=t.Function,Ie=t.Math,Pe=t.Object,Ce=t.RegExp,Oe=t.String,Ae=t.TypeError,Ee=re.prototype,ze=we.prototype,ke=Pe.prototype,Te=t["__core-js_shared__"],je=ze.toString,Be=ke.hasOwnProperty,xe=0,Ne=(n=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Fe=ke.toString,Me=je.call(Pe),De=ut._,Ue=Ce("^"+je.call(Be).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Re=ht?t.Buffer:r,Le=t.Symbol,Ve=t.Uint8Array,Ge=Re?Re.allocUnsafe:r,qe=on(Pe.getPrototypeOf,Pe),We=Pe.create,He=ke.propertyIsEnumerable,$e=Ee.splice,Ke=Le?Le.isConcatSpreadable:r,Je=Le?Le.iterator:r,Xe=Le?Le.toStringTag:r,ot=function(){try{var e=co(Pe,"defineProperty");return e({},"",{}),e}catch(e){}}(),ct=t.clearTimeout!==ut.clearTimeout&&t.clearTimeout,lt=be&&be.now!==ut.Date.now&&be.now,dt=t.setTimeout!==ut.setTimeout&&t.setTimeout,pt=Ie.ceil,ft=Ie.floor,yt=Pe.getOwnPropertySymbols,Nt=Re?Re.isBuffer:r,Gt=t.isFinite,fn=Ee.join,yn=on(Pe.keys,Pe),mn=Ie.max,vn=Ie.min,gn=be.now,_n=t.parseInt,bn=Ie.random,Sn=Ee.reverse,wn=co(t,"DataView"),In=co(t,"Map"),Pn=co(t,"Promise"),Cn=co(t,"Set"),On=co(t,"WeakMap"),An=co(Pe,"create"),En=On&&new On,zn={},kn=Mo(wn),Tn=Mo(In),jn=Mo(Pn),Bn=Mo(Cn),xn=Mo(On),Nn=Le?Le.prototype:r,Fn=Nn?Nn.valueOf:r,Mn=Nn?Nn.toString:r;function Dn(e){if(es(e)&&!Ga(e)&&!(e instanceof Vn)){if(e instanceof Ln)return e;if(Be.call(e,"__wrapped__"))return Do(e)}return new Ln(e)}var Un=function(){function e(){}return function(t){if(!Xa(t))return{};if(We)return We(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__=p,this.__views__=[]}function Gn(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 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 Wn(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.__data__=new Wn;++t<n;)this.add(e[t])}function $n(e){var t=this.__data__=new qn(e);this.size=t.size}function Kn(e,t){var n=Ga(e),r=!n&&Va(e),i=!n&&!r&&$a(e),o=!n&&!r&&!i&&cs(e),a=n||r||i||o,s=a?Ht(e.length,Oe):[],c=s.length;for(var l in e)!t&&!Be.call(e,l)||a&&("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||mo(l,c))||s.push(l);return s}function Yn(e){var t=e.length;return t?e[Wr(0,t-1)]:r}function Zn(e,t){return jo(Oi(e),or(t,0,e.length))}function Jn(e){return jo(Oi(e))}function Qn(e,t,n){(n!==r&&!Ua(e[t],n)||n===r&&!(t in e))&&rr(e,t,n)}function Xn(e,t,n){var i=e[t];Be.call(e,t)&&Ua(i,n)&&(n!==r||t in e)||rr(e,t,n)}function er(e,t){for(var n=e.length;n--;)if(Ua(e[n][0],t))return n;return-1}function tr(e,t,n,r){return ur(e,function(e,i,o){t(r,e,n(e),o)}),r}function nr(e,t){return e&&Ai(t,ks(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,l=2&t,u=4&t;if(n&&(s=o?n(e,i,o,a):n(e)),s!==r)return s;if(!Xa(e))return e;var d=Ga(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Be.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!c)return Oi(e,s)}else{var p=po(e),h=p==_||p==b;if($a(e))return bi(e,c);if(p==I||p==f||h&&!o){if(s=l||h?{}:fo(e),!c)return l?function(e,t){return Ai(e,uo(e),t)}(e,function(e,t){return e&&Ai(t,Ts(t),e)}(s,e)):function(e,t){return Ai(e,lo(e),t)}(e,nr(s,e))}else{if(!it[p])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case k:return Si(e);case m:case v:return new i(+e);case T:return function(e,t){var n=t?Si(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case j:case B:case x:case N:case F:case M:case D:case U:case R:return wi(e,n);case S:return new i;case w: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 E:return r=e,Fn?Pe(Fn.call(r)):{}}}(e,p,c)}}a||(a=new $n);var y=a.get(e);if(y)return y;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 g=d?r:(u?l?to:eo:l?Ts:ks)(e);return Pt(g||e,function(r,i){g&&(r=e[i=r]),Xn(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=Pe(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 Eo(function(){e.apply(r,n)},t)}function lr(e,t,n,r){var i=-1,o=Et,a=!0,s=e.length,c=[],l=t.length;if(!s)return c;n&&(t=kt(t,Kt(n))),r?(o=zt,a=!1):t.length>=200&&(o=Zt,a=!1,t=new Hn(t));e:for(;++i<s;){var u=e[i],d=null==n?u:n(u);if(u=r||0!==u?u:0,a&&d==d){for(var p=l;p--;)if(t[p]===d)continue e;c.push(u)}else o(t,d,r)||c.push(u)}return c}Dn.templateSettings={escape:K,evaluate:Y,interpolate:Z,variable:"",imports:{_:Dn}},Dn.prototype=Rn.prototype,Dn.prototype.constructor=Dn,Ln.prototype=Un(Rn.prototype),Ln.prototype.constructor=Ln,Vn.prototype=Un(Rn.prototype),Vn.prototype.constructor=Vn,Gn.prototype.clear=function(){this.__data__=An?An(null):{},this.size=0},Gn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Gn.prototype.get=function(e){var t=this.__data__;if(An){var n=t[e];return n===o?r:n}return Be.call(t,e)?t[e]:r},Gn.prototype.has=function(e){var t=this.__data__;return An?t[e]!==r:Be.call(t,e)},Gn.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},qn.prototype.clear=function(){this.__data__=[],this.size=0},qn.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():$e.call(t,n,1),--this.size,0))},qn.prototype.get=function(e){var t=this.__data__,n=er(t,e);return n<0?r:t[n][1]},qn.prototype.has=function(e){return er(this.__data__,e)>-1},qn.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},Wn.prototype.clear=function(){this.size=0,this.__data__={hash:new Gn,map:new(In||qn),string:new Gn}},Wn.prototype.delete=function(e){var t=ao(this,e).delete(e);return this.size-=t?1:0,t},Wn.prototype.get=function(e){return ao(this,e).get(e)},Wn.prototype.has=function(e){return ao(this,e).has(e)},Wn.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},Hn.prototype.add=Hn.prototype.push=function(e){return this.__data__.set(e,o),this},Hn.prototype.has=function(e){return this.__data__.has(e)},$n.prototype.clear=function(){this.__data__=new qn,this.size=0},$n.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},$n.prototype.get=function(e){return this.__data__.get(e)},$n.prototype.has=function(e){return this.__data__.has(e)},$n.prototype.set=function(e,t){var n=this.__data__;if(n instanceof qn){var r=n.__data__;if(!In||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Wn(r)}return n.set(e,t),this.size=n.size,this};var ur=ki(gr),dr=ki(_r,!0);function pr(e,t){var n=!0;return ur(e,function(e,r,i){return n=!!t(e,r,i)}),n}function hr(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,l=a}return l}function fr(e,t){var n=[];return ur(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function yr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=yo),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?yr(s,t-1,n,r,i):Tt(i,s):r||(i[i.length]=s)}return i}var mr=Ti(),vr=Ti(!0);function gr(e,t){return e&&mr(e,t,ks)}function _r(e,t){return e&&vr(e,t,ks)}function br(e,t){return At(t,function(t){return Za(e[t])})}function Sr(e,t){for(var n=0,i=(t=mi(t,e)).length;null!=e&&n<i;)e=e[Fo(t[n++])];return n&&n==i?e:r}function wr(e,t,n){var r=t(e);return Ga(e)?r:Tt(r,n(e))}function Ir(e){return null==e?e===r?"[object Undefined]":"[object Null]":Xe&&Xe in Pe(e)?function(e){var t=Be.call(e,Xe),n=e[Xe];try{e[Xe]=r;var i=!0}catch(e){}var o=Fe.call(e);return i&&(t?e[Xe]=n:delete e[Xe]),o}(e):function(e){return Fe.call(e)}(e)}function Pr(e,t){return e>t}function Cr(e,t){return null!=e&&Be.call(e,t)}function Or(e,t){return null!=e&&t in Pe(e)}function Ar(e,t,n){for(var i=n?zt:Et,o=e[0].length,a=e.length,s=a,c=re(a),l=1/0,u=[];s--;){var d=e[s];s&&t&&(d=kt(d,Kt(t))),l=vn(d.length,l),c[s]=!n&&(t||o>=120&&d.length>=120)?new Hn(s&&d):r}d=e[0];var p=-1,h=c[0];e:for(;++p<o&&u.length<l;){var f=d[p],y=t?t(f):f;if(f=n||0!==f?f:0,!(h?Zt(h,y):i(u,y,n))){for(s=a;--s;){var m=c[s];if(!(m?Zt(m,y):i(e[s],y,n)))continue e}h&&h.push(y),u.push(f)}}return u}function Er(e,t,n){var i=null==(e=Co(e,t=mi(t,e)))?e:e[Fo(Yo(t))];return null==i?r:wt(i,e,n)}function zr(e){return es(e)&&Ir(e)==f}function kr(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=Ga(e),c=Ga(t),l=s?y:po(e),u=c?y:po(t),d=(l=l==f?I:l)==I,p=(u=u==f?I:u)==I,h=l==u;if(h&&$a(e)){if(!$a(t))return!1;s=!0,d=!1}if(h&&!d)return a||(a=new $n),s||cs(e)?Qi(e,t,n,i,o,a):function(e,t,n,r,i,o,a){switch(n){case T:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case k:return!(e.byteLength!=t.byteLength||!o(new Ve(e),new Ve(t)));case m:case v:case w:return Ua(+e,+t);case g:return e.name==t.name&&e.message==t.message;case C:case A:return e==t+"";case S:var s=rn;case O:var c=1&r;if(s||(s=sn),e.size!=t.size&&!c)return!1;var l=a.get(e);if(l)return l==t;r|=2,a.set(e,t);var u=Qi(s(e),s(t),r,i,o,a);return a.delete(e),u;case E:if(Fn)return Fn.call(e)==Fn.call(t)}return!1}(e,t,l,n,i,o,a);if(!(1&n)){var _=d&&Be.call(e,"__wrapped__"),b=p&&Be.call(t,"__wrapped__");if(_||b){var P=_?e.value():e,z=b?t.value():t;return a||(a=new $n),o(P,z,n,i,a)}}return!!h&&(a||(a=new $n),function(e,t,n,i,o,a){var s=1&n,c=eo(e),l=c.length;if(l!=eo(t).length&&!s)return!1;for(var u=l;u--;){var d=c[u];if(!(s?d in t:Be.call(t,d)))return!1}var p=a.get(e),h=a.get(t);if(p&&h)return p==t&&h==e;var f=!0;a.set(e,t),a.set(t,e);for(var y=s;++u<l;){var m=e[d=c[u]],v=t[d];if(i)var g=s?i(v,m,d,t,e,a):i(m,v,d,e,t,a);if(!(g===r?m===v||o(m,v,n,i,a):g)){f=!1;break}y||(y="constructor"==d)}if(f&&!y){var _=e.constructor,b=t.constructor;_==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof _&&_ instanceof _&&"function"==typeof b&&b instanceof b||(f=!1)}return a.delete(e),a.delete(t),f}(e,t,n,i,o,a))}(e,t,n,i,kr,o))}function Tr(e,t,n,i){var o=n.length,a=o,s=!i;if(null==e)return!a;for(e=Pe(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 l=(c=n[o])[0],u=e[l],d=c[1];if(s&&c[2]){if(u===r&&!(l in e))return!1}else{var p=new $n;if(i)var h=i(u,d,l,e,t,p);if(!(h===r?kr(d,u,3,i,p):h))return!1}}return!0}function jr(e){return!(!Xa(e)||(t=e,Ne&&Ne in t))&&(Za(e)?Ue:fe).test(Mo(e));var t}function Br(e){return"function"==typeof e?e:null==e?nc:"object"==typeof e?Ga(e)?Dr(e[0],e[1]):Mr(e):dc(e)}function xr(e){if(!So(e))return yn(e);var t=[];for(var n in Pe(e))Be.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Nr(e,t){return e<t}function Fr(e,t){var n=-1,r=Wa(e)?re(e.length):[];return ur(e,function(e,i,o){r[++n]=t(e,i,o)}),r}function Mr(e){var t=so(e);return 1==t.length&&t[0][2]?Io(t[0][0],t[0][1]):function(n){return n===e||Tr(n,e,t)}}function Dr(e,t){return go(e)&&wo(t)?Io(Fo(e),t):function(n){var i=Cs(n,e);return i===r&&i===t?Os(n,e):kr(t,i,3)}}function Ur(e,t,n,i,o){e!==t&&mr(t,function(a,s){if(o||(o=new $n),Xa(a))!function(e,t,n,i,o,a,s){var c=Oo(e,n),l=Oo(t,n),u=s.get(l);if(u)Qn(e,n,u);else{var d=a?a(c,l,n+"",e,t,s):r,p=d===r;if(p){var h=Ga(l),f=!h&&$a(l),y=!h&&!f&&cs(l);d=l,h||f||y?Ga(c)?d=c:Ha(c)?d=Oi(c):f?(p=!1,d=bi(l,!0)):y?(p=!1,d=wi(l,!0)):d=[]:rs(l)||Va(l)?(d=c,Va(c)?d=ms(c):Xa(c)&&!Za(c)||(d=fo(l))):p=!1}p&&(s.set(l,d),o(d,l,i,a,s),s.delete(l)),Qn(e,n,d)}}(e,t,s,n,Ur,i,o);else{var c=i?i(Oo(e,s),a,s+"",e,t,o):r;c===r&&(c=a),Qn(e,s,c)}},Ts)}function Rr(e,t){var n=e.length;if(n)return mo(t+=t<0?n:0,n)?e[t]:r}function Lr(e,t,n){t=t.length?kt(t,function(e){return Ga(e)?function(t){return Sr(t,1===e.length?e[0]:e)}:e}):[nc];var r=-1;t=kt(t,Kt(oo()));var i=Fr(e,function(e,n,i){var o=kt(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=Ii(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=Sr(e,a);n(s,a)&&Zr(o,mi(a,e),s)}return o}function Gr(e,t,n,r){var i=r?Ut:Dt,o=-1,a=t.length,s=e;for(e===t&&(t=Oi(t)),n&&(s=kt(e,Kt(n)));++o<a;)for(var c=0,l=t[o],u=n?n(l):l;(c=i(s,u,c,r))>-1;)s!==e&&$e.call(s,c,1),$e.call(e,c,1);return e}function qr(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;mo(i)?$e.call(e,i,1):ci(e,i)}}return e}function Wr(e,t){return e+ft(bn()*(t-e+1))}function Hr(e,t){var n="";if(!e||t<1||t>u)return n;do{t%2&&(n+=e),(t=ft(t/2))&&(e+=e)}while(t);return n}function $r(e,t){return zo(Po(e,t,nc),e+"")}function Kr(e){return Yn(Us(e))}function Yr(e,t){var n=Us(e);return jo(n,or(t,0,n.length))}function Zr(e,t,n,i){if(!Xa(e))return e;for(var o=-1,a=(t=mi(t,e)).length,s=a-1,c=e;null!=c&&++o<a;){var l=Fo(t[o]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=s){var d=c[l];(u=i?i(d,l,c):r)===r&&(u=Xa(d)?d:mo(t[o+1])?[]:{})}Xn(c,l,u),c=c[l]}return e}var Jr=En?function(e,t){return En.set(e,t),e}:nc,Qr=ot?function(e,t){return ot(e,"toString",{configurable:!0,enumerable:!1,value:Xs(t),writable:!0})}:nc;function Xr(e){return jo(Us(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 ur(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,l=ss(t),u=t===r;o<a;){var d=ft((o+a)/2),p=n(e[d]),h=p!==r,f=null===p,y=p==p,m=ss(p);if(s)var v=i||y;else v=u?y&&(i||h):c?y&&h&&(i||!f):l?y&&h&&!f&&(i||!m):!f&&!m&&(i?p<=t:p<t);v?o=d+1:a=d}return vn(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||!Ua(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(Ga(e))return kt(e,ai)+"";if(ss(e))return Mn?Mn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function si(e,t,n){var r=-1,i=Et,o=e.length,a=!0,s=[],c=s;if(n)a=!1,i=zt;else if(o>=200){var l=t?null:Hi(e);if(l)return sn(l);a=!1,i=Zt,c=new Hn}else c=t?[]:s;e:for(;++r<o;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,a&&d==d){for(var p=c.length;p--;)if(c[p]===d)continue e;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}function ci(e,t){var n=-1,r=(t=mi(t,e)).length;if(!r)return!0;for(;++n<r;){var i=Fo(t[n]);if("__proto__"===i&&!Be.call(e,"__proto__"))return!1;if(("constructor"===i||"prototype"===i)&&n<r-1)return!1}var o=Co(e,t);return null==o||delete o[Fo(Yo(t))]}function li(e,t,n,r){return Zr(e,t,n(Sr(e,t)),r)}function ui(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()),jt(t,function(e,t){return t.func.apply(t.thisArg,Tt([e],t.args))},n)}function pi(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]=lr(o[i]||a,e[s],t,n));return si(yr(o,1),t,n)}function hi(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 Ha(e)?e:[]}function yi(e){return"function"==typeof e?e:nc}function mi(e,t){return Ga(e)?e:go(e,t)?[e]:No(vs(e))}var vi=$r;function gi(e,t,n){var i=e.length;return n=n===r?i:n,!t&&n>=i?e:ei(e,t,n)}var _i=ct||function(e){return ut.clearTimeout(e)};function bi(e,t){if(t)return e.slice();var n=e.length,r=Ge?Ge(n):new e.constructor(n);return e.copy(r),r}function Si(e){var t=new e.constructor(e.byteLength);return new Ve(t).set(new Ve(e)),t}function wi(e,t){var n=t?Si(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ii(e,t){if(e!==t){var n=e!==r,i=null===e,o=e==e,a=ss(e),s=t!==r,c=null===t,l=t==t,u=ss(t);if(!c&&!u&&!a&&e>t||a&&s&&l&&!c&&!u||i&&s&&l||!n&&l||!o)return 1;if(!i&&!a&&!u&&e<t||u&&n&&o&&!i&&!a||c&&n&&o||!s&&o||!l)return-1}return 0}function Pi(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,c=t.length,l=mn(o-a,0),u=re(c+l),d=!r;++s<c;)u[s]=t[s];for(;++i<a;)(d||i<o)&&(u[n[i]]=e[i]);for(;l--;)u[s++]=e[i++];return u}function Ci(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,c=-1,l=t.length,u=mn(o-s,0),d=re(u+l),p=!r;++i<u;)d[i]=e[i];for(var h=i;++c<l;)d[h+c]=t[c];for(;++a<s;)(p||i<o)&&(d[h+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],l=i?i(n[c],e[c],c,n,e):r;l===r&&(l=e[c]),o?rr(n,c,l):Xn(n,c,l)}return n}function Ei(e,t){return function(n,r){var i=Ga(n)?It:tr,o=t?t():{};return i(n,e,oo(r,2),o)}}function zi(e){return $r(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&&vo(n[0],n[1],s)&&(a=o<3?r:a,o=1),t=Pe(t);++i<o;){var c=n[i];c&&e(t,c,i,a)}return t})}function ki(e,t){return function(n,r){if(null==n)return n;if(!Wa(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Pe(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Ti(e){return function(t,n,r){for(var i=-1,o=Pe(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 ji(e){return function(t){var n=nn(t=vs(t))?un(t):r,i=n?n[0]:t.charAt(0),o=n?gi(n,1).join(""):t.slice(1);return i[e]()+o}}function Bi(e){return function(t){return jt(Zs(Vs(t).replace(Ye,"")),e,"")}}function xi(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=Un(e.prototype),r=e.apply(n,t);return Xa(r)?r:n}}function Ni(e){return function(t,n,i){var o=Pe(t);if(!Wa(t)){var a=oo(n,3);t=ks(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 Fi(e){return Xi(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 l=ro(s=t[o]),u="wrapper"==l?no(s):r;c=u&&_o(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[ro(u[0])].apply(c,u[3]):1==s.length&&_o(s)?c[l]():c.thru(s)}return function(){var e=arguments,r=e[0];if(c&&1==e.length&&Ga(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 Mi(e,t,n,i,o,a,s,l,u,d){var p=t&c,h=1&t,f=2&t,y=24&t,m=512&t,v=f?r:xi(e);return function c(){for(var g=arguments.length,_=re(g),b=g;b--;)_[b]=arguments[b];if(y)var S=io(c),w=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(_,S);if(i&&(_=Pi(_,i,o,y)),a&&(_=Ci(_,a,s,y)),g-=w,y&&g<d){var I=an(_,S);return qi(e,t,Mi,c.placeholder,n,_,I,l,u,d-g)}var P=h?n:this,C=f?P[e]:e;return g=_.length,l?_=function(e,t){for(var n=e.length,i=vn(t.length,n),o=Oi(e);i--;){var a=t[i];e[i]=mo(a,n)?o[a]:r}return e}(_,l):m&&g>1&&_.reverse(),p&&u<g&&(_.length=u),this&&this!==ut&&this instanceof c&&(C=v||xi(C)),C.apply(P,_)}}function Di(e,t){return function(n,r){return function(e,t,n,r){return gr(e,function(e,i,o){t(r,n(e),i,o)}),r}(n,e,t(r),{})}}function Ui(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 Xi(function(t){return t=kt(t,Kt(oo())),$r(function(n){var r=this;return e(t,function(e){return wt(e,r,n)})})})}function Li(e,t){var n=(t=t===r?" ":ai(t)).length;if(n<2)return n?Hr(t,e):t;var i=Hr(t,pt(e/ln(t)));return nn(t)?gi(un(i),0,e).join(""):i.slice(0,e)}function Vi(e){return function(t,n,i){return i&&"number"!=typeof i&&vo(t,n,i)&&(n=i=r),t=ps(t),n===r?(n=t,t=0):n=ps(n),function(e,t,n,r){for(var i=-1,o=mn(pt((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:ps(i),e)}}function Gi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ys(t),n=ys(n)),e(t,n)}}function qi(e,t,n,i,o,a,c,l,u,d){var p=8&t;t|=p?s:64,4&(t&=~(p?64:s))||(t&=-4);var h=[e,t,o,p?a:r,p?c:r,p?r:a,p?r:c,l,u,d],f=n.apply(r,h);return _o(e)&&Ao(f,h),f.placeholder=i,ko(f,e,t)}function Wi(e){var t=Ie[e];return function(e,n){if(e=ys(e),(n=null==n?0:vn(hs(n),292))&&Gt(e)){var r=(vs(e)+"e").split("e");return+((r=(vs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Hi=Cn&&1/sn(new Cn([,-0]))[1]==l?function(e){return new Cn(e)}:sc;function $i(e){return function(t){var n=po(t);return n==S?rn(t):n==O?cn(t):function(e,t){return kt(t,function(t){return[t,e[t]]})}(t,e(t))}}function Ki(e,t,n,o,l,u,d,p){var h=2&t;if(!h&&"function"!=typeof e)throw new Ae(i);var f=o?o.length:0;if(f||(t&=-97,o=l=r),d=d===r?d:mn(hs(d),0),p=p===r?p:hs(p),f-=l?l.length:0,64&t){var y=o,m=l;o=l=r}var v=h?r:no(e),g=[e,t,n,o,l,y,m,u,d,p];if(v&&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 l=t[3];if(l){var u=e[3];e[3]=u?Pi(u,l,t[4]):l,e[4]=u?an(e[3],a):t[4]}(l=t[5])&&(u=e[5],e[5]=u?Ci(u,l,t[6]):l,e[6]=u?an(e[5],a):t[6]),(l=t[7])&&(e[7]=l),r&c&&(e[8]=null==e[8]?t[8]:vn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(g,v),e=g[0],t=g[1],n=g[2],o=g[3],l=g[4],!(p=g[9]=g[9]===r?h?0:e.length:mn(g[9]-f,0))&&24&t&&(t&=-25),t&&1!=t)_=8==t||16==t?function(e,t,n){var i=xi(e);return function o(){for(var a=arguments.length,s=re(a),c=a,l=io(o);c--;)s[c]=arguments[c];var u=a<3&&s[0]!==l&&s[a-1]!==l?[]:an(s,l);return(a-=u.length)<n?qi(e,t,Mi,o.placeholder,r,s,u,r,r,n-a):wt(this&&this!==ut&&this instanceof o?i:e,this,s)}}(e,t,p):t!=s&&33!=t||l.length?Mi.apply(r,g):function(e,t,n,r){var i=1&t,o=xi(e);return function t(){for(var a=-1,s=arguments.length,c=-1,l=r.length,u=re(l+s),d=this&&this!==ut&&this instanceof t?o:e;++c<l;)u[c]=r[c];for(;s--;)u[c++]=arguments[++a];return wt(d,i?n:this,u)}}(e,t,n,o);else var _=function(e,t,n){var r=1&t,i=xi(e);return function t(){return(this&&this!==ut&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,n);return ko((v?Jr:Ao)(_,g),e,t)}function Yi(e,t,n,i){return e===r||Ua(e,ke[n])&&!Be.call(i,n)?t:e}function Zi(e,t,n,i,o,a){return Xa(e)&&Xa(t)&&(a.set(t,e),Ur(e,t,r,Zi,a),a.delete(t)),e}function Ji(e){return rs(e)?r:e}function Qi(e,t,n,i,o,a){var s=1&n,c=e.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var p=-1,h=!0,f=2&n?new Hn:r;for(a.set(e,t),a.set(t,e);++p<c;){var y=e[p],m=t[p];if(i)var v=s?i(m,y,p,t,e,a):i(y,m,p,e,t,a);if(v!==r){if(v)continue;h=!1;break}if(f){if(!xt(t,function(e,t){if(!Zt(f,t)&&(y===e||o(y,e,n,i,a)))return f.push(t)})){h=!1;break}}else if(y!==m&&!o(y,m,n,i,a)){h=!1;break}}return a.delete(e),a.delete(t),h}function Xi(e){return zo(Po(e,r,qo),e+"")}function eo(e){return wr(e,ks,lo)}function to(e){return wr(e,Ts,uo)}var no=En?function(e){return En.get(e)}:sc;function ro(e){for(var t=e.name+"",n=zn[t],r=Be.call(zn,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(Be.call(Dn,"placeholder")?Dn:e).placeholder}function oo(){var e=Dn.iteratee||rc;return e=e===rc?Br: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=ks(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,wo(i)]}return t}function co(e,t){var n=function(e,t){return null==e?r:e[t]}(e,t);return jr(n)?n:r}var lo=yt?function(e){return null==e?[]:(e=Pe(e),At(yt(e),function(t){return He.call(e,t)}))}:fc,uo=yt?function(e){for(var t=[];e;)Tt(t,lo(e)),e=qe(e);return t}:fc,po=Ir;function ho(e,t,n){for(var r=-1,i=(t=mi(t,e)).length,o=!1;++r<i;){var a=Fo(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Qa(i)&&mo(a,i)&&(Ga(e)||Va(e))}function fo(e){return"function"!=typeof e.constructor||So(e)?{}:Un(qe(e))}function yo(e){return Ga(e)||Va(e)||!!(Ke&&e&&e[Ke])}function mo(e,t){var n=typeof e;return!!(t=t??u)&&("number"==n||"symbol"!=n&&me.test(e))&&e>-1&&e%1==0&&e<t}function vo(e,t,n){if(!Xa(n))return!1;var r=typeof t;return!!("number"==r?Wa(n)&&mo(t,n.length):"string"==r&&t in n)&&Ua(n[t],e)}function go(e,t){if(Ga(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ss(e))||Q.test(e)||!J.test(e)||null!=t&&e in Pe(t)}function _o(e){var t=ro(e),n=Dn[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]}(wn&&po(new wn(new ArrayBuffer(1)))!=T||In&&po(new In)!=S||Pn&&po(Pn.resolve())!=P||Cn&&po(new Cn)!=O||On&&po(new On)!=z)&&(po=function(e){var t=Ir(e),n=t==I?e.constructor:r,i=n?Mo(n):"";if(i)switch(i){case kn:return T;case Tn:return S;case jn:return P;case Bn:return O;case xn:return z}return t});var bo=Te?Za:yc;function So(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ke)}function wo(e){return e==e&&!Xa(e)}function Io(e,t){return function(n){return null!=n&&n[e]===t&&(t!==r||e in Pe(n))}}function Po(e,t,n){return t=mn(t===r?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=mn(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),wt(e,this,s)}}function Co(e,t){return t.length<2?e:Sr(e,ei(t,0,-1))}function Oo(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ao=To(Jr),Eo=dt||function(e,t){return ut.setTimeout(e,t)},zo=To(Qr);function ko(e,t,n){var r=t+"";return zo(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 Pt(h,function(n){var r="_."+n[0];t&n[1]&&!Et(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ae):[]}(r),n)))}function To(e){var t=0,n=0;return function(){var i=gn(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function jo(e,t){var n=-1,i=e.length,o=i-1;for(t=t===r?i:t;++n<t;){var a=Wr(n,o),s=e[a];e[a]=e[n],e[n]=s}return e.length=t,e}var Bo,xo,No=(Bo=Ba(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(X,function(e,n,r,i){t.push(r?i.replace(le,"$1"):n||e)}),t},function(e){return 500===xo.size&&xo.clear(),e}),xo=Bo.cache,Bo);function Fo(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Mo(e){if(null!=e){try{return je.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Do(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 Uo=$r(function(e,t){return Ha(e)?lr(e,yr(t,1,Ha,!0)):[]}),Ro=$r(function(e,t){var n=Yo(t);return Ha(n)&&(n=r),Ha(e)?lr(e,yr(t,1,Ha,!0),oo(n,2)):[]}),Lo=$r(function(e,t){var n=Yo(t);return Ha(n)&&(n=r),Ha(e)?lr(e,yr(t,1,Ha,!0),r,n):[]});function Vo(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=mn(r+i,0)),Mt(e,oo(t,3),i)}function Go(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return n!==r&&(o=hs(n),o=n<0?mn(i+o,0):vn(o,i-1)),Mt(e,oo(t,3),o,!0)}function qo(e){return null!=e&&e.length?yr(e,1):[]}function Wo(e){return e&&e.length?e[0]:r}var Ho=$r(function(e){var t=kt(e,fi);return t.length&&t[0]===e[0]?Ar(t):[]}),$o=$r(function(e){var t=Yo(e),n=kt(e,fi);return t===Yo(n)?t=r:n.pop(),n.length&&n[0]===e[0]?Ar(n,oo(t,2)):[]}),Ko=$r(function(e){var t=Yo(e),n=kt(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 Zo=$r(Jo);function Jo(e,t){return e&&e.length&&t&&t.length?Gr(e,t):e}var Qo=Xi(function(e,t){var n=null==e?0:e.length,r=ir(e,t);return qr(e,kt(t,function(e){return mo(e,n)?+e:e}).sort(Ii)),r});function Xo(e){return null==e?e:Sn.call(e)}var ea=$r(function(e){return si(yr(e,1,Ha,!0))}),ta=$r(function(e){var t=Yo(e);return Ha(t)&&(t=r),si(yr(e,1,Ha,!0),oo(t,2))}),na=$r(function(e){var t=Yo(e);return t="function"==typeof t?t:r,si(yr(e,1,Ha,!0),r,t)});function ra(e){if(!e||!e.length)return[];var t=0;return e=At(e,function(e){if(Ha(e))return t=mn(e.length,t),!0}),Ht(t,function(t){return kt(e,Vt(t))})}function ia(e,t){if(!e||!e.length)return[];var n=ra(e);return null==t?n:kt(n,function(e){return wt(t,r,e)})}var oa=$r(function(e,t){return Ha(e)?lr(e,t):[]}),aa=$r(function(e){return pi(At(e,Ha))}),sa=$r(function(e){var t=Yo(e);return Ha(t)&&(t=r),pi(At(e,Ha),oo(t,2))}),ca=$r(function(e){var t=Yo(e);return t="function"==typeof t?t:r,pi(At(e,Ha),r,t)}),la=$r(ra),ua=$r(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=Dn(e);return t.__chain__=!0,t}function pa(e,t){return t(e)}var ha=Xi(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&&mo(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:pa,args:[o],thisArg:r}),new Ln(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(r),e})):this.thru(o)}),fa=Ei(function(e,t,n){Be.call(e,n)?++e[n]:rr(e,n,1)}),ya=Ni(Vo),ma=Ni(Go);function va(e,t){return(Ga(e)?Pt:ur)(e,oo(t,3))}function ga(e,t){return(Ga(e)?Ct:dr)(e,oo(t,3))}var _a=Ei(function(e,t,n){Be.call(e,n)?e[n].push(t):rr(e,n,[t])}),ba=$r(function(e,t,n){var r=-1,i="function"==typeof t,o=Wa(e)?re(e.length):[];return ur(e,function(e){o[++r]=i?wt(t,e,n):Er(e,t,n)}),o}),Sa=Ei(function(e,t,n){rr(e,n,t)});function wa(e,t){return(Ga(e)?kt:Fr)(e,oo(t,3))}var Ia=Ei(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),Pa=$r(function(e,t){if(null==e)return[];var n=t.length;return n>1&&vo(e,t[0],t[1])?t=[]:n>2&&vo(t[0],t[1],t[2])&&(t=[t[0]]),Lr(e,yr(t,1),[])}),Ca=lt||function(){return ut.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=hs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=r),n}}var Ea=$r(function(e,t,n){var r=1;if(n.length){var i=an(n,io(Ea));r|=s}return Ki(e,r,t,n,i)}),za=$r(function(e,t,n){var r=3;if(n.length){var i=an(n,io(za));r|=s}return Ki(t,r,e,n,i)});function ka(e,t,n){var o,a,s,c,l,u,d=0,p=!1,h=!1,f=!0;if("function"!=typeof e)throw new Ae(i);function y(t){var n=o,i=a;return o=a=r,d=t,c=e.apply(i,n)}function m(e){var n=e-u;return u===r||n>=t||n<0||h&&e-d>=s}function v(){var e=Ca();if(m(e))return g(e);l=Eo(v,function(e){var n=t-(e-u);return h?vn(n,s-(e-d)):n}(e))}function g(e){return l=r,f&&o?y(e):(o=a=r,c)}function _(){var e=Ca(),n=m(e);if(o=arguments,a=this,u=e,n){if(l===r)return function(e){return d=e,l=Eo(v,t),p?y(e):c}(u);if(h)return _i(l),l=Eo(v,t),y(u)}return l===r&&(l=Eo(v,t)),c}return t=ys(t)||0,Xa(n)&&(p=!!n.leading,s=(h="maxWait"in n)?mn(ys(n.maxWait)||0,t):s,f="trailing"in n?!!n.trailing:f),_.cancel=function(){l!==r&&_i(l),d=0,o=u=a=l=r},_.flush=function(){return l===r?c:g(Ca())},_}var Ta=$r(function(e,t){return cr(e,1,t)}),ja=$r(function(e,t,n){return cr(e,ys(t)||0,n)});function Ba(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(Ba.Cache||Wn),n}function xa(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)}}Ba.Cache=Wn;var Na=vi(function(e,t){var n=(t=1==t.length&&Ga(t[0])?kt(t[0],Kt(oo())):kt(yr(t,1),Kt(oo()))).length;return $r(function(r){for(var i=-1,o=vn(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return wt(e,this,r)})}),Fa=$r(function(e,t){var n=an(t,io(Fa));return Ki(e,s,r,t,n)}),Ma=$r(function(e,t){var n=an(t,io(Ma));return Ki(e,64,r,t,n)}),Da=Xi(function(e,t){return Ki(e,256,r,r,r,t)});function Ua(e,t){return e===t||e!=e&&t!=t}var Ra=Gi(Pr),La=Gi(function(e,t){return e>=t}),Va=zr(function(){return arguments}())?zr:function(e){return es(e)&&Be.call(e,"callee")&&!He.call(e,"callee")},Ga=re.isArray,qa=mt?Kt(mt):function(e){return es(e)&&Ir(e)==k};function Wa(e){return null!=e&&Qa(e.length)&&!Za(e)}function Ha(e){return es(e)&&Wa(e)}var $a=Nt||yc,Ka=vt?Kt(vt):function(e){return es(e)&&Ir(e)==v};function Ya(e){if(!es(e))return!1;var t=Ir(e);return t==g||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Za(e){if(!Xa(e))return!1;var t=Ir(e);return t==_||t==b||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Ja(e){return"number"==typeof e&&e==hs(e)}function Qa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function Xa(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==typeof e}var ts=gt?Kt(gt):function(e){return es(e)&&po(e)==S};function ns(e){return"number"==typeof e||es(e)&&Ir(e)==w}function rs(e){if(!es(e)||Ir(e)!=I)return!1;var t=qe(e);if(null===t)return!0;var n=Be.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&je.call(n)==Me}var is=_t?Kt(_t):function(e){return es(e)&&Ir(e)==C},os=bt?Kt(bt):function(e){return es(e)&&po(e)==O};function as(e){return"string"==typeof e||!Ga(e)&&es(e)&&Ir(e)==A}function ss(e){return"symbol"==typeof e||es(e)&&Ir(e)==E}var cs=St?Kt(St):function(e){return es(e)&&Qa(e.length)&&!!rt[Ir(e)]},ls=Gi(Nr),us=Gi(function(e,t){return e<=t});function ds(e){if(!e)return[];if(Wa(e))return as(e)?un(e):Oi(e);if(Je&&e[Je])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[Je]());var t=po(e);return(t==S?rn:t==O?sn:Us)(e)}function ps(e){return e?(e=ys(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hs(e){var t=ps(e),n=t%1;return t==t?n?t-n:t:0}function fs(e){return e?or(hs(e),0,p):0}function ys(e){if("number"==typeof e)return e;if(ss(e))return d;if(Xa(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Xa(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=$t(e);var n=he.test(e);return n||ye.test(e)?st(e.slice(2),n?2:8):pe.test(e)?d:+e}function ms(e){return Ai(e,Ts(e))}function vs(e){return null==e?"":ai(e)}var gs=zi(function(e,t){if(So(t)||Wa(t))Ai(t,ks(t),e);else for(var n in t)Be.call(t,n)&&Xn(e,n,t[n])}),_s=zi(function(e,t){Ai(t,Ts(t),e)}),bs=zi(function(e,t,n,r){Ai(t,Ts(t),e,r)}),Ss=zi(function(e,t,n,r){Ai(t,ks(t),e,r)}),ws=Xi(ir),Is=$r(function(e,t){e=Pe(e);var n=-1,i=t.length,o=i>2?t[2]:r;for(o&&vo(t[0],t[1],o)&&(i=1);++n<i;)for(var a=t[n],s=Ts(a),c=-1,l=s.length;++c<l;){var u=s[c],d=e[u];(d===r||Ua(d,ke[u])&&!Be.call(e,u))&&(e[u]=a[u])}return e}),Ps=$r(function(e){return e.push(r,Zi),wt(Bs,r,e)});function Cs(e,t,n){var i=null==e?r:Sr(e,t);return i===r?n:i}function Os(e,t){return null!=e&&ho(e,t,Or)}var As=Di(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Fe.call(t)),e[t]=n},Xs(nc)),Es=Di(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Fe.call(t)),Be.call(e,t)?e[t].push(n):e[t]=[n]},oo),zs=$r(Er);function ks(e){return Wa(e)?Kn(e):xr(e)}function Ts(e){return Wa(e)?Kn(e,!0):function(e){if(!Xa(e))return function(e){var t=[];if(null!=e)for(var n in Pe(e))t.push(n);return t}(e);var t=So(e),n=[];for(var r in e)("constructor"!=r||!t&&Be.call(e,r))&&n.push(r);return n}(e)}var js=zi(function(e,t,n){Ur(e,t,n)}),Bs=zi(function(e,t,n,r){Ur(e,t,n,r)}),xs=Xi(function(e,t){var n={};if(null==e)return n;var r=!1;t=kt(t,function(t){return t=mi(t,e),r||(r=t.length>1),t}),Ai(e,to(e),n),r&&(n=ar(n,7,Ji));for(var i=t.length;i--;)ci(n,t[i]);return n}),Ns=Xi(function(e,t){return null==e?{}:function(e,t){return Vr(e,t,function(t,n){return Os(e,n)})}(e,t)});function Fs(e,t){if(null==e)return{};var n=kt(to(e),function(e){return[e]});return t=oo(t),Vr(e,n,function(e,n){return t(e,n[0])})}var Ms=$i(ks),Ds=$i(Ts);function Us(e){return null==e?[]:Yt(e,ks(e))}var Rs=Bi(function(e,t,n){return t=t.toLowerCase(),e+(n?Ls(t):t)});function Ls(e){return Ys(vs(e).toLowerCase())}function Vs(e){return(e=vs(e))&&e.replace(ve,Xt).replace(Ze,"")}var Gs=Bi(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),qs=Bi(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Ws=ji("toLowerCase"),Hs=Bi(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),$s=Bi(function(e,t,n){return e+(n?" ":"")+Ys(t)}),Ks=Bi(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Ys=ji("toUpperCase");function Zs(e,t,n){return e=vs(e),(t=n?r:t)===r?function(e){return et.test(e)}(e)?function(e){return e.match(Qe)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Js=$r(function(e,t){try{return wt(e,r,t)}catch(e){return Ya(e)?e:new Se(e)}}),Qs=Xi(function(e,t){return Pt(t,function(t){t=Fo(t),rr(e,t,Ea(e[t],e))}),e});function Xs(e){return function(){return e}}var ec=Fi(),tc=Fi(!0);function nc(e){return e}function rc(e){return Br("function"==typeof e?e:ar(e,1))}var ic=$r(function(e,t){return function(n){return Er(n,e,t)}}),oc=$r(function(e,t){return function(n){return Er(e,n,t)}});function ac(e,t,n){var r=ks(t),i=br(t,r);null!=n||Xa(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=br(t,ks(t)));var o=!(Xa(n)&&"chain"in n&&!n.chain),a=Za(e);return Pt(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,Tt([this.value()],arguments))})}),e}function sc(){}var cc=Ri(kt),lc=Ri(Ot),uc=Ri(xt);function dc(e){return go(e)?Vt(Fo(e)):function(e){return function(t){return Sr(t,e)}}(e)}var pc=Vi(),hc=Vi(!0);function fc(){return[]}function yc(){return!1}var mc,vc=Ui(function(e,t){return e+t},0),gc=Wi("ceil"),_c=Ui(function(e,t){return e/t},1),bc=Wi("floor"),Sc=Ui(function(e,t){return e*t},1),wc=Wi("round"),Ic=Ui(function(e,t){return e-t},0);return Dn.after=function(e,t){if("function"!=typeof t)throw new Ae(i);return e=hs(e),function(){if(--e<1)return t.apply(this,arguments)}},Dn.ary=Oa,Dn.assign=gs,Dn.assignIn=_s,Dn.assignInWith=bs,Dn.assignWith=Ss,Dn.at=ws,Dn.before=Aa,Dn.bind=Ea,Dn.bindAll=Qs,Dn.bindKey=za,Dn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ga(e)?e:[e]},Dn.chain=da,Dn.chunk=function(e,t,n){t=(n?vo(e,t,n):t===r)?1:mn(hs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=re(pt(i/t));o<i;)s[a++]=ei(e,o,o+=t);return s},Dn.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},Dn.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 Tt(Ga(n)?Oi(n):[n],yr(t,1))},Dn.cond=function(e){var t=null==e?0:e.length,n=oo();return e=t?kt(e,function(e){if("function"!=typeof e[1])throw new Ae(i);return[n(e[0]),e[1]]}):[],$r(function(n){for(var r=-1;++r<t;){var i=e[r];if(wt(i[0],this,n))return wt(i[1],this,n)}})},Dn.conforms=function(e){return function(e){var t=ks(e);return function(n){return sr(n,e,t)}}(ar(e,1))},Dn.constant=Xs,Dn.countBy=fa,Dn.create=function(e,t){var n=Un(e);return null==t?n:nr(n,t)},Dn.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},Dn.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},Dn.debounce=ka,Dn.defaults=Is,Dn.defaultsDeep=Ps,Dn.defer=Ta,Dn.delay=ja,Dn.difference=Uo,Dn.differenceBy=Ro,Dn.differenceWith=Lo,Dn.drop=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,(t=n||t===r?1:hs(t))<0?0:t,i):[]},Dn.dropRight=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,0,(t=i-(t=n||t===r?1:hs(t)))<0?0:t):[]},Dn.dropRightWhile=function(e,t){return e&&e.length?ui(e,oo(t,3),!0,!0):[]},Dn.dropWhile=function(e,t){return e&&e.length?ui(e,oo(t,3),!0):[]},Dn.fill=function(e,t,n,i){var o=null==e?0:e.length;return o?(n&&"number"!=typeof n&&vo(e,t,n)&&(n=0,i=o),function(e,t,n,i){var o=e.length;for((n=hs(n))<0&&(n=-n>o?0:o+n),(i=i===r||i>o?o:hs(i))<0&&(i+=o),i=n>i?0:fs(i);n<i;)e[n++]=t;return e}(e,t,n,i)):[]},Dn.filter=function(e,t){return(Ga(e)?At:fr)(e,oo(t,3))},Dn.flatMap=function(e,t){return yr(wa(e,t),1)},Dn.flatMapDeep=function(e,t){return yr(wa(e,t),l)},Dn.flatMapDepth=function(e,t,n){return n=n===r?1:hs(n),yr(wa(e,t),n)},Dn.flatten=qo,Dn.flattenDeep=function(e){return null!=e&&e.length?yr(e,l):[]},Dn.flattenDepth=function(e,t){return null!=e&&e.length?yr(e,t=t===r?1:hs(t)):[]},Dn.flip=function(e){return Ki(e,512)},Dn.flow=ec,Dn.flowRight=tc,Dn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];rr(r,i[0],i[1])}return r},Dn.functions=function(e){return null==e?[]:br(e,ks(e))},Dn.functionsIn=function(e){return null==e?[]:br(e,Ts(e))},Dn.groupBy=_a,Dn.initial=function(e){return null!=e&&e.length?ei(e,0,-1):[]},Dn.intersection=Ho,Dn.intersectionBy=$o,Dn.intersectionWith=Ko,Dn.invert=As,Dn.invertBy=Es,Dn.invokeMap=ba,Dn.iteratee=rc,Dn.keyBy=Sa,Dn.keys=ks,Dn.keysIn=Ts,Dn.map=wa,Dn.mapKeys=function(e,t){var n={};return t=oo(t,3),gr(e,function(e,r,i){rr(n,t(e,r,i),e)}),n},Dn.mapValues=function(e,t){var n={};return t=oo(t,3),gr(e,function(e,r,i){rr(n,r,t(e,r,i))}),n},Dn.matches=function(e){return Mr(ar(e,1))},Dn.matchesProperty=function(e,t){return Dr(e,ar(t,1))},Dn.memoize=Ba,Dn.merge=js,Dn.mergeWith=Bs,Dn.method=ic,Dn.methodOf=oc,Dn.mixin=ac,Dn.negate=xa,Dn.nthArg=function(e){return e=hs(e),$r(function(t){return Rr(t,e)})},Dn.omit=xs,Dn.omitBy=function(e,t){return Fs(e,xa(oo(t)))},Dn.once=function(e){return Aa(2,e)},Dn.orderBy=function(e,t,n,i){return null==e?[]:(Ga(t)||(t=null==t?[]:[t]),Ga(n=i?r:n)||(n=null==n?[]:[n]),Lr(e,t,n))},Dn.over=cc,Dn.overArgs=Na,Dn.overEvery=lc,Dn.overSome=uc,Dn.partial=Fa,Dn.partialRight=Ma,Dn.partition=Ia,Dn.pick=Ns,Dn.pickBy=Fs,Dn.property=dc,Dn.propertyOf=function(e){return function(t){return null==e?r:Sr(e,t)}},Dn.pull=Zo,Dn.pullAll=Jo,Dn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,oo(n,2)):e},Dn.pullAllWith=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,r,n):e},Dn.pullAt=Qo,Dn.range=pc,Dn.rangeRight=hc,Dn.rearg=Da,Dn.reject=function(e,t){return(Ga(e)?At:fr)(e,xa(oo(t,3)))},Dn.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 qr(e,i),n},Dn.rest=function(e,t){if("function"!=typeof e)throw new Ae(i);return $r(e,t=t===r?t:hs(t))},Dn.reverse=Xo,Dn.sampleSize=function(e,t,n){return t=(n?vo(e,t,n):t===r)?1:hs(t),(Ga(e)?Zn:Yr)(e,t)},Dn.set=function(e,t,n){return null==e?e:Zr(e,t,n)},Dn.setWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:Zr(e,t,n,i)},Dn.shuffle=function(e){return(Ga(e)?Jn:Xr)(e)},Dn.slice=function(e,t,n){var i=null==e?0:e.length;return i?(n&&"number"!=typeof n&&vo(e,t,n)?(t=0,n=i):(t=null==t?0:hs(t),n=n===r?i:hs(n)),ei(e,t,n)):[]},Dn.sortBy=Pa,Dn.sortedUniq=function(e){return e&&e.length?ii(e):[]},Dn.sortedUniqBy=function(e,t){return e&&e.length?ii(e,oo(t,2)):[]},Dn.split=function(e,t,n){return n&&"number"!=typeof n&&vo(e,t,n)&&(t=n=r),(n=n===r?p:n>>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=ai(t))&&nn(e)?gi(un(e),0,n):e.split(t,n):[]},Dn.spread=function(e,t){if("function"!=typeof e)throw new Ae(i);return t=null==t?0:mn(hs(t),0),$r(function(n){var r=n[t],i=gi(n,0,t);return r&&Tt(i,r),wt(e,this,i)})},Dn.tail=function(e){var t=null==e?0:e.length;return t?ei(e,1,t):[]},Dn.take=function(e,t,n){return e&&e.length?ei(e,0,(t=n||t===r?1:hs(t))<0?0:t):[]},Dn.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ei(e,(t=i-(t=n||t===r?1:hs(t)))<0?0:t,i):[]},Dn.takeRightWhile=function(e,t){return e&&e.length?ui(e,oo(t,3),!1,!0):[]},Dn.takeWhile=function(e,t){return e&&e.length?ui(e,oo(t,3)):[]},Dn.tap=function(e,t){return t(e),e},Dn.throttle=function(e,t,n){var r=!0,o=!0;if("function"!=typeof e)throw new Ae(i);return Xa(n)&&(r="leading"in n?!!n.leading:r,o="trailing"in n?!!n.trailing:o),ka(e,t,{leading:r,maxWait:t,trailing:o})},Dn.thru=pa,Dn.toArray=ds,Dn.toPairs=Ms,Dn.toPairsIn=Ds,Dn.toPath=function(e){return Ga(e)?kt(e,Fo):ss(e)?[e]:Oi(No(vs(e)))},Dn.toPlainObject=ms,Dn.transform=function(e,t,n){var r=Ga(e),i=r||$a(e)||cs(e);if(t=oo(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Xa(e)&&Za(o)?Un(qe(e)):{}}return(i?Pt:gr)(e,function(e,r,i){return t(n,e,r,i)}),n},Dn.unary=function(e){return Oa(e,1)},Dn.union=ea,Dn.unionBy=ta,Dn.unionWith=na,Dn.uniq=function(e){return e&&e.length?si(e):[]},Dn.uniqBy=function(e,t){return e&&e.length?si(e,oo(t,2)):[]},Dn.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?si(e,r,t):[]},Dn.unset=function(e,t){return null==e||ci(e,t)},Dn.unzip=ra,Dn.unzipWith=ia,Dn.update=function(e,t,n){return null==e?e:li(e,t,yi(n))},Dn.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:li(e,t,yi(n),i)},Dn.values=Us,Dn.valuesIn=function(e){return null==e?[]:Yt(e,Ts(e))},Dn.without=oa,Dn.words=Zs,Dn.wrap=function(e,t){return Fa(yi(t),e)},Dn.xor=aa,Dn.xorBy=sa,Dn.xorWith=ca,Dn.zip=la,Dn.zipObject=function(e,t){return hi(e||[],t||[],Xn)},Dn.zipObjectDeep=function(e,t){return hi(e||[],t||[],Zr)},Dn.zipWith=ua,Dn.entries=Ms,Dn.entriesIn=Ds,Dn.extend=_s,Dn.extendWith=bs,ac(Dn,Dn),Dn.add=vc,Dn.attempt=Js,Dn.camelCase=Rs,Dn.capitalize=Ls,Dn.ceil=gc,Dn.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=ys(n))==n?n:0),t!==r&&(t=(t=ys(t))==t?t:0),or(ys(e),t,n)},Dn.clone=function(e){return ar(e,4)},Dn.cloneDeep=function(e){return ar(e,5)},Dn.cloneDeepWith=function(e,t){return ar(e,5,t="function"==typeof t?t:r)},Dn.cloneWith=function(e,t){return ar(e,4,t="function"==typeof t?t:r)},Dn.conformsTo=function(e,t){return null==t||sr(e,t,ks(t))},Dn.deburr=Vs,Dn.defaultTo=function(e,t){return null==e||e!=e?t:e},Dn.divide=_c,Dn.endsWith=function(e,t,n){e=vs(e),t=ai(t);var i=e.length,o=n=n===r?i:or(hs(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},Dn.eq=Ua,Dn.escape=function(e){return(e=vs(e))&&$.test(e)?e.replace(W,en):e},Dn.escapeRegExp=function(e){return(e=vs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Dn.every=function(e,t,n){var i=Ga(e)?Ot:pr;return n&&vo(e,t,n)&&(t=r),i(e,oo(t,3))},Dn.find=ya,Dn.findIndex=Vo,Dn.findKey=function(e,t){return Ft(e,oo(t,3),gr)},Dn.findLast=ma,Dn.findLastIndex=Go,Dn.findLastKey=function(e,t){return Ft(e,oo(t,3),_r)},Dn.floor=bc,Dn.forEach=va,Dn.forEachRight=ga,Dn.forIn=function(e,t){return null==e?e:mr(e,oo(t,3),Ts)},Dn.forInRight=function(e,t){return null==e?e:vr(e,oo(t,3),Ts)},Dn.forOwn=function(e,t){return e&&gr(e,oo(t,3))},Dn.forOwnRight=function(e,t){return e&&_r(e,oo(t,3))},Dn.get=Cs,Dn.gt=Ra,Dn.gte=La,Dn.has=function(e,t){return null!=e&&ho(e,t,Cr)},Dn.hasIn=Os,Dn.head=Wo,Dn.identity=nc,Dn.includes=function(e,t,n,r){e=Wa(e)?e:Us(e),n=n&&!r?hs(n):0;var i=e.length;return n<0&&(n=mn(i+n,0)),as(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Dt(e,t,n)>-1},Dn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:hs(n);return i<0&&(i=mn(r+i,0)),Dt(e,t,i)},Dn.inRange=function(e,t,n){return t=ps(t),n===r?(n=t,t=0):n=ps(n),function(e,t,n){return e>=vn(t,n)&&e<mn(t,n)}(e=ys(e),t,n)},Dn.invoke=zs,Dn.isArguments=Va,Dn.isArray=Ga,Dn.isArrayBuffer=qa,Dn.isArrayLike=Wa,Dn.isArrayLikeObject=Ha,Dn.isBoolean=function(e){return!0===e||!1===e||es(e)&&Ir(e)==m},Dn.isBuffer=$a,Dn.isDate=Ka,Dn.isElement=function(e){return es(e)&&1===e.nodeType&&!rs(e)},Dn.isEmpty=function(e){if(null==e)return!0;if(Wa(e)&&(Ga(e)||"string"==typeof e||"function"==typeof e.splice||$a(e)||cs(e)||Va(e)))return!e.length;var t=po(e);if(t==S||t==O)return!e.size;if(So(e))return!xr(e).length;for(var n in e)if(Be.call(e,n))return!1;return!0},Dn.isEqual=function(e,t){return kr(e,t)},Dn.isEqualWith=function(e,t,n){var i=(n="function"==typeof n?n:r)?n(e,t):r;return i===r?kr(e,t,r,n):!!i},Dn.isError=Ya,Dn.isFinite=function(e){return"number"==typeof e&&Gt(e)},Dn.isFunction=Za,Dn.isInteger=Ja,Dn.isLength=Qa,Dn.isMap=ts,Dn.isMatch=function(e,t){return e===t||Tr(e,t,so(t))},Dn.isMatchWith=function(e,t,n){return n="function"==typeof n?n:r,Tr(e,t,so(t),n)},Dn.isNaN=function(e){return ns(e)&&e!=+e},Dn.isNative=function(e){if(bo(e))throw new Se("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return jr(e)},Dn.isNil=function(e){return null==e},Dn.isNull=function(e){return null===e},Dn.isNumber=ns,Dn.isObject=Xa,Dn.isObjectLike=es,Dn.isPlainObject=rs,Dn.isRegExp=is,Dn.isSafeInteger=function(e){return Ja(e)&&e>=-9007199254740991&&e<=u},Dn.isSet=os,Dn.isString=as,Dn.isSymbol=ss,Dn.isTypedArray=cs,Dn.isUndefined=function(e){return e===r},Dn.isWeakMap=function(e){return es(e)&&po(e)==z},Dn.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Ir(e)},Dn.join=function(e,t){return null==e?"":fn.call(e,t)},Dn.kebabCase=Gs,Dn.last=Yo,Dn.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=hs(n))<0?mn(i+o,0):vn(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):Mt(e,Rt,o,!0)},Dn.lowerCase=qs,Dn.lowerFirst=Ws,Dn.lt=ls,Dn.lte=us,Dn.max=function(e){return e&&e.length?hr(e,nc,Pr):r},Dn.maxBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Pr):r},Dn.mean=function(e){return Lt(e,nc)},Dn.meanBy=function(e,t){return Lt(e,oo(t,2))},Dn.min=function(e){return e&&e.length?hr(e,nc,Nr):r},Dn.minBy=function(e,t){return e&&e.length?hr(e,oo(t,2),Nr):r},Dn.stubArray=fc,Dn.stubFalse=yc,Dn.stubObject=function(){return{}},Dn.stubString=function(){return""},Dn.stubTrue=function(){return!0},Dn.multiply=Sc,Dn.nth=function(e,t){return e&&e.length?Rr(e,hs(t)):r},Dn.noConflict=function(){return ut._===this&&(ut._=De),this},Dn.noop=sc,Dn.now=Ca,Dn.pad=function(e,t,n){e=vs(e);var r=(t=hs(t))?ln(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Li(ft(i),n)+e+Li(pt(i),n)},Dn.padEnd=function(e,t,n){e=vs(e);var r=(t=hs(t))?ln(e):0;return t&&r<t?e+Li(t-r,n):e},Dn.padStart=function(e,t,n){e=vs(e);var r=(t=hs(t))?ln(e):0;return t&&r<t?Li(t-r,n)+e:e},Dn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),_n(vs(e).replace(ne,""),t||0)},Dn.random=function(e,t,n){if(n&&"boolean"!=typeof n&&vo(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=ps(e),t===r?(t=e,e=0):t=ps(t)),e>t){var i=e;e=t,t=i}if(n||e%1||t%1){var o=bn();return vn(e+o*(t-e+at("1e-"+((o+"").length-1))),t)}return Wr(e,t)},Dn.reduce=function(e,t,n){var r=Ga(e)?jt:qt,i=arguments.length<3;return r(e,oo(t,4),n,i,ur)},Dn.reduceRight=function(e,t,n){var r=Ga(e)?Bt:qt,i=arguments.length<3;return r(e,oo(t,4),n,i,dr)},Dn.repeat=function(e,t,n){return t=(n?vo(e,t,n):t===r)?1:hs(t),Hr(vs(e),t)},Dn.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Dn.result=function(e,t,n){var i=-1,o=(t=mi(t,e)).length;for(o||(o=1,e=r);++i<o;){var a=null==e?r:e[Fo(t[i])];a===r&&(i=o,a=n),e=Za(a)?a.call(e):a}return e},Dn.round=wc,Dn.runInContext=e,Dn.sample=function(e){return(Ga(e)?Yn:Kr)(e)},Dn.size=function(e){if(null==e)return 0;if(Wa(e))return as(e)?ln(e):e.length;var t=po(e);return t==S||t==O?e.size:xr(e).length},Dn.snakeCase=Hs,Dn.some=function(e,t,n){var i=Ga(e)?xt:ti;return n&&vo(e,t,n)&&(t=r),i(e,oo(t,3))},Dn.sortedIndex=function(e,t){return ni(e,t)},Dn.sortedIndexBy=function(e,t,n){return ri(e,t,oo(n,2))},Dn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ni(e,t);if(r<n&&Ua(e[r],t))return r}return-1},Dn.sortedLastIndex=function(e,t){return ni(e,t,!0)},Dn.sortedLastIndexBy=function(e,t,n){return ri(e,t,oo(n,2),!0)},Dn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ni(e,t,!0)-1;if(Ua(e[n],t))return n}return-1},Dn.startCase=$s,Dn.startsWith=function(e,t,n){return e=vs(e),n=null==n?0:or(hs(n),0,e.length),t=ai(t),e.slice(n,n+t.length)==t},Dn.subtract=Ic,Dn.sum=function(e){return e&&e.length?Wt(e,nc):0},Dn.sumBy=function(e,t){return e&&e.length?Wt(e,oo(t,2)):0},Dn.template=function(e,t,n){var i=Dn.templateSettings;n&&vo(e,t,n)&&(t=r),e=vs(e),t=Ss({},t,i,Yi);var o=Ss({},t.imports,i.imports,Yi),a=ks(o),s=Yt(o,a);Pt(a,function(e){if(ce.test(e))throw new Se("Invalid `imports` option passed into `_.template`")});var c,l,u=0,d=t.interpolate||ge,p="__p += '",h=Ce((t.escape||ge).source+"|"+d.source+"|"+(d===Z?ue:ge).source+"|"+(t.evaluate||ge).source+"|$","g"),f="//# sourceURL="+(Be.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++nt+"]")+"\n";e.replace(h,function(t,n,r,i,o,a){return r||(r=i),p+=e.slice(u,a).replace(_e,tn),n&&(c=!0,p+="' +\n__e("+n+") +\n'"),o&&(l=!0,p+="';\n"+o+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=a+t.length,t}),p+="';\n";var y=Be.call(t,"variable")&&t.variable;if(y){if(ce.test(y))throw new Se("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(l?p.replace(L,""):p).replace(V,"$1").replace(G,"$1;"),p="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(c?", __e = _.escape":"")+(l?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var m=Js(function(){return we(a,f+"return "+p).apply(r,s)});if(m.source=p,Ya(m))throw m;return m},Dn.times=function(e,t){if((e=hs(e))<1||e>u)return[];var n=p,r=vn(e,p);t=oo(t),e-=p;for(var i=Ht(r,t);++n<e;)t(n);return i},Dn.toFinite=ps,Dn.toInteger=hs,Dn.toLength=fs,Dn.toLower=function(e){return vs(e).toLowerCase()},Dn.toNumber=ys,Dn.toSafeInteger=function(e){return e?or(hs(e),-9007199254740991,u):0===e?e:0},Dn.toString=vs,Dn.toUpper=function(e){return vs(e).toUpperCase()},Dn.trim=function(e,t,n){if((e=vs(e))&&(n||t===r))return $t(e);if(!e||!(t=ai(t)))return e;var i=un(e),o=un(t);return gi(i,Jt(i,o),Qt(i,o)+1).join("")},Dn.trimEnd=function(e,t,n){if((e=vs(e))&&(n||t===r))return e.slice(0,dn(e)+1);if(!e||!(t=ai(t)))return e;var i=un(e);return gi(i,0,Qt(i,un(t))+1).join("")},Dn.trimStart=function(e,t,n){if((e=vs(e))&&(n||t===r))return e.replace(ne,"");if(!e||!(t=ai(t)))return e;var i=un(e);return gi(i,Jt(i,un(t))).join("")},Dn.truncate=function(e,t){var n=30,i="...";if(Xa(t)){var o="separator"in t?t.separator:o;n="length"in t?hs(t.length):n,i="omission"in t?ai(t.omission):i}var a=(e=vs(e)).length;if(nn(e)){var s=un(e);a=s.length}if(n>=a)return e;var c=n-ln(i);if(c<1)return i;var l=s?gi(s,0,c).join(""):e.slice(0,c);if(o===r)return l+i;if(s&&(c+=l.length-c),is(o)){if(e.slice(c).search(o)){var u,d=l;for(o.global||(o=Ce(o.source,vs(de.exec(o))+"g")),o.lastIndex=0;u=o.exec(d);)var p=u.index;l=l.slice(0,p===r?c:p)}}else if(e.indexOf(ai(o),c)!=c){var h=l.lastIndexOf(o);h>-1&&(l=l.slice(0,h))}return l+i},Dn.unescape=function(e){return(e=vs(e))&&H.test(e)?e.replace(q,pn):e},Dn.uniqueId=function(e){var t=++xe;return vs(e)+t},Dn.upperCase=Ks,Dn.upperFirst=Ys,Dn.each=va,Dn.eachRight=ga,Dn.first=Wo,ac(Dn,(mc={},gr(Dn,function(e,t){Be.call(Dn.prototype,t)||(mc[t]=e)}),mc),{chain:!1}),Dn.VERSION="4.18.1",Pt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Dn[e].placeholder=Dn}),Pt(["drop","take"],function(e,t){Vn.prototype[e]=function(n){n=n===r?1:mn(hs(n),0);var i=this.__filtered__&&!t?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=vn(n,i.__takeCount__):i.__views__.push({size:vn(n,p),type:e+(i.__dir__<0?"Right":"")}),i},Vn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),Pt(["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}}),Pt(["head","last"],function(e,t){var n="take"+(t?"Right":"");Vn.prototype[e]=function(){return this[n](1).value()[0]}}),Pt(["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=$r(function(e,t){return"function"==typeof e?new Vn(this):this.map(function(n){return Er(n,e,t)})}),Vn.prototype.reject=function(e){return this.filter(xa(oo(e)))},Vn.prototype.slice=function(e,t){e=hs(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=hs(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(p)},gr(Vn.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Dn[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Dn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof Vn,l=s[0],u=c||Ga(t),d=function(e){var t=o.apply(Dn,Tt([e],s));return i&&p?t[0]:t};u&&n&&"function"==typeof l&&1!=l.length&&(c=u=!1);var p=this.__chain__,h=!!this.__actions__.length,f=a&&!p,y=c&&!h;if(!a&&u){t=y?t:new Vn(this);var m=e.apply(t,s);return m.__actions__.push({func:pa,args:[d],thisArg:r}),new Ln(m,p)}return f&&y?e.apply(this,s):(m=this.thru(d),f?i?m.value()[0]:m.value():m)})}),Pt(["pop","push","shift","sort","splice","unshift"],function(e){var t=Ee[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Dn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ga(i)?i:[],e)}return this[n](function(n){return t.apply(Ga(n)?n:[],e)})}}),gr(Vn.prototype,function(e,t){var n=Dn[t];if(n){var r=n.name+"";Be.call(zn,r)||(zn[r]=[]),zn[r].push({name:t,func:n})}}),zn[Mi(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=Ga(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=vn(t,e+a);break;case"takeRight":e=mn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,c=s-a,l=r?s:a-1,u=this.__iteratees__,d=u.length,p=0,h=vn(c,this.__takeCount__);if(!n||!r&&i==c&&h==c)return di(e,this.__actions__);var f=[];e:for(;c--&&p<h;){for(var y=-1,m=e[l+=t];++y<d;){var v=u[y],g=v.iteratee,_=v.type,b=g(m);if(2==_)m=b;else if(!b){if(1==_)continue e;break e}}f[p++]=m}return f},Dn.prototype.at=ha,Dn.prototype.chain=function(){return da(this)},Dn.prototype.commit=function(){return new Ln(this.value(),this.__chain__)},Dn.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__++]}},Dn.prototype.plant=function(e){for(var t,n=this;n instanceof Rn;){var i=Do(n);i.__index__=0,i.__values__=r,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},Dn.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:pa,args:[Xo],thisArg:r}),new Ln(t,this.__chain__)}return this.thru(Xo)},Dn.prototype.toJSON=Dn.prototype.valueOf=Dn.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Dn.prototype.first=Dn.prototype.head,Je&&(Dn.prototype[Je]=function(){return this}),Dn}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(ut._=hn,define(function(){return hn})):pt?((pt.exports=hn)._=hn,dt._=hn):ut._=hn}.call(this)},1657(e){"use strict";e.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const n=e.indexOf(t);return-1===n?[e]:[e.slice(0,n),e.slice(n+t.length)]}},803(e){"use strict";e.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)},1635(e,t,n){"use strict";n.d(t,{__assign:()=>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)};Object.create,Object.create}},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,{createPayPalCommerceAlternativeMethodsPaymentStrategy:()=>ge,createPayPalCommerceButtonStrategy:()=>pt,createPayPalCommerceCreditButtonStrategy:()=>yt,createPayPalCommerceCreditCardsPaymentStrategy:()=>xe,createPayPalCommerceCreditCustomerStrategy:()=>it,createPayPalCommerceCreditPaymentStrategy:()=>re,createPayPalCommerceCreditWalletStrategy:()=>Ot,createPayPalCommerceCustomerStrategy:()=>Ze,createPayPalCommerceFastlaneCustomerStrategy:()=>ut,createPayPalCommerceFastlanePaymentStrategy:()=>We,createPayPalCommercePaymentStrategy:()=>X,createPayPalCommerceRatePayPaymentStrategy:()=>Me,createPayPalCommerceVenmoButtonStrategy:()=>gt,createPayPalCommerceVenmoCustomerStrategy:()=>st,createPayPalCommerceVenmoPaymentStrategy:()=>ae,createPayPalCommerceVenmoWalletStrategy:()=>zt,createPayPalCommerceWalletStrategy:()=>It});var e=n(315);function t(e,t){return Object.assign(e,{resolveIds:t})}var i,o=n(8686),a=n(4043);class s 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 c extends s{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"}(i||(i={}));class l extends s{constructor(e){super(function(e){switch(e){case i.MissingBillingAddress:return"Unable to proceed because billing address data is unavailable.";case i.MissingCart:return"Unable to proceed because cart data is unavailable.";case i.MissingConsignments:return"Unable to proceed because consignments data is unavailable.";case i.MissingCheckout:return"Unable to proceed because checkout data is unavailable.";case i.MissingCustomer:return"Unable to proceed because customer data is unavailable.";case i.MissingCheckoutConfig:case i.MissingOrderConfig:return"Unable to proceed because configuration data is unavailable.";case i.MissingOrder:return"Unable to proceed because order data is unavailable.";case i.MissingOrderId:return"Unable to proceed because order ID is unavailable or not generated yet.";case i.MissingPayment:return"Unable to proceed because payment data is unavailable.";case i.MissingPaymentToken:return"Unable to proceed because the token required to submit a payment is missing.";case i.MissingPaymentMethod:return"Unable to proceed because payment method data is unavailable or not properly configured.";case i.MissingShippingAddress:return"Unable to proceed because shipping address data is unavailable.";default:return"Unable to proceed because the required data is unavailable."}}(e)),this.subtype=e,this.name="MissingDataError",this.type="missing_data"}}const u={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"},d=["ar_BH","ar_DZ","ar_EG","ar_JO","ar_KW","ar_MA","ar_OM","ar_QA","ar_SA","ar_TN","ar_YE","ar_AE","bg_BG","cs_CZ","da_DK","da_FO","da_GL","de_AT","de_CH","de_DE","de_LU","el_GR","en_AD","en_AE","en_AG","en_AI","en_AL","en_AM","en_AN","en_AO","en_AT","en_AU","en_AW","en_AZ","en_BB","en_BE","en_BH","en_BJ","en_BM","en_BN","en_BS","en_BT","en_BW","en_BY","en_BZ","en_C2","en_CA","en_CD","en_CG","en_CH","en_CI","en_CK","en_CL","en_CM","en_CN","en_CO","en_CR","en_CV","en_CY","en_CZ","en_DE","en_DJ","en_DK","en_DM","en_DO","en_DZ","en_EC","en_EE","en_EG","en_ER","en_ES","en_ET","en_FI","en_FJ","en_FK","en_FM","en_FO","en_FR","en_GA","en_GB","en_GD","en_GE","en_GF","en_GI","en_GL","en_GM","en_GN","en_GP","en_GR","en_GT","en_GW","en_GY","en_HK","en_HN","en_HR","en_HU","en_ID","en_IE","en_IL","en_IN","en_IS","en_IT","en_JM","en_JO","en_JP","en_KE","en_KG","en_KH","en_KI","en_KM","en_KN","en_KR","en_KW","en_KY","en_KZ","en_LA","en_LC","en_LI","en_LK","en_LS","en_LT","en_LU","en_LV","en_MA","en_MC","en_MD","en_ME","en_MG","en_MH","en_MK","en_ML","en_MN","en_MQ","en_MR","en_MS","en_MT","en_MU","en_MV","en_MW","en_MY","en_MZ","en_NA","en_NC","en_NE","en_NF","en_NG","en_NI","en_NL","en_NO","en_NP","en_NR","en_NU","en_NZ","en_OM","en_PA","en_PE","en_PF","en_PG","en_PH","en_PL","en_PM","en_PN","en_PT","en_PW","en_PY","en_QA","en_RE","en_RO","en_RS","en_RU","en_RW","en_SA","en_SB","en_SC","en_SE","en_SG","en_SH","en_SI","en_SJ","en_SK","en_SL","en_SM","en_SN","en_SO","en_SR","en_ST","en_SV","en_SZ","en_TC","en_TD","en_TG","en_TH","en_TJ","en_TM","en_TN","en_TO","en_TR","en_TT","en_TV","en_TW","en_TZ","en_UA","en_UG","en_US","en_UY","en_VA","en_VC","en_VE","en_VG","en_VN","en_VU","en_WF","en_WS","en_YE","en_YT","en_ZA","en_ZM","en_ZW","es_AD","es_AI","es_AO","es_AR","es_AW","es_BB","es_BJ","es_BM","es_BO","es_BS","es_BZ","es_CD","es_CG","es_CK","es_CL","es_CO","es_CR","es_CV","es_DJ","es_DM","es_DO","es_DZ","es_EC","es_EG","es_ER","es_ES","es_ET","es_FJ","es_FK","es_FO","es_GA","es_GD","es_GE","es_GI","es_GL","es_GM","es_GN","es_GT","es_GW","es_GY","es_HN","es_IE","es_JM","es_JO","es_KE","es_KG","es_KI","es_KM","es_KN","es_KW","es_KY","es_KZ","es_LC","es_LI","es_LS","es_LU","es_MA","es_MG","es_MH","es_ML","es_MR","es_MS","es_MU","es_MW","es_MX","es_MZ","es_NA","es_NC","es_NE","es_NF","es_NI","es_NR","es_NU","es_NZ","es_OM","es_PA","es_PE","es_PF","es_PG","es_PM","es_PN","es_PW","es_PY","es_QA","es_RS","es_RW","es_SA","es_SB","es_SC","es_SH","es_SJ","es_SL","es_SM","es_SN","es_SO","es_SR","es_ST","es_SV","es_SZ","es_TC","es_TD","es_TG","es_TJ","es_TM","es_TN","es_TT","es_TV","es_UA","es_UG","es_US","es_UY","es_VA","es_VC","es_VE","es_VG","es_VU","es_WF","es_YE","es_ZM","et_EE","fi_FI","fr_AD","fr_AE","fr_AI","fr_AM","fr_AO","fr_AW","fr_AZ","fr_BB","fr_BE","fr_BF","fr_BI","fr_BJ","fr_BM","fr_BS","fr_BZ","fr_CA","fr_CD","fr_CG","fr_CH","fr_CI","fr_CK","fr_CM","fr_CV","fr_DJ","fr_DM","fr_DO","fr_DZ","fr_EC","fr_ER","fr_ET","fr_FJ","fr_FK","fr_FO","fr_FR","fr_GA","fr_GD","fr_GE","fr_GF","fr_GI","fr_GL","fr_GM","fr_GN","fr_GP","fr_GT","fr_GW","fr_GY","fr_HN","fr_IE","fr_JM","fr_JO","fr_KE","fr_KG","fr_KI","fr_KM","fr_KN","fr_KW","fr_KY","fr_KZ","fr_LC","fr_LI","fr_LS","fr_LU","fr_MA","fr_MC","fr_MG","fr_MH","fr_ML","fr_MQ","fr_MR","fr_MS","fr_MU","fr_MW","fr_MZ","fr_NA","fr_NC","fr_NE","fr_NF","fr_NI","fr_NR","fr_NU","fr_NZ","fr_OM","fr_PA","fr_PE","fr_PF","fr_PG","fr_PM","fr_PN","fr_PW","fr_QA","fr_RE","fr_RS","fr_RW","fr_SA","fr_SB","fr_SC","fr_SH","fr_SJ","fr_SL","fr_SM","fr_SN","fr_SO","fr_SR","fr_ST","fr_SV","fr_SZ","fr_TC","fr_TD","fr_TG","fr_TJ","fr_TM","fr_TN","fr_TT","fr_TV","fr_UA","fr_UG","fr_US","fr_UY","fr_VA","fr_VC","fr_VE","fr_VG","fr_VU","fr_WF","fr_YE","fr_YT","fr_ZA","fr_ZM","he_IL","hu_HU","id_ID","it_IT","ja_JP","ko_KR","lv_LV","lt_LT","ms_BN","ms_MY","nl_BE","nl_NL","pl_PL","pt_BR","pt_PT","ro_RO","ru_EE","ru_LT","ru_LV","ru_RU","ru_UA","si_LK","sk_SK","sl_SI","sq_AL","sv_SE","tl_PH","th_TH","tr_TR","vi_VN","zh_C2","zh_CN","zh_HK","zh_TW","zh_AD","zh_AE","zh_AI","zh_AO","zh_AW","zh_BB","zh_BH","zh_BJ","zh_BM","zh_BS","zh_BZ","zh_CD","zh_CG","zh_CK","zh_CL","zh_CO","zh_CV","zh_DJ","zh_DM","zh_DO","zh_DZ","zh_EC","zh_EG","zh_ER","zh_ET","zh_FJ","zh_FK","zh_FO","zh_GA","zh_GD","zh_GE","zh_GI","zh_GL","zh_GM","zh_GN","zh_GT","zh_GW","zh_GY","zh_HN","zh_IE","zh_JM","zh_JO","zh_KE","zh_KG","zh_KI","zh_KM","zh_KN","zh_KW","zh_KY","zh_KZ","zh_LC","zh_LI","zh_LS","zh_LT","zh_LU","zh_MA","zh_MG","zh_MH","zh_ML","zh_MR","zh_MS","zh_MU","zh_MW","zh_MZ","zh_NA","zh_NC","zh_NE","zh_NF","zh_NI","zh_NR","zh_NU","zh_NZ","zh_OM","zh_PA","zh_PE","zh_PF","zh_PG","zh_PM","zh_PN","zh_PW","zh_QA","zh_RS","zh_RW","zh_SA","zh_SB","zh_SC","zh_SH","zh_SJ","zh_SL","zh_SM","zh_SN","zh_SO","zh_SR","zh_ST","zh_SV","zh_SZ","zh_TC","zh_TD","zh_TG","zh_TJ","zh_TM","zh_TN","zh_TT","zh_TV","zh_UA","zh_UG","zh_US","zh_UY","zh_VA","zh_VC","zh_VE","zh_VG","zh_VU","zh_WF","zh_YE","zh_ZA","zh_ZM"];function p(e){if(!e)return;let t;if(e.includes("-")){const[n,r]=e.split("-");t=`${n}_${r.toUpperCase()}`}else t=`${e}_${e.toUpperCase()}`;return d.includes(t)?t:void 0}var h=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 f{constructor(e){this.scriptLoader=e,this.window=window}getPayPalSDK(e,t,n,r,i){return h(this,void 0,void 0,function*(){if(!this.window.paypal||i){const i=this.getPayPalSdkScriptConfigOrThrow(e,t,n,r);if(yield this.loadPayPalSdk(i),!this.window.paypal)throw new c}return this.window.paypal})}getPayPalFastlaneSdk(e,t,n,r){return h(this,void 0,void 0,function*(){if(!this.window.paypalFastlaneSdk){const i=this.getPayPalFastlaneSdkConfiguration(e,t,n,r);if(yield this.loadPayPalSdk(i),!this.window.paypalFastlaneSdk)throw new c}return this.window.paypalFastlaneSdk})}getPayPalGooglePaySdk(e,t,n,r,i){return h(this,void 0,void 0,function*(){if(!this.window.paypalGooglePay||i){const i=this.getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n,r);yield this.loadPayPalSdk(i)}if(!this.window.paypalGooglePay)throw new c;return this.window.paypalGooglePay})}getPayPalApmsSdk(e,t,n){return h(this,void 0,void 0,function*(){if(!this.window.paypalApms){const r=this.getPayPalApmSdkConfiguration(e,t,n);if(yield this.loadPayPalSdk(r),!this.window.paypalApms)throw new c}return this.window.paypalApms})}getPayPalMessages(e,t,n){return h(this,void 0,void 0,function*(){if(!this.window.paypalMessages){const r=this.getPayPalSdkMessagesConfiguration(e,t,n);yield this.loadPayPalSdk(r)}if(!this.window.paypalMessages)throw new c;return this.window.paypalMessages})}loadPayPalSdk(e){return h(this,arguments,void 0,function*({options:e,attributes:t}){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})})}getPayPalSdkScriptConfigOrThrow(e,t,n,r=!0){const{id:o,clientToken:a,initializationData:s}=e;if(!s||!s.clientId)throw new l(i.MissingPaymentMethod);const{intent:c,clientId:u,merchantId:d,buyerCountry:h,attributionId:f,isVenmoEnabled:y,isHostedCheckoutEnabled:m,isPayPalCreditAvailable:v,isDeveloperModeApplicable:g,availableAlternativePaymentMethods:_=[],enabledAlternativePaymentMethods:b=[],isGooglePayEnabled:S}=s,w=m||r,I="paypalcommercecreditcards"===o||"bigcommerce_payments_creditcards"===o,P=I?["card"]:[],C=v?["credit","paylater"]:[],O=y?["venmo"]:[],A=S?["googlepay"]:[],E=r?["card-fields"]:[],z=[...I?[]:["card"],...v?[]:["credit","paylater"],...y?[]:["venmo"],..._.filter(e=>!b.includes(e))],k=[...P,...C,...O,...b],T=p(n);return{options:Object.assign(Object.assign({"client-id":u,"merchant-id":d,"enable-funding":k.length>0?k:void 0,"disable-funding":z.length>0?z:void 0,commit:w,components:["buttons","hosted-fields","payment-fields","legal",...A,...E],currency:t,intent:c},g&&{"buyer-country":h}),T&&{locale:T}),attributes:{"data-partner-attribution-id":f,"data-client-token":a}}}getPayPalFastlaneSdkConfiguration(e,t,n,r){const{clientToken:o,initializationData:a}=e;if(!a||!a.clientId)throw new l(i.MissingPaymentMethod);const{intent:s,clientId:c,merchantId:u,attributionId:d}=a,h=p(r);return{options:Object.assign(Object.assign({"client-id":c,"merchant-id":u,commit:!0,components:["fastlane","buttons","payment-fields","hosted-fields","three-domain-secure"],currency:t},h&&{locale:h}),{intent:s}),attributes:{"data-client-metadata-id":n.replace(/-/g,""),"data-namespace":"paypalFastlaneSdk","data-partner-attribution-id":d,"data-sdk-client-token":o}}}getPayPalGooglePaySdkScriptConfigOrThrow(e,t,n,r=!0){const{clientToken:o,initializationData:a}=e;if(!a||!a.clientId)throw new l(i.MissingPaymentMethod);const{intent:s,clientId:c,merchantId:u,buyerCountry:d,attributionId:h,isHostedCheckoutEnabled:f,isDeveloperModeApplicable:y}=a,m=f||r,v=p(n);return{options:Object.assign(Object.assign({"client-id":c,"merchant-id":u,commit:m,components:["googlepay"],currency:t,intent:s},y&&{"buyer-country":d}),v&&{locale:v}),attributes:{"data-partner-attribution-id":h,"data-client-token":o,"data-namespace":"paypalGooglePay"}}}getPayPalApmSdkConfiguration(e,t,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new l(i.MissingPaymentMethod);const{intent:o,clientId:a,merchantId:s,buyerCountry:c,attributionId:u,isDeveloperModeApplicable:d,availableAlternativePaymentMethods:h=[],enabledAlternativePaymentMethods:f=[]}=r,y=f,m=h.filter(e=>!f.includes(e)),v=p(n);return{options:Object.assign(Object.assign({"client-id":a,"merchant-id":s,"enable-funding":y.length>0?y:void 0,"disable-funding":m.length>0?m:void 0,commit:!0,components:["buttons","payment-fields"],currency:t,intent:o},d&&{"buyer-country":c}),v&&{locale:v}),attributes:{"data-partner-attribution-id":u,"data-namespace":"paypalApms"}}}getPayPalSdkMessagesConfiguration(e,t,n){const{initializationData:r}=e;if(!r||!r.clientId)throw new l(i.MissingPaymentMethod);const{clientId:o,merchantId:a,attributionId:s,isDeveloperModeApplicable:c,buyerCountry:u}=r,d=p(n);return{options:Object.assign(Object.assign({"client-id":o,"merchant-id":a,components:["messages"],currency:t},c&&{"buyer-country":u}),d&&{locale:d}),attributes:{"data-namespace":"paypalMessages","data-partner-attribution-id":s}}}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 y(){return new f((0,e.vQ)())}var m=n(9440);class v extends s{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 g={body:{},headers:{},status:0};class _ extends s{constructor(e,{message:t,errors:n}={}){const{body:r,headers:i,status:o}=e||g;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 b,S,w,I,P,C,O,A,E,z,k;!function(e){e.BuyNow="BUY_NOW",e.INVOICE="B2B_INVOICE"}(b||(b={})),function(e){e.AUTHORIZE="authorize",e.CAPTURE="capture"}(S||(S={})),function(e){e.Always="SCA_ALWAYS"}(w||(w={})),function(e){e.Succeeded="succeeded",e.Cancelled="cancelled",e.Errored="errored"}(I||(I={})),function(e){e.Possible="POSSIBLE",e.No="NO",e.Unknown="UNKNOWN",e.Yes="YES"}(P||(P={})),function(e){e.paypal="paypal",e.checkout="checkout",e.buynow="buynow",e.pay="pay",e.installment="installment"}(C||(C={})),function(e){e.gold="gold",e.blue="blue",e.silver="silver",e.black="black",e.white="white"}(O||(O={})),function(e){e.pill="pill",e.rect="rect"}(A||(A={})),function(e){e.SUCCEEDED="succeeded",e.FAILED="failed",e.CANCELED="canceled",e.UNRECOGNIZED="unrecognized"}(E||(E={})),function(e){e.OXXO="oxxo"}(z||(z={})),function(e){e.Approved="APPROVED",e.Created="CREATED",e.PayerActionRequired="PAYER_ACTION_REQUIRED",e.PollingStop="POLLING_STOP",e.PollingError="POLLING_ERROR"}(k||(k={}));var T=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.paypalRequestSender=n,this.paypalSdkLoader=r}loadPayPalSdk(e,t,n,r){return T(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=t||i.getCartOrThrow().currency.code,a=i.getPaymentMethodOrThrow(e),s=i.getLocale();return this.paypalSdk=yield this.paypalSdkLoader.getPayPalSDK(a,o,s,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new c;return this.paypalSdk}createBuyNowCartOrThrow(e){return T(this,void 0,void 0,function*(){const t=e.getBuyNowCartRequestBody();if(!t)throw new l(i.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(t)}catch(e){throw new v}})}createOrder(e,t){return T(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.paypalRequestSender.createOrder(e,Object.assign({cartId:n},t));return r})}createOrderCardFields(e,t){return T(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.paypalRequestSender.createOrder(e,Object.assign({cartId:n},t));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(e,t,n,r){return T(this,void 0,void 0,function*(){const i=this.paymentIntegrationService.getState(),o=i.getCartOrThrow();let a;r||(a=i.getConsignmentsOrThrow()[0]);try{yield this.paypalRequestSender.updateOrder(e,Object.assign(Object.assign({availableShippingOptions:r?[]:null==a?void 0:a.availableShippingOptions,cartId:o.id,selectedShippingOption:r?null:null==a?void 0:a.selectedShippingOption},t?{methodId:t}:{}),n?{orderId:n}:{}))}catch(e){throw new _}})}getOrderStatus(e,t){return T(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalRequestSender.getOrderStatus(e,t);return n}catch(e){throw new _}})}tokenizePayment(e,t){const n=this.paymentIntegrationService.getState().getCartOrThrow();if(!t)throw new l(i.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:e,order_id:t},n.source===b.BuyNow&&{cart_id:n.id}))}submitPayment(e,t,n){return T(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=>{if(t.selectedShippingOption){const n=t.selectedShippingOption.id;return e.id===n}return!1}))||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&&O[t]?t:void 0,height:this.getValidHeight(n),label:r&&C[r]?r:void 0,shape:i&&A[i]?i:void 0};return(0,m.omitBy)(o,m.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 B="This API endpoint is for internal use only and may change in the future";var x;!function(e){e.Json="application/json",e.JsonV1="application/vnd.bc.v1+json"}(x||(x={}));const N=x,F={"X-Checkout-SDK-Version":"1.946.0"};var M=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 D{constructor(e){this.requestSender=e}createOrder(e,t){return M(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${e}`,r=t,i=Object.assign({"X-API-INTERNAL":B,"Content-Type":N.Json},F);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(e,t){return M(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${e}`,r=t,i=Object.assign({"X-API-INTERNAL":B,"Content-Type":N.Json},F);return(yield this.requestSender.put(n,{headers:i,body:r})).body})}getOrderStatus(e,t){return M(this,void 0,void 0,function*(){const n=`/api/storefront/initialization/${e}`,r=Object.assign({"X-API-INTERNAL":B,"Content-Type":N.Json},F);return(yield this.requestSender.get(n,Object.assign({headers:r},t))).body})}}const U=e=>{const{getHost:t}=e.getState();return new j((0,o.createFormPoster)(),e,new D((0,a.createRequestSender)({host:t()})),y())},R={size:70,color:"#d9d9d9",backgroundColor:"#ffffff"},L="embedded-checkout-loading-indicator-rotation";class V{constructor(e){this.styles=Object.assign(Object.assign({},R),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=`${L} 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(L))return;const t=document.createElement("style");t.id=L,null===(e=document.head)||void 0===e||e.appendChild(t),t.sheet instanceof CSSStyleSheet&&t.sheet.insertRule(`\n @keyframes ${L} {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n `,0)}}class G extends s{constructor(e){super(e||"Invalid arguments have been provided."),this.name="InvalidArgumentError",this.type="invalid_argument"}}class q extends G{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 W 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 H extends s{constructor(){super("The current order does not need to be finalized at this stage."),this.name="OrderFinalizationNotRequiredError",this.type="order_finalization_not_required"}}function $(e){return!("object"!=typeof e||null===e||void 0!==e.shouldSaveInstrument&&"boolean"!=typeof e.shouldSaveInstrument||void 0!==e.shouldSetAsDefaultInstrument&&"boolean"!=typeof e.shouldSetAsDefaultInstrument)}function K(e){return Boolean(e.instrumentId)}const Y=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};function Z(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 J=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 Q{constructor(e,t,n,r){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.payPalSdkScriptLoader=n,this.loadingIndicator=r}initialize(e){return J(this,void 0,void 0,function*(){var t;const{methodId:n,paypalcommerce:r}=e||{};if(this.paypalcommerce=r,!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new G('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(n);const i=this.paymentIntegrationService.getState(),o=i.getPaymentMethodOrThrow(n),{container:a,bannerContainerId:s}=r,{orderId:c,paypalBNPLConfiguration:l=[],isPayPalCreditAvailable:u}=o.initializationData||{};if(void 0!==s){if(!document.getElementById(s))return void console.error("Unable to create banner without valid banner container ID.");const e=null==l?void 0:l.find(({id:e})=>"checkout"===e);if(u||!(null==e?void 0:e.status))return;const t=yield this.payPalSdkScriptLoader.getPayPalMessages(o,i.getCartOrThrow().currency.code,i.getLocale());return t&&"function"==typeof(null==t?void 0:t.Messages)?this.renderMessages(t,s,e):void console.error("[BC PayPalCommerce PayLater]: banner could not be rendered, due to issues with loading PayPal SDK")}c?this.orderId=null===(t=o.initializationData)||void 0===t?void 0:t.orderId:(this.loadingIndicatorContainer=null==a?void 0:a.split("#")[1],yield this.paypalIntegrationService.loadPayPalSdk(n),r.onInit&&"function"==typeof r.onInit&&r.onInit(()=>this.renderButton(n,r)),(void 0===r.shouldRenderPayPalButtonOnInitialization||r.shouldRenderPayPalButtonOnInitialization)&&this.renderButton(n,r))})}execute(e,t){return J(this,void 0,void 0,function*(){var n,r;const{payment:i}=e,o=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:a}=this.paypalcommerce||{};if(!i)throw new q(["payment"]);const{methodId:s,paymentData:c}=i;if(this.isPayPalVaultedInstrumentPaymentData(c)&&!this.orderId&&(this.orderId=yield this.createOrder()),!this.orderId)throw new W;const l=this.isPayPalVaultedInstrumentPaymentData(c)?this.prepareVaultedInstrumentPaymentPayload(s,this.orderId,c):this.preparePaymentPayload(s,this.orderId,c);try{yield this.paymentIntegrationService.submitOrder(o,t),yield this.paymentIntegrationService.submitPayment(l)}catch(e){if(function(e){var t;return(e=>"object"==typeof e&&null!==e&&"body"in e)(e)&&"offsite_redirect"===(null===(t=e.body.additional_action_required)||void 0===t?void 0:t.type)}(e)){const t=null===(r=null===(n=e.body.additional_action_required)||void 0===n?void 0:n.data)||void 0===r?void 0:r.redirect_url;return new Promise(()=>window.location.replace(t))}return this.isProviderError(e)&&(yield this.paypalIntegrationService.loadPayPalSdk(i.methodId),yield new Promise((e,t)=>{var n;this.paypalcommerce&&(null===(n=this.paypalButton)||void 0===n||n.close(),this.renderButton(i.methodId,this.paypalcommerce),this.handleError(new Error("INSTRUMENT_DECLINED"),a)),t()})),this.handleError(e,a),Promise.reject()}})}finalize(){return Promise.reject(new H)}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}=$(n)?n:{};return{methodId:e,paymentData:{shouldSaveInstrument:r,shouldSetAsDefaultInstrument:i,formattedPayload:{paypal_account:{order_id:t}}}}}renderButton(e,t){const n=this.paypalIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:c,onValidate:l,submitForm:u}=t;if(!a)throw new G('Unable to initialize payment because "container" argument is not provided.');const d=this.getSmartButtonContainerId(a);if(!document.getElementById(d))throw new G(`Unable to initialize payment because element with id ${d} does not exist.`);const p={fundingSource:n.FUNDING.PAYPAL,style:this.paypalIntegrationService.getValidButtonStyle(o),createOrder:()=>this.createOrder(),onClick:(e,t)=>this.handleClick(t,l),onApprove:e=>this.handleApprove(e,u),onError:e=>this.handleError(e,s),onCancel:()=>this.toggleLoadingIndicator(!1)};this.paypalButton=n.Buttons(p),this.paypalButton.isEligible()&&(c&&"function"==typeof c&&c(),this.paypalButton.render(a))}handleClick(e,t){return J(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;return 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 J(this,void 0,void 0,function*(){const e=this.getFieldsValues();return this.paypalIntegrationService.createOrder("paypalcommercecheckout",{shouldSaveInstrument:(null==e?void 0:e.shouldSaveInstrument)||!1})})}getFieldsValues(){const{getFieldsValues:e}=this.paypalcommerce||{};return"function"==typeof e?e():void 0}isTrustedVaultingFlow(e){if(e&&K(e)){const t=this.paymentIntegrationService.getState().getInstruments(),n=null==t?void 0:t.find(t=>Z(t)&&t.bigpayToken===e.instrumentId);return!(Z(n)&&!n.trustedShippingAddress)}return!1}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isPayPalVaultedInstrumentPaymentData(e){return!!e&&K(e)&&$(e)}renderMessages(e,t,n){const r={amount:this.paymentIntegrationService.getState().getCheckoutOrThrow().outstandingBalance,placement:"payment",style:Y(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)}getSmartButtonContainerId(e){var t;return null!==(t=e.split("#")[1])&&void 0!==t?t:e}}const X=t(t=>new Q(t,U(t),new f((0,e.vQ)()),new V({containerStyles:u})),[{id:"paypalcommerce"}]);class ee extends s{constructor(e){super(e||"Not implemented."),this.name="NotImplementedError",this.type="not_implemented"}}var te=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 ne{constructor(e,t,n,r){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.loadingIndicator=n,this.payPalSdkScriptLoader=r}initialize(e){return te(this,void 0,void 0,function*(){const{methodId:t,paypalcommerce:n,paypalcommercecredit:r}=e||{},i=r||n;if(!t)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new G('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(t);const o=this.paymentIntegrationService.getState(),a=o.getPaymentMethodOrThrow(t),{paypalBNPLConfiguration:s=[],orderId:c}=a.initializationData||{},{bannerContainerId:l,container:u}=i;if(void 0!==l){if(!document.getElementById(l))return void console.error("Unable to create banner without valid banner container ID.");const e=s&&s.find(({id:e})=>"checkout"===e);if(!(null==e?void 0:e.status))return;const t=yield this.payPalSdkScriptLoader.getPayPalMessages(a,o.getCartOrThrow().currency.code,o.getLocale());return this.renderMessages(t,l,e)}c?this.orderId=c:(yield this.paypalIntegrationService.loadPayPalSdk(t),this.loadingIndicatorContainer=null==u?void 0:u.split("#")[1],this.renderButton(t,i))})}execute(e,t){return te(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 q(["payment"]);if(!this.orderId)throw new W;yield this.paymentIntegrationService.submitOrder(r,t),yield this.paypalIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new H)}deinitialize(){var e;return this.orderId=void 0,null===(e=this.paypalButton)||void 0===e||e.close(),Promise.resolve()}renderButton(e,t){if(!(null==t?void 0:t.container))throw new G('Unable to initialize payment because "container" argument is not provided.');const n=this.paypalIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:c,onValidate:l,submitForm:u}=t,d=[n.FUNDING.PAYLATER,n.FUNDING.CREDIT];let p=!1;d.forEach(e=>{if(p)return;const t={fundingSource:e,style:this.paypalIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalIntegrationService.createOrder("paypalcommercecreditcheckout"),onClick:(e,t)=>this.handleClick(t,l),onApprove:e=>this.handleApprove(e,u),onCancel:()=>this.toggleLoadingIndicator(!1),onError:e=>this.handleError(e,s)};if(this.paypalButton=n.Buttons(t),this.paypalButton.isEligible()||e!==n.FUNDING.PAYLATER){if(!this.paypalButton.isEligible()&&e===n.FUNDING.CREDIT)throw new ee(`PayPal ${e} is not available for your region. Please use PayPal Checkout instead.`);c&&"function"==typeof c&&c(),this.paypalButton.render(a),p=!0}})}handleClick(e,t){return te(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;if(t&&"function"==typeof t)return 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:Y(n)};e.Messages(r).render(`#${t}`)}}const re=t(e=>new ne(e,U(e),new V({containerStyles:u}),y()),[{id:"paypalcommercecredit"}]);var ie=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 oe{constructor(e,t,n){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.loadingIndicator=n}initialize(e){return ie(this,void 0,void 0,function*(){var t,n;const{methodId:r,paypalcommerce:i,paypalcommercevenmo:o}=e||{},a=o||i;if(!r)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!a)throw new G('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');yield this.paymentIntegrationService.loadPaymentMethod(r);const s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(r);(null===(t=s.initializationData)||void 0===t?void 0:t.orderId)?this.orderId=null===(n=s.initializationData)||void 0===n?void 0:n.orderId:(yield this.paypalIntegrationService.loadPayPalSdk(r),this.loadingIndicatorContainer=a.container.split("#")[1],this.renderButton(r,a))})}execute(e,t){return ie(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 q(["payment"]);if(!this.orderId)throw new W;yield this.paymentIntegrationService.submitOrder(r,t),yield this.paypalIntegrationService.submitPayment(n.methodId,this.orderId)})}finalize(){return Promise.reject(new H)}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.paypalIntegrationService.getPayPalSdkOrThrow(),r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:i}=r.initializationData||{},{checkoutPaymentButtonStyles:o}=i||{},{container:a,onError:s,onRenderButton:c,onValidate:l,submitForm:u}=t,d={fundingSource:n.FUNDING.VENMO,style:this.paypalIntegrationService.getValidButtonStyle(o),createOrder:()=>this.paypalIntegrationService.createOrder("paypalcommercevenmocheckout"),onClick:(e,t)=>this.handleClick(t,l),onApprove:e=>this.handleApprove(e,u),onCancel:()=>this.toggleLoadingIndicator(!1),onError:e=>this.handleError(e,s)};if(this.paypalButton=n.Buttons(d),!this.paypalButton.isEligible())throw new ee("PayPal Venmo is not available for your region. Please use PayPal Checkout instead.");c&&"function"==typeof c&&c(),this.paypalButton.render(a)}handleClick(e,t){return ie(this,void 0,void 0,function*(){const{resolve:n,reject:r}=e;return 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 ae=t(e=>new oe(e,U(e),new V({containerStyles:u,styles:{backgroundColor:"black"}})),[{id:"paypalcommercevenmo"}]),se={"background-color":"rgba(0, 0, 0, 0.4)","z-index":"1000"};class ce extends _{constructor(e){super(e,{message:"The request has timed out or aborted."}),this.name="TimeoutError",this.type="timeout"}}var le,ue,de,pe,he,fe,ye;!function(e){e.Possible="POSSIBLE",e.No="NO",e.Unknown="UNKNOWN",e.Yes="YES"}(le||(le={})),function(e){e.AUTHORIZE="authorize",e.CAPTURE="capture"}(ue||(ue={})),function(e){e.paypal="paypal",e.checkout="checkout",e.buynow="buynow",e.pay="pay",e.installment="installment"}(de||(de={})),function(e){e.gold="gold",e.blue="blue",e.silver="silver",e.black="black",e.white="white"}(pe||(pe={})),function(e){e.pill="pill",e.rect="rect"}(he||(he={})),function(e){e.OXXO="oxxo",e.IDEAL="ideal"}(fe||(fe={})),function(e){e.Approved="APPROVED",e.Created="CREATED",e.PayerActionRequired="PAYER_ACTION_REQUIRED",e.PollingStop="POLLING_STOP",e.PollingError="POLLING_ERROR"}(ye||(ye={}));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 ve{constructor(e,t,n,r,i=3e3,o=3e5){this.paymentIntegrationService=e,this.paypalCommerceIntegrationService=t,this.paypalSdkScriptLoader=n,this.loadingIndicator=r,this.pollingInterval=i,this.maxPollingIntervalTime=o,this.pollingTimer=0,this.stopPolling=m.noop,this.isOrderApprovedProcessing=!1}initialize(e){return me(this,void 0,void 0,function*(){const{gatewayId:t,methodId:n,paypalcommerce:r,paypalcommercealternativemethods:i}=e,o=i||r;if(this.paypalcommercealternativemethods=i,!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!o)throw new G('Unable to initialize payment because "options.paypalcommercealternativemethods" argument is not provided.');const a=this.paymentIntegrationService.getState(),s=a.getPaymentMethodOrThrow(n,t),{orderId:c,shouldRenderFields:l}=s.initializationData||{},u=a.getStoreConfigOrThrow().checkoutSettings.features;this.isOrderApprovedProcessing=function(e,t,n=!0){var r;return null!==(r=e["PAYPAL-5431.order_approved_processing"])&&void 0!==r?r:n}(u,0,!1),c?this.orderId=c:(this.paypalApms=yield this.paypalSdkScriptLoader.getPayPalApmsSdk(s,a.getCartOrThrow().currency.code,a.getLocale()),this.loadingIndicatorContainer=o.container.split("#")[1],this.renderButton(n,t,o),l&&this.renderFields(n,o))})}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 q(["payment"]);const{methodId:i,gatewayId:o}=n;if(!this.orderId)throw new W;this.isOrderApprovedProcessing||"ideal"!==i||(yield new Promise((e,t)=>{this.initializePollingMechanism(i,e,t,o)})),this.isNonInstantPaymentMethod(i)&&(i!==fe.IDEAL||this.isOrderApprovedProcessing)||(yield this.paymentIntegrationService.submitOrder(r,t)),yield this.paypalCommerceIntegrationService.submitPayment(i,this.orderId,o)})}finalize(){return Promise.reject(new H)}deinitialize(){var e;return this.orderId=void 0,this.isOrderApprovedProcessing||this.resetPollingMechanism(),null===(e=this.paypalButton)||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.paypalCommerceIntegrationService.getOrderStatus(null!=r?r:"paypalcommerce"),o=i===ye.Approved,a=i===ye.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,paypalcommercealternativemethods:this.paypalcommercealternativemethods}),this.handleError(new ce)}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.paypalcommercealternativemethods||{};this.isOrderApprovedProcessing||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:l}=n,u={fundingSource:e,style:this.paypalCommerceIntegrationService.getValidButtonStyle(o),onInit:(e,t)=>n.onInitButton(t),createOrder:()=>this.onCreateOrder(e,t,n),onApprove:e=>this.handleApprove(e,l),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.paypalButton=r.Buttons(u),this.paypalButton.isEligible()&&(c&&"function"==typeof c&&c(),this.paypalButton.render(a))}onCreateOrder(e,t,n){return me(this,void 0,void 0,function*(){var r;const{onValidate:i}=n;yield i(()=>(this.toggleLoadingIndicator(!0),()=>Promise.resolve()),m.noop);const o=yield this.paypalCommerceIntegrationService.createOrder("paypalcommercealternativemethodscheckout");if(this.isNonInstantPaymentMethod(e)&&(e===fe.IDEAL&&this.isOrderApprovedProcessing||e===fe.OXXO)){const n={useStoreCredit:!1},i={params:{methodId:e,gatewayId:t}};if(yield this.paymentIntegrationService.submitOrder(n,i),e===fe.IDEAL){const t=null===(r=this.paymentIntegrationService.getState().getOrder())||void 0===r?void 0:r.orderId;yield this.paypalCommerceIntegrationService.updateOrder("paypalcommercealternativemethods",e,t)}yield this.paypalCommerceIntegrationService.submitPayment(e,o,t)}return o})}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 G('Unable to initialize payment because "options.paypalcommercealternativemethods" argument should contain "apmFieldsContainer".');const l=document.querySelector(s);l&&(l.innerHTML="");const u={fundingSource:e,style:c||{},fields:{name:{value:`${i} ${o}`},email:{value:a}}};n.PaymentFields(u).render(s)}toggleLoadingIndicator(e){e&&this.loadingIndicatorContainer?this.loadingIndicator.show(this.loadingIndicatorContainer):this.loadingIndicator.hide()}isNonInstantPaymentMethod(e){return e.toUpperCase()in fe}getPaypalAmpsSdkOrThrow(){if(!this.paypalApms)throw new c;return this.paypalApms}}const ge=t(e=>new ve(e,U(e),y(),new V({containerStyles:se})),[{gateway:"paypalcommercealternativemethods"}]);var _e;!function(e){e.CVV="cvv",e.PAN="pan"}(_e||(_e={}));class be{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){be.set(e,"",Object.assign({expires:new Date(0)},t))}}var Se,we=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 Ie{constructor(){this.window=window}initializePayPalFastlane(e,t,n){return we(this,void 0,void 0,function*(){if(t&&(window.localStorage.setItem("fastlaneEnv","sandbox"),window.localStorage.setItem("axoEnv","sandbox")),!this.window.paypalFastlane){const t={root:{backgroundColorPrimary:"transparent"}};this.window.paypalFastlane=yield e.Fastlane({styles:n||t})}return this.window.paypalFastlane})}getPayPalFastlaneOrThrow(){if(!this.window.paypalFastlane)throw new c;return this.window.paypalFastlane}lookupCustomerOrThrow(e){return we(this,void 0,void 0,function*(){return this.getPayPalFastlaneOrThrow().identity.lookupCustomerByEmail(e)})}triggerAuthenticationFlowOrThrow(e){return we(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};be.set("bc-fastlane-sessionId",e,n)}removeStorageSessionId(){be.remove("bc-fastlane-sessionId")}getStorageSessionId(){return be.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,l=null==a?void 0:a.name,u=null==a?void 0:a.card,d=c?this.mapPayPalToBcAddress(c.address,c.name,c.phoneNumber):void 0,p=s&&l?this.mapPayPalToBcAddress(s,l,null==c?void 0:c.phoneNumber):void 0,h=u?this.mapPayPalToBcInstrument(e,u):[],f=this.filterAddresses([d,p]);return{authenticationState:o||E.UNRECOGNIZED,addresses:f,billingAddress:p,shippingAddress:d,instruments:h}}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:_e.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,m.isEqual)(this.normalizeAddress(e),this.normalizeAddress(t))}normalizeAddress(e){return(0,m.omit)(e,["id","phone"])}}function Pe(){return new Ie}!function(e){e.CardCode="cardCode",e.CardCodeVerification="cardCodeVerification",e.CardExpiry="cardExpiry",e.CardName="cardName",e.CardNumber="cardNumber",e.CardNumberVerification="cardNumberVerification",e.CardExpiryVerification="cardExpiryVerification"}(Se||(Se={}));const Ce=Se;function Oe(e){return Ce.CardNumber in e&&Ce.CardName in e&&Ce.CardExpiry in e}function Ae(e){return Ce.CardNumberVerification in e&&Ce.CardCodeVerification in e&&Ce.CardExpiryVerification in e}class Ee extends s{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 ze;!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"}(ze||(ze={}));class ke extends s{constructor(e){super(function(e){switch(e){case ze.CustomerNotInitialized:return"Unable to proceed because the customer step of checkout has not been initialized.";case ze.PaymentNotInitialized:return"Unable to proceed because the payment step of checkout has not been initialized.";case ze.ShippingNotInitialized:return"Unable to proceed because the shipping step of checkout has not been initialized.";case ze.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 s{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 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 Be{constructor(e,t,n,r){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(e){return je(this,void 0,void 0,function*(){const{methodId:t,paypalcommercecreditcards:n,paypalcommerce:r}=e,i=n||r,{form:o,onCreditCardFieldsRenderingError:a,onLoadComplete:s}=i||{};if(!t)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!o)throw new G('Unable to proceed because "options.paypalcommercecreditcards.form" argument is not provided.');this.hostedFormOptions=o,this.isCreditCardForm=Oe(o.fields),this.isCreditCardVaultedForm=Ae(o.fields)&&!this.hasUndefinedValues(),yield this.paymentIntegrationService.loadPaymentMethod(t),yield this.paypalIntegrationService.loadPayPalSdk(t,void 0,!0,!0),(this.isCreditCardForm||this.isCreditCardVaultedForm)&&(yield this.initializeFields(o,a)),null==s||s(),this.shouldInitializePayPalFastlane(t)&&(yield this.initializePayPalFastlaneOrThrow(t))})}execute(e,t){return je(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 q(["payment"]);if(this.executionPaymentData=o,this.isCreditCardForm||this.isCreditCardVaultedForm)yield this.validateHostedFormOrThrow(),yield this.submitHostedForm();else{const{orderId:e}=yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",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 H)}deinitialize(){return je(this,void 0,void 0,function*(){var e,t,n,r;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}=$(t)?t:{},a=t&&K(t)?t.instrumentId:void 0,s=(0,m.omitBy)({verification_nonce:r,token:a},m.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 je(this,void 0,void 0,function*(){const{fields:n,styles:r}=e,i=this.paypalIntegrationService.getPayPalSdkOrThrow(),o=this.getExecuteCallback(n),a=Object.assign({style:this.getInputStyles(r),onApprove:({orderID:e,vaultSetupToken:t,liabilityShift:n})=>{if(n===le.No||n===le.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 ke(ze.PaymentNotInitialized);try{this.stylizeInputContainers(n),Oe(n)&&(yield this.renderFields(n)),Ae(n)&&(yield this.renderVaultedFields(n))}catch(e){"function"==typeof t&&t(e)}})}getExecuteCallback(e){return Ae(e)?this.createVaultSetupTokenCallback():this.createOrderCallback()}createVaultSetupTokenCallback(){return{createVaultSetupToken:()=>je(this,void 0,void 0,function*(){const{setupToken:e}=(yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",Object.assign(Object.assign({},this.getInstrumentParams()),{setupToken:!0})))||{};return e})}}createOrderCallback(){return{createOrder:()=>je(this,void 0,void 0,function*(){const{orderId:e}=(yield this.paypalIntegrationService.createOrderCardFields("paypalcommercecreditcardscheckout",this.getInstrumentParams()))||{};return e})}}handleApprove({orderID:e,vaultSetupToken:t}){e&&(this.returnedOrderId=e),t&&(this.returnedVaultedToken=t)}renderFields(e){return je(this,void 0,void 0,function*(){var t,n,r,i;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){return je(this,void 0,void 0,function*(){var t,n,r;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($(this.executionPaymentData)){const{shouldSaveInstrument:e,shouldSetAsDefaultInstrument:t}=this.executionPaymentData;return{shouldSaveInstrument:e,shouldSetAsDefaultInstrument:t}}if(K(this.executionPaymentData)){const{instrumentId:e}=this.executionPaymentData;return{instrumentId:e}}return{}}getFieldTypeByEmittedField({emittedBy:e}){return{fieldType:this.mapFieldType(e)}}submitHostedForm(){return je(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(){return je(this,void 0,void 0,function*(){var e,t;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 Ce.CardCode:case Ce.CardCodeVerification:return{fieldType:e,message:"Invalid card code",type:"invalid_card_code"};case Ce.CardNumber:case Ce.CardNumberVerification:return{fieldType:e,message:"Invalid card number",type:"invalid_card_number"};case Ce.CardExpiry:case Ce.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 Ce.CardName;case"cardNumberField":case"number":return this.isCreditCardForm?Ce.CardNumber:Ce.CardNumberVerification;case"cardExpiryField":case"expiry":return this.isCreditCardForm?Ce.CardExpiry:Ce.CardExpiryVerification;case"cardCvvField":case"cvv":return this.isCreditCardForm?Ce.CardCode:Ce.CardCodeVerification;default:throw new Error("Unexpected field type")}}getCardFieldsOrThrow(){if(!this.cardFields)throw new ke(ze.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.isPayPalCommerceAnalyticsV2Enabled)&&!(null==a?void 0:a.authenticationState)}initializePayPalFastlaneOrThrow(e){return je(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.paypalSdkScriptLoader.getPayPalFastlaneSdk(r,n.currency.code,n.id,t.getLocale());yield this.paypalFastlaneUtils.initializePayPalFastlane(o,!!(null==i?void 0:i.isDeveloperModeApplicable))}catch(e){}})}}const xe=t(e=>new Be(e,U(e),y(),Pe()),[{id:"paypalcommercecreditcards"}]);var Ne=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 Fe{constructor(e,t,n,r=3e3,i=3e5){this.paymentIntegrationService=e,this.paypalCommerceService=t,this.loadingIndicator=n,this.pollingInterval=r,this.maxPollingIntervalTime=i,this.pollingTimer=0,this.stopPolling=m.noop}initialize(e){return Ne(this,void 0,void 0,function*(){const{gatewayId:t,methodId:n,paypalcommerceratepay:r}=e;if(!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.gatewayId" argument is not provided.');if(!r)throw new G('Unable to initialize payment because "options.paypalcommerceratepay" argument is not provided.');const{legalTextContainer:i,container:o,loadingContainerId:a}=r;if(!o)throw new G('Unable to initialize payment because "options.container" argument is not provided.');if(!i)throw new G('Unable to initialize payment because "options.legalTextContainer" argument is not provided.');if(!a)throw new G('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 G("Unable to initialize payment because merchantId argument is not provided.");this.paypalcommerceratepay=r,yield this.paypalCommerceService.loadPayPalSdk(n),this.createFraudNetScript(c,n,t),this.loadFraudnetConfig(),this.renderLegalText(i,o)})}execute(e,t){return Ne(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.paypalcommerceratepay||{};if(!n)throw new q(["payment"]);if(!i||"function"!=typeof i)throw new G('Unable to initialize payment because "options.getFieldsValues" argument is not provided.');this.toggleLoadingIndicator(!0);try{const e=yield this.paypalCommerceService.createOrder("paypalcommercealternativemethodscheckout",{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 H)}deinitialize(){const{legalTextContainer:e}=this.paypalcommerceratepay||{},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.paypalCommerceService.getPayPalSdkOrThrow(),c=s.Legal({fundingSource:s.Legal.FUNDING.PAY_UPON_INVOICE});if(!document.getElementById(n))throw new G('Unable to initialize payment because "legalTextContainerElement" argument is not found.');c.render(`#${n}`)}handleError(e){const{onError:t}=this.paypalcommerceratepay||{};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 Ne(this,void 0,void 0,function*(){yield this.deinitialize(),yield this.initialize(e)})}initializePollingMechanism(e,t,n,r){return Ne(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.paypalCommerceService.getOrderStatus("paypalcommercealternativemethods",{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,paypalcommerceratepay:this.paypalcommerceratepay}),this.handleError(new ce)}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 Me=t(e=>new Fe(e,U(e),new V({containerStyles:Object.assign(Object.assign({},u),{position:"fixed"})})),[{gateway:"paypalcommercealternativemethods",id:"ratepay"}]);var De=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 Ue{constructor(e){this.requestSender=e}createOrder(e,t){return De(this,void 0,void 0,function*(){const n=`/api/storefront/payment/${e}`,r=t,i=Object.assign({"X-API-INTERNAL":B,"Content-Type":N.Json},F);return(yield this.requestSender.post(n,{headers:i,body:r})).body})}updateOrder(e){return De(this,void 0,void 0,function*(){const t=e,n=Object.assign({"X-API-INTERNAL":B,"Content-Type":N.Json},F);return(yield this.requestSender.put("/api/storefront/initialization/paypalcommerce",{headers:n,body:t})).body})}getOrderStatus(){return De(this,arguments,void 0,function*(e="paypalcommerce",t){const n=`/api/storefront/initialization/${e}`,r=Object.assign({"X-API-INTERNAL":B,"Content-Type":N.Json},F);return(yield this.requestSender.get(n,Object.assign({headers:r},t))).body})}}function Re(e){return"string"!=typeof e}function Le(e,t){if(t||e)return function(e){var t,n;const r={},i=(0,m.omitBy)(e.root,Re),o=(0,m.omitBy)(e.input,Re),a=(0,m.omitBy)(e.toggle,Re),s=(0,m.omitBy)(null===(t=e.text)||void 0===t?void 0:t.body,Re),c=(0,m.omitBy)(null===(n=e.text)||void 0===n?void 0:n.caption,Re),l=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),l&&(r.branding=l),r}(function(e,t){var n,r,i,o,a,s,c,l,u,d,p,h,f,y,m,v,g,_,b,S,w,I;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===(l=null==t?void 0:t.input)||void 0===l?void 0:l.borderColor),focusBorderColor:(null==e?void 0:e.fastlaneInputSettingsFocusBorderBase)||(null===(u=null==t?void 0:t.input)||void 0===u?void 0:u.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===(p=null==t?void 0:t.input)||void 0===p?void 0:p.borderWidth),textColorBase:(null==e?void 0:e.fastlaneInputSettingsTextColorBase)||(null===(h=null==t?void 0:t.input)||void 0===h?void 0:h.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===(y=null==t?void 0:t.toggle)||void 0===y?void 0:y.colorSecondary)},text:{body:{color:(null==e?void 0:e.fastlaneTextBodySettingsColor)||(null===(v=null===(m=null==t?void 0:t.text)||void 0===m?void 0:m.body)||void 0===v?void 0:v.color),fontSize:(null==e?void 0:e.fastlaneTextBodySettingsFontSize)||(null===(_=null===(g=null==t?void 0:t.text)||void 0===g?void 0:g.body)||void 0===_?void 0:_.fontSize)},caption:{color:(null==e?void 0:e.fastlaneTextCaptionSettingsColor)||(null===(S=null===(b=null==t?void 0:t.text)||void 0===b?void 0:b.caption)||void 0===S?void 0:S.color),fontSize:(null==e?void 0:e.fastlaneTextCaptionSettingsFontSize)||(null===(I=null===(w=null==t?void 0:t.text)||void 0===w?void 0:w.caption)||void 0===I?void 0:I.fontSize)}},branding:(null==e?void 0:e.fastlaneBrandingSettings)||(null==t?void 0:t.branding)}}(e,t))}function Ve(e){return!!e&&("authenticationState"in e||"addresses"in e||"instruments"in e)}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 qe{constructor(e,t,n,r){this.paymentIntegrationService=e,this.paypalCommerceRequestSender=t,this.paypalSdkScriptLoader=n,this.paypalFastlaneUtils=r}initialize(e){return Ge(this,void 0,void 0,function*(){var t,n;const{methodId:r,paypalcommercefastlane:i}=e;if(this.methodId=r,this.paypalcommercefastlane=i,!r)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new G('Unable to initialize payment because "options.paypalcommercefastlane" argument is not provided.');if(!i.onInit||"function"!=typeof i.onInit)throw new G('Unable to initialize payment because "options.paypalcommercefastlane.onInit" argument is not provided or it is not a function.');if(!i.onChange||"function"!=typeof i.onChange)throw new G('Unable to initialize payment because "options.paypalcommercefastlane.onChange" argument is not provided or it is not a function.');yield this.paymentIntegrationService.loadPaymentMethod(r);const o=this.paymentIntegrationService.getState(),a=o.getCartOrThrow(),s=o.getPaymentMethodOrThrow(r),{isDeveloperModeApplicable:c,isFastlaneStylingEnabled:l}=s.initializationData||{};this.threeDSVerificationMethod=null===(t=s.initializationData)||void 0===t?void 0:t.threeDSVerificationMethod,this.paypalFastlaneSdk=yield this.paypalSdkScriptLoader.getPayPalFastlaneSdk(s,a.currency.code,a.id,o.getLocale());const u=Le(l?null===(n=null==s?void 0:s.initializationData)||void 0===n?void 0:n.fastlaneStyles:{},null==i?void 0:i.styles);yield this.paypalFastlaneUtils.initializePayPalFastlane(this.paypalFastlaneSdk,!!c,u),this.shouldRunAuthenticationFlow()&&(yield this.runPayPalAuthenticationFlowOrThrow(r)),yield this.initializePayPalPaymentComponent(),i.onInit(e=>this.renderPayPalPaymentComponent(e)),i.onChange(()=>this.handlePayPalStoredInstrumentChange(r))})}execute(e,t){return Ge(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 q(["payment"]);const{paymentData:i,methodId:o}=n,a=i&&K(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.paypalFastlaneUtils.removeStorageSessionId()}catch(e){if(function(e){return"object"==typeof e&&null!==e&&"message"in e&&"response"in e&&"body"in e.response&&"name"in e.response.body}(e)&&"INVALID_REQUEST"===e.response.body.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 H)}deinitialize(){return Ge(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=Ve(r)?r:{},o=this.paypalFastlaneUtils.getStorageSessionId();return!(!n.isGuest||(null==i?void 0:i.authenticationState)===E.CANCELED||(null==i?void 0:i.authenticationState)||o!==t.id)}runPayPalAuthenticationFlowOrThrow(e){return Ge(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.paypalFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalFastlaneUtils.triggerAuthenticationFlowOrThrow(a),{authenticationState:c,addresses:l,instruments:u}=this.paypalFastlaneUtils.mapPayPalFastlaneProfileToBcCustomerData(e,s);yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:c,addresses:l,instruments:u}),s.authenticationState===E.CANCELED?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n.id)}catch(e){}})}initializePayPalPaymentComponent(){return Ge(this,void 0,void 0,function*(){const e=this.paymentIntegrationService.getState().getBillingAddressOrThrow(),t=e.phone,n=`${e.firstName} ${e.lastName}`.trim(),r=this.paypalFastlaneUtils.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 G('Unable to render card component because "container" argument is not provided.');t.render(e)}getPayPalComponentMethodsOrThrow(){if(!this.paypalComponentMethods)throw new c;return this.paypalComponentMethods}prepareVaultedInstrumentPaymentPayload(e,t){return Ge(this,void 0,void 0,function*(){const{instrumentId:n}=t,r=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e).config.is3dsEnabled?yield this.get3DSNonce(n):n;return yield this.createOrder(r),{methodId:e,paymentData:{formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:r}}}}})}preparePaymentPayload(e,t){return Ge(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.paypalFastlaneUtils.mapBcToPayPalAddress(r)}),c=i.config.is3dsEnabled?yield this.get3DSNonce(s):s;yield this.createOrder(c);const{shouldSaveInstrument:l=!1,shouldSetAsDefaultInstrument:u=!1}=$(t)?t:{};return{methodId:e,paymentData:Object.assign(Object.assign({},t),{shouldSaveInstrument:l,shouldSetAsDefaultInstrument:u,formattedPayload:{paypal_fastlane_token:{order_id:this.orderId,token:c}}})}})}createOrder(e){return Ge(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState().getCartOrThrow().id;if(this.methodId){const{orderId:n}=yield this.paypalCommerceRequestSender.createOrder(this.methodId,{cartId:t,fastlaneToken:e});this.orderId=n}})}get3DSNonce(e){return Ge(this,void 0,void 0,function*(){var t;const n=this.paymentIntegrationService.getState(),r=n.getCartOrThrow(),i=n.getOrderOrThrow(),o=n.getStoreConfigOrThrow().links.checkoutLink,a=null===(t=this.paypalFastlaneSdk)||void 0===t?void 0:t.ThreeDomainSecureClient;if(!a)throw new c;const s={amount:i.orderAmount.toFixed(2),currency:r.currency.code,nonce:e,threeDSRequested:this.threeDSVerificationMethod===w.Always,transactionContext:{experience_context:{locale:"en-US",return_url:o,cancel_url:o}}},l=yield a.isEligible(s);if(this.threeDSVerificationMethod===w.Always&&!l)throw new W;if(l){const{liabilityShift:e,authenticationState:t,nonce:n}=yield a.show();if(e===le.No||e===le.Unknown||t===I.Errored||t===I.Cancelled)throw new W;if(t===I.Succeeded&&[le.Yes,le.Possible].includes(e))return n;throw new W}return e})}handlePayPalStoredInstrumentChange(e){return Ge(this,void 0,void 0,function*(){const t=this.paypalFastlaneUtils.getPayPalFastlaneOrThrow(),{selectionChanged:n,selectedCard:r}=yield t.profile.showCardSelector();if(n){const t=this.paymentIntegrationService.getState().getPaymentProviderCustomer(),n=Ve(t)?t:{},i=this.paypalFastlaneUtils.mapPayPalToBcInstrument(e,r)[0];return yield this.paymentIntegrationService.updatePaymentProviderCustomer(Object.assign(Object.assign({},n),{instruments:[i]})),i}})}handleError(e){var t;(null===(t=this.paypalcommercefastlane)||void 0===t?void 0:t.onError)&&"function"==typeof this.paypalcommercefastlane.onError&&this.paypalcommercefastlane.onError(e)}}const We=t(e=>{const{getHost:t}=e.getState();return new qe(e,new Ue((0,a.createRequestSender)({host:t()})),y(),Pe())},[{id:"paypalcommerceacceleratedcheckout"}]);var He=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())})};const $e=class{constructor(e,t){this.paymentIntegrationService=e,this.paypalIntegrationService=t}createPayPalButton(e,t,n,r){const{style:i,fundingSource:o,isHostedCheckoutEnabled:a,isServerSideShippingCallbacksEnabled:s,onClick:c,onCancel:l,onPaymentComplete:u,onError:d}=n;this.onError=d;const p=this.paypalIntegrationService.getPayPalSdkOrThrow();if(!Object.values(p.FUNDING).includes(o))throw new G('Unable to initialize PayPal button because "fundingSource" argument is not valid funding source.');const h=Object.assign(Object.assign({},!s&&{onShippingAddressChange:t=>this.onShippingAddressChange(t,e),onShippingOptionsChange:t=>this.onShippingOptionsChange(t,e)}),{onApprove:(n,r)=>this.onHostedCheckoutApprove(n,r,t,e,u,s)});return p.Buttons(Object.assign(Object.assign(Object.assign({fundingSource:o,style:this.paypalIntegrationService.getValidButtonStyle(i),createOrder:()=>He(this,void 0,void 0,function*(){if(r){const e=yield this.paypalIntegrationService.createBuyNowCartOrThrow(r);yield this.paymentIntegrationService.loadCheckout(e.id)}return this.paypalIntegrationService.createOrder(e)}),onApprove:({orderID:e})=>this.paypalIntegrationService.tokenizePayment(t,e)},c?{onClick:c}:{}),l?{onCancel:l}:{}),a&&h))}onHostedCheckoutApprove(e,t,n,r,o,a){return He(this,void 0,void 0,function*(){if(!e.orderID)throw new l(i.MissingOrderId);const s=this.paymentIntegrationService.getState().getCartOrThrow();try{const i=s.lineItems.physicalItems.length>0;if(!a){const e=yield t.order.get(),n=this.paypalIntegrationService.getBillingAddressFromOrderDetails(e);if(yield this.paymentIntegrationService.updateBillingAddress(n),i){const t=this.paypalIntegrationService.getShippingAddressFromOrderDetails(e);yield this.paymentIntegrationService.updateShippingAddress(t)}}i&&(yield this.paypalIntegrationService.updateOrder(r,void 0,void 0,a)),a&&(yield this.paymentIntegrationService.loadCheckout()),yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalIntegrationService.submitPayment(n,e.orderID),o&&"function"==typeof o&&o()}catch(e){this.handleError(e)}})}onShippingAddressChange(e,t){return He(this,void 0,void 0,function*(){const n=this.paypalIntegrationService.getAddress({city:e.shippingAddress.city,countryCode:e.shippingAddress.countryCode,postalCode:e.shippingAddress.postalCode,stateOrProvinceCode:e.shippingAddress.state});try{yield this.paymentIntegrationService.updateBillingAddress(n),yield this.paymentIntegrationService.updateShippingAddress(n);const e=this.paypalIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalIntegrationService.updateOrder(t)}catch(e){this.handleError(e)}})}onShippingOptionsChange(e,t){return He(this,void 0,void 0,function*(){const n=this.paypalIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(n.id),yield this.paypalIntegrationService.updateOrder(t)}catch(e){this.handleError(e)}})}handleError(e){if("function"!=typeof this.onError)throw e;this.onError(e)}};var Ke=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 Ye{constructor(e,t,n){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.paypalButtonCreationService=n}initialize(e){return Ke(this,void 0,void 0,function*(){const{paypalcommerce:t,methodId:n}=e;if(!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(!t.container)throw new G('Unable to initialize payment because "options.paypalcommerce.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new G('Unable to initialize payment because "options.paypalcommerce.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalIntegrationService.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 Ke(this,void 0,void 0,function*(){return yield this.paymentIntegrationService.signInCustomer(e,t),Promise.resolve()})}signOut(e){return Ke(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){const{container:n,onClick:r,onComplete:i,onError:o}=t,a=this.paypalIntegrationService.getPayPalSdkOrThrow(),s=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:c,paymentButtonStyles:l,isServerSideShippingCallbacksEnabled:u}=s.initializationData||{},{checkoutTopButtonStyles:d}=l||{},p=Object.assign(Object.assign(Object.assign({fundingSource:a.FUNDING.PAYPAL,isServerSideShippingCallbacksEnabled:u,isHostedCheckoutEnabled:c,style:Object.assign(Object.assign({},d),{height:40})},r&&{onClick:()=>r()}),c&&i&&{onPaymentComplete:()=>i()}),{onError:o}),h=this.paypalButtonCreationService.createPayPalButton("paypalcommerce",e,p);h.isEligible()?h.render(`#${n}`):this.paypalIntegrationService.removeElement(n)}}const Ze=t(e=>{const t=U(e),n=new $e(e,t);return new Ye(e,t,n)},[{id:"paypalcommerce"}]);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 Qe{constructor(e,t,n,r){this.formPoster=e,this.paymentIntegrationService=t,this.paypalCommerceRequestSender=n,this.paypalCommerceScriptLoader=r}loadPayPalSdk(e,t,n,r){return Je(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.paypalCommerceScriptLoader.getPayPalSDK(a,o,i.getLocale(),n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new c;return this.paypalSdk}createBuyNowCartOrThrow(e){return Je(this,void 0,void 0,function*(){const t=e.getBuyNowCartRequestBody();if(!t)throw new l(i.MissingCart);try{return yield this.paymentIntegrationService.createBuyNowCart(t)}catch(e){throw new v}})}createOrder(e,t){return Je(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r}=yield this.paypalCommerceRequestSender.createOrder(e,Object.assign({cartId:n},t));return r})}createOrderCardFields(e,t){return Je(this,void 0,void 0,function*(){const n=this.paymentIntegrationService.getState().getCartOrThrow().id,{orderId:r,setupToken:i}=yield this.paypalCommerceRequestSender.createOrder(e,Object.assign({cartId:n},t));return Object.assign({orderId:r},i?{setupToken:i}:{})})}updateOrder(e){return Je(this,void 0,void 0,function*(){const t=this.paymentIntegrationService.getState(),n=t.getCartOrThrow(),r=t.getConsignmentsOrThrow()[0];try{yield this.paypalCommerceRequestSender.updateOrder({availableShippingOptions:e?[]:r.availableShippingOptions,cartId:n.id,selectedShippingOption:e?null:r.selectedShippingOption})}catch(e){throw new _}})}getOrderStatus(e,t){return Je(this,void 0,void 0,function*(){try{const{status:n}=yield this.paypalCommerceRequestSender.getOrderStatus(e,t);return n}catch(e){throw new _}})}tokenizePayment(e,t){const n=this.paymentIntegrationService.getState().getCartOrThrow();if(!t)throw new l(i.MissingOrderId);return this.formPoster.postForm("/checkout.php",Object.assign({payment_type:"paypal",action:"set_external_checkout",provider:e,order_id:t},n.source===b.BuyNow&&{cart_id:n.id}))}submitPayment(e,t,n){return Je(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&&pe[t]?t:void 0,height:this.getValidHeight(n),label:r&&de[r]?r:void 0,shape:i&&he[i]?i:void 0};return(0,m.omitBy)(o,m.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")}}var Xe=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){this.scriptLoader=e,this.window=window}getPayPalSDK(e,t,n,r,i){return Xe(this,void 0,void 0,function*(){const o=this.getPayPalSdkScriptConfigOrThrow(e,t,n,r);return this.loadPayPalSDK(o,i)})}loadPayPalSDK(e){return Xe(this,arguments,void 0,function*(e,t=!1){if(!this.window.paypal||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.paypal)throw new c;return this.window.paypal})}getPayPalSdkScriptConfigOrThrow(e,t,n,r=!0){const{id:o,clientToken:a,initializationData:s}=e;if(!(null==s?void 0:s.clientId))throw new l(i.MissingPaymentMethod);const{intent:c,clientId:u,merchantId:d,buyerCountry:h,attributionId:f,isVenmoEnabled:y,isHostedCheckoutEnabled:m,isPayPalCreditAvailable:v,isDeveloperModeApplicable:g,availableAlternativePaymentMethods:_=[],enabledAlternativePaymentMethods:b=[],isGooglePayEnabled:S}=s,w=m||r,I="paypalcommercecreditcards"===o,P=I?["card"]:[],C=v?["credit","paylater"]:[],O=y?["venmo"]:[],A=S?["googlepay"]:[],E=r?["card-fields"]:[],z=[...I?[]:["card"],...v?[]:["credit","paylater"],...y?[]:["venmo"],..._.filter(e=>!b.includes(e))],k=[...P,...C,...O,...b],T=p(n);return{options:Object.assign(Object.assign({"client-id":u,"merchant-id":d,"enable-funding":k.length>0?k:void 0,"disable-funding":z.length>0?z:void 0,commit:w,components:["buttons","hosted-fields","payment-fields","legal",...A,...E],currency:t,intent:c},g&&{"buyer-country":h}),T&&{locale:T}),attributes:{"data-partner-attribution-id":f,"data-client-token":a}}}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 tt=t=>{const{getHost:n}=t.getState();return new Qe((0,o.createFormPoster)(),t,new Ue((0,a.createRequestSender)({host:n()})),new et((0,e.vQ)()))};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.paypalCommerceIntegrationService=t,this.onError=m.noop}initialize(e){return nt(this,void 0,void 0,function*(){const{paypalcommercecredit:t,methodId:n}=e;if(!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(!t.container)throw new G('Unable to initialize payment because "options.paypalcommercecredit.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new G('Unable to initialize payment because "options.paypalcommercecredit.onClick" argument is not a function.');this.onError=t.onError||m.noop,this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,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 nt(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t)})}signOut(e){return nt(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.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),a=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{isHostedCheckoutEnabled:s,paymentButtonStyles:c,isServerSideShippingCallbacksEnabled:l}=a.initializationData||{},{checkoutTopButtonStyles:u}=c||{},d=Object.assign({createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},i&&{onClick:()=>i()}),p=Object.assign(Object.assign({},!l&&{onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e)}),{onApprove:(t,n)=>this.onHostedCheckoutApprove(t,n,e,r,l)}),h=[o.FUNDING.PAYLATER,o.FUNDING.CREDIT];let f=!1;h.forEach(e=>{if(!f){const t=Object.assign(Object.assign({fundingSource:e,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},u),{height:40}))},d),s&&p),r=o.Buttons(t);r.isEligible()&&(r.render(`#${n}`),f=!0)}}),f||this.paypalCommerceIntegrationService.removeElement(n)}onHostedCheckoutApprove(e,t,n,r,o){return nt(this,void 0,void 0,function*(){if(!e.orderID)throw new l(i.MissingOrderId);const a=this.paymentIntegrationService.getState().getCartOrThrow();try{const i=a.lineItems.physicalItems.length>0;if(!o){const e=yield t.order.get(),n=this.paypalCommerceIntegrationService.getBillingAddressFromOrderDetails(e);if(yield this.paymentIntegrationService.updateBillingAddress(n),i){const t=this.paypalCommerceIntegrationService.getShippingAddressFromOrderDetails(e);yield this.paymentIntegrationService.updateShippingAddress(t)}}i&&(yield this.paypalCommerceIntegrationService.updateOrder(o)),o&&(yield this.paymentIntegrationService.loadCheckout()),yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalCommerceIntegrationService.submitPayment(n,e.orderID),r&&"function"==typeof r&&r()}catch(e){this.handleError(e)}})}onShippingAddressChange(e){return nt(this,void 0,void 0,function*(){const t=this.paypalCommerceIntegrationService.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.paypalCommerceIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}onShippingOptionsChange(e){return nt(this,void 0,void 0,function*(){const t=this.paypalCommerceIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalCommerceIntegrationService.updateOrder()}catch(e){this.handleError(e)}})}handleError(e){if("function"!=typeof this.onError)throw e;this.onError(e)}}const it=t(e=>new rt(e,tt(e)),[{id:"paypalcommercecredit"}]);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){this.paymentIntegrationService=e,this.paypalCommerceIntegrationService=t}initialize(e){return ot(this,void 0,void 0,function*(){const{paypalcommercevenmo:t,methodId:n}=e;if(!n)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(!t.container)throw new G('Unable to initialize payment because "options.paypalcommercevenmo.container" argument is not provided.');if(t.onClick&&"function"!=typeof t.onClick)throw new G('Unable to initialize payment because "options.paypalcommercevenmo.onClick" argument is not a function.');this.paymentIntegrationService.getState().getPaymentMethod(n)||(yield this.paymentIntegrationService.loadPaymentMethod(n));const r=yield this.paypalCommerceIntegrationService.loadPayPalSdk(n);r&&r.Buttons&&"function"==typeof r.Buttons?this.renderButton(n,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 ot(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t)})}signOut(e){return ot(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.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),o=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{paymentButtonStyles:a}=o.initializationData||{},{checkoutTopButtonStyles:s}=a||{},c=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.paypalCommerceIntegrationService.getValidButtonStyle(Object.assign(Object.assign({},s),{height:40})),createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:t})=>this.paypalCommerceIntegrationService.tokenizePayment(e,t)},r&&{onClick:()=>r()}),l=i.Buttons(c);l.isEligible()?l.render(`#${n}`):this.paypalCommerceIntegrationService.removeElement(n)}}const st=t(e=>new at(e,tt(e)),[{id:"paypalcommercevenmo"}]);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 lt{constructor(e,t,n){this.paymentIntegrationService=e,this.paypalSdkScriptLoader=t,this.paypalFastlaneUtils=n}initialize(e){return ct(this,void 0,void 0,function*(){var t;const{methodId:n,paypalcommercefastlane:r}=e;if(!n)throw new G('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.paypalSdkScriptLoader.getPayPalFastlaneSdk(o,i.currency.code,i.id,e.getLocale());yield this.paypalFastlaneUtils.initializePayPalFastlane(s,a,this.getFastlaneStyles(n,r))}catch(e){}return Promise.resolve()})}deinitialize(){return ct(this,void 0,void 0,function*(){return Promise.resolve()})}signIn(e,t){return ct(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signInCustomer(e,t),yield this.paymentIntegrationService.updatePaymentProviderCustomer({authenticationState:void 0,addresses:void 0,instruments:void 0}),this.paypalFastlaneUtils.removeStorageSessionId()})}signOut(e){return ct(this,void 0,void 0,function*(){yield this.paymentIntegrationService.signOutCustomer(e)})}executePaymentMethodCheckout(e){return ct(this,void 0,void 0,function*(){const{checkoutPaymentMethodExecuted:t,continueWithCheckoutCallback:n,methodId:r}=e||{};if(!r)throw new G('Unable to proceed because "methodId" argument is not provided.');if("function"!=typeof n)throw new G('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 ct(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.paypalFastlaneUtils.lookupCustomerOrThrow(o),s=yield this.paypalFastlaneUtils.triggerAuthenticationFlowOrThrow(a),c=s.authenticationState===E.CANCELED;yield this.updateCustomerDataState(e,s),c?this.paypalFastlaneUtils.removeStorageSessionId():this.paypalFastlaneUtils.updateStorageSessionId(n)})}updateCustomerDataState(e,t){return ct(this,void 0,void 0,function*(){var n;const r=this.paymentIntegrationService.getState().getCartOrThrow(),{authenticationState:i,addresses:o,billingAddress:a,shippingAddress:s,instruments:c}=this.paypalFastlaneUtils.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=(null===(n=(t.getConsignments()||[])[0])||void 0===n?void 0:n.availableShippingOptions)||[],a=o[0],c=o.find(e=>e.isRecommended);if((c||a)&&i){const e=(null==c?void 0:c.id)||a.id;yield this.paymentIntegrationService.selectShippingOption(e)}}})}getFastlaneStyles(e,t){const n=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(e),{fastlaneStyles:r,isFastlaneStylingEnabled:i}=n.initializationData||{};return Le(i?r:{},null==t?void 0:t.styles)}}const ut=t(e=>new lt(e,y(),Pe()),[{id:"paypalcommerceacceleratedcheckout"},{id:"paypalcommercecreditcards"}]);class dt{constructor(e,t,n){this.paymentIntegrationService=e,this.paypalIntegrationService=t,this.paypalButtonCreationService=n}initialize(e){return t=this,n=void 0,i=function*(){var t;const{paypalcommerce:n,containerId:r,methodId:i}=e,o=Boolean(null==n?void 0:n.buyNowInitializeOptions);if(!i)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!r)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!n)throw new G('Unable to initialize payment because "options.paypalcommerce" argument is not provided.');if(o&&!n.currencyCode)throw new G('Unable to initialize payment because "options.paypalcommerce.currencyCode" argument is not provided.');if(o&&"function"!=typeof(null===(t=n.buyNowInitializeOptions)||void 0===t?void 0:t.getBuyNowCartRequestBody))throw new G('Unable to initialize payment because "options.paypalcommerce.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');o||(yield this.paymentIntegrationService.loadDefaultCheckout());const a=o?n.currencyCode:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(i,a,!1),this.renderButton(r,i,n)},new((r=void 0)||(r=Promise))(function(e,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r(function(e){e(n)})).then(a,s)}c((i=i.apply(t,n||[])).next())});var t,n,r,i}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.paypalIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:l,isServerSideShippingCallbacksEnabled:u}=c.initializationData||{},d={onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},p=Object.assign(Object.assign({fundingSource:s.FUNDING.PAYPAL,style:this.paypalIntegrationService.getValidButtonStyle(i),isServerSideShippingCallbacksEnabled:u,isHostedCheckoutEnabled:l},r&&d),l&&o&&{onPaymentComplete:()=>o()}),h=this.paypalButtonCreationService.createPayPalButton("paypalcommerce",t,p,r);h.isEligible()?h.render(`#${e}`):a&&"function"==typeof a?a():this.paypalIntegrationService.removeElement(e)}}const pt=t(e=>{const t=U(e),n=new $e(e,t);return new dt(e,t,n)},[{id:"paypalcommerce"}]);var ht=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 ft{constructor(e,t){this.paymentIntegrationService=e,this.paypalIntegrationService=t}initialize(e){return ht(this,void 0,void 0,function*(){const{paypalcommercecredit:t,containerId:n,methodId:r}=e,{buyNowInitializeOptions:i,currencyCode:o}=t||{},a=!!i;if(!r)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommercecredit" argument is not provided.');if(a&&!o)throw new G('Unable to initialize payment because "options.paypalcommercecredit.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new G('Unable to initialize payment because "options.paypalcommercecredit.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');a||(yield this.paymentIntegrationService.loadDefaultCheckout());const s=this.paymentIntegrationService.getState(),c=a?o:s.getCartOrThrow().currency.code;yield this.paypalIntegrationService.loadPayPalSdk(r,c,!1),this.renderButton(n,r,t)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{buyNowInitializeOptions:r,style:i,onComplete:o,onEligibilityFailure:a}=n,s=this.paypalIntegrationService.getPayPalSdkOrThrow(),c=this.paymentIntegrationService.getState().getPaymentMethodOrThrow(t),{isHostedCheckoutEnabled:l,isServerSideShippingCallbacksEnabled:u}=c.initializationData||{},d={createOrder:()=>this.paypalIntegrationService.createOrder("paypalcommercecredit"),onApprove:({orderID:e})=>this.paypalIntegrationService.tokenizePayment(t,e)},p={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},h=Object.assign(Object.assign({},!u&&{onShippingAddressChange:e=>this.onShippingAddressChange(e),onShippingOptionsChange:e=>this.onShippingOptionsChange(e)}),{onApprove:(e,n)=>this.onHostedCheckoutApprove(e,n,t,o,u)}),f=[s.FUNDING.PAYLATER,s.FUNDING.CREDIT];let y=!1;f.forEach(t=>{if(!y){const n=Object.assign(Object.assign(Object.assign({fundingSource:t,style:this.paypalIntegrationService.getValidButtonStyle(i)},d),r&&p),l&&h),o=s.Buttons(n);o.isEligible()?(o.render(`#${e}`),y=!0):a&&"function"==typeof a&&a()}}),y||this.paypalIntegrationService.removeElement(e)}handleClick(e){return ht(this,void 0,void 0,function*(){if(e){const t=yield this.paypalIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}onHostedCheckoutApprove(e,t,n,r,o){return ht(this,void 0,void 0,function*(){if(!e.orderID)throw new l(i.MissingOrderId);const a=this.paymentIntegrationService.getState().getCartOrThrow();try{const i=a.lineItems.physicalItems.length>0;if(!o){const e=yield t.order.get(),n=this.paypalIntegrationService.getBillingAddressFromOrderDetails(e);if(yield this.paymentIntegrationService.updateBillingAddress(n),i){const t=this.paypalIntegrationService.getShippingAddressFromOrderDetails(e);yield this.paymentIntegrationService.updateShippingAddress(t)}}return i&&(yield this.paypalIntegrationService.updateOrder("paypalcommerce",void 0,void 0,o)),o&&(yield this.paymentIntegrationService.loadCheckout()),yield this.paymentIntegrationService.submitOrder({},{params:{methodId:n}}),yield this.paypalIntegrationService.submitPayment(n,e.orderID),r&&"function"==typeof r&&r(),!0}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingAddressChange(e){return ht(this,void 0,void 0,function*(){const t=this.paypalIntegrationService.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.paypalIntegrationService.getShippingOptionOrThrow();yield this.paymentIntegrationService.selectShippingOption(e.id),yield this.paypalIntegrationService.updateOrder("paypalcommerce")}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}onShippingOptionsChange(e){return ht(this,void 0,void 0,function*(){const t=this.paypalIntegrationService.getShippingOptionOrThrow(e.selectedShippingOption.id);try{yield this.paymentIntegrationService.selectShippingOption(t.id),yield this.paypalIntegrationService.updateOrder("paypalcommerce")}catch(e){if("string"==typeof e)throw new Error(e);throw e}})}}const yt=t(e=>new ft(e,U(e)),[{id:"paypalcommercecredit"}]);var mt=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 vt{constructor(e,t){this.paymentIntegrationService=e,this.paypalCommerceIntegrationService=t}initialize(e){return mt(this,void 0,void 0,function*(){const{paypalcommercevenmo:t,containerId:n,methodId:r}=e,{buyNowInitializeOptions:i,currencyCode:o}=t||{},a=!!i;if(!r)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!n)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!t)throw new G('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');if(a&&!o)throw new G('Unable to initialize payment because "options.paypalcommercevenmo.currencyCode" argument is not provided.');if(a&&"function"!=typeof(null==i?void 0:i.getBuyNowCartRequestBody))throw new G('Unable to initialize payment because "options.paypalcommercevenmo.buyNowInitializeOptions.getBuyNowCartRequestBody" argument is not provided or it is not a function.');a||(yield this.paymentIntegrationService.loadDefaultCheckout());const s=a?o:this.paymentIntegrationService.getState().getCartOrThrow().currency.code;yield this.paypalCommerceIntegrationService.loadPayPalSdk(r,s,!1),this.renderButton(n,r,t)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n){const{buyNowInitializeOptions:r,style:i,onEligibilityFailure:o}=n,a=this.paypalCommerceIntegrationService.getPayPalSdkOrThrow(),s=a.FUNDING.VENMO,c={createOrder:()=>this.paypalCommerceIntegrationService.createOrder("paypalcommercevenmo"),onApprove:({orderID:e})=>this.paypalCommerceIntegrationService.tokenizePayment(t,e)},l={onClick:()=>this.handleClick(r),onCancel:()=>this.paymentIntegrationService.loadDefaultCheckout()},u=Object.assign(Object.assign({fundingSource:s,style:this.getValidVenmoButtonStyles(i)},c),r&&l),d=a.Buttons(u);d.isEligible()?d.render(`#${e}`):o&&"function"==typeof o?o():this.paypalCommerceIntegrationService.removeElement(e)}getValidVenmoButtonStyles(e){const t=this.paypalCommerceIntegrationService.getValidButtonStyle(e);return t.color===pe.gold?Object.assign(Object.assign({},t),{color:void 0}):t}handleClick(e){return mt(this,void 0,void 0,function*(){if(e){const t=yield this.paypalCommerceIntegrationService.createBuyNowCartOrThrow(e);yield this.paymentIntegrationService.loadCheckout(t.id)}})}}const gt=t(e=>new vt(e,tt(e)),[{id:"paypalcommercevenmo"}]);var _t=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 bt{constructor(e,t){this.walletButtonIntegrationService=e,this.paypalCommerceScriptLoader=t}loadPayPalSdk(e,t,n,r){return _t(this,void 0,void 0,function*(){return this.paypalSdk=yield this.paypalCommerceScriptLoader.getPayPalSDK(e,t,void 0,n,r),this.paypalSdk})}getPayPalSdkOrThrow(){if(!this.paypalSdk)throw new c;return this.paypalSdk}proxyTokenizationPayment(e,t,n,r){return _t(this,void 0,void 0,function*(){var o;if(!r)throw new l(i.MissingOrderId);const a={paymentWalletData:{providerId:t,providerOrderId:r},cartEntityId:e,queryParams:[{key:"payment_type",value:"paypal"},{key:"action",value:"set_external_checkout"},{key:"provider",value:n}]},s=yield this.walletButtonIntegrationService.getRedirectToCheckoutUrl(a);if(!(null===(o=s.body.redirectUrls)||void 0===o?void 0:o.externalCheckoutUrl))throw new Error("Failed to redirection to checkout page");window.location.assign(s.body.redirectUrls.externalCheckoutUrl)})}createPaymentOrderIntent(e,t,n){return _t(this,void 0,void 0,function*(){const r={cartEntityId:t,paymentWalletEntityId:e};return(yield this.walletButtonIntegrationService.createPaymentOrderIntent(r,n)).body.orderId})}addBillingAddress(e,t,n){return _t(this,void 0,void 0,function*(){return this.walletButtonIntegrationService.addBillingAddress(e,t,n)})}getValidButtonStyle(e){const{color:t,height:n,label:r,shape:i}=e||{},o={color:t&&pe[t]?t:void 0,height:this.getValidHeight(n),label:r&&de[r]?r:void 0,shape:i&&he[i]?i:void 0};return(0,m.omitBy)(o,m.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")}}var St=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 wt{constructor(e){this.paypalCommerceHeadlessWalletButtonService=e}initialize(e){return St(this,void 0,void 0,function*(){var t,n;const{paypalcommercepaypal:r,containerId:i,methodId:o}=e;if(!o)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!r)throw new G('Unable to initialize payment because "options.paypalcommercepaypal" argument is not provided.');let a;try{a=JSON.parse(atob(r.initializationData))}catch(e){throw new G("Failed to parse payment method 'initializationData'.")}const s=null===(n=null===(t=a.initializationData)||void 0===t?void 0:t.paymentButtonStyles)||void 0===n?void 0:n.cartButtonStyles;yield this.paypalCommerceHeadlessWalletButtonService.loadPayPalSdk(a,r.currency.code,!1),this.renderButton(i,"paypalcommerce.paypal",r.cartId,s)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n,r){const i=this.paypalCommerceHeadlessWalletButtonService.getPayPalSdkOrThrow(),o={createOrder:()=>this.paypalCommerceHeadlessWalletButtonService.createPaymentOrderIntent(t,n),onApprove:(e,r)=>St(this,[e,r],void 0,function*({orderID:e},r){const i=yield r.order.get(),o=this.mapOrderDetailsToBillingAddress(i);yield this.paypalCommerceHeadlessWalletButtonService.addBillingAddress(n,o),yield this.paypalCommerceHeadlessWalletButtonService.proxyTokenizationPayment(n,t,"paypalcommerce",e)})},a=Object.assign({fundingSource:i.FUNDING.PAYPAL,style:this.paypalCommerceHeadlessWalletButtonService.getValidButtonStyle(r)},o),s=i.Buttons(a);s.isEligible()?s.render(`#${e}`):this.paypalCommerceHeadlessWalletButtonService.removeElement(e)}mapOrderDetailsToBillingAddress(e){var t,n,r,i;const{payer:o}=e;return{firstName:o.name.given_name,lastName:o.name.surname,company:"",address1:o.address.address_line_1,address2:o.address.address_line_2,city:o.address.admin_area_2,email:o.email_address,stateOrProvince:null!==(t=o.address.admin_area_1)&&void 0!==t?t:"",stateOrProvinceCode:null!==(n=o.address.admin_area_1)&&void 0!==n?n:"",countryCode:o.address.country_code,postalCode:o.address.postal_code,phone:null!==(i=null===(r=o.phone)||void 0===r?void 0:r.phone_number.national_number)&&void 0!==i?i:"",shouldSaveAddress:!1}}}const It=t(t=>new wt(new bt(t,new et((0,e.vQ)()))),[{id:"paypalcommercepaypal"}]);var Pt=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 Ct{constructor(e){this.paypalCommerceHeadlessWalletButtonService=e}initialize(e){return Pt(this,void 0,void 0,function*(){var t,n;const{paypalcommercepaypalcredit:r,containerId:i,methodId:o}=e;if(!o)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!r)throw new G('Unable to initialize payment because "options.paypalcommercepaypalcredit" argument is not provided.');let a;try{a=JSON.parse(atob(r.initializationData))}catch(e){throw new G("Failed to parse payment method 'initializationData'.")}yield this.paypalCommerceHeadlessWalletButtonService.loadPayPalSdk(a,r.currency.code,!1);const s=null===(n=null===(t=a.initializationData)||void 0===t?void 0:t.paymentButtonStyles)||void 0===n?void 0:n.cartButtonStyles;this.renderButton(i,"paypalcommerce.paypalcredit",r.cartId,s)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n,r){const i=this.paypalCommerceHeadlessWalletButtonService.getPayPalSdkOrThrow(),o=[i.FUNDING.PAYLATER,i.FUNDING.CREDIT],a={createOrder:()=>this.paypalCommerceHeadlessWalletButtonService.createPaymentOrderIntent(t,n),onApprove:(e,r)=>Pt(this,[e,r],void 0,function*({orderID:e},r){const i=yield r.order.get(),o=this.mapOrderDetailsToBillingAddress(i);yield this.paypalCommerceHeadlessWalletButtonService.addBillingAddress(n,o),yield this.paypalCommerceHeadlessWalletButtonService.proxyTokenizationPayment(n,t,"paypalcommercecredit",e)})};let s=!1;o.forEach(t=>{if(!s){const n=Object.assign({fundingSource:t,style:this.paypalCommerceHeadlessWalletButtonService.getValidButtonStyle(r)},a),o=i.Buttons(n);o.isEligible()&&(o.render(`#${e}`),s=!0)}}),s||this.paypalCommerceHeadlessWalletButtonService.removeElement(e)}mapOrderDetailsToBillingAddress(e){var t,n,r,i;const{payer:o}=e;return{firstName:o.name.given_name,lastName:o.name.surname,company:"",address1:o.address.address_line_1,address2:o.address.address_line_2,city:o.address.admin_area_2,email:o.email_address,stateOrProvince:null!==(t=o.address.admin_area_1)&&void 0!==t?t:"",stateOrProvinceCode:null!==(n=o.address.admin_area_1)&&void 0!==n?n:"",countryCode:o.address.country_code,postalCode:o.address.postal_code,phone:null!==(i=null===(r=o.phone)||void 0===r?void 0:r.phone_number.national_number)&&void 0!==i?i:"",shouldSaveAddress:!1}}}const Ot=t(t=>new Ct(new bt(t,new et((0,e.vQ)()))),[{id:"paypalcommercepaypalcredit"}]);var At=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){this.paypalCommerceHeadlessWalletButtonService=e}initialize(e){return At(this,void 0,void 0,function*(){var t,n;const{paypalcommercevenmo:r,containerId:i,methodId:o}=e;if(!o)throw new G('Unable to initialize payment because "options.methodId" argument is not provided.');if(!i)throw new G('Unable to initialize payment because "options.containerId" argument is not provided.');if(!r)throw new G('Unable to initialize payment because "options.paypalcommercevenmo" argument is not provided.');let a;try{a=JSON.parse(atob(r.initializationData))}catch(e){throw new G("Failed to parse payment method 'initializationData'.")}const s=null===(n=null===(t=a.initializationData)||void 0===t?void 0:t.paymentButtonStyles)||void 0===n?void 0:n.cartButtonStyles;yield this.paypalCommerceHeadlessWalletButtonService.loadPayPalSdk(a,r.currency.code,!1),this.renderButton(i,"paypalcommerce.venmo",r.cartId,s)})}deinitialize(){return Promise.resolve()}renderButton(e,t,n,r){const i=this.paypalCommerceHeadlessWalletButtonService.getPayPalSdkOrThrow(),o={createOrder:()=>this.paypalCommerceHeadlessWalletButtonService.createPaymentOrderIntent(t,n),onApprove:e=>At(this,[e],void 0,function*({orderID:e}){yield this.paypalCommerceHeadlessWalletButtonService.proxyTokenizationPayment(n,t,"paypalcommercevenmo",e)})},a=Object.assign({fundingSource:i.FUNDING.VENMO,style:this.getValidVenmoButtonStyles(r)},o),s=i.Buttons(a);s.isEligible()?s.render(`#${e}`):this.paypalCommerceHeadlessWalletButtonService.removeElement(e)}getValidVenmoButtonStyles(e){const t=this.paypalCommerceHeadlessWalletButtonService.getValidButtonStyle(e);return t.color===pe.gold?Object.assign(Object.assign({},t),{color:void 0}):t}}const zt=t(t=>new Et(new bt(t,new et((0,e.vQ)()))),[{id:"paypalcommercevenmo"}])})(),module.exports=r})();
2
2
  //# sourceMappingURL=paypal-commerce.js.map