@zonos/elements 1.3.161 → 1.3.163

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 (36) hide show
  1. package/dist/cjs/index.cjs.js +47 -7
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/zonos-address_8.cjs.entry.js +11 -2
  4. package/dist/cjs/zonos-controller.cjs.entry.js +7 -7
  5. package/dist/cjs/zonos-elements.cjs.js +1 -1
  6. package/dist/collection/components/main/zonos-controller.js +7 -7
  7. package/dist/collection/components/stripe/zonos-address/zonos-address.js +12 -1
  8. package/dist/collection/scripts/_zonosBase.js +40 -0
  9. package/dist/esm/index.js +47 -7
  10. package/dist/esm/loader.js +1 -1
  11. package/dist/esm/zonos-address_8.entry.js +11 -2
  12. package/dist/esm/zonos-controller.entry.js +7 -7
  13. package/dist/esm/zonos-elements.js +1 -1
  14. package/dist/esm-es5/index.js +1 -1
  15. package/dist/esm-es5/loader.js +1 -1
  16. package/dist/esm-es5/zonos-address_8.entry.js +1 -1
  17. package/dist/esm-es5/zonos-controller.entry.js +1 -1
  18. package/dist/esm-es5/zonos-elements.js +1 -1
  19. package/dist/scripts/index.d.ts +6 -0
  20. package/dist/scripts/index.js +1 -1
  21. package/dist/scripts/loadZonos.js +1 -1
  22. package/dist/scripts/zonos.js +1 -1
  23. package/dist/types/components/stripe/zonos-address/zonos-address.d.ts +1 -0
  24. package/dist/types/scripts/_zonosBase.d.ts +6 -0
  25. package/dist/zonos-elements/index.esm.js +1 -1
  26. package/dist/zonos-elements/p-0cee00ae.system.js +1 -0
  27. package/dist/zonos-elements/{p-c522ddf2.entry.js → p-28a062f3.entry.js} +1 -1
  28. package/dist/zonos-elements/p-46f6e5e9.system.js +1 -1
  29. package/dist/zonos-elements/p-52bfe2bc.system.entry.js +1 -0
  30. package/dist/zonos-elements/{p-95aa4518.system.entry.js → p-6bbdc759.system.entry.js} +1 -1
  31. package/dist/zonos-elements/p-fb7b12af.entry.js +1 -0
  32. package/dist/zonos-elements/zonos-elements.esm.js +1 -1
  33. package/package.json +1 -1
  34. package/dist/zonos-elements/p-4968aa73.entry.js +0 -1
  35. package/dist/zonos-elements/p-b5d1fb0e.system.js +0 -1
  36. package/dist/zonos-elements/p-d8406c80.system.entry.js +0 -1
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(o,e,s,t){function n(o){return o instanceof s?o:new s((function(e){e(o)}))}return new(s||(s=Promise))((function(s,i){function a(o){try{l(t.next(o))}catch(o){i(o)}}function r(o){try{l(t["throw"](o))}catch(o){i(o)}}function l(o){o.done?s(o.value):n(o.value).then(a,r)}l((t=t.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,n,i,a;return a={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function r(o){return function(e){return l([o,e])}}function l(r){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,r[0]&&(s=0)),s)try{if(t=1,n&&(i=r[0]&2?n["return"]:r[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,r[1])).done)return i;if(n=0,i)r=[r[0]&2,i.value];switch(r[0]){case 0:case 1:i=r;break;case 4:s.label++;return{value:r[1],done:false};case 5:s.label++;n=r[1];r=[0];continue;case 7:r=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(r[0]===6||r[0]===2)){s=0;continue}if(r[0]===3&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(r[0]===6&&s.label<i[1]){s.label=i[1];i=r;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(r);break}if(i[2])s.ops.pop();s.trys.pop();continue}r=e.call(o,s)}catch(o){r=[6,o];n=0}finally{t=i=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,d as getElement}from"./index-d82f06f2.js";import{f as stripeStore,V as getFallbackDefaultCountryCode,l as localizationStore,r as translate,e as cartStore}from"./cart-41bdd9fb.js";import{i as isCheckoutMobile}from"./isCheckoutMobile-8846dccb.js";import{b as logError,l as log}from"./handleFetch-b4633675.js";import{i as isTextContainsNonLatinChars,c as containsNonLatinChars}from"./containsNonLatinChars-2d8810c3.js";import{z as zonosStore,d as zonosStoreFontFamily}from"./zonosStore-71d7e02f.js";import{c as classes}from"./classes-0d95c529.js";import{R as RemoveIcon$1}from"./RemoveIcon-9dc5dd1a.js";import{g as getBorderRadius}from"./getBorderRadius-740610fb.js";import{i as isDarkColor}from"./isDarkColor-2f59d721.js";var zonosAddressCss=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";var ZonosAddressStyle0=zonosAddressCss;var ZonosAddress=function(){function o(o){registerInstance(this,o);this.invalidCharacters=createEvent(this,"invalidCharacters",7);this.isAutoCompleteAdjusted=false;this.type=undefined;this.titleText=undefined;this.defaultAddress=null;this.stripe=window.Zonos.stripe;this.isDirtyAddress=false}o.prototype.getStripeAddressInstance=function(){if(this.type==="billing"){return{stripeAddressElement:stripeStore.stripeBillingAddressElement,stripeAddressEventData:stripeStore.stripeBillingAddressEventData,stripeElements:stripeStore.stripeElementsForBillingAddress}}return{stripeAddressElement:stripeStore.stripeAddressElement,stripeAddressEventData:stripeStore.stripeAddressEventData,stripeElements:stripeStore.stripeElements}};o.prototype.updateAddressEventData=function(o){var e=o.event,s=o.type;switch(s){case"billing":stripeStore.stripeBillingAddressEventData=e;break;default:stripeStore.stripeAddressEventData=e;break}};o.prototype.updateAddressElement=function(o){var e=o.stripeAddressElement,s=o.type;if(s==="shipping"){stripeStore.stripeAddressElement=e;return}stripeStore.stripeBillingAddressElement=e};o.prototype.watchInitStripe=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,s,t,n,i,a,r,l,d,c,h;var f=this;return __generator(this,(function(u){this.stripe=window.Zonos.stripe;s=this.getStripeAddressInstance(),t=s.stripeAddressEventData,n=s.stripeElements;if(!this.stripe||!n){logError("Stripe is not initialized. Couldn't load stripe element.");return[2]}i=(o=this.defaultAddress)===null||o===void 0?void 0:o.phone;if(!i){(e=this.defaultAddress)===null||e===void 0?true:delete e.phone}a=localizationStore.shippingZoneCountries;r=a?Object.values(a).map((function(o){return o.code})):[];l=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries");d=this.type==="shipping"?r:[];c=(t===null||t===void 0?void 0:t.value.address.country)||getFallbackDefaultCountryCode(d);log("Stripe country code: ".concat(c),"info");h=n.create("address",{allowedCountries:l?[]:d,contacts:this.defaultAddress&&!t?[this.defaultAddress]:[],defaultValues:{address:Object.assign(Object.assign({},t===null||t===void 0?void 0:t.value.address),{country:c}),firstName:t===null||t===void 0?void 0:t.value.firstName,lastName:t===null||t===void 0?void 0:t.value.lastName,phone:t===null||t===void 0?void 0:t.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});h.mount(this.el.querySelector(".zonos--address-component"));h.on("change",(function(o){var e=o.value;if(!f.isDirtyAddress&&e.address.line1.length>=3){f.isDirtyAddress=true;setTimeout((function(){if(!f.isAutoCompleteAdjusted){var o=f.el.querySelector('iframe[src*="autocomplete-suggestions"]');if(o){o.style.zIndex="2"}f.isAutoCompleteAdjusted=true}if(isCheckoutMobile()){f.el.scrollIntoView({behavior:"smooth",block:"end"})}else{var e=f.type==="shipping"?100:600;var s=f.el.closest(".zonos--group");var t=f.el.getBoundingClientRect().top+e;s===null||s===void 0?void 0:s.scrollTo({behavior:"smooth",top:t})}}),600)}f.updateAddressEventData({event:Object.assign(Object.assign({},o),{elementMode:f.type,elementType:"address",value:Object.assign(Object.assign({},e),{firstName:e.firstName||e.name.split(" ")[0],lastName:e.lastName||e.name.split(" ")[1]})}),type:f.type})}));this.updateAddressElement({stripeAddressElement:h,type:this.type});return[2]}))}))};o.prototype.disconnectedCallback=function(){var o=this.getStripeAddressInstance().stripeAddressElement;o===null||o===void 0?void 0:o.destroy()};o.prototype.componentDidLoad=function(){var o=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!o&&o.value.address.line1.length>0;void this.watchInitStripe()};o.prototype.render=function(){return h(Host,{key:"2bc89330a07e2f14f21805d8d38a5455b85cf295",class:"zonos--address zonos--elements"},h("zonos-text",{key:"17f156c41379d68822f605e7fd4a8329d32b7dee",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"5f032eab47ca5751ee38ea644d00255d9d12a588",class:"zonos--address-component"}))};Object.defineProperty(o.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{stripe:["watchInitStripe"]}},enumerable:false,configurable:true});return o}();ZonosAddress.style=ZonosAddressStyle0;var zonosAddressDisplayCss=':host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--title{margin-bottom:12px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:4px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-line{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .zonos--address-line zonos-text+zonos-text::before{content:", ";color:var(--zonos-elements-gray-1000);margin-right:4px}:host .zonos--country-flag{width:20px;height:14px;border-radius:2px;margin:1px;position:relative;overflow:hidden;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);margin-right:8px;z-index:10;justify-self:center}';var ZonosAddressDisplayStyle0=zonosAddressDisplayCss;var ZonosAddressDisplay=function(){function o(o){registerInstance(this,o);this.currentAddress=undefined;this.addressType=undefined}o.prototype.render=function(){var o;var e=this.currentAddress,s=e.city,t=e.country,n=e.email,i=e.line1,a=e.line2,r=e.name,l=e.phone,d=e.postal_code,c=e.state;var f=(o=localizationStore.shippingZoneCountries)===null||o===void 0?void 0:o[t];var u=function(o){var e=o.bold,s=o.content;var t=isTextContainsNonLatinChars(s)?"red-600":"gray-1000";return h("zonos-text",{textColor:t,type:e?"boldLabel":"body"},s)};return h(Host,{class:"zonos--address-form zonos--elements"},h("div",{class:"zonos--title"},h("zonos-text",{textColor:"gray-700",type:"smallHeader"},this.addressType==="shipping"?translate("Shipping"):translate("Billing"))),h("div",{class:"zonos--address-group"},r&&h("div",{class:"zonos--address-line"},u({bold:true,content:r})),n&&h("div",{class:"zonos--address-line"},u({content:n})),l&&h("div",{class:"zonos--address-line"},u({content:l})),i&&h("div",{class:"zonos--address-line"},u({content:i})),a&&h("div",{class:"zonos--address-line"},u({content:a})),h("div",{class:"zonos--address-line"},s&&u({content:s}),c&&u({content:c}),d&&u({content:d})),f&&h("div",{class:"zonos--address-line"},h("zonos-country-flag",{class:"zonos--country-flag",countryCode:f.code})," ",u({content:f.displayName}))))};return o}();ZonosAddressDisplay.style=ZonosAddressDisplayStyle0;var zonosAddressFormCss=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--title{margin-bottom:20px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:20px;-ms-flex-direction:column;flex-direction:column;margin:1px}:host .zonos--contact{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-row{display:-ms-flexbox;display:flex;gap:8px}:host .zonos--address-row>*{-ms-flex:1;flex:1}:host .zonos--address{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}";var ZonosAddressFormStyle0=zonosAddressFormCss;var ZonosAddressForm=function(){function o(o){var e=this;registerInstance(this,o);this.addressChange=createEvent(this,"addressChange",7);this.onInputChange=function(o){var s;var t=o.key,n=o.value;e.addressChange.emit(Object.assign(Object.assign({},e.localAddress),(s={},s[t]=n,s)))};this.currentAddress=undefined;this.translatedAddress=undefined;this.addressType=undefined;this.localAddress=this.currentAddress}o.prototype.watchCurrentAddress=function(){var o,e,s,t,n,i;var a=this.currentAddress,r=a.city,l=a.line1,d=a.line2,c=a.name,h=a.postal_code,f=a.state;this.localAddress=Object.assign(Object.assign({},this.currentAddress),{city:((o=this.translatedAddress.city)===null||o===void 0?void 0:o[r])||r,line1:((e=this.translatedAddress.line1)===null||e===void 0?void 0:e[l])||l,line2:((s=this.translatedAddress.line2)===null||s===void 0?void 0:s[d])||d,name:((t=this.translatedAddress.name)===null||t===void 0?void 0:t[c])||c,postal_code:((n=this.translatedAddress.postal_code)===null||n===void 0?void 0:n[h])||h,state:((i=this.translatedAddress.state)===null||i===void 0?void 0:i[f])||f})};o.prototype.componentWillLoad=function(){this.watchCurrentAddress()};o.prototype.render=function(){var o=this;var e=this.localAddress,s=e.city,t=e.country,n=e.line1,i=e.line2,a=e.name,r=e.phone,l=e.postal_code,d=e.state;var c=a.split(" ")[0]||"";var f=a.split(" ").slice(1).join(" ")||"";return h(Host,{key:"8b578737e33203a23563be7e9be0778deec99bbf",class:"zonos--address-form zonos--elements"},h("div",{key:"793675a1348547bf3f781788956befe325191011",class:"zonos--title"},h("zonos-text",{key:"13de35cb0a7c98a48342e3fb86ae3ade9f5b88d9",textColor:"gray-700",type:"smallHeader"},this.addressType==="shipping"?translate("Shipping"):translate("Billing"))),h("div",{key:"2c5de5b5283fb99ee5f8b61d7a217177986fc2db",class:"zonos--address-group"},h("div",{key:"23bf3c893071000d5995a5f175867bab11929193",class:"zonos--contact"},h("zonos-text",{key:"7cdfe2a84ebad89ba5b16498d75def99cf392384",type:"label"},translate("Contact")),h("zonos-input",{key:"1c39c38767fd306c5eb1164cdc989b8291209cf0",class:"zonos--form-email",inputLabel:translate("Email"),inputValue:this.currentAddress.email,isDisabled:true}),h("div",{key:"cbdf61217125e22b1a6cec9a340ef0aca2c75670",class:"zonos--name zonos--address-row"},h("zonos-input",{key:"360c99e7b2c6caa64580d5768b5bb53368927275",class:"zonos--form-first-name",inputLabel:translate("First name"),inputValue:c,isError:isTextContainsNonLatinChars(c),onInputChange:function(e){return o.onInputChange({key:"name",value:"".concat(e.detail," ").concat(f)})}}),h("zonos-input",{key:"8ce5fa5c15c6f7928339ea10009ce0e68954a91f",class:"zonos--form-last-name",inputLabel:translate("Last name"),inputValue:f,isError:isTextContainsNonLatinChars(f),onInputChange:function(e){return o.onInputChange({key:"name",value:"".concat(c," ").concat(e.detail)})}}))),h("div",{key:"7b4fa2d3baa6cb257e7688e5ba6777123898b3fd",class:"zonos--address"},h("zonos-text",{key:"9d5782331b2642755a755aeb7f98c9f4d87f9a20",type:"label"},translate("Address")),h("zonos-input",{key:"a622025924ca86bdbf1d3c04b79e6dee172b4c42",class:"zonos--form-country",inputLabel:translate("Country"),inputValue:t,isDisabled:true}),h("zonos-input",{key:"f99b3a74db09ab5730878e80705b9aeac76bf800",class:"zonos--form-line1",inputLabel:translate("Address line 1"),inputValue:n,isError:isTextContainsNonLatinChars(n),onInputChange:function(e){return o.onInputChange({key:"line1",value:e.detail})}}),h("zonos-input",{key:"5d16aefa45a78045c87d166aaaec0255606e455e",class:"zonos--form-line2",inputLabel:translate("Address line 2"),inputValue:i,isError:isTextContainsNonLatinChars(i),onInputChange:function(e){return o.onInputChange({key:"line2",value:e.detail})}}),h("div",{key:"dc166be9381142835d72e731cb38a718522a068a",class:"zonos--address-row"},h("zonos-input",{key:"4f1a98f9d10ce0cff3ef18a3037a12382552b31d",class:"zonos--form-city",inputLabel:translate("City"),inputValue:s,isError:isTextContainsNonLatinChars(s),onInputChange:function(e){return o.onInputChange({key:"city",value:e.detail})}}),h("zonos-input",{key:"d4f97900b5fe2e1619950a52d1d1f716a8bc19ff",class:"zonos--form-state",inputLabel:translate("State/Province"),inputValue:d,isError:isTextContainsNonLatinChars(d),onInputChange:function(e){return o.onInputChange({key:"state",value:e.detail})}})),h("zonos-input",{key:"cf1eb0ca5cd15c8412a2e1246aaf2e39361dc733",class:"zonos--form-postal-code",inputLabel:translate("Postal code"),inputValue:l,isError:isTextContainsNonLatinChars(l),onInputChange:function(e){return o.onInputChange({key:"postal_code",value:e.detail})}}),h("zonos-input",{key:"7421c82847eded6bdbcce49ef8196124d8e50c1d",class:"zonos--form-phone",inputLabel:translate("Phone number"),inputValue:r,onInputChange:function(e){return o.onInputChange({key:"phone",value:e.detail})}}))))};Object.defineProperty(o,"watchers",{get:function(){return{translatedAddress:["watchCurrentAddress"]}},enumerable:false,configurable:true});return o}();ZonosAddressForm.style=ZonosAddressFormStyle0;var zonosAddressUpdateDialogCss=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";var ZonosAddressUpdateDialogStyle0=zonosAddressUpdateDialogCss;var ZonosAddressUpdateDialog=function(){function o(o){var e=this;registerInstance(this,o);this.closeUpdateDialog=createEvent(this,"closeUpdateDialog",7);this.continueClicked=createEvent(this,"continueClicked",7);this.closeUpdateDialogHandler=function(){e.closeUpdateDialog.emit()};this.getTranslatedAddress=function(o){var e=o.currentAddress,s=o.translatedAddress;var t,n,i,a,r,l;var d=e.city,c=e.line1,h=e.line2,f=e.name,u=e.postal_code,p=e.state;return{city:((t=s.city)===null||t===void 0?void 0:t[d])||d,line1:((n=s.line1)===null||n===void 0?void 0:n[c])||c,line2:((i=s.line2)===null||i===void 0?void 0:i[h])||h,name:((a=s.name)===null||a===void 0?void 0:a[f])||f,postal_code:((r=s.postal_code)===null||r===void 0?void 0:r[u])||u,state:((l=s.state)===null||l===void 0?void 0:l[p])||p}};this.continueClickHandler=function(){return __awaiter(e,void 0,void 0,(function(){var o,e,s,t,n,i,a,r,l,d,c,h,f;return __generator(this,(function(u){this.continueLoading=true;t=this.billingAddress?this.getTranslatedAddress({currentAddress:this.billingAddress,translatedAddress:this.translatedBillingAddressState}):null;n=this.getTranslatedAddress({currentAddress:this.shippingAddress,translatedAddress:this.translatedShippingAddressState});i=containsNonLatinChars(Object.assign(Object.assign({},n),{country:this.shippingAddress.country}));a=t&&this.billingAddress&&containsNonLatinChars(Object.assign(Object.assign({},t),{country:this.billingAddress.country}));r=!!Object.keys(i).length;l=!!a&&!!Object.keys(a).length;if(r||l){d=(o=this.el.shadowRoot)===null||o===void 0?void 0:o.querySelectorAll("zonos-address-form");c=d===null||d===void 0?void 0:d[0];h=d===null||d===void 0?void 0:d[1];f=((e=c===null||c===void 0?void 0:c.shadowRoot)===null||e===void 0?void 0:e.querySelector(".has-error"))||((s=h===null||h===void 0?void 0:h.shadowRoot)===null||s===void 0?void 0:s.querySelector(".has-error"));if(f){f.scrollIntoView({behavior:"smooth",block:"center"})}this.continueLoading=false;return[2]}this.continueClicked.emit({billingAddress:t,shippingAddress:n});return[2]}))}))};this.buildTranslateAddressState=function(o){var e,s,t,n,i,a;var r=o.currentAddress,l=o.translatedAddress;var d=r.city,c=r.line1,h=r.line2,f=r.name,u=r.postal_code,p=r.state;return{city:(e={},e[d]=l.city,e),line1:(s={},s[c]=l.line1,s),line2:(t={},t[h]=l.line2,t),name:(n={},n[f]=l.name,n),postal_code:(i={},i[u]=l.postal_code,i),state:(a={},a[p]=l.state,a)}};this.continueLoading=false;this.dialogLoading=undefined;this.dialogOpen=false;this.submitBtnType=undefined;this.submitBtnColor=undefined;this.isMobile=false;this.shippingAddress=undefined;this.billingAddress=undefined;this.translatedShippingAddress=undefined;this.translatedBillingAddress=undefined;this.showErrorBanner=false;this.translatedShippingAddressState={};this.translatedBillingAddressState={}}o.prototype.watchTranslatedShippingAddress=function(){this.translatedShippingAddressState=this.translatedShippingAddress};o.prototype.watchTranslatedBillingAddress=function(){this.translatedBillingAddressState=this.translatedBillingAddress};o.prototype.componentWillLoad=function(){this.watchTranslatedBillingAddress();this.watchTranslatedShippingAddress()};o.prototype.render=function(){var o=this;var e=this.submitBtnColor||zonosStore.appearance.colorSecondary;var s=e==="#ffffff"?"outline":this.submitBtnType||"standard";var t=this.billingAddress;var n=this.shippingAddress;return h(Host,{key:"655845cef04f4af526b1a1c4e49243c4f2b4c7f6",class:classes(["zonos--address-update-dialog zonos--elements",this.isMobile&&"mobile"])},h("zonos-dialog",{key:"eab429bb78ce6f05ba463d8748d7edd5499402fa",isLoading:this.dialogLoading,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return o.closeUpdateDialog.emit()},open:this.dialogOpen,width:"568px"},h("div",{key:"08f0400e62addfcaffd91bf5200999d29bbd2da9",class:"zonos--body"},h("div",{key:"8699df5e2f823e19066fbb552ba2a66c127c05e9",class:"zonos--dialog-header"},h("div",{key:"92e0ff932dcdb0e5b59ea34b688d1ef8e31bfeb3",class:"zonos--dialog-title"},h("zonos-text",{key:"aaac3375526bddb319ce7c8f49bde30da7210264",type:"title"},translate("Update your address")),h("zonos-button",{key:"66abf7b74045e68e84e631298504236d32ca9c4e",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon$1}),noBackground:true,onClick:function(){return o.closeUpdateDialogHandler()}})),h("zonos-text",{key:"ffb3d8f169867d5f6dff269e1becd99c98c5a7da"},translate("To ensure delivery all address details must be in Latin characters."))),h("div",{key:"2cb61f06ce174e2317870decfdd337c67c5cf128",class:"zonos--group"},h("zonos-text",{key:"a616c540984120b468e52bccfb380ea3974ced22",class:"zonos--what-you-entered",type:"semiBoldLabel"},translate("What you entered")),h("div",{key:"6ac8f9c14472370c501af1b0d50bd8f8746b7694",class:"zonos--address-display-group"},h("zonos-address-display",{key:"ea2c67a7bba51c99f80be968e448beeffcf1f863",addressType:"shipping",currentAddress:n}),t&&h("zonos-address-display",{key:"7ea1683dc04a292810e04ed6550d86086f25186f",addressType:"billing",currentAddress:t})),h("div",{key:"4d1cd9096943518b8b4e267608a5e1542befb6a9",class:"zonos--address-form-section"},h("zonos-text",{key:"e4184a2cc618d26d43979fa8cfe06070cf8b5af8",type:"semiBoldLabel"},translate("Translated address")),h("zonos-address-form",{key:"c55d9d3c658565ceb7c7b879f444e3937b9f7ad6",addressType:"shipping",class:"zonos--shipping-address-form",currentAddress:n,onAddressChange:function(e){var s=e.detail;o.translatedShippingAddressState=o.buildTranslateAddressState({currentAddress:n,translatedAddress:s})},translatedAddress:this.translatedShippingAddressState}),t&&h("zonos-address-form",{key:"c3facc295b1322bb00baa6081f343dcea4f10777",addressType:"billing",class:"zonos--billing-address-form",currentAddress:t,onAddressChange:function(e){var s=e.detail;o.translatedBillingAddressState=o.buildTranslateAddressState({currentAddress:t,translatedAddress:s})},translatedAddress:this.translatedBillingAddressState}))),h("div",{key:"1c89c9604ba0dece40275fcfac97e7f93706b430",class:"zonos--group-btn"},h("div",{key:"e47d393940b094b4e123864e4070daa87f0616f0",class:"zonos--button-wrapper"},h("zonos-button",{key:"216b7afe268a4acd6bb8a76b7f5a32dc09bdd4f6",class:"zonos--cancel-btn",onClick:function(){return o.closeUpdateDialogHandler()},variant:"subtle"},translate("Cancel")),h("zonos-button",{key:"acbacb92cedb325b46843d8f3aff13f4e7c86ab5",backgroundColor:this.submitBtnColor,class:"zonos--update-btn",loading:this.continueLoading,onClick:function(){return o.continueClickHandler()},size:"sm",variant:s},translate("Update address")))))))};Object.defineProperty(o.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{translatedShippingAddress:["watchTranslatedShippingAddress"],translatedBillingAddress:["watchTranslatedBillingAddress"]}},enumerable:false,configurable:true});return o}();ZonosAddressUpdateDialog.style=ZonosAddressUpdateDialogStyle0;var colorPrefixes=["blue","cyan","green","orange","purple","red","gray","glass"];var zonosCheckboxCss=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer}:host label{display:-ms-inline-flexbox;display:inline-flex;position:relative;gap:8px;-ms-flex-align:center;align-items:center}:host label.disabled{cursor:not-allowed;opacity:0.6}:host input[type=checkbox]{opacity:0;position:absolute;left:0;width:0;height:0;top:0;z-index:-99999}:host svg{opacity:0}:host .checkmark-container{height:var(--zonos--size);width:var(--zonos--size);background-color:transparent;border:1.5px solid var(--zonos-elements-gray-400);position:relative;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-4))}:host .checkmark{opacity:0;position:absolute;top:-1.5px;left:-1.5px;right:-1.5px;bottom:-1.5px;width:calc(100% + 3px);-webkit-transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);-webkit-transform:scale(0.4);transform:scale(0.4);background-color:var(--zonos--background-color);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-4))}:host input[type=checkbox]:checked~.checkmark-container .checkmark{opacity:1;-webkit-transform:scale(1);transform:scale(1)}";var ZonosCheckboxStyle0=zonosCheckboxCss;var ZonosCheckbox=function(){function o(o){registerInstance(this,o);this.checkboxSelected=createEvent(this,"checkboxSelected",7);this.backgroundColor="blue";this.label=undefined;this.isChecked=false;this.isDisabled=false;this.size=12;this.fontSize="base";this.borderStyle=undefined}o.prototype.onClick=function(){if(this.isDisabled){return}this.checkboxSelected.emit(!this.isChecked)};o.prototype.render=function(){var o=this;var e=colorPrefixes.includes(this.backgroundColor);var s=e?"var(--zonos-elements-".concat(this.backgroundColor,"-600)"):this.backgroundColor;var t=e?"var(--zonos-elements-".concat(this.backgroundColor,"-200)"):!isDarkColor(s)?"var(--zonos-elements-gray-800)":"var(--zonos-elements-gray-0)";var n=getBorderRadius({customRoundRadius:"4px",overrideBorderStyle:this.borderStyle});return h(Host,{key:"7a2972128b04d5dffe09f60b5292d90f7201066a",class:classes(["zonos--elements zonos--checkbox"]),style:{"--zonos--background-color":s,"--zonos--border-radius":n,"--zonos--font-family":zonosStoreFontFamily(),"--zonos--size":"".concat(this.size,"px")}},h("label",{key:"b18d0f091b783555b4b3a1fc2b5d5cb1c62a9d41",class:classes([this.isDisabled&&"disabled"])},h("input",{key:"f3b86525ef7988d6df87f9147f5aa22b447c1303",checked:this.isChecked,disabled:this.isDisabled,hidden:true,onChange:function(e){o.checkboxSelected.emit(e.target.checked)},type:"checkbox"}),h("span",{key:"2007c2fbc4d8437f75b9a3d7a4e65d394922abf4",class:"checkmark-container"},h("svg",{key:"481b9272c99cf464d8d88ab24a8dba35de921abf",class:"checkmark",color:t,fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},h("path",{key:"ab7690fba113135175248c8926907312dfe478d5","clip-rule":"evenodd",d:"M17.456 7.404a.75.75 0 0 1 .14 1.052l-6.5 8.5a.75.75 0 0 1-1.126.074l-4-4a.75.75 0 0 1 1.06-1.06l3.395 3.394 5.98-7.82a.75.75 0 0 1 1.05-.14Z",fill:"currentColor","fill-rule":"evenodd"}))),this.label&&h("zonos-text",{key:"99689099e7469f2ff928619daa2fcee0ce35a418",size:this.fontSize},this.label)))};return o}();ZonosCheckbox.style=ZonosCheckboxStyle0;var RemoveIcon='<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>';var zonosDialogCss=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:2147483009;background:var(--zonos-elements-gray-0);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:2147483008;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;min-height:var(--zonos--min-height, auto);height:var(--zonos--height, auto);width:var(--zonos--width, auto);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:16px 24px}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--zonos-elements-radius-10);-ms-flex-item-align:start;align-self:flex-start}:host .zonos--header .zonos--close-button:hover{background:var(--zonos-elements-hover-color)}:host .zonos--body{padding:8px 24px;max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:16px 24px}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483008;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:2147483009;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";var ZonosDialogStyle0=zonosDialogCss;var ZonosDialog=function(){function o(o){var e=this;registerInstance(this,o);this.closeDialog=createEvent(this,"closeDialog",3);this.isMobileMode=function(){return e.mobile||window.innerWidth<=768};this.closeButtonHandler=function(){if(!e.open){return}e.closeDialog.emit()};this.clickOutsideDialogHandler=function(o){if(o.target===o.currentTarget&&!e.noClickOutside){e.closeDialog.emit()}};this.open=false;this.headerText="";this.width="460px";this.height=undefined;this.minHeight=undefined;this.noHeader=false;this.noBodyPadding=false;this.noBorder=false;this.borderStyle=undefined;this.noCloseButton=false;this.noClickOutside=false;this.mobile=false;this.isLoading=true;this.isMobile=false}o.prototype.handleWindowResize=function(){this.isMobile=this.isMobileMode()};o.prototype.handleKeyDown=function(o){if(o.key==="Escape"){this.closeButtonHandler()}};o.prototype.componentDidLoad=function(){this.isMobile=this.isMobileMode()};o.prototype.render=function(){var o=getBorderRadius({overrideBorderStyle:this.borderStyle});return h(Host,{key:"a9932187bccf8e7fa505c7e07175d03541d66852",class:classes(["zonos--elements",this.open&&"open",this.isLoading&&"is-loading",this.noBorder&&"no-border",this.isMobile&&"mobile"]),style:{"--zonos--border-radius":o,"--zonos--font-family":zonosStoreFontFamily(),"--zonos--height":this.height||"initial","--zonos--min-height":this.minHeight||"500px","--zonos--width":this.width}},h("div",{key:"0298cf365a50e3544656a6d27ae59e922b9e3aed",class:"zonos--backdrop"}),h("div",{key:"9fce580a07147d51f17c898a22204c3d9ce6ac7b",class:"zonos--dialog-layout",inert:!this.open,onClick:this.clickOutsideDialogHandler},h("div",{key:"b168439cd985cc5c0166a653db206688504cf7dd",class:"zonos--dialog"},this.isLoading&&h("div",{key:"e0b6215f3c7bc939721669069bc294e08558d8b5",class:"zonos--loading"},h("zonos-spinner",{key:"687bcd6d2695933de828484c34aff1230bf71d49",size:30})),(this.headerText||!this.noCloseButton)&&h("div",{key:"04a57a4add896e3d96faca8b77321bba5f00b889",class:"zonos--header"},this.headerText&&h("h3",{key:"d084cb3aedcb7e5bb8fd82012b57f441d7dce4a2",class:"zonos--header-text"},this.headerText),!this.noCloseButton&&h("zonos-button",{key:"7b73bd57b8651fd3f3ebd29e3c252bd83d9375ee",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close dialog",content:RemoveIcon}),noBackground:true,onClick:this.closeButtonHandler,variant:"subtle"})),h("div",{key:"7af04c281b6410b87bfe53913e74fa215f6de24b",class:classes(["zonos--body",this.noBodyPadding&&"zonos--no-body-padding"])},h("slot",{key:"8c6ce4437d2bc98f9eccea0280cee31794883b77"})),h("slot",{key:"11f97e705b3cc1bad11c037ede940d2f392d67e7",name:"dialog-footer"}))))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}();ZonosDialog.style=ZonosDialogStyle0;var validateEmailValue=function(o){var e=/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/;return e.test(o)};var zonosLinkAuthenticationCss=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";var ZonosLinkAuthenticationStyle0=zonosLinkAuthenticationCss;var ZonosLinkAuthentication=function(){function o(o){var e=this;registerInstance(this,o);this.linkAuthenticationChange=createEvent(this,"linkAuthenticationChange",7);this.setCustomEmailInputToLinkEvent=function(o){var e=validateEmailValue(o);var s={complete:!!e,elementType:"linkAuthentication",empty:!o,value:{email:o}};stripeStore.stripeLinkEventData=s};this.handleNormalEmailInput=function(o){var s;var t=o.detail;e.setCustomEmailInputToLinkEvent(t);(s=e.linkAuthenticationChange)===null||s===void 0?void 0:s.emit()};this.titleText=undefined;this.defaultEmail=null;this.isEmailError=false;this.stripe=stripeStore.stripe;this.isStagingMode=cartStore.isStagingMode;this.clientSecret=stripeStore.clientSecret}o.prototype.watchIsStagingMode=function(){var o=this;setTimeout((function(){o.watchInitStripe()}),0)};o.prototype.watchInitStripe=function(){var o=this;if(!this.stripe||!stripeStore.stripeElements){return}if(cartStore.isStagingMode||!this.clientSecret){return}var e=this.defaultEmail?{email:this.defaultEmail}:undefined;var s=stripeStore.stripeLinkElement||stripeStore.stripeElements.create("linkAuthentication",{defaultValues:e||undefined});var t=this.el.querySelector(".zonos--link-authentication-component");if(!t){logError("Cannot find container element for linkAuthenticationElement");return}s.mount(t);s.on("change",(function(e){var s;stripeStore.stripeLinkEventData=e;(s=o.linkAuthenticationChange)===null||s===void 0?void 0:s.emit()}));stripeStore.stripeLinkElement=s};o.prototype.watchDefaultEmail=function(){if(!this.defaultEmail){return}this.setCustomEmailInputToLinkEvent(this.defaultEmail)};o.prototype.componentDidLoad=function(){this.watchInitStripe();if(!this.defaultEmail){return}this.setCustomEmailInputToLinkEvent(this.defaultEmail)};o.prototype.render=function(){var o=this;this.isStagingMode=cartStore.isStagingMode;this.clientSecret=stripeStore.clientSecret;var e=function(){var e;if(cartStore.isStagingMode){return h("zonos-stripe-input",{inputLabel:translate("Email"),inputValue:o.defaultEmail||((e=stripeStore.stripeLinkEventData)===null||e===void 0?void 0:e.value.email)||"",isError:o.isEmailError,onBlur:function(){var e;var s=((e=stripeStore.stripeLinkEventData)===null||e===void 0?void 0:e.value.email)||"";if(!s){return}var t=validateEmailValue(s);o.isEmailError=!t},onInputChange:o.handleNormalEmailInput})}return h("div",{class:"zonos--link-authentication-component ".concat(o.isEmailError&&"zonos--input-invalid")})};return h(Host,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":getBorderRadius()}},h("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),e(),this.isEmailError&&h("zonos-text",{textColor:"red-600"},translate("Please enter a valid email address.")))};Object.defineProperty(o.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}},enumerable:false,configurable:true});return o}();ZonosLinkAuthentication.style=ZonosLinkAuthenticationStyle0;var zonosStripeInputCss=':host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{--zonos--background-color:#f1f1f1;--zonos--local-glowing-color:0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 0 0 1px var(--zonos--primary-color);--zonos--border:1px solid #e8e8e8}:host(.dark){color-scheme:dark;--zonos--background-color:#30313d;--zonos--local-glowing-color:0px 2px 4px rgba(0, 0, 0, 0.5),\n 0px 1px 6px rgba(0, 0, 0, 0.25), 0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 1px 1px 0 rgba(255, 255, 255, 0.12);--zonos--border:1px solid var(--zonos--primary-color)}:host{margin:1px;height:calc(var(--zonos-elements-size-xl) - 2px);}:host .zonos--label-wrapper{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:100%;width:100%;background:var(--zonos--background-color);border-radius:var(--zonos--border-radius);border:var(--zonos--border);outline-offset:0;outline-width:2px}:host .zonos--floated-input{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;padding:0 16px;outline:none;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);width:100%;border-radius:var(--zonos--border-radius);background:var(--zonos--background-color);border:var(--zonos--border);-ms-flex-order:2;order:2;font-weight:400;font-size:var(--zonos--font-size)}:host .zonos--floated-input :-internal-autofill-selected{border-radius:var(--zonos-elements-radius-6) 0 0 var(--zonos-elements-radius-6)}:host .zonos--floated-input :-internal-autofill-selected+label+div{background-color:#e8f0fe}:host .zonos--floated-input.has-label{padding:24px 4px 2px 16px}:host .zonos--floated-input.has-label.has-input-prefix{padding-left:0}:host .zonos--floated-input.has-label.has-input-prefix~.zonos--floated-label label{margin-left:0}:host .zonos--floated-input:not(.has-label)::-webkit-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input:not(.has-label)::-moz-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input:not(.has-label):-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input:not(.has-label)::-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input:not(.has-label)::placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input::-webkit-input-placeholder{-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}:host .zonos--floated-input::-moz-placeholder{-moz-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}:host .zonos--floated-input:-ms-input-placeholder{-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}:host .zonos--floated-input::-ms-input-placeholder{-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}:host .zonos--floated-input::placeholder{-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}:host .zonos--floated-input:focus{outline:none;border:var(--zonos--border)}:host .zonos--floated-input:focus~.zonos--floated-label::after{-webkit-box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color));box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color))}:host .zonos--floated-input.has-error+.zonos--floated-label::after{-webkit-box-shadow:0 0 0 2px #df1b41;box-shadow:0 0 0 2px #df1b41}:host .zonos--floated-input.has-content::-webkit-input-placeholder,:host .zonos--floated-input:focus::-webkit-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input.has-content::-moz-placeholder,:host .zonos--floated-input:focus::-moz-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input.has-content:-ms-input-placeholder,:host .zonos--floated-input:focus:-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input.has-content::-ms-input-placeholder,:host .zonos--floated-input:focus::-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input.has-content::placeholder,:host .zonos--floated-input:focus::placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input.has-content~.zonos--floated-label label,:host .zonos--floated-input:focus~.zonos--floated-label label{top:11px;-webkit-transform:scale(0.8);transform:scale(0.8)}:host .zonos--floated-input:-webkit-autofill,:host .zonos--floated-input:-moz-autofill{background-color:var(--zonos-elements-input-background);color:var(--zonos-elements-text-color)}:host .zonos--floated-label{display:block;max-height:0;pointer-events:none;-ms-flex-order:1;order:1}:host .zonos--floated-label label{color:var(--zonos-elements-gray-800);position:absolute;font-size:16px;line-height:16px;display:inline-block;-webkit-filter:blur(0);filter:blur(0);-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);margin-left:16px;top:calc(50% - 8px);z-index:1}:host .zonos--floated-label::after{content:"";position:absolute;left:0;right:0;top:0;bottom:0;border-radius:var(--zonos--border-radius)}:host .disabled .zonos--floated-label{pointer-events:inherit}:host .disabled .zonos--floated-label::after{cursor:not-allowed;z-index:1}:host(.dark) .zonos--label-wrapper{background:#30313d}';var ZonosStripeInputStyle0=zonosStripeInputCss;var ZonosStripeInput=function(){function o(o){registerInstance(this,o);this.inputChange=createEvent(this,"inputChange",7);this.inputValue="";this.inputLabel=undefined;this.overridePrimaryColor=undefined;this.overrideSecondaryColor=undefined;this.isDisabled=false;this.isError=false;this.inputPlaceholder="";this.value="";this.internalValue=this.inputValue}o.prototype.onInputValueChange=function(o){this.internalValue=o;this.inputChange.emit(o);this.value=o};o.prototype.onValueChange=function(o){this.internalValue=o};o.prototype.render=function(){var o=this;var e=this.overridePrimaryColor||zonosStore.appearance.colorPrimary;var s=this.overrideSecondaryColor||zonosStore.appearance.colorSecondary;var t=e&&isDarkColor(e);var n=zonosStore.appearance.fontSizeInputValue||16;return h(Host,{key:"d78f2aee99ac4e6d95cf1628e058e6d3bb70e309",class:classes(["zonos--input zonos--elements",t&&"dark",this.isError&&"has-error"]),"data-theme":t?"DARK":"LIGHT",style:{"--zonos--border-radius":getBorderRadius(),"--zonos--font-family":zonosStoreFontFamily(),"--zonos--font-size":"".concat(n,"px"),"--zonos--primary-color":s}},h("div",{key:"a3e7f765b0081a564c5955e387ff4b521a28d1a5",class:classes(["zonos--label-wrapper",this.isDisabled&&"disabled"])},h("input",{key:"181c5230ddeb02e9cea646b7f0a8efa3a530796e",class:classes(["zonos--floated-input",!!this.inputLabel&&"has-label",this.internalValue&&"has-content",this.isError&&"has-error"]),disabled:this.isDisabled,id:"zonos--input",onChange:function(e){var s=e.target;o.inputChange.emit(s.value);o.el.inputValue=s.value;o.el.dispatchEvent(new Event("change"))},placeholder:this.inputPlaceholder,type:"text",value:this.internalValue}),h("div",{key:"ac6e97971905ba130c3533da6a409de60f99ed6d",class:"zonos--floated-label"},h("label",{key:"1643ab4ef5b9449332351c854f8e43db8d192164",htmlFor:"zonos--input"},this.inputLabel))))};Object.defineProperty(o.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{inputValue:["onInputValueChange"],value:["onValueChange"]}},enumerable:false,configurable:true});return o}();ZonosStripeInput.style=ZonosStripeInputStyle0;export{ZonosAddress as zonos_address,ZonosAddressDisplay as zonos_address_display,ZonosAddressForm as zonos_address_form,ZonosAddressUpdateDialog as zonos_address_update_dialog,ZonosCheckbox as zonos_checkbox,ZonosDialog as zonos_dialog,ZonosLinkAuthentication as zonos_link_authentication,ZonosStripeInput as zonos_stripe_input};
1
+ var __awaiter=this&&this.__awaiter||function(o,e,s,t){function n(o){return o instanceof s?o:new s((function(e){e(o)}))}return new(s||(s=Promise))((function(s,i){function a(o){try{l(t.next(o))}catch(o){i(o)}}function r(o){try{l(t["throw"](o))}catch(o){i(o)}}function l(o){o.done?s(o.value):n(o.value).then(a,r)}l((t=t.apply(o,e||[])).next())}))};var __generator=this&&this.__generator||function(o,e){var s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,n,i,a;return a={next:r(0),throw:r(1),return:r(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function r(o){return function(e){return l([o,e])}}function l(r){if(t)throw new TypeError("Generator is already executing.");while(a&&(a=0,r[0]&&(s=0)),s)try{if(t=1,n&&(i=r[0]&2?n["return"]:r[0]?n["throw"]||((i=n["return"])&&i.call(n),0):n.next)&&!(i=i.call(n,r[1])).done)return i;if(n=0,i)r=[r[0]&2,i.value];switch(r[0]){case 0:case 1:i=r;break;case 4:s.label++;return{value:r[1],done:false};case 5:s.label++;n=r[1];r=[0];continue;case 7:r=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(r[0]===6||r[0]===2)){s=0;continue}if(r[0]===3&&(!i||r[1]>i[0]&&r[1]<i[3])){s.label=r[1];break}if(r[0]===6&&s.label<i[1]){s.label=i[1];i=r;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(r);break}if(i[2])s.ops.pop();s.trys.pop();continue}r=e.call(o,s)}catch(o){r=[6,o];n=0}finally{t=i=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host,d as getElement}from"./index-d82f06f2.js";import{f as stripeStore,V as getFallbackDefaultCountryCode,l as localizationStore,r as translate,e as cartStore}from"./cart-41bdd9fb.js";import{i as isCheckoutMobile}from"./isCheckoutMobile-8846dccb.js";import{b as logError,l as log}from"./handleFetch-b4633675.js";import{i as isTextContainsNonLatinChars,c as containsNonLatinChars}from"./containsNonLatinChars-2d8810c3.js";import{z as zonosStore,d as zonosStoreFontFamily}from"./zonosStore-71d7e02f.js";import{c as classes}from"./classes-0d95c529.js";import{R as RemoveIcon$1}from"./RemoveIcon-9dc5dd1a.js";import{g as getBorderRadius}from"./getBorderRadius-740610fb.js";import{i as isDarkColor}from"./isDarkColor-2f59d721.js";var zonosAddressCss=".sc-zonos-address-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-address-h *.sc-zonos-address{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-address-h img.sc-zonos-address{max-width:100%}.sc-zonos-address-h dl.sc-zonos-address,.sc-zonos-address-h dd.sc-zonos-address,.sc-zonos-address-h h1.sc-zonos-address,.sc-zonos-address-h h2.sc-zonos-address,.sc-zonos-address-h h3.sc-zonos-address,.sc-zonos-address-h h4.sc-zonos-address,.sc-zonos-address-h h5.sc-zonos-address,.sc-zonos-address-h h6.sc-zonos-address,.sc-zonos-address-h hr.sc-zonos-address,.sc-zonos-address-h figure.sc-zonos-address,.sc-zonos-address-h p.sc-zonos-address,.sc-zonos-address-h pre.sc-zonos-address{margin:0}.sc-zonos-address-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-address-h .zonos--title.sc-zonos-address{margin-bottom:16px}.sc-zonos-address-h zonos-banner.sc-zonos-address{margin-top:8px}";var ZonosAddressStyle0=zonosAddressCss;var ZonosAddress=function(){function o(o){registerInstance(this,o);this.invalidCharacters=createEvent(this,"invalidCharacters",7);this.isAutoCompleteAdjusted=false;this.type=undefined;this.titleText=undefined;this.defaultAddress=null;this.stripe=window.Zonos.stripe;this.isDirtyAddress=false}o.prototype.getStripeAddressInstance=function(){if(this.type==="billing"){return{stripeAddressElement:stripeStore.stripeBillingAddressElement,stripeAddressEventData:stripeStore.stripeBillingAddressEventData,stripeElements:stripeStore.stripeElementsForBillingAddress}}return{stripeAddressElement:stripeStore.stripeAddressElement,stripeAddressEventData:stripeStore.stripeAddressEventData,stripeElements:stripeStore.stripeElements}};o.prototype.updateAddressEventData=function(o){var e=o.event,s=o.type;switch(s){case"billing":stripeStore.stripeBillingAddressEventData=e;break;default:stripeStore.stripeAddressEventData=e;break}};o.prototype.updateAddressElement=function(o){var e=o.stripeAddressElement,s=o.type;if(s==="shipping"){stripeStore.stripeAddressElement=e;return}stripeStore.stripeBillingAddressElement=e};o.prototype.watchInitStripe=function(){return __awaiter(this,void 0,void 0,(function(){var o,e,s,t,n,i,a,r,l,d,c,h;var f=this;return __generator(this,(function(u){this.stripe=window.Zonos.stripe;s=this.getStripeAddressInstance(),t=s.stripeAddressEventData,n=s.stripeElements;if(!this.stripe||!n){logError("Stripe is not initialized. Couldn't load stripe element.");return[2]}i=(o=this.defaultAddress)===null||o===void 0?void 0:o.phone;if(!i){(e=this.defaultAddress)===null||e===void 0?true:delete e.phone}a=localizationStore.shippingZoneCountries;r=a?Object.values(a).map((function(o){return o.code})):[];l=new URLSearchParams(window.location.search).has("zonosCheckoutAllCountries");d=this.type==="shipping"?r:[];c=(t===null||t===void 0?void 0:t.value.address.country)||getFallbackDefaultCountryCode(d);log("Stripe country code: ".concat(c),"info");h=n.create("address",{allowedCountries:l?[]:d,contacts:this.defaultAddress&&!t?[this.defaultAddress]:[],defaultValues:{address:Object.assign(Object.assign({},t===null||t===void 0?void 0:t.value.address),{country:c}),firstName:t===null||t===void 0?void 0:t.value.firstName,lastName:t===null||t===void 0?void 0:t.value.lastName,phone:t===null||t===void 0?void 0:t.value.phone},display:{name:"split"},fields:{phone:"always"},mode:this.type,validation:{phone:{required:"always"}}});h.mount(this.el.querySelector(".zonos--address-component"));h.on("change",(function(o){var e=o.value;if(!f.isDirtyAddress&&e.address.line1.length>=3){f.isDirtyAddress=true;setTimeout((function(){if(!f.isAutoCompleteAdjusted){var o=f.el.querySelector('iframe[src*="autocomplete-suggestions"]');if(o){o.style.zIndex="2"}f.isAutoCompleteAdjusted=true}if(isCheckoutMobile()){f.el.scrollIntoView({behavior:"smooth",block:"end"})}else{var e=f.type==="shipping"?100:600;var s=f.el.closest(".zonos--group");var t=f.el.getBoundingClientRect().top+e;s===null||s===void 0?void 0:s.scrollTo({behavior:"smooth",top:t})}}),600)}f.updateAddressEventData({event:Object.assign(Object.assign({},o),{elementMode:f.type,elementType:"address",value:Object.assign(Object.assign({},e),{firstName:e.firstName||e.name.split(" ")[0],lastName:e.lastName||e.name.split(" ")[1]})}),type:f.type})}));this.updateAddressElement({stripeAddressElement:h,type:this.type});return[2]}))}))};o.prototype.defaultAddressChanged=function(){log("Reset address element when default address property is changed","info",{defaultAddress:this.defaultAddress});var o=this.getStripeAddressInstance().stripeAddressElement;o===null||o===void 0?void 0:o.destroy();void this.watchInitStripe()};o.prototype.disconnectedCallback=function(){var o=this.getStripeAddressInstance().stripeAddressElement;o===null||o===void 0?void 0:o.destroy()};o.prototype.componentDidLoad=function(){var o=this.getStripeAddressInstance().stripeAddressEventData;this.isDirtyAddress=!!o&&o.value.address.line1.length>0;void this.watchInitStripe()};o.prototype.render=function(){return h(Host,{key:"6b60b7dcf989454403af0c916d039cdc6c5675a3",class:"zonos--address zonos--elements"},h("zonos-text",{key:"7a555cc624abac44b61f81f616305fb8e5a4fd66",class:"zonos--title",type:"semiBoldLabel"},this.titleText),h("div",{key:"55c305ccb4230c37b6f36087f9782a1545be242f",class:"zonos--address-component"}))};Object.defineProperty(o.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{stripe:["watchInitStripe"],defaultAddress:["defaultAddressChanged"]}},enumerable:false,configurable:true});return o}();ZonosAddress.style=ZonosAddressStyle0;var zonosAddressDisplayCss=':host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--title{margin-bottom:12px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:4px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-line{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}:host .zonos--address-line zonos-text+zonos-text::before{content:", ";color:var(--zonos-elements-gray-1000);margin-right:4px}:host .zonos--country-flag{width:20px;height:14px;border-radius:2px;margin:1px;position:relative;overflow:hidden;-webkit-box-shadow:var(--zonos-elements-v3-shadow-medium);box-shadow:var(--zonos-elements-v3-shadow-medium);margin-right:8px;z-index:10;justify-self:center}';var ZonosAddressDisplayStyle0=zonosAddressDisplayCss;var ZonosAddressDisplay=function(){function o(o){registerInstance(this,o);this.currentAddress=undefined;this.addressType=undefined}o.prototype.render=function(){var o;var e=this.currentAddress,s=e.city,t=e.country,n=e.email,i=e.line1,a=e.line2,r=e.name,l=e.phone,d=e.postal_code,c=e.state;var f=(o=localizationStore.shippingZoneCountries)===null||o===void 0?void 0:o[t];var u=function(o){var e=o.bold,s=o.content;var t=isTextContainsNonLatinChars(s)?"red-600":"gray-1000";return h("zonos-text",{textColor:t,type:e?"boldLabel":"body"},s)};return h(Host,{class:"zonos--address-form zonos--elements"},h("div",{class:"zonos--title"},h("zonos-text",{textColor:"gray-700",type:"smallHeader"},this.addressType==="shipping"?translate("Shipping"):translate("Billing"))),h("div",{class:"zonos--address-group"},r&&h("div",{class:"zonos--address-line"},u({bold:true,content:r})),n&&h("div",{class:"zonos--address-line"},u({content:n})),l&&h("div",{class:"zonos--address-line"},u({content:l})),i&&h("div",{class:"zonos--address-line"},u({content:i})),a&&h("div",{class:"zonos--address-line"},u({content:a})),h("div",{class:"zonos--address-line"},s&&u({content:s}),c&&u({content:c}),d&&u({content:d})),f&&h("div",{class:"zonos--address-line"},h("zonos-country-flag",{class:"zonos--country-flag",countryCode:f.code})," ",u({content:f.displayName}))))};return o}();ZonosAddressDisplay.style=ZonosAddressDisplayStyle0;var zonosAddressFormCss=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--title{margin-bottom:20px}:host .zonos--address-group{display:-ms-flexbox;display:flex;gap:20px;-ms-flex-direction:column;flex-direction:column;margin:1px}:host .zonos--contact{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}:host .zonos--address-row{display:-ms-flexbox;display:flex;gap:8px}:host .zonos--address-row>*{-ms-flex:1;flex:1}:host .zonos--address{display:-ms-flexbox;display:flex;gap:8px;-ms-flex-direction:column;flex-direction:column}";var ZonosAddressFormStyle0=zonosAddressFormCss;var ZonosAddressForm=function(){function o(o){var e=this;registerInstance(this,o);this.addressChange=createEvent(this,"addressChange",7);this.onInputChange=function(o){var s;var t=o.key,n=o.value;e.addressChange.emit(Object.assign(Object.assign({},e.localAddress),(s={},s[t]=n,s)))};this.currentAddress=undefined;this.translatedAddress=undefined;this.addressType=undefined;this.localAddress=this.currentAddress}o.prototype.watchCurrentAddress=function(){var o,e,s,t,n,i;var a=this.currentAddress,r=a.city,l=a.line1,d=a.line2,c=a.name,h=a.postal_code,f=a.state;this.localAddress=Object.assign(Object.assign({},this.currentAddress),{city:((o=this.translatedAddress.city)===null||o===void 0?void 0:o[r])||r,line1:((e=this.translatedAddress.line1)===null||e===void 0?void 0:e[l])||l,line2:((s=this.translatedAddress.line2)===null||s===void 0?void 0:s[d])||d,name:((t=this.translatedAddress.name)===null||t===void 0?void 0:t[c])||c,postal_code:((n=this.translatedAddress.postal_code)===null||n===void 0?void 0:n[h])||h,state:((i=this.translatedAddress.state)===null||i===void 0?void 0:i[f])||f})};o.prototype.componentWillLoad=function(){this.watchCurrentAddress()};o.prototype.render=function(){var o=this;var e=this.localAddress,s=e.city,t=e.country,n=e.line1,i=e.line2,a=e.name,r=e.phone,l=e.postal_code,d=e.state;var c=a.split(" ")[0]||"";var f=a.split(" ").slice(1).join(" ")||"";return h(Host,{key:"8b578737e33203a23563be7e9be0778deec99bbf",class:"zonos--address-form zonos--elements"},h("div",{key:"793675a1348547bf3f781788956befe325191011",class:"zonos--title"},h("zonos-text",{key:"13de35cb0a7c98a48342e3fb86ae3ade9f5b88d9",textColor:"gray-700",type:"smallHeader"},this.addressType==="shipping"?translate("Shipping"):translate("Billing"))),h("div",{key:"2c5de5b5283fb99ee5f8b61d7a217177986fc2db",class:"zonos--address-group"},h("div",{key:"23bf3c893071000d5995a5f175867bab11929193",class:"zonos--contact"},h("zonos-text",{key:"7cdfe2a84ebad89ba5b16498d75def99cf392384",type:"label"},translate("Contact")),h("zonos-input",{key:"1c39c38767fd306c5eb1164cdc989b8291209cf0",class:"zonos--form-email",inputLabel:translate("Email"),inputValue:this.currentAddress.email,isDisabled:true}),h("div",{key:"cbdf61217125e22b1a6cec9a340ef0aca2c75670",class:"zonos--name zonos--address-row"},h("zonos-input",{key:"360c99e7b2c6caa64580d5768b5bb53368927275",class:"zonos--form-first-name",inputLabel:translate("First name"),inputValue:c,isError:isTextContainsNonLatinChars(c),onInputChange:function(e){return o.onInputChange({key:"name",value:"".concat(e.detail," ").concat(f)})}}),h("zonos-input",{key:"8ce5fa5c15c6f7928339ea10009ce0e68954a91f",class:"zonos--form-last-name",inputLabel:translate("Last name"),inputValue:f,isError:isTextContainsNonLatinChars(f),onInputChange:function(e){return o.onInputChange({key:"name",value:"".concat(c," ").concat(e.detail)})}}))),h("div",{key:"7b4fa2d3baa6cb257e7688e5ba6777123898b3fd",class:"zonos--address"},h("zonos-text",{key:"9d5782331b2642755a755aeb7f98c9f4d87f9a20",type:"label"},translate("Address")),h("zonos-input",{key:"a622025924ca86bdbf1d3c04b79e6dee172b4c42",class:"zonos--form-country",inputLabel:translate("Country"),inputValue:t,isDisabled:true}),h("zonos-input",{key:"f99b3a74db09ab5730878e80705b9aeac76bf800",class:"zonos--form-line1",inputLabel:translate("Address line 1"),inputValue:n,isError:isTextContainsNonLatinChars(n),onInputChange:function(e){return o.onInputChange({key:"line1",value:e.detail})}}),h("zonos-input",{key:"5d16aefa45a78045c87d166aaaec0255606e455e",class:"zonos--form-line2",inputLabel:translate("Address line 2"),inputValue:i,isError:isTextContainsNonLatinChars(i),onInputChange:function(e){return o.onInputChange({key:"line2",value:e.detail})}}),h("div",{key:"dc166be9381142835d72e731cb38a718522a068a",class:"zonos--address-row"},h("zonos-input",{key:"4f1a98f9d10ce0cff3ef18a3037a12382552b31d",class:"zonos--form-city",inputLabel:translate("City"),inputValue:s,isError:isTextContainsNonLatinChars(s),onInputChange:function(e){return o.onInputChange({key:"city",value:e.detail})}}),h("zonos-input",{key:"d4f97900b5fe2e1619950a52d1d1f716a8bc19ff",class:"zonos--form-state",inputLabel:translate("State/Province"),inputValue:d,isError:isTextContainsNonLatinChars(d),onInputChange:function(e){return o.onInputChange({key:"state",value:e.detail})}})),h("zonos-input",{key:"cf1eb0ca5cd15c8412a2e1246aaf2e39361dc733",class:"zonos--form-postal-code",inputLabel:translate("Postal code"),inputValue:l,isError:isTextContainsNonLatinChars(l),onInputChange:function(e){return o.onInputChange({key:"postal_code",value:e.detail})}}),h("zonos-input",{key:"7421c82847eded6bdbcce49ef8196124d8e50c1d",class:"zonos--form-phone",inputLabel:translate("Phone number"),inputValue:r,onInputChange:function(e){return o.onInputChange({key:"phone",value:e.detail})}}))))};Object.defineProperty(o,"watchers",{get:function(){return{translatedAddress:["watchCurrentAddress"]}},enumerable:false,configurable:true});return o}();ZonosAddressForm.style=ZonosAddressFormStyle0;var zonosAddressUpdateDialogCss=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--body{padding:0 24px;position:relative}:host .zonos--dialog-header{margin-bottom:32px;position:-webkit-sticky;position:sticky;padding-top:24px;top:0;z-index:11;background:var(--zonos-elements-gray-0)}:host .zonos--dialog-title{display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center;margin-bottom:12px}:host .zonos--group{overflow:auto;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:8px;-ms-scroll-chaining:none;overscroll-behavior:contain}:host .zonos--group::-webkit-scrollbar{width:10px}:host .zonos--group::-webkit-scrollbar-track{background:var(--zonos-elements-gray-50)}:host .zonos--group::-webkit-scrollbar-thumb{border-radius:10px;background:#cccccc;border:3px solid transparent;background-clip:content-box}:host .zonos--group::-webkit-scrollbar-thumb:hover{background:#d6d6d6}:host .zonos--address-display-group{display:-ms-flexbox;display:flex;gap:8px;margin-bottom:20px}:host .zonos--address-display-group zonos-address-display{-ms-flex:1;flex:1}:host .zonos--what-you-entered{margin-bottom:8px}:host .zonos--address-form-section{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:24px}:host .zonos--group-btn{position:-webkit-sticky;position:sticky;padding:24px 0;bottom:0;display:-ms-flexbox;display:flex;-ms-flex-pack:end;justify-content:end;background:var(--zonos-elements-gray-0);z-index:11}:host .zonos--group-btn .zonos--button-wrapper{display:-ms-flexbox;display:flex;gap:8px}:host(.mobile) .zonos--button-wrapper{-ms-flex-direction:column;flex-direction:column;width:100%}:host(.mobile) .zonos--button-wrapper zonos-button{width:100%}:host(.mobile) .zonos--button-wrapper .zonos--cancel-btn{-ms-flex-order:2;order:2}:host(.mobile) .zonos--button-wrapper .zonos--update-btn{-ms-flex-order:1;order:1}";var ZonosAddressUpdateDialogStyle0=zonosAddressUpdateDialogCss;var ZonosAddressUpdateDialog=function(){function o(o){var e=this;registerInstance(this,o);this.closeUpdateDialog=createEvent(this,"closeUpdateDialog",7);this.continueClicked=createEvent(this,"continueClicked",7);this.closeUpdateDialogHandler=function(){e.closeUpdateDialog.emit()};this.getTranslatedAddress=function(o){var e=o.currentAddress,s=o.translatedAddress;var t,n,i,a,r,l;var d=e.city,c=e.line1,h=e.line2,f=e.name,u=e.postal_code,p=e.state;return{city:((t=s.city)===null||t===void 0?void 0:t[d])||d,line1:((n=s.line1)===null||n===void 0?void 0:n[c])||c,line2:((i=s.line2)===null||i===void 0?void 0:i[h])||h,name:((a=s.name)===null||a===void 0?void 0:a[f])||f,postal_code:((r=s.postal_code)===null||r===void 0?void 0:r[u])||u,state:((l=s.state)===null||l===void 0?void 0:l[p])||p}};this.continueClickHandler=function(){return __awaiter(e,void 0,void 0,(function(){var o,e,s,t,n,i,a,r,l,d,c,h,f;return __generator(this,(function(u){this.continueLoading=true;t=this.billingAddress?this.getTranslatedAddress({currentAddress:this.billingAddress,translatedAddress:this.translatedBillingAddressState}):null;n=this.getTranslatedAddress({currentAddress:this.shippingAddress,translatedAddress:this.translatedShippingAddressState});i=containsNonLatinChars(Object.assign(Object.assign({},n),{country:this.shippingAddress.country}));a=t&&this.billingAddress&&containsNonLatinChars(Object.assign(Object.assign({},t),{country:this.billingAddress.country}));r=!!Object.keys(i).length;l=!!a&&!!Object.keys(a).length;if(r||l){d=(o=this.el.shadowRoot)===null||o===void 0?void 0:o.querySelectorAll("zonos-address-form");c=d===null||d===void 0?void 0:d[0];h=d===null||d===void 0?void 0:d[1];f=((e=c===null||c===void 0?void 0:c.shadowRoot)===null||e===void 0?void 0:e.querySelector(".has-error"))||((s=h===null||h===void 0?void 0:h.shadowRoot)===null||s===void 0?void 0:s.querySelector(".has-error"));if(f){f.scrollIntoView({behavior:"smooth",block:"center"})}this.continueLoading=false;return[2]}this.continueClicked.emit({billingAddress:t,shippingAddress:n});return[2]}))}))};this.buildTranslateAddressState=function(o){var e,s,t,n,i,a;var r=o.currentAddress,l=o.translatedAddress;var d=r.city,c=r.line1,h=r.line2,f=r.name,u=r.postal_code,p=r.state;return{city:(e={},e[d]=l.city,e),line1:(s={},s[c]=l.line1,s),line2:(t={},t[h]=l.line2,t),name:(n={},n[f]=l.name,n),postal_code:(i={},i[u]=l.postal_code,i),state:(a={},a[p]=l.state,a)}};this.continueLoading=false;this.dialogLoading=undefined;this.dialogOpen=false;this.submitBtnType=undefined;this.submitBtnColor=undefined;this.isMobile=false;this.shippingAddress=undefined;this.billingAddress=undefined;this.translatedShippingAddress=undefined;this.translatedBillingAddress=undefined;this.showErrorBanner=false;this.translatedShippingAddressState={};this.translatedBillingAddressState={}}o.prototype.watchTranslatedShippingAddress=function(){this.translatedShippingAddressState=this.translatedShippingAddress};o.prototype.watchTranslatedBillingAddress=function(){this.translatedBillingAddressState=this.translatedBillingAddress};o.prototype.componentWillLoad=function(){this.watchTranslatedBillingAddress();this.watchTranslatedShippingAddress()};o.prototype.render=function(){var o=this;var e=this.submitBtnColor||zonosStore.appearance.colorSecondary;var s=e==="#ffffff"?"outline":this.submitBtnType||"standard";var t=this.billingAddress;var n=this.shippingAddress;return h(Host,{key:"655845cef04f4af526b1a1c4e49243c4f2b4c7f6",class:classes(["zonos--address-update-dialog zonos--elements",this.isMobile&&"mobile"])},h("zonos-dialog",{key:"eab429bb78ce6f05ba463d8748d7edd5499402fa",isLoading:this.dialogLoading,mobile:this.isMobile,noBodyPadding:true,noBorder:true,noClickOutside:true,noCloseButton:true,onCloseDialog:function(){return o.closeUpdateDialog.emit()},open:this.dialogOpen,width:"568px"},h("div",{key:"08f0400e62addfcaffd91bf5200999d29bbd2da9",class:"zonos--body"},h("div",{key:"8699df5e2f823e19066fbb552ba2a66c127c05e9",class:"zonos--dialog-header"},h("div",{key:"92e0ff932dcdb0e5b59ea34b688d1ef8e31bfeb3",class:"zonos--dialog-title"},h("zonos-text",{key:"aaac3375526bddb319ce7c8f49bde30da7210264",type:"title"},translate("Update your address")),h("zonos-button",{key:"66abf7b74045e68e84e631298504236d32ca9c4e",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close checkout dialog",content:RemoveIcon$1}),noBackground:true,onClick:function(){return o.closeUpdateDialogHandler()}})),h("zonos-text",{key:"ffb3d8f169867d5f6dff269e1becd99c98c5a7da"},translate("To ensure delivery all address details must be in Latin characters."))),h("div",{key:"2cb61f06ce174e2317870decfdd337c67c5cf128",class:"zonos--group"},h("zonos-text",{key:"a616c540984120b468e52bccfb380ea3974ced22",class:"zonos--what-you-entered",type:"semiBoldLabel"},translate("What you entered")),h("div",{key:"6ac8f9c14472370c501af1b0d50bd8f8746b7694",class:"zonos--address-display-group"},h("zonos-address-display",{key:"ea2c67a7bba51c99f80be968e448beeffcf1f863",addressType:"shipping",currentAddress:n}),t&&h("zonos-address-display",{key:"7ea1683dc04a292810e04ed6550d86086f25186f",addressType:"billing",currentAddress:t})),h("div",{key:"4d1cd9096943518b8b4e267608a5e1542befb6a9",class:"zonos--address-form-section"},h("zonos-text",{key:"e4184a2cc618d26d43979fa8cfe06070cf8b5af8",type:"semiBoldLabel"},translate("Translated address")),h("zonos-address-form",{key:"c55d9d3c658565ceb7c7b879f444e3937b9f7ad6",addressType:"shipping",class:"zonos--shipping-address-form",currentAddress:n,onAddressChange:function(e){var s=e.detail;o.translatedShippingAddressState=o.buildTranslateAddressState({currentAddress:n,translatedAddress:s})},translatedAddress:this.translatedShippingAddressState}),t&&h("zonos-address-form",{key:"c3facc295b1322bb00baa6081f343dcea4f10777",addressType:"billing",class:"zonos--billing-address-form",currentAddress:t,onAddressChange:function(e){var s=e.detail;o.translatedBillingAddressState=o.buildTranslateAddressState({currentAddress:t,translatedAddress:s})},translatedAddress:this.translatedBillingAddressState}))),h("div",{key:"1c89c9604ba0dece40275fcfac97e7f93706b430",class:"zonos--group-btn"},h("div",{key:"e47d393940b094b4e123864e4070daa87f0616f0",class:"zonos--button-wrapper"},h("zonos-button",{key:"216b7afe268a4acd6bb8a76b7f5a32dc09bdd4f6",class:"zonos--cancel-btn",onClick:function(){return o.closeUpdateDialogHandler()},variant:"subtle"},translate("Cancel")),h("zonos-button",{key:"acbacb92cedb325b46843d8f3aff13f4e7c86ab5",backgroundColor:this.submitBtnColor,class:"zonos--update-btn",loading:this.continueLoading,onClick:function(){return o.continueClickHandler()},size:"sm",variant:s},translate("Update address")))))))};Object.defineProperty(o.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{translatedShippingAddress:["watchTranslatedShippingAddress"],translatedBillingAddress:["watchTranslatedBillingAddress"]}},enumerable:false,configurable:true});return o}();ZonosAddressUpdateDialog.style=ZonosAddressUpdateDialogStyle0;var colorPrefixes=["blue","cyan","green","orange","purple","red","gray","glass"];var zonosCheckboxCss=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer}:host label{display:-ms-inline-flexbox;display:inline-flex;position:relative;gap:8px;-ms-flex-align:center;align-items:center}:host label.disabled{cursor:not-allowed;opacity:0.6}:host input[type=checkbox]{opacity:0;position:absolute;left:0;width:0;height:0;top:0;z-index:-99999}:host svg{opacity:0}:host .checkmark-container{height:var(--zonos--size);width:var(--zonos--size);background-color:transparent;border:1.5px solid var(--zonos-elements-gray-400);position:relative;border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-4))}:host .checkmark{opacity:0;position:absolute;top:-1.5px;left:-1.5px;right:-1.5px;bottom:-1.5px;width:calc(100% + 3px);-webkit-transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);transition:0.3s all cubic-bezier(0.175, 0.885, 0.32, 1.275);-webkit-transform:scale(0.4);transform:scale(0.4);background-color:var(--zonos--background-color);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-4))}:host input[type=checkbox]:checked~.checkmark-container .checkmark{opacity:1;-webkit-transform:scale(1);transform:scale(1)}";var ZonosCheckboxStyle0=zonosCheckboxCss;var ZonosCheckbox=function(){function o(o){registerInstance(this,o);this.checkboxSelected=createEvent(this,"checkboxSelected",7);this.backgroundColor="blue";this.label=undefined;this.isChecked=false;this.isDisabled=false;this.size=12;this.fontSize="base";this.borderStyle=undefined}o.prototype.onClick=function(){if(this.isDisabled){return}this.checkboxSelected.emit(!this.isChecked)};o.prototype.render=function(){var o=this;var e=colorPrefixes.includes(this.backgroundColor);var s=e?"var(--zonos-elements-".concat(this.backgroundColor,"-600)"):this.backgroundColor;var t=e?"var(--zonos-elements-".concat(this.backgroundColor,"-200)"):!isDarkColor(s)?"var(--zonos-elements-gray-800)":"var(--zonos-elements-gray-0)";var n=getBorderRadius({customRoundRadius:"4px",overrideBorderStyle:this.borderStyle});return h(Host,{key:"7a2972128b04d5dffe09f60b5292d90f7201066a",class:classes(["zonos--elements zonos--checkbox"]),style:{"--zonos--background-color":s,"--zonos--border-radius":n,"--zonos--font-family":zonosStoreFontFamily(),"--zonos--size":"".concat(this.size,"px")}},h("label",{key:"b18d0f091b783555b4b3a1fc2b5d5cb1c62a9d41",class:classes([this.isDisabled&&"disabled"])},h("input",{key:"f3b86525ef7988d6df87f9147f5aa22b447c1303",checked:this.isChecked,disabled:this.isDisabled,hidden:true,onChange:function(e){o.checkboxSelected.emit(e.target.checked)},type:"checkbox"}),h("span",{key:"2007c2fbc4d8437f75b9a3d7a4e65d394922abf4",class:"checkmark-container"},h("svg",{key:"481b9272c99cf464d8d88ab24a8dba35de921abf",class:"checkmark",color:t,fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},h("path",{key:"ab7690fba113135175248c8926907312dfe478d5","clip-rule":"evenodd",d:"M17.456 7.404a.75.75 0 0 1 .14 1.052l-6.5 8.5a.75.75 0 0 1-1.126.074l-4-4a.75.75 0 0 1 1.06-1.06l3.395 3.394 5.98-7.82a.75.75 0 0 1 1.05-.14Z",fill:"currentColor","fill-rule":"evenodd"}))),this.label&&h("zonos-text",{key:"99689099e7469f2ff928619daa2fcee0ce35a418",size:this.fontSize},this.label)))};return o}();ZonosCheckbox.style=ZonosCheckboxStyle0;var RemoveIcon='<svg xmlns="https://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path fill="#C5C6CA" fill-rule="evenodd" d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z" clip-rule="evenodd"/><path fill="#4D505A" fill-rule="evenodd" d="M8.293 8.293a1 1 0 0 1 1.414 0L12 10.586l2.293-2.293a1 1 0 1 1 1.414 1.414L13.414 12l2.293 2.293a1 1 0 0 1-1.414 1.414L12 13.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L10.586 12 8.293 9.707a1 1 0 0 1 0-1.414Z" clip-rule="evenodd"/></svg>';var zonosDialogCss=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host .zonos--backdrop,:host .zonos--dialog-layout{opacity:0;z-index:-999;visibility:hidden;-webkit-transition:0.3s all ease;transition:0.3s all ease}:host .zonos--backdrop{width:100vw;height:100vh;left:0;top:0;background:var(--zonos-elements-backdrop-color);position:fixed}:host .zonos--loading{position:absolute;left:0;right:0;bottom:0;top:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;z-index:2147483009;background:var(--zonos-elements-gray-0);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10))}:host .zonos--dialog-layout{width:100vw;height:100vh;left:0;top:0;position:fixed;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;color:var(--zonos-elements-text-color);visibility:hidden}:host .zonos--dialog{position:relative;z-index:2147483008;background:var(--zonos-elements-gray-0);max-width:90vw;max-height:90vh;min-height:var(--zonos--min-height, auto);height:var(--zonos--height, auto);width:var(--zonos--width, auto);border-radius:var(--zonos--border-radius, var(--zonos-elements-radius-10));outline:none;-webkit-box-shadow:var(--zonos-elements-v3-shadow-xxl);box-shadow:var(--zonos-elements-v3-shadow-xxl);border:var(--zonos-elements-border);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .zonos--header{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;padding:16px 24px}:host .zonos--header .-zonos-stencil-library--header-text{-ms-flex-positive:1;flex-grow:1}:host .zonos--header .zonos--close-button{width:var(--zonos-elements-size-md);height:var(--zonos-elements-size-md);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;border-radius:var(--zonos-elements-radius-10);-ms-flex-item-align:start;align-self:flex-start}:host .zonos--header .zonos--close-button:hover{background:var(--zonos-elements-hover-color)}:host .zonos--body{padding:8px 24px;max-height:100%;height:100%;overflow:auto}:host .zonos--body.zonos--no-body-padding{padding:0}:host .zonos--footer{padding:16px 24px}:host(.open) .zonos--dialog-layout,:host(.open) .zonos--backdrop{visibility:visible}:host(.open) .zonos--backdrop{z-index:2147483008;opacity:0.65}:host(.open) .zonos--dialog-layout{opacity:1;z-index:2147483009;-webkit-transform:scale(1);transform:scale(1)}:host(.no-border) .zonos--dialog{border:none}:host(.mobile) .zonos--dialog{max-width:100vw;max-height:100vh;height:100%;width:100%;border-radius:0;-webkit-box-shadow:none;box-shadow:none;border:none}";var ZonosDialogStyle0=zonosDialogCss;var ZonosDialog=function(){function o(o){var e=this;registerInstance(this,o);this.closeDialog=createEvent(this,"closeDialog",3);this.isMobileMode=function(){return e.mobile||window.innerWidth<=768};this.closeButtonHandler=function(){if(!e.open){return}e.closeDialog.emit()};this.clickOutsideDialogHandler=function(o){if(o.target===o.currentTarget&&!e.noClickOutside){e.closeDialog.emit()}};this.open=false;this.headerText="";this.width="460px";this.height=undefined;this.minHeight=undefined;this.noHeader=false;this.noBodyPadding=false;this.noBorder=false;this.borderStyle=undefined;this.noCloseButton=false;this.noClickOutside=false;this.mobile=false;this.isLoading=true;this.isMobile=false}o.prototype.handleWindowResize=function(){this.isMobile=this.isMobileMode()};o.prototype.handleKeyDown=function(o){if(o.key==="Escape"){this.closeButtonHandler()}};o.prototype.componentDidLoad=function(){this.isMobile=this.isMobileMode()};o.prototype.render=function(){var o=getBorderRadius({overrideBorderStyle:this.borderStyle});return h(Host,{key:"a9932187bccf8e7fa505c7e07175d03541d66852",class:classes(["zonos--elements",this.open&&"open",this.isLoading&&"is-loading",this.noBorder&&"no-border",this.isMobile&&"mobile"]),style:{"--zonos--border-radius":o,"--zonos--font-family":zonosStoreFontFamily(),"--zonos--height":this.height||"initial","--zonos--min-height":this.minHeight||"500px","--zonos--width":this.width}},h("div",{key:"0298cf365a50e3544656a6d27ae59e922b9e3aed",class:"zonos--backdrop"}),h("div",{key:"9fce580a07147d51f17c898a22204c3d9ce6ac7b",class:"zonos--dialog-layout",inert:!this.open,onClick:this.clickOutsideDialogHandler},h("div",{key:"b168439cd985cc5c0166a653db206688504cf7dd",class:"zonos--dialog"},this.isLoading&&h("div",{key:"e0b6215f3c7bc939721669069bc294e08558d8b5",class:"zonos--loading"},h("zonos-spinner",{key:"687bcd6d2695933de828484c34aff1230bf71d49",size:30})),(this.headerText||!this.noCloseButton)&&h("div",{key:"04a57a4add896e3d96faca8b77321bba5f00b889",class:"zonos--header"},this.headerText&&h("h3",{key:"d084cb3aedcb7e5bb8fd82012b57f441d7dce4a2",class:"zonos--header-text"},this.headerText),!this.noCloseButton&&h("zonos-button",{key:"7b73bd57b8651fd3f3ebd29e3c252bd83d9375ee",class:"zonos--close-button",icon:h("zonos-icon",{"aria-label":"Close dialog",content:RemoveIcon}),noBackground:true,onClick:this.closeButtonHandler,variant:"subtle"})),h("div",{key:"7af04c281b6410b87bfe53913e74fa215f6de24b",class:classes(["zonos--body",this.noBodyPadding&&"zonos--no-body-padding"])},h("slot",{key:"8c6ce4437d2bc98f9eccea0280cee31794883b77"})),h("slot",{key:"11f97e705b3cc1bad11c037ede940d2f392d67e7",name:"dialog-footer"}))))};Object.defineProperty(o,"assetsDirs",{get:function(){return["assets"]},enumerable:false,configurable:true});return o}();ZonosDialog.style=ZonosDialogStyle0;var validateEmailValue=function(o){var e=/^[a-zA-Z0-9.%_+-]*@[a-zA-Z0-9][a-zA-Z0-9.-]*\.[a-zA-Z0-9]{2,}$/;return e.test(o)};var zonosLinkAuthenticationCss=".sc-zonos-link-authentication-h{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}.sc-zonos-link-authentication-h *.sc-zonos-link-authentication{font-family:var(--zonos--font-family, Inter), Inter}.sc-zonos-link-authentication-h img.sc-zonos-link-authentication{max-width:100%}.sc-zonos-link-authentication-h dl.sc-zonos-link-authentication,.sc-zonos-link-authentication-h dd.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h1.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h2.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h3.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h4.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h5.sc-zonos-link-authentication,.sc-zonos-link-authentication-h h6.sc-zonos-link-authentication,.sc-zonos-link-authentication-h hr.sc-zonos-link-authentication,.sc-zonos-link-authentication-h figure.sc-zonos-link-authentication,.sc-zonos-link-authentication-h p.sc-zonos-link-authentication,.sc-zonos-link-authentication-h pre.sc-zonos-link-authentication{margin:0}.sc-zonos-link-authentication-h{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.sc-zonos-link-authentication-h .zonos--title.sc-zonos-link-authentication{margin-bottom:16px}.sc-zonos-link-authentication-h .zonos--input-invalid.sc-zonos-link-authentication{border:2px solid var(--zonos-elements-red-600);border-radius:var(--zonos--border-radius)}";var ZonosLinkAuthenticationStyle0=zonosLinkAuthenticationCss;var ZonosLinkAuthentication=function(){function o(o){var e=this;registerInstance(this,o);this.linkAuthenticationChange=createEvent(this,"linkAuthenticationChange",7);this.setCustomEmailInputToLinkEvent=function(o){var e=validateEmailValue(o);var s={complete:!!e,elementType:"linkAuthentication",empty:!o,value:{email:o}};stripeStore.stripeLinkEventData=s};this.handleNormalEmailInput=function(o){var s;var t=o.detail;e.setCustomEmailInputToLinkEvent(t);(s=e.linkAuthenticationChange)===null||s===void 0?void 0:s.emit()};this.titleText=undefined;this.defaultEmail=null;this.isEmailError=false;this.stripe=stripeStore.stripe;this.isStagingMode=cartStore.isStagingMode;this.clientSecret=stripeStore.clientSecret}o.prototype.watchIsStagingMode=function(){var o=this;setTimeout((function(){o.watchInitStripe()}),0)};o.prototype.watchInitStripe=function(){var o=this;if(!this.stripe||!stripeStore.stripeElements){return}if(cartStore.isStagingMode||!this.clientSecret){return}var e=this.defaultEmail?{email:this.defaultEmail}:undefined;var s=stripeStore.stripeLinkElement||stripeStore.stripeElements.create("linkAuthentication",{defaultValues:e||undefined});var t=this.el.querySelector(".zonos--link-authentication-component");if(!t){logError("Cannot find container element for linkAuthenticationElement");return}s.mount(t);s.on("change",(function(e){var s;stripeStore.stripeLinkEventData=e;(s=o.linkAuthenticationChange)===null||s===void 0?void 0:s.emit()}));stripeStore.stripeLinkElement=s};o.prototype.watchDefaultEmail=function(){if(!this.defaultEmail){return}this.setCustomEmailInputToLinkEvent(this.defaultEmail)};o.prototype.componentDidLoad=function(){this.watchInitStripe();if(!this.defaultEmail){return}this.setCustomEmailInputToLinkEvent(this.defaultEmail)};o.prototype.render=function(){var o=this;this.isStagingMode=cartStore.isStagingMode;this.clientSecret=stripeStore.clientSecret;var e=function(){var e;if(cartStore.isStagingMode){return h("zonos-stripe-input",{inputLabel:translate("Email"),inputValue:o.defaultEmail||((e=stripeStore.stripeLinkEventData)===null||e===void 0?void 0:e.value.email)||"",isError:o.isEmailError,onBlur:function(){var e;var s=((e=stripeStore.stripeLinkEventData)===null||e===void 0?void 0:e.value.email)||"";if(!s){return}var t=validateEmailValue(s);o.isEmailError=!t},onInputChange:o.handleNormalEmailInput})}return h("div",{class:"zonos--link-authentication-component ".concat(o.isEmailError&&"zonos--input-invalid")})};return h(Host,{class:"zonos--link-authentication zonos--elements",style:{"--zonos--border-radius":getBorderRadius()}},h("zonos-text",{class:"zonos--title",type:"semiBoldLabel"},this.titleText),e(),this.isEmailError&&h("zonos-text",{textColor:"red-600"},translate("Please enter a valid email address.")))};Object.defineProperty(o.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{isStagingMode:["watchIsStagingMode"],stripe:["watchInitStripe"],clientSecret:["watchInitStripe"],defaultEmail:["watchDefaultEmail"]}},enumerable:false,configurable:true});return o}();ZonosLinkAuthentication.style=ZonosLinkAuthenticationStyle0;var zonosStripeInputCss=':host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{--zonos--background-color:#f1f1f1;--zonos--local-glowing-color:0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 0 0 1px var(--zonos--primary-color);--zonos--border:1px solid #e8e8e8}:host(.dark){color-scheme:dark;--zonos--background-color:#30313d;--zonos--local-glowing-color:0px 2px 4px rgba(0, 0, 0, 0.5),\n 0px 1px 6px rgba(0, 0, 0, 0.25), 0 0 0 3px hsla(0, 0%, 100%, 25%),\n 0 1px 1px 0 rgba(255, 255, 255, 0.12);--zonos--border:1px solid var(--zonos--primary-color)}:host{margin:1px;height:calc(var(--zonos-elements-size-xl) - 2px);}:host .zonos--label-wrapper{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;height:100%;width:100%;background:var(--zonos--background-color);border-radius:var(--zonos--border-radius);border:var(--zonos--border);outline-offset:0;outline-width:2px}:host .zonos--floated-input{-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;padding:0 16px;outline:none;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);width:100%;border-radius:var(--zonos--border-radius);background:var(--zonos--background-color);border:var(--zonos--border);-ms-flex-order:2;order:2;font-weight:400;font-size:var(--zonos--font-size)}:host .zonos--floated-input :-internal-autofill-selected{border-radius:var(--zonos-elements-radius-6) 0 0 var(--zonos-elements-radius-6)}:host .zonos--floated-input :-internal-autofill-selected+label+div{background-color:#e8f0fe}:host .zonos--floated-input.has-label{padding:24px 4px 2px 16px}:host .zonos--floated-input.has-label.has-input-prefix{padding-left:0}:host .zonos--floated-input.has-label.has-input-prefix~.zonos--floated-label label{margin-left:0}:host .zonos--floated-input:not(.has-label)::-webkit-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input:not(.has-label)::-moz-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input:not(.has-label):-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input:not(.has-label)::-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input:not(.has-label)::placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input::-webkit-input-placeholder{-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}:host .zonos--floated-input::-moz-placeholder{-moz-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}:host .zonos--floated-input:-ms-input-placeholder{-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}:host .zonos--floated-input::-ms-input-placeholder{-ms-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}:host .zonos--floated-input::placeholder{-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);opacity:0}:host .zonos--floated-input:focus{outline:none;border:var(--zonos--border)}:host .zonos--floated-input:focus~.zonos--floated-label::after{-webkit-box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color));box-shadow:var(--zonos--glowing-color, var(--zonos--local-glowing-color))}:host .zonos--floated-input.has-error+.zonos--floated-label::after{-webkit-box-shadow:0 0 0 2px #df1b41;box-shadow:0 0 0 2px #df1b41}:host .zonos--floated-input.has-content::-webkit-input-placeholder,:host .zonos--floated-input:focus::-webkit-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input.has-content::-moz-placeholder,:host .zonos--floated-input:focus::-moz-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input.has-content:-ms-input-placeholder,:host .zonos--floated-input:focus:-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input.has-content::-ms-input-placeholder,:host .zonos--floated-input:focus::-ms-input-placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input.has-content::placeholder,:host .zonos--floated-input:focus::placeholder{opacity:var(--zonos-elements-opacity-disabled)}:host .zonos--floated-input.has-content~.zonos--floated-label label,:host .zonos--floated-input:focus~.zonos--floated-label label{top:11px;-webkit-transform:scale(0.8);transform:scale(0.8)}:host .zonos--floated-input:-webkit-autofill,:host .zonos--floated-input:-moz-autofill{background-color:var(--zonos-elements-input-background);color:var(--zonos-elements-text-color)}:host .zonos--floated-label{display:block;max-height:0;pointer-events:none;-ms-flex-order:1;order:1}:host .zonos--floated-label label{color:var(--zonos-elements-gray-800);position:absolute;font-size:16px;line-height:16px;display:inline-block;-webkit-filter:blur(0);filter:blur(0);-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:var(--zonos-elements-transition);transition:var(--zonos-elements-transition);margin-left:16px;top:calc(50% - 8px);z-index:1}:host .zonos--floated-label::after{content:"";position:absolute;left:0;right:0;top:0;bottom:0;border-radius:var(--zonos--border-radius)}:host .disabled .zonos--floated-label{pointer-events:inherit}:host .disabled .zonos--floated-label::after{cursor:not-allowed;z-index:1}:host(.dark) .zonos--label-wrapper{background:#30313d}';var ZonosStripeInputStyle0=zonosStripeInputCss;var ZonosStripeInput=function(){function o(o){registerInstance(this,o);this.inputChange=createEvent(this,"inputChange",7);this.inputValue="";this.inputLabel=undefined;this.overridePrimaryColor=undefined;this.overrideSecondaryColor=undefined;this.isDisabled=false;this.isError=false;this.inputPlaceholder="";this.value="";this.internalValue=this.inputValue}o.prototype.onInputValueChange=function(o){this.internalValue=o;this.inputChange.emit(o);this.value=o};o.prototype.onValueChange=function(o){this.internalValue=o};o.prototype.render=function(){var o=this;var e=this.overridePrimaryColor||zonosStore.appearance.colorPrimary;var s=this.overrideSecondaryColor||zonosStore.appearance.colorSecondary;var t=e&&isDarkColor(e);var n=zonosStore.appearance.fontSizeInputValue||16;return h(Host,{key:"d78f2aee99ac4e6d95cf1628e058e6d3bb70e309",class:classes(["zonos--input zonos--elements",t&&"dark",this.isError&&"has-error"]),"data-theme":t?"DARK":"LIGHT",style:{"--zonos--border-radius":getBorderRadius(),"--zonos--font-family":zonosStoreFontFamily(),"--zonos--font-size":"".concat(n,"px"),"--zonos--primary-color":s}},h("div",{key:"a3e7f765b0081a564c5955e387ff4b521a28d1a5",class:classes(["zonos--label-wrapper",this.isDisabled&&"disabled"])},h("input",{key:"181c5230ddeb02e9cea646b7f0a8efa3a530796e",class:classes(["zonos--floated-input",!!this.inputLabel&&"has-label",this.internalValue&&"has-content",this.isError&&"has-error"]),disabled:this.isDisabled,id:"zonos--input",onChange:function(e){var s=e.target;o.inputChange.emit(s.value);o.el.inputValue=s.value;o.el.dispatchEvent(new Event("change"))},placeholder:this.inputPlaceholder,type:"text",value:this.internalValue}),h("div",{key:"ac6e97971905ba130c3533da6a409de60f99ed6d",class:"zonos--floated-label"},h("label",{key:"1643ab4ef5b9449332351c854f8e43db8d192164",htmlFor:"zonos--input"},this.inputLabel))))};Object.defineProperty(o.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(o,"watchers",{get:function(){return{inputValue:["onInputValueChange"],value:["onValueChange"]}},enumerable:false,configurable:true});return o}();ZonosStripeInput.style=ZonosStripeInputStyle0;export{ZonosAddress as zonos_address,ZonosAddressDisplay as zonos_address_display,ZonosAddressForm as zonos_address_form,ZonosAddressUpdateDialog as zonos_address_update_dialog,ZonosCheckbox as zonos_checkbox,ZonosDialog as zonos_dialog,ZonosLinkAuthentication as zonos_link_authentication,ZonosStripeInput as zonos_stripe_input};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(t,o,n,e){function i(t){return t instanceof n?t:new n((function(o){o(t)}))}return new(n||(n=Promise))((function(n,r){function s(t){try{u(e.next(t))}catch(t){r(t)}}function a(t){try{u(e["throw"](t))}catch(t){r(t)}}function u(t){t.done?n(t.value):i(t.value).then(s,a)}u((e=e.apply(t,o||[])).next())}))};var __generator=this&&this.__generator||function(t,o){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},e,i,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(o){return u([t,o])}}function u(a){if(e)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(e=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=o.call(t,n)}catch(t){a=[6,t];i=0}finally{e=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-d82f06f2.js";import{G as isValidSelector,f as stripeStore,H as initLocalizationStore,e as cartStore,a as localizationStoreUpdateSelectedCountryCode}from"./cart-41bdd9fb.js";import{z as zonosStore,b as zonosStoreInitSetting,d as zonosStoreFontFamily}from"./zonosStore-71d7e02f.js";import{h as handleFetch,b as logError,l as log}from"./handleFetch-b4633675.js";import"./isDarkColor-2f59d721.js";import"./getBorderRadius-740610fb.js";var getZonosSettings=function(){return __awaiter(void 0,void 0,void 0,(function(){var t,o,n,e;return __generator(this,(function(i){switch(i.label){case 0:return[4,handleFetch("/api/zonos-elements/zonos-settings")];case 1:t=i.sent(),o=t.errors,n=t.json,e=t.zonosMode;if(o.length){logError("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings");return[2,{errors:o,json:null,zonosMode:e}]}return[2,{errors:[],json:n,zonosMode:e}]}}))}))};var injectCheckoutElement=function(){var t=document.querySelector("zonos-checkout");if(!t){var o=document.createElement("zonos-checkout");document.body.appendChild(o)}};var initCheckout=function(t){if(!t.placeOrderButtonSelector&&!window.Zonos.cartData){return}if(t.placeOrderButtonSelector&&!isValidSelector(t.placeOrderButtonSelector)){logError('Selector checkoutButtonAnchor "'.concat(t.placeOrderButtonSelector,'" is not a valid selector'));return}injectCheckoutElement()};var injectHelloComponent=function(t){var o=document.querySelector(t);var n=document.querySelector("zonos-hello");if(!n&&o){var e=document.createElement("zonos-hello");o.appendChild(e);return true}return false};var convertPosition=function(t){switch(t){case"BOTTOM_RIGHT":return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right";default:return"bottom-right"}};var injectDefaultWrapper=function(t){var o=t.position,n=o===void 0?"bottom-right":o;var e=".zonos--hello-mobile-wrapper";var i=document.querySelector(e);if(i){return e}var r=document.createElement("div");r.className="zonos--hello-mobile-wrapper";r.style.position="fixed";if(n==="top-right"){r.style.top="72px";r.style.right="24px"}if(n==="top-left"){r.style.top="72px";r.style.left="24px"}if(n==="bottom-right"){r.style.bottom="72px";r.style.right="24px"}if(n==="bottom-left"){r.style.bottom="72px";r.style.left="24px"}r.style.zIndex="2147483007";document.body.appendChild(r);return e};var initHello=function(t){return __awaiter(void 0,void 0,void 0,(function(){var o,n,e,i,r;return __generator(this,(function(s){if(window.Zonos.isLegacyCheckout){log("Hello is disabled when isLegacyCheckout","info");return[2]}o=t.anchorElementSelector;n=o;if(!t.anchorElementSelector&&t.desktopLocation){e=injectDefaultWrapper({position:"bottom-right"});n=e}if(!n||!isValidSelector(n)){logError('Selector anchorElementSelector "'.concat(t.anchorElementSelector,'" is not a valid selector.'));return[2]}log("Hello init complete");i=injectHelloComponent(n);if(!i){r=new MutationObserver((function(){var t=injectHelloComponent(n);if(t){r.disconnect()}}));r.observe(document.body,{childList:true,subtree:true});setTimeout((function(){injectHelloComponent(n)}),1e3);setTimeout((function(){if(t.notFoundElementFallback){log("Hello anchor selector ".concat(t.anchorElementSelector," not found after 3 seconds, falling back to 'notFoundElementFallback': ").concat(t.notFoundElementFallback),"info");var o=injectDefaultWrapper({position:convertPosition(t.notFoundElementFallback)});injectHelloComponent(o)}}),3e3)}return[2]}))}))};var zonosControllerCss=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";var ZonosControllerStyle0=zonosControllerCss;var ZonosController=function(){function t(t){registerInstance(this,t);this.paypalInitEvent=createEvent(this,"paypalInitEvent",7);this.stripeInitEvent=createEvent(this,"stripeInitEvent",7);this.config=undefined;this.zonosApiKey=undefined}t.prototype.initCheckoutElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){if(!t){log("Stripe is not loaded yet - cannot init checkout element","warn");return[2]}stripeStore.stripe=t;void initCheckout(zonosStore.checkoutSettings);log("init checkout element");return[2]}))}))};t.prototype.initZonosNotification=function(){var t=document.querySelector("zonos-notification");if(t){return}var o=document.createElement("zonos-notification");document.body.appendChild(o)};t.prototype.setupGoogleFont=function(t){return __awaiter(this,void 0,void 0,(function(){var o,n,e,i,r,s,a,u;return __generator(this,(function(c){switch(c.label){case 0:e=t||zonosStoreFontFamily();if(e==="Inter"){if(!t){return[2]}log("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn");zonosStore.appearance=Object.assign(Object.assign({},zonosStore.appearance),{fontFamily:t})}i=new URLSearchParams;i.set("family",e);return[4,handleFetch("/api/zonos-elements/get-font-detail?".concat(i.toString()))];case 1:r=c.sent(),s=r.errors,a=r.json;if(s.length>0){log("Failed to load font ".concat(e),"warn");zonosStore.appearance=Object.assign(Object.assign({},zonosStore.appearance),{fontFamily:"Inter"});return[2]}u=a===null||a===void 0?void 0:a.fontUrl;if(u){(n=(o=window.Zonos).injectSupportGoogleFont)===null||n===void 0?void 0:n.call(o,u)}if(!t){return[2]}log("[FONT] ".concat(t," font override applied"));zonosStore.appearance=Object.assign(Object.assign({},zonosStore.appearance),{fontFamily:t});return[2]}}))}))};t.prototype.handleLocationChange=function(){void initHello(zonosStore.helloSettings)};t.prototype.initHistoryListener=function(){var t=history.pushState;history.pushState=function o(){window.dispatchEvent(new window.Event("pushstate"));window.dispatchEvent(new window.Event("locationchange"));return t.apply(this,arguments)};var o=history.replaceState;history.replaceState=function t(){window.dispatchEvent(new window.Event("replacestate"));window.dispatchEvent(new window.Event("locationchange"));return o.apply(this,arguments)}};t.prototype.injectCustomHTML=function(t){if(!t){return}if(!window.Zonos.isLegacyCheckout){log("=== Skip injecting custom HTML for hosted checkout","info");return}log("=== Injecting custom HTML for hosted checkout");var o=document.createElement("template");o.innerHTML=t;var n=o.content.querySelectorAll("script");n.forEach((function(t){var o=document.createElement("script");if(t.src){o.src=t.src;o.async=t.async}else{o.textContent=t.innerHTML}document.body.appendChild(o)}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){this.initHistoryListener();zonosStore.zonosApiKey=this.zonosApiKey;(function(){return __awaiter(t,void 0,void 0,(function(){var t,o,n,e,i,r,s,a,u,c,l,d,f,h;var v=this;return __generator(this,(function(g){switch(g.label){case 0:return[4,getZonosSettings()];case 1:r=g.sent(),s=r.errors,a=r.json,u=r.zonosMode;if(((t=s[0])===null||t===void 0?void 0:t.type.toString())==="403"){log("Failed to load zonos settings. This domain may not have access","warn");return[2]}c=((o=a===null||a===void 0?void 0:a.checkoutSettings)===null||o===void 0?void 0:o.customHTML)||"";this.injectCustomHTML(c);this.initZonosNotification();l=function(){var t,o,n;if(window.Zonos.isLegacyCheckout){return((t=a===null||a===void 0?void 0:a.appearanceSettings)===null||t===void 0?void 0:t.logoUrl)||((o=v.config.appearance)===null||o===void 0?void 0:o.logoUrl)}return(n=v.config.appearance)===null||n===void 0?void 0:n.logoUrl};d=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&((n=this.config.checkoutSettings)===null||n===void 0?void 0:n.successBehavior)==="CLOSE_MODAL";f=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:l()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:undefined,subscriptionStatus:undefined,successBehavior:d?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:d?(e=window.Zonos.cartData)===null||e===void 0?void 0:e.storeBaseUrl:this.config.checkoutSettings.successRedirectUrl}):undefined});zonosStoreInitSetting({overrideSettings:f,zonosSettings:a});zonosStore.zonosMode=u;void this.setupGoogleFont();if(zonosStore.helloSettings.visibilityStatus==="DISABLED"){log("=== Hello is disabled by store owner ===","warn")}if(zonosStore.helloSettings&&zonosStore.helloSettings.visibilityStatus==="ENABLED"){log("Initializing hello");void initHello(zonosStore.helloSettings)}return[4,initLocalizationStore()];case 2:g.sent();h=((i=a===null||a===void 0?void 0:a.checkoutSettings)===null||i===void 0?void 0:i.externalServiceTokens.find((function(t){return t.type==="STRIPE_PUBLISHABLE_TOKEN"})))||null;if(!h||!this.stripeInitEvent){log("Checkout failed to load -- missing publishable key","warn");return[2]}if(zonosStore.checkoutSettings.subscriptionStatus==="INACTIVE"){log('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn");log("zonos controller loaded");return[2]}if(zonosStore.checkoutSettings.visibilityStatus==="DISABLED"){log("=== Checkout is disabled by store owner ===","warn");log("zonos controller loaded");return[2]}this.stripeInitEvent.emit({publishableKey:h.token});return[2]}}))}))})();return[2]}))}))};t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(n){o=document.querySelector("zonos-notification");if(!o){log("Failed to show notification - zonos-notification not found","warn");return[2]}void o.showNotification(t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){cartStore.checkoutSessionId=null;stripeStore.clientSecret="";return[2]}))}))};t.prototype.overrideConfig=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){zonosStoreInitSetting({overrideSettings:t,zonosSettings:null});return[2]}))}))};t.prototype.overrideCountry=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){log("Override country code to ".concat(t));void localizationStoreUpdateSelectedCountryCode(t);return[2]}))}))};t.prototype.getAppearanceSetting=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,zonosStore.appearance]}))}))};t.prototype.updateOrganizationName=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){zonosStore.organizationName=t;return[2]}))}))};t.prototype.render=function(){return h(Host,{key:"031af3ed517512a8f937ac66672f42aa28759826",class:"zonos--elements"})};return t}();ZonosController.style=ZonosControllerStyle0;export{ZonosController as zonos_controller};
1
+ var __awaiter=this&&this.__awaiter||function(t,o,n,e){function i(t){return t instanceof n?t:new n((function(o){o(t)}))}return new(n||(n=Promise))((function(n,r){function s(t){try{u(e.next(t))}catch(t){r(t)}}function a(t){try{u(e["throw"](t))}catch(t){r(t)}}function u(t){t.done?n(t.value):i(t.value).then(s,a)}u((e=e.apply(t,o||[])).next())}))};var __generator=this&&this.__generator||function(t,o){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},e,i,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(o){return u([t,o])}}function u(a){if(e)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(e=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;i=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=o.call(t,n)}catch(t){a=[6,t];i=0}finally{e=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-d82f06f2.js";import{G as isValidSelector,f as stripeStore,H as initLocalizationStore,e as cartStore,a as localizationStoreUpdateSelectedCountryCode}from"./cart-41bdd9fb.js";import{z as zonosStore,b as zonosStoreInitSetting,d as zonosStoreFontFamily}from"./zonosStore-71d7e02f.js";import{h as handleFetch,b as logError,l as log}from"./handleFetch-b4633675.js";import"./isDarkColor-2f59d721.js";import"./getBorderRadius-740610fb.js";var getZonosSettings=function(){return __awaiter(void 0,void 0,void 0,(function(){var t,o,n,e;return __generator(this,(function(i){switch(i.label){case 0:return[4,handleFetch("/api/zonos-elements/zonos-settings")];case 1:t=i.sent(),o=t.errors,n=t.json,e=t.zonosMode;if(o.length){logError("Error occurred when getting zonos settings. If this is not an unauthorized error, it will use user settings or default settings");return[2,{errors:o,json:null,zonosMode:e}]}return[2,{errors:[],json:n,zonosMode:e}]}}))}))};var injectCheckoutElement=function(){var t=document.querySelector("zonos-checkout");if(!t){var o=document.createElement("zonos-checkout");document.body.appendChild(o)}};var initCheckout=function(t){if(!t.placeOrderButtonSelector&&!window.Zonos.cartData){return}if(t.placeOrderButtonSelector&&!isValidSelector(t.placeOrderButtonSelector)){logError('Selector checkoutButtonAnchor "'.concat(t.placeOrderButtonSelector,'" is not a valid selector'));return}injectCheckoutElement()};var injectHelloComponent=function(t){var o=document.querySelector(t);var n=document.querySelector("zonos-hello");if(!n&&o){var e=document.createElement("zonos-hello");o.appendChild(e);return true}return false};var convertPosition=function(t){switch(t){case"BOTTOM_RIGHT":return"bottom-right";case"BOTTOM_LEFT":return"bottom-left";case"TOP_LEFT":return"top-left";case"TOP_RIGHT":return"top-right";default:return"bottom-right"}};var injectDefaultWrapper=function(t){var o=t.position,n=o===void 0?"bottom-right":o;var e=".zonos--hello-mobile-wrapper";var i=document.querySelector(e);if(i){return e}var r=document.createElement("div");r.className="zonos--hello-mobile-wrapper";r.style.position="fixed";if(n==="top-right"){r.style.top="72px";r.style.right="24px"}if(n==="top-left"){r.style.top="72px";r.style.left="24px"}if(n==="bottom-right"){r.style.bottom="72px";r.style.right="24px"}if(n==="bottom-left"){r.style.bottom="72px";r.style.left="24px"}r.style.zIndex="2147483007";document.body.appendChild(r);return e};var initHello=function(t){return __awaiter(void 0,void 0,void 0,(function(){var o,n,e,i,r;return __generator(this,(function(s){if(window.Zonos.isLegacyCheckout){log("Hello is disabled when isLegacyCheckout","info");return[2]}o=t.anchorElementSelector;n=o;if(!t.anchorElementSelector&&t.desktopLocation){e=injectDefaultWrapper({position:"bottom-right"});n=e}if(!n||!isValidSelector(n)){logError('Selector anchorElementSelector "'.concat(t.anchorElementSelector,'" is not a valid selector.'));return[2]}log("Hello init complete");i=injectHelloComponent(n);if(!i){r=new MutationObserver((function(){var t=injectHelloComponent(n);if(t){r.disconnect()}}));r.observe(document.body,{childList:true,subtree:true});setTimeout((function(){injectHelloComponent(n)}),1e3);setTimeout((function(){if(t.notFoundElementFallback){log("Hello anchor selector ".concat(t.anchorElementSelector," not found after 3 seconds, falling back to 'notFoundElementFallback': ").concat(t.notFoundElementFallback),"info");var o=injectDefaultWrapper({position:convertPosition(t.notFoundElementFallback)});injectHelloComponent(o)}}),3e3)}return[2]}))}))};var zonosControllerCss=":host{font-family:var(--zonos--font-family, Inter), Inter;display:block;white-space:normal}:host *{font-family:var(--zonos--font-family, Inter), Inter}:host img{max-width:100%}:host dl,:host dd,:host h1,:host h2,:host h3,:host h4,:host h5,:host h6,:host hr,:host figure,:host p,:host pre{margin:0}:host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}:host{visibility:hidden;opacity:0;height:0}";var ZonosControllerStyle0=zonosControllerCss;var ZonosController=function(){function t(t){registerInstance(this,t);this.paypalInitEvent=createEvent(this,"paypalInitEvent",7);this.stripeInitEvent=createEvent(this,"stripeInitEvent",7);this.config=undefined;this.zonosApiKey=undefined}t.prototype.initCheckoutElement=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){if(!t){log("Stripe is not loaded yet - cannot init checkout element","warn");return[2]}stripeStore.stripe=t;void initCheckout(zonosStore.checkoutSettings);log("init checkout element");return[2]}))}))};t.prototype.initZonosNotification=function(){var t=document.querySelector("zonos-notification");if(t){return}var o=document.createElement("zonos-notification");document.body.appendChild(o)};t.prototype.setupGoogleFont=function(t){return __awaiter(this,void 0,void 0,(function(){var o,n,e,i,r,s,a,u;return __generator(this,(function(c){switch(c.label){case 0:e=t||zonosStoreFontFamily();if(e==="Inter"){if(!t){return[2]}log("[FONT] Just applied Inter , but no need to inject since we already inject Inter on start","warn");zonosStore.appearance=Object.assign(Object.assign({},zonosStore.appearance),{fontFamily:t})}i=new URLSearchParams;i.set("family",e);return[4,handleFetch("/api/zonos-elements/get-font-detail?".concat(i.toString()))];case 1:r=c.sent(),s=r.errors,a=r.json;if(s.length>0){log("Failed to load font ".concat(e),"warn");zonosStore.appearance=Object.assign(Object.assign({},zonosStore.appearance),{fontFamily:"Inter"});return[2]}u=a===null||a===void 0?void 0:a.fontUrl;if(u){(n=(o=window.Zonos).injectSupportGoogleFont)===null||n===void 0?void 0:n.call(o,u)}if(!t){return[2]}log("[FONT] ".concat(t," font override applied"));zonosStore.appearance=Object.assign(Object.assign({},zonosStore.appearance),{fontFamily:t});return[2]}}))}))};t.prototype.handleLocationChange=function(){void initHello(zonosStore.helloSettings)};t.prototype.initHistoryListener=function(){var t=history.pushState;history.pushState=function o(){window.dispatchEvent(new window.Event("pushstate"));window.dispatchEvent(new window.Event("locationchange"));return t.apply(this,arguments)};var o=history.replaceState;history.replaceState=function t(){window.dispatchEvent(new window.Event("replacestate"));window.dispatchEvent(new window.Event("locationchange"));return o.apply(this,arguments)}};t.prototype.injectCustomHTML=function(t){if(!t){return}if(!window.Zonos.isLegacyCheckout){log("=== Skip injecting custom HTML for hosted checkout","info");return}log("=== Injecting custom HTML for hosted checkout");var o=document.createElement("template");o.innerHTML=t;var n=o.content.querySelectorAll("script");n.forEach((function(t){var o=document.createElement("script");if(t.src){o.src=t.src;o.async=t.async}else{o.textContent=t.innerHTML}document.body.appendChild(o)}))};t.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(o){this.initHistoryListener();zonosStore.zonosApiKey=this.zonosApiKey;(function(){return __awaiter(t,void 0,void 0,(function(){var t,o,n,e,i,r,s,a,u,c,l,d,f,h,v;var g=this;return __generator(this,(function(w){switch(w.label){case 0:return[4,getZonosSettings()];case 1:s=w.sent(),a=s.errors,u=s.json,c=s.zonosMode;if(((o=(t=a[0])===null||t===void 0?void 0:t.type)===null||o===void 0?void 0:o.toString())==="403"){log("Failed to load zonos settings. This domain may not have access","warn");return[2]}l=((n=u===null||u===void 0?void 0:u.checkoutSettings)===null||n===void 0?void 0:n.customHTML)||"";this.injectCustomHTML(l);this.initZonosNotification();d=function(){var t,o,n;if(window.Zonos.isLegacyCheckout){return((t=u===null||u===void 0?void 0:u.appearanceSettings)===null||t===void 0?void 0:t.logoUrl)||((o=g.config.appearance)===null||o===void 0?void 0:o.logoUrl)}return(n=g.config.appearance)===null||n===void 0?void 0:n.logoUrl};f=window.Zonos.isLegacyCheckout&&!!window.Zonos.cartData&&((e=this.config.checkoutSettings)===null||e===void 0?void 0:e.successBehavior)==="CLOSE_MODAL";h=Object.assign(Object.assign({},this.config),{appearance:Object.assign(Object.assign({},this.config.appearance),{logoUrl:d()}),checkoutSettings:this.config.checkoutSettings?Object.assign(Object.assign({},this.config.checkoutSettings),{allowedSettlementCurrencies:undefined,subscriptionStatus:undefined,successBehavior:f?"ZONOS_SUCCESS_PAGE":this.config.checkoutSettings.successBehavior,successRedirectUrl:f?(i=window.Zonos.cartData)===null||i===void 0?void 0:i.storeBaseUrl:this.config.checkoutSettings.successRedirectUrl}):undefined});zonosStoreInitSetting({overrideSettings:h,zonosSettings:u});zonosStore.zonosMode=c;void this.setupGoogleFont();if(zonosStore.helloSettings.visibilityStatus==="DISABLED"){log("=== Hello is disabled by store owner ===","warn")}if(zonosStore.helloSettings&&zonosStore.helloSettings.visibilityStatus==="ENABLED"){log("Initializing hello");void initHello(zonosStore.helloSettings)}return[4,initLocalizationStore()];case 2:w.sent();v=((r=u===null||u===void 0?void 0:u.checkoutSettings)===null||r===void 0?void 0:r.externalServiceTokens.find((function(t){return t.type==="STRIPE_PUBLISHABLE_TOKEN"})))||null;if(!v||!this.stripeInitEvent){log("Checkout failed to load -- missing publishable key","warn");return[2]}if(zonosStore.checkoutSettings.subscriptionStatus==="INACTIVE"){log('=== Checkout subscription is "INACTIVE" - Cancel initializing for Checkout ===',"warn");log("zonos controller loaded");return[2]}if(zonosStore.checkoutSettings.visibilityStatus==="DISABLED"){log("=== Checkout is disabled by store owner ===","warn");log("zonos controller loaded");return[2]}this.stripeInitEvent.emit({publishableKey:v.token});return[2]}}))}))})();return[2]}))}))};t.prototype.showNotification=function(t){return __awaiter(this,void 0,void 0,(function(){var o;return __generator(this,(function(n){o=document.querySelector("zonos-notification");if(!o){log("Failed to show notification - zonos-notification not found","warn");return[2]}void o.showNotification(t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){cartStore.checkoutSessionId=null;stripeStore.clientSecret="";return[2]}))}))};t.prototype.overrideConfig=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){zonosStoreInitSetting({overrideSettings:t,zonosSettings:null});return[2]}))}))};t.prototype.overrideCountry=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){log("Override country code to ".concat(t));void localizationStoreUpdateSelectedCountryCode(t);return[2]}))}))};t.prototype.getAppearanceSetting=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,zonosStore.appearance]}))}))};t.prototype.updateOrganizationName=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(o){zonosStore.organizationName=t;return[2]}))}))};t.prototype.render=function(){return h(Host,{key:"d5d6c9e8984b321893b92612620a16f3f43d81fa",class:"zonos--elements"})};return t}();ZonosController.style=ZonosControllerStyle0;export{ZonosController as zonos_controller};
@@ -1 +1 @@
1
- var __awaiter=this&&this.__awaiter||function(e,o,t,i){function n(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i["throw"](e))}catch(e){r(e)}}function l(e){e.done?t(e.value):n(e.value).then(s,a)}l((i=i.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,n,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(o){return l([e,o])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(t=0)),t)try{if(i=1,n&&(r=a[0]&2?n["return"]:a[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;if(n=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;n=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(r=t.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){t.label=a[1];break}if(a[0]===6&&t.label<r[1]){t.label=r[1];r=a;break}if(r&&t.label<r[2]){t.label=r[2];t.ops.push(a);break}if(r[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];n=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{p as promiseResolve,b as bootstrapLazy}from"./index-d82f06f2.js";export{s as setNonce}from"./index-d82f06f2.js";import{g as globalScripts}from"./app-globals-0f993ce5.js";var patchBrowser=function(){var e=import.meta.url;var o={};if(e!==""){o.resourcesUrl=new URL(".",e).href}return promiseResolve(o)};patchBrowser().then((function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,globalScripts()];case 1:o.sent();return[2,bootstrapLazy(JSON.parse('[["zonos-checkout",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"overrideStagingMode":[4,"override-staging-mode"],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"defaultAddressParams":[32],"open":[32],"stripe":[32],"submitLoading":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"isIframed":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"isCartExpired":[32],"payInUsdConfirmDialogOpen":[32],"inventoryCheckErrorMessage":[32],"placedOrderInfo":[32],"clientSecret":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64],"mockCheckoutSession":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"overrideStagingMode":["overrideStagingModeChanged"],"mobile":["handleMobileChange"],"defaultAddress":["handleAddressChange"],"clientSecret":["handleClientSecretChange"],"open":["handleOpenChange"]}]]],["zonos-hello",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"isHelloWidgetRendered":[32],"isMobile":[32],"getCountryList":[64],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"reset":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-tooltip",[[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-component",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-hello-dialog",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-badge",[[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4],"loading":[4],"dismissHandler":[16]}]]],["zonos-shipping-rich-radio",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"selectedItem":[16]}]]],["zonos-toggle",[[1,"zonos-toggle",{"options":[16],"value":[1]}]]],["zonos-collapse",[[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["zonos-card",[[1,"zonos-card",{"actions":[16],"backgroundColor":[1,"background-color"],"borderRadius":[2,"border-radius"],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["zonos-input",[[1,"zonos-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"inputSize":[1,"input-size"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[32]},null,{"inputValue":["onInputValueChange"]}]]],["zonos-text",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-banner",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-country-flag",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-v-stack",[[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-empty-state-payment_4",[[1,"zonos-empty-state-payment",{"emptyStateText":[1,"empty-state-text"],"theme":[1]}],[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}],[2,"zonos-paypal-payment"],[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["zonos-button_3",[[17,"zonos-button",{"buttonColor":[1,"button-color"],"backgroundColor":[1,"background-color"],"borderStyle":[1,"border-style"],"isDisabled":[4,"is-disabled"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"variant":[1],"noBackground":[4,"no-background"],"withBoxShadow":[4,"with-box-shadow"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"justifyContent":[1,"justify-content"],"bold":[4],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}]]],["zonos-language-select_2",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}]]],["zonos-country-select_4",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}],[2,"zonos-virtual-scroll",{"renderItem":[16],"itemWidth":[2,"item-width"],"fallbackItemHeight":[2,"fallback-item-height"],"itemHeights":[16],"container":[32],"scrollTop":[32],"totalHeight":[32]},null,{"itemHeights":["updateTotalHeight"],"fallbackItemHeight":["updateTotalHeight"]}]]],["zonos-address_8",[[1,"zonos-address-update-dialog",{"continueLoading":[4,"continue-loading"],"dialogLoading":[4,"dialog-loading"],"dialogOpen":[4,"dialog-open"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"shippingAddress":[16],"billingAddress":[16],"translatedShippingAddress":[16],"translatedBillingAddress":[16],"showErrorBanner":[32],"translatedShippingAddressState":[32],"translatedBillingAddressState":[32]},null,{"translatedShippingAddress":["watchTranslatedShippingAddress"],"translatedBillingAddress":["watchTranslatedBillingAddress"]}],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"defaultEmail":[1,"default-email"],"isEmailError":[4,"is-email-error"],"stripe":[32],"isStagingMode":[32],"clientSecret":[32]},null,{"isStagingMode":["watchIsStagingMode"],"stripe":["watchInitStripe"],"clientSecret":["watchInitStripe"],"defaultEmail":["watchDefaultEmail"]}],[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"stripe":[32],"isDirtyAddress":[32]},null,{"stripe":["watchInitStripe"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]},[[1,"click","onClick"]]],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"minHeight":[1,"min-height"],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"borderStyle":[1,"border-style"],"noCloseButton":[4,"no-close-button"],"noClickOutside":[4,"no-click-outside"],"mobile":[4],"isLoading":[4,"is-loading"],"isMobile":[32]},[[9,"resize","handleWindowResize"],[4,"keydown","handleKeyDown"]]],[1,"zonos-address-display",{"currentAddress":[16],"addressType":[1,"address-type"]}],[1,"zonos-address-form",{"currentAddress":[16],"translatedAddress":[16],"addressType":[1,"address-type"],"localAddress":[32]},null,{"translatedAddress":["watchCurrentAddress"]}],[1,"zonos-stripe-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[1025],"internalValue":[32]},null,{"inputValue":["onInputValueChange"],"value":["onValueChange"]}]]],["zonos-cart-items_13",[[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"defaultAddress":[16],"showErrorBanner":[32],"shippingCountry":[32],"isCheckingForRestrictedItems":[32],"isValidatingAddress":[32],"isTaxIdError":[32],"invalidShippingCharacterList":[32],"invalidBillingCharacterList":[32],"openAddressValidationDialog":[32],"isEmailError":[32]}],[2,"zonos-checkout-payment",{"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"overridePrimaryColor":[1,"override-primary-color"],"showErrorBanner":[32],"hasStripePaymentError":[32],"stagingOrderCreateErrorMessage":[32],"internalContinueLoading":[32]},null,{"continueLoading":["continueLoadingWatcher"],"hasStripePaymentError":["stripePaymentErrorWatcher"]}],[1,"zonos-checkout-footer",{"mobile":[4],"dataTheme":[1,"data-theme"],"showLanguageDialog":[32],"isMobile":[32]},[[4,"click","handleGlobalClick"]],{"mobile":["handleMobileChange"]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"collapsedDAPOptions":[32],"isSelecting":[32],"showErrorBanner":[32],"serviceLevelsDDP":[32],"serviceLevelsDAP":[32],"serviceLevelsOther":[32],"serviceLevelsAll":[32],"displayBaseCurrency":[32]}],[1,"zonos-cart-subtotal",{"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"loading":[32]}],[1,"zonos-cart-restricted-items",{"hide":[4],"errorImages":[32],"internalCollapsed":[32],"firstRender":[32]}],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"notificationActionText":[32],"order":[32],"isWaitingToRedirect":[32]}],[1,"zonos-confirm-dialog",{"dialogTitle":[1,"dialog-title"],"dialogIntent":[1,"dialog-intent"],"dialogSubtitle":[1,"dialog-subtitle"],"submitBtnColor":[1,"submit-btn-color"],"dialogConfirmBtnText":[1,"dialog-confirm-btn-text"],"dialogWidth":[2,"dialog-width"],"dialogCancelBtnText":[1,"dialog-cancel-btn-text"],"dialogType":[1,"dialog-type"],"isMobile":[4,"is-mobile"],"dialogOpen":[4,"dialog-open"],"noClickOutside":[4,"no-click-outside"]},[[4,"keydown","handleKeyDown"]]],[1,"zonos-checkout-progress-tabs",{"tabColor":[1,"tab-color"],"backgroundColor":[1,"background-color"],"setTabItems":[64],"setTabSelected":[64]}],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}],[1,"zonos-currency-toggle",{"errorImages":[32]}],[1,"zonos-rest-state",{"restStateSubtitle":[1,"rest-state-subtitle"],"restStateTitle":[1,"rest-state-title"],"restStateType":[1,"rest-state-type"],"isErrorImageLoad":[32]}]]]]'),e)]}}))}))}));
1
+ var __awaiter=this&&this.__awaiter||function(e,o,t,i){function n(e){return e instanceof t?e:new t((function(o){o(e)}))}return new(t||(t=Promise))((function(t,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i["throw"](e))}catch(e){r(e)}}function l(e){e.done?t(e.value):n(e.value).then(s,a)}l((i=i.apply(e,o||[])).next())}))};var __generator=this&&this.__generator||function(e,o){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,n,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(o){return l([e,o])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(t=0)),t)try{if(i=1,n&&(r=a[0]&2?n["return"]:a[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;if(n=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:t.label++;return{value:a[1],done:false};case 5:t.label++;n=a[1];a=[0];continue;case 7:a=t.ops.pop();t.trys.pop();continue;default:if(!(r=t.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){t.label=a[1];break}if(a[0]===6&&t.label<r[1]){t.label=r[1];r=a;break}if(r&&t.label<r[2]){t.label=r[2];t.ops.push(a);break}if(r[2])t.ops.pop();t.trys.pop();continue}a=o.call(e,t)}catch(e){a=[6,e];n=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{p as promiseResolve,b as bootstrapLazy}from"./index-d82f06f2.js";export{s as setNonce}from"./index-d82f06f2.js";import{g as globalScripts}from"./app-globals-0f993ce5.js";var patchBrowser=function(){var e=import.meta.url;var o={};if(e!==""){o.resourcesUrl=new URL(".",e).href}return promiseResolve(o)};patchBrowser().then((function(e){return __awaiter(void 0,void 0,void 0,(function(){return __generator(this,(function(o){switch(o.label){case 0:return[4,globalScripts()];case 1:o.sent();return[2,bootstrapLazy(JSON.parse('[["zonos-checkout",[[2,"zonos-checkout",{"appearanceSettingsOverride":[16],"preview":[4],"mobile":[4],"overrideStagingMode":[4,"override-staging-mode"],"defaultAddress":[16],"forceDialogOpen":[4,"force-dialog-open"],"defaultAddressParams":[32],"open":[32],"stripe":[32],"submitLoading":[32],"collapseReviewMobile":[32],"isAttachError":[32],"isMobile":[32],"isIframed":[32],"zonosReviewRef":[32],"storybookPaymentStatusOverride":[32],"isLegacyCheckout":[32],"confirmDialogOpen":[32],"isCartExpired":[32],"payInUsdConfirmDialogOpen":[32],"inventoryCheckErrorMessage":[32],"placedOrderInfo":[32],"clientSecret":[32],"closeDialogHandler":[64],"init":[64],"setToFinishStep":[64],"mockCheckoutSession":[64]},[[16,"zonos--init-cart-info","initCartInfoHandler"],[4,"keydown","handleKeyPress"],[9,"resize","handleWindowResize"]],{"appearanceSettingsOverride":["appearanceSettingsOverrideChanged","handleAppearanceSettingsOverrideChange"],"overrideStagingMode":["overrideStagingModeChanged"],"mobile":["handleMobileChange"],"defaultAddress":["handleAddressChange"],"clientSecret":["handleClientSecretChange"],"open":["handleOpenChange"]}]]],["zonos-hello",[[1,"zonos-hello",{"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettingsOverride":[16],"showPeekMessage":[32],"zonosStoreHelloSettings":[32],"showDialog":[32],"peekMessage":[32],"initialUrl":[32],"allRestrictedItems":[32],"allFoundProducts":[32],"productsOnPage":[32],"isHelloWidgetRendered":[32],"isMobile":[32],"getCountryList":[64],"displayCurrency":[64],"convertAndFormat":[64],"convert":[64],"format":[64],"openHelloDialog":[64]},[[9,"resize","handleResize"]],{"appearanceSettingsOverride":["handleAppearanceSettingsOverrideChange"]}]]],["zonos-controller",[[1,"zonos-controller",{"config":[16],"zonosApiKey":[1,"zonos-api-key"],"initCheckoutElement":[64],"setupGoogleFont":[64],"showNotification":[64],"reset":[64],"overrideConfig":[64],"overrideCountry":[64],"getAppearanceSetting":[64],"updateOrganizationName":[64]},[[8,"locationchange","handleLocationChange"]]]]],["zonos-tooltip",[[1,"zonos-tooltip",{"label":[1],"subtitle":[1],"showTooltip":[32]}]]],["zonos-component",[[1,"zonos-component",{"first":[1],"middle":[1],"last":[1]}]]],["zonos-link",[[1,"zonos-link",{"href":[1],"rel":[1],"target":[1],"linkTitle":[1,"link-title"]}]]],["zonos-logo",[[1,"zonos-logo",{"theme":[1],"width":[1]}]]],["zonos-hello-dialog",[[1,"zonos-hello-dialog",{"isOpen":[4,"is-open"],"setIsOpen":[16],"mobileLocationOverride":[1,"mobile-location-override"],"animateFromLeftOverride":[4,"animate-from-left-override"],"appearanceSettings":[16],"restrictedItems":[16],"welcomeMessage":[32],"showCountrySelect":[32],"showLanguageSelect":[32]},[[4,"click","globalClickHandler"]],{"isOpen":["isOpenHandler"]}]]],["zonos-badge",[[1,"zonos-badge",{"bold":[4],"badgeColor":[1,"badge-color"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"rounded":[4],"loading":[4],"dismissHandler":[16]}]]],["zonos-shipping-rich-radio",[[1,"zonos-shipping-rich-radio",{"items":[16],"borderColor":[1,"border-color"],"borderStyle":[1,"border-style"],"theme":[1],"selectedItem":[16]}]]],["zonos-toggle",[[1,"zonos-toggle",{"options":[16],"value":[1]}]]],["zonos-collapse",[[1,"zonos-collapse",{"collapsed":[4],"collapseSize":[2,"collapse-size"],"height":[32],"iframe":[32]}]]],["zonos-card",[[1,"zonos-card",{"actions":[16],"backgroundColor":[1,"background-color"],"borderRadius":[2,"border-radius"],"footerActions":[16],"footerContent":[16],"footerHeight":[2,"footer-height"],"label":[16],"spacing":[1]}]]],["zonos-input",[[1,"zonos-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"inputSize":[1,"input-size"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[32]},null,{"inputValue":["onInputValueChange"]}]]],["zonos-text",[[1,"zonos-text",{"textColor":[1,"text-color"],"size":[1],"type":[1],"weight":[2],"ready":[32]}]]],["zonos-banner",[[1,"zonos-banner",{"bannerTitle":[1,"banner-title"],"intent":[1],"hasContent":[32]}]]],["zonos-country-flag",[[1,"zonos-country-flag",{"countryCode":[1,"country-code"],"size":[2]}]]],["zonos-v-stack",[[1,"zonos-v-stack",{"spacing":[2]}]]],["zonos-empty-state-payment_4",[[1,"zonos-empty-state-payment",{"emptyStateText":[1,"empty-state-text"],"theme":[1]}],[2,"zonos-payment",{"titleText":[1,"title-text"],"stripe":[32],"stripeElements":[32]},null,{"stripeElements":["watchInitStripe"],"stripe":["watchInitStripe"]}],[2,"zonos-paypal-payment"],[1,"zonos-notification",{"notificationArray":[32],"showNotification":[64]}]]],["zonos-button_3",[[17,"zonos-button",{"buttonColor":[1,"button-color"],"backgroundColor":[1,"background-color"],"borderStyle":[1,"border-style"],"isDisabled":[4,"is-disabled"],"icon":[16],"iconRight":[4,"icon-right"],"size":[1],"variant":[1],"noBackground":[4,"no-background"],"withBoxShadow":[4,"with-box-shadow"],"noPaddingLeft":[4,"no-padding-left"],"noPaddingRight":[4,"no-padding-right"],"loading":[4],"justifyContent":[1,"justify-content"],"bold":[4],"theme":[1],"hasIcon":[32],"hasContent":[32]},[[2,"click","clickHandler"]],{"icon":["iconChangeHandler"]}],[1,"zonos-spinner",{"size":[2],"spinnerColor":[1,"spinner-color"]}],[1,"zonos-icon",{"autoHeight":[4,"auto-height"],"iconColor":[1,"icon-color"],"content":[1],"size":[2]}]]],["zonos-language-select_2",[[1,"zonos-language-select",{"handleOnClose":[16]}],[1,"zonos-select-dialog-header",{"handleOnClose":[16],"label":[1]}]]],["zonos-country-select_4",[[1,"zonos-country-select",{"handleOnClose":[16],"inputValue":[32]}],[1,"zonos-hello-dialog-footer",{"appearanceSettings":[16],"setShowCountrySelect":[16],"setShowLanguageSelect":[16]}],[1,"zonos-custom-message",{"icon":[1],"message":[1]}],[2,"zonos-virtual-scroll",{"renderItem":[16],"itemWidth":[2,"item-width"],"fallbackItemHeight":[2,"fallback-item-height"],"itemHeights":[16],"container":[32],"scrollTop":[32],"totalHeight":[32]},null,{"itemHeights":["updateTotalHeight"],"fallbackItemHeight":["updateTotalHeight"]}]]],["zonos-address_8",[[1,"zonos-address-update-dialog",{"continueLoading":[4,"continue-loading"],"dialogLoading":[4,"dialog-loading"],"dialogOpen":[4,"dialog-open"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"shippingAddress":[16],"billingAddress":[16],"translatedShippingAddress":[16],"translatedBillingAddress":[16],"showErrorBanner":[32],"translatedShippingAddressState":[32],"translatedBillingAddressState":[32]},null,{"translatedShippingAddress":["watchTranslatedShippingAddress"],"translatedBillingAddress":["watchTranslatedBillingAddress"]}],[2,"zonos-link-authentication",{"titleText":[1,"title-text"],"defaultEmail":[1,"default-email"],"isEmailError":[4,"is-email-error"],"stripe":[32],"isStagingMode":[32],"clientSecret":[32]},null,{"isStagingMode":["watchIsStagingMode"],"stripe":["watchInitStripe"],"clientSecret":["watchInitStripe"],"defaultEmail":["watchDefaultEmail"]}],[2,"zonos-address",{"type":[1],"titleText":[1,"title-text"],"defaultAddress":[16],"stripe":[32],"isDirtyAddress":[32]},null,{"stripe":["watchInitStripe"],"defaultAddress":["defaultAddressChanged"]}],[1,"zonos-checkbox",{"backgroundColor":[1,"background-color"],"label":[1],"isChecked":[4,"is-checked"],"isDisabled":[4,"is-disabled"],"size":[2],"fontSize":[1,"font-size"],"borderStyle":[1,"border-style"]},[[1,"click","onClick"]]],[1,"zonos-dialog",{"open":[4],"headerText":[1,"header-text"],"width":[1],"height":[1],"minHeight":[1,"min-height"],"noHeader":[4,"no-header"],"noBodyPadding":[4,"no-body-padding"],"noBorder":[4,"no-border"],"borderStyle":[1,"border-style"],"noCloseButton":[4,"no-close-button"],"noClickOutside":[4,"no-click-outside"],"mobile":[4],"isLoading":[4,"is-loading"],"isMobile":[32]},[[9,"resize","handleWindowResize"],[4,"keydown","handleKeyDown"]]],[1,"zonos-address-display",{"currentAddress":[16],"addressType":[1,"address-type"]}],[1,"zonos-address-form",{"currentAddress":[16],"translatedAddress":[16],"addressType":[1,"address-type"],"localAddress":[32]},null,{"translatedAddress":["watchCurrentAddress"]}],[1,"zonos-stripe-input",{"inputValue":[1,"input-value"],"inputLabel":[1,"input-label"],"overridePrimaryColor":[1,"override-primary-color"],"overrideSecondaryColor":[1,"override-secondary-color"],"isDisabled":[4,"is-disabled"],"isError":[4,"is-error"],"inputPlaceholder":[1,"input-placeholder"],"value":[1025],"internalValue":[32]},null,{"inputValue":["onInputValueChange"],"value":["onValueChange"]}]]],["zonos-cart-items_13",[[2,"zonos-customer-info",{"continueLoading":[4,"continue-loading"],"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"defaultAddress":[16],"showErrorBanner":[32],"shippingCountry":[32],"isCheckingForRestrictedItems":[32],"isValidatingAddress":[32],"isTaxIdError":[32],"invalidShippingCharacterList":[32],"invalidBillingCharacterList":[32],"openAddressValidationDialog":[32],"isEmailError":[32]}],[2,"zonos-checkout-payment",{"submitBtnType":[1,"submit-btn-type"],"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"isMobile":[4,"is-mobile"],"overridePrimaryColor":[1,"override-primary-color"],"showErrorBanner":[32],"hasStripePaymentError":[32],"stagingOrderCreateErrorMessage":[32],"internalContinueLoading":[32]},null,{"continueLoading":["continueLoadingWatcher"],"hasStripePaymentError":["stripePaymentErrorWatcher"]}],[1,"zonos-checkout-footer",{"mobile":[4],"dataTheme":[1,"data-theme"],"showLanguageDialog":[32],"isMobile":[32]},[[4,"click","handleGlobalClick"]],{"mobile":["handleMobileChange"]}],[2,"zonos-shipping",{"continueLoading":[4,"continue-loading"],"submitBtnColor":[1,"submit-btn-color"],"submitBtnType":[1,"submit-btn-type"],"selectedShippingMethod":[32],"collapsedDAPOptions":[32],"isSelecting":[32],"showErrorBanner":[32],"serviceLevelsDDP":[32],"serviceLevelsDAP":[32],"serviceLevelsOther":[32],"serviceLevelsAll":[32],"displayBaseCurrency":[32]}],[1,"zonos-cart-subtotal",{"submitBtnType":[1,"submit-btn-type"],"submitBtnColor":[1,"submit-btn-color"],"loading":[32]}],[1,"zonos-cart-restricted-items",{"hide":[4],"errorImages":[32],"internalCollapsed":[32],"firstRender":[32]}],[1,"zonos-checkout-finish",{"borderRadius":[1,"border-radius"],"storybookForceStatus":[1,"storybook-force-status"],"overrideNotification":[16],"isLoading":[32],"notificationType":[32],"notificationTitle":[32],"notificationMessages":[32],"notificationActionText":[32],"order":[32],"isWaitingToRedirect":[32]}],[1,"zonos-confirm-dialog",{"dialogTitle":[1,"dialog-title"],"dialogIntent":[1,"dialog-intent"],"dialogSubtitle":[1,"dialog-subtitle"],"submitBtnColor":[1,"submit-btn-color"],"dialogConfirmBtnText":[1,"dialog-confirm-btn-text"],"dialogWidth":[2,"dialog-width"],"dialogCancelBtnText":[1,"dialog-cancel-btn-text"],"dialogType":[1,"dialog-type"],"isMobile":[4,"is-mobile"],"dialogOpen":[4,"dialog-open"],"noClickOutside":[4,"no-click-outside"]},[[4,"keydown","handleKeyDown"]]],[1,"zonos-checkout-progress-tabs",{"tabColor":[1,"tab-color"],"backgroundColor":[1,"background-color"],"setTabItems":[64],"setTabSelected":[64]}],[1,"zonos-review",{"mobile":[4],"collapsed":[4],"isMobile":[32]},[[9,"resize","handleWindowResize"]]],[1,"zonos-cart-items",{"errorImages":[32]}],[1,"zonos-currency-toggle",{"errorImages":[32]}],[1,"zonos-rest-state",{"restStateSubtitle":[1,"rest-state-subtitle"],"restStateTitle":[1,"rest-state-title"],"restStateType":[1,"rest-state-type"],"isErrorImageLoad":[32]}]]]]'),e)]}}))}))}));
@@ -4838,6 +4838,12 @@ declare abstract class Zonos {
4838
4838
  static showNotification: (notification: NotificationInit) => void;
4839
4839
  static updateOrganizationName: (organizationName: string) => void;
4840
4840
  private static disablePlaceOrderButtons;
4841
+ /**
4842
+ * Zonos elements and its dependencies are using the native browser functions.
4843
+ * This function will restore the native browser functions that are overridden by the merchant's polyfills.
4844
+ * If the URL parameter `useMerchantPolyfill=1` is present, keep the merchant's polyfills instead of restoring native browser functions. This allows testing checkout compatibility with merchant polyfills.
4845
+ */
4846
+ private static restoreNativeBrowserFunctions;
4841
4847
  private static injectController;
4842
4848
  private static injectScript;
4843
4849
  /**
@@ -1 +1 @@
1
- (function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),c=[`(${a})`,...r];c.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...c));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(i=l.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...c);break;case"info":d.info(t,...c);break;case"error":d.error(t,...c);break;default:d.groupCollapsed(t,...c),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function l(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const d=["cloudflare","vercel"],u=d[0],p={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},m=p[u],w=(e=u)=>{const o=d.indexOf(e),t=d[o+1];return t||null},h=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},y=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=h(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},g=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||p[e]||u,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&c&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await y({response:n}),response:n,zonosMode:a}}const l=n.status.toString();try{const e=await y({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map((e=>"string"==typeof e?{message:e,type:l}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:a}}},f=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await g({basePathType:i,options:o,path:n}),{errors:c,response:d}=a,u=l(a,["errors","response"]),y=w(i),v=!!c.find((({type:e})=>"unknown"===e))||404===(null==d?void 0:d.status),S=y&&v;return v&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${m}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=w();if(!o)return;fetch(`${p[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:p[i]+n,errors:c.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:y,requestHeaders:null==o?void 0:o.headers,requestPayload:h(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==d?void 0:d.status,statusText:null==d?void 0:d.statusText},shouldPostReleaseErrorReporting:!0}),S?(t(`=== "${n}" failed to fetch, trying next fallback ${y}`),f({basePathType:y,options:o,path:n})):Object.assign({errors:c,response:d},u)},v=async(e,o)=>{const n=l(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":a()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers);Object.keys(i).forEach((e=>void 0===i[e]&&delete i[e]));const d=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),p=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),f({basePathType:p||u,options:d,path:e})},S=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.161.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},b="https://js.stripe.com/v3",z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,C="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let j=null;const O=e=>(null!==j||(j=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(C),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${b}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&z.test(t.src))return t}return null})();r&&e?console.warn(C):r||(r=(e=>{const o=document.createElement("script");o.src=`${b}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),j),Z=Promise.resolve().then((()=>O(null)));let k=!1;Z.catch((e=>{k||console.warn(e)}));const I=async({cartId:e,retries:o})=>{const n=c(),{errors:r,json:s}=await v("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,options:{noOnlineStoreSettings:!0},tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),I({cartId:e,retries:o-1})):i?null:s},E=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,A=new RegExp(`^${E.source}$`),L=new RegExp(`^cart_${E.source}$`),$=/^[a-zA-Z0-9]{2,}$/,T=/^cart_[a-zA-Z0-9]{2,}$/,N=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:T.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:L.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:A.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await I({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var U;const D=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),P="https://v1.3.161.js.zonos.com",F=D||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.161",R="https://fonts.googleapis.com",x=/^https:\/\/fonts\.googleapis\.com/;class M{}U=M,M.doneInit=!1,M.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),M.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),M._paypalMockResponse=null,M.isBigCommerce=!1,M.releaseDate="1739578619790",M.isLegacyCheckout=!1,M.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",M.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),M.isNpm=!0,M.zonosQaUrl=null,M.zonosQaUrlApi=null,M.version="v1.3.161",M.modeAlerted=!1,M.cartData=null,M.paypal=null,M.getCurrentTimestamp=()=>(new Date).getTime(),M.zonosController=null,M.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:p}=e;if(U.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),U.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${U.version}) ======`),U.zonosApiKey=p,U.storeId=u,U.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=S();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=U.isNpm,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!U.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!U.cartData&&U.cartId){t("Initialize cart data");const e=await N(U.cartId);if(!e)return void n("Failed to get cart data");U.cartData=e.cartData,U.zonosApiKey=e.zonosApiKey}const r=await(async()=>{const e=c(),o=a();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await v("/api/get-test-public-credential");if(r.length||!s)return n("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(t(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(n("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();r&&(U.zonosApiKey=r)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(U.cartId&&U.cartData||!!m){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),U.injectCustomScriptForHostedCheckout(),U.injectZonosCdn(),U.injectZonosCss(),U.injectFonts(),U.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d}}),U.doneInit=!0},M.injectCustomScriptForHostedCheckout=()=>{const e=U.cartData,o=(null==e?void 0:e.metadata)||[],n=o.find((e=>"customHeaderScript"===e.key)),r=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(n||r)){if(n){t("Injecting custom header script");const e=document.createElement("script");e.textContent=n.value,document.head.appendChild(e)}if(r){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=r.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:n,isLegacyCheckout:window.Zonos.isLegacyCheckout})},M.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},M.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},M.showNotification=e=>{var o;null===(o=U.zonosController)||void 0===o||o.showNotification(e)},M.updateOrganizationName=e=>{var o;null===(o=U.zonosController)||void 0===o||o.updateOrganizationName(e)},M.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},M.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=U.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{k=!0;const o=Date.now();return Z.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),U.zonosController=r,t("Zonos controller injected!")},M.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${U.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const t=i(e);t&&U.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(c)},M.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return F;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.161";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.161";case"vercel":return P}};if(U.isNpm){return S()||o()}return o()},M.injectZonosCdn=()=>{U.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),U.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},M.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=U.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${P}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&U.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},M.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(U.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},M.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${R}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!x.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=R,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${R}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(n),t("Zonos font injected!")},M.setupGoogleFont=e=>{var o;null===(o=U.zonosController)||void 0===o||o.setupGoogleFont(e)},M.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${R}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=R,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},exports.Zonos=M})();
1
+ (function(){"use strict";const e=performance.now(),o=e=>{if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(o){if(e&&"function"==typeof e.toString){return e.toString()}return"Unable to stringify info"}},t=(t,n,...r)=>{var s,i;const{elapsedTimePretty:a}=(()=>{const o=performance.now()-e,t=o>1e3?`${(o/1e3).toFixed(2)}s`:`${o.toFixed(2)}ms`;return{elapsedTime:o,elapsedTimePretty:t}})(),c=[`(${a})`,...r];c.map(o).join(" ");if(!(!!(null===(s=window.Zonos)||void 0===s?void 0:s.debug)||!!window.location.search.match(/\?.*(&*)zonosDebug=1/)))return void("error"===n&&console.error(t,...c));let l=document.querySelector("iframe#zonos---debug-logging-iframe");l||(l=document.createElement("iframe"),l.id="zonos---debug-logging-iframe",l.style.display="none",l.style.opacity="0",l.style.position="absolute",l.style.top="-9999px",l.style.left="-9999px",l.style.width="1px",l.style.height="1px",l.style.border="none",l.style.overflow="hidden",l.style.visibility="hidden",document.body.appendChild(l));const d=(null===(i=l.contentWindow)||void 0===i?void 0:i.window.console)||window.console;switch(n){case"warn":d.warn(t,...c);break;case"info":d.info(t,...c);break;case"error":d.error(t,...c);break;default:d.groupCollapsed(t,...c),d.trace(),d.groupEnd()}},n=(e,...o)=>{t(e,"error",...o)},r=["jsdelivr","cdnjs","unpkg","vercel"],s="jsdelivr",i=e=>{const o=r.indexOf(e);return r[o+1]||null},a=()=>window.location.search.includes("zonosStagingMode=1"),c=()=>{var e;return(null===(e=window.Zonos.zonosApiKey)||void 0===e?void 0:e.includes("test"))||window.location.search.includes("zonosTestMode=1")};function l(e,o){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(n=Object.getOwnPropertySymbols(e);r<n.length;r++)o.indexOf(n[r])<0&&Object.prototype.propertyIsEnumerable.call(e,n[r])&&(t[n[r]]=e[n[r]])}return t}"function"==typeof SuppressedError&&SuppressedError;const d=["cloudflare","vercel"],u=d[0],p={cloudflare:"https://route.elements.zonos.com",vercel:"https://route.js.zonos.com"},m=p[u],w=(e=u)=>{const o=d.indexOf(e),t=d[o+1];return t||null},y=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){return null}return null},h=async({response:e,shouldLog:o=!0,shouldThrow:t=!1})=>{try{const o=await e.text(),t=y(o);if(!t)throw new Error(`Failed to parse content: ${o}`);return t}catch(e){if(t)throw e;return o&&console.error(e),null}},f=async({basePathType:e,options:o,path:t})=>{let n;const r=window.Zonos.zonosQaUrlApi||p[e]||u,s=new URL(r+t),i=window.Zonos.cartId?`${window.location.hostname}-${window.Zonos.cartId}`:window.location.hostname;s.searchParams.set("zToken",(e=>{try{return btoa(e).replace(/=/g,"")}catch(o){return e.replace(/[^A-Za-z0-9]/g,"").split("").reverse().join("")}})(i));try{n=await fetch(s.toString(),o)}catch(e){if(e instanceof Error)return{baseUrl:r,errors:[{message:e.message,type:"unknown"}],json:null,response:null,zonosMode:null};return{baseUrl:r,errors:[{message:"Failed to fetch",type:"unknown"}],json:null,response:null,zonosMode:null}}const a=n.headers.get("Zonos-Mode"),c=window.Zonos.zonosQaUrl;if(!window.Zonos.modeAlerted&&a&&c&&(window.Zonos.modeAlerted=!0),n.ok){return{baseUrl:r,errors:[],json:await h({response:n}),response:n,zonosMode:a}}const l=n.status.toString();try{const e=await h({response:n,shouldThrow:!0});if(e&&"errors"in e&&Array.isArray(e.errors)){const o=e.errors;return{baseUrl:r,errors:o.map((e=>"string"==typeof e?{message:e,type:l}:e)),json:null,response:n,zonosMode:a}}return{baseUrl:r,errors:[{message:JSON.stringify(e),type:l}],json:null,response:n,zonosMode:a}}catch(e){return{baseUrl:r,errors:[{message:`${l}: ${"Unknown error"}`,type:l}],json:null,response:null,zonosMode:a}}},g=async({basePathType:e,options:o,path:n})=>{var r,s;const i=n.startsWith("/api/bigcommerce")?"vercel":e,a=await f({basePathType:i,options:o,path:n}),{errors:c,response:d}=a,u=l(a,["errors","response"]),h=w(i),v=!!c.find((({type:e})=>"unknown"===e))||404===(null==d?void 0:d.status),b=h&&v;return v&&(async({endpoint:e,errors:o,metadata:n,shouldPostReleaseErrorReporting:r})=>{if(t("sendErrorLog","warn",e,n,o),r){const e=Number(window.Zonos.releaseDate);if((new Date).getTime()-e>36e5)return}const s="userAgentData"in window.navigator?window.navigator.userAgentData:null,i={endpoint:e,errors:o,href:window.location.href,metadata:Object.assign({appVersion:window.Zonos.version,domain:window.Zonos.domain,publicCredential:window.Zonos.zonosApiKey,userAgent:s&&s.brands.length>0?s:window.navigator.userAgent},n)};try{fetch(`${m}/api/zonos-elements/log-error`,{body:JSON.stringify(i),headers:{"Zonos-Referer":window.location.hostname},method:"POST"})}catch(e){const o=w();if(!o)return;fetch(`${p[o]}/api/zonos-elements/log-error`,{body:JSON.stringify(i),method:"POST"})}})({endpoint:p[i]+n,errors:c.map((({message:e})=>`API: ${e}`)),metadata:{currentBasePath:i,nextFallbackApiType:h,requestHeaders:null==o?void 0:o.headers,requestPayload:y(null===(r=null==o?void 0:o.body)||void 0===r?void 0:r.toString())||(null===(s=null==o?void 0:o.body)||void 0===s?void 0:s.toString()),status:null==d?void 0:d.status,statusText:null==d?void 0:d.statusText},shouldPostReleaseErrorReporting:!0}),b?(t(`=== "${n}" failed to fetch, trying next fallback ${h}`),g({basePathType:h,options:o,path:n})):Object.assign({errors:c,response:d},u)},v=async(e,o)=>{const n=l(o||{},[]),r=n.body?JSON.stringify(n.body):void 0,s=n.method||"GET",i=Object.assign({"Content-Type":"application/json","Zonos-Is-BigCommerce":window.Zonos.isBigCommerce.toString(),"Zonos-Referer":window.location.hostname,"Zonos-Staging-Mode":a()?"1":void 0,"Zonos-Test-Mode":c()?"1":void 0,"Zonos-Version":window.Zonos.version,credentialtoken:window.Zonos.zonosApiKey||"Empty credential token from zonos-elements"},n.headers);Object.keys(i).forEach((e=>void 0===i[e]&&delete i[e]));const d=Object.assign(Object.assign({},n),{body:"GET"===s?void 0:r,headers:i,method:s}),p=new URLSearchParams(window.location.search).get("useFallbackApi");return t(e,"info"),g({basePathType:p||u,options:d,path:e})},b=()=>{const e=window&&window.location.href.includes("forceLoadCdn");if("undefined"==typeof window||e)return null;const o=(e=>{if(!e)return null;const o=new URL(e).searchParams.get("zonosQaUrl");return o?/[^a-zA-Z0-9-_]+/.test(o)?null:o:null})(window.location.href),n="https://v1.3.163.js.zonos.com";if(!o&&(n.includes("test.")||n.includes("test-")))return n;if(!o&&["dev.demo.elements.zonos.com"].includes(window.location.hostname))return"https://dev.elements.zonos.com";if(!o)return null;if("dev-elements"===o)return"https://dev.elements.zonos.com";const r=`https://${o}.preview.js.zonos.com`;return t(`[ZONOS-WARNING] using '${r}' for loading elements script`,"warn"),fetch(r).then((()=>{window.sessionStorage.removeItem("zonos--checkout-session-id"),window.sessionStorage.removeItem("zonos--client-secret")})).catch((()=>{alert(`[ZONOS-WARNING] '${r}' IS NO LONGER AVAILABLE. REMOVING zonosQaUrl PARAM AND RELOADING THE PAGE`);const e=new URLSearchParams(window.location.search);e.delete("zonosQaUrl");const{pathname:o}=window.location,t=`${o}?${e.toString()}`;return window.history.replaceState(window.history.state,"",t),window.location.reload(),null})),r},S="https://js.stripe.com/v3",z=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,C="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used";let j=null;const O=e=>(null!==j||(j=new Promise(((o,t)=>{if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&e&&console.warn(C),window.Stripe)o(window.Stripe);else try{let r=(()=>{const e=document.querySelectorAll(`script[src^="${S}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&z.test(t.src))return t}return null})();r&&e?console.warn(C):r||(r=(e=>{const o=document.createElement("script");o.src=`${S}`;const t=document.head||document.body;return t?(t.appendChild(o),o):(n("Expected document.body not to be null. Stripe.js requires a <body> element."),null)})()),null==r||r.addEventListener("load",(()=>{window.Stripe?o(window.Stripe):t(new Error("Stripe.js not available"))})),null==r||r.addEventListener("error",(()=>{t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else o(null)}))),j),Z=Promise.resolve().then((()=>O(null)));let k=!1;Z.catch((e=>{k||console.warn(e)}));const I=async({cartId:e,retries:o})=>{const n=c(),{errors:r,json:s}=await v("/api/zonos-elements/get-temp-cart",{body:{isTestMode:n,options:{noOnlineStoreSettings:!0},tempCartUUID:e},headers:{"Content-Type":"application/json"},method:"POST"}),i=!s||r.length;return i&&o?(t("[ZONOS - loadZonos] temp cart not ready, retrying in 1 second","info",{retries:o}),await new Promise((e=>setTimeout(e,500))),I({cartId:e,retries:o-1})):i?null:s},A=/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/,E=new RegExp(`^${A.source}$`),L=new RegExp(`^cart_${A.source}$`),$=/^[a-zA-Z0-9]{2,}$/,N=/^cart_[a-zA-Z0-9]{2,}$/,T=async e=>{const{isDgsCartId:o,isLegacyCartId:r}=(e=>e?e.includes("undefined")?{isDgsCartId:!1,isLegacyCartId:!1}:N.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:$.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:L.test(e)?{isDgsCartId:!0,isLegacyCartId:!1}:E.test(e)?{isDgsCartId:!1,isLegacyCartId:!0}:{isDgsCartId:!1,isLegacyCartId:!1}:{isDgsCartId:!1,isLegacyCartId:!1})(e);if(!r&&!o)return n("[ZONOS - loadZonos] invalid cart id"),null;const s=await I({cartId:e,retries:5});return t("[ZONOS - loadZonos] getting temp cart data","info",s),s?(window.Zonos.storeId=s.cartData.storeId,window.Zonos.zonosApiKey=s.cartData.credentialToken,{cartData:s.cartData,storeFavicon:s.storeFaviconUrl,storeId:s.cartData.storeId,storeLogo:s.storeLogoUrl,zonosApiKey:s.cartData.credentialToken}):(n("[ZONOS - loadZonos] Error getting temp cart data, stop checkout process."),null)};var U;const P=(()=>{if("undefined"==typeof document)return null;const e=document.querySelector('script[src*="/zonos.js"]'),{currentLoadScriptUrl:o,isWhiteListed:t}=(({loadScriptSrc:e})=>{if(!e)return{currentLoadScriptUrl:"",isForceLoadVersionDomain:!1,isWhiteListed:!1};const o=new URL(e).origin,t=["dev.elements.zonos.com","dev.assets-checkout.zonos.com",".js.zonos.com","zonos-elements-test-git","zonos-elements-git"].some((e=>o.includes(e))),n=["qa.js.zonos.com"].some((e=>o.includes(e)));return{currentLoadScriptUrl:o,isForceLoadVersionDomain:n,isWhiteListed:t}})({loadScriptSrc:null==e?void 0:e.src});return t?o:null})(),D="https://v1.3.163.js.zonos.com",F=P||"https://cdn.jsdelivr.net/npm/@zonos/elements@1.3.163",R="https://fonts.googleapis.com",x=/^https:\/\/fonts\.googleapis\.com/;class M{}U=M,M.doneInit=!1,M.debug="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosDebug=1/),M.zonosConversionTest="undefined"!=typeof window&&!!window.location.search.match(/\?.*(&*)zonosConversionTest/),M._paypalMockResponse=null,M.isBigCommerce=!1,M.releaseDate="1740498125505",M.isLegacyCheckout=!1,M.domain="undefined"!=typeof window?window.location!=window.parent.location&&document.referrer||document.location.hostname:"",M.showBaseForeign="undefined"!=typeof window&&window.location.search.includes("zonosShowBaseForeign"),M.isNpm=!0,M.zonosQaUrl=null,M.zonosQaUrlApi=null,M.version="v1.3.163",M.modeAlerted=!1,M.cartData=null,M.paypal=null,M.getCurrentTimestamp=()=>(new Date).getTime(),M.zonosController=null,M.init=async e=>{const{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d,storeId:u,zonosApiKey:p}=e;if(U.cartId=new URLSearchParams(window.location.search).get("tempCartUUID"),U.doneInit)return;if(t(`====== ZONOS DEBUG MODE: on (${U.version}) ======`),U.zonosApiKey=p,U.storeId=u,U.isNpm){t("====== ZONOS LOADING FROM NPM ======");const o=b();if(o&&!window.isZonosPreview){t(`====== RE-INJECT "zonos.js" FROM PRVIEW: ${o} ======`,"info");const n=document.createElement("script");return n.src=`${o}/dist/scripts/zonos.js`,document.head.appendChild(n),n.addEventListener("load",(()=>{window.Zonos.isNpm=U.isNpm,window.Zonos.isBigCommerce=U.isBigCommerce,window.Zonos.isLegacyCheckout=U.isLegacyCheckout,window.Zonos.init(e)})),n.addEventListener("error",(()=>{alert(`[ZONOS - loadZonos] Failed to load "loadZonos.js" from zonosQaUrl: ${o}`)})),void(window.isZonosPreview=!0)}if(!p&&!U.cartId)return void n("Zonos API key is required unless `tempCartUUID` is provided in url query params.");if(!U.cartData&&U.cartId){t("Initialize cart data");const e=await T(U.cartId);if(!e)return void n("Failed to get cart data");U.cartData=e.cartData,U.zonosApiKey=e.zonosApiKey}const r=await(async()=>{const e=c(),o=a();if(!e&&!o||!window.Zonos.zonosApiKey)return null;if(t("[ZONOS - loadZonos] Attempt test public credential","info"),window.Zonos.zonosApiKey.includes("credential_test"))return t("[ZONOS - loadZonos] Test mode is enabled but the API key is already a test key","info"),null;const{errors:r,json:s}=await v("/api/get-test-public-credential");if(r.length||!s)return n("[ZONOS - loadZonos] Failed to get test public credential. Keep using production key",r),null;const i=s.publicCredential;return i?(t(`[ZONOS - loadZonos] Retrieve new test public token ${i}`,"info"),i):(n("[ZONOS - loadZonos] No test public key credential. Keep using production key"),null)})();r&&(U.zonosApiKey=r)}const m=new URL(window.location.href).searchParams.get("payment_intent_client_secret")||sessionStorage.getItem("zonos--client-secret");if(U.cartId&&U.cartData||!!m){t("Cart data or stripe client secret is available, inject hidden button and trigger checkout");const e=document.createElement("button");e.style.display="none",e.id="zonos--checkout-hidden-button",document.body.appendChild(e)}t("init zonos"),U.restoreNativeBrowserFunctions(),U.injectCustomScriptForHostedCheckout(),U.injectZonosCdn(),U.injectZonosCss(),U.injectFonts(),U.injectController({config:{appearance:o,checkoutSettings:r,currencyConverter:s,helloSettings:i,onCountryChange:l,overrideCurrencyFormat:d}}),U.doneInit=!0},M.injectCustomScriptForHostedCheckout=()=>{const e=U.cartData,o=(null==e?void 0:e.metadata)||[],n=o.find((e=>"customHeaderScript"===e.key)),r=o.find((e=>"customFooterScript"===e.key));if(window.Zonos.isLegacyCheckout&&(n||r)){if(n){t("Injecting custom header script");const e=document.createElement("script");e.textContent=n.value,document.head.appendChild(e)}if(r){t("Injecting custom footer script");const e=document.createElement("script");e.textContent=r.value,document.body.appendChild(e)}}else t("Skip injecting custom script for hosted checkout","info",{footerScript:r,headerScript:n,isLegacyCheckout:window.Zonos.isLegacyCheckout})},M.displayCurrency=()=>{const e=document.querySelector("zonos-hello");e&&e.displayCurrency()},M.openHelloDialog=e=>{const o=document.querySelector("zonos-hello");o&&o.openHelloDialog(null==e||e)},M.showNotification=e=>{var o;null===(o=U.zonosController)||void 0===o||o.showNotification(e)},M.updateOrganizationName=e=>{var o;null===(o=U.zonosController)||void 0===o||o.updateOrganizationName(e)},M.disablePlaceOrderButtons=({autoEnable:e=!0,config:o,disable:t,placeOrderButtonSelector:n})=>{var r;if(!(null===(r=o.checkoutSettings)||void 0===r?void 0:r.disablePlaceOrderButtonActivation)&&n){const o=document.querySelectorAll(n),r=e=>{e.target.getAttribute("disabled")&&(e.preventDefault(),e.stopPropagation())};o.forEach((e=>{e.getAttribute("data-zonos-checkout-attached")||(t?(e.setAttribute("disabled","true"),e.addEventListener("click",r)):(e.removeAttribute("disabled"),e.removeEventListener("click",r)))})),e&&t&&setTimeout((()=>{o.forEach((e=>{e.removeAttribute("disabled"),e.removeEventListener("click",r)}))}),5e3)}},M.restoreNativeBrowserFunctions=()=>{var e;if("1"===new URL(window.location.href).searchParams.get("useMerchantPolyfill"))return;const o="zonos---native-browser";let t=document.querySelector(`iframe#${o}`);t||(t=document.createElement("iframe"),t.id=o,t.style.display="none",t.style.opacity="0",t.style.position="absolute",t.style.top="-9999px",t.style.left="-9999px",t.style.width="1px",t.style.height="1px",t.style.border="none",t.style.overflow="hidden",t.style.visibility="hidden",document.body.appendChild(t));const n=(null===(e=t.contentWindow)||void 0===e?void 0:e.window.Array.from)||Array.from;Array.from=n,document.body.removeChild(t)},M.injectController=({config:e})=>{var o;if(document.querySelector("zonos-controller"))return;if(null===(o=e.checkoutSettings)||void 0===o?void 0:o.placeOrderButtonSelector){const o=e.checkoutSettings.placeOrderButtonSelector;U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o});new MutationObserver((()=>{U.disablePlaceOrderButtons({config:e,disable:!0,placeOrderButtonSelector:o})})).observe(document.body,{childList:!0,subtree:!0})}const r=document.createElement("zonos-controller");r.config=e,r.zonosApiKey=U.zonosApiKey||"",r.addEventListener("stripeInitEvent",(async e=>{const{detail:o}=e;t("loading Stripe");const s=await(async(...e)=>{k=!0;const o=Date.now();return Z.then((t=>((e,o,t)=>{if(null===e)return null;const n=e.apply(void 0,o);return((e,o)=>{e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",startTime:o})})(n,t),n})(t,e,o)))})(o.publishableKey);s?(window.Zonos.stripe=s,r.initCheckoutElement(s)):n("API seems to be invalid or missing. Failed to load Stripe")})),document.body.appendChild(r),U.zonosController=r,t("Zonos controller injected!")},M.injectScript=({cdnType:e,isModule:o,theRestUrl:r})=>{const s=`${U.getZonosUrl(e)}/${r}`;if(document.querySelector(`script[src="${s}"]`))return void t(`Zonos script "${s}" already exists in the document`,"warn");const a=document.head||document.body,c=document.createElement("script");o?c.type="module":c.noModule=!0,c.src=s,c.crossOrigin="anonymous",c.onerror=()=>{n(`Failed to load ${c.src}`);const t=i(e);t&&U.injectScript({cdnType:t,isModule:o,theRestUrl:r})},a.appendChild(c)},M.getZonosUrl=e=>{const o=()=>{switch(e){case"jsdelivr":return F;case"unpkg":return"https://unpkg.com/@zonos/elements@1.3.163";case"cdnjs":return"https://cdnjs.cloudflare.com/ajax/libs/zonos-elements/1.3.163";case"vercel":return D}};if(U.isNpm){return b()||o()}return o()},M.injectZonosCdn=()=>{U.injectScript({cdnType:s,isModule:!0,theRestUrl:"dist/zonos-elements/zonos-elements.esm.js"}),U.injectScript({cdnType:s,isModule:!1,theRestUrl:"dist/zonos-elements/zonos-elements.js"}),t("Zonos cdn script injected!")},M.injectStylesheet=({cdnType:e,theRestUrl:o})=>{const t=U.getZonosUrl(e),r=document.head||document.body,s=document.createElement("link");s.rel="preconnect",s.href=`${D}/`,r.appendChild(s);const a=document.createElement("link");a.rel="stylesheet",a.href=`${t}/${o}`,a.onerror=()=>{n(`Failed to load ${a.href}`);const t=i(e);t&&U.injectStylesheet({cdnType:t,theRestUrl:o})},r.appendChild(a)},M.injectZonosCss=()=>{document.querySelector('link[rel="stylesheet"][href*="/dist/zonos-elements/zonos-elements.css"]')?t("Zonos style links already injected","warn"):(U.injectStylesheet({cdnType:s,theRestUrl:"dist/zonos-elements/zonos-elements.css"}),t("Zonos style css injected!"))},M.injectFonts=()=>{if((()=>{if(document.fonts.check("1em Inter"))return void t("Inter font already loaded","warn");const e=document.querySelectorAll(`link[rel="stylesheet"][href^="${R}"]`);for(let o=0;o<e.length;o++){const t=e[o];if(t&&!x.test(t.href))return t}return null})())return void t("Inter font already injected","warn");const e=document.head||document.body,o=document.createElement("link");o.rel="preconnect",o.href=R,e.appendChild(o);const n=document.createElement("link");n.rel="stylesheet",n.href=`${R}/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap`,e.appendChild(n),t("Zonos font injected!")},M.setupGoogleFont=e=>{var o;null===(o=U.zonosController)||void 0===o||o.setupGoogleFont(e)},M.injectSupportGoogleFont=e=>{var o;t(`[FONT] injecting ${e}`);const n=null===(o=e.match(/family=(.*?):/))||void 0===o?void 0:o[1],r=document.head||document.body;if(!document.querySelector(`link[rel="preconnect"][href^="${R}"]`)){const e=document.createElement("link");e.rel="preconnect",e.href=R,r.appendChild(e)}if(document.querySelector(`link[rel="stylesheet"][href="${e}"]`))return void t(`[FONT] ${n} font already injected`,"warn");const s=document.createElement("link");s.rel="stylesheet",s.href=e,r.appendChild(s),t(`[FONT] ${n} font injected!`)},exports.Zonos=M})();