@liquidcommerce/elements-sdk 2.6.0-beta.32 → 2.6.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +11079 -10847
- package/dist/types/clients/base.d.ts +6 -0
- package/dist/types/clients/checkout.d.ts +2 -0
- package/dist/types/constants/core.constant.d.ts +1 -0
- package/dist/types/enums/core.enum.d.ts +1 -0
- package/dist/types/interfaces/configs/product-list.interface.d.ts +1 -0
- package/dist/types/modules/address/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/cart/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/checkout/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/product/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/product-list/components/card-components/product-fulfillments.d.ts +0 -3
- package/dist/types/modules/product-list/components/index.d.ts +2 -1
- package/dist/types/modules/product-list/components/product-list-engraving.component.d.ts +6 -0
- package/dist/types/modules/product-list/components/product-list-filters.component.d.ts +0 -1
- package/dist/types/modules/product-list/product-list-card.component.d.ts +2 -2
- package/dist/types/modules/product-list/product-list.component.d.ts +1 -1
- package/dist/types/modules/product-list/styles/product-list-card.style.d.ts +1 -0
- package/dist/types/modules/product-list/styles/product-list-filters.style.d.ts +1 -0
- package/dist/types/modules/product-list/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/theme-provider/services/style-registry.service.d.ts +16 -0
- package/dist/types/modules/theme-provider/services/stylesheet-generator.service.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/register-styles.d.ts +1 -0
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +2 -1
- package/dist/types/modules/ui-components/modal/modal.component.d.ts +3 -1
- package/package.json +4 -3
- package/umd/elements-checkout.js +1 -1
- package/umd/elements.js +1 -1
- package/dist/index.checkout.esm.js +0 -16000
- package/dist/types/modules/theme-provider/styles/address/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/cart/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/checkout/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/product/index.d.ts +0 -3
- package/dist/types/modules/theme-provider/styles/product-list/index.d.ts +0 -1
- package/dist/types/modules/theme-provider/styles/ui/index.d.ts +0 -4
- /package/dist/types/modules/{theme-provider/styles/address → address/styles}/address.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/cart → cart/styles}/cart.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/checkout → checkout/styles}/checkout.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/image-carousel.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/product.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/product → product/styles}/retailers.style.d.ts +0 -0
- /package/dist/types/modules/product-list/components/{product-list-retailers.d.ts → product-list-retailers.component.d.ts} +0 -0
- /package/dist/types/modules/{theme-provider/styles/product-list → product-list/styles}/product-list.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/drawer.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/loading.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/modal.style.d.ts +0 -0
- /package/dist/types/modules/{theme-provider/styles/ui → ui-components/styles}/promo-code-ticker.style.d.ts +0 -0
package/umd/elements-checkout.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):(t="undefined"!=typeof globalThis?globalThis:t||self,n(t.LiquidCommerceElementsCheckout={}))})(this,function(exports){"use strict";class SDKError extends Error{constructor(t,n=![]){super(t),this.name="SDKError",this.isSdk=!![],this.reThrow=n,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(t,n){if((null==t?void 0:t.isSdk)===!![])return t instanceof SDKError&&t.reThrow?![]:!![];if(!t||"object"!=typeof t)return n?isSDKSource(n):![];const e=String((null==t?void 0:t.message)||""),i=/liquidcommerce\s+elements/i.test(e),o=String((null==t?void 0:t.stack)||""),r=(null==t?void 0:t.source)||n||"",a=[/@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,/elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,/chunk-[a-z0-9]+.*elements/i],s=[/\bElements\b(?!\w)/,/\bElementsBuilder\b/,/\bLiquidCommerceElements\b/,/BaseComponent/,/Elements(?:Base)?Client/,/(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,/(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,/(?:Product|Cart|Checkout|Address|ProductList).*Component/],c=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\/(?:main|checkout)\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],l=[/elements-sdk[/\\]/i,/modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,/core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,/@liquidcommerce[/\\]elements-sdk/i],d=isSDKSource(r),h=a.some(t=>t.test(o)),p=s.some(t=>t.test(o)),m=c.some(t=>t.test(o)),f=l.some(t=>t.test(o));return i||d||h||p||m||f}function isSDKSource(t){if(!t||"string"!=typeof t)return![];const n=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return n.some(n=>n.test(t))}class SingletonManager{static getInstances(){return"builder"===SingletonManager.currentContext?(SingletonManager.builderClientInstances||(SingletonManager.builderClientInstances=new Map),SingletonManager.builderClientInstances):(SingletonManager.regularClientInstances||(SingletonManager.regularClientInstances=new Map),SingletonManager.regularClientInstances)}constructor(){}static setContext({isBuilder:t}){SingletonManager.currentContext=t?"builder":"regular"}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,n){const e=SingletonManager.getInstances();e.has(t)||e.set(t,n());const i=e.get(t);if(!i)throw new SDKError("ElementsSdk: Instance for class "+t+" could not be created.");return i}static async getClient(t){const n=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),e="LiquidCommerceElementsClient_"+n,i=SingletonManager.getInstances();if(i.has(e))return i.get(e);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const o=new SingletonManager.clientConstructor(t);return await o.prepare(),i.set(e,o),o}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";class LoggerService{constructor(t){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.telemetryService=null,this.context=t}static getInstance(t){return SingletonManager.getClassInstance("LoggerService_"+t,()=>new LoggerService(t))}setEnableLogging(t){this.enableLogging=t}setTelemetryService(t){this.telemetryService=t}getPrefix(t){if(!this.enableLogging)return[];const n=(new Date).toISOString().slice(11,23);return["%c["+n+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[t],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[t],"color: "+this.colors[t]]}debug(t,n){if(this.sendToTelemetry("debug",t,void 0,n),!this.enableLogging)return;const[e,...i]=this.getPrefix("debug");void 0!==n?console.debug(e,...i,t,n):console.debug(e,...i,t)}info(t,n){if(!this.enableLogging)return;const[e,...i]=this.getPrefix("info");void 0!==n?console.info(e,...i,t,n):console.info(e,...i,t)}warn(t,n){if(this.sendToTelemetry("warn",t,void 0,n),!this.enableLogging)return;const[e,...i]=this.getPrefix("warn");void 0!==n?console.warn(e,...i,t,n):console.warn(e,...i,t)}error(t,n){const e=n instanceof Error;let i=e?n:void 0,o=!e&&n?n:void 0;if(o&&o.error instanceof Error){i=o.error;const{error:t,...n}=o;o=Object.keys(n).length>0?n:void 0}if(this.sendToTelemetry("error",t,i,o),!this.enableLogging)return;const[r,...a]=this.getPrefix("error");if(console.group(r+" "+t,...a),i){console.log("Type:",i.name||"Error"),console.log("Message:",i.message),i.stack&&console.log("Stack:",i.stack),i.cause&&console.log("Caused by:",i.cause);const t=Object.keys(i).filter(t=>!["name","message","stack","cause"].includes(t));if(t.length>0){const n={};for(const e of t)n[e]=i[e];console.log("Additional:",n)}}o&&Object.keys(o).length>0&&console.log("Context:",o),console.groupEnd()}sendToTelemetry(t,n,e,i){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,n,{context:this.context,error:e,data:i})}catch(o){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const n=this.getInstances();if(!n.has(t)){const e=LoggerService.getInstance(t);e.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&e.setTelemetryService(this.telemetryService),n.set(t,e)}return n.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const n=this.getInstances();for(const[,e]of n)e.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const n=this.getInstances();for(const[,e]of n)e.setTelemetryService(t)}}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null;class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async setPersistedStore(t,n){try{if(!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!n||0===Object.keys(n).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+t,{body:n})}catch(e){this.logger.error("Error setting persisted store",e)}}async getPersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to get persisted store"),null;const n=await this.client.get("/configs/store/"+t);return n.data}catch(n){return this.logger.error("Error fetching persisted store",n),null}}async deletePersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+t+"/delete")}catch(n){this.logger.error("Error deleting persisted store",n)}}async getAddressSuggestions(t){try{if(!t||0===t.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const n=await this.client.post("/address/autocomplete",{body:{input:t}});return n.data}catch(n){return this.logger.error("Error fetching address suggestions",n),[]}}async getAddressDetails(t){try{if(!t||0===t.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const n=await this.client.post("/address/details",{body:{id:t}});return n.data}catch(n){throw this.logger.error("Error fetching address details",n),new SDKError("Failed to fetch address details: "+(null==n?void 0:n.message))}}async getProductsData(t,n){try{if(0===t.length)return this.logger.error("No product identifiers provided"),null;const e={identifiers:t,location:n},i=await this.client.post("/product/availability",{body:e});return i.data}catch(e){return this.logger.error("Error fetching product data",e),null}}async catalogSearch(t){try{const n=await this.client.post("/product/search",{body:t});return n.data}catch(n){return this.logger.error("Error fetching catalog search data",n),{products:[],retailers:{},navigation:{currentPage:1,totalPages:0,totalCount:0,filters:[]}}}}async getCartData(t){try{const n=await this.client.post("/cart/get",{body:{id:t||void 0}});return n.data}catch(n){throw this.logger.error("Error fetching cart data",n),new SDKError("Failed to fetch cart data: "+n.message)}}async updateCart(t){try{const n=await this.client.post("/cart/update",{body:t});return n.data}catch(n){throw this.logger.error("Error updating cart",n),new SDKError("Failed to update cart: "+(null==n?void 0:n.message))}}async prepareCheckout(t){try{const n=await this.client.post("/checkout/prepare",{body:t});return n.data}catch(n){throw this.logger.error("Error fetching prepare checkout data",n),new SDKError("Failed to fetch prepare checkout data: "+(null==n?void 0:n.message))}}async updateCheckoutItems(t){try{const n=await this.client.post("/checkout/items",{body:t});return n.data}catch(n){throw this.logger.error("Error updating checkout items",n),new SDKError("Failed to update checkout items: "+(null==n?void 0:n.message))}}async getPaymentSession(t){try{const n=await this.client.post("/checkout/payment/session",{body:{cartId:t}});return n.data}catch(n){throw this.logger.error("Error fetching payment session",n),new SDKError("Failed to get payment session: "+(null==n?void 0:n.message))}}async confirmPaymentSession(t){try{const n=await this.client.post("/checkout/payment/confirm",{body:t});return n.data}catch(n){throw this.logger.error("Error confirming payment session",n),new SDKError("Failed to confirm payment session: "+(null==n?void 0:n.message))}}async checkoutComplete(t){try{const n=await this.client.post("/checkout/complete",{body:{token:t}});return n.data}catch(n){if(this.logger.error("Error completing checkout",n),null==n?void 0:n.error)throw new SDKError("Failed to complete checkout: "+(null==n?void 0:n.message));throw n}}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(t,n)=>t||n&&n.status>=500&&n.status<600?!![]:![],this.xhrFetch=(t,n)=>new Promise((e,i)=>{const o=new XMLHttpRequest;o.open(n.method||"GET",t);for(const[t,r]of Object.entries(n.headers))o.setRequestHeader(t,r);o.onload=()=>{const t={ok:o.status>=200&&o.status<300,status:o.status,statusText:o.statusText,headers:o.getAllResponseHeaders().split("\r\n").reduce((t,n)=>{const[e,i]=n.split(": ");return e&&i&&(t[e]=i),t},{}),t:o.responseText,json:()=>Promise.resolve(JSON.parse(o.responseText)),text:()=>Promise.resolve(o.responseText)};e(t)},o.onerror=()=>{i(new TypeError("Network request failed"))},o.ontimeout=()=>{i(new TypeError("Network request timed out"))},o.timeout=3e4,o.send(n.body)}),this.fetchImpl=this.getFetchImplementation()}async request(t){var n,e,i;const{url:o,options:r,retryConfig:a}=t,s=null!==(n=null==a?void 0:a.maxRetries)&&void 0!==n?n:3,c=null!==(e=null==a?void 0:a.retryDelay)&&void 0!==e?e:1e3,l=null!==(i=null==a?void 0:a.shouldRetry)&&void 0!==i?i:this.defaultShouldRetry;let d;const h=Date.now();for(let m=0;m<=s;m++){let t=Date.now();try{t=Date.now();const n=await this.fetchImpl(o,r),e=Date.now()-t;if(n.ok)return n;if(await this.logFailedResponse(o,r,n,e,m,s),m<s&&l(null,n)){await this.delay(c*2**m);continue}return n}catch(p){const n=Date.now()-t;if(d=p,this.logNetworkError(o,r,p,n,m,s),m<s&&l(p,void 0)){await this.delay(c*2**m);continue}throw this.enhanceError(p,o,r,Date.now()-h)}}throw this.enhanceError(d,o,r,Date.now()-h)}async logFailedResponse(t,n,e,i,o,r){const a=o<r;let s,c;try{e.t||(e.t=await e.text());try{s=JSON.parse(e.t)}catch(l){s=e.t}}catch(d){s="[Unable to read response body]"}if(n.body)try{c=JSON.parse(n.body)}catch(h){c=n.body}this.logger.error("HTTP request failed",{method:n.method,url:t,status:e.status,statusText:e.statusText,duration:i+"ms",attempt:o+1+"/"+(r+1),willRetry:a,requestHeaders:n.headers,requestBody:c,responseHeaders:e.headers,responseBody:s})}logNetworkError(t,n,e,i,o,r){var a;const s=o<r;this.logger.error("Network request failed",{method:n.method,url:t,error:e,errorType:(null===(a=null==e?void 0:e.constructor)||void 0===a?void 0:a.name)||typeof e,duration:i+"ms",attempt:o+1+"/"+(r+1),willRetry:s,possibleCauses:this.diagnosePossibleCauses(e)})}diagnosePossibleCauses(t){var n,e,i,o,r;const a=[];return((null===(n=null==t?void 0:t.message)||void 0===n?void 0:n.includes("timeout"))||(null===(e=null==t?void 0:t.message)||void 0===e?void 0:e.includes("timed out")))&&a.push("Request timeout - server took too long to respond"),((null===(i=null==t?void 0:t.message)||void 0===i?void 0:i.includes("Failed to fetch"))||(null===(o=null==t?void 0:t.message)||void 0===o?void 0:o.includes("Network request failed")))&&(a.push("Network connectivity issue"),a.push("CORS policy blocking the request"),a.push("Server is not responding"),a.push("Request was blocked by browser or firewall")),(null===(r=null==t?void 0:t.message)||void 0===r?void 0:r.includes("aborted"))&&a.push("Request was aborted"),0===a.length&&a.push("Unknown network error"),a}enhanceError(t,n,e,i){const o=new Error((null==t?void 0:t.message)||"Network request failed - no response from server");return o.url=n,o.method=e.method,o.totalDuration=i+"ms",o.isNetworkError=!![],o.originalError=t,o.possibleCauses=this.diagnosePossibleCauses(t),o}delay(t){return new Promise(n=>setTimeout(n,t))}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):window.fetch?this.fetchAdapter(window.fetch):this.xhrFetch}fetchAdapter(t){return async(n,e)=>{var i;const o=await t(n,e);let r;if("function"==typeof(null===(i=o.headers)||void 0===i?void 0:i.entries))r=Object.fromEntries(o.headers.entries());else{r={};for(const[t,n]of o.headers)r[t]=n}const a={ok:o.ok,status:o.status,statusText:o.statusText,headers:r,json:async()=>(a.t||(a.t=await o.text()),JSON.parse(a.t)),text:async()=>(a.t||(a.t=await o.text()),a.t)};return a}}}const t={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",INTERNAL_CART_TO_CHECKOUT:"internal_cart_to_checkout",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},e={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},i={DRAWER:"drawer",INPUT:"input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",MODAL:"modal",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",PRODUCT_LIST_RETAILERS:"product-list-retailers",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},o={ON_DEMAND:"onDemand",SHIPPING:"shipping"},r={NONE:"none",CONSOLE:"console",PANEL:"panel"},a={GENERIC:"generic",PROMO_CODE:"promo-code",GIFT_CARD:"gift-card"},s={SUCCESS:"success",WARNING:"warning",ERROR:"error"},c={[t.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[t.STAGING]:"https://staging-elements.liquidcommerce.us",[t.PRODUCTION]:"https://elements.liquidcommerce.us"},l={ENGRAVING:"engraving",PRESALE:"presale",FULFILLMENT:"fulfillment",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},d={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040,MODAL:2147483640},h="lce",p={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},m={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:o.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},f={id:"",subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},g={token:"",cartId:"",loading:![],updating:![],error:null,presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddress:{formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},promoCode:null,giftCards:[],orderNumber:null,itemsQuantity:0,items:{},fulfillments:{},retailers:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,engraving:0,giftCards:0,tip:0,service:0,platform:0,tax:0},rerender:![],tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},v={drawer:{isOpen:![],contentConfig:null},modal:{isOpen:![],contentConfig:null}},x={checkout:{injection:null,returnUrl:null}},b={products:[],retailers:{},filters:[],pagination:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]},appliedFilters:{},searchTerm:"",gridConfig:void 0,userProducts:{},loading:![]},w={products:{},cart:f,address:p,checkout:g,ui:v,metadata:x,productsList:b};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,n={}){this.validateInputs(t,n),this.config=Object.freeze(this.buildConfiguration(t,n))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,n){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[t]:n})}isDevelopment(){return this.get("env")===t.DEVELOPMENT}isStaging(){return this.get("env")===t.STAGING}isProduction(){return this.get("env")===t.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const t=this.get("debugMode");return t===r.CONSOLE||t===r.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===r.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===r.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}getProxyConfig(){return this.get("proxy")}validateInputs(n,e){if(!(null==n?void 0:n.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(e.env&&!Object.values(t).includes(e.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+e.env+'". Using default environment.'),e.env=void 0),void 0!==e.isBuilder&&"boolean"!=typeof e.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),e.isBuilder=void 0),void 0===e.debugMode||Object.values(r).includes(e.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+e.debugMode+'". Must be one of: '+Object.values(r).join(", ")+". Using default value."),e.debugMode=void 0),e.promoTicker&&"object"!=typeof e.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),e.promoTicker=void 0),e.checkout&&("object"!=typeof e.checkout?(console.warn("[LiquidCommerce Elements] checkout must be an object. Skipping checkout configuration."),e.checkout=void 0):e.checkout.pageUrl&&"string"==typeof e.checkout.pageUrl?e.checkout.pageUrl.trim()?e.checkout.pageUrl.includes("{id}")||console.warn('[LiquidCommerce Elements] checkout.pageUrl does not include "{id}" placeholder and will not include cart IDs.'):(console.warn("[LiquidCommerce Elements] checkout.pageUrl cannot be empty. Skipping checkout configuration."),e.checkout=void 0):(console.warn("[LiquidCommerce Elements] checkout.pageUrl is required and must be a string. Skipping checkout configuration."),e.checkout=void 0)),e.promoTicker)if(Array.isArray(e.promoTicker)){const t=e.promoTicker.filter((t,n)=>{if(!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof t.separator||!t.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom is required. Skipping this promo."),![];const e="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(e instanceof Date)||Number.isNaN(e.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil is required. Skipping this promo."),![];const i="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return i instanceof Date&&!Number.isNaN(i.getTime())?e>=i?(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});e.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),e.promoTicker=void 0;e.proxy&&("object"!=typeof e.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),e.proxy=void 0):e.proxy.baseUrl&&"string"==typeof e.proxy.baseUrl?e.proxy.headers&&"object"!=typeof e.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),e.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),e.proxy=void 0))}buildConfiguration(n,e){var i,o,a,s;const l=e.env||t.PRODUCTION;let d=c[l];const p=l===t.PRODUCTION,m=e.isBuilder||![],f=h+(p?"":"_"+l)+(m?"builder":"");return(null===(i=e.development)||void 0===i?void 0:i.customApiUrl)&&(d=e.development.customApiUrl),{apiKey:n.trim(),env:l,isBuilder:m,debugMode:e.debugMode||r.NONE,baseUrl:d,partnerCode:void 0,partnerName:void 0,customTheme:e.customTheme||null,proxy:e.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:f,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:e.promoTicker||null,paymentMethodId:(null===(o=e.development)||void 0===o?void 0:o.paymentMethodId)||void 0,openShadowDom:p?![]:(null===(a=e.development)||void 0===a?void 0:a.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(s=e.development)||void 0===s?void 0:s.customApiUrl),checkout:e.checkout||null}}detectDeviceType(){var t,n;if("undefined"==typeof navigator)return"desktop";const e=navigator.userAgent.toLowerCase(),i="ontouchstart"in window||navigator.maxTouchPoints>0,o=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,r=(null===(n=window.screen)||void 0===n?void 0:n.height)||0,a=Math.max(o,r),s=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],c=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return s.some(t=>t.test(e))?"tablet":c.some(t=>t.test(e))||i&&a<768?"mobile":i&&a>=768&&a<=1200||i&&/macintosh/i.test(e)&&navigator.maxTouchPoints>1||/android/i.test(e)&&i&&a>=768||/windows nt/i.test(e)&&i&&a>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(e),"desktop")}}class AuthClientService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.authPromise=null,this.refreshPromise=null,this.shouldRetryNonAuth=(t,n)=>t?!![]:n&&this.isAuthError(n)?![]:n&&n.status>=500&&n.status<600,this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(t))}async authenticateAndGetConfigs(){var t,n,e,i,o,r,a,s,c;try{this.logger.info("Authenticating and fetching configurations in single request");const l=await this.request("/auth/authenticate",{method:"GET"},!![]);return(null===(n=null===(t=null==l?void 0:l.data)||void 0===t?void 0:t.auth)||void 0===n?void 0:n.accessToken)&&(null===(i=null===(e=null==l?void 0:l.data)||void 0===e?void 0:e.auth)||void 0===i?void 0:i.expiration)?(null===(c=null==l?void 0:l.data)||void 0===c?void 0:c.configs)?(this.accessToken=l.data.auth.accessToken,this.tokenExpiration=l.data.auth.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Successfully authenticated and retrieved configurations"),{success:!![],configs:{...l.data.configs,productList:{theme:{backgroundColor:"#FFFFFF"},layout:{productCard:{style:"card",cornerRadius:"rounded",showPrice:!![],showSizeSelector:!![],showFulfillment:!![],showQuantityCounter:!![],enablePersonalization:!![],enableShippingFulfillment:!![],enableOnDemandFulfillment:!![],showCollections:![]}}}}}):(this.logger.error("Combined auth response missing configs data",{response:null==l?void 0:l.data}),{success:![]}):(this.logger.error("Combined auth response missing required auth fields",{hasToken:!!(null===(r=null===(o=null==l?void 0:l.data)||void 0===o?void 0:o.auth)||void 0===r?void 0:r.accessToken),hasExp:!!(null===(s=null===(a=null==l?void 0:l.data)||void 0===a?void 0:a.auth)||void 0===s?void 0:s.expiration),response:null==l?void 0:l.data}),{success:![]})}catch(l){return this.logger.error("Failed to authenticate and get configs from combined endpoint",{error:l,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),{success:![]}}}async authenticate(){if(this.authPromise)return this.authPromise;this.authPromise=this.performAuthentication();try{return await this.authPromise}finally{this.authPromise=null}}async refreshToken(){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async get(t,n){return this.request(t,{method:"GET",headers:null==n?void 0:n.headers})}async post(t,n){return this.request(t,{method:"POST",body:null==n?void 0:n.body,headers:null==n?void 0:n.headers})}async performAuthentication(){var t,n,e,i;try{const o=await this.request("/auth",{method:"GET"},!![]);return(null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.accessToken)&&(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.expiration)?(this.accessToken=o.data.accessToken,this.tokenExpiration=o.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,!![]):(this.logger.error("Authentication response missing required fields",{hasToken:!!(null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.accessToken),hasExp:!!(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.expiration),response:null==o?void 0:o.data}),![])}catch(o){return this.logger.error("Failed to obtain access token from authentication endpoint",{error:o,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),![]}}async performTokenRefresh(){var t,n,e,i;try{this.logger.info("Attempting to refresh access token");const o=await this.request("/auth/refresh",{method:"POST"},![],!![]);return(null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.accessToken)&&(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.expiration)?(this.accessToken=o.data.accessToken,this.tokenExpiration=o.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Access token refreshed successfully"),!![]):(this.logger.error("Token refresh response missing required fields",{hasToken:!!(null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.accessToken),hasExp:!!(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.expiration),response:null==o?void 0:o.data}),![])}catch(o){return this.logger.warn("Failed to refresh access token, will fall back to full authentication",{error:o,status:null==o?void 0:o.status,endpoint:"/auth/refresh"}),![]}}async request(t,n,e=![],i=![]){if(!e&&!i&&(!this.accessToken||this.isTokenExpired())){let t=this.accessToken?await this.refreshToken():![];if(t||(this.logger.info("Token refresh failed or unavailable, attempting full authentication"),t=await this.authenticate()),!t)throw{status:401,message:"Authentication failed - unable to obtain valid access token",isAuthError:!![]}}const o=this.buildUrl(t),r=this.buildHeaders(n.headers,e),a=await this.httpClient.request({url:o,options:{method:n.method,headers:r,body:n.body?JSON.stringify(n.body):void 0},retryConfig:{maxRetries:AuthClientService.MAX_RETRIES,retryDelay:AuthClientService.RETRY_DELAY_MS,shouldRetry:this.shouldRetryNonAuth}});return a.ok?this.handleSuccessResponse(a,t,n.method):!this.isAuthError(a)||e||i?this.handleErrorResponse(a):this.handleAuthError(a,t,n)}async handleSuccessResponse(t,n,e){try{return await t.json()}catch(i){const o=await t.text().catch(()=>"Success");return this.logger.error("Response returned 2xx status but body is not valid JSON",{path:n,method:e,status:t.status,responsePreview:o.substring(0,1e3),error:i}),{message:o}}}async handleAuthError(t,n,e){this.logger.warn("Access token rejected with "+t.status+", attempting to obtain new token and retry request",{status:t.status,path:n,method:e.method});let i=await this.refreshToken();return i||(this.logger.info("Token refresh failed after auth error, attempting full authentication"),this.clearToken(),i=await this.authenticate()),i?this.request(n,e,![],!![]):(this.logger.error("Unable to obtain new access token after receiving auth error, request cannot be retried",{status:t.status,path:n,method:e.method}),this.handleErrorResponse(t))}async handleErrorResponse(t){let n;try{n=await t.json()}catch(e){const i=await t.text().catch(()=>"HTTP error status: "+t.status);n={message:i||"Unknown error"}}throw{...n,status:t.status,message:(null==n?void 0:n.message)||"Request failed"}}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}clearToken(){this.accessToken=null,this.tokenExpiration=null}buildUrl(t){const n=this.clientConfig.getProxyConfig();return new URL("api"+t,n?n.baseUrl:this.baseUrl).toString()}buildHeaders(t,n=![]){const e={"Content-Type":"application/json","X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now().toString(),"X-Liquid-UD-ID":this.clientConfig.get("userDeviceId")||"unknown",...this.getProxyHeaders(),...t};return n?e["X-Liquid-Api-Key"]=this.apiKey:e.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(e["X-Liquid-Api-Builder"]="true"),e}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}isAuthError(t){return 401===t.status||403===t.status}}AuthClientService.TOKEN_EXPIRATION_BUFFER_MS=6e5,AuthClientService.MAX_RETRIES=2,AuthClientService.RETRY_DELAY_MS=1e3;const _="@liquidcommerce/elements-sdk",E="LiquidCommerce Elements SDK",S="UNLICENSED",P="LiquidCommerce Team",D="2.6.0-beta.32",F="https://docs.liquidcommerce.co/elements-sdk",I={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},O={url:"https://github.com/liquidcommerce/elements-sdk/issues"},M="./dist/index.esm.js",L="./umd/elements.js",R="./dist/types/index.d.ts",j="pnpm@10.0.0",N={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./checkout":{types:"./dist/types/index.checkout.d.ts",import:"./dist/index.checkout.esm.js",browser:"./umd/elements-checkout.js",default:"./dist/index.checkout.esm.js"},"./package.json":"./package.json"},B=["dist","umd","docs","README.md","LICENSE"],q={access:"public",registry:"https://registry.npmjs.org/"},U="module",V=["dist/index.esm.js","dist/index.checkout.esm.js","umd/elements.js","umd/elements-checkout.js","src/index.ts","src/index.umd.ts","src/index.checkout.ts","src/index.checkout.umd.ts"],H={build:"rollup -c","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build:dev",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},K=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],Y={"@biomejs/biome":"2.3.11","@commitlint/cli":"^20.3.1","@commitlint/config-conventional":"^20.3.1","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.3","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^25.0.10","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.56.0","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},W={node:">=22"},Q={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},X={name:_,description:E,license:S,author:P,version:D,homepage:F,repository:I,bugs:O,module:M,browser:L,types:R,packageManager:j,exports:N,files:B,publishConfig:q,type:U,sideEffects:V,scripts:H,keywords:K,devDependencies:Y,engines:W,pnpm:Q};class GoogleTagManagerService{constructor(){this.enablePartnerGTM=![],this.enableLiquidCommerceGTM=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(t){const n=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return n.some(n=>{const e=n.src;return e.includes("id="+t)})}isContainerInitialized(t){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(t)?window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event)):![]}async loadGTMScript(t){try{if(this.isContainerInitialized(t))return{success:!![],usingExistingGTM:!![],message:"Container "+t+" already loaded"};if(this.isContainerLoaded(t)){const n=await this.waitForContainerInit(t,1e4);return n?{success:!![],usingExistingGTM:!![],message:"Container "+t+" initialized"}:this.checkFallbackGTM(t)}return await this.injectGTMScript(t),{success:!![],usingExistingGTM:![],message:"Container "+t+" loaded successfully"}}catch(n){return this.checkFallbackGTM(t)}}waitForContainerInit(t,n){return new Promise(e=>{let i;const o=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(o),clearTimeout(i),e(!![]))},100);i=setTimeout(()=>{clearInterval(o),e(![])},n)})}injectGTMScript(t){return new Promise((n,e)=>{const i=document.createElement("script");i.src="https://www.googletagmanager.com/gtm.js?id="+t,i.async=!![],i.crossOrigin="anonymous";let o=![];const r=setTimeout(()=>{o||(o=!![],this.isContainerInitialized(t)?n():e(new Error("GTM script timeout")))},15e3);i.onload=()=>{o||setTimeout(()=>{o||(o=!![],clearTimeout(r),this.isContainerInitialized(t)||window.dataLayer&&Array.isArray(window.dataLayer)?n():e(new Error("GTM script loaded but failed to initialize")))},500)},i.onerror=()=>{setTimeout(()=>{o||(o=!![],clearTimeout(r),this.isContainerLoaded(t)&&this.isContainerInitialized(t)?n():e(new Error("GTM script failed to load")))},100)},document.head.appendChild(i)})}checkFallbackGTM(t){if(this.isGTMAlreadyLoaded()&&window.dataLayer&&Array.isArray(window.dataLayer)){if(this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId))return{success:!![],usingExistingGTM:!![],message:"Using partner GTM container"};const t=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));if(t)return{success:!![],usingExistingGTM:!![],message:"Using existing GTM container"}}return window.dataLayer&&Array.isArray(window.dataLayer)?{success:!![],usingExistingGTM:!![],message:"Using basic dataLayer for event tracking"}:{success:![],usingExistingGTM:![],message:"Failed to load container "+t+" and no fallback available"}}processEventQueue(){const t=Date.now(),n=this.eventQueue.filter(n=>t-n.timestamp<3e4);for(const i of n)try{const t={event:i.eventName,...i.eventData};window.dataLayer.push(t)}catch(e){this.logger.error("Error processing queued event "+i.methodName,e)}this.eventQueue=[],n.length>0&&this.logger.info("Processed "+n.length+" queued GTM events")}getSendToTargets(){const t=[];return this.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&t.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&t.push(this.partnerGTMId),t}async initialize(t){try{if(this.isInitialized)return Promise.resolve();if(this.isInitializing&&this.initializationPromise)return this.initializationPromise;if(0,this.clientConfigService.isBuilder())return;this.isInitializing=!![],this.initializationPromise=this.doInitialize(t),await this.initializationPromise}catch(n){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",n)}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGTMId))return;if(!t.enableLiquidCommerceGTM&&!t.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerCode=t.partnerCode,this.partnerGTMId=t.partnerGTMId,this.liquidCommerceGTMId=t.liquidCommerceGTMId,this.enablePartnerGTM=t.enablePartnerGTM,this.enableLiquidCommerceGTM=t.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...t)=>window.dataLayer.push(t));const n=t.enableLiquidCommerceGTM?await this.loadGTMScript(t.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!n.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+n.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(n.message),this.processEventQueue()}executeEvent(t,n,e){try{if(this.clientConfigService.isBuilder())return;const i=this.getSendToTargets(),o={...e,...i.length>0&&{send_to:i},tenant_name:this.partnerName,tenant_code:this.partnerCode,tenant_source:X.description+" v"+X.version};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:n,eventData:o,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const r={event:n,...o};window.dataLayer.push(r)}catch(i){this.logger.error("GTM "+t+" error",i)}}calculateValue(t){const n=t.reduce((t,n)=>t+(n.price||0)*(n.quantity||1),0);return Number.parseFloat(n.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,n,e){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:n,item_list_name:e,items:t})}selectItem(t,n,e){this.executeEvent("selectItem","select_item",{item_list_id:n,item_list_name:e,items:[t]})}addToCart(t){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),quantity:t.quantity||1,items:[t]})}viewCart(t){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(t),items:t})}removeFromCart(t){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}beginCheckout(t,n){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:n,items:t})}addShippingInfo(t,n){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:n,items:t})}addPaymentInfo(t,n,e){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:n,coupon:e,items:t})}purchase(t){this.executeEvent("purchase","purchase",{transaction_id:t.transaction_id,value:t.value,currency:this.currency,tax:t.tax,shipping:t.shipping,coupon:t.coupon,items:t.items,subtotal:t.subtotal,total:t.total_before_discounts,discounts:t.discounts,gift_cards:t.gift_cards,net_total:t.net_total})}promoCodeAttempt(t){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:t})}promoCodeApplied(t,n){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:n})}promoCodeFailed(t,n){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:n})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,n){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:n})}giftCardFailed(t,n){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:n})}addressUpdated(t){this.executeEvent("addressUpdated","address_updated",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,coordinates:t.coordinates})}addressFailed(t){this.executeEvent("addressFailed","address_failed",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,address_error_message:t.error})}productNoAvailability(t){this.executeEvent("productNoAvailability","product_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productSizeNoAvailability(t){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productFulfillmentNoAvailability(t){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,fulfillment_type:t.fulfillmentType,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}}class PubSubService{constructor(){this.clientReadyEvent=null,this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub"),this.setupClientReadyBuffering()}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,n){this.publishSpecific("actions."+t,n)}publishForm(t,n){this.publishSpecific("forms."+t,n)}publishSpecific(t,n){const[e,i]=t.includes(".")?t.split(".",2):["actions",t];let o=i.split("_")[0];["product","cart","address","checkout"].includes(o)||(o="other");const r=Date.now(),a={eventId:"evt_"+r+"_"+Math.random().toString(36).slice(2,9),namespace:e,event:i,originalEvent:t,actionNamespace:"actions"===e?o:void 0,timestamp:r},s={data:n,metadata:a};this.dispatchNativeEvents(t,s)}dispatchNativeEvents(t,n){const[e]=t.split(".",2);try{"actions.client_ready"===t&&(this.clientReadyEvent=n);const i=new CustomEvent(this.eventPrefix+":"+t,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(i);const o=new CustomEvent(this.eventPrefix+":"+e,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(o)}catch(i){this.logger.error("Error dispatching native events for "+t,i)}}setupClientReadyBuffering(){try{const t=window.addEventListener,n=this.eventPrefix+":actions.client_ready";window.addEventListener=(e,i,o)=>{if(e!==n)return t.call(window,e,i,o);if(!this.clientReadyEvent)return t.call(window,e,i,o);try{const t=new CustomEvent(n,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof i?i(t):i&&"function"==typeof i.handleEvent&&i.handleEvent(t)}catch(r){this.logger.error("Error replaying CLIENT_READY event",r)}return t.call(window,e,i,o)}}catch(X){this.logger.error("Error setting up CLIENT_READY buffering",X)}}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:n,next:e})=>{const i=performance.now();try{const o=e(),r=performance.now()-i;return this.logger.info("🏪 Store "+t+" ✓ "+r.toFixed(3)+"ms",n),o}catch(o){const e=performance.now()-i;throw this.logger.error("🏪 Store "+t+" ✗ "+e.toFixed(3)+"ms",{payload:n,error:o}),o}},this.performanceMiddleware=({action:t,next:n})=>{const e=performance.now(),i=n(),o=performance.now()-e;return o>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+o.toFixed(2)+"ms"),i},this.state=w,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable:n,persistedStore:e}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+t,this.isLocalStorageAvailable=n,n?await this.loadPersistedState():e&&await this.loadFromDBPersistence(e),this.state={...this.state,metadata:x},this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:n,hasPersistedState:null!==e,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const n=t.split(".");let e=this.state;for(const i of n){if(null==e)return;e=e[i]}return void 0!==e?Array.isArray(e)?[...e]:"object"==typeof e&&null!==e?{...e}:e:void 0}set(t,n){return this.runWithMiddleware("set",{path:t,value:n},()=>{const e=this.get(t);return this.state=this.immutableSet(this.state,t,n),this.notifyListeners(t,n,e),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,n){const e=this.get(t),i=n(e);return this.set(t,i)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const n=this.get(t);if(void 0===n)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const e=t.split(".");let i=this.state;const o=e.pop();for(const r of e){if(void 0===i[r])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];i=i[r]}if(Array.isArray(i))i=i.filter((t,n)=>n!==Number.parseInt(o,10));else{if("object"!=typeof i||null===i)return this.logger.warn('Cannot remove property "'+o+'" from non-object type at path "'+t+'".'),![];{const{[o]:t,...n}=i;i=n}}return this.state=this.immutableSet(this.state,e.join("."),i),this.notifyListeners(t,void 0,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const n=[];if("function"==typeof t){const e=t(this.state);for(const[t,i]of Object.entries(e)){const e=this.get(t);n.push({path:t,oldValue:e,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,i)}}else for(const[e,i]of Object.entries(t)){const t=this.get(e);n.push({path:e,oldValue:t,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,e,i)}for(const{path:t,oldValue:e,newValue:i}of n)this.notifyListeners(t,i,e);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,n){const e=t;return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(n),()=>{var t;null===(t=this.listeners.get(e))||void 0===t?void 0:t.delete(n)}}watchMany(t,n){const e=[];let i;const o=t.map(t=>this.watch(t,(o,r)=>{e.push({path:t,value:o,oldValue:r}),clearTimeout(i),i=setTimeout(()=>{e.length>0&&(n([...e]),e.length=0)},0)}));return()=>{for(const t of o)t()}}createProductInstance(t){const n="products."+t,e=this.get(n);return e?!![]:this.set(n,m)}removeProductInstance(t){const n=this.get("products"),{[t]:e,...i}=n;return this.set("products",i)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(t,n,e){let i=0;const k=()=>{if(i>=this.middleware.length)return e();const o=this.middleware[i++];return o({action:t,payload:n,state:this.getState(),next:k})};return k()}immutableSet(t,n,e){const i=n.split(".");if(1===i.length){if(Array.isArray(t)){const n=[...t];return n[i[0]]=e,n}return{...t,[i[0]]:e}}const[o,...r]=i,a=t[o],s=Array.isArray(a)?[]:{};if(Array.isArray(t)){const n=[...t];return n[o]=this.immutableSet(a||s,r.join("."),e),n}return{...t,[o]:this.immutableSet(a||s,r.join("."),e)}}notifyListeners(t,n,e){const i=this.listeners.get(t);if(i)for(const s of i)try{s(n,e)}catch(r){this.logger.error('Error in store listener for path "'+t+'"',r)}const o=t.split(".");for(let s=o.length-1;s>0;s--){const t=o.slice(0,s).join("."),n=this.listeners.get(t);if(n){const i=this.get(t),r=o.slice(s).join("."),c=this.immutableSet(i,r,e);for(const e of n)try{e(i,c)}catch(a){this.logger.error('Error in store listener for parent path "'+t+'"',a)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var t;const n=this.get("address.id")||"",e=this.get("cart.id");if(!n&&!e)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:n,cartId:e}),void 0;try{const i=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(i,{p:n,c:e}),this.logger.info("Session data persisted to DB",{userDeviceId:i,addressId:n,cartId:e})}catch(i){this.logger.error("Failed to persist session data to DB",i)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.info("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.info("localStorage entry completely removed",{key:this.localStorageKey})}catch(X){this.logger.error("Failed to clear localStorage entry",X)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const n=this.get("address.id")||"",e=this.get("cart.id");(n||e)&&(t=n+":"+e)}else t=this.getState();t&&localStorage.setItem(this.localStorageKey,"string"!=typeof t?JSON.stringify(t):t)}catch(t){this.logger.error("Failed to persist store state",t)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const n=localStorage.getItem(this.localStorageKey);if(!n)return;try{const t=JSON.parse(n);for(const[n,e]of Object.entries(t))this.set(n,e);return}catch(t){if(n.includes(":")){const[t,e]=n.split(":");if(void 0!==t){const n=await this.getAddressDataFromId(t);this.set("address",n)}return void 0!==e&&this.set("cart.id",e||""),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:n})}}catch(n){this.logger.error("Failed to load persisted state",n),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const n=await this.getAddressDataFromId(t.p);this.set("address",n)}void 0!==t.c&&this.set("cart.id",t.c||""),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(n){this.logger.error("Failed to load session data from DB persistence",n)}}async getAddressDataFromId(t){if(!t||""===t.trim())return p;try{const n=await this.api.getAddressDetails(t);return n&&0!==Object.keys(n).length?{id:t,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:{latitude:n.coordinates.latitude,longitude:n.coordinates.longitude}}:{...p,id:t}}catch(n){return{...p,id:t}}}}const Z=[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL,i.PRODUCT_OPTIONS,i.PRODUCT_INTERACTIONS,i.PRODUCT_DESCRIPTION,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST,i.PRODUCT_PRICE,i.PRODUCT_ADD_TO_CART_SECTION,i.PRODUCT_DRAWER,i.PRODUCT_LOADING,i.ENGRAVING_FORM,i.ENGRAVING_VIEW],J=[i.ADDRESS_INPUT,i.ADDRESS_DISPLAY],$=[i.CART,i.CART_RETAILER,i.CART_ITEM,i.CART_FOOTER,i.CART_ITEM_QUANTITY_PRICE,i.CART_RETAILER_SUBTOTAL,i.CART_PROMO_CODE,i.CART_HEADER,i.CART_BODY,i.CART_FULFILLMENT,i.BUTTONS_CART_OPEN],tt=[i.CHECKOUT,i.CHECKOUT_INFORMATION,i.CHECKOUT_STRIPE_HANDLER,i.CHECKOUT_STRIPE_FORM,i.CHECKOUT_PAYMENT,i.CHECKOUT_BILLING,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PROMO_CODE,i.CHECKOUT_GIFT_CARDS,i.CHECKOUT_AMOUNTS,i.CHECKOUT_ITEMS,i.CHECKOUT_COMPLETED,i.CHECKOUT_DELIVER_TO,i.CHECKOUT_DELIVER_TO_SUMMARY,i.CHECKOUT_BUYER,i.CHECKOUT_TIPS,i.CHECKOUT_PC_GC,i.CHECKOUT_ITEM,i.CHECKOUT_ITEM_QUANTITY,i.CHECKOUT_PLACE_ORDER_BUTTON,i.CHECKOUT_HEADER,i.CHECKOUT_PRESALE_COUNTDOWN,i.CHECKOUT_PRESALE_EXPIRED,i.CHECKOUT_SEND_AS_GIFT],nt=[i.PRODUCT_LIST,i.PRODUCT_LIST_CARD,i.PRODUCT_LIST_CARD_LOADING,i.PRODUCT_LIST_FILTERS,i.PRODUCT_LIST_SEARCH];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,n="swap"){if(!t||0===t.length)return;const e=[...this.defaultFontFamilies,...t],i=e.map(t=>{const n=encodeURIComponent(t.name);return"family="+n+":wght@"+t.weights.join(";")}).join("&"),o="display="+n;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+i+"&"+o,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,n="swap"){const e=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,n),e&&e.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),n=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!t){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",document.head.appendChild(t)}if(!n){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="",document.head.appendChild(t)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const t=document.createElement("link");t.rel="stylesheet",t.href=this.googleFontsUrl,t.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(t)}}const getProductListStyles=()=>"\n .product-list {\n width: 100%;\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-search__control-container {\n max-width: 500px;\n width: 100%;\n }\n\n /* Filter button host - shown only on mobile when NOT in drawer */\n .product-list-filter-button-host {\n display: none;\n }\n\n /* Mobile: show button on page, but hide it in drawer */\n @media (max-width: 1023px) {\n /* Show button on the page */\n .product-list-filter-button-host {\n display: flex;\n }\n \n /* Hide filter content on the page (sidebar) */\n .product-list-filters-content-wrapper {\n display: none !important;\n }\n \n /* But in drawer mode, hide button and show content */\n .drawer-mode .product-list-filter-button-host,\n .product-list-filters-container.drawer-mode .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper.drawer-mode,\n .product-list-filters-container.drawer-mode .product-list-filters-content-wrapper {\n display: block !important;\n padding: 0px 16px;\n }\n }\n\n /* Desktop: always hide button, show filter content */\n @media (min-width: 1024px) {\n .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper {\n display: block !important;\n }\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n cursor: default;\n }\n\n .product-list-filter-icon {\n display: flex;\n align-items: center;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 0px;\n }\n\n .product-list-filters-container {\n width: 16.6%;\n min-width: 200px;\n max-height: calc(100vh - 48px);\n height: fit-content;\n position: sticky;\n overflow-y: auto;\n overflow-x: hidden;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 80px 24px;\n position: static;\n max-height: none;\n height: 100%;\n overflow-y: visible;\n }\n\n\n\n .product-list-filters-engraving,\n .product-list-filters-presale,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-engraving,\n .product-list-filters-presale {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n }\n\n .product-list-filters-engraving-label,\n .product-list-filters-presale-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-fulfillment-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-fulfillment-options-header:hover .product-list-filters-fulfillment-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-engraving:hover .product-list-filters-engraving-label, \n .product-list-filters-presale:hover .product-list-filters-presale-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filters-fulfillment-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-fulfillment-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-fulfillment-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-fulfillment-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-fulfillment-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-fulfillment-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-fulfillment-option {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n\n .product-list-filters-fulfillment-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-fulfillment-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-fulfillment-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-fulfillment-radio:focus,\n .product-list-filters-fulfillment-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-fulfillment-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-fulfillment-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+d.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Filters */\n .product-list-filters-fulfillment-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price:last-child {\n border-bottom: none;\n padding-bottom: 0px 16px;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 16px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n z-index: 999;\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Product List Card Styles */\n .product-list-card {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-height: 400px;\n height: 100%;\n padding: 8px;\n border: 1px solid var(--base-accent, #E4E4E7);\n background: var(--base-background, #FAFAFA);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .product-list-card.sharp {\n border-radius: 0px;\n }\n\n .product-list-card.card {\n background: var(--base-background, #FAFAFA);\n border: 1px solid var(--base-accent, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .product-list-card.ghost {\n background: transparent;\n border: none;\n box-shadow: none;\n }\n\n .product-list-card.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n position: relative;\n }\n\n .product-list-card .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-card .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n /* Pre-Order Badge Styles */\n .plc__presale-badge {\n position: absolute;\n top: 16px;\n left: 16px;\n padding: 4px 12px;\n background-color: #18181B;\n color: #FFFFFF;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n z-index: 10;\n text-transform: capitalize;\n letter-spacing: 0.5px;\n }\n\n .plc__presale-badge.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__presale-badge.sharp {\n border-radius: 0px;\n }\n\n .plc__content {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 16px;\n align-self: stretch;\n padding-top: 16px;\n }\n\n .plc__badges-wrapper {\n display: flex;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n gap: 8px;\n line-height: 14px;\n }\n\n .plc__badge-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 400;\n }\n\n .plc__content .plc__title {\n width: 100%;\n font-size: 24px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n line-height: 24px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n word-wrap: break-word;\n word-break: break-word;\n height: 70px;\n }\n\n .plc__price-personalization-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .plc__price {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 24px;\n }\n\n .plc__personalize {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .plc__dropdown-size-wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0;\n align-items: flex-start;\n border: 1px solid var(--base-accent, #E4E4E7);\n background: var(--base-background, #FAFAFA);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n transition: all 0.3s ease;\n overflow: visible;\n position: relative;\n }\n\n .plc__dropdown-size-wrapper.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__dropdown-size-wrapper.sharp {\n border-radius: 0px;\n }\n\n .plc__dropdown-default-size-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n background: none;\n border: none;\n padding: 4px 8px;\n cursor: pointer;\n transition: opacity 0.2s ease;\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__dropdown-size-wrapper.expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .plc__dropdown-size-text {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-weight: 400;\n }\n\n .plc__dropdown-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .plc__dropdown-chevron svg {\n display: block;\n }\n\n .plc__dropdown-check {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .plc__dropdown-check svg {\n display: block;\n }\n\n .plc__sizes-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 0;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease;\n background: var(--base-background, #FFFFFF);\n border: 1px solid var(--base-accent, #E4E4E7);\n border-top: none;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n z-index: 1000;\n }\n\n .plc__sizes-list.rounded {\n border-bottom-left-radius: var(--border-radius-rounded, 6px);\n border-bottom-right-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__sizes-list.sharp {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .plc__dropdown-size-wrapper.expanded .plc__sizes-list {\n max-height: 200px;\n opacity: 1;\n overflow-y: auto;\n }\n\n .plc__size-option {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 4px 8px;\n background: var(--base-background, #FFFFFF);\n border: none;\n cursor: pointer;\n transition: all 0.2s ease;\n }\n\n .plc__size-option:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .plc__size-option:hover .plc__size-option-text {\n color: var(--selected-text-color, #ffffff);\n }\n\n .plc__size-option:hover .plc__size-option-check svg {\n color: var(--selected-text-color, #ffffff);\n }\n\n .plc__size-option-text {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-weight: 400;\n transition: color 0.2s ease;\n }\n\n .plc__size-option-check {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: color 0.2s ease;\n width: 12px;\n }\n\n .plc__size-option-check svg {\n display: block;\n }\n\n .plc__fulfillment-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n align-self: stretch;\n }\n\n .plc__fulfillment-text {\n color: var(--base-foreground, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n word-wrap: break-word;\n word-break: break-word;\n height: 48px;\n }\n\n .plc__fulfillment-delivery {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .plc__add-to-cart-wrapper {\n display: flex;\n align-items: center;\n align-content: flex-start;\n gap: 8px;\n align-self: stretch;\n flex-wrap: nowrap;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text {\n display: flex;\n min-width: 32px;\n height: 36px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n user-select: none;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text.ghost {\n border: none;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase {\n display: flex;\n width: 32px;\n height: 36px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n background: transparent;\n border: 1px solid var(--accent-color, #E4E4E7);\n transition: background-color 0.15s ease, opacity 0.15s ease;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease {\n border-right: 1px solid var(--accent-color, #E4E4E7); \n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase {\n border-left: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.disabled,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.rounded {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.rounded {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n \n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.sharp {\n border-radius: 0px;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.sharp {\n border-radius: 0px;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.ghost,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.ghost {\n border: none;\n }\n\n .product-list-card .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n height: 36px;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n font-family: var(--paragraph-font-family, Poppins);\n padding: 0 0.75rem;\n border: none;\n cursor: pointer;\n transition-property: background-color, transform;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button.rounded {\n border-radius: var(--button-border-radius, 6px);\n }\n\n .plc__button.sharp {\n border-radius: 0px;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .plc__button:active {\n transform: translateY(1px);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Product List Card Drawer */\n .product-list-card {\n position: relative;\n overflow: visible;\n }\n\n .product-list-card-drawer-container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--drawer-background-color, #ffffff);\n z-index: 100;\n transform: translateX(100%);\n transition: transform 0.3s ease;\n overflow: hidden;\n border-radius: var(--border-radius-rounded, 6px);\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n }\n\n .product-list-card-drawer-container.open {\n transform: translateX(0);\n }\n\n .product-list-card-drawer-content {\n width: 100%;\n height: 100%;\n overflow-y: auto;\n padding: 16px;\n position: relative;\n }\n\n\n /* Retailers Popup Styles */\n .retailers-popup-wrapper {\n padding: 16px;\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .retailers-popup-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 16px;\n }\n\n .retailers-popup-title {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n line-height: 24px;\n margin: 0;\n }\n\n .retailers-popup-close {\n background: none;\n border: none;\n cursor: pointer;\n color: #6B7280;\n padding: 4px;\n }\n\n .retailers-popup-no-data {\n padding: 24px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .popup-fulfillment-list-container {\n margin-top: 16px;\n max-height: 445px;\n overflow-y: auto;\n }\n\n /* Prevent background scroll when dialog is active */\n body:has(dialog[open]) {\n overflow: hidden;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Filters Chips */\n .product-list-filters-chips-container {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-chips-container:empty {\n display: none;\n padding: 0;\n border-bottom: none;\n }\n\n .product-list-filters-clear-all {\n display: inline-flex;\n align-items: center;\n padding: 8px 0px 0px;\n background: none;\n border: none;\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 700;\n color: var(--primary-color, #3b82f6);\n text-decoration: underline;\n cursor: pointer;\n text-transform: uppercase;\n }\n\n .product-list-filters-clear-all:hover {\n color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-clear-all:focus {\n outline: none;\n }\n\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 4px 12px;\n background-color: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 400;\n color: var(--default-text-color, #374151);\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n\n .chip-text {\n line-height: 1.2;\n user-select: none;\n }\n\n .chip-close {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--default-text-color-70, #9ca3af);\n transition: color 0.2s ease;\n flex-shrink: 0;\n }\n\n .chip-close:hover {\n color: var(--default-text-color, #374151);\n }\n\n .chip-close:focus {\n outline: none;\n }\n\n .chip-close svg {\n display: block;\n width: 16px;\n height: 16px;\n }\n\n /* Responsive Styles */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+d.ADDRESS_SUGGESTIONS+";\n list-style: none;\n overflow-y: auto;\n padding: 4px 0;\n align-self: stretch;\n border-radius: 0 0 6px 6px;\n border-right: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n border-left: 1px solid var(--accent-color, #E4E4E7);\n background: var(--drawer-background-color, #FAFAFA);\n }\n\n .address-input-container .suggestions-list.show {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n .address-input-container .suggestions-list.hide {\n display: none;\n }\n\n .address-input-container .suggestions-list.show {\n display: block;\n }\n\n .address-input-container .suggestion-item {\n display: flex;\n padding: 6px 8px;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n text-align: left;\n }\n\n .address-input-container .suggestion-item > span {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n flex: 1 0 0;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .address-input-container .suggestion-item:hover {\n border-radius: 2px;\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--default-text-color-50, #E4E4E7);\n }\n\n .address-input-container .suggestion-item.no-suggestions {\n color: var(--warning-color, #6B7280);\n text-align: center;\n cursor: default;\n }\n\n .address-input-container .suggestion-item.no-suggestions:hover {\n background-color: transparent;\n }\n\n .address-input-container .error-message {\n display: flex;\n align-items: center;\n padding: 12px;\n border: 1px solid var(--error-color, #B91C1C);\n border-radius: var(--card-border-radius, 6px);\n color: var(--error-color, #B91C1C);\n font-size: 14px;\n position: relative;\n z-index: "+d.ERROR_MESSAGE+";\n }\n\n .address-input-container .error-icon {\n font-size: 16px;\n margin-right: 8px;\n }\n\n .address-input-container .error-text {\n flex: 1;\n }\n\n .address-input-container .action-buttons {\n display: flex;\n justify-content: space-between;\n position: relative;\n z-index: "+d.ADDRESS_ACTIONS+";\n }\n\n .address-input-container .action-buttons > button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n transition: all 0.2s ease;\n width: 50%;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .address-input-container .action-buttons > button:not(:first-child) {\n margin-left: 8px;\n }\n\n .address-input-container .action-buttons .secondary-button {\n color: var(--default-text-color, #18181B);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .action-buttons .primary-button {\n color: var(--selected-text-color, #18181B);\n background-color: var(--primary-color, #E4E4E7);\n border: 1px solid transparent;\n }\n\n .privacy-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\n color: var(--default-text-color, #18181B);\n text-align: left;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .address-input-container .suggestion-item > span {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .address-display-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .address-display-container > span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .address-display-container > button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n text-align: left;\n }\n",getCartStyles=()=>"\n .cart-container {\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .cart-container.no-header .cart-body {\n padding: 0 0 16px 0;\n }\n\n .cart-container.no-header .cart-footer {\n padding: 16px 0 0 0;\n }\n\n .cart-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n position: sticky;\n top: 0;\n background-color: var(--drawer-background-color, #FFFFFF);\n z-index: "+d.CART_HEADER+";\n }\n\n .cart-header-content {\n width: 100%;\n height: 48px;\n display: flex;\n align-items: center;\n align-self: stretch;\n justify-content: space-between;\n padding: 16px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .cart-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-header-close-btn {\n font-size: 1.4rem;\n font-weight: 300;\n border: none;\n background: none;\n }\n\n .cart-header-close-btn:hover {\n cursor: pointer;\n }\n\n .cart-body {\n position: relative;\n flex: 1;\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-self: stretch;\n }\n\n .cart-body > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .empty-cart-container {\n display: flex;\n align-self: center;\n margin: auto;\n }\n\n .retailer-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .section-header-label {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n }\n\n .cart-fulfillment-subtotal {\n color: var(--default-text-color, #18181B);\n }\n\n .section-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-retailer-header {\n display: flex;\n flex-direction: column;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-info {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .retailer-body-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n flex-direction: column;\n max-height: 2000px;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .retailer-subtotal-container {\n display: flex;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailer-subtotal-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-subtotal-amount {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-fulfillment-container {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n max-height: 2000px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-fulfillment-container > .cart-item-container {\n margin-top: 16px;\n }\n\n .cart-item-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item-container > *:not(:first-child) {\n margin-top: 12px;\n }\n\n .cart-item {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .item-image {\n display: flex;\n width: 56px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .item-details {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-details > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .quantity-price {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .item-title {\n font-weight: 500;\n font-size: 0.95rem;\n word-break: break-word;\n margin: 0;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-specs {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-shipping-container {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .cart-add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .item-shipping {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-quantity {\n display: flex;\n width: 106px;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .quantity-btn-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-decrease {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease:disabled,\n .quantity-btn-increase:disabled,\n .quantity-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .quantity-value {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-quantity.outlined .quantity-value {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .item-price-container {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n align-content: center;\n flex: 1 0 0;\n flex-wrap: wrap;\n }\n\n .item-price-container > *:not(:first-child) {\n margin-left: 6px;\n }\n\n .item-price {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .item-price-per-unit {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .item-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n align-self: stretch;\n }\n\n .cart-footer {\n margin-top: auto;\n display: flex;\n min-height: 146px;\n padding: 16px;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n align-self: stretch;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n flex-shrink: 0;\n }\n\n .cart-footer > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .cart-footer-header {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n }\n\n .cart-footer-header > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .cart-footer-header .cart-footer-items-price {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n\n .cart-footer-header .subtotal-text {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .subtotal-price {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .taxes-fees-info {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n max-width: 85%;\n }\n\n .promo-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n width: 100%;\n border-radius: var(--button-border-radius, 6px);\n }\n\n .promo-input.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .promo-input.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .checkout-button {\n display: flex;\n position: relative;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border: none;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #F1F5F9);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+d.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .checkout-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n /* CSS-only accordions */\n .chevron {\n transition: transform 0.3s ease;\n }\n\n /* Product section accordions */\n .section-toggle {\n display: none;\n }\n\n .section-toggle:checked + .section-header-label .chevron {\n transform: rotate(180deg);\n color: var(--default-text-color, #18181B);\n }\n\n .retailer-section.collapsed .retailer-body-container {\n max-height: 0;\n }\n\n .retailer-section.collapsed .cart-retailer-header {\n border-bottom: none;\n }\n\n .shipping-content {\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease-out;\n padding-left: 20px;\n }\n\n /** * Loading spinner styles */\n .cart-loading-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: var(--drawer-background-color-30, #E4E4E7);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: "+d.CART_LOADING+";\n }\n\n /* Modern browsers with backdrop-filter support */\n @supports (backdrop-filter: blur(1px)) {\n .cart-loading-backdrop {\n background-color: var(--drawer-background-color-30, #E4E4E7);\n backdrop-filter: blur(1px);\n }\n }\n\n .cart-loading-spinner-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .cart-loading-spinner {\n margin-bottom: 16px;\n }\n\n .cart-spinner {\n animation: cart-spinner-rotate 2s linear infinite;\n color: var(--primary-color, #1D4ED8);\n }\n\n .cart-spinner-path {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: 0;\n stroke-linecap: round;\n animation: cart-spinner-dash 1.5s ease-in-out infinite;\n }\n\n @keyframes cart-spinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n @keyframes cart-spinner-dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n }\n\n /*PROMO CODE */\n .promo-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-self: stretch;\n flex: 1;\n }\n\n .promo-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .promo-container-wrapper {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-code-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-input-wrapper {\n flex: 1;\n }\n\n /* Style the InputComponent container */\n .promo-input-wrapper .custom-input {\n margin: 0;\n width: 100%;\n }\n\n /* Hide label in promo context since we have placeholder */\n .promo-input-wrapper .custom-input label {\n display: none;\n }\n\n /* Style the actual input inside the InputComponent */\n .promo-input-wrapper .promo-input {\n width: 100%;\n padding: 12px 16px;\n border: 1px solid #ddd;\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n box-sizing: border-box;\n }\n\n .promo-input-wrapper .promo-input:focus {\n outline: none;\n border-color: var(--primary-color, #1D4ED8);\n }\n\n .promo-input-wrapper .promo-input:disabled {\n background-color: #f8f9fa;\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n .promo-input-wrapper .promo-input.input-error {\n border-color: #dc3545; }\n\n /* Error container styling from InputComponent */\n .promo-input-wrapper .error-container {\n margin-top: 4px;\n min-height: 20px;\n }\n\n .promo-input-wrapper .error-message {\n color: #dc3545;\n font-size: 12px;\n margin: 2px 0;\n display: block;\n }\n\n /* Apply button styling */\n .apply-button {\n display: flex;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .apply-button:hover:not(:disabled) {\n opacity: 0.9;\n }\n\n .apply-button:disabled {\n cursor: not-allowed;\n opacity: 0.7;\n }\n\n /* Applied promo code display - matches the design */\n .promo-applied-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n align-items: center;\n flex: 1;\n }\n\n .promo-code-pill {\n display: flex;\n height: var(--height-h-9, 36px);\n padding: 4px 12px;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px\n }\n\n .promo-remove-btn {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.2s ease;\n text-decoration: underline;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n }\n\n .error-banner {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px) 0 0 var(--card-border-radius, 6px);\n }\n\n .error-banner > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .close-btn {\n border: none;\n font-size: 16px;\n cursor: pointer;\n color: #fff;\n border-radius: 0 var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0;\n padding: 8px 16px;\n\n background: var(--error-color, #DC2626);\n }\n\n /* Mobile responsive */\n .promo-code-pill {\n align-self: flex-start;\n }\n\n .promo-remove-btn {\n align-self: flex-end;\n padding: 4px 8px;\n }\n }\n\n /* Optional: Add loading indicator styles if needed */\n .promo-input-wrapper.loading::after {\n content: '';\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+d.LOADING_INDICATOR+";\n width: 16px;\n height: 16px;\n border: 2px solid var(--accent-color, #E4E4E7);\n border-top: 2px solid var(--accent-color, #E4E4E7);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n\n .empty-cart-content {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getCheckoutStyles=()=>"\n .checkout-container {\n width: 100%;\n height: auto;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n align-self: stretch;\n gap: 24px;\n }\n\n .checkout-container:not(.independent) {\n padding: 24px;\n }\n\n .checkout-container.independent {\n padding: 24px;\n }\n\n .checkout-information-section {\n min-width: 320px;\n max-width: 512px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-wrap: wrap;\n flex: 1 0 0;\n }\n\n .checkout-information-section > *:not(:first-child) {\n margin-top: 24px;\n padding-top: 24px;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-delivery-information,\n .checkout-buyer-information,\n .checkout-billing-form {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-delivery-information > *:not(:first-child),\n .checkout-buyer-information > *:not(:first-child),\n .checkout-billing-form > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-billing-form {\n margin-top: 24px;\n }\n\n .checkout-payment-form {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .checkout-payment-form > *:not(:last-child) {\n margin-bottom: 24px;\n }\n\n .delivery-header-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .delivery-title-container {\n display: flex;\n min-width: 200px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .delivery-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .section-title-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .section-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .delivery-title-container > .delivery-title,\n .section-title-container > .section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .delivery-title-container > .delivery-subtitle,\n .section-title-container > .section-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-self: stretch;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .gift-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .gift-toggle-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .gift-label-wrapper {\n display: flex;\n flex-direction: column;\n min-width: 200px;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .gift-toggle-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n z-index: "+d.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .checkout-tips-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tips-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-tip-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-distribution-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-distribution-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-tips-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list.show {\n display: flex;\n }\n\n .checkout-tip-distribution-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-fulfillment-input-wrapper {\n display: flex;\n align-items: center;\n }\n\n .checkout-tip-fulfillment-input-wrapper > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-tip-remove-button {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .checkout-tip-distribution-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-sub-header {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-tip-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-tip-config-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-config-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-tip-selection-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-selection-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-tip-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-tip-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-tip-button > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-tip-input-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-input-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-sections-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-sections-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-pc-gc-sub-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-pc-gc-sub-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-pc-gc-applied {\n display: flex;\n width: 100%;\n flex-direction: row;\n align-self: stretch;\n display: flex;\n padding: 0px 12px;\n justify-content: space-between;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-pc-gc-applied span {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .checkout-pc-gc-applied button {\n display: flex;\n height: 36px;\n padding: 8px 0px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+d.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-send-to-subtitle,\n .checkout-your-info-subtitle,\n .checkout-billing-subtitle,\n .checkout-payment-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-summary-section {\n min-width: 320px;\n max-width: 400px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-summary-section > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-disclaimer-title,\n .checkout-summary-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-disclaimer-subtitle,\n .checkout-summary-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-promo-code-container,\n .checkout-gift-cards-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-promo-code-container > *:not(:first-child),\n .checkout-gift-cards-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .input-promo-code-container,\n .input-gift-card-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n }\n\n .input-promo-code-container > *:not(:first-child),\n .input-gift-card-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .input-promo-code-container .apply-button,\n .input-gift-card-container .apply-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-self: flex-start;\n align-items: center;\n\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .input-promo-code-container .apply-button.disabled,\n .input-gift-card-container .apply-button.disabled {\n background: var(--primary-color-50, #1D4ED8);\n }\n\n .checkout-amounts-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-amounts-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-amount-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-amount-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-total {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n\n }\n\n .checkout-amount-total span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-separator {\n width: 100%;\n height: 1px;\n margin: 0px;\n background: var(--accent-color, #E4E4E7);\n }\n\n .checkout-place-order-button-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-place-order-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n font-family: var(--paragraph-font-family, Poppins);\n align-self: stretch;\n font-weight: 600;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n transition: all 0.2s ease;\n cursor: pointer;\n position: relative;\n }\n\n .checkout-place-order-button-container .alert-container, .checkout-place-order-button-container .alert-wrapper {\n margin-bottom: 24px;\n }\n\n .checkout-place-order-button.ready {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-place-order-button.ready:hover {\n filter: brightness(0.9);\n transform: translateY(-1px);\n }\n\n .checkout-place-order-button.ready:active {\n transform: translateY(0);\n }\n\n /* States when things are missing/wrong - use your opacity variants */\n .checkout-place-order-button.form-invalid,\n .checkout-place-order-button.payment-incomplete,\n .checkout-place-order-button.payment-error {\n background: var(--primary-color-70);\n color: var(--selected-text-color);\n }\n\n .checkout-place-order-button.form-invalid:hover,\n .checkout-place-order-button.payment-incomplete:hover,\n .checkout-place-order-button.payment-error:hover {\n background: var(--primary-color-70);\n }\n\n /* Processing state - keep full primary color to show confidence */\n .checkout-place-order-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .checkout-place-order-button.processing::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+d.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n line-height: 100%;\n }\n\n .checkout-completed-help-section a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section {\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child,\n .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+d.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\n }\n\n /* Hosted checkout header - non-sticky */\n .checkout-header-wrapper.hosted {\n position: relative;\n background-color: transparent;\n }\n\n .checkout-header-container {\n display: flex;\n min-width: 320px;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 8px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-header-button {\n display: flex;\n height: 36px;\n padding: 12px 16px;\n padding-right: 0px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-button > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-header-button-close {\n display: flex;\n height: 36px;\n width: 36px;\n padding: 2px 4px;\n justify-content: center;\n align-items: center;\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Spacer to maintain layout balance when close button is hidden */\n .checkout-header-spacer {\n width: 36px;\n height: 36px;\n flex-shrink: 0;\n }\n\n .checkout-header-title {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-presale-countdown-container {\n display: flex;\n min-width: 320px;\n padding: 12px 24px 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n\n &.is-scrolled {\n box-shadow: 0px 6px 10px -2px var(--primary-color-30);\n }\n\n &.time-warning {\n box-shadow: 0px 6px 10px -2px var(--error-color-30, #FDE68A);\n }\n }\n\n .checkout-presale-countdown {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: 0;\n overflow: hidden;\n }\n\n .checkout-presale-countdown.time-warning {\n background: var(--error-color-30, #FDE68A);\n border: 1px solid var(--error-color, #E4E4E7);\n }\n\n .checkout-presale-countdown.time-warning {\n background: transparent;\n border: none;\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-bar {\n background: var(--error-color-70, #FDE68A);\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-fill {\n background: var(--error-color, #EF4444);\n }\n\n .checkout-presale-text-container {\n display: flex;\n padding: 0px 0px 6px;\n justify-content: flex-end;\n align-self: stretch;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-presale-progress-bar {\n display: flex;\n height: 6px;\n align-items: center;\n align-self: stretch;\n border-radius: 40px;\n background: var(--primary-color-50, #E4E4E7);\n position: relative;\n overflow: hidden;\n }\n\n .checkout-presale-progress-fill {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n z-index: "+d.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--default-text-color, #18181B);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 5px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+d.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 500;\n }\n\n .engraving-view-container .engraving-body {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-view-container .engraving-lines {\n display: flex;\n min-width: 136px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .engraving-view-container .engraving-lines .engraving-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-transform: uppercase;\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-lines .engraving-line:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-actions {\n display: flex;\n align-items: center;\n }\n\n .engraving-view-container .engraving-actions .edit-button {\n margin-left: 16px;\n }\n\n .engraving-view-container .engraving-actions button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n',getImageCarouselStyle=()=>"\n .product-image-carousel {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 100%;\n height: auto;\n min-height: 350px;\n overflow: hidden;\n }\n\n .product-image-carousel.popup {\n max-height: 474px;\n }\n\n .product-image-carousel.carousel {\n max-height: 594px;\n }\n\n .main-image {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n border-radius: var(--card-border-radius, 6px);\n overflow: hidden;\n flex: 1;\n background-image: var(--bg-image, none);\n background-position: center center;\n background-size: contain;\n background-repeat: no-repeat;\n }\n\n .carousel-dots {\n position: absolute;\n bottom: 16px;\n left: 50%;\n transform: translateX(-50%);\n z-index: "+d.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n width: 60px;\n height: 60px;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n opacity: 0.5;\n overflow: hidden;\n }\n\n .gallery-image {\n display: block;\n object-fit: cover;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n height: 100%;\n margin: 0 auto;\n max-width: 100%;\n max-height: 100%;\n }\n\n .gallery-image-wrapper.selected {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image-wrapper {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+d.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .add-to-cart-container .add-to-cart-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .add-to-cart-container .add-to-cart-button.disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .product-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-title.hide {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .main-product-price {\n display: inline-block;\n width: fit-content;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 30px;\n font-style: normal;\n font-weight: 600;\n line-height: 36px;\n }\n\n .product-presale-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n text-align: left;\n }\n\n .product-description {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-description > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .product-description .title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .product-description .content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n align-self: stretch;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .product-description .content.collapsed {\n /* Modern browsers with line-clamp support */\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n\n /* Fallback for older browsers */\n max-height: 4.5em; /* 3 lines * 1.5 line-height */\n line-height: 1.5;\n word-wrap: break-word;\n\n /* Additional fallback properties */\n text-overflow: ellipsis;\n white-space: normal;\n }\n\n /* Fallback for browsers without line-clamp support */\n @supports not (-webkit-line-clamp: 3) {\n .product-description .content.collapsed {\n display: block;\n max-height: 4.5em;\n overflow: hidden;\n position: relative;\n }\n\n .product-description .content.collapsed::after {\n content: '...';\n position: absolute;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, transparent, var(--default-background-color, white) 50%);\n padding-left: 20px;\n }\n }\n\n .product-description .collapse-button {\n border-radius: var(--button-border-radius, 6px);\n cursor: pointer;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+d.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n max-height: 418px;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+d.DRAWER_WRAPPER+";\n pointer-events: none;\n }\n\n .drawer-wrapper.open {\n pointer-events: auto;\n }\n\n /* Backdrop overlay */\n .drawer-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: "+d.DRAWER_BACKDROP+";\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n pointer-events: none;\n }\n\n .drawer-backdrop.visible {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n /* Main drawer */\n .drawer {\n position: absolute;\n top: 0;\n right: 0;\n width: 400px;\n height: 100vh; /* Fallback for browsers that don't support dvh */\n height: 100dvh;\n z-index: "+d.DRAWER_CONTENT+";\n background-color: #ffffff;\n overflow: hidden;\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n }\n\n /* Opened drawer state */\n .drawer.open {\n transform: translateX(0);\n }\n\n .drawer.address-input .drawer-content,\n .drawer.engraving-form .drawer-content,\n .drawer.product-retailers-popup-list .drawer-content {\n padding: 16px;\n }\n\n /* Content area - fills the remaining space */\n .drawer-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n background-color: var(--drawer-background-color, #FAFAFA);\n }\n\n /* Content swap animation classes */\n .drawer-content-fade-out {\n opacity: 1;\n transition: opacity 150ms ease-out;\n }\n\n .drawer-content-fade-out.fading {\n opacity: 0;\n }\n\n .drawer-content-fade-in {\n opacity: 0;\n transition: opacity 150ms ease-in;\n }\n\n .drawer-content-fade-in.visible {\n opacity: 1;\n }\n\n /* Mobile adjustments */\n @media (max-width: 576px) {\n .drawer {\n width: 100%;\n }\n }\n\n /* Accessibility - respect user's motion preferences */\n @media (prefers-reduced-motion: reduce) {\n .drawer,\n .drawer-backdrop,\n .drawer-content-fade-out,\n .drawer-content-fade-in {\n transition: none;\n }\n }\n "}const getProductLoadingStyles=()=>"\n .skeleton-container {\n min-width: 320px;\n width: 100%;\n height: auto;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n }\n\n .skeleton-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .skeleton-container .wave {\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .skeleton-container .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+d.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n .sc-main-image {\n width: 100%;\n height: 350px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n flex: 1;\n }\n\n .sc-carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background-color: #c4d1e0;\n margin-right: 10px;\n }\n\n .sc-carousel-dot:last-child {\n margin-right: 0;\n }\n\n .sc-gallery-thumbnail {\n width: 60px;\n height: 60px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-main-image::before { animation-delay: 1.5s; }\n .sc-carousel-dot::before { animation-delay: 1.6s; }\n .sc-gallery-thumbnail::before { animation-delay: 1.7s; }\n\n @media (min-width: 480px) {\n .sc-carousel-dot {\n width: 8px;\n height: 8px;\n margin-right: 8px;\n }\n }\n\n @media (min-width: 769px) {\n .sc-gallery-thumbnail {\n width: 80px;\n height: 80px;\n }\n\n .sc-main-image {\n height: 474px;\n }\n }\n\n @keyframes wave {\n 0% {\n left: -100%;\n }\n 100% {\n left: 100%;\n }\n }\n",getProductListCardLoadingStyles=()=>"\n .product-list-card-loading__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n pointer-events: none;\n background-color: transparent;\n border: none;\n border-radius: var(--card-border-radius, 0.375rem);\n overflow: hidden;\n cursor: default;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n }\n\n .slc__card .wave {\n background-color: #c4d1e0;\n position: relative;\n overflow: hidden;\n }\n\n .slc__card .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+d.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getModalStyles(){return"\n /* Modal dialog */\n .modal {\n position: fixed;\n border: none;\n padding: 0;\n margin: auto;\n background: transparent;\n max-width: 90vw;\n max-height: 90vh;\n z-index: "+d.MODAL+";\n overflow: visible;\n }\n\n .modal::backdrop {\n background-color: rgba(0, 0, 0, 0.5);\n backdrop-filter: blur(2px);\n animation: modal-backdrop-fade-in 150ms ease-out;\n }\n\n @keyframes modal-backdrop-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n /* Modal content */\n .modal-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow: hidden;\n background: var(--drawer-background-color, #FAFAFA);\n border-radius: var(--border-radius-rounded, 6px);\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n }\n\n /* Specific modal sizes based on content type */\n .modal.product-list-retailers {\n width: 512px;\n height: 576px;\n }\n "}function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const et={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",linkTextColor:"--link-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},it={backgroundColor:"--product-background-color"},ot={backgroundColor:"--cart-background-color"},rt={backgroundColor:"--address-background-color"},at={backgroundColor:"--checkout-background-color"},st={backgroundColor:"--product-list-background-color"},ct={global:et,product:it,cart:ot,address:rt,checkout:at,productList:st};function getCSSVariableMapping(t){return ct[t]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(t,n){const e={},i=getCSSVariableMapping(n);for(const[o,r]of Object.entries(i)){const n=this.getValueByPath(t,o);void 0!==n&&this.isCSSValue(n)&&(e[r]=n,this.isColorVariable(r,n)&&this.generateOpacityVariants(e,r,n))}return e}extractVariablesFromPartialTheme(t,n){const e={},i=getCSSVariableMapping(n);for(const[o,r]of Object.entries(i))if(this.hasValueAtPath(t,o)){const n=this.getValueByPath(t,o);void 0!==n&&this.isCSSValue(n)&&(e[r]=n,this.isColorVariable(r,n)&&this.generateOpacityVariants(e,r,n))}return e}generateCSSVariablesString(t){return Object.entries(t).map(([t,n])=>" "+t+": "+n+";").join("\n")}updateCSSVariablesInStylesheet(t,n){if(0!==Object.keys(n).length)try{const e=this.findOrCreateRule(t);for(const[t,i]of Object.entries(n))e.style.setProperty(t,String(i))}catch(e){this.logger.warn("Failed to update CSS variables")}}getValueByPath(t,n){return n.split(".").reduce((t,n)=>t&&void 0!==t[n]?t[n]:void 0,t)}hasValueAtPath(t,n){const e=n.split(".");let i=t;for(const o of e){if(null==i||!(o in i))return![];i=i[o]}return!![]}findOrCreateRule(t){const n=":host";for(const i of Array.from(t.cssRules))if(i instanceof CSSStyleRule&&i.selectorText===n)return i;const e=t.insertRule(n+" {}");return t.cssRules[e]}isCSSValue(t){if("string"==typeof t){if(""===t.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(t.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(t))return!![];if(/^[a-z-]+$/.test(t))return!![]}return"number"==typeof t}generateOpacityVariants(t,n,e){for(const i of this.opacityLevels){const o=n+"-"+i.suffix,r=this.addOpacityToHexColor(e,i.value);r&&(t[o]=r)}}isColorVariable(t,n){if("string"!=typeof n)return![];const e=t.toLowerCase().includes("color"),i=/^#[0-9a-f]{3,8}$/i.test(n);return e&&i}addOpacityToHexColor(t,n){if(!t.startsWith("#"))return null;let e=t.slice(1);if(3===e.length&&(e=e.split("").map(t=>t+t).join("")),6!==e.length)return null;const i=Math.round(255*n),o=i.toString(16).padStart(2,"0");return"#"+e+o}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,n){const e=this.cssProcessor.extractVariablesFromTheme(n,t),i=this.cssProcessor.generateCSSVariablesString(e),o=this.getStylesheetStyles(t).join("\n\n"),r=0===i.length?"":":host { "+i+" }",a=("\n "+r+"\n\n "+o+"\n ").trim();this.createStylesheet(t,a)}createStylesheet(t,n){try{if(this.isCSSStyleSheetSupported()){const e=new CSSStyleSheet;e.replaceSync(n),this.styleSheets.set(t,e)}else this.styleSheets.set(t,n)}catch(X){this.styleSheets.set(t,n)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}updateVariablesInStylesheet(t,n,e){const i=this.styleSheets.get(t);if(i&&"string"!=typeof i){const t=this.cssProcessor.extractVariablesFromPartialTheme(n,e);this.cssProcessor.updateCSSVariablesInStylesheet(i,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles(),getModalStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];case"product-list":return[getProductListStyles(),getProductRetailersStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme),this.stylesheetGenerator.generateSpecificStylesheet("product-list",this.data.productList.theme)}updateComponentGlobalConfigs(t){var n,e;const i=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=i,((null===(n=t.theme)||void 0===n?void 0:n.headingFont)||(null===(e=t.theme)||void 0===e?void 0:e.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}updateProductListComponent(t){this.data.productList=this.deepMerge(this.getConfigs("productList"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product-list",t.theme,"product-list")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==Z.indexOf(t)?this.getConfigs("product"):-1!==J.indexOf(t)?this.getConfigs("address"):-1!==$.indexOf(t)?this.getConfigs("cart"):-1!==tt.indexOf(t)?this.getConfigs("checkout"):-1!==nt.indexOf(t)?this.getConfigs("productList"):void 0}getStylesheet(t){const n=this.getBaseStylesheets();if(t===i.DRAWER||t===i.MODAL){const t=[...n],e=this.stylesheetGenerator.getStylesheet("product"),i=this.stylesheetGenerator.getStylesheet("cart"),o=this.stylesheetGenerator.getStylesheet("checkout"),r=this.stylesheetGenerator.getStylesheet("address"),a=this.stylesheetGenerator.getStylesheet("product-list");return e&&t.push(e),i&&t.push(i),o&&t.push(o),r&&t.push(r),a&&t.push(a),t}let e;if(J.includes(t)||t===i.ADDRESS)e="address";else if(Z.includes(t)||t===i.PRODUCT)e="product";else if($.includes(t)||t===i.CART)e="cart";else if(tt.includes(t)||t===i.CHECKOUT)e="checkout";else{if(!nt.includes(t)&&t!==i.PRODUCT_LIST)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),n;e="product-list"}const o=this.stylesheetGenerator.getStylesheet(e);return o?[...n,o]:n}getBaseStylesheets(){const t=[],n=this.stylesheetGenerator.getStylesheet("global"),e=this.stylesheetGenerator.getStylesheet("ui");return n&&t.push(n),e&&t.push(e),t}deepMerge(t,n){const e={...t};for(const i in n)null!==n[i]&&void 0!==n[i]&&("object"!=typeof n[i]||Array.isArray(n[i])||"object"!=typeof t[i]||Array.isArray(t[i])?e[i]=n[i]:e[i]=this.deepMerge(t[i],n[i]));return e}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.longitude&&t.coordinates.latitude)return{coordinates:t.coordinates,address:t.address}}}function centToDollar(t){return t/100}function formatCentToDollarText(t,n=!![]){const e=Math.floor(t/100),i=t%100;let o="$"+e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(n||i>0)&&(o+=".",o+=i<10?"0"+i:i.toString()),o}function htmlStringToElement(t){const n=document.createElement("template");return n.innerHTML=t.trim(),n.content.firstElementChild}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const n=new Date(t);if(Number.isNaN(n.getTime()))return"";const e=(n.getMonth()+1).toString().padStart(2,"0"),i=n.getDate().toString().padStart(2,"0"),o=n.getFullYear().toString();return e+"/"+i+"/"+o}catch(n){return""}}function capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const n=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:n[0]||"",category2:n[1]||"",category3:n[2]||""}}class CartCommands extends BaseCommand{constructor(){super(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,e){try{this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+e),new SDKError("Item not found");const r=o.quantity+e;if(r<1)return this.removeItem(t,!![]);const a=this.buildItemUpdate(o,r),s=await this.api.updateCart({id:i,items:[a],location:this.getLocation()});this.syncItemsFromApiResponse(s,[t]),this.updateFulfillment(o.fulfillmentId,s),this.syncRetailersFromApiResponse(s),this.syncCartMetaFromApiResponse(s),this.pubSub.publishAction(e<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{cartId:i,itemId:o.id,quantity:r,previousQuantity:o.quantity});const c=splitCategoryPath(o.catPath),l={item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_size:o.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,quantity:Math.abs(e),price:centToDollar(o.unitPrice||0),item_image:o.mainImage,upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId};e<0?this.googleTagManager.removeFromCart(l):e>0&&this.googleTagManager.addToCart(l)}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to update item quantity",i),i}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,e){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw new SDKError("Item not found");const r=this.buildItemUpdate(o,0),a=await this.api.updateCart({id:i,items:[r],location:this.getLocation()}),s={itemId:o.id,fulfillmentId:o.fulfillmentId,retailerId:o.retailerId};this.syncItemsFromApiResponse(a,[]),this.cleanupAfterItemRemoval(s,a),this.syncCartMetaFromApiResponse(a),this.pubSub.publishAction(n.CART_ITEM_REMOVED,{cartId:i,itemId:o.id});const c=splitCategoryPath(o.catPath);this.googleTagManager.removeFromCart({item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_size:o.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,quantity:o.quantity,price:centToDollar(o.unitPrice||0),item_image:o.mainImage,upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId})}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to remove item",i),i}}async updateItemEngraving(t,e){var i,o,r;try{const a=this.store.get("cart"),s=null===(i=a.items)||void 0===i?void 0:i[t];if(!s)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const c=this.getDetails(),l={id:s.id,fulfillmentId:s.fulfillmentId,partNumber:s.partNumber,quantity:s.quantity,engravingLines:e},d=await this.api.updateCart({id:a.id||"",items:[l],location:this.getLocation()});this.syncItemsFromApiResponse(d,[t]),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d);const h=this.getDetails();this.pubSub.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{cartId:h.cartId,itemId:s.id,engravingLines:e,previousEngravingLines:(null===(r=null===(o=s.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[]}),this.pubSub.publishAction(n.CART_UPDATED,{previous:c,current:h})}catch(a){throw this.store.set("cart.items."+t+".error",a.message),this.logger.error("Failed to update item engraving",a),a}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var e,i;try{this.store.set("cart.loading",!![]);const o=this.store.get("cart"),r=this.getDetails(),a=(null===(e=t.engravingLines)||void 0===e?void 0:e.filter(t=>""!==t.trim()))||[],s=a.length>0,c=Object.values(o.items||{}).find(n=>{var e,i,o,r,c;const l=n.fulfillmentId===t.fulfillmentId&&n.partNumber===t.partNumber;if(!l)return![];if(s){const t=(null===(i=null===(e=n.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.lines)||[];return a.join(",")===t.join(",")}return!(null===(c=null===(r=null===(o=n.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===c?void 0:c.length)}),l={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:c?t.quantity+c.quantity:t.quantity};s&&(l.engravingLines=a);const d=await this.api.updateCart({id:o.id||"",items:[l],location:this.getLocation()}),h=null===(i=Object.values(d.items))||void 0===i?void 0:i.find(t=>t.fulfillmentId===l.fulfillmentId&&t.partNumber===l.partNumber);if(!h)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(d,[]);const p=this.store.get("cart.fulfillments."+t.fulfillmentId);p?this.updateFulfillment(t.fulfillmentId,d):this.addNewFulfillmentAndRetailer(t.fulfillmentId,d),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d);const m=this.getDetails();this.pubSub.publishAction(n.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(n.CART_ITEM_ADDED,{cartId:m.cartId,itemId:h.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(n.CART_UPDATED,{previous:r,current:m});const f=splitCategoryPath(h.catPath);this.googleTagManager.addToCart({item_id:h.liquidId,item_name:h.name,item_brand:h.brand,item_size:h.size,item_category:f.category,item_category2:f.category2,item_category3:f.category3,quantity:h.quantity,price:centToDollar(h.unitPrice||0),item_image:h.mainImage,upc:h.upc,grouping_id:h.salsifyGrouping,product_id:h.liquidId})}catch(o){this.store.set("cart.error",o.message),this.logger.error("Failed to add item to cart",o)}finally{this.store.set("cart.loading",![])}}async handleGoToCheckout(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=this.clientConfig.get("checkout");if(e){this.trackBeginCheckout(t);const n=await this.api.prepareCheckout({cartId:t.id||""}),i=this.resolveCheckoutRedirectUrl(e.pageUrl,n.token);return window.location.assign(i),void 0}this.pubSub.publishAction(n.INTERNAL_CART_TO_CHECKOUT,{}),this.trackBeginCheckout(t)}catch(t){throw this.store.set("cart.error",t.message),this.logger.error("Failed to proceed to checkout",t),t}finally{this.store.set("cart.loading",![])}}trackBeginCheckout(t){var n;const e=(null===(n=t.promoCode)||void 0===n?void 0:n.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(t.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],e)}resolveCheckoutRedirectUrl(t,n){return t.includes("{id}")?n?t.split("{id}").join(encodeURIComponent(n)):(this.logger.warn('Checkout redirect URL contains "{id}" placeholder but no checkout token was found. Removing placeholder.'),t.split("{id}").join("")):t}async applyPromoCode(t){var e,i,o,r,a;if(!(null==t?void 0:t.trim()))throw new SDKError("Promo code is required");const s=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(s);const c=await this.api.updateCart({id:t,items:[],promoCode:s,location:this.getLocation()});this.store.batch({"cart.subtotal":c.subtotal,"cart.itemsQuantity":c.itemsQuantity,"cart.events":c.events});const l=(null===(i=null===(e=c.promoCode)||void 0===e?void 0:e.code)||void 0===i?void 0:i.toLowerCase())===s.toLowerCase();l?(this.store.set("cart.promoCode",{code:s,discount:(null===(o=c.promoCode)||void 0===o?void 0:o.discount)||0}),this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{cartId:t,discount:(null===(r=c.promoCode)||void 0===r?void 0:r.discount)||0,newSubtotal:c.subtotal||0}),this.googleTagManager.promoCodeApplied(s,(null===(a=c.promoCode)||void 0===a?void 0:a.discount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code does not exist"}),this.googleTagManager.promoCodeFailed(s,'Code "'+s+'" does not exist'))}catch(c){const t=(null==c?void 0:c.message)||"Failed to apply promo code. Please try again.";this.store.set("cart.error",t);const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:e,error:t}),this.googleTagManager.promoCodeFailed(s,t),this.logger.error("Failed to apply promo code",c),c}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.promoCode":null}),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{cartId:t,newSubtotal:e.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const e=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",e);const i=this.store.get("cart.promoCode"),o=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:o,error:e}),(null==i?void 0:i.code)&&this.googleTagManager.promoCodeFailed(i.code,e),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){try{this.store.set("cart",{...f,rerender:!![]}),this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartState(e,!![]),e.id!==t.id&&await this.store.persist(),this.pubSub.publishAction(n.CART_RESET,!![])}catch(t){const e=(null==t?void 0:t.message)||"Failed to reset cart";this.store.set("cart.error",e);const i=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_FAILED,{cartId:i,message:e}),this.logger.error("Reset cart failed",t),t}finally{this.store.set("cart.loading",![])}}getDetails(){var t;const n=this.store.get("cart"),e=this.store.get("address"),i={};for(const o in n.items||{}){const t=n.items[o];i[o]={id:t.id,variantId:t.variantId,liquidId:t.liquidId,salsifyGrouping:t.salsifyGrouping,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price,quantity:t.quantity,maxQuantity:t.maxQuantity,unitPrice:t.unitPrice,mainImage:t.mainImage,attributes:t.attributes}}return{cartId:n.id||"",promoCodeDiscount:(null===(t=n.promoCode)||void 0===t?void 0:t.discount)||null,subtotal:n.subtotal,itemCount:n.itemsQuantity,items:i,retailers:n.retailers||{},location:e.id?{placesId:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates}:null}}buildItemUpdate(t,n){var e,i,o;const r={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:n},a=(null===(o=null===(i=null===(e=t.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.lines)||void 0===o?void 0:o.filter(t=>""!==t.trim()))||[];return a.length>0&&(r.engravingLines=a),r}syncItemsFromApiResponse(t,n=[]){const e=this.store.get("cart.items")||{},i=new Set(Object.keys(t.items));for(const r of Object.keys(e))i.has(r)||this.store.remove("cart.items."+r);const o={};for(const r of Object.values(t.items))0!==n.length&&!n.includes(r.id)&&e[r.id]||(o["cart.items."+r.id]=r);Object.keys(o).length>0&&this.store.batch(o)}syncCartMetaFromApiResponse(t){var n,e;const i={"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.error":null,"cart.events":t.events},o=null===(n=null==t?void 0:t.promoCode)||void 0===n?void 0:n.code;if(o)i["cart.promoCode"]={code:o.toUpperCase(),discount:(null===(e=t.promoCode)||void 0===e?void 0:e.discount)||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(i["cart.promoCode"]=null)}this.store.batch(i)}syncRetailersFromApiResponse(t){var n,e;const i=this.store.get("cart.retailers")||{},o=this.store.get("cart.fulfillments")||{},r=new Set(Object.keys(t.retailers)),a=new Set;for(const s of Object.values(t.retailers))if(s.fulfillments)for(const t of Object.keys(s.fulfillments))a.add(t);for(const s of Object.keys(i))r.has(s)||this.store.remove("cart.retailers."+s);for(const s of Object.keys(o))a.has(s)||this.store.remove("cart.fulfillments."+s);if((null===(n=Object.values(t.retailers))||void 0===n?void 0:n.length)>0){const n={};for(const i of Object.values(t.retailers))if(n["cart.retailers."+i.id]=i,(null===(e=Object.values(i.fulfillments))||void 0===e?void 0:e.length)>0)for(const t of Object.values(i.fulfillments))n["cart.fulfillments."+t.id]=t;this.store.batch(n)}}updateFulfillment(t,n){var e;const i=null===(e=Object.values(n.retailers))||void 0===e?void 0:e.find(n=>{var e;return null===(e=Object.keys(n.fulfillments))||void 0===e?void 0:e.some(n=>n===t)}),o=null==i?void 0:i.fulfillments[t];o&&i&&this.store.set("cart.fulfillments."+t,o)}addNewFulfillmentAndRetailer(t,n){var e;const i=null===(e=Object.values(n.retailers))||void 0===e?void 0:e.find(n=>{var e;return null===(e=Object.keys(n.fulfillments))||void 0===e?void 0:e.some(n=>n===t)}),o=null==i?void 0:i.fulfillments[t];if(o&&i){const n={["cart.fulfillments."+t]:o,["cart.retailers."+i.id]:i};this.store.batch(n)}}cleanupAfterItemRemoval(t,n){var e,i;const o=null===(e=Object.values(n.retailers))||void 0===e?void 0:e.some(n=>{var e;return null===(e=Object.keys(n.fulfillments))||void 0===e?void 0:e.some(n=>n===t.fulfillmentId)}),r=null===(i=Object.keys(n.retailers))||void 0===i?void 0:i.some(n=>n===t.retailerId);if(o){this.updateFulfillment(t.fulfillmentId,n);const e=n.retailers[t.retailerId];e&&this.store.set("cart.retailers."+t.retailerId,e)}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),r){const e=n.retailers[t.retailerId];e&&this.store.set("cart.retailers."+t.retailerId,e)}else this.store.remove("cart.retailers."+t.retailerId)}syncCartState(t,e=![]){var i,o,r,a,s;const c=this.store.get("cart");for(const n of Object.keys(c.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(c.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(c.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const l={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(i=t.promoCode)||void 0===i?void 0:i.code)?{...t.promoCode,error:null}:null};if((null===(o=Object.values(t.items))||void 0===o?void 0:o.length)>0)for(const n of Object.values(t.items))l["cart.items."+n.id]=n;if((null===(r=Object.values(t.retailers))||void 0===r?void 0:r.length)>0)for(const n of Object.values(t.retailers))if(l["cart.retailers."+n.id]=n,(null===(a=Object.values(n.fulfillments))||void 0===a?void 0:a.length)>0)for(const t of Object.values(n.fulfillments))l["cart.fulfillments."+t.id]=t;if((null===(s=t.events)||void 0===s?void 0:s.length)>0&&(l["cart.events"]=t.events),this.store.batch(l),e){const t=this.store.get("cart"),e=this.buildCartLoadedEventData(t);this.pubSub.publishAction(n.CART_LOADED,e)}}buildCartLoadedEventData(t){var n,e;const i=this.store.get("address"),o={};for(const r of Object.keys(t.items||{})){const n=t.items[r];o[r]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,salsifyGrouping:n.salsifyGrouping,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price,quantity:n.quantity,maxQuantity:n.maxQuantity,unitPrice:n.unitPrice,mainImage:n.mainImage,attributes:n.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(e=null===(n=t.promoCode)||void 0===n?void 0:n.discount)&&void 0!==e?e:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:o,retailers:t.retailers||{},location:(null==i?void 0:i.id)&&i.coordinates&&i.address?{placesId:i.id,formattedAddress:i.formattedAddress,address:i.address,coordinates:i.coordinates}:null}}}function componentError({componentType:t,message:n}){const e=document.createElement("div");e.className=t;const i=e.attachShadow({mode:"closed"}),o=document.createElement("style");o.textContent='\n div {\n padding: 10px;\n background-color: #f0f4f8;\n border-radius: 6px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: #d63031;\n line-height: 1.4;\n margin-bottom: 5px;\n }\n\n p {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n color: #18181B;\n line-height: 1.5;\n max-width: 350px;\n }\n ';const r=document.createElement("div"),a=document.createElement("h3");a.textContent="Component </"+t+">";const s=document.createElement("p");return s.textContent=n,r.appendChild(o),r.appendChild(a),r.appendChild(s),i.appendChild(r),e}function productionComponentError({title:t,message:n,componentType:e}){const i=document.createElement("div");i.setAttribute("data-component-type",e);const o=i.attachShadow({mode:"closed"}),r=document.createElement("style");r.textContent="\n div {\n padding: 20px;\n background-color: #f0f4f8;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: Poppins, sans-serif;\n max-width: 512px;\n display: block;\n }\n\n h2 {\n color: #18181B;\n margin: 0 0 8px 0;\n font-size: 18px;\n font-style: normal;\n font-weight: 600;\n line-height: 18px;\n text-transform: lowercase;\n }\n\n h2::first-letter {\n text-transform: uppercase;\n }\n\n p {\n color: #18181B;\n font-size: 14px;\n font-style: italic;\n font-weight: 400;\n line-height: 20px;\n margin: 0;\n }\n ";const a=document.createElement("div"),s=document.createElement("h2");s.textContent=t;const c=document.createElement("p");return c.textContent=n,a.appendChild(r),a.appendChild(s),a.appendChild(c),o.appendChild(a),i}class ComponentFactoryService{static get logger(){return ComponentFactoryService.i||(ComponentFactoryService.i=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.i}static get clientConfig(){return ComponentFactoryService.o||(ComponentFactoryService.o=ClientConfigService.getInstance()),ComponentFactoryService.o}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(t,n){ComponentFactoryService.getComponentRegistry().set(t,n)}static createElement(t){try{const n=ComponentFactoryService.getComponentRegistry().get(t.type);if(!n)throw new SDKError("Component type ["+t.type+"] is not registered");const e=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(e)||window.customElements.define(e,n);const o=document.createElement(e);if(o.initialize){const{type:n,useShadowDom:i,wrapInLceElement:r,...a}=t,s={type:n,tagName:e,useShadowDom:i&&r!==!![]};o.initialize({data:a,config:s})}if(t.wrapInLceElement){const n=ComponentFactoryService.getComponentRegistry().get(i.LCE_ELEMENT),e=ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT);window.customElements.get(e)||window.customElements.define(e,n);const r=document.createElement(e);return r.initialize(t.type,o),r}return o}catch(n){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",n),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t.type}):componentError({componentType:t.type,message:(null==n?void 0:n.message)||n})}}static componentError({componentType:t,message:n}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+n),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t}):componentError({componentType:t,message:n})}static getComponentTagName(t){const n={[i.DRAWER]:"drawer-lc",[i.INPUT]:"input-lc",[i.ENGRAVING_FORM]:"engraving-form-lc",[i.ENGRAVING_VIEW]:"engraving-view-lc",[i.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[i.POWERED_BY]:"powered-by-lc",[i.LCE_ELEMENT]:"lce-element",[i.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[i.ALERT]:"alert-lc",[i.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[i.MODAL]:"modal-lc",[i.ADDRESS]:"address-lc",[i.ADDRESS_INPUT]:"address-input-lc",[i.ADDRESS_DISPLAY]:"address-display-lc",[i.PRODUCT]:"product-lc",[i.PRODUCT_OPTIONS]:"product-options-lc",[i.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[i.PRODUCT_INTERACTIONS]:"product-interactions-lc",[i.PRODUCT_DESCRIPTION]:"product-description-lc",[i.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[i.PRODUCT_RETAILERS]:"product-retailers-lc",[i.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[i.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[i.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[i.PRODUCT_PRICE]:"product-price-lc",[i.PRODUCT_DRAWER]:"product-drawer-lc",[i.PRODUCT_LOADING]:"product-loading-lc",[i.PRODUCT_LIST]:"product-list-lc",[i.PRODUCT_LIST_CARD]:"product-list-card-lc",[i.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[i.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[i.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[i.PRODUCT_LIST_RETAILERS]:"product-list-retailers-lc",[i.CART]:"cart-lc",[i.CART_RETAILER]:"cart-retailer-lc",[i.CART_ITEM]:"cart-item-lc",[i.CART_FOOTER]:"cart-footer-lc",[i.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[i.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[i.CART_PROMO_CODE]:"cart-promo-code-lc",[i.CART_HEADER]:"cart-header-lc",[i.CART_BODY]:"cart-body-lc",[i.CART_FULFILLMENT]:"cart-fulfillment-lc",[i.CHECKOUT]:"checkout-lc",[i.CHECKOUT_INFORMATION]:"checkout-information-lc",[i.CHECKOUT_PAYMENT]:"checkout-payment-lc",[i.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[i.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[i.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[i.CHECKOUT_BILLING]:"checkout-billing-lc",[i.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[i.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[i.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[i.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[i.CHECKOUT_ITEMS]:"checkout-items-lc",[i.CHECKOUT_COMPLETED]:"checkout-completed-lc",[i.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[i.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[i.CHECKOUT_BUYER]:"checkout-buyer-lc",[i.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[i.CHECKOUT_TIPS]:"checkout-tips-lc",[i.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[i.CHECKOUT_ITEM]:"checkout-item-lc",[i.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[i.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[i.CHECKOUT_HEADER]:"checkout-header-lc",[i.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[i.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[i.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return n[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.i=null,ComponentFactoryService.o=null,ComponentFactoryService.componentRegistry=null;class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,e){const o={type:t,data:e||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:o}),t===i.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),t===i.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===i.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==t?void 0:t.type)===i.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}openModal(t,n){const e={type:t,data:n||{}};this.store.set("ui.modal",{isOpen:!![],contentConfig:e})}closeModal(){this.store.set("ui.modal.isOpen",![]),this.store.set("ui.modal.contentConfig",null)}}function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...t){for(;this.firstChild;)this.removeChild(this.firstChild);for(const n of t)"string"==typeof n?this.appendChild(document.createTextNode(n)):this.appendChild(n)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const n=document.createDocumentFragment();for(const e of t)"string"==typeof e?n.appendChild(document.createTextNode(e)):n.appendChild(e);this.insertBefore(n,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const n=this.parentNode;if(!n)return;const e=document.createDocumentFragment();for(const i of t)"string"==typeof i?e.appendChild(document.createTextNode(i)):e.appendChild(i);n.replaceChild(e,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const n=this.parentNode;if(!n)return;const e=document.createDocumentFragment();for(const i of t)"string"==typeof i?e.appendChild(document.createTextNode(i)):e.appendChild(i);n.insertBefore(e,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const n=this.parentNode;if(!n)return;const e=document.createDocumentFragment();for(const i of t)"string"==typeof i?e.appendChild(document.createTextNode(i)):e.appendChild(i);n.insertBefore(e,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const n={};for(const[e,i]of t)n[e]=i;return n})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(X){console.warn("DOM polyfills initialization failed:",X)}}function safeReplaceChildren(t,...n){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...n);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const e of n)"string"==typeof e?t.appendChild(document.createTextNode(e)):t.appendChild(e)}}catch(e){console.error("replaceChildren operation failed:",e),1===n.length&&"string"==typeof n[0]&&(t.innerHTML=n[0])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),window.addEventListener("lce:actions."+n.INTERNAL_CART_TO_CHECKOUT,async()=>{this.store.set("metadata.checkout",x.checkout),await this.loadCheckout({}),this.uiCommands.openDrawer(i.CHECKOUT)}),window.addEventListener("lce:actions."+n.CART_RESET,()=>{this.store.set("checkout",{...g,rerender:!![]})})}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async addPresaleItem(t){try{const n={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines},e=await this.api.updateCart({id:"",items:[n],location:this.getLocation()});await this.loadCheckout({cartId:e.id,isForPresale:!![]})}catch(n){throw this.store.set("checkout.error",n.message),this.logger.error("Failed to add presale item to checkout",n),n}}async loadCheckout(t){try{this.store.set("checkout.loading",!![]);const e=void 0!==t.cartId?t.cartId:this.store.get("cart.id");if(!t.checkoutId&&!e)return this.store.set("checkout.error","Checkout token or Cart ID is required"),void 0;const i=this.themeProvider.getConfigs("checkout"),o=await this.api.prepareCheckout({token:t.checkoutId||void 0,cartId:t.checkoutId?void 0:e,marketingPreferences:{canEmail:i.layout.emailOptIn.checked,canSms:i.layout.smsOptIn.checked}});if(t.isForPresale===!![]&&0===o.itemsQuantity)return this.showPresaleExpired("items_unavailable"),void 0;const r={"checkout.cartId":o.cartId,"checkout.isGift":o.isGift,"checkout.marketingPreferences":o.marketingPreferences,"checkout.customerForm":g.customerForm,"checkout.giftRecipientForm":g.giftRecipientForm,"checkout.paymentForm":g.paymentForm,"checkout.paymentForm.billingSameAsShipping":o.billingSameAsShipping,"checkout.shippingAddress":o.shippingAddress,"checkout.presale":o.presale,"checkout.giftRecipientForm.data":o.giftOptions,"checkout.updating":![],"checkout.itemsQuantity":o.itemsQuantity};this.store.batch(r),this.syncCheckoutState(o),this.pubSub.publishAction(n.CHECKOUT_LOADED,this.getDetails())}catch(e){this.store.set("checkout.error",e.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:e.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const e=this.store.get("checkout.isGift"),i=null!=t?t:!e,o={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":i,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":o});const r=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{cartId:r,isActive:i,previousIsActive:e})}async toggleBillingSameAsShipping(t){const e=this.store.get("checkout.paymentForm.billingSameAsShipping"),i=null!=t?t:!e;this.store.set("checkout.paymentForm.billingSameAsShipping",i);const o=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{cartId:o,isActive:i,previousIsActive:e})}async toggleMarketingPreferences(t,e){const i=this.store.get("checkout.marketingPreferences."+t),o=null!=e?e:!i,r=this.store.get("checkout.marketingPreferences"),a=this.dataForCheckoutPrepare({marketingPreferences:{...r,[t]:o}}),s=await this.api.prepareCheckout(a);this.store.set("checkout.marketingPreferences",s.marketingPreferences);const c=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{cartId:c,fieldName:t,isActive:o,previousIsActive:i})}async getPaymentSession(){try{const t=this.store.get("cart.id"),n=await this.api.getPaymentSession(t);this.store.batch({"checkout.paymentForm.paymentSession":n,"checkout.paymentForm.paymentMethod":null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,n){try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"35"}};const e=await this.api.confirmPaymentSession({confirmationTokenId:t,setupIntentId:n});return{id:e.id,card:{brand:e.card.brand,last4:e.card.last4,expMonth:e.card.expMonth,expYear:e.card.expYear}}}catch(e){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){try{this.googleTagManager.promoCodeAttempt(t);const e=this.dataForCheckoutPrepare({}),i=await this.api.prepareCheckout({...e,promoCode:t}),o=0!==i.amounts.discounts,r=i.events.some(t=>t.type===a.PROMO_CODE)?i.events[0]:null;if(!o){this.store.set("checkout.promoCodeError",r?r.message:'Code "'+t+'" does not exist');const e=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:e,error:(null==r?void 0:r.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==r?void 0:r.message)||"not_applied"),void 0}const s=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:s,discount:i.amounts.discounts,newTotal:i.amounts.total}),this.googleTagManager.promoCodeApplied(t,i.amounts.discounts),await this.refreshCheckout({response:i})}catch(e){const i=(null==e?void 0:e.message)||"Failed to apply promo code. Please try again.";this.store.set("checkout.error",i);const o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:i}),this.googleTagManager.promoCodeFailed(t,i),e}}async removePromoCode(){var t,e;try{const i=this.dataForCheckoutPrepare({}),o=(null===(e=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===e?void 0:e.code)||"",r=await this.api.prepareCheckout({...i,promoCode:""});if(0!==r.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;const a=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:a,newTotal:r.amounts.total}),this.googleTagManager.promoCodeApplied(o,0),await this.refreshCheckout({response:r})}catch(i){const t=(null==i?void 0:i.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.promoCode.code")||"",o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:t}),e&&this.googleTagManager.promoCodeFailed(e,t),i}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(X){const n=X.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",n),X}}async applyGiftCard(t){const e=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(e);const t=this.dataForCheckoutPrepare({}),i=t.giftCards||[],o=await this.api.prepareCheckout({...t,giftCards:[...i,e]}),r=o.events.some(t=>t.type===a.GIFT_CARD&&t.level===s.ERROR)?o.events[0]:null;r&&this.store.set("checkout.giftCardError",r.message);const c=o.giftCards.find(t=>t.code.toLowerCase()===e.toLowerCase());if(!c){this.store.set("checkout.giftCardError","Gift card could not be applied");const t=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t,error:(null==r?void 0:r.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(e,(null==r?void 0:r.message)||"not_applied"),void 0}const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:l,newTotal:o.amounts.total}),this.googleTagManager.giftCardApplied(e,c.applied),await this.refreshCheckout({response:o})}catch(i){const t=(null==i?void 0:i.message)||"Failed to apply gift card. Please try again.";this.store.set("checkout.error",t);const o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:o,error:t}),this.googleTagManager.giftCardFailed(e,t),i}}async removeGiftCard(t){var e;const i=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),o=(null===(e=t.giftCards)||void 0===e?void 0:e.filter(t=>t.toLowerCase()!==i.toLowerCase()))||[],r=await this.api.prepareCheckout({...t,giftCards:o}),a=r.giftCards.find(t=>t.code.toLowerCase()===i.toLowerCase());if(a)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+i),void 0;const s=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:s,newTotal:r.amounts.total}),this.googleTagManager.giftCardApplied(i,0),await this.refreshCheckout({response:r})}catch(o){const t=(null==o?void 0:o.message)||"Failed to remove gift card. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:e,error:t}),this.googleTagManager.giftCardFailed(i,t),o}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(X){throw this.store.set("checkout.error",(null==X?void 0:X.message)||"Failed to clear gift card error. Please try again."),X}}showPresaleExpired(t="time_expired"){this.store.set("checkout",{...g,rerender:![]});const n=this.store.get("metadata.checkout.injection");if(null==n?void 0:n.containerId){const e=document.getElementById(n.containerId);if(e){const n=ComponentFactoryService.createElement({type:i.CHECKOUT_PRESALE_EXPIRED,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],reason:t});safeReplaceChildren(e,n)}return}this.uiCommands.openDrawer(i.CHECKOUT_PRESALE_EXPIRED,{reason:t})}openCheckout(){const t=this.clientConfig.get("checkout");if(null==t?void 0:t.pageUrl){this.store.set("metadata.checkout.returnUrl",window.location.href);const n=this.store.get("checkout.token")||"",e=this.resolveCheckoutPageUrl(t.pageUrl,n);return window.location.assign(e),void 0}this.uiCommands.openDrawer(i.CHECKOUT)}getReturnUrl(){return this.store.get("metadata.checkout.returnUrl")}resolveCheckoutPageUrl(t,n){return t.includes("{id}")?n?t.split("{id}").join(encodeURIComponent(n)):(this.logger.warn('Checkout page URL contains "{id}" placeholder but no checkout token was found. Removing placeholder.'),t.split("{id}").join("")):t}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,e){var i,o,r;try{this.store.set("checkout.items."+t+".updating",!![]);const a=this.store.get("checkout.cartId"),s=this.store.get("checkout.items."+t);if(!s)throw new SDKError("Item not found");const c=s.quantity,l=s.quantity+e;if(l<1)return this.removeItem(t,!![]);const d={id:s.cartItemId,fulfillmentId:s.fulfillmentId,partNumber:s.partNumber,quantity:l},h=(null===(r=null===(o=null===(i=s.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(t=>""!==t.trim()))||[];h.length>0&&(d.engravingLines=h);const p=await this.api.updateCheckoutItems({cartId:a,items:[d],location:this.getLocation()});this.syncFromItemUpdate(p.cart,p.checkout),this.pubSub.publishAction(e>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartId:a,cartItemId:s.cartItemId,quantity:l,previousQuantity:c});const m=splitCategoryPath(s.catPath),f={item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:m.category,item_category2:m.category2,item_category3:m.category3,quantity:Math.abs(e),price:centToDollar(s.unitPrice||0),item_image:s.mainImage,upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId};e<0?this.googleTagManager.removeFromCart(f):e>0&&this.googleTagManager.addToCart(f)}catch(a){throw this.store.set("checkout.items."+t+".error",a.message),a}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var e,i,o;try{const r=this.store.get("checkout.items."+t);if(!r)throw new SDKError("Item not found in checkout");if(!(null===(e=r.attributes)||void 0===e?void 0:e.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const a=(null===(o=null===(i=r.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],s={id:r.cartItemId,fulfillmentId:r.fulfillmentId,partNumber:r.partNumber,quantity:r.quantity,engravingLines:[]},c=this.store.get("checkout.cartId"),l=await this.api.updateCheckoutItems({cartId:c,items:[s],location:this.getLocation()});this.syncFromItemUpdate(l.cart,l.checkout),this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartId:c,cartItemId:r.cartItemId,engravingLines:[],previousEngravingLines:a})}catch(r){throw this.store.set("checkout.items."+t+".error",r.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:r}),r}}async removeItem(t,e){var i,o,r;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("checkout.items."+t+".updating",!![]);const a=this.store.get("checkout.cartId"),s=this.store.get("checkout.items."+t);if(!s)throw new SDKError("Item not found");const c={id:s.cartItemId,fulfillmentId:s.fulfillmentId,partNumber:s.partNumber,quantity:0},l=(null===(r=null===(o=null===(i=s.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(t=>""!==t.trim()))||[];l.length>0&&(c.engravingLines=l);const d=await this.api.updateCheckoutItems({cartId:a,items:[c],location:this.getLocation()});this.syncFromItemUpdate(d.cart,d.checkout),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartId:a,cartItemId:s.cartItemId})}catch(a){throw this.store.set("checkout.items."+t+".error",a.message),a}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const e=this.store.get("checkout.fulfillments"),i=Object.values(e||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),r=Object.values(e||{}).filter(t=>t.type===o.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:Math.round(n.amounts.subtotal*t/100)})),a=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(a);const s=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:s,deliveryTips:r,previousDeliveryTips:i})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to update tips. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,e){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.fulfillments"),r=Object.values(i||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),a=Object.values(i||{}).filter(t=>t.type===o.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:n.id===t?e:n.amounts.tip})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:a}));this.updateStoreFromCheckoutResponse(s);const c=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:c,deliveryTips:a,previousDeliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const e=this.store.get("checkout.fulfillments"),i=Object.values(e||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),r=Object.values(e||{}).filter(t=>t.type===o.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:n.id===t?0:n.amounts.tip})),a=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(a);const s=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:s,deliveryTips:r,previousDeliveryTips:i})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to remove fulfillment tip. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:t,deliveryInstructions:e,customerData:i}){var o;try{this.store.set("checkout.customerForm.isSaving",!![]);const r=this.store.get("checkout.customerForm.data"),a=this.store.get("checkout.isGift"),s=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,customer:{...r,...i},isGift:a}),c=await this.api.prepareCheckout(s);this.store.batch({"checkout.customerForm.data":c.customer,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddress":c.shippingAddress,"checkout.deliveryInstructions":e});const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{cartId:l});const d=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(d.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(o=d.promoCode)||void 0===o?void 0:o.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:e,...i}){var o;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const r=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,isGift:!![],giftRecipient:i}),a=await this.api.prepareCheckout(r);this.store.batch({"checkout.giftRecipientForm.data":a.giftOptions,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddress":a.shippingAddress,"checkout.deliveryInstructions":e});const s=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,{cartId:s});const c=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(c.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(o=c.promoCode)||void 0===o?void 0:o.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:t,paymentSession:e}){var i,o,r;try{this.store.set("checkout.paymentForm.isSaving",!![]);const a=this.store.get("checkout"),s={},c=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let l=null,d=null;if(c||e){const t=await this.confirmPaymentSession((null==e?void 0:e.confirmationTokenId)||"",(null==e?void 0:e.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");l=t.card,d=t.id}const h=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:d||void 0}),p=await this.api.prepareCheckout(h);if(p.payment&&l&&(s["checkout.paymentForm.paymentMethod"]={id:p.payment,card:l}),t&&p.billingAddress){s["checkout.paymentForm.data"]={firstName:p.billingAddress.firstName||"",lastName:p.billingAddress.lastName||"",email:p.billingAddress.email||"",phone:p.billingAddress.phone||"",company:p.billingAddress.company||"",addressOne:p.billingAddress.one||"",addressTwo:p.billingAddress.two||"",city:p.billingAddress.city||"",state:p.billingAddress.state||"",zipCode:p.billingAddress.zip||""};const t=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,{cartId:t})}s["checkout.paymentForm.isEditing"]=![],s["checkout.paymentForm.isValid"]=!![],this.store.batch(s);const m=s["checkout.paymentForm.paymentMethod"]||(null===(i=a.paymentForm)||void 0===i?void 0:i.paymentMethod),f=(null===(o=null==m?void 0:m.card)||void 0===o?void 0:o.brand)?m.card.brand+" ****"+m.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(a.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}}),f,(null===(r=a.promoCode)||void 0===r?void 0:r.code)||void 0)}catch(a){throw this.logger.error("Failed to save payment form",a),this.store.set("checkout.error",a.message),a}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var t,e,o,r,a,s;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const c=this.store.get("checkout"),{orderNumber:l}=await this.api.checkoutComplete(c.token);c.presale||this.store.set("cart.shouldReset",!![]);const d={orderNumber:l,orderTotal:c.amounts.total,cardLast4:(null===(o=null===(e=null===(t=null==c?void 0:c.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===e?void 0:e.card)||void 0===o?void 0:o.last4)||"",customerEmail:c.customerForm.data.email,giftRecipientEmail:(null===(a=null===(r=null==c?void 0:c.giftRecipientForm)||void 0===r?void 0:r.data)||void 0===a?void 0:a.email)||null},h=this.store.get("metadata.checkout.injection");if(null==h?void 0:h.containerId){const t=document.getElementById(h.containerId);if(t){const n=ComponentFactoryService.createElement({type:i.CHECKOUT_COMPLETED,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...d});safeReplaceChildren(t,n)}}else this.uiCommands.openDrawer(i.CHECKOUT_COMPLETED,d);this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:l,orderTotal:c.amounts.total}),this.googleTagManager.purchase({transaction_id:l,tax:centToDollar(c.amounts.tax+c.amounts.service+c.amounts.platform),shipping:centToDollar(c.amounts.shipping||0),coupon:(null===(s=c.promoCode)||void 0===s?void 0:s.code)||void 0,items:[...Object.values(c.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(c.amounts.total),subtotal:centToDollar(c.amounts.subtotal),total_before_discounts:centToDollar(c.amounts.subtotal+c.amounts.tax+c.amounts.service+c.amounts.platform+c.amounts.shipping+c.amounts.delivery),discounts:centToDollar(c.amounts.discounts),gift_cards:centToDollar(c.amounts.giftCards||0),net_total:centToDollar(c.amounts.total)})}catch(c){const t=(null==c?void 0:c.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(t){const n={"checkout.amounts":t.amounts,"checkout.events":t.events,"checkout.error":null};if(t.retailers&&Object.values(t.retailers).length>0)for(const e of Object.values(t.retailers))for(const t of Object.values(e.fulfillments))n["checkout.fulfillments."+t.id]=t;this.store.batch(n)}syncFromItemUpdate(t,n){var e,i,o,r,a;try{this.store.set("checkout.updating",!![]);const s=this.store.get("cart");for(const t of Object.keys(s.items||{}))this.store.remove("cart.items."+t);for(const t of Object.keys(s.retailers||{}))this.store.remove("cart.retailers."+t);for(const t of Object.keys(s.fulfillments||{}))this.store.remove("cart.fulfillments."+t);const c={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":t.events||[],"cart.promoCode":(null===(e=t.promoCode)||void 0===e?void 0:e.code)?{...t.promoCode,error:null}:null};if((null===(i=Object.values(t.items))||void 0===i?void 0:i.length)>0)for(const n of Object.values(t.items))c["cart.items."+n.id]=n;if((null===(o=Object.values(t.retailers))||void 0===o?void 0:o.length)>0)for(const n of Object.values(t.retailers))if(c["cart.retailers."+n.id]=n,(null===(r=Object.values(n.fulfillments))||void 0===r?void 0:r.length)>0)for(const t of Object.values(n.fulfillments))c["cart.fulfillments."+t.id]=t;this.store.batch(c);const l={"checkout.token":n.token,"checkout.events":n.events,"checkout.amounts":n.amounts,"checkout.shippingAddress":n.shippingAddress,"checkout.itemsQuantity":n.itemsQuantity,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":n.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(a=null==n?void 0:n.promoCode)||void 0===a?void 0:a.code)?null==n?void 0:n.promoCode:null};if(Object.values(n.items).length>0){this.store.remove("checkout.items");for(const t of Object.values(n.items))l["checkout.items."+t.cartItemId]={...t,loading:![],updating:![],error:null}}if(n.retailers&&Object.values(n.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const t of Object.values(n.retailers)){l["checkout.retailers."+t.id]=t;for(const n of Object.values(t.fulfillments))l["checkout.fulfillments."+n.id]=n}}this.store.batch(l)}finally{this.store.set("checkout.updating",![])}}syncCheckoutState(t){var n;const e={"checkout.token":t.token,"checkout.events":t.events,"checkout.amounts":t.amounts,"checkout.shippingAddress":t.shippingAddress,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":t.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(n=null==t?void 0:t.promoCode)||void 0===n?void 0:n.code)?null==t?void 0:t.promoCode:null};if(Object.values(t.items).length>0){this.store.remove("checkout.items");for(const n of Object.values(t.items))e["checkout.items."+n.cartItemId]={...n,loading:![],updating:![],error:null}}if(t.retailers&&Object.values(t.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const n of Object.values(t.retailers)){e["checkout.retailers."+n.id]=n;for(const t of Object.values(n.fulfillments))e["checkout.fulfillments."+t.id]=t}}this.store.batch(e)}async refreshCheckout(t){var e;try{let n;if(this.store.set("checkout.updating",!![]),null==t?void 0:t.response)n=t.response;else{const i=null!==(e=null==t?void 0:t.cartId)&&void 0!==e?e:this.store.get("checkout.cartId");if(!i)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const o=this.dataForCheckoutPrepare({});n=await this.api.prepareCheckout({...o,cartId:i})}this.syncCheckoutState(n)}catch(i){const t=(null==i?void 0:i.message)||"Failed to refresh checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:t}),i}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:n,billingData:e,marketingPreferences:i,shippingAddressTwo:r,deliveryInstructions:a,deliveryTips:s,paymentMethodId:c,isGift:l}){var d,h,p,m,f,g,v,x,b,w,_,E,S,P,D,F,I,O,M,L,R,j,N;const B=this.store.get("checkout"),q=null!==(h=null===(d=B.paymentForm)||void 0===d?void 0:d.billingSameAsShipping)&&void 0!==h?h:!![],U=void 0!==l?l:B.isGift,V=n?!![]:null!==(m=null===(p=B.giftRecipientForm)||void 0===p?void 0:p.isValid)&&void 0!==m?m:![],H=U&&V,K={cartId:B.cartId,shippingAddressTwo:r,billingSameAsShipping:q,marketingPreferences:i||B.marketingPreferences,promoCode:(null===(f=B.promoCode)||void 0===f?void 0:f.code)||void 0,isGift:H,giftCards:(null===(g=null==B?void 0:B.giftCards)||void 0===g?void 0:g.map(t=>t.code))||[],deliveryTips:s||Object.values(B.fulfillments||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip}))};c?K.payment=c:(null===(x=null===(v=B.paymentForm)||void 0===v?void 0:v.paymentMethod)||void 0===x?void 0:x.id)&&(K.payment=B.paymentForm.paymentMethod.id);const Y=a||B.deliveryInstructions;if(Y&&(K.deliveryInstructions=Object.values(B.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:Y}))),K.customer=t||((null===(w=null===(b=null==B?void 0:B.customerForm)||void 0===b?void 0:b.data)||void 0===w?void 0:w.email)?{firstName:null===(E=null===(_=B.customerForm)||void 0===_?void 0:_.data)||void 0===E?void 0:E.firstName,lastName:null===(P=null===(S=B.customerForm)||void 0===S?void 0:S.data)||void 0===P?void 0:P.lastName,email:null===(F=null===(D=B.customerForm)||void 0===D?void 0:D.data)||void 0===F?void 0:F.email,phone:null===(O=null===(I=B.customerForm)||void 0===I?void 0:I.data)||void 0===O?void 0:O.phone,birthDate:null===(L=null===(M=B.customerForm)||void 0===M?void 0:M.data)||void 0===L?void 0:L.birthDate,company:null===(j=null===(R=B.customerForm)||void 0===R?void 0:R.data)||void 0===j?void 0:j.company}:void 0),H){const t=n||(null===(N=B.giftRecipientForm)||void 0===N?void 0:N.data);t&&(K.giftOptions=t)}return q||(e?K.billingAddress={firstName:e.firstName,lastName:e.lastName,email:e.email,phone:e.phone,company:e.company,one:e.one,two:e.two,city:e.city,state:e.state,zip:e.zip}:B.paymentForm.data&&(K.billingAddress=B.paymentForm.data)),K}getDetails(){var t,n,e,i;const o=this.store.get("checkout"),r={};for(const a in o.items||{}){const t=o.items[a];r[a]={liquidId:t.liquidId,variantId:t.variantId,cartItemId:a,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyPid:t.salsifyPid,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,tax:t.tax,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes}}return{cartId:o.cartId,isGift:o.isGift||![],billingSameAsShipping:(null===(t=o.paymentForm)||void 0===t?void 0:t.billingSameAsShipping)||!![],marketingPreferences:{canEmail:(null===(n=o.marketingPreferences)||void 0===n?void 0:n.canEmail)||![],canSms:(null===(e=o.marketingPreferences)||void 0===e?void 0:e.canSms)||![]},hasPromoCode:Boolean(null===(i=o.promoCode)||void 0===i?void 0:i.code),hasGiftCards:Array.isArray(o.giftCards)&&o.giftCards.length>0,amounts:o.amounts,itemCount:Object.values(r).reduce((t,n)=>t+(n.quantity||0),0),items:r}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,n=![]){this.store.createProductInstance(t),n&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var n;if(!Array.isArray(t)||0===t.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(t.reduce((t,n)=>(t["products."+n+".loading"]=!![],t["products."+n+".error"]=null,t),{}));const e=await this.api.getProductsData(t,this.getLocation());if(!e||!e.products||0===e.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,n)=>(t["products."+n+".loading"]=![],t["products."+n+".error"]=!![],t),{})),void 0;const i=[];for(const r of e.products){const o=Object.values(r.sizes).filter(n=>t.some(t=>t===(n.upc||n.id||r.salsifyGrouping))),a=t.find(t=>o.some(n=>t===n.upc||t===n.id)||t===r.salsifyGrouping),s=a||(null===(n=null==o?void 0:o[0])||void 0===n?void 0:n.upc);await this.loadProduct(s,{products:[r],retailers:e.retailers}),i.push(s)}const o=t.filter(t=>-1===i.indexOf(t));this.store.batch(o.reduce((t,n)=>(t["products."+n+".loading"]=![],t["products."+n+".error"]="Product data not found",t),{}))}async loadProduct(t,e=null){var i,o;try{const r=this.store.get("products."+t);r.loading||this.store.set("products."+t+".loading",!![]);let a=null;if(e&&(a=e),e||(a=await this.api.getProductsData([t],this.getLocation())),!a||!(null===(i=null==a?void 0:a.products)||void 0===i?void 0:i[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const s=this.loadProductStoreUpdate(a);if(!s)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...s,identifier:t}),this.pubSub.publishAction(n.PRODUCT_LOADED,this.productDataForEventFromStore(t));const c=a.products[0],l=s.sizes[s.selectedSizeId||""],d=Boolean(this.getLocation()),h=s.selectedFulfillment,p=d&&(null==h?void 0:h.variant.price)?h.variant.price:s.noAvailabilityPrice,m=splitCategoryPath(c.catPath);this.googleTagManager.viewItem({item_id:null==l?void 0:l.id,item_name:c.name,item_brand:c.brand,item_size:null==l?void 0:l.size,item_category:m.category,item_category2:m.category2,item_category3:m.category3,price:centToDollar(p),item_type:c.type,item_subtype:c.subType,item_image:(null==l?void 0:l.image)||(null===(o=c.images)||void 0===o?void 0:o[0]),upc:null==l?void 0:l.upc,grouping_id:c.salsifyGrouping,product_id:null==l?void 0:l.id})}catch(r){this.store.set("products."+t+".error",r.message),this.logger.error("Failed to load product data for ID "+t,r)}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,e){var i,r,a;const s=this.store.get("products."+t),c=s.sizes[e],l=Object.values(c.shippingFulfillments),d=Object.values(c.onDemandFulfillments),h=l.length>0,p=d.length>0,m=h||p;let f=s.selectedFulfillmentType,g=null,v=null;const x=f===o.SHIPPING?h:p;!x&&m&&(f=f===o.SHIPPING?o.ON_DEMAND:o.SHIPPING);const b=f===o.SHIPPING?l:d;b.length>0&&(g=b[0],v=g.id);const w=b.length>0,_=splitCategoryPath(s.catPath);this.googleTagManager.viewItem({item_id:null==c?void 0:c.id,item_name:s.name,item_brand:s.brand,item_size:null==c?void 0:c.size,item_category:_.category,item_category2:_.category2,item_category3:_.category3,price:centToDollar((null==g?void 0:g.variant.price)||s.noAvailabilityPrice),item_type:s.type,item_subtype:s.subType,item_image:(null==c?void 0:c.image)||(null===(i=s.images)||void 0===i?void 0:i[0]),upc:null==c?void 0:c.upc,grouping_id:s.salsifyGrouping,product_id:null==c?void 0:c.id}),m||this.googleTagManager.productSizeNoAvailability({productId:null==c?void 0:c.id,productName:s.name,productBrand:s.brand,productCategory:_.category,productCategory2:_.category2,productCategory3:_.category3,productType:s.type,productSubtype:s.subType,productPrice:s.noAvailabilityPrice,sizeId:e,sizeName:null==c?void 0:c.size,upc:null==c?void 0:c.upc,groupingId:s.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:e,selectedSize:(null===(r=s.sizes[e])||void 0===r?void 0:r.size)||"",previousSizeId:s.selectedSizeId||"",previousSize:(null===(a=s.sizes[s.selectedSizeId])||void 0===a?void 0:a.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:e,["products."+t+".productHasAvailability"]:m,["products."+t+".fulfillmentHasAvailability"]:w,["products."+t+".selectedFulfillmentType"]:f,["products."+t+".selectedFulfillment"]:g,["products."+t+".selectedFulfillmentId"]:v})}async selectFulfillment(t,e){var i;const r=this.store.get("products."+t),a=r.sizes[r.selectedSizeId],s=r.selectedFulfillmentType===o.SHIPPING?a.shippingFulfillments:a.onDemandFulfillments,c=s[e];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:e,selectedFulfillmentType:r.selectedFulfillmentType,previousFulfillmentId:r.selectedFulfillmentId||"",previousFulfillmentType:r.selectedFulfillmentType});const l=splitCategoryPath(r.catPath);this.googleTagManager.viewItem({item_id:null==a?void 0:a.id,item_name:r.name,item_brand:r.brand,item_size:null==a?void 0:a.size,item_category:l.category,item_category2:l.category2,item_category3:l.category3,price:centToDollar((null==c?void 0:c.variant.price)||r.noAvailabilityPrice),item_type:r.type,item_subtype:r.subType,item_image:(null==a?void 0:a.image)||(null===(i=r.images)||void 0===i?void 0:i[0]),upc:null==a?void 0:a.upc,grouping_id:r.salsifyGrouping,product_id:null==a?void 0:a.id}),this.store.batch({["products."+t+".selectedFulfillment"]:c,["products."+t+".selectedFulfillmentId"]:e,["products."+t+".quantity"]:1})}async updateQuantity(t,e){var i;const o=this.store.get("products."+t),r=o.quantity,a=r+e,s=1,c=(null===(i=null==o?void 0:o.selectedFulfillment)||void 0===i?void 0:i.variant.stock)||5,l=Math.max(s,Math.min(c,a));this.pubSub.publishAction(e<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:l,previousQuantity:r}),this.store.set("products."+t+".quantity",l)}async changeFulfillmentType(t,e){var i,r;const a=this.store.get("products."+t),s=a.sizes[a.selectedSizeId],c=e===o.SHIPPING?s.shippingFulfillments:s.onDemandFulfillments,l=Object.values(c);if(0===l.length){const t=splitCategoryPath(a.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==s?void 0:s.id,productName:a.name,productBrand:a.brand,productCategory:t.category,productCategory2:t.category2,productCategory3:t.category3,productType:a.type,productSubtype:a.subType,productPrice:a.noAvailabilityPrice,sizeId:null!==(i=a.selectedSizeId)&&void 0!==i?i:void 0,sizeName:null==s?void 0:s.size,fulfillmentType:e,upc:null==s?void 0:s.upc,groupingId:a.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+e+" fulfillments available for selected size"}),void 0}const d=l[0]||null,h=(null==d?void 0:d.id)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:e,selectedFulfillmentId:h,previousFulfillmentType:a.selectedFulfillmentType,previousFulfillmentId:a.selectedFulfillmentId,fulfillmentHasAvailability:l.length>0});const p=splitCategoryPath(a.catPath);this.googleTagManager.viewItem({item_id:null==s?void 0:s.id,item_name:a.name,item_brand:a.brand,item_size:null==s?void 0:s.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,price:centToDollar((null==d?void 0:d.variant.price)||a.noAvailabilityPrice),item_type:a.type,item_subtype:a.subType,item_image:(null==s?void 0:s.image)||(null===(r=a.images)||void 0===r?void 0:r[0]),upc:null==s?void 0:s.upc,grouping_id:a.salsifyGrouping,product_id:null==s?void 0:s.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:e,["products."+t+".selectedFulfillment"]:d,["products."+t+".selectedFulfillmentId"]:h,["products."+t+".fulfillmentHasAvailability"]:l.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,n,e){const i={type:n,data:e||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:i})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),n=Object.keys(t);for(const e of n)this.store.set("products."+e+".rerender",!![])}async addToCart(t,n){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(i.CART),await this.cartCommands.addItem(n),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const e=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(e.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(e){this.logger.error("Error adding to cart",e),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,n){try{this.store.set("products."+t+".updating",!![]),await this.checkoutCommands.addPresaleItem(n),this.clientConfig.isBuilder()||this.checkoutCommands.openCheckout(),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(e){this.logger.error("Error adding presale item to checkout",e),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const n=this.store.get("products."+t);if(!n)throw new Error('Product store not found for identifier "'+t+'"');const fulfillmentEventData=t=>t?Object.entries(t).reduce((t,[n,e])=>(t[n]={...e},t),{}):{},e=Object.entries(n.sizes||{}).reduce((t,[n,e])=>{const{loading:i,error:o,shippingFulfillments:r,onDemandFulfillments:a,...s}=e;return t[n]={...s,shippingFulfillments:fulfillmentEventData(r),onDemandFulfillments:fulfillmentEventData(a)},t},{});return{identifier:t,selectedSizeId:n.selectedSizeId||null,selectedFulfillmentType:n.selectedFulfillmentType,selectedFulfillmentId:n.selectedFulfillmentId||null,productHasAvailability:Boolean(n.productHasAvailability),fulfillmentHasAvailability:Boolean(n.fulfillmentHasAvailability),id:n.id,name:n.name,brand:n.brand,catPath:n.catPath,category:n.category,classification:n.classification,type:n.type,subType:n.subType,salsifyGrouping:n.salsifyGrouping,description:n.description,htmlDescription:n.htmlDescription,tastingNotes:n.tastingNotes,images:n.images||[],region:n.region,country:n.country,material:n.material,abv:n.abv,proof:n.proof,age:n.age,color:n.color,flavor:n.flavor,variety:n.variety,appellation:n.appellation,vintage:n.vintage,noAvailabilityPrice:n.noAvailabilityPrice,sizes:e}}findFirstAvailableSize(t){const n=Object.values(t);for(const e of n){const t=e.shippingFulfillments||{},n=e.onDemandFulfillments||{},i=Object.values(t).length,o=Object.values(n).length;if(i+o>0)return e.id}return null}loadProductStoreUpdate({products:[t,...n],retailers:e}){var i,r,a,s,c;try{const n=this.themeProvider.getConfigs("product"),l={id:t.id,brand:t.brand,category:t.category,catPath:t.catPath,classification:t.classification,type:t.type,subType:t.subType,salsifyGrouping:t.salsifyGrouping,name:t.name,description:t.description,htmlDescription:t.htmlDescription,images:t.images,region:t.region,country:t.country,material:t.material,abv:t.abv,proof:t.proof,age:t.age,color:t.color,flavor:t.flavor,variety:t.variety,appellation:t.appellation,vintage:t.vintage,tastingNotes:t.tastingNotes,noAvailabilityPrice:t.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:n.layout.enableShippingFulfillment?o.SHIPPING:o.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(t.sizes&&Object.values(t.sizes).length>0)for(const{shippingVariants:i,onDemandVariants:o,...r}of Object.values(t.sizes)){l.sizes[r.id]={...r,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const t of Object.values(i)){const n=e[t.retailerId];(null==n?void 0:n.shippingFulfillment)&&(l.sizes[r.id].shippingFulfillments[n.shippingFulfillment.id]={...n.shippingFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:t})}for(const t of Object.values(o)){const n=e[t.retailerId];(null==n?void 0:n.onDemandFulfillment)&&(l.sizes[r.id].onDemandFulfillments[n.onDemandFulfillment.id]={...n.onDemandFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:t})}}const d=Object.values(l.sizes),h=this.findFirstAvailableSize(l.sizes);l.selectedSizeId=h||(null===(i=d[0])||void 0===i?void 0:i.id)||"";const p=(null===(r=l.sizes[l.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments)||{},m=(null===(a=l.sizes[l.selectedSizeId])||void 0===a?void 0:a.onDemandFulfillments)||{};l.productHasAvailability=Object.values(p).length+Object.values(m).length>0;const f=l.selectedFulfillmentType===o.SHIPPING?Object.values(p):Object.values(m);if(l.fulfillmentHasAvailability=f.length>0,l.selectedFulfillment=f[0]||null,l.selectedFulfillmentId=(null===(s=l.selectedFulfillment)||void 0===s?void 0:s.id)||null,!l.fulfillmentHasAvailability){const t=l.selectedFulfillmentType===o.SHIPPING?o.ON_DEMAND:o.SHIPPING,n=t===o.SHIPPING?Object.values(p):Object.values(m);n.length>0&&(l.selectedFulfillmentType=t,l.selectedFulfillment=n[0],l.selectedFulfillmentId=(null===(c=l.selectedFulfillment)||void 0===c?void 0:c.id)||null,l.fulfillmentHasAvailability=!![])}if(!l.productHasAvailability){const n=splitCategoryPath(t.catPath),e=l.sizes[l.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==e?void 0:e.id,productName:t.name,productBrand:t.brand,productCategory:n.category,productCategory2:n.category2,productCategory3:n.category3,productType:t.type,productSubtype:t.subType,productPrice:t.noAvailabilityPrice,upc:null==e?void 0:e.upc,groupingId:t.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for any size"})}return l}catch(l){throw this.logger.error("Product data processing error",l),l}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(t){return!t||t.length<3?[]:await this.api.getAddressSuggestions(t)}async getAddressDetails(t){return await this.api.getAddressDetails(t)}async setSelectedAddress(t){try{this.store.batch({"address.id":t.id,"address.formattedAddress":t.formattedAddress,"address.address":t.address,"address.coordinates":t.coordinates});const n=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(n)),await this.cartCommands.resetCart(),await this.store.persist()}catch(e){throw this.googleTagManager.addressFailed({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),e}this.googleTagManager.addressUpdated({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates}),this.pubSub.publishAction(n.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,e){try{const n=this.buildFormattedAddressString(t),i={id:"",formattedAddress:n,address:t,coordinates:e};await this.setSelectedAddress(i)}catch(i){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country},error:(null==i?void 0:i.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:t,coordinates:e,error:(null==i?void 0:i.message)||"Failed to set manual address"}),i}}async clearSelectedAddress(){this.store.set("address",p),this.pubSub.publishAction(n.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const t=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(t),this.store.clearLocalStorage()}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}buildFormattedAddressString(t){var n,e,i,o,r,a;const s=[],c=[];(null===(n=t.one)||void 0===n?void 0:n.trim())&&c.push(t.one.trim()),(null===(e=t.two)||void 0===e?void 0:e.trim())&&c.push(t.two.trim()),c.length>0&&s.push(c.join(" ")),(null===(i=t.city)||void 0===i?void 0:i.trim())&&s.push(t.city.trim());const l=[];return(null===(o=t.state)||void 0===o?void 0:o.trim())&&l.push(t.state.trim()),(null===(r=t.zip)||void 0===r?void 0:r.trim())&&l.push(t.zip.trim()),l.length>0&&s.push(l.join(" ")),(null===(a=t.country)||void 0===a?void 0:a.trim())&&s.push(t.country.trim()),s.join(", ")}}const lt={BRANDS:"brands",FLAVOR:"flavor",FULFILLMENT:"fulfillment",REGION:"region",VARIETY:"variety",ENGRAVING:"engraving",PRICE:"price",PRESALE:"presale",CATEGORIES:"categories",SIZES:"sizes",APPELLATION:"appellation",COUNTRY:"country",VINTAGE:"vintage",MATERIALS:"materials"},dt={ALL:"all",SHIPPING:"shipping",ON_DEMAND:"onDemand"},ht={MIN:"0",MAX:"1000"},ut={YES:"YES",NO:"NO"};class ProductListCommands extends BaseCommand{constructor(){super(),this.FILTER_TYPE_MAP={[lt.BRANDS]:l.BRANDS,[lt.CATEGORIES]:l.CATEGORIES,[lt.FLAVOR]:l.FLAVOR,[lt.REGION]:l.REGION,[lt.VARIETY]:l.VARIETY,[lt.VINTAGE]:l.VINTAGE,[lt.COUNTRY]:l.COUNTRY,[lt.APPELLATION]:l.APPELLATION,[lt.MATERIALS]:l.MATERIALS,[lt.SIZES]:l.SIZES,[lt.PRESALE]:l.PRESALE,[lt.ENGRAVING]:l.ENGRAVING,[lt.FULFILLMENT]:l.FULFILLMENT},this.listeners=new Set,this.selectFulfillmentType=async(t,n)=>{var e;const i=this.getStoreState(),r=i.products.find(n=>(n.salsifyGrouping||n.id)===t),a=i.userProducts[t].selectedSizeId,s=r?Object.values(r.sizes).find(t=>t.id===a):void 0;if(!s)return;const c=n===o.SHIPPING?Object.values(s.shippingFulfillments):Object.values(s.onDemandFulfillments),l=c[0];if(!l)return;const d=l.variant,h=i.retailers,p=h[d.retailerId];if(!p)return;const m=n===o.SHIPPING?p.shippingFulfillment:p.onDemandFulfillment,f={...i.userProducts,[t]:{...i.userProducts[t],selectedFulfillmentType:n,selectedFulfillment:m?{...m,id:null!==(e=m.id)&&void 0!==e?e:"",retailerName:p.name,retailerAddress:p.address,retailerAddressFormatted:p.addressFormatted,variant:d,image:s.image}:null}};this.store.set("productsList.userProducts",f),this.notifyListeners()},this.selectFulfillment=async(t,n)=>{var e,i;const r=this.getStoreState(),a=r.products.find(n=>(n.salsifyGrouping||n.id)===t),s=r.userProducts[t].selectedSizeId,c=a?Object.values(a.sizes).find(t=>t.id===s):void 0;if(!c)return;const l=Object.values(c.shippingFulfillments||{}).find(t=>t.id===n),d=Object.values(c.onDemandFulfillments||{}).find(t=>t.id===n),h=l||d;if(!h)return;const p=l?o.SHIPPING:o.ON_DEMAND,m=null===(e=h.variant)||void 0===e?void 0:e.retailerId,f=m?r.retailers[m]:void 0;if(!f)return;const g=p===o.SHIPPING?f.shippingFulfillment:f.onDemandFulfillment,v={...r.userProducts,[t]:{...r.userProducts[t],selectedFulfillmentType:p,selectedFulfillment:g?{...g,id:null!==(i=g.id)&&void 0!==i?i:"",retailerName:f.name,retailerAddress:f.address,retailerAddressFormatted:f.addressFormatted,variant:h.variant,image:c.image}:null}};this.store.set("productsList.userProducts",v),this.notifyListeners()},this.selectSize=async(t,n)=>{var e;const i=this.getStoreState(),o=i.products.find(n=>(n.salsifyGrouping||n.id)===t);if(!o)return;const r=Object.values(o.sizes).find(t=>t.id===n);if(!r)return;const{fulfillment:a,fulfillmentType:s}=this.getFulfillmentForSize(r,i.userProducts[t].selectedFulfillmentType),c={...i.userProducts,[t]:{...i.userProducts[t],selectedSizeId:n,...s?{selectedFulfillmentType:s}:{},...a?{selectedFulfillment:a?{...a,image:null!==(e=a.image)&&void 0!==e?e:null}:null}:{}}};this.store.set("productsList.userProducts",c),this.notifyListeners()},this.updateQuantity=(t,n)=>{const e=this.getStoreState(),i={...e.userProducts,[t]:{...e.userProducts[t],selectedQuantity:n}};this.store.set("productsList.userProducts",i),this.notifyListeners()},this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}subscribe(t){this.listeners.add(t);const n=this.getStoreState();try{t(n)}catch(e){this.logger.error("Error in initial state listener call:",e)}return()=>{this.listeners.delete(t)}}getStoreState(){return this.store.get("productsList")}updateSearchTerm(t){this.store.set("productsList.searchTerm",t),this.notifyListeners()}setLoading(t){this.store.set("productsList.loading",t),this.notifyListeners()}notifyListeners(){const t=this.getStoreState();this.listeners.forEach(n=>{try{n(t)}catch(e){this.logger.error("Error in state listener:",e)}})}initializeProductFulfillment(t){const n=Object.values(t.sizes)[0];if(!n)return{sizeId:"",fulfillmentType:null,fulfillment:null};const e=n.id,i=Object.values(n.shippingFulfillments)[0];if(i)return{sizeId:e,fulfillmentType:"shipping",fulfillment:{...i,image:Object.values(t.sizes)[0].image}};const o=Object.values(n.onDemandFulfillments)[0];return o?{sizeId:e,fulfillmentType:"onDemand",fulfillment:{...o,image:t.sizes[0].image}}:{sizeId:e,fulfillmentType:null,fulfillment:null}}transformProductVariantsToFulfillments(t,n){return t.map(t=>this.transformSingleProduct(t,n))}transformSingleProduct(t,n){const e={...t,sizes:{}};if(!t.sizes||0===Object.values(t.sizes).length)return e;for(const[i,o]of Object.entries(t.sizes))e.sizes[i]=this.transformProductSize(o,n);return e}transformProductSize(t,n){const{shippingVariants:e,onDemandVariants:i,...o}=t,r={...o,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};return this.addShippingFulfillments(r,e,n),this.addOnDemandFulfillments(r,i,n),r}addShippingFulfillments(t,n,e){if(n)for(const i of Object.values(n)){const n=e[i.retailerId];(null==n?void 0:n.shippingFulfillment)&&(t.shippingFulfillments[n.shippingFulfillment.id]={...n.shippingFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:i})}}addOnDemandFulfillments(t,n,e){if(n)for(const i of Object.values(n)){const n=e[i.retailerId];(null==n?void 0:n.onDemandFulfillment)&&(t.onDemandFulfillments[n.onDemandFulfillment.id]={...n.onDemandFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:i})}}async loadInitialProducts(t,n,e,i,o){try{this.setLoading(!![]);const r=this.buildSearchParams(t,n,e,i,o),a=await this.getProductList(r),s=this.transformProductVariantsToFulfillments(a.products||[],a.retailers||{}),c={};s&&s.length>0&&s.forEach(t=>{var n;const e=t.salsifyGrouping||t.id||"",i=this.initializeProductFulfillment(t);c[e]={selectedSizeId:i.sizeId,selectedQuantity:1,selectedFulfillmentType:i.fulfillmentType||"shipping",selectedFulfillment:i.fulfillment?{...i.fulfillment,image:null!==(n=i.fulfillment.image)&&void 0!==n?n:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":s,"productsList.retailers":a.retailers,"productsList.filters":a.navigation.filters,"productsList.pagination":this.updatePagination(a.navigation),"productsList.loading":![],"productsList.userProducts":c}),this.notifyListeners()}catch(r){throw this.logger.error("Error loading initial products:",r),this.store.batch({"productsList.products":[],"productsList.retailers":{},"productsList.filters":[],"productsList.pagination":{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]},"productsList.loading":![],"productsList.userProducts":{}}),this.notifyListeners(),r}}async loadMoreProducts(t,n,e,i){try{const o=this.getStoreState(),r=o.pagination;if(!r.hasMorePages)return;this.setLoading(!![]);const a=r.currentPage+1,s=this.buildSearchParams(a,t,n,e,i),c=await this.getProductList(s);if(c.products&&c.products.length>0){const t=o.products,n=o.retailers,e=o.userProducts,i=this.mergeRetailers(n,c.retailers||{}),r=this.transformProductVariantsToFulfillments(c.products,c.retailers||{}),a={...e};r.forEach(t=>{var n;const e=t.salsifyGrouping||t.id||"",i=this.initializeProductFulfillment(t);a[e]={selectedSizeId:i.sizeId,selectedQuantity:1,selectedFulfillmentType:i.fulfillmentType||"shipping",selectedFulfillment:i.fulfillment?{...i.fulfillment,image:null!==(n=i.fulfillment.image)&&void 0!==n?n:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":[...t,...r],"productsList.retailers":i,"productsList.filters":c.navigation.filters,"productsList.pagination":this.updatePagination(c.navigation),"productsList.loading":![],"productsList.userProducts":a}),this.notifyListeners()}else this.store.batch({"productsList.pagination":{...r,hasMorePages:![]},"productsList.loading":![]}),this.notifyListeners()}catch(o){throw this.logger.error("Error loading more products:",o),this.setLoading(![]),o}}async getProductList(t){t.location=this.getLocation();const n=await this.api.catalogSearch(t);return n.products&&n.products.length>0&&this.trackViewItemList(n.products),n}syncFiltersFromComponent(t){const n={};for(const[e,i]of Object.entries(t))null!=i&&(Array.isArray(i)?n[e]=i:n[e]="object"==typeof i?[JSON.stringify(i)]:[String(i)]);this.store.set("productsList.appliedFilters",n),this.notifyListeners()}getSanitizedFilters(t,n){return n&&0!==n.length?t.filter(t=>{const e=this.FILTER_TYPE_MAP[t.type];return e&&n.includes(e)}):[]}buildSearchParams(t,n,e,i,o){const r={page:t,perPage:n,filters:this.buildFilters(i,o)};return e&&e.trim().length>0&&(r.search=e.trim()),r}buildFilters(t,n){const e=[];return this.addToggleFilters(e,t,n),this.addPriceFilter(e,t,n),this.addDynamicFilters(e,t,n),e}addToggleFilters(t,n,e){this.addEngravingFilter(t,n,e),this.addPresaleFilter(t,n,e),this.addFulfillmentFilter(t,n,e)}getBooleanFilterValue(t){return"boolean"==typeof t?t:Array.isArray(t)&&t.length>0?"true"===t[0]:"string"==typeof t?"true"===t:![]}addEngravingFilter(t,n,e){if(e.includes(l.ENGRAVING)){const e=this.getBooleanFilterValue(n[lt.ENGRAVING]);t.push({key:lt.ENGRAVING,values:[e?ut.YES:ut.NO]})}}addPresaleFilter(t,n,e){if(e.includes(l.PRESALE)){const e=this.getBooleanFilterValue(n[lt.PRESALE]);t.push({key:lt.PRESALE,values:[e?ut.YES:ut.NO]})}}addFulfillmentFilter(t,n,e){if(e.includes(l.FULFILLMENT)){const e=n[lt.FULFILLMENT],i=Array.isArray(e)?e[0]:e||dt.ALL,o=i===dt.ALL?[dt.ON_DEMAND,dt.SHIPPING]:[i];t.push({key:lt.FULFILLMENT,values:o})}}addPriceFilter(t,n,e){var i,o,r,a;e.includes(l.PRICE)&&t.push({key:lt.PRICE,values:{min:null!==(o=null===(i=n.price)||void 0===i?void 0:i.min)&&void 0!==o?o:ht.MIN,max:null!==(a=null===(r=n.price)||void 0===r?void 0:r.max)&&void 0!==a?a:ht.MAX}})}addDynamicFilters(t,n,e){const i=[lt.PRICE,lt.ENGRAVING,lt.PRESALE,lt.FULFILLMENT],o=Object.keys(n).filter(t=>!i.includes(t)),r=new Set;for(const s of o)t.push({key:s,values:n[s]}),r.add(s);const a=this.getFilterKeyToTypeMap();for(const s of e){const n=a[s];!n||r.has(n)||i.includes(n)||t.push({key:n,values:[]})}}setGridConfig(t,n){this.store.set("productsList.gridConfig",{rows:t,columns:n})}getItemsPerPage(){const t=this.getStoreState(),n=t.gridConfig;return n?n.rows*n.columns:16}updatePagination(t){var n,e,i,o,r;return t?{currentPage:null!==(n=t.currentPage)&&void 0!==n?n:0,totalPages:null!==(e=t.totalPages)&&void 0!==e?e:0,totalCount:null!==(i=t.totalCount)&&void 0!==i?i:0,hasMorePages:(null!==(o=t.currentPage)&&void 0!==o?o:0)<(null!==(r=t.totalPages)&&void 0!==r?r:1)-1}:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]}}createInitialPagination(){return{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]}}mergeRetailers(t,n){const e={...t};for(const[i,o]of Object.entries(n))e[i]||(e[i]=o);return e}extractProductCardData(t,n){const e=Object.values(t.sizes)[0];if(!e)return this.logger.warn("Product "+t.id+" has no sizes"),null;const i=Object.values(e.shippingFulfillments),o=Object.values(e.onDemandFulfillments),r=i[0],a=o[0],s=(null==r?void 0:r.variant)||(null==a?void 0:a.variant);if(!s)return this.logger.warn("Product "+t.id+" has no variants"),null;const c=n[s.retailerId];return c?{product:t,retailer:c}:(this.logger.warn("Retailer "+s.retailerId+" not found for product "+t.id),null)}getFilterKeyToTypeMap(){const t={};for(const[n,e]of Object.entries(this.FILTER_TYPE_MAP))t[e]=n;return t}async addToCart(t){try{this.uiCommands.openDrawer(i.CART),await this.cartCommands.addItem(t)}catch(n){throw this.logger.error("Error adding product to cart from product list",n),n}}async addPresaleToCart(t){try{await this.checkoutCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.checkoutCommands.openCheckout()}catch(n){throw this.logger.error("Error adding presale product to checkout from product list",n),n}}trackViewItemList(t){if(0!==t.length)try{const n=this.getStoreState(),e=this.transformProductVariantsToFulfillments(t,n.retailers),i=e.map((t,n)=>({...this.convertProductToBaseItem(t),index:n+1}));this.googleTagManager.viewItemList(i,"product_list","Product List")}catch(n){this.logger.error("Error tracking view_item_list event",n)}}trackSelectItem(t){try{const n=this.convertProductToBaseItem(t);this.googleTagManager.selectItem(n,"product_list","Product List")}catch(n){this.logger.error("Error tracking select_item event",n)}}convertProductToBaseItem(t){var n,e;const i=null===(n=t.sizes)||void 0===n?void 0:n[0],o=null==i?void 0:i.shippingFulfillments[Object.keys(i.shippingFulfillments)[0]],r=splitCategoryPath(t.catPath);return{item_id:null==i?void 0:i.id,item_name:t.name,item_brand:t.brand,item_size:null==i?void 0:i.size,item_category:r.category,item_category2:r.category2,item_category3:r.category3,price:(null==o?void 0:o.variant.price)?centToDollar(o.variant.price):t.noAvailabilityPrice?centToDollar(t.noAvailabilityPrice):void 0,item_type:t.type,item_subtype:t.subType,item_image:(null==i?void 0:i.image)||(null===(e=t.images)||void 0===e?void 0:e[0]),upc:null==i?void 0:i.upc,grouping_id:t.salsifyGrouping,product_id:null==i?void 0:i.id,item_list_id:"product_list",item_list_name:"Product List"}}openProductListModal(t,n,e){const i={type:n,data:e};this.store.batch({["productsList.userProducts."+t+".modal.isOpen"]:!![],["productsList.userProducts."+t+".modal.contentConfig"]:i}),this.notifyListeners()}closeProductListModal(t){this.store.batch({["productsList.userProducts."+t+".modal.isOpen"]:![],["productsList.userProducts."+t+".modal.contentConfig"]:null}),this.notifyListeners()}getFulfillmentForSize(t,n){const e=Object.values(t.shippingFulfillments||{}),i=Object.values(t.onDemandFulfillments||{}),r=e[0],a=i[0];return n===o.SHIPPING&&r?{fulfillment:{...r,image:t.image},fulfillmentType:o.SHIPPING}:n===o.ON_DEMAND&&a?{fulfillment:{...a,image:t.image},fulfillmentType:o.ON_DEMAND}:r?{fulfillment:{...r,image:t.image},fulfillmentType:o.SHIPPING}:a?{fulfillment:{...a,image:t.image},fulfillmentType:o.ON_DEMAND}:{fulfillment:null,fulfillmentType:null}}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,e=![]){var i,o,r,a,s;const c=this.store.get("cart");for(const n of Object.keys(c.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(c.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(c.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const l={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(i=t.promoCode)||void 0===i?void 0:i.code)?{...t.promoCode,error:null}:null};if((null===(o=Object.values(t.items))||void 0===o?void 0:o.length)>0)for(const n of Object.values(t.items))l["cart.items."+n.id]=n;if((null===(r=Object.values(t.retailers))||void 0===r?void 0:r.length)>0)for(const n of Object.values(t.retailers))if(l["cart.retailers."+n.id]=n,(null===(a=Object.values(n.fulfillments))||void 0===a?void 0:a.length)>0)for(const t of Object.values(n.fulfillments))l["cart.fulfillments."+t.id]=t;if((null===(s=t.events)||void 0===s?void 0:s.length)>0&&(l["cart.events"]=t.events),this.store.batch(l),e){const t=this.store.get("cart"),e=this.buildCartLoadedEventData(t);this.pubSub.publishAction(n.CART_LOADED,e)}}buildCartLoadedEventData(t){var n,e;const i=this.store.get("address"),o={};for(const r of Object.keys(t.items||{})){const n=t.items[r];o[r]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,salsifyGrouping:n.salsifyGrouping,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price,quantity:n.quantity,maxQuantity:n.maxQuantity,unitPrice:n.unitPrice,mainImage:n.mainImage,attributes:n.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(e=null===(n=t.promoCode)||void 0===n?void 0:n.discount)&&void 0!==e?e:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:o,retailers:t.retailers||{},location:(null==i?void 0:i.id)&&i.coordinates&&i.address?{placesId:i.id,formattedAddress:i.formattedAddress,address:i.address,coordinates:i.coordinates}:null}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),n=await this.api.getCartData(t.id);this.syncCartFromResponse(n,!![]),n.id!==t.id&&await this.store.persist()}catch(t){const e=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",e);const i=this.store.get("cart.id");this.pubSub.publishAction(n.CART_FAILED,{cartId:i,message:e}),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}const pt="lce-checkout-stripe-slot",mt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},ft={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},gt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};class BaseActionService{constructor(t){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get(t)}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.latitude&&t.coordinates.longitude)return{coordinates:t.coordinates,address:t.address}}}class ClientCheckoutActionService extends BaseActionService{constructor(){super("CheckoutAction"),this.allowedCustomerFields=new Set(Object.values(mt)),this.allowedBillingFields=new Set(Object.values(gt)),this.allowedGiftFields=new Set(Object.values(ft)),this.cartActionsAddProduct=null,this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientCheckoutActionService",()=>new ClientCheckoutActionService)}setCartActionsAddProduct(t){this.cartActionsAddProduct=t}get actions(){return{openCheckout:this.openCheckout.bind(this),closeCheckout:this.closeCheckout.bind(this),toggleCheckout:this.toggleCheckout.bind(this),addProduct:this.addProduct.bind(this),applyPromoCode:this.applyPromoCode.bind(this),removePromoCode:this.removePromoCode.bind(this),applyGiftCard:this.applyGiftCard.bind(this),removeGiftCard:this.removeGiftCard.bind(this),toggleIsGift:this.toggleIsGift.bind(this),toggleBillingSameAsShipping:this.toggleBillingSameAsShipping.bind(this),toggleMarketingPreferences:this.toggleMarketingPreferences.bind(this),updateCustomerInfo:this.updateCustomerInfo.bind(this),updateBillingInfo:this.updateBillingInfo.bind(this),updateGiftInfo:this.updateGiftInfo.bind(this),getDetails:this.getDetails.bind(this)}}normalizeCheckoutFieldValue(t){return"string"==typeof t?t:null==t?"":String(t)}openCheckout(){this.command.ui.openDrawer(i.CHECKOUT)}closeCheckout(){this.command.ui.closeDrawer()}toggleCheckout(){const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CHECKOUT)}async addProduct(t,e){var r;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;e===!![]&&this.command.ui.openDrawer(i.CHECKOUT);const a=t.map(t=>t.identifier);if(this.cartActionsAddProduct)await this.cartActionsAddProduct(t);else for(const n of t){const t=this.getLocation();if(!t)throw new SDKError("Location is required to add products to checkout",!![]);const e=await this.api.getProductsData([n.identifier],t);if(!(null===(r=null==e?void 0:e.products)||void 0===r?void 0:r[0])){this.logger.warn("No product data found for identifier: "+n.identifier);continue}const i=e.products[0],a=Object.values(i.sizes)[0];if(!a)continue;const s=n.fulfillmentType===o.SHIPPING?a.shippingVariants:a.onDemandVariants,c=Object.values(s)[0];if(!c)continue;const l=n.fulfillmentType===o.ON_DEMAND?c.onDemandFulfillmentId:c.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:l,partNumber:c.partNumber,quantity:n.quantity,identifier:n.identifier})}await this.command.checkout.loadCheckout({});const s=this.store.get("cart.id");this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:s,itemsAdded:t.length,identifiers:a}),this.logger.info("Products added to checkout successfully:",a)}catch(a){this.logger.error("Error adding products to checkout:",a);const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:e,identifiers:t.map(t=>t.identifier),error:a.message||"Failed to add products to checkout"}),a}}async applyPromoCode(t){var e;try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const i=t.trim().toUpperCase(),o=this.themeProvider.getConfigs("global"),r=o.layout.allowPromoCodes;if(!r)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const a=this.store.get("checkout.promoCode");if(a&&a.code===i)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const s=this.store.get("checkout"),c=s.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:s.cartId,discount:(null==c?void 0:c.discount)||0,newTotal:(null===(e=null==s?void 0:s.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(i){this.logger.error("Failed to apply checkout promo code:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:t.cartId,error:"Promo code could not be applied"}),i}}async removePromoCode(){var t;try{const e=this.themeProvider.getConfigs("global"),i=e.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const o=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:o.cartId,newTotal:(null===(t=null==o?void 0:o.amounts)||void 0===t?void 0:t.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(e){throw this.logger.error("Failed to remove checkout promo code:",e),e}}async applyGiftCard(t){var e;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:r.cartId,newTotal:(null===(e=null==r?void 0:r.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card applied successfully")}catch(i){this.logger.error("Failed to apply gift card:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be applied"}),i}}async removeGiftCard(t){var e;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:r.cartId,newTotal:(null===(e=null==r?void 0:r.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card removed successfully")}catch(i){this.logger.error("Failed to remove gift card:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be removed"}),i}}async toggleIsGift(t){await this.command.checkout.toggleIsGift(t)}async toggleBillingSameAsShipping(t){await this.command.checkout.toggleBillingSameAsShipping(t)}async toggleMarketingPreferences(t,n){await this.command.checkout.toggleMarketingPreferences(t,n)}updateCustomerInfo(t){const n={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateCustomerInfo called without valid params"),void 0;for(const[e,i]of Object.entries(t)){if(!this.allowedCustomerFields.has(e))continue;const t=this.normalizeCheckoutFieldValue(i);e===mt.addressTwo?n["checkout.shippingAddress.address.two"]=t:n["checkout.customerForm.data."+e]=t}if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateCustomerInfo called without supported fields"),void 0;this.store.batch(n)}updateBillingInfo(t){const n={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateBillingInfo called without valid params"),void 0;for(const[e,i]of Object.entries(t))this.allowedBillingFields.has(e)&&(n["checkout.paymentForm.data."+e]=this.normalizeCheckoutFieldValue(i));if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateBillingInfo called without supported fields"),void 0;this.store.batch(n)}updateGiftInfo(t){const n={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateGiftInfo called without valid params"),void 0;for(const[e,i]of Object.entries(t)){if(!this.allowedGiftFields.has(e))continue;const t=this.normalizeCheckoutFieldValue(i);e===ft.addressTwo?n["checkout.shippingAddress.address.two"]=t:n["checkout.giftRecipientForm.data."+e]=t}if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateGiftInfo called without supported fields"),void 0;this.store.batch(n)}getDetails(){return this.command.checkout.getDetails()}}const vt="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",yt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const t=LoggerFactory,n=t.instances;if(n)for(const[i,o]of n)this.interceptLoggerInstance(o,i);const e=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const n=e(t);return this.interceptLoggerInstance(n,t),n}}interceptLoggerInstance(t,n){if(t.l)return;const e=t.debug.bind(t),i=t.info.bind(t),o=t.warn.bind(t),r=t.error.bind(t),C=(t,e,i)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:e,data:i,context:n});t.debug=(t,n)=>{e(t,n),this.addLogEntry(C("debug",t,n))},t.info=(t,n)=>{i(t,n),this.addLogEntry(C("info",t,n))},t.warn=(t,n)=>{o(t,n),this.addLogEntry(C("warn",t,n))},t.error=(t,n)=>{r(t,n),this.addLogEntry(C("error",t,n))},t.l=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),n=t.publishAction.bind(t);t.publishAction=(t,e)=>{n(t,e),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:e,context:"PubSub"})};const e=t.publishForm.bind(t);t.publishForm=(t,n)=>{e(t,n),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+t,data:n,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),n=t.executeEvent.bind(t);t.executeEvent=(t,e,i)=>{n(t,e,i),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+e,data:i,context:"GTM."+t})}}addLogEntry(t){this.logs.push(t),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const t=this.logs.filter(t=>{switch(t.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",t.forEach(t=>{const n=this.createLogElement(t);this.logContainer.appendChild(n)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(yt);t&&t.remove(),this.panelElement=document.createElement(yt);const n=window.innerWidth<=768,e=window.innerWidth<=480;e?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):n?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const t=this.panelElement.attachShadow({mode:"closed"}),n=document.createElement("style");n.textContent=vt,t.appendChild(n),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const e=this.createHeader();this.panelContainer.appendChild(e);const i=this.createToggles();this.panelContainer.appendChild(i),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const o=this.createResizeHandle();this.panelContainer.appendChild(o),t.appendChild(this.panelContainer),this.setupShadowEventListeners(t)}createHeader(){const t=document.createElement("div");t.className="header",t.title="Drag to move panel";const n=document.createElement("div");n.className="icon",n.innerHTML="🔍",n.title="Elements Debug Console",n.style.cursor="help";const e=document.createElement("div");e.className="title-container";const i=document.createElement("div");i.className="title",i.textContent="Elements Debug Console";const o=document.createElement("div");o.className="subtitle",o.textContent="Live SDK logs, events & GTM tracking",e.appendChild(i),e.appendChild(o);const r=document.createElement("button");return r.className="minimize",r.innerHTML="−",r.title="Minimize debug panel",r.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(n),t.appendChild(e),t.appendChild(r),t}createToggles(){const t=document.createElement("div");t.className="toggles";const n=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];n.forEach(({key:n,label:e,description:i,color:o})=>{const r=document.createElement("label");r.className="toggle",r.title=i;const a=document.createElement("input");a.type="checkbox",a.checked="showLogs"!==n,a.addEventListener("change",t=>{const e=t.target;"showEvents"===n&&(this.showEvents=e.checked),"showGtmEvents"===n&&(this.showGtmEvents=e.checked),"showLogs"===n&&(this.showLogs=e.checked),this.renderLogs()});const s=document.createElement("span");s.textContent=e,s.style.color=o,r.appendChild(a),r.appendChild(s),t.appendChild(r)});const e=document.createElement("button");return e.className="clear-btn",e.innerHTML="🗑️",e.title="Clear all logs",e.addEventListener("click",()=>this.clearLogs()),t.appendChild(e),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let n=![],e=0,i=0,o=0,r=0;t.addEventListener("mousedown",t=>{n=!![],e=t.clientX,i=t.clientY,o=Number.parseInt(this.panelElement.style.width,10)||500,r=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",A),document.addEventListener("mouseup",z),t.preventDefault()});const A=t=>{if(!n||!this.panelElement)return;const a=t.clientX-e,s=t.clientY-i,c=window.innerWidth<=768,l=window.innerWidth<=480;let d,h,p,m;l?(d=280,h=window.innerWidth-20,p=200,m=.4*window.innerHeight):c?(d=300,h=window.innerWidth-30,p=200,m=.4*window.innerHeight):(d=300,h=800,p=200,m=600);const f=Math.max(d,Math.min(h,o+a)),g=Math.max(p,Math.min(m,r+s));this.panelElement.style.width=f+"px",this.panelElement.style.height=g+"px"},z=()=>{n=![],document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",z)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const n=t.querySelector(".header");if(n){let t=![],e=0,i=0,o=0,r=0;n.addEventListener("mousedown",n=>{if(n.target.classList.contains("minimize"))return;t=!![],e=n.clientX,i=n.clientY;const a=this.panelElement.getBoundingClientRect();o=a.left,r=a.top,document.addEventListener("mousemove",A),document.addEventListener("mouseup",z),n.preventDefault()});const A=n=>{if(!t||!this.panelElement)return;const a=n.clientX-e,s=n.clientY-i;this.panelElement.style.left=o+a+"px",this.panelElement.style.top=r+s+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},z=()=>{t=![],document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",z)}}}createFloatingButton(){const t=document.createElement("div");return t.className="floating-btn",t.innerHTML="⚙️",t.title="Open Elements Debug Console",t.style.display="none",t.addEventListener("click",()=>{this.toggleVisibility()}),t}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(t){const n=document.createElement("div");n.className="log-entry "+t.type+" "+t.level;const e=new Date(t.timestamp).toLocaleTimeString();return n.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+e+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(t.message)+"\n "+(t.context?'<div class="log-context">'+this.escapeHtml(t.context)+"</div>":"")+"\n "+(t.data?'<div class="log-data"><pre>'+this.formatJsonData(t.data)+"</pre></div>":"")+"\n </div>\n ",n}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(n){return String(t)}}escapeHtml(t){const n=document.createElement("div");return n.textContent=t,n.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.h()){const n=this.u(t);if(n)return this.m(t,n)}return this.cachedFingerprint||(this.cachedFingerprint=this.v()),this.m(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.k(),browser:this.C(),timezone:this._()}}isLocalStorageWebApiAvailable(){return this.h()}m(t,n){return(t+"_"+n).toLowerCase()}h(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const t=window.localStorage,n="__localStorage_test_"+Date.now()+"__",e="test";t.setItem(n,e);const i=t.getItem(n);return i!==e?(this.isLocalStorageAvailable=![],![]):(t.removeItem(n),this.isLocalStorageAvailable=!![],!![])}catch(t){const e=t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name);if(e)try{const t=window.localStorage;return t&&t.length>0?(this.S()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(n){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],t instanceof DOMException){const n={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},e=n[t.name]||"Storage error: "+t.name,i=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+i+": "+e)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}u(t){try{const n=this.clientConfig.get("localStorageKeyPrefix")+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const e=localStorage.key(t);if(null==e?void 0:e.startsWith(n)){const t=e.substring(n.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(n){return null}}v(){const t=this.getFingerprintData(),n=Object.keys(t).sort().map(n=>n+":"+t[n]).join("|");return this.P(n)}k(){try{const t=screen,n=t.colorDepth||24,e=t.pixelDepth||n,i=this.T(),o=Math.round(100*(window.devicePixelRatio||1));return n+"|"+e+"|"+i+"|"+o}catch(t){return"24|24|srgb|100"}}T(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(X){}return"srgb"}C(){var t;try{const n=navigator,e=[],i=((null===(t=n.languages)||void 0===t?void 0:t[0])||n.language||"en").substring(0,2);e.push(i),e.push(n.hardwareConcurrency||4);const o=(n.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);e.push(o),e.push(n.cookieEnabled?"1":"0"),e.push(n.maxTouchPoints||0),e.push(n.deviceMemory||0),e.push(this.D()),e.push(this.S()?"webview":"browser");const r=["bluetooth"in n?"1":"0","usb"in n?"1":"0","mediaDevices"in n?"1":"0","permissions"in n?"1":"0","credentials"in n?"1":"0","storage"in n?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return e.push(r.join("")),e.join("|")}catch(n){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}D(){try{const t=navigator.userAgent.toLowerCase();return t.includes("instagram")?"ig_webview":t.includes("fban")||t.includes("fbav")?"fb_webview":t.includes("tiktok")?"tiktok_webview":t.includes("linkedin")?"linkedin_webview":t.includes("snapchat")?"snapchat_webview":t.includes("twitter")?"twitter_webview":t.includes("line/")?"line_webview":t.includes("micromessenger")?"wechat_webview":t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}S(){try{const t=navigator.userAgent.toLowerCase(),n=navigator,e=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return e.some(n=>t.includes(n))?!![]:void 0===n.standalone||n.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}_(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}P(t){const n=16777619;let e=2166136261,i=2166136261,o=2166136261,r=2166136261;for(let a=0;a<t.length;a++){const s=t.charCodeAt(a);e^=s,e=Math.imul(e,n),i^=s<<1,i=Math.imul(i,n),o^=s<<2,o=Math.imul(o,n),r^=s<<3,r=Math.imul(r,n)}return e=Math.abs(e),i=Math.abs(i),o=Math.abs(o),r=Math.abs(r),e.toString(16)+i.toString(16)+o.toString(16)+r.toString(16)}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance();const n=this.clientConfig.get("env"),e=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:e,batchSize:n===t.PRODUCTION?5:10,batchInterval:n===t.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(t,n,e={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const i=Date.now();try{const o={eventId:"event_"+i,timestamp:i,level:t,message:n,context:e.context,error:e.error?this.buildErrorContext(e.error):void 0,component:e.component,data:e.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(o)}catch(o){this.handleInternalError(o)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const t=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:t||void 0}}buildBrowserContext(){return{userAgent:navigator.userAgent,deviceType:this.clientConfig.get("deviceType"),url:window.location.href,referrer:document.referrer||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}shouldCapture(t){switch(t){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(t){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(t),this.stats.totalEvents++,this.stats.eventsByLevel[t.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var t;if(0===this.eventQueue.length||!(null===(t=this.config)||void 0===t?void 0:t.endpoint))return;const n=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const e=this.createBatch(n);try{this.sendBatch(e),this.stats.batchesSent++}catch(i){this.stats.failedBatches++,this.handleInternalError(i),this.eventQueue.unshift(...n),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const n=Date.now();return{batchId:"batch_"+n,timestamp:n,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const n=new Blob([JSON.stringify(t)],{type:"text/plain"}),e=navigator.sendBeacon(this.config.endpoint,n);if(e)return}catch(n){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const n=new XMLHttpRequest;if(n.open("POST",this.config.endpoint,![]),n.setRequestHeader("Content-Type","text/plain"),n.send(JSON.stringify(t)),n.status<200||n.status>=300)throw new SDKError("XHR request failed with status: "+n.status)}catch(n){throw new SDKError("Both sendBeacon and XHR failed: "+n.message)}}truncateStackTrace(t){if(t)return t.split("\n").slice(0,10).join("\n")}handleInternalError(t){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",t)}shutdown(){var t;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(t=this.config)||void 0===t?void 0:t.endpoint))){const t=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(t),this.stats.batchesSent++}catch(n){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:n}){var e;this.F=Object.freeze(t),this.A=Object.freeze({type:n.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(e=null==n?void 0:n.useShadowDom)&&void 0!==e?e:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(t){return t.map(t=>this.interpolatePath(t))}interpolatePath(t){if("string"!=typeof t)return t;const n=/\{([^}]+)}/g;return t.replace(n,(n,e)=>{const i=this.F[e];return null==i?(this.logger.warn('Parameter "'+e+'" not found in component params for path "'+t+'"'),n):String(i)})}connectedCallback(){var t,n;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.A.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(e){this.logger.error("Component connectedCallback error in "+((null===(n=this.A)||void 0===n?void 0:n.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"connectedCallback")}}disconnectedCallback(){var t,n;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(e){this.logger.error("Component disconnectedCallback error in "+((null===(n=this.A)||void 0===n?void 0:n.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"disconnectedCallback")}}setup(){var t,n,e;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(n=this.beforeConnected)||void 0===n||n.call(this)}catch(i){this.logger.error("Component setup error in "+((null===(e=this.A)||void 0===e?void 0:e.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const n of this.unsubscribers)try{n()}catch(t){this.logger.error("Cleanup error during component destruction",t),t instanceof Error&&this.captureComponentError(t,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var t;if(!this.reactiveOptions.autoDestroy)return;let n=this.reactiveOptions.autoDestroyPath;if(!n&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(n=this.reactiveOptions.watchStorePaths[0]),!n)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const e=this.interpolatePath(n),i=this.store.watch(e,(t,n)=>{this.isDestroyed||void 0===t&&void 0!==n&&this.handleAutoDestroy(e)});this.unsubscribers.push(i)}handleAutoDestroy(t){var n;if(this.isDestroyed)return;null===(n=this.beforeAutoDestroy)||void 0===n?void 0:n.call(this,t);const e=this.reactiveOptions.autoDestroyDelay||0;e>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},e):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(n){this.logger.error("Error during auto-destroy of "+this.A.tagName,n),n instanceof Error&&this.captureComponentError(n,"auto-destroy")}}setupStoreWatchers(){var t;try{let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.F)return;t=this.interpolateStorePaths(t);const n=this.store.watchMany(t,t=>{var n,e;try{if(this.isDestroyed)return;const e=t.map(t=>t.path).join(", "),i="store:["+e+"]",o=null===(n=this.onStoreChanged)||void 0===n?void 0:n.call(this,t);o!==![]&&this.triggerRender(i)}catch(i){this.logger.error("Store watcher callback error in "+((null===(e=this.A)||void 0===e?void 0:e.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"storeWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Store watchers setup error in "+((null===(t=this.A)||void 0===t?void 0:t.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupStoreWatchers")}}setupNonRenderingWatchers(){var t;try{let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.F)return;t=this.interpolateStorePaths(t);const n=this.store.watchMany(t,t=>{var n,e;try{if(this.isDestroyed)return;null===(n=this.onStoreWatch)||void 0===n?void 0:n.call(this,t)}catch(i){this.logger.error("Non-rendering watcher callback error in "+((null===(e=this.A)||void 0===e?void 0:e.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"nonRenderingWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.A)||void 0===t?void 0:t.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupNonRenderingWatchers")}}triggerRender(t){this.lastRenderTrigger=t,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var t,n;if(!this.initialized||this.isDestroyed)return;const e=performance.now();this.renderCount++;try{const n=this.template();"string"==typeof n&&(this.container.innerHTML=n),n instanceof HTMLElement&&safeReplaceChildren(this.container,n),Array.isArray(n)&&safeReplaceChildren(this.container,...n);const o=performance.now()-e;this.logRenderInfo(o);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(i){this.logger.error("❌ afterRender hook error in "+this.A.tagName,i),i instanceof Error&&this.captureComponentError(i,"afterRender")}}catch(o){const t=performance.now()-e;this.logger.error("❌ Component render error in "+this.A.tagName,o),this.captureComponentError(o,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.A.type,message:o instanceof Error?o.message:String(o)}));try{null===(n=this.onError)||void 0===n?void 0:n.call(this,o,"render")}catch(r){this.logger.error("❌ onError hook error in "+this.A.tagName,r)}}}logRenderInfo(t){const n=this.A.type,e=this.A.tagName,i=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+i+" "+n+" </"+e+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&(this.logger.warn("⚠️ Slow render in "+n+"("+e+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:t,threshold:16,componentType:n,tagName:e,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+e+":performance",component:{type:n,tagName:e,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.A.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,n,e){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.A.tagName+":"+n,component:{type:this.A.type,tagName:this.A.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:e,useShadowDom:this.A.useShadowDom}})}catch(i){}}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.add(...n)}}addHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.add(...n)}removeHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.remove(...n)}toggleHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const e of n)this.classList.toggle(e)}addHostAttribute(t,n){t&&"string"==typeof t&&n&&"string"==typeof n&&(this.setAttribute(t,String(n)),this.hostAttributes[t]=String(n))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[n,e]of Object.entries(t))n&&"string"==typeof n&&e&&"string"==typeof e&&this.setAttribute(n,String(e))}get params(){return this.F}get config(){return this.themeProvider.getComponentConfig(this.A.type)}get elementConfig(){return this.A}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,n){return this.store.set(t,n)}watchStore(t,n){const e=this.store.watch(t,n);return this.unsubscribers.push(e),e}}const xt={CT:"America/New_York",DE:"America/New_York",FL:"America/New_York",GA:"America/New_York",IN:"America/New_York",KY:"America/New_York",ME:"America/New_York",MD:"America/New_York",MA:"America/New_York",MI:"America/New_York",NH:"America/New_York",NJ:"America/New_York",NY:"America/New_York",NC:"America/New_York",OH:"America/New_York",PA:"America/New_York",RI:"America/New_York",SC:"America/New_York",TN:"America/New_York",VT:"America/New_York",VA:"America/New_York",WV:"America/New_York",AL:"America/Chicago",AR:"America/Chicago",IL:"America/Chicago",IA:"America/Chicago",KS:"America/Chicago",LA:"America/Chicago",MN:"America/Chicago",MS:"America/Chicago",MO:"America/Chicago",NE:"America/Chicago",ND:"America/Chicago",OK:"America/Chicago",SD:"America/Chicago",TX:"America/Chicago",WI:"America/Chicago",AZ:"America/Phoenix",CO:"America/Denver",ID:"America/Denver",MT:"America/Denver",NV:"America/Los_Angeles",NM:"America/Denver",UT:"America/Denver",WY:"America/Denver",CA:"America/Los_Angeles",OR:"America/Los_Angeles",WA:"America/Los_Angeles",AK:"America/Anchorage",HI:"Pacific/Honolulu"},bt="America/New_York";function detectUserTimezone(t){try{if(t){const n=t.toUpperCase(),e=xt[n];return e||bt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){return bt}}function getCurrentTimeInTimezone(t){try{const n=new Date,e=n.getTime(),i=6e4*n.getTimezoneOffset(),o=new Date(e+i),r=new Date(o.toLocaleString("en-US",{timeZone:t})),a=o.getTime()-r.getTime();return new Date(e+a)}catch(n){return new Date}}function getCurrentTimeInUserTimezone(t){const n=detectUserTimezone(t);return getCurrentTimeInTimezone(n)}function isDateTimeInRange(t){const{startDate:n,endDate:e,addressState:i}=t;try{const t=getCurrentTimeInUserTimezone(i),o=!n||t>=new Date(n),r=!e||t<=new Date(e);return o&&r}catch(o){return![]}}function filterActiveItems(t,n){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:n}))}function hasActiveItems(t,n){return filterActiveItems(t,n).length>0}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){const t=this.store.get("checkout.presale"),n=this.getPromoTickerData(),e=this.checkForActiveTickers(n),o=document.createElement("div");o.classList.add("checkout-container"),this.params.isIndependentComponent&&o.classList.add("independent"),o.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_INFORMATION})),o.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_ORDER_SUMMARY}));const r=this.createHeaderWrapper(t,n,e);return[r,o]}getPromoTickerData(){var t,n;const e=this.getConfigs("global"),i=this.clientConfig.get("promoTicker"),o=null!==(n=null===(t=null==e?void 0:e.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==n?n:[];return null!=i?i:o}checkForActiveTickers(t){var n;const e=this.store.get("address");return hasActiveItems(t,null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state)}createHeaderWrapper(t,n,e){const o=this.params.isIndependentComponent,r=document.createElement("div");return r.classList.add("checkout-header-wrapper"),o&&r.classList.add("hosted"),r.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_HEADER,isHostedCheckout:o})),n.length>0&&e&&!t&&r.appendChild(ComponentFactoryService.createElement({context:"checkout",type:i.PROMO_CODE_TICKER,tickers:n})),t&&r.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_PRESALE_COUNTDOWN})),r}}const ArrowRightIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="arrow-right-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},CheckboxIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="checkbox-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="'+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="chevron-left-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},CloseIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="close-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="error-info-icon '+e+'" style="'+o+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="info-icon '+e+'" style="'+o+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SuccessIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="success-icon '+e+'" style="'+o+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="trash-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:t=16,height:n=16,className:e="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="warning-icon '+e+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,n,e;const i=this.getStoreValue("checkout"),r=Boolean(i.promoCode),a=Boolean(null===(t=i.giftCards)||void 0===t?void 0:t.length),s=this.getConfigs("global"),c=Object.values(i.fulfillments).some(t=>t.type===o.SHIPPING),l=Object.values(i.fulfillments).some(t=>t.type===o.ON_DEMAND),d=[],h=document.createElement("div");h.classList.add("checkout-amount-line");const p=document.createElement("span");p.textContent="Subtotal ("+i.itemsQuantity+" item"+(i.itemsQuantity>1?"s":"")+")",h.appendChild(p);const m=document.createElement("span");if(m.textContent=formatCentToDollarText(i.amounts.subtotal),h.appendChild(m),d.push(h),c){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Shipping",t.appendChild(n);const e=document.createElement("span");e.textContent=formatCentToDollarText(i.amounts.shipping),t.appendChild(e),d.push(t)}if(l){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Delivery",t.appendChild(n);const e=document.createElement("span");e.textContent=formatCentToDollarText(i.amounts.delivery),t.appendChild(e),d.push(t)}if((null===(n=null==i?void 0:i.amounts)||void 0===n?void 0:n.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Engraving",t.appendChild(n);const e=document.createElement("span");e.textContent=formatCentToDollarText(i.amounts.engraving),t.appendChild(e),d.push(t)}const f=document.createElement("div");f.classList.add("checkout-amount-line");const g=document.createElement("span");g.textContent="Taxes & Fees",f.appendChild(g);const v=document.createElement("span");if(v.textContent=formatCentToDollarText(i.amounts.tax+i.amounts.service+i.amounts.platform),f.appendChild(v),d.push(f),r){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Promo Code ("+(null===(e=i.promoCode)||void 0===e?void 0:e.code.toUpperCase())+")",t.appendChild(n);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(i.amounts.discounts),t.appendChild(o),d.push(t)}if(a){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Gift Cards Applied",t.appendChild(n);const e=document.createElement("span");e.textContent="-"+formatCentToDollarText(i.amounts.giftCards),t.appendChild(e),d.push(t)}if(l){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Tips",t.appendChild(n);const e=document.createElement("span");e.textContent=formatCentToDollarText(i.amounts.tip),t.appendChild(e),d.push(t)}const x=document.createElement("div");x.classList.add("checkout-separator"),d.push(x);const b=document.createElement("div");b.classList.add("checkout-amount-total");const w=document.createElement("span");w.textContent="Total",b.appendChild(w);const _=document.createElement("span");if(_.textContent=formatCentToDollarText(i.amounts.total),b.appendChild(_),d.push(b),i.presale){const t=document.createElement("div");t.classList.add("checkout-amount-due");const n=document.createElement("span");n.textContent="Amount due today",t.appendChild(n);const e=document.createElement("span");e.textContent=formatCentToDollarText(0),t.appendChild(e),d.push(t);const i=document.createElement("div");i.classList.add("checkout-presale-locked-message");const o=htmlStringToElement(InfoIcon({color:s.theme.defaultTextColor}));i.appendChild(o);const r=document.createElement("p");r.textContent="Pre-ordered items will be charged when shipped.",i.appendChild(r),d.push(i)}return d}}class CheckoutBillingComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.paymentForm.billingSameAsShipping"]}),this.billingData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},addressOne:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},city:{isValid:![],value:""},state:{isValid:![],value:""},zipCode:{isValid:![],value:""}}}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"),n=document.createElement("div");n.classList.add("checkout-billing-same-as-shipping-toggle-container");const e=document.createElement("div");e.classList.add("checkout-checkbox-container");const i=document.createElement("span");i.id="billingSameAsShipping",i.classList.add("checkout-checkbox-visual"),i.setAttribute("role","checkbox"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label","Billing same as shipping checkbox"),i.setAttribute("aria-checked",t?"true":"false"),t&&i.classList.add("checked"),i.innerHTML=CheckboxIcon({width:16,height:16}),n.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),n.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const o=document.createElement("label");return o.textContent="Billing address same as shipping address",o.setAttribute("for","billingSameAsShipping"),o.classList.add("billing-checkbox-label"),e.appendChild(i),e.appendChild(o),n.appendChild(e),n}updateSaveButtonState(){const t=!Object.values(this.billingData).every(t=>t.isValid),n={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,one:this.billingData.addressOne.value,two:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zip:this.billingData.zipCode.value};this.params.isFormValid(!t,n)}template(){const t=this.getStoreValue("checkout.paymentForm"),n=[],o=this.billingSameAsShippingToggle();if(n.push(o),t.billingSameAsShipping)return n;t.data&&(t.data.firstName&&(this.billingData.firstName={isValid:!![],value:t.data.firstName}),t.data.lastName&&(this.billingData.lastName={isValid:!![],value:t.data.lastName}),t.data.email&&(this.billingData.email={isValid:!![],value:t.data.email}),t.data.phone&&(this.billingData.phone={isValid:!![],value:t.data.phone}),t.data.company&&(this.billingData.company={isValid:!![],value:t.data.company}),t.data.one&&(this.billingData.addressOne={isValid:!![],value:t.data.one}),t.data.two&&(this.billingData.addressTwo={isValid:!![],value:t.data.two}),t.data.city&&(this.billingData.city={isValid:!![],value:t.data.city}),t.data.state&&(this.billingData.state={isValid:!![],value:t.data.state}),t.data.zip&&(this.billingData.zipCode={isValid:!![],value:t.data.zip})),this.updateSaveButtonState();const r=document.createElement("div");r.classList.add("section-title-container");const a=document.createElement("h3");a.textContent="Your billing info",a.classList.add("section-title"),r.appendChild(a);const s=document.createElement("p");s.textContent="Provide the info relevant to your payment method",s.classList.add("section-subtitle"),r.appendChild(s),n.push(r);const c=document.createElement("div");c.classList.add("section-form-container");const l=document.createElement("div");l.classList.add("checkout-two-col-container");const d=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:gt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:gt.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});d.setAttribute("aria-label","First name input"),l.appendChild(d);const h=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:gt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:gt.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});h.setAttribute("aria-label","Last name input"),l.appendChild(h),c.appendChild(l);const p=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:gt.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:gt.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});p.setAttribute("aria-label","Email input"),c.appendChild(p);const m=document.createElement("div");m.classList.add("checkout-two-col-container");const f=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:gt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:gt.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});f.setAttribute("aria-label","Phone input"),m.appendChild(f);const g=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:gt.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:gt.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});g.setAttribute("aria-label","Company input"),m.appendChild(g),c.appendChild(m);const v=document.createElement("div");v.classList.add("checkout-two-col-container");const x=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:gt.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:gt.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});x.setAttribute("aria-label","Street address input"),v.appendChild(x);const b=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:gt.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:gt.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});b.setAttribute("aria-label","Apt, suite, etc. (optional) input"),v.appendChild(b),c.appendChild(v);const w=document.createElement("div");w.classList.add("checkout-three-col-container");const _=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:gt.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:gt.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","City input"),w.appendChild(_);const E=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:gt.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:t=>t&&2===t.length&&/^[A-Z]{2}$/.test(t)?null:"State must be 2 uppercase characters"},onChange:async t=>{this.billingData.state.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:gt.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});E.setAttribute("aria-label","State input"),w.appendChild(E);const S=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:gt.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(e.BILLING,{fieldName:gt.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return S.setAttribute("aria-label","Zip Code input"),w.appendChild(S),c.appendChild(w),n.push(c),n}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(t){const n=t.find(t=>"checkout.customerForm.isSaving"===t.path);n&&(n.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const t=this.store.get("checkout.customerForm.data");t.firstName&&(this.customerData.firstName={isValid:!![],value:t.firstName}),t.lastName&&(this.customerData.lastName={isValid:!![],value:t.lastName}),t.email&&(this.customerData.email={isValid:!![],value:t.email}),t.phone&&(this.customerData.phone={isValid:!![],value:t.phone}),t.company&&(this.customerData.company={isValid:!![],value:t.company}),t.birthDate&&(this.customerData.birthDate={isValid:!![],value:t.birthDate});const n=[],o=document.createElement("div");o.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Buyer Information",r.classList.add("section-title"),o.appendChild(r);const a=document.createElement("p");a.textContent="Buyer information is used to process your order and for delivery purposes.",a.classList.add("section-subtitle"),o.appendChild(a),n.push(o);const s=document.createElement("div");s.classList.add("section-form-container");const c=document.createElement("div");c.classList.add("checkout-two-col-container");const l=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:mt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});c.appendChild(l);const d=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:mt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});c.appendChild(d),s.appendChild(c);const h=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:mt.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});s.appendChild(h);const p=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:mt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});s.appendChild(p);const m=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:mt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});s.appendChild(m);const f=ComponentFactoryService.createElement({type:i.INPUT,inputType:"birthdate",name:mt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return s.appendChild(f),n.push(s),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),n.push(this.saveButton),this.updateSaveButtonState(),n}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const t=[],n=this.getStoreValue("checkout.customerForm.data"),e=document.createElement("div");e.classList.add("checkout-summary-form-header");const i=document.createElement("h2");i.textContent="Buyer: "+n.firstName+" "+n.lastName,e.appendChild(i);const o=document.createElement("span");if(o.textContent="Edit",o.setAttribute("aria-label","Edit Buyer Information"),o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),o.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editCustomerForm())}),e.appendChild(o),t.push(e),n.company){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=n.company,t.push(e)}const r=document.createElement("p");r.classList.add("checkout-summary-form-line"),r.textContent=n.email,t.push(r);const a=document.createElement("p");a.classList.add("checkout-summary-form-line"),a.textContent=n.phone,t.push(a);const s=document.createElement("p");return s.classList.add("checkout-summary-form-line"),s.textContent=formatISODateToMMDDYYYY(n.birthDate),t.push(s),t}}const wt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],kt={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(t,n){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(n)?n:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(n)?n:null:"class"===t?n.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():n.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const n=t.textContent||"",e=n.replace(/<[^>]*>/g,"");if(e.trim()){const t=document.createTextNode(e);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const n=t,e=n.tagName.toLowerCase();if(wt.includes(e)){const t=document.createElement(e),i=kt[e]||[];for(const e of Array.from(n.attributes)){const n=e.name.toLowerCase();if(i.includes(n)){const i=sanitizeAttributeValue(n,e.value);null!==i&&t.setAttribute(n,i)}}"a"===e&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const e of Array.from(n.childNodes)){const n=cleanNode(e);n&&t.appendChild(n)}return t}const i=document.createDocumentFragment();for(const t of Array.from(n.childNodes)){const n=cleanNode(t);n&&i.appendChild(n)}return i.childNodes.length>0?i:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const n=new DOMParser,e=n.parseFromString(t,"text/html"),i=e.querySelector("parsererror");if(i)return console.warn("HTML parsing error detected"),"";const o=document.createDocumentFragment();for(const t of Array.from(e.body.childNodes)){const n=cleanNode(t);n&&o.appendChild(n)}const r=document.createElement("div");return r.appendChild(o),r.innerHTML}catch(n){return console.error("HTML sanitization error:",n),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,n,e,o,r,a;const s=[],c=this.getConfigs("configurations"),l=this.getConfigs("global"),d=this.getConfigs("checkout"),h=this.config.layout.continueShoppingUrl||window.location.host,p=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(n=null===(t=this.config.layout)||void 0===t?void 0:t.checkoutCompleted)||void 0===n?void 0:n.customLogo){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const n=document.createElement("img");n.src=null===(o=null===(e=this.config.layout)||void 0===e?void 0:e.checkoutCompleted)||void 0===o?void 0:o.customLogo,n.alt=c.partnerName+" Logo",t.appendChild(n),s.push(t)}const m=document.createElement("div");m.classList.add("checkout-completed-section-container");const f=document.createElement("div");f.classList.add("checkout-completed-title-container");const g=document.createElement("div");g.classList.add("checkout-completed-title-section");const v=document.createElement("h3");v.innerHTML=(null===(a=null===(r=this.config.layout)||void 0===r?void 0:r.checkoutCompleted)||void 0===a?void 0:a.customText)||"Thank You for Your Order!",g.appendChild(v);const x=document.createElement("p");x.textContent="Your payment has been successfully processed.",g.appendChild(x),f.appendChild(g),m.appendChild(f);const b=document.createElement("div");b.classList.add("checkout-completed-sub-section");const w=document.createElement("div");w.classList.add("checkout-completed-line");const _=document.createElement("h3");_.textContent="Order Number",w.appendChild(_);const E=document.createElement("span");E.textContent=this.params.orderNumber,w.appendChild(E),b.appendChild(w);const S=document.createElement("div");S.classList.add("checkout-completed-line");const P=document.createElement("h3");P.textContent="Order Amount",S.appendChild(P);const D=document.createElement("span");D.textContent=""+formatCentToDollarText(this.params.orderTotal),S.appendChild(D),b.appendChild(S);const F=document.createElement("div");F.classList.add("checkout-completed-line");const I=document.createElement("h3");I.textContent="Payment Method",F.appendChild(I);const O=document.createElement("span");O.textContent="** "+this.params.cardLast4,F.appendChild(O),b.appendChild(F),m.appendChild(b);const M=document.createElement("div");M.classList.add("checkout-completed-sub-section");const L=document.createElement("p");L.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<br><br>A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.":"A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.",M.appendChild(L),m.appendChild(M),s.push(m);const R=document.createElement("div");R.classList.add("checkout-completed-section-container");const j=document.createElement("button");j.type="button";const N=document.createElement("span");N.textContent=p,j.setAttribute("tabindex","0"),j.setAttribute("role","button"),j.setAttribute("aria-label",p),j.appendChild(N);const B=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:l.theme.selectedTextColor}));j.appendChild(B),j.addEventListener("click",()=>{window.location.href=h}),j.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=h)}),R.appendChild(j),s.push(R);const q=document.createElement("div");q.classList.add("checkout-completed-section-container");const U=document.createElement("div");U.classList.add("checkout-completed-help-section"),q.appendChild(U);const V=document.createElement("p");V.textContent="Questions about your order? Contact us at ";const H=document.createElement("a");H.href="mailto:"+c.supportEmail,H.textContent=c.supportEmail,V.appendChild(H),U.appendChild(V);const K=document.createElement("p"),Y=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(K.textContent="Order placed on "+Y,U.appendChild(K),s.push(q),d.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(d.layout.legalMessage.text);const e=document.createElement("div");e.classList.add("checkout-separator"),s.push(t),s.push(n),s.push(e)}if(l.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});s.push(t)}return s}}class CheckoutDeliverToComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift"],watchOnlyStorePaths:["checkout.customerForm.isSaving","checkout.giftRecipientForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},birthDate:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.giftData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},message:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.saveButtonText="Save Delivery Information"}onStoreWatch(t){const n=t.find(t=>"checkout.customerForm.isSaving"===t.path),e=t.find(t=>"checkout.giftRecipientForm.isSaving"===t.path);(null==n?void 0:n.value)||(null==e?void 0:e.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const t=this.getStoreValue("checkout.isGift")||![];let n;n=t?!(this.giftData.firstName.isValid&&this.giftData.lastName.isValid&&this.giftData.email.isValid&&this.giftData.phone.isValid&&this.giftData.message.isValid&&this.giftData.addressTwo.isValid):!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid),this.saveButton.disabled=n}template(){const t=this.getConfigs("global"),n=this.getStoreValue("checkout.isGift"),r=this.store.get("checkout.giftRecipientForm.data"),a=this.store.get("checkout.customerForm.data"),s=this.store.get("checkout.shippingAddress"),c=n?r:a,l=this.store.get("checkout.deliveryInstructions");a.firstName&&(this.customerData.firstName={isValid:!![],value:a.firstName}),a.lastName&&(this.customerData.lastName={isValid:!![],value:a.lastName}),a.email&&(this.customerData.email={isValid:!![],value:a.email}),a.phone&&(this.customerData.phone={isValid:!![],value:a.phone}),a.company&&(this.customerData.company={isValid:!![],value:a.company}),a.birthDate&&(this.customerData.birthDate={isValid:!![],value:a.birthDate}),r.firstName&&(this.giftData.firstName={isValid:!![],value:r.firstName}),r.lastName&&(this.giftData.lastName={isValid:!![],value:r.lastName}),r.email&&(this.giftData.email={isValid:!![],value:r.email}),r.phone&&(this.giftData.phone={isValid:!![],value:r.phone}),r.message&&(this.giftData.message={isValid:!![],value:r.message}),s.address.two&&(this.customerData.addressTwo={isValid:!![],value:s.address.two},this.giftData.addressTwo={isValid:!![],value:s.address.two}),l&&(this.customerData.deliveryInstructions={isValid:!![],value:l},this.giftData.deliveryInstructions={isValid:!![],value:l});const d=this.store.get("checkout.fulfillments")||{},h=Object.values(d).some(t=>t.type===o.ON_DEMAND),p=[],m=document.createElement("div");m.classList.add("delivery-header-container");const f=document.createElement("div");f.classList.add("delivery-header-content");const g=document.createElement("div");g.classList.add("delivery-title-container");const v=document.createElement("h3");v.textContent="Deliver to",v.classList.add("delivery-title");const x=document.createElement("p");x.textContent="Package recipient must be 21+",x.classList.add("delivery-subtitle"),g.appendChild(v),g.appendChild(x),m.appendChild(g),p.push(m);const b=document.createElement("div");b.classList.add("section-form-container");const w=document.createElement("div");w.classList.add("checkout-two-col-container");const _=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:n?ft.firstName:mt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:c.firstName,onChange:t=>{n?(this.giftData.firstName.value=t,this.pubSub.publishForm(e.GIFT,{fieldName:ft.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.firstName}))},onValidation:t=>{n?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","First Name Input"),w.appendChild(_);const E=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:n?ft.lastName:mt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:c.lastName,onChange:t=>{n?(this.giftData.lastName.value=t,this.pubSub.publishForm(e.GIFT,{fieldName:ft.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.lastName}))},onValidation:t=>{n?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(E.setAttribute("aria-label","Last Name Input"),w.appendChild(E),b.appendChild(w),!n){const t=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:mt.company,label:"Company (optional)",autocomplete:!![],value:c.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),b.appendChild(t)}const S=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:n?ft.email:mt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:c.email,onChange:t=>{n?(this.giftData.email.value=t,this.pubSub.publishForm(e.GIFT,{fieldName:ft.email})):(this.customerData.email.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.email}))},onValidation:t=>{n?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});S.setAttribute("aria-label","Email Input"),b.appendChild(S);const P=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:n?ft.phone:mt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:c.phone,onChange:t=>{n?(this.giftData.phone.value=t,this.pubSub.publishForm(e.GIFT,{fieldName:ft.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.phone}))},onValidation:t=>{n?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(P.setAttribute("aria-label","Phone Input"),b.appendChild(P),!n){const t=ComponentFactoryService.createElement({type:i.INPUT,inputType:"birthdate",name:mt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:c.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),b.appendChild(t)}const D=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:s.formattedAddress,disabled:!![],className:"disabled-input"});D.setAttribute("aria-label","Delivery Address Input"),b.appendChild(D);const F=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:n?ft.addressTwo:mt.addressTwo,label:"Apt, suite, etc. (optional)",value:s.address.two,onChange:t=>{n?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(e.GIFT,{fieldName:ft.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(e.CUSTOMER,{fieldName:mt.addressTwo}))},onValidation:t=>{n?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(F.setAttribute("aria-label","Address Line 2 Input"),b.appendChild(F),n){const n=document.createElement("div");n.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Gift Message*",i.setAttribute("for",ft.message);const o=document.createElement("textarea");o.name=ft.message,o.id=ft.message,o.rows=4,o.value=r.message||"",o.setAttribute("aria-label","Gift Message Textarea"),o.addEventListener("input",async t=>{const n=t.target.value;this.giftData.message.value=n,this.giftData.message.isValid=n.length>0,this.pubSub.publishForm(e.GIFT,{fieldName:ft.message}),this.updateSaveButtonState()});const a=document.createElement("p");a.textContent="Your gift message will be emailed to the recipient along with delivery details.",a.classList.add("textarea-message-disclaimer"),n.appendChild(i),n.appendChild(o),n.appendChild(a),b.appendChild(n)}if(h){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Delivery Instructions",i.setAttribute("for","delivery_instructions");const o=document.createElement("textarea");o.id="delivery_instructions",o.name="delivery_instructions",o.rows=4,o.setAttribute("aria-label","Delivery Instructions Textarea"),o.value=l,o.addEventListener("input",async t=>{const e=t.target.value;n?(this.giftData.deliveryInstructions.value=e,this.giftData.deliveryInstructions.isValid=e.length>0):(this.customerData.deliveryInstructions.value=e,this.customerData.deliveryInstructions.isValid=e.length>0)});const r=document.createElement("p");r.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",r.classList.add("textarea-message-disclaimer"),e.appendChild(i),e.appendChild(o),e.appendChild(r),b.appendChild(e)}p.push(b),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const T=async()=>{n?await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}):await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:this.customerData.deliveryInstructions.value})};return this.saveButton.addEventListener("click",T),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await T())}),p.push(this.saveButton),this.updateSaveButtonState(),p}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const t=[],n=this.getStoreValue("checkout.isGift"),e=this.getStoreValue("checkout.customerForm.data"),i=this.getStoreValue("checkout.giftRecipientForm.data"),o=this.getStoreValue("checkout.shippingAddress"),r=this.getStoreValue("checkout.deliveryInstructions"),a=document.createElement("div");a.classList.add("checkout-summary-form-header");const s=document.createElement("h2");s.textContent=n?"Delivering to "+i.firstName+" "+i.lastName:"Delivering to "+e.firstName+" "+e.lastName,a.appendChild(s);const c=document.createElement("span");c.textContent="Edit",c.setAttribute("aria-label","Edit Delivery Information"),c.setAttribute("role","button"),c.setAttribute("tabindex","0");const C=async()=>{n?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(c.addEventListener("click",C),c.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await C())}),a.appendChild(c),t.push(a),!n&&e.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=e.company,t.push(n)}const l=document.createElement("p");l.classList.add("checkout-summary-form-line"),l.textContent=o.formattedAddress,t.push(l);const d=document.createElement("p");d.classList.add("checkout-summary-form-line"),d.textContent=n?i.email:e.email,t.push(d);const h=document.createElement("p");if(h.classList.add("checkout-summary-form-line"),h.textContent=n?i.phone:e.phone,t.push(h),!n&&e.birthDate){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=formatISODateToMMDDYYYY(e.birthDate),t.push(n)}if(n){const n=document.createElement("div");n.classList.add("checkout-summary-form-line-container");const e=document.createElement("span");e.classList.add("checkout-summary-form-line-container-label"),e.textContent="Gift Message:",n.appendChild(e);const o=document.createElement("span");o.classList.add("checkout-summary-form-line"),o.textContent=i.message||"No message provided.",n.appendChild(o),t.push(n)}if(r){const n=document.createElement("div");n.classList.add("checkout-summary-form-line-container");const e=document.createElement("span");e.classList.add("checkout-summary-form-line-container-label"),e.textContent="Delivery Instructions:",n.appendChild(e);const i=document.createElement("span");i.classList.add("checkout-summary-form-line"),i.textContent=r||"No instructions provided.",n.appendChild(i),t.push(n)}return t}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(t){var n;const e=t.find(t=>"checkout.giftCards"===t.path),i=t.find(t=>"checkout.loading"===t.path);e&&e.value.length>((null===(n=e.oldValue)||void 0===n?void 0:n.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),i&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),n=t.length>=3&&t.length<=255,e=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!n||e||Boolean(i)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const n=t.toUpperCase(),e=this.giftCardInput;e.setValue(n),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const y=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(n){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",y),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const t=[];return t.push(this.createGiftCardInput()),t.push(this.createApplyButton()),t}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){var t,n;const e=this.store.get("checkout.presale"),o=this.getConfigs("checkout"),r=null!==(n=null===(t=this.params)||void 0===t?void 0:t.isHostedCheckout)&&void 0!==n?n:![];let a=null;if(!e){a=document.createElement("button"),a.type="button",a.classList.add("checkout-header-button"),a.setAttribute("aria-label",r?"Back":"Back to Cart"),a.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back Button Is Disabled In Builder Mode"),void 0;if(r){const t=null==o?void 0:o.layout.continueShoppingUrl;t&&(window.location.href=t)}else this.commands.ui.openDrawer(i.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),a.appendChild(t)}const s=document.createElement("h1");if(s.textContent=(null==o?void 0:o.layout.drawerHeaderText)||"Checkout",s.classList.add("checkout-header-title"),s.setAttribute("aria-label","Checkout Page"),r){const t=document.createElement("div");return t.classList.add("checkout-header-spacer"),a?[a,s,t]:[s,t]}const c=document.createElement("button");return c.innerHTML=CloseIcon({width:16,height:16}),c.classList.add("checkout-header-button-close"),c.setAttribute("aria-label","Close Checkout"),c.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),a?[a,s,c]:[s,c]}}class CheckoutInformationComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift","checkout.customerForm.isEditing","checkout.giftRecipientForm.isEditing","checkout.paymentForm.isEditing"]})}onStoreWatch(){const t=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm.isEditing"),e=this.getStoreValue("checkout.giftRecipientForm.isEditing"),i=this.getStoreValue("checkout.paymentForm.isEditing");t?(this.buyerForm.style.display=n?"block":"none",this.buyerSummary.style.display=n?"none":"block",this.deliveryToForm.style.display=e?"block":"none",this.deliverToSummary.style.display=e?"none":"block"):(this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=i?"block":"none",this.paymentSummary.style.display=i?"none":"block"}template(){const t=[],n=this.getStoreValue("checkout.isGift"),e=this.getStoreValue("checkout.customerForm"),o=this.getStoreValue("checkout.giftRecipientForm"),r=this.getStoreValue("checkout.paymentForm"),a=ComponentFactoryService.createElement({type:i.CHECKOUT_SEND_AS_GIFT});return t.push(a),this.deliveryToForm=ComponentFactoryService.createElement({type:i.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=n?o.isEditing?"block":"none":e.isEditing?"block":"none",t.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=n?o.isEditing?"none":"block":e.isEditing?"none":"block",t.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:i.CHECKOUT_BUYER}),this.buyerForm.style.display=n&&e.isEditing?"block":"none",t.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=n&&!e.isEditing?"block":"none",t.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:i.CHECKOUT_PAYMENT}),this.paymentForm.style.display=r.isEditing?"block":"none",t.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=r.isEditing?"none":"block",t.push(this.paymentSummary),t}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(t){var n,e,i,o;const r=t.find(t=>"checkout.items"===t.path);r&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const a=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(a){const t=a.oldValue,r=a.value;if(r.updating)return![];const s=(null==t?void 0:t.quantity)!==(null==r?void 0:r.quantity),c=(null===(e=null===(n=null==t?void 0:t.attributes)||void 0===n?void 0:n.engraving)||void 0===e?void 0:e.lines)||[],l=(null===(o=null===(i=null==r?void 0:r.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],d=JSON.stringify(c)!==JSON.stringify(l);(s||d)&&this.updateEngravingElement(r)}return![]}updateEngravingElement(t){var n,e;const o=this.getConfigs("global"),r=this.container.querySelector(".engraving-view-container");if(r&&r.remove(),(null===(e=null===(n=null==t?void 0:t.attributes)||void 0===n?void 0:n.engraving)||void 0===e?void 0:e.hasEngraving)===!![]&&o.layout.enablePersonalization){const n=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),e=this.container.querySelector(".checkout-item-card-footer");e&&e.before(n)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const n=t.fulfillmentId;if(!n)return;if(!this.container)return;const e=this.container.querySelector(".checkout-item-card-header");if(e){const t=this.getStoreValue("cart.fulfillments."+n),o=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(o&&o.remove(),t.hasUnmetMinimumPurchaseAmount){const n=ComponentFactoryService.createElement({type:i.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(t.minimumPurchaseAmount-t.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:t.subtotal,config:{showIcon:!![],alertType:"minimal"}});n.setAttribute("data-component-type","checkout-retailer-alert"),e.before(n)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),n=Object.keys(t.items).length,e=1===n;this.trashButton.disabled=e,e?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","item-loading-overlay");const n=document.createElement("div");n.className="cart-loading-spinner-container";const e=document.createElement("div");return e.className="cart-loading-spinner",e.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(e),t.appendChild(n),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="item-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const t=this.getStoreValue("checkout.items."+this.params.itemId);return t?t.updating===!![]:![]}checkAndUpdateLoadingState(){const t=this.isItemUpdating(),n=this.hasLoadingOverlay();t&&!n?this.showLoadingOverlay():!t&&n&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,n,e;const o=this.getConfigs("global"),r=this.getStoreValue("checkout.items."+this.params.itemId),a=null===(t=null==r?void 0:r.attributes)||void 0===t?void 0:t.presale,s=(null==a?void 0:a.isActive)&&(null==a?void 0:a.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(a.estimatedShipBy):"";if(!r)return[];const c=this.getStoreValue("checkout.fulfillments."+r.fulfillmentId),l=this.getStoreValue("checkout.retailers."+r.retailerId),d=document.createElement("div");d.classList.add("checkout-item-card-header");const h=document.createElement("div");h.classList.add("checkout-item-image");const p=document.createElement("img");p.src=r.mainImage,p.alt=r.name,p.loading="lazy",h.appendChild(p),d.appendChild(h);const m=document.createElement("div");m.classList.add("checkout-item-details-container");const f=document.createElement("h4");f.classList.add("checkout-item-title"),f.textContent=r.name,m.appendChild(f);const g=document.createElement("div");g.classList.add("checkout-item-subtitle");const v=document.createElement("span");v.textContent=a.isActive?s+",":(r.attributes.engraving.hasEngraving?null==c?void 0:c.engravingExpectation:null==c?void 0:c.expectation)+",",g.appendChild(v);const x=document.createElement("span");x.textContent="From "+((null==l?void 0:l.name)||"Retailer"),g.appendChild(x),m.appendChild(g),d.appendChild(m),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var n;if(t.preventDefault(),t.stopPropagation(),!(null===(n=this.trashButton)||void 0===n?void 0:n.disabled))try{await this.commands.checkout.removeItem(r.cartItemId)}catch(e){this.logger.error("Checkout item removal failed",e)}}),d.appendChild(this.trashButton);const b=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM_QUANTITY,itemId:r.cartItemId}),w=[];if(w.push(d),o.layout.enablePersonalization&&(null===(e=null===(n=null==r?void 0:r.attributes)||void 0===n?void 0:n.engraving)||void 0===e?void 0:e.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:r.cartItemId,context:"checkout"});w.push(t)}return w.push(b),w}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(t){const n=t.find(t=>"checkout.items"===t.path);if(n){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,n,e;const i=this.getStoreValue("checkout.items."+this.params.itemId);if(!i)return 0;const o=this.getStoreValue("products");if(!o)return 0;const r=i.partNumber,a=i.fulfillmentId,s=null===(e=null===(n=null===(t=Object.values(o).find(t=>t.sizes[i.liquidId]))||void 0===t?void 0:t.sizes)||void 0===n?void 0:n[i.liquidId])||void 0===e?void 0:e.maxQuantityPerOrder;if(!s)return 0;const c=this.getStoreValue("checkout.items")||{},l=Object.values(c).filter(t=>t.partNumber===r&&t.fulfillmentId===a),d=l.reduce((t,n)=>t+n.quantity,0);return s-d}calculateQuantityLimits(){var t;const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const e=this.getStoreValue("checkout"),i=1===(null===(t=Object.values(e.items))||void 0===t?void 0:t.length),o=n.quantity,r=this.getAvailableQuantity(),a=r>0,s=!(i&&1===o);return{currentQuantity:o,availableQuantity:r,isTheOnlyItem:i,canIncrease:a,canDecrease:s}}updateButtonStates(t){this.decreaseButton&&(this.decreaseButton.disabled=!t.canDecrease,this.decreaseButton.classList.toggle("disabled",!t.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!t.canIncrease,this.increaseButton.classList.toggle("disabled",!t.canIncrease),t.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const n=this.calculateQuantityLimits(),e=this.params.itemId;if((!(t<0)||n.canDecrease)&&(!(t>0)||n.canIncrease)){if(!e)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:t}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(e,t)}catch(i){this.logger.error("Checkout item quantity change operation failed",i)}}}template(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const n=this.calculateQuantityLimits(),e=document.createElement("div");e.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),e.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),e.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),e.appendChild(this.increaseButton),this.updateButtonStates(n);const i=document.createElement("span");if(i.classList.add("checkout-item-price-text"),i.textContent=formatCentToDollarText(t.price),t.quantity>1){const n=document.createElement("span");n.classList.add("checkout-item-price-each-text"),n.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",i.appendChild(n)}return[e,i]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]}),this.togglerElement=null,this.togglerButton=null,this.togglerLabel=null,this.itemsList=null}createItemElement(t){return ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM,itemId:t})}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},n=new Map;for(const e of Object.values(t))e&&e.cartItemId&&n.set(e.cartItemId,e);return n}syncItemsWithStore(){if(!this.itemsList)return;const t=this.getCurrentItemsMap(),n=this.itemsList.querySelectorAll("[data-item-id]"),e=new Set;for(const i of n){const t=i.getAttribute("data-item-id");t&&e.add(t)}for(const i of n){const n=i.getAttribute("data-item-id");n&&!t.has(n)&&i.remove()}for(const[i]of t)if(!e.has(i)){const t=this.createItemElement(i);t.setAttribute("data-item-id",i),this.itemsList.appendChild(t)}if(this.togglerLabel){const t=this.getStoreValue("checkout.itemsQuantity");this.togglerLabel.textContent=t+" item"+(t>1?"s":"")}}onStoreChanged(t){let n=null;for(let e=0;e<t.length;e++){const i=t[e];if("checkout"===i.path||"checkout.items"===i.path||"checkout.items."===i.path.substring(0,15)){n=i;break}}return n?(this.syncItemsWithStore(),![]):![]}handleToggle(){if(!this.togglerButton||!this.itemsList)return;const t=this.itemsList.classList.contains("show");this.itemsList.classList.toggle("show"),this.togglerButton.classList.toggle("expanded"),t?(this.togglerButton.setAttribute("aria-expanded","false"),this.togglerButton.setAttribute("aria-label","Expand checkout items")):(this.togglerButton.setAttribute("aria-expanded","true"),this.togglerButton.setAttribute("aria-label","Collapse checkout items"))}setupToggler(){if(!this.togglerElement||!this.togglerButton||!this.itemsList)return;const t=this.itemsList.classList.contains("show");this.togglerButton.setAttribute("tabindex","0"),this.togglerButton.setAttribute("aria-expanded",t?"true":"false"),this.togglerButton.setAttribute("aria-label",t?"Collapse checkout items":"Expand checkout items"),this.togglerElement.addEventListener("click",()=>this.handleToggle()),this.togglerElement.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.itemsQuantity"),n=this.getStoreValue("checkout.items");this.togglerElement=document.createElement("div"),this.togglerElement.classList.add("checkout-items-toggler"),this.togglerLabel=document.createElement("span"),this.togglerLabel.classList.add("checkout-items-toggler-label"),this.togglerLabel.textContent=t+" item"+(t>1?"s":""),this.togglerElement.appendChild(this.togglerLabel),this.togglerButton=document.createElement("button"),this.togglerButton.type="button",this.togglerButton.classList.add("checkout-items-toggler-button"),this.togglerButton.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),this.togglerElement.appendChild(this.togglerButton),this.itemsList=document.createElement("div"),this.itemsList.classList.add("checkout-items-list","show");for(const e of Object.values(n)){const t=this.createItemElement(e.cartItemId);t.setAttribute("data-item-id",e.cartItemId),this.itemsList.appendChild(t)}return[this.togglerElement,this.itemsList]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const n=t.find(t=>"checkout.amounts"===t.path);if(n){const t=this.getStoreValue("checkout"),n=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&n>0)}}updateZeroAmountElement(t){const n=this.container.querySelector(".checkout-zero-amount-container");if(t&&!n){const t=document.createElement("div");t.classList.add("checkout-zero-amount-container"),t.textContent="Credit card required to complete order (even when fully covered by gift card)";const n=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");n&&n.after(t)}else!t&&n&&n.remove()}afterRender(){const t=this.getStoreValue("checkout.amounts");t&&this.updateZeroAmountElement(0===t.total)}handleEmailToggle(t){this.commands.checkout.toggleMarketingPreferences("canEmail"),t.classList.toggle("checked");const n=t.classList.contains("checked");t.setAttribute("aria-checked",n?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const n=t.classList.contains("checked");t.setAttribute("aria-checked",n?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,n=this.config.layout.smsOptIn;if(!t.show&&!n.show)return null;const e=document.createElement("div");if(e.classList.add("checkout-marketing-opt-ins-container"),t.show){const n=document.createElement("div");let i;n.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const o=document.createElement("span");o.id="emailOptIn",o.classList.add("checkout-checkbox-visual"),i&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),o.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Email opt-in checkbox"),o.setAttribute("aria-checked",i?"true":"false"),o.addEventListener("click",()=>this.handleEmailToggle(o)),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(o))});const r=document.createElement("label");r.setAttribute("for","emailOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(t.text),r.addEventListener("click",t=>{const n=t.target,e="A"===n.tagName||n.closest("a");e||(this.commands.checkout.toggleMarketingPreferences("canEmail"),o.classList.toggle("checked"))}),n.appendChild(o),n.appendChild(r),e.appendChild(n)}if(n.show){const t=document.createElement("div");let i;t.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?n.checked:this.store.get("checkout.marketingPreferences.canSms");const o=document.createElement("span");o.classList.add("checkout-checkbox-visual"),o.id="smsOptIn",i&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),o.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","SMS opt-in checkbox"),o.setAttribute("aria-checked",i?"true":"false"),o.addEventListener("click",()=>this.handleSmsToggle(o)),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(o))});const r=document.createElement("label");r.setAttribute("for","smsOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(n.text),r.addEventListener("click",t=>{const n=t.target,e="A"===n.tagName||n.closest("a");e||(this.commands.checkout.toggleMarketingPreferences("canSms"),o.classList.toggle("checked"))}),t.appendChild(o),t.appendChild(r),e.appendChild(t)}return e}hasOnDemandOrder(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).some(t=>t.type===o.ON_DEMAND)}template(){var t;const n=[],e=this.getConfigs("global"),o=this.getConfigs("checkout"),r=this.getConfigs("global"),a=o.layout.allowGiftCards,s=null===(t=null==r?void 0:r.layout)||void 0===t?void 0:t.allowPromoCodes,c=document.createElement("div");c.classList.add("section-title-container");const l=document.createElement("h3");l.textContent="Order Summary",l.classList.add("section-title"),c.appendChild(l),n.push(c);const d=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEMS});n.push(d);const h=document.createElement("div");h.classList.add("checkout-separator");const p=document.createElement("div");if(p.classList.add("checkout-separator"),n.push(h),a||s){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_PC_GC});n.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_TIPS});n.push(t),n.push(p)}const m=document.createElement("div");m.classList.add("section-title-container");const f=document.createElement("h3");f.textContent="100% Secure Payments",f.classList.add("disclaimer-header"),m.appendChild(f);const g=document.createElement("p");g.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",g.classList.add("disclaimer-description"),m.appendChild(g),n.push(m);const v=ComponentFactoryService.createElement({type:i.CHECKOUT_AMOUNTS});n.push(v);const x=ComponentFactoryService.createElement({type:i.CHECKOUT_PLACE_ORDER_BUTTON});n.push(x);const b=this.marketingOptInsContainer();if(b&&n.push(b),o.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const e=document.createElement("div");e.classList.add("checkout-legal-message"),e.innerHTML=sanitizeHTML(o.layout.legalMessage.text),n.push(t),n.push(e)}const w=document.createElement("div");if(w.classList.add("checkout-separator"),n.push(w),e.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});n.push(t)}return n}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.hardcodedPaymentElement=null,this.billingFormData=null,this.isValidBillingForm=![],this.isBillingSameAsShipping=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.savedCardInfo=null,this.showingStripeSummary=![],this.isSavingPayment=![]}onStoreWatch(t){for(const n of t)switch(n.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=n.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(n.value)}}handleBillingSameAsShippingChange(t){this.isBillingSameAsShipping=t,t&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var t;this.isBillingSameAsShipping=null!==(t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==t?t:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let t=!![],n="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)n="Saving...",t=!![];else if(this.stripeFormStatus.hasError)n="Fix Errors and Retry",t=![];else if(this.showingStripeSummary&&this.savedCardInfo){const n=this.isBillingSameAsShipping||this.isValidBillingForm;t=!n}else{const n=this.stripeFormStatus.isFormComplete,e=this.isBillingSameAsShipping||this.isValidBillingForm;t=!(n&&e)}this.saveButton.disabled=t,this.saveButton.textContent=n,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let t="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?t=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(t="Please complete the billing address form"),t?(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(t){this.errorMessageElement&&(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===t&&(this.errorMessageElement.style.display="none")},5e3))}template(){const t=[],n=document.createElement("div");n.classList.add("section-title-container");const e=document.createElement("h3");e.textContent="Payment",e.classList.add("section-title"),n.appendChild(e);const o=document.createElement("p");if(o.textContent="All transactions are secure and encrypted.",o.classList.add("section-subtitle"),n.appendChild(o),t.push(n),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const n=document.createElement("p");n.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(n),t.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:i.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:t=>{this.stripeFormStatus=t,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:t=>{this.savedCardInfo=t},onEditModeVisibilityChanged:t=>{this.showingStripeSummary=t,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(t,n)=>{const e={paymentSession:{confirmationTokenId:t,setupIntentId:n}};!this.isBillingSameAsShipping&&this.billingFormData&&(e.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(e)}}}),t.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),t.push(this.errorMessageElement);const r=ComponentFactoryService.createElement({type:i.CHECKOUT_BILLING,isFormValid:(t,n)=>{this.billingFormData=n,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return t.push(r),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleSaveButtonClick())}),t.push(this.saveButton),t}async handleSaveButtonClick(){var t;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(n){this.logger.error("Failed to save payment form in edit mode",n),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(e){this.logger.error("Failed to save payment form in beta mode",e),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(t=this.stripeHandlerElement)||void 0===t||t.submitStripeForm())}validatePrerequisites(){return this.isBillingSameAsShipping||this.isValidBillingForm?this.stripeFormStatus.isFormComplete?!![]:(this.showError("Please complete all required payment fields."),![]):(this.showError("Please complete the billing address form before saving."),![])}disconnected(){var t;this.isSavingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var t,n,e,i,o,r,a,s,c;const l=[],d=this.getStoreValue("checkout.paymentForm"),h=document.createElement("div");h.classList.add("checkout-summary-form-header");const p=document.createElement("h2");p.textContent="Paying with "+(null!==(e=null===(n=null===(t=d.paymentMethod)||void 0===t?void 0:t.card)||void 0===n?void 0:n.brand)&&void 0!==e?e:"")+" "+(null===(o=null===(i=d.paymentMethod)||void 0===i?void 0:i.card)||void 0===o?void 0:o.last4),h.appendChild(p);const m=document.createElement("span");m.textContent="Edit",m.setAttribute("aria-label","Edit Payment Information"),m.setAttribute("role","button"),m.setAttribute("tabindex","0"),m.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),m.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editPaymentForm())}),h.appendChild(m),l.push(h);const f=document.createElement("p");return f.classList.add("checkout-summary-form-line"),f.textContent="Exp. "+(null===(a=null===(r=d.paymentMethod)||void 0===r?void 0:r.card)||void 0===a?void 0:a.expMonth)+"/"+(null===(c=null===(s=d.paymentMethod)||void 0===s?void 0:s.card)||void 0===c?void 0:c.expYear),l.push(f),l}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.error","checkout.customerForm.isValid","checkout.giftRecipientForm.isValid","checkout.paymentForm.isValid"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreWatch(t){const n=t.some(t=>"checkout.loading"===t.path||"checkout.error"===t.path||"checkout.customerForm.isValid"===t.path||"checkout.giftRecipientForm.isValid"===t.path||"checkout.paymentForm.isValid"===t.path);n&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.loading")||![],n=this.store.get("checkout.error")||null;this.updateErrorDisplay(n);const e=this.determineButtonState({isCheckoutLoading:t,hasCheckoutError:!!n});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(e.state),this.placeOrderButton.disabled=e.disabled,this.placeOrderButton.textContent=e.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const n=this.errorContainer.querySelector(".error-text");n&&(this.clearErrorTimeout(),t?(n.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(n.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:t,hasCheckoutError:n}){const e=this.config.layout.placeOrderButtonText,i=this.store.get("checkout.presale");let o=![];if(!i){const t=this.getStoreValue("cart.fulfillments")||{};o=Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}const r=this.store.get("checkout.isGift"),a=this.store.get("checkout.customerForm.isValid"),s=this.store.get("checkout.giftRecipientForm.isValid"),c=this.store.get("checkout.paymentForm.isValid");return o||r&&!s||!a||!c?{state:"disabled",text:e,disabled:!![]}:t?{state:"processing",text:"Placing Order...",disabled:!![]}:n?{state:"disabled",text:e,disabled:!![]}:{state:"ready",text:e,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const t=this.store.get("checkout.loading");if(t)return;await this.commands.checkout.checkoutComplete()}catch(t){this.logger.error("Error handling place order click",t)}}template(){const t=document.createElement("button");t.type="button",t.textContent=this.config.layout.placeOrderButtonText,t.classList.add("checkout-place-order-button"),t.disabled=!![],t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label","Place Order"),t.addEventListener("click",this.handlePlaceOrderClick.bind(this)),t.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handlePlaceOrderClick())});const n=document.createElement("div");n.classList.add("checkout-error-wrapper"),n.setAttribute("role","alert"),n.style.display="none";const e=document.createElement("div");e.classList.add("checkout-error");const o=document.createElement("span");o.classList.add("icon-error"),o.innerHTML=ErrorInfoIcon({});const r=document.createElement("span");r.classList.add("error-text"),e.appendChild(o),e.appendChild(r),n.appendChild(e);const a=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[n,a,t]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.initialDurationSeconds=null,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var n;const e=t.find(t=>"checkout.presale"===t.path);if(null==e?void 0:e.value)return this.updateExpiresAt(e.value.expiresAt),!![];const i=t.find(t=>"ui.drawer"===t.path);return(null===(n=null==i?void 0:i.value)||void 0===n?void 0:n.isOpen)===![]&&this.resetCountdownState(),![]}resetCountdownState(){this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}afterRender(){const t=this.store.get("checkout.presale");(null==t?void 0:t.expiresAt)&&this.updateExpiresAt(t.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){if(this.scrollContainer=this.findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;const t=70,n=10;this.scrollHandler=()=>{if(!this.scrollContainer)return;const e=this.scrollContainer.scrollTop;!this.isCurrentlyScrolled&&e>t?this.setScrolledState(!![]):this.isCurrentlyScrolled&&e<n&&this.setScrolledState(![])},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}findScrollContainer(){var t,n;const e=[".drawer-content"];for(const o of e){const n=null===(t=this.rootElement)||void 0===t?void 0:t.closest(o);if(n&&this.isScrollable(n))return n}let i=null===(n=this.rootElement)||void 0===n?void 0:n.parentElement;for(;i&&i!==document.body;){if(this.isScrollable(i))return i;i=i.parentElement}return null}setScrolledState(t){var n,e;this.isCurrentlyScrolled=t,t?(null===(n=this.rootElement)||void 0===n?void 0:n.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):(null===(e=this.rootElement)||void 0===e?void 0:e.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))}isScrollable(t){const n=window.getComputedStyle(t),e=n.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===e||"scroll"===e||"overlay"===e)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(t){this.stopCountdown();try{if(this.expiresAt=new Date(t),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:t}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const n=new Date,e=Math.floor((this.expiresAt.getTime()-n.getTime())/1e3);this.initialDurationSeconds=Math.min(e,CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS),this.startCountdown()}catch(n){this.logger.error("Failed to parse presale expiration date",n),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement||!this.initialDurationSeconds)return;const t=new Date,n=Math.max(0,this.expiresAt.getTime()-t.getTime()),e=n/1e3,i=this.initialDurationSeconds-e,o=Math.max(0,Math.min(100,i/this.initialDurationSeconds*100)),r=e<CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS;r!==this.isUnderOneMinute&&(this.isUnderOneMinute=r,this.updateWarningState()),this.updateTimerDisplay(n),this.updateProgressBar(o),0===n&&this.handleExpire()}updateWarningState(){if(!this.rootElement)return;const t=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==t||t.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==t||t.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}updateTimerDisplay(t){if(!this.rootElement)return;const n=this.rootElement.querySelector("[data-timer]");n&&(n.textContent=this.formatTime(t))}updateProgressBar(t){if(!this.rootElement)return;const n=this.rootElement.querySelector("[data-progress-fill]");n&&(n.style.width=t+"%")}formatTime(t){const n=Math.floor(t/1e3),e=Math.floor(n/60),i=n%60,o=Math.floor(t%1e3/10);return e.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")}handleExpire(){this.clientConfig.isBuilder()||(this.stopCountdown(),this.commands.checkout.showPresaleExpired())}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const n=this.createTextContainer(),e=this.createProgressBar();return t.appendChild(n),t.appendChild(e),t}createTextContainer(){const t=document.createElement("div");t.classList.add("checkout-presale-text-container");const n=this.createHeader(),e=this.createSubtitle();return t.appendChild(n),t.appendChild(e),t}createHeader(){const t=document.createElement("div");t.classList.add("checkout-presale-heading");const n=document.createElement("h2");n.textContent="LIMITED PRE-ORDER:";const e=document.createElement("div");return e.classList.add("checkout-presale-timer"),e.setAttribute("data-timer",""),e.textContent="00:00:00",t.appendChild(n),t.appendChild(e),t}createSubtitle(){const t=document.createElement("p");return t.classList.add("checkout-presale-subtitle"),t.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",t}createProgressBar(){const t=document.createElement("div");t.className="checkout-presale-progress-bar",t.setAttribute("data-progress","");const n=document.createElement("div");return n.className="checkout-presale-progress-fill",n.setAttribute("data-progress-fill",""),n.style.width="0%",t.appendChild(n),t}}CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS=300,CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS=60,CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS=10;class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}isItemsUnavailable(){var t;return"items_unavailable"===(null===(t=this.params)||void 0===t?void 0:t.reason)}isTimeExpired(){var t,n;return"time_expired"===(null===(t=this.params)||void 0===t?void 0:t.reason)||!(null===(n=this.params)||void 0===n?void 0:n.reason)}afterRender(){this.isTimeExpired()&&this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown();const t=this.commands.checkout.getReturnUrl();if(t)return window.location.assign(t),void 0;this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const t=[],n=this.getConfigs("global"),e=document.createElement("div");e.classList.add("checkout-completed-section-container");const o=document.createElement("div");o.classList.add("checkout-completed-title-section");const r=document.createElement("div");r.classList.add("checkout-completed-title-section");const a=document.createElement("p");a.classList.add("presale-expired-title");const s=document.createElement("p"),c=document.createElement("div");c.classList.add("checkout-completed-help-section"),this.isItemsUnavailable()&&(a.textContent="Items No Longer Available",s.textContent="The presale items you were trying to purchase are no longer available.",c.textContent="These items may have sold out or are no longer part of the presale. Please check our catalog for other available products."),this.isTimeExpired()&&(a.textContent="Session Expired",s.textContent="Your reservation time has ended. The item has been released for other customers.",c.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available."),r.appendChild(a),r.appendChild(s),o.appendChild(r),e.appendChild(o),e.appendChild(c),t.push(e);const l=document.createElement("div");l.classList.add("checkout-completed-section-container");const d=document.createElement("button");d.setAttribute("aria-label","Continue shopping"),d.type="button";const h=document.createElement("span");h.textContent="Continue Shopping",d.setAttribute("tabindex","0"),d.setAttribute("role","button"),d.setAttribute("aria-label","Continue Shopping"),d.appendChild(h);const p=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:n.theme.selectedTextColor}));if(d.appendChild(p),d.addEventListener("click",()=>this.handleExit()),d.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),l.appendChild(d),t.push(l),this.isTimeExpired()){const n=document.createElement("div");n.classList.add("checkout-completed-section-container");const e=document.createElement("p");e.classList.add("checkout-completed-auto-close-text"),e.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const i=document.createElement("span");i.classList.add("checkout-completed-auto-close-text"),i.textContent="seconds",n.appendChild(e),n.appendChild(this.autoCloseElement),n.appendChild(i),t.push(n)}if(n.layout.showPoweredBy){const n=document.createElement("div");n.classList.add("checkout-completed-powered-by-container");const e=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});n.appendChild(e),t.push(n)}return t}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(t){const n=t.find(t=>"checkout.promoCode"===t.path),e=t.find(t=>"checkout.loading"===t.path);if(n){const{value:t,oldValue:e}=n,i=Boolean(e),o=Boolean(t);if(!i&&o)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!o)return this.container.innerHTML="",this.createInputContainer(),void 0;o&&this.promoCodeText&&t.discount!==(null==e?void 0:e.discount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")")}e&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),n=t.length>=3&&t.length<=255,e=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.promoCode"),o=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!n||e||Boolean(i)||Boolean(o)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const n=t.toUpperCase(),e=this.promoInput;e.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const y=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(n){this.logger.error("Checkout promo code application failed",{promoCode:t,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",y),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),this.applyButton}createAppliedContainer(t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discount)||0)+")";const e=document.createElement("button");e.type="button",e.classList.add("remove-button"),e.textContent="Remove",e.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(e),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const t=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")";const e=document.createElement("button");return e.type="button",e.classList.add("remove-button"),e.textContent="Remove",e.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(e),n}const n=[];return n.push(this.createPromoInput()),n.push(this.createApplyButton()),n}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const t=this.getStoreValue("checkout.isGift"),n=document.createElement("div");n.classList.add("gift-label-wrapper");const e=document.createElement("span");e.textContent="Send as Gift? (Free)",e.classList.add("gift-toggle-label"),n.appendChild(e);const i=document.createElement("span");i.textContent="With personalized note & gift receipt.",i.classList.add("gift-toggle-description"),n.appendChild(i);const o=document.createElement("div");o.classList.add("toggle-switch"),o.classList.toggle("active",t);const r=document.createElement("div");return r.classList.add("toggle-slider"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Toggle Gift Option"),o.setAttribute("role","switch"),o.setAttribute("aria-checked",t?"true":"false"),o.appendChild(r),o.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),o.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),[n,o]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.I=![],this.O=null,this.M=null,this.L=null,this.R=![],this.j=![],this.N=![],this.B=null}async initialize({data:t}){if(this.I)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.I=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.O=window.Stripe(t.publishableKey),this.M=this.O.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.L=this.M.create("payment",t.elementOptions),this.L.mount(this),this.L.on("change",async t=>{const n=!!t.error,e=t.complete,i=n?t.error.message:null;this.j=e,this.R||await this.updateStripeFormStatus({isFormComplete:e,isProcessing:![],hasCompletedPayment:![],errorMessage:i,hasError:n})}),this.L.on("focus",async()=>{this.R||await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.N=![]}catch(t){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(t){const{stripeConfig:n}=t.detail;n&&(this.q=n,await this.refreshPaymentSession())}async handleSubmit(){var t,n;if(this.R)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.j)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.R=!![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.N&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const t=await this.createConfirmationTokenId(),n=this.q.clientSecret,e=n.split("_secret_")[0];this.N=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:t,setupIntentId:e},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(e){console.error("Payment submission error:",e),this.N=!![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==e?void 0:e.message)||"Payment processing failed. Please try again."}),((null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.includes("expired"))||(null===(n=null==e?void 0:e.message)||void 0===n?void 0:n.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.R=![]}}async requestSessionRefresh(){return this.B||(this.B=new Promise((t,n)=>{const e=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",G),this.B=null,n(new Error("Session refresh timeout"))},1e4),G=()=>{clearTimeout(e),this.removeEventListener("lce:s:refreshSession",G),this.B=null,t()};this.addEventListener("lce:s:refreshSession",G,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.B}async refreshPaymentSession(){try{this.M&&this.M.update({clientSecret:this.q.clientSecret}),this.N=![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(X){console.error("Failed to refresh payment session:",X),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.L&&this.L.clear(),this.j=![],this.N=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(X){console.error("Failed to reset form:",X)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.M)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.M.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const n={elements:this.M,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:e,confirmationToken:i}=await this.O.createConfirmationToken(n);if(e)throw new SDKError(e.message||"Failed to create confirmation token");if(!i||!i.id)throw new SDKError("Invalid confirmation token received");return i.id}catch(t){if(t instanceof SDKError)throw t;throw new SDKError("Payment processing error: "+(t.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,n;try{this.B=null,this.L&&(this.L.unmount(),this.L=null),this.M&&(null===(n=(t=this.M).destroy)||void 0===n?void 0:n.call(t),this.M=null),this.O=null,this.R=![],this.j=![],this.N=![],this.I=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(e){console.warn("Error during Stripe form cleanup:",e)}}loadStripeJS(){return new Promise((t,n)=>{const e=document.querySelector('script[src*="stripe.com"]');if(e)return e.addEventListener("load",()=>t()),e.addEventListener("error",()=>n(new Error("Failed to load Stripe.js"))),void 0;const i=document.createElement("script");i.src="https://js.stripe.com/basil/stripe.js",i.async=!![],i.onload=()=>t(),i.onerror=()=>n(new Error("Failed to load Stripe.js")),document.head.appendChild(i)})}}class CheckoutStripeHandlerComponent extends BaseComponent{get hostClasses(){return["checkout-stripe-handler"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.paymentMethod","checkout.paymentForm.isEditing"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.isInEditMode=![],this.savedCardInfo=null,this.isChangingPayment=![],this.callbacks={}}beforeConnected(){this.callbacks=this.params.callbacks||{}}onStoreWatch(t){for(const n of t)switch(n.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(n.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(n.value)}}handleSavedCardChange(t){var n,e,i,o;(null===(n=null==t?void 0:t.card)||void 0===n?void 0:n.brand)&&(null===(e=null==t?void 0:t.card)||void 0===e?void 0:e.last4)?this.savedCardInfo={brand:t.card.brand,last4:t.card.last4}:this.savedCardInfo=null,null===(o=(i=this.callbacks).onSavedCardInfoChanged)||void 0===o||o.call(i,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(t){this.isInEditMode=t,this.updateDisplayState()}updateDisplayState(){var t,n,e,i,o,r;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(n=(t=this.callbacks).onEditModeVisibilityChanged)||void 0===n||n.call(t,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(i=(e=this.callbacks).onEditModeVisibilityChanged)||void 0===i||i.call(e,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(t=>{this.logger.error("Failed to create stripe form in updateDisplayState",t)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(r=(o=this.callbacks).onEditModeVisibilityChanged)||void 0===r||r.call(o,![]))}async afterRender(){var t,n,e,i;this.isInEditMode=null!==(t=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==t?t:![];const o=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(n=null==o?void 0:o.card)||void 0===n?void 0:n.brand)&&o.card.last4&&(this.savedCardInfo={brand:o.card.brand,last4:o.card.last4}),null===(i=(e=this.callbacks).onSavedCardInfoChanged)||void 0===i||i.call(e,this.savedCardInfo),this.updateDisplayState(),(this.isInEditMode&&!this.savedCardInfo||this.isChangingPayment)&&await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",t=>{var n,e;this.stripeFormStatus=t.detail.status,null===(e=(n=this.callbacks).onStripeFormStatusChanged)||void 0===e||e.call(n,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async t=>{var n,e,i,o,r;try{const{confirmationTokenId:i,setupIntentId:o}=t.detail;await(null===(e=(n=this.callbacks).onPaymentSessionConfirmed)||void 0===e?void 0:e.call(n,i,o)),this.isChangingPayment=![]}catch(a){this.logger.error("Failed to save payment form",a),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==a?void 0:a.message)||"Failed to save payment information. Please try again."},null===(o=(i=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(i,this.stripeFormStatus),null===(r=this.stripeFormElement)||void 0===r||r.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const n=await this.doStripeConfig();null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:n}}))}catch(n){this.logger.error("Failed to refresh payment session",n)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const t=document.createElement("span");t.classList.add("stripe-summary-text"),t.textContent=(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const n=document.createElement("button");n.type="button",n.classList.add("change-payment-link"),n.textContent="Change",n.setAttribute("aria-label","Change Payment Method"),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.addEventListener("click",()=>this.handleChangePayment()),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(t,n),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var t,n;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(n=(t=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(t,this.stripeFormStatus),this.updateDisplayState()}template(){const t=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",t.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const n=document.createElement("slot");return n.setAttribute("name",pt),this.stripeFormContainer.appendChild(n),t.push(this.stripeFormContainer),t}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,n=null;for(;t&&t!==document.body;){const e=t.hasAttribute("checkout"),o=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT),r=t.hasAttribute("drawer"),a=(null==n?void 0:n.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(i.DRAWER),s="checkout"===(null==n?void 0:n.getAttribute("data-target"));if(e||o&&r&&a&&s)return this.rootComponent=t,t;n=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){const t=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==t?void 0:t.key)&&(null==t?void 0:t.secret)||await this.commands.checkout.getPaymentSession();const n=this.store.get("checkout.paymentForm.paymentSession"),e=this.getConfigs("global");return{publishableKey:n.key,clientSecret:n.secret,appearance:{theme:"dark"===e.layout.poweredByMode?"night":"stripe",variables:{fontFamily:e.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:e.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===e.layout.inputFieldStyle?"none":"1px solid "+e.theme.accentColor,backgroundColor:"filled"===e.layout.inputFieldStyle?e.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t,n,e;if(this.isCreatingStripeForm)return this.logger.info("Stripe form creation already in progress, skipping"),void 0;if(this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment)return this.logger.info("In edit mode with saved card, skipping stripe form creation"),void 0;const o=this.findRootComponent();if(!o)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const r=o.querySelectorAll('[slot="'+pt+'"]');if(r.length>0)for(const i of r)i.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:i.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",pt),o.appendChild(this.stripeFormElement)}catch(a){this.logger.error("Stripe form element creation failed",a),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(e=(n=this.callbacks).onStripeFormStatusChanged)||void 0===e||e.call(n,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.fulfillments","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillments(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).filter(t=>t.type===o.ON_DEMAND)}getRetailerNameForFulfillment(t){const n=this.getStoreValue("checkout.items")||{},e=this.getStoreValue("checkout.retailers")||{},i=Object.values(n).find(n=>n.fulfillmentId===t);if(!i)return"Retailer";const o=e[i.retailerId];return(null==o?void 0:o.name)||"Retailer"}async handlePercentageSelect(t){const n=this.getStoreValue("checkout.updating")||![];if(!n)try{await this.commands.checkout.updateTips(t)}catch(e){this.logger.error("Checkout tips update failed",e)}}async handleFulfillmentTipInput(t,n){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const i=this.getOnDemandFulfillments();if(!i.find(n=>n.id===t))return;const o=Math.round(100*n);try{await this.commands.checkout.updateFulfillmentTip(t,o)}catch(r){this.logger.error("Checkout fulfillment tip update failed",r)}}async removeTipFromFulfillment(t){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const e=this.getOnDemandFulfillments();if(e.find(n=>n.id===t))try{await this.commands.checkout.removeFulfillmentTip(t)}catch(i){this.logger.error("Checkout fulfillment tip removal failed",i)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const n=[10,18,20],e=this.getStoreValue("checkout.updating")||![],i=this.getTipSelection();for(const o of n){const n=document.createElement("button");n.type="button",n.textContent=o+"%",n.classList.add("checkout-tip-button"),n.disabled=e,i===o&&n.classList.add("selected"),n.addEventListener("click",()=>this.handlePercentageSelect(o)),t.appendChild(n)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),n=this.container.querySelector(".checkout-items-toggler-button"),e=this.container.querySelector(".retailers-tips-list");t&&n&&e&&t.addEventListener("click",()=>{const t=e.classList.contains("show");e.classList.toggle("show"),t?(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-label","Expand tips section")):(n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse tips section")),n.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const n=this.getOnDemandFulfillments();if(0===n.length)return t;const e=document.createElement("div");e.classList.add("checkout-tip-distribution-header");const i=document.createElement("h3");i.textContent="View Tip Distribution",i.classList.add("checkout-sub-header"),e.appendChild(i);const o=document.createElement("button");o.type="button",o.classList.add("checkout-items-toggler-button"),o.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),e.appendChild(o),t.appendChild(e);const r=document.createElement("div");r.classList.add("retailers-tips-list","show");for(const a of n){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const n=document.createElement("h4");n.textContent=this.getRetailerNameForFulfillment(a.id),n.classList.add("checkout-sub-header"),t.appendChild(n);const e=document.createElement("div");e.classList.add("checkout-tip-fulfillment-input-wrapper");const i=document.createElement("div");i.classList.add("dollar-input-container");const o=document.createElement("span");o.classList.add("dollar-sign"),o.textContent="$";const s=document.createElement("input");let c;s.type="number",s.id="tip-input-"+a.id,s.name="tip-"+a.id,s.min="0",s.step="0.01",s.placeholder="0.00",s.classList.add("dollar-input"),s.value=a.amounts.tip>0?(a.amounts.tip/100).toFixed(2):"",s.disabled=this.getStoreValue("checkout.updating")||![],s.addEventListener("wheel",t=>{t.preventDefault()}),s.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),s.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),s.addEventListener("paste",t=>{t.preventDefault()}),s.addEventListener("contextmenu",t=>{t.preventDefault()}),s.addEventListener("input",t=>{const n=t.target;let e=n.value;if(Number.parseFloat(e)<0&&(n.value=Math.abs(Number.parseFloat(e)).toString(),e=n.value),e.includes(".")){const t=e.split(".");t.length>1&&t[1].length>2&&(n.value=t[0]+"."+t[1].substring(0,2))}}),s.addEventListener("input",t=>{const n=t.target,e=Number.parseFloat(n.value)||0;c&&clearTimeout(c),c=setTimeout(()=>{this.handleFulfillmentTipInput(a.id,e)},500)}),i.appendChild(o),i.appendChild(s),e.appendChild(i);const l=document.createElement("button");l.type="button",l.textContent="Remove",l.classList.add("checkout-tip-remove-button"),l.disabled=this.getStoreValue("checkout.updating")||![],l.addEventListener("click",()=>this.removeTipFromFulfillment(a.id)),e.appendChild(l),t.appendChild(e),r.appendChild(t)}return t.appendChild(r),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),n=this.getOnDemandFulfillments();if(t&&n.length>0){const i=n.every(t=>t.amounts.tip>0);if(i)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(t)}catch(e){this.logger.error("Default tip initialization failed",e),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(i){this.logger.error("Default tip initialization failed during fallback",i),this.isInitialized=![]}}template(){const t=[],n=this.getOnDemandFulfillments();if(0===n.length)return t;n.length>0&&this.initializeDefaultTip();const e=document.createElement("section");e.classList.add("checkout-tip-container");const i=document.createElement("h3");i.classList.add("checkout-sub-header"),i.textContent="Add a tip",e.appendChild(i);const o=document.createElement("div");o.classList.add("checkout-tip-config-container");const r=this.createTipSelectionButtons();o.appendChild(r),e.appendChild(o);const a=document.createElement("p");a.classList.add("checkout-tip-disclaimer"),a.textContent="Tips will be split proportionally between retailers.",e.appendChild(a);const s=this.createTipDistribution();return t.push(e,s),t}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(t){var n,e;const i=t.find(t=>"checkout.giftCardError"===t.path),o=t.find(t=>"checkout.promoCodeError"===t.path),r=t.find(t=>"checkout.giftCards"===t.path);if(r&&this.updateAppliedGiftCards(r.value),i){const t=this.container.querySelector(".input-gift-card-container");if(t){const e=t.nextElementSibling;if((null===(n=null==e?void 0:e.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==e?void 0:e.remove()),i.value){const n=this.createErrorElement(i.value);t.after(n)}const o=t.querySelector(".apply-button");o&&(o.disabled=Boolean(i.value))}}if(o){const t=this.container.querySelector(".input-promo-code-container");if(t){const n=t.nextElementSibling;if((null===(e=null==n?void 0:n.classList)||void 0===e?void 0:e.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),o.value){const n=this.createErrorElement(o.value);t.after(n)}const i=t.querySelector(".apply-button");i&&(i.disabled=Boolean(o.value))}}}updateAppliedGiftCards(t){const n=t&&t.length>0;if(!n)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",t.forEach(t=>{const n=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(n)})}createAppliedGiftCardElement(t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),n.setAttribute("data-gift-card-code",t.code);const e=document.createElement("span");e.textContent=t.code+" (- "+formatCentToDollarText(t.applied)+")",n.appendChild(e);const i=document.createElement("button");return i.type="button",i.textContent="Remove",i.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),n.appendChild(i),n}inputContainer(){var t;const n=this.getConfigs("checkout"),e=this.getConfigs("global"),o=n.layout.allowGiftCards,r=null===(t=null==e?void 0:e.layout)||void 0===t?void 0:t.allowPromoCodes,a=document.createElement("div");a.classList.add("checkout-pc-gc-sub-container");const s=ComponentFactoryService.createElement({type:i.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]}),c=ComponentFactoryService.createElement({type:i.CHECKOUT_GIFT_CARDS});r&&a.appendChild(s);const l=this.getStoreValue("checkout.promoCodeError");if(l){const t=this.createErrorElement(l);t.classList.add("promo-code-error-wrapper"),a.appendChild(t)}o&&a.appendChild(c);const d=this.getStoreValue("checkout.giftCardError");if(d){const t=this.createErrorElement(d);a.appendChild(t)}return a}createErrorElement(t){const n=document.createElement("div");n.classList.add("error-banner-checkout");const e=document.createElement("div");e.innerHTML=ErrorInfoIcon({});const i=document.createElement("p");return i.textContent=t.toString(),n.appendChild(e),n.appendChild(i),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),n.remove()},3e3),n}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const n=[];return n.push(this.inputContainer()),t&&t.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),t.forEach(t=>{const n=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(n)}),n.push(this.appliedGiftCardsContainer)),n}disconnected(){this.appliedGiftCardsContainer=null}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,n;const e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],i=null!==(n=this.params.showFirstEvent)&&void 0!==n?n:!![];if(e){const t=this.store.get(this.params.errorStorePath)||[],n=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return i?n.slice(0,1):n}const o=this.store.get(this.params.errorStorePath);return o?[{message:o,level:"error"}]:[]}createErrorElement(t){const n=document.createElement("div");n.classList.add("alert-container","alert-"+t.level);const e=document.createElement("span");e.classList.add("alert-icon"),e.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const i=document.createElement("span");return i.classList.add("alert-text"),i.textContent=t.message,n.appendChild(e),n.appendChild(i),n}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const n=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},n)}hideAllErrors(){var t;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[];const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];n?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["engraving-view-container",t.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const t=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+t),e=(null==n?void 0:n.attributes.engraving.fee)||0,i=(null==n?void 0:n.quantity)||1;return{quantity:i,fee:e,total:e*i}}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+t),e=(null==n?void 0:n.attributes.engraving.fee)||0,i=(null==n?void 0:n.quantity)||1;return{quantity:i,fee:e,total:e*i}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+t);return(null==n?void 0:n.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+t);return(null==n?void 0:n.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,n,e,o,r,a,s,c,l,d,h,p,m,f,g,v,x,b,w,_;const E=this.params.identifier,S={identifier:E,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+E);S.lines=(null===(n=null===(t=null==i?void 0:i.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.lines)||[],S.maxLines=(null===(o=null===(e=null==i?void 0:i.attributes)||void 0===e?void 0:e.engraving)||void 0===o?void 0:o.maxLines)||1,S.maxCharsPerLine=(null===(a=null===(r=null==i?void 0:i.attributes)||void 0===r?void 0:r.engraving)||void 0===a?void 0:a.maxCharsPerLine)||16,S.fee=(null===(c=null===(s=null==i?void 0:i.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.fee)||0,S.location=(null===(d=null===(l=null==i?void 0:i.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+E);S.lines=(null===(p=null===(h=null==t?void 0:t.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.lines)||[],S.maxLines=(null===(f=null===(m=null==t?void 0:t.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.maxLines)||1,S.maxCharsPerLine=(null===(v=null===(g=null==t?void 0:t.attributes)||void 0===g?void 0:g.engraving)||void 0===v?void 0:v.maxCharsPerLine)||16,S.fee=(null===(b=null===(x=null==t?void 0:t.attributes)||void 0===x?void 0:x.engraving)||void 0===b?void 0:b.fee)||0,S.location=(null===(_=null===(w=null==t?void 0:t.attributes)||void 0===w?void 0:w.engraving)||void 0===_?void 0:_.location)||""}this.commands.ui.openDrawer(i.ENGRAVING_FORM,S)}async handleRemove(){const t=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(t,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(t)}template(){const t=this.engravingQuantityFee(),n=this.engravingLines();if(0===n.length)return"";const e=document.createElement("div");e.className="engraving-header";const i=document.createElement("h3");i.textContent="Personalization";const o=document.createElement("span");if(o.className="engraving-fee",1===t.quantity&&(o.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){o.textContent=formatCentToDollarText(t.total,![]);const n=document.createElement("span");n.className="engraving-fee-each",n.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",o.appendChild(n)}e.appendChild(i),e.appendChild(o);const r=document.createElement("div");r.className="engraving-body";const a=document.createElement("div");a.className="engraving-lines";for(const l of n){const t=document.createElement("span");t.className="engraving-line",t.textContent=l,a.appendChild(t)}const s=document.createElement("div");s.className="engraving-actions";const c=document.createElement("button");c.type="button",c.classList.add("remove-button"),c.textContent="Remove",c.setAttribute("aria-label","Remove engraving");const u=async()=>{await this.handleRemove()};if(c.addEventListener("click",u),c.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await u())}),s.appendChild(c),"checkout"!==this.params.context){const t=document.createElement("button");t.type="button",t.classList.add("edit-button"),t.textContent="Edit",t.setAttribute("aria-label","Edit engraving"),t.addEventListener("click",this.handleEdit.bind(this)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEdit())}),s.appendChild(t)}return r.appendChild(a),r.appendChild(s),[e,r]}}class InputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}handlePhoneKeydown(t){if("Backspace"===t.key){const n=t.target,e=n.selectionStart||0,i=n.value;e>0&&/\D/.test(i[e-1])&&setTimeout(()=>{const t=Math.max(0,e-2);n.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const n=t.target;let e=n.value.replace(/\D/g,"");e.length>10&&(e=e.substring(0,10)),e.length>=6?e="("+e.substring(0,3)+") "+e.substring(3,6)+"-"+e.substring(6):e.length>=3&&(e="("+e.substring(0,3)+") "+e.substring(3)),n.value=e}formatDate(t){const n=t.target,e=n.value,i=n.selectionStart||0;let o=0,r;if(i>2&&(o=1),i>5&&(o=2),e.includes("/")){const t=e.split("/");let n=(t[0]||"").replace(/\D/g,"").substring(0,2);const i=(t[1]||"").replace(/\D/g,"");let o=i.substring(0,2);const a=i.substring(2);let s=(t[2]||"").replace(/\D/g,"");if(s=(a+s).substring(0,4),""===n&&3===t.length&&(n="01"),2===n.length){let t=Number.parseInt(n,10);t>12&&(t=12),t<1&&(t=1),n=t.toString().padStart(2,"0")}if(""===o&&3===t.length&&(o="01"),2===o.length){let t=Number.parseInt(o,10);t>31&&(t=31),t<1&&(t=1),o=t.toString().padStart(2,"0")}r=n,(t.length>1||o)&&(r+="/"+o),(s||t.length>2)&&(r+="/"+s)}else{let t=e.replace(/\D/g,"");if(t.length>8&&(t=t.substring(0,8)),t.length>=2){let n=Number.parseInt(t.substring(0,2),10);n>12&&(n=12),t=n.toString().padStart(2,"0")+t.substring(2)}if(t.length>=4){let n=Number.parseInt(t.substring(2,4),10);n>31&&(n=31),t=t.substring(0,2)+n.toString().padStart(2,"0")+t.substring(4)}r=t.length>=5?t.substring(0,2)+"/"+t.substring(2,4)+"/"+t.substring(4):t.length>=3?t.substring(0,2)+"/"+t.substring(2):t}if(n.value=r,e.includes("/")){let t;t=0===o?Math.min(i,2):1===o?Math.min(i,5):r.length,n.setSelectionRange(t,t)}}validateEmail(t){const n=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return n.test(t)}validateTel(t){const n=/^\(\d{3}\) \d{3}-\d{4}$/;return n.test(t)}validateDate(t){const n=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!n.test(t))return![];const[e,i,o]=t.split("/").map(Number),r=new Date(o,e-1,i);return r.getFullYear()===o&&r.getMonth()===e-1&&r.getDate()===i}parseDateString(t){if(!this.validateDate(t))return null;const[n,e,i]=t.split("/").map(Number);return new Date(i,n-1,e)}calculateAge(t){const n=new Date;let e=n.getFullYear()-t.getFullYear();const i=n.getMonth()-t.getMonth();return(i<0||0===i&&n.getDate()<t.getDate())&&e--,e}validateDateConstraints(t){const n=[],e=this.params.validation;if(!e)return n;const i=this.parseDateString(t);if(!i)return n;const o=i.getFullYear();void 0!==e.minYear&&o<e.minYear&&n.push("Year must be "+e.minYear+" or later"),void 0!==e.maxYear&&o>e.maxYear&&n.push("Year must be "+e.maxYear+" or earlier");const r=this.calculateAge(i);return void 0!==e.minAge&&r<e.minAge&&n.push("Must be at least "+e.minAge+" years old"),void 0!==e.maxAge&&r>e.maxAge&&n.push("Must be no more than "+e.maxAge+" years old"),n}isFieldComplete(){var t,n,e;const i=this.inputElement.value.trim();if(!i)return![];switch(this.params.inputType){case"tel":return this.validateTel(i);case"date":case"birthdate":return this.validateDate(i);case"email":return i.includes("@")&&(null===(t=i.split("@")[1])||void 0===t?void 0:t.includes("."));case"number":return!Number.isNaN(Number.parseFloat(i));default:return(null===(n=this.params.validation)||void 0===n?void 0:n.max)&&i.length>=this.params.validation.max||(null===(e=this.params.validation)||void 0===e?void 0:e.min)&&i.length>=this.params.validation.min?!![]:i.length>=3}}validateInput(){const t=this.inputElement.value,n=[],e=this.params.validation;if(!e)return this.showErrors([]),!![];if(e.required&&!t.trim()&&n.push("This field is required"),!e.required&&!t.trim())return this.showErrors([]),!![];if(t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||n.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||n.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"===this.params.inputType||"birthdate"===this.params.inputType)if(this.validateDate(t)){const e=this.validateDateConstraints(t);n.push(...e)}else n.push("Please enter a valid date (MM/DD/YYYY)");if("number"===this.params.inputType){const i=Number.parseFloat(t);Number.isNaN(i)?t.trim()&&n.push("Please enter a valid number"):(void 0!==e.min&&i<e.min&&n.push("Value must be at least "+e.min),void 0!==e.max&&i>e.max&&n.push("Value must be no more than "+e.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==e.min&&t.length<e.min&&n.push("Must be at least "+e.min+" characters"),void 0!==e.max&&t.length>e.max&&n.push("Must be no more than "+e.max+" characters")),e.pattern){const i=new RegExp(e.pattern);i.test(t)||n.push("Invalid format")}if(e.customValidator){const i=e.customValidator(t);i&&n.push(i)}}this.showErrors(n);const i=0===n.length;return this.params.onValidation&&this.params.onValidation(i,n),i}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const n of t){const t=document.createElement("div");t.className="error-message",t.textContent=n,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const n=[];if(this.params.label){const e=document.createElement("label");e.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(e.textContent+="*"),e.setAttribute("for",this.params.name),n.push(e)}return this.inputElement=document.createElement("input"),this.inputElement.type="birthdate"===this.params.inputType?"text":this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||(this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.params.placeholder||(this.inputElement.placeholder="MM/DD/YYYY")),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",n.push(this.inputElement),n.push(this.errorContainer),n}}class LceElementComponent extends HTMLElement{constructor(){super(),this.I=![],this.U=null;const t=ClientConfigService.getInstance();this.V=this.attachShadow({mode:t.get("openShadowDom")?"open":"closed"})}initialize(t,n){if(this.I)return;if(!t||"string"!=typeof t)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(n&&n instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.V)throw new SDKError("LceElementComponent: Shadow DOM container is not available");n&&"function"==typeof n.rerender&&(this.U=t=>{n.rerender(t||"LceElementRerender")}),this.V.appendChild(n),this.applyBasicStyles();const e=ThemeProviderService.getInstance(),i=e.getStylesheet(t);this.applyThemeStyles(i),this.I=!![],this.V=null}rerender(t){this.U&&this.U(t)}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n width: 100%;\n height: auto;\n }\n\n :host([drawer]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(t),this.V.adoptedStyleSheets=[n,...this.V.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(X){this.createFallbackStylesheet(t)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}applyThemeStyles(t){t.forEach(t=>{"string"==typeof t?this.createFallbackStylesheet(t):this.V.adoptedStyleSheets=[...this.V.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const n=document.createElement("style");n.textContent=t,this.V&&this.V.appendChild(n)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const t=document.createElement("div");t.className="pb-title-container";const n=document.createElement("span");n.className="pb-text",n.textContent="Powered by",t.appendChild(n);const e=document.createElement("span");e.className="pb-lc",e.textContent="LiquidCommerce",t.appendChild(e);const i=document.createElement("span");return i.className="pb-dot",i.textContent=".",t.appendChild(i),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const n=this.getDisclaimerConfig();return n.parts.forEach(n=>{"text"===n.type?t.appendChild(document.createTextNode(n.content)):"link"===n.type&&t.appendChild(this.createLink(n.href,n.text))}),t}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(t,n){const e=document.createElement("a");return e.href=t,e.target="_blank",e.rel="noopener noreferrer",e.className="pb-link",e.textContent=n,e.setAttribute("role","link"),e.setAttribute("aria-label","Read "+n),e}template(){const t=this.createPoweredBySection(),n=this.createDisclaimerSection();return[t,n]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const n=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!n||!this.applyButton||!this.currentActiveTicker)return;const e=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);e&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!e&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const n=this.store.get("cart.promoCode"),e=this.store.get("checkout.promoCode");return(null==n?void 0:n.code)===t||(null==e?void 0:e.code)===t}getActiveTickers(){var t;const n=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var e;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(e=null==n?void 0:n.address)||void 0===e?void 0:e.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const n=document.createElement("div");n.classList.add("promo-ticker__text-group");const e=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const i of e){const e=i.trim();if(!e)continue;const o=document.createElement("span");o.classList.add("promo-ticker__text-item"),o.textContent=e,n.appendChild(o);const r=document.createElement("span");r.classList.add("promo-ticker__separator"),r.textContent=t.separator,n.appendChild(r)}return n}async handlePromoClick(){var t;(null===(t=this.currentActiveTicker)||void 0===t?void 0:t.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const t=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(t),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const n=document.createElement("div");n.classList.add("promo-ticker__content");const e=document.createElement("div");e.classList.add("promo-ticker__track");for(let o=0;o<5;o++)e.appendChild(this.generateTextContent(this.currentActiveTicker));n.appendChild(e);const i=document.createElement("button");return i.type="button",i.classList.add("promo-ticker__cta"),i.textContent="APPLY",i.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(i.disabled=!![],i.textContent="APPLIED"),i.addEventListener("click",()=>this.handlePromoClick()),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=i,[n,i]}}class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const n={warning:"warning",success:"success",info:"info"},e={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},i=n[this.params.messageType]||"warning",o=document.createElement("div");return o.className="alert-icon alert-icon-"+this.params.messageType,o.appendChild(htmlStringToElement(e[i]({width:16,height:16,className:"alert-icon-svg"}))),o}template(){var t;const n=[],e=this.getIconElement();e&&n.push(e);const i=document.createElement("span");if(i.className="alert-message",i.textContent=this.params.message,n.push(i),"detailed"===(null===(t=this.config)||void 0===t?void 0:t.alertType)&&this.params.currentTotal){const t=document.createElement("div");t.className="alert-details";const e=document.createElement("small");e.className="alert-details-text",e.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(e),n.push(t)}return n}}const Ct=LoggerFactory.get("ClientHelpers"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,n){if(!t||!n)return t;const e={...t},i=[];for(const o in n){const r=n[o],a=e[o];if(!(o in t)){i.push('Property "'+o+'" does not exist in target schema, skipping merge.');continue}const s=getType(r),c=getType(a);s===c?isObject(r)&&isObject(a)?e[o]=deepMergeConfigs(a,r):e[o]=r:i.push('Type mismatch for key "'+o+'": source is '+s+", target is "+c+". Skipping merge.")}return i.length>0&&Ct.warn("Merging configurations with warnings:",i),e}class ElementsCheckoutClient{constructor(t){this.clientPrepared=![],this.componentsRegistered=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.checkoutActionService=ClientCheckoutActionService.getInstance(),this.logger=LoggerFactory.get("CheckoutClient"),this.authClient=AuthClientService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareServices(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Checkout client preparation failed",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareServices(){this.clientConfig.set("version",X.version);const t=this.clientConfig.isProduction(),n=this.clientConfig.isDebuggingEnabled();!t&&n&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled")),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),!t&&n&&this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized")),this.logger.info("🔐 Starting authentication...");const{success:e,configs:i}=await this.authClient.authenticateAndGetConfigs();if(!e||!i)throw this.clientPrepared=![],new SDKError("Authentication failed",!![]);this.logger.info("✅ Authentication completed"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed");let o=i;this.clientConfig.set("partnerCode",o.configurations.partnerCode),this.clientConfig.set("partnerName",o.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const r=await this.fingerPrintService.getId(o.configurations.partnerCode),a=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",r),this.clientConfig.set("isLocalStorageAvailable",a);const s=a?null:await this.apiClient.getPersistedStore(r);if(await this.store.initialize({userDeviceId:r,isLocalStorageAvailable:a,persistedStore:s}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),n=o.global.layout.showPoweredBy;o=deepMergeConfigs(o,t),o.global.layout.showPoweredBy=n}await this.themeProvider.initialize(o),this.logger.info("✅ Theme provider initialized"),this.logger.info("📦 Registering checkout components..."),this.registerCheckoutComponents(),this.logger.info("✅ Checkout components registered"),this.initializeGTM(),this.logger.info("🎯 Checkout client preparation completed")}async initializeGTM(){try{const t=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:t.partnerName,partnerCode:t.partnerCode,enablePartnerGTM:t.enablePartnerGTM,partnerGTMId:t.partnerGTMId||void 0,enableLiquidCommerceGTM:t.enableLiquidCommerceGTM,liquidCommerceGTMId:t.liquidCommerceGTMId})}catch(t){this.logger.warn("GTM initialization failed",t)}}registerCheckoutComponents(){this.componentsRegistered||(ComponentFactoryService.registerComponent(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.INPUT,InputComponent),ComponentFactoryService.registerComponent(i.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(i.ALERT,AlertComponent),ComponentFactoryService.registerComponent(i.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(i.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(i.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(i.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent),this.componentsRegistered=!![])}async injectCheckout(t,n){if(!t||"string"!=typeof t)throw new SDKError("Checkout requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const e=t.replace("#",""),o=document.getElementById(e);if(!o)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before injecting checkout.',!![]);const r=ComponentFactoryService.createElement({type:i.CHECKOUT,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});return o.innerHTML="",safeReplaceChildren(o,r),this.store.set("metadata.checkout.injection",{containerId:e,injectedAt:Date.now()}),await this.checkoutCommands.loadCheckout({checkoutId:void 0===n?"":n}),this.createInjectedComponentWrapper(e,r)}createInjectedComponentWrapper(t,n){return{getType:()=>i.CHECKOUT,getElement:()=>document.getElementById(t),rerender:()=>{try{n&&"function"==typeof n.rerender&&n.rerender("CheckoutRerender")}catch(e){this.logger.warn("Failed to rerender checkout in container '"+t+"'")}}}}get actions(){const t=this.checkoutActionService.actions;return{checkout:{applyPromoCode:t.applyPromoCode,removePromoCode:t.removePromoCode,applyGiftCard:t.applyGiftCard,removeGiftCard:t.removeGiftCard,toggleIsGift:t.toggleIsGift,toggleBillingSameAsShipping:t.toggleBillingSameAsShipping,toggleMarketingPreferences:t.toggleMarketingPreferences,updateCustomerInfo:t.updateCustomerInfo,updateBillingInfo:t.updateBillingInfo,updateGiftInfo:t.updateGiftInfo,getDetails:t.getDetails}}}}async function ElementsCheckout(t,e){try{SingletonManager.setContext({isBuilder:![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:e.env,isBuilder:![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:void 0,proxy:e.proxy,development:e.development,checkout:e.checkout});const o=i.getConfigs(),r=new ElementsCheckoutClient(o);if(await r.prepare(),!r.clientPrepared)throw new SDKError("Failed to initialize checkout client.",!![]);const a={injectCheckout:r.injectCheckout.bind(r),actions:r.actions};window.elementsCheckout=a;const s=PubSubService.getInstance();return s.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Checkout Client Is Ready",timestamp:Date.now(),version:i.get("version")}),a}catch(i){return console.error("[LiquidCommerce Elements] Checkout client initialization failed",i),null}}const _t={SCRIPT:{CHECKOUT_PARAM:"data-checkout-param"},ELEMENT:{CHECKOUT:"data-lce-checkout"},JSON_SCRIPT:{DEVELOPMENT:"data-liquid-commerce-elements-development"}};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function getDevelopmentConfigs(){const t=document.querySelector("script["+_t.JSON_SCRIPT.DEVELOPMENT+"]");if(t)try{return JSON.parse(t.textContent||"{}")}catch(n){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",n),void 0}}function triggerAutoInit(t,n){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await t()}catch(e){console.error(n+" Failed to initialize:",e)}},50)}):setTimeout(async()=>{try{await t()}catch(e){console.error(n+" Failed to initialize:",e)}},50)}catch(e){console.error(n+" Failed to setup initialization:",e)}}async function setupCheckout(t,n,e){try{const i=document.querySelector("div["+_t.ELEMENT.CHECKOUT+"]");if(!i)return e.requireCheckoutId||console.warn(e.errorPrefix+" No checkout container found. Add a div with data-lce-checkout attribute."),void 0;const o="lce-checkout-container";let r;i.className="lce-checkout-container",i.id=o;const a=t.getAttribute(_t.SCRIPT.CHECKOUT_PARAM)||"lce_checkout";if(a&&startsWithLcePrefix(a)){const t=new URLSearchParams(window.location.search);if(r=t.get(a)||void 0,!r&&e.requireCheckoutId)return console.warn(e.errorPrefix+" Checkout ID not found in query parameters."),void 0}else if(console.warn(e.errorPrefix+' Ignoring checkout query parameter "'+a+'" because it does not start with "lce_" prefix.'),e.requireCheckoutId)return;await n(o,r)}catch(i){console.error(e.errorPrefix+" Failed to setup checkout:",i)}}const Et={SCRIPT:{MAIN:"data-liquid-commerce-checkout",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode",CHECKOUT_URL:"data-checkout-url"}};async function ElementsCheckoutAutoInitialize(){try{const n=document.querySelector("script["+Et.SCRIPT.MAIN+"]");if(!n)return;const e=n.getAttribute(Et.SCRIPT.TOKEN),i=n.getAttribute(Et.SCRIPT.ENV)||t.PRODUCTION,o=n.getAttribute(Et.SCRIPT.DEBUG_MODE);if(!e)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements Checkout script tag.',!![]);const a=n.getAttribute(Et.SCRIPT.CHECKOUT_URL)||void 0;let s=r.NONE;o&&i!==t.PRODUCTION&&(s=o);const c=await ElementsCheckout(e,{env:i,debugMode:s,checkout:a?{pageUrl:a}:void 0,development:getDevelopmentConfigs()});if(!c)throw new SDKError("ElementsCheckout SDK client initialization failed",!![]);await setupCheckout(n,c.injectCheckout.bind(c),{requireCheckoutId:![],errorPrefix:"[LiquidCommerce Checkout Auto Initialization]"})}catch(n){console.error("[LiquidCommerce Checkout Auto Initialization]",n)}}function triggerElementsCheckoutAutoInit(){triggerAutoInit(ElementsCheckoutAutoInitialize,"[LiquidCommerce Checkout Auto Initialization]")}if(void 0===window.customElements)console.error("[LiquidCommerce Checkout] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Checkout] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const t=window.onerror;window.onerror=(n,e,i,o,r)=>isSDKError(r,e)?(console.error("[LiquidCommerce Checkout] Unhandled SDK error:",{message:n,source:e,lineno:i,colno:o,error:r}),!![]):t?t(n,e,i,o,r):![];const n=window.onunhandledrejection;window.onunhandledrejection=t=>{if(t.reason&&isSDKError(t.reason))return console.error("[LiquidCommerce Checkout] Unhandled SDK promise rejection:",t.reason),t.preventDefault(),void 0;n&&n.call(window,t)};try{initializeDOMPolyfills()}catch(St){console.error("[LiquidCommerce Checkout] DOM polyfills initialization failed:",St)}window.ElementsCheckout=ElementsCheckout;try{triggerElementsCheckoutAutoInit()}catch(Pt){console.error("[LiquidCommerce Checkout] Auto-initialization failed:",Pt)}}catch(Tt){console.error("[LiquidCommerce Checkout] SDK initialization failed:",Tt)}exports.ElementsCheckout=ElementsCheckout,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):(e="undefined"!=typeof globalThis?globalThis:e||self,n(e.LiquidCommerceElementsCheckout={}))})(this,function(exports){"use strict";class SDKError extends Error{constructor(e,n=![]){super(e),this.name="SDKError",this.isSdk=!![],this.reThrow=n,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(e,n){if((null==e?void 0:e.isSdk)===!![])return e instanceof SDKError&&e.reThrow?![]:!![];if(!e||"object"!=typeof e)return n?isSDKSource(n):![];const o=String((null==e?void 0:e.message)||""),r=/liquidcommerce\s+elements/i.test(o),s=String((null==e?void 0:e.stack)||""),a=(null==e?void 0:e.source)||n||"",c=[/@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,/elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,/chunk-[a-z0-9]+.*elements/i],l=[/\bElements\b(?!\w)/,/\bElementsBuilder\b/,/\bLiquidCommerceElements\b/,/BaseComponent/,/Elements(?:Base)?Client/,/(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,/(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,/(?:Product|Cart|Checkout|Address|ProductList).*Component/],d=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\/(?:main|checkout)\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],p=[/elements-sdk[/\\]/i,/modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,/core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,/@liquidcommerce[/\\]elements-sdk/i],f=isSDKSource(a),g=c.some(e=>e.test(s)),v=l.some(e=>e.test(s)),y=d.some(e=>e.test(s)),b=p.some(e=>e.test(s));return r||f||g||v||y||b}function isSDKSource(e){if(!e||"string"!=typeof e)return![];const n=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return n.some(n=>n.test(e))}class SingletonManager{static getInstances(){return"builder"===SingletonManager.currentContext?(SingletonManager.builderClientInstances||(SingletonManager.builderClientInstances=new Map),SingletonManager.builderClientInstances):(SingletonManager.regularClientInstances||(SingletonManager.regularClientInstances=new Map),SingletonManager.regularClientInstances)}constructor(){}static setContext({isBuilder:e}){SingletonManager.currentContext=e?"builder":"regular"}static setClientConstructor(e){SingletonManager.clientConstructor=e}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(e,n){const o=SingletonManager.getInstances();o.has(e)||o.set(e,n());const r=o.get(e);if(!r)throw new SDKError("ElementsSdk: Instance for class "+e+" could not be created.");return r}static async getClient(e){const n=[e.apiKey,e.env,e.isBuilder,e.debugMode].join("_"),o="LiquidCommerceElementsClient_"+n,r=SingletonManager.getInstances();if(r.has(o))return r.get(o);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const s=new SingletonManager.clientConstructor(e);return await s.prepare(),r.set(o,s),s}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";class LoggerService{constructor(e){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.telemetryService=null,this.context=e}static getInstance(e){return SingletonManager.getClassInstance("LoggerService_"+e,()=>new LoggerService(e))}setEnableLogging(e){this.enableLogging=e}setTelemetryService(e){this.telemetryService=e}getPrefix(e){if(!this.enableLogging)return[];const n=(new Date).toISOString().slice(11,23);return["%c["+n+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[e],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[e],"color: "+this.colors[e]]}debug(e,n){if(this.sendToTelemetry("debug",e,void 0,n),!this.enableLogging)return;const[o,...r]=this.getPrefix("debug");void 0!==n?console.debug(o,...r,e,n):console.debug(o,...r,e)}info(e,n){if(!this.enableLogging)return;const[o,...r]=this.getPrefix("info");void 0!==n?console.info(o,...r,e,n):console.info(o,...r,e)}warn(e,n){if(this.sendToTelemetry("warn",e,void 0,n),!this.enableLogging)return;const[o,...r]=this.getPrefix("warn");void 0!==n?console.warn(o,...r,e,n):console.warn(o,...r,e)}error(e,n){const o=n instanceof Error;let r=o?n:void 0,s=!o&&n?n:void 0;if(s&&s.error instanceof Error){r=s.error;const{error:e,...n}=s;s=Object.keys(n).length>0?n:void 0}if(this.sendToTelemetry("error",e,r,s),!this.enableLogging)return;const[a,...c]=this.getPrefix("error");if(console.group(a+" "+e,...c),r){console.log("Type:",r.name||"Error"),console.log("Message:",r.message),r.stack&&console.log("Stack:",r.stack),r.cause&&console.log("Caused by:",r.cause);const e=Object.keys(r).filter(e=>!["name","message","stack","cause"].includes(e));if(e.length>0){const n={};for(const o of e)n[o]=r[o];console.log("Additional:",n)}}s&&Object.keys(s).length>0&&console.log("Context:",s),console.groupEnd()}sendToTelemetry(e,n,o,r){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(e,n,{context:this.context,error:o,data:r})}catch(s){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(e){const n=this.getInstances();if(!n.has(e)){const o=LoggerService.getInstance(e);o.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&o.setTelemetryService(this.telemetryService),n.set(e,o)}return n.get(e)}static setEnableLogging(e){this.enableLoggingGlobally=e;const n=this.getInstances();for(const[,o]of n)o.setEnableLogging(e)}static setTelemetryService(e){this.telemetryService=e;const n=this.getInstances();for(const[,o]of n)o.setTelemetryService(e)}}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null;class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(e){this.client=e}async setPersistedStore(e,n){try{if(!e)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!n||0===Object.keys(n).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+e,{body:n})}catch(o){this.logger.error("Error setting persisted store",o)}}async getPersistedStore(e){try{if(!e)return this.logger.error("User device ID is required to get persisted store"),null;const n=await this.client.get("/configs/store/"+e);return n.data}catch(n){return this.logger.error("Error fetching persisted store",n),null}}async deletePersistedStore(e){try{if(!e)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+e+"/delete")}catch(n){this.logger.error("Error deleting persisted store",n)}}async getAddressSuggestions(e){try{if(!e||0===e.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const n=await this.client.post("/address/autocomplete",{body:{input:e}});return n.data}catch(n){return this.logger.error("Error fetching address suggestions",n),[]}}async getAddressDetails(e){try{if(!e||0===e.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const n=await this.client.post("/address/details",{body:{id:e}});return n.data}catch(n){throw this.logger.error("Error fetching address details",n),new SDKError("Failed to fetch address details: "+(null==n?void 0:n.message))}}async getProductsData(e,n){try{if(0===e.length)return this.logger.error("No product identifiers provided"),null;const o={identifiers:e,location:n},r=await this.client.post("/product/availability",{body:o});return r.data}catch(o){return this.logger.error("Error fetching product data",o),null}}async catalogSearch(e){try{const n=await this.client.post("/product/search",{body:e});return n.data}catch(n){return this.logger.error("Error fetching catalog search data",n),{products:[],retailers:{},navigation:{currentPage:1,totalPages:0,totalCount:0,filters:[]}}}}async getCartData(e){try{const n=await this.client.post("/cart/get",{body:{id:e||void 0}});return n.data}catch(n){throw this.logger.error("Error fetching cart data",n),new SDKError("Failed to fetch cart data: "+n.message)}}async updateCart(e){try{const n=await this.client.post("/cart/update",{body:e});return n.data}catch(n){throw this.logger.error("Error updating cart",n),new SDKError("Failed to update cart: "+(null==n?void 0:n.message))}}async prepareCheckout(e){try{const n=await this.client.post("/checkout/prepare",{body:e});return n.data}catch(n){throw this.logger.error("Error fetching prepare checkout data",n),new SDKError("Failed to fetch prepare checkout data: "+(null==n?void 0:n.message))}}async updateCheckoutItems(e){try{const n=await this.client.post("/checkout/items",{body:e});return n.data}catch(n){throw this.logger.error("Error updating checkout items",n),new SDKError("Failed to update checkout items: "+(null==n?void 0:n.message))}}async getPaymentSession(e){try{const n=await this.client.post("/checkout/payment/session",{body:{cartId:e}});return n.data}catch(n){throw this.logger.error("Error fetching payment session",n),new SDKError("Failed to get payment session: "+(null==n?void 0:n.message))}}async confirmPaymentSession(e){try{const n=await this.client.post("/checkout/payment/confirm",{body:e});return n.data}catch(n){throw this.logger.error("Error confirming payment session",n),new SDKError("Failed to confirm payment session: "+(null==n?void 0:n.message))}}async checkoutComplete(e){try{const n=await this.client.post("/checkout/complete",{body:{token:e}});return n.data}catch(n){if(this.logger.error("Error completing checkout",n),null==n?void 0:n.error)throw new SDKError("Failed to complete checkout: "+(null==n?void 0:n.message));throw n}}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(e,n)=>e||n&&n.status>=500&&n.status<600?!![]:![],this.xhrFetch=(e,n)=>new Promise((o,r)=>{const s=new XMLHttpRequest;s.open(n.method||"GET",e);for(const[e,a]of Object.entries(n.headers))s.setRequestHeader(e,a);s.onload=()=>{const e={ok:s.status>=200&&s.status<300,status:s.status,statusText:s.statusText,headers:s.getAllResponseHeaders().split("\r\n").reduce((e,n)=>{const[o,r]=n.split(": ");return o&&r&&(e[o]=r),e},{}),t:s.responseText,json:()=>Promise.resolve(JSON.parse(s.responseText)),text:()=>Promise.resolve(s.responseText)};o(e)},s.onerror=()=>{r(new TypeError("Network request failed"))},s.ontimeout=()=>{r(new TypeError("Network request timed out"))},s.timeout=3e4,s.send(n.body)}),this.fetchImpl=this.getFetchImplementation()}async request(e){var n,o,r;const{url:s,options:a,retryConfig:c}=e,l=null!==(n=null==c?void 0:c.maxRetries)&&void 0!==n?n:3,d=null!==(o=null==c?void 0:c.retryDelay)&&void 0!==o?o:1e3,p=null!==(r=null==c?void 0:c.shouldRetry)&&void 0!==r?r:this.defaultShouldRetry;let f;const g=Date.now();for(let y=0;y<=l;y++){let e=Date.now();try{e=Date.now();const n=await this.fetchImpl(s,a),o=Date.now()-e;if(n.ok)return n;if(await this.logFailedResponse(s,a,n,o,y,l),y<l&&p(null,n)){await this.delay(d*2**y);continue}return n}catch(v){const n=Date.now()-e;if(f=v,this.logNetworkError(s,a,v,n,y,l),y<l&&p(v,void 0)){await this.delay(d*2**y);continue}throw this.enhanceError(v,s,a,Date.now()-g)}}throw this.enhanceError(f,s,a,Date.now()-g)}async logFailedResponse(e,n,o,r,s,a){const c=s<a;let l,d;try{o.t||(o.t=await o.text());try{l=JSON.parse(o.t)}catch(p){l=o.t}}catch(f){l="[Unable to read response body]"}if(n.body)try{d=JSON.parse(n.body)}catch(g){d=n.body}this.logger.error("HTTP request failed",{method:n.method,url:e,status:o.status,statusText:o.statusText,duration:r+"ms",attempt:s+1+"/"+(a+1),willRetry:c,requestHeaders:n.headers,requestBody:d,responseHeaders:o.headers,responseBody:l})}logNetworkError(e,n,o,r,s,a){var c;const l=s<a;this.logger.error("Network request failed",{method:n.method,url:e,error:o,errorType:(null===(c=null==o?void 0:o.constructor)||void 0===c?void 0:c.name)||typeof o,duration:r+"ms",attempt:s+1+"/"+(a+1),willRetry:l,possibleCauses:this.diagnosePossibleCauses(o)})}diagnosePossibleCauses(e){var n,o,r,s,a;const c=[];return((null===(n=null==e?void 0:e.message)||void 0===n?void 0:n.includes("timeout"))||(null===(o=null==e?void 0:e.message)||void 0===o?void 0:o.includes("timed out")))&&c.push("Request timeout - server took too long to respond"),((null===(r=null==e?void 0:e.message)||void 0===r?void 0:r.includes("Failed to fetch"))||(null===(s=null==e?void 0:e.message)||void 0===s?void 0:s.includes("Network request failed")))&&(c.push("Network connectivity issue"),c.push("CORS policy blocking the request"),c.push("Server is not responding"),c.push("Request was blocked by browser or firewall")),(null===(a=null==e?void 0:e.message)||void 0===a?void 0:a.includes("aborted"))&&c.push("Request was aborted"),0===c.length&&c.push("Unknown network error"),c}enhanceError(e,n,o,r){const s=new Error((null==e?void 0:e.message)||"Network request failed - no response from server");return s.url=n,s.method=o.method,s.totalDuration=r+"ms",s.isNetworkError=!![],s.originalError=e,s.possibleCauses=this.diagnosePossibleCauses(e),s}delay(e){return new Promise(n=>setTimeout(n,e))}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):window.fetch?this.fetchAdapter(window.fetch):this.xhrFetch}fetchAdapter(e){return async(n,o)=>{var r;const s=await e(n,o);let a;if("function"==typeof(null===(r=s.headers)||void 0===r?void 0:r.entries))a=Object.fromEntries(s.headers.entries());else{a={};for(const[e,n]of s.headers)a[e]=n}const c={ok:s.ok,status:s.status,statusText:s.statusText,headers:a,json:async()=>(c.t||(c.t=await s.text()),JSON.parse(c.t)),text:async()=>(c.t||(c.t=await s.text()),c.t)};return c}}}const e={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",INTERNAL_CART_TO_CHECKOUT:"internal_cart_to_checkout",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},o={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},r={DRAWER:"drawer",INPUT:"input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",MODAL:"modal",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",PRODUCT_LIST_RETAILERS:"product-list-retailers",PRODUCT_LIST_ENGRAVING_FORM:"product-list-engraving-form",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},s={ON_DEMAND:"onDemand",SHIPPING:"shipping"},a={NONE:"none",CONSOLE:"console",PANEL:"panel"},c={GENERIC:"generic",PROMO_CODE:"promo-code",GIFT_CARD:"gift-card"},l={SUCCESS:"success",WARNING:"warning",ERROR:"error"},d={[e.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[e.STAGING]:"https://staging-elements.liquidcommerce.us",[e.PRODUCTION]:"https://elements.liquidcommerce.us"},p={ENGRAVING:"engraving",PRESALE:"presale",FULFILLMENT:"fulfillment",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},f={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,LOADING_INDICATOR:5730,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,SKELETON_WAVE:5040,MODAL:2147483640},g="lce",v={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},y={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:s.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},b={id:"",subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},k={token:"",cartId:"",loading:![],updating:![],error:null,presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddress:{formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},promoCode:null,giftCards:[],orderNumber:null,itemsQuantity:0,items:{},fulfillments:{},retailers:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,engraving:0,giftCards:0,tip:0,service:0,platform:0,tax:0},rerender:![],tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},x={drawer:{isOpen:![],contentConfig:null},modal:{isOpen:![],contentConfig:null}},w={checkout:{injection:null,returnUrl:null}},C={products:[],retailers:{},filters:[],pagination:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]},appliedFilters:{},searchTerm:"",gridConfig:void 0,userProducts:{},loading:![]},S={products:{},cart:b,address:v,checkout:k,ui:x,metadata:w,productsList:C};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(e,n={}){this.validateInputs(e,n),this.config=Object.freeze(this.buildConfiguration(e,n))}getConfigs(){return{...this.config}}get(e){return this.config[e]}set(e,n){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[e]:n})}isDevelopment(){return this.get("env")===e.DEVELOPMENT}isStaging(){return this.get("env")===e.STAGING}isProduction(){return this.get("env")===e.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const e=this.get("debugMode");return e===a.CONSOLE||e===a.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===a.PANEL}debuggingDisabled(){const e=this.get("debugMode");return e===a.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}getProxyConfig(){return this.get("proxy")}validateInputs(n,o){if(!(null==n?void 0:n.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(o.env&&!Object.values(e).includes(o.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+o.env+'". Using default environment.'),o.env=void 0),void 0!==o.isBuilder&&"boolean"!=typeof o.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),o.isBuilder=void 0),void 0===o.debugMode||Object.values(a).includes(o.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+o.debugMode+'". Must be one of: '+Object.values(a).join(", ")+". Using default value."),o.debugMode=void 0),o.promoTicker&&"object"!=typeof o.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),o.promoTicker=void 0),o.checkout&&("object"!=typeof o.checkout?(console.warn("[LiquidCommerce Elements] checkout must be an object. Skipping checkout configuration."),o.checkout=void 0):o.checkout.pageUrl&&"string"==typeof o.checkout.pageUrl?o.checkout.pageUrl.trim()?o.checkout.pageUrl.includes("{id}")||console.warn('[LiquidCommerce Elements] checkout.pageUrl does not include "{id}" placeholder and will not include cart IDs.'):(console.warn("[LiquidCommerce Elements] checkout.pageUrl cannot be empty. Skipping checkout configuration."),o.checkout=void 0):(console.warn("[LiquidCommerce Elements] checkout.pageUrl is required and must be a string. Skipping checkout configuration."),o.checkout=void 0)),o.promoTicker)if(Array.isArray(o.promoTicker)){const e=o.promoTicker.filter((e,n)=>{if(!e.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(e.text)||0===e.text.length||!e.text.every(e=>"string"==typeof e&&e.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof e.separator||!e.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!e.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom is required. Skipping this promo."),![];const o="string"==typeof e.activeFrom?new Date(e.activeFrom):e.activeFrom;if(!(o instanceof Date)||Number.isNaN(o.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!e.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil is required. Skipping this promo."),![];const r="string"==typeof e.activeUntil?new Date(e.activeUntil):e.activeUntil;return r instanceof Date&&!Number.isNaN(r.getTime())?o>=r?(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});o.promoTicker=e.length>0?e:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),o.promoTicker=void 0;o.proxy&&("object"!=typeof o.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),o.proxy=void 0):o.proxy.baseUrl&&"string"==typeof o.proxy.baseUrl?o.proxy.headers&&"object"!=typeof o.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),o.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),o.proxy=void 0))}buildConfiguration(n,o){var r,s,c,l;const p=o.env||e.PRODUCTION;let f=d[p];const v=p===e.PRODUCTION,y=o.isBuilder||![],b=g+(v?"":"_"+p)+(y?"builder":"");return(null===(r=o.development)||void 0===r?void 0:r.customApiUrl)&&(f=o.development.customApiUrl),{apiKey:n.trim(),env:p,isBuilder:y,debugMode:o.debugMode||a.NONE,baseUrl:f,partnerCode:void 0,partnerName:void 0,customTheme:o.customTheme||null,proxy:o.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:b,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:o.promoTicker||null,paymentMethodId:(null===(s=o.development)||void 0===s?void 0:s.paymentMethodId)||void 0,openShadowDom:v?![]:(null===(c=o.development)||void 0===c?void 0:c.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(l=o.development)||void 0===l?void 0:l.customApiUrl),checkout:o.checkout||null}}detectDeviceType(){var e,n;if("undefined"==typeof navigator)return"desktop";const o=navigator.userAgent.toLowerCase(),r="ontouchstart"in window||navigator.maxTouchPoints>0,s=(null===(e=window.screen)||void 0===e?void 0:e.width)||0,a=(null===(n=window.screen)||void 0===n?void 0:n.height)||0,c=Math.max(s,a),l=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],d=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return l.some(e=>e.test(o))?"tablet":d.some(e=>e.test(o))||r&&c<768?"mobile":r&&c>=768&&c<=1200||r&&/macintosh/i.test(o)&&navigator.maxTouchPoints>1||/android/i.test(o)&&r&&c>=768||/windows nt/i.test(o)&&r&&c>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(o),"desktop")}}class AuthClientService{constructor(e){this.accessToken=null,this.tokenExpiration=null,this.authPromise=null,this.refreshPromise=null,this.shouldRetryNonAuth=(e,n)=>e?!![]:n&&this.isAuthError(n)?![]:n&&n.status>=500&&n.status<600,this.apiKey=e.apiKey,this.baseUrl=e.baseUrl,this.env=e.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(e){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(e))}async authenticateAndGetConfigs(){var e,n,o,r,s,a,c,l,d;try{this.logger.info("Authenticating and fetching configurations in single request");const p=await this.request("/auth/authenticate",{method:"GET"},!![]);return(null===(n=null===(e=null==p?void 0:p.data)||void 0===e?void 0:e.auth)||void 0===n?void 0:n.accessToken)&&(null===(r=null===(o=null==p?void 0:p.data)||void 0===o?void 0:o.auth)||void 0===r?void 0:r.expiration)?(null===(d=null==p?void 0:p.data)||void 0===d?void 0:d.configs)?(this.accessToken=p.data.auth.accessToken,this.tokenExpiration=p.data.auth.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Successfully authenticated and retrieved configurations"),{success:!![],configs:{...p.data.configs,productList:{theme:{backgroundColor:"#FFFFFF"},layout:{productCard:{style:"card",cornerRadius:"rounded",showPrice:!![],showSizeSelector:!![],showFulfillment:!![],showRetailerName:!![],showQuantityCounter:!![],enablePersonalization:!![],enableShippingFulfillment:!![],enableOnDemandFulfillment:!![],showCollections:![]}}}}}):(this.logger.error("Combined auth response missing configs data",{response:null==p?void 0:p.data}),{success:![]}):(this.logger.error("Combined auth response missing required auth fields",{hasToken:!!(null===(a=null===(s=null==p?void 0:p.data)||void 0===s?void 0:s.auth)||void 0===a?void 0:a.accessToken),hasExp:!!(null===(l=null===(c=null==p?void 0:p.data)||void 0===c?void 0:c.auth)||void 0===l?void 0:l.expiration),response:null==p?void 0:p.data}),{success:![]})}catch(p){return this.logger.error("Failed to authenticate and get configs from combined endpoint",{error:p,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),{success:![]}}}async authenticate(){if(this.authPromise)return this.authPromise;this.authPromise=this.performAuthentication();try{return await this.authPromise}finally{this.authPromise=null}}async refreshToken(){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async get(e,n){return this.request(e,{method:"GET",headers:null==n?void 0:n.headers})}async post(e,n){return this.request(e,{method:"POST",body:null==n?void 0:n.body,headers:null==n?void 0:n.headers})}async performAuthentication(){var e,n,o,r;try{const s=await this.request("/auth",{method:"GET"},!![]);return(null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.accessToken)&&(null===(n=null==s?void 0:s.data)||void 0===n?void 0:n.expiration)?(this.accessToken=s.data.accessToken,this.tokenExpiration=s.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,!![]):(this.logger.error("Authentication response missing required fields",{hasToken:!!(null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.accessToken),hasExp:!!(null===(r=null==s?void 0:s.data)||void 0===r?void 0:r.expiration),response:null==s?void 0:s.data}),![])}catch(s){return this.logger.error("Failed to obtain access token from authentication endpoint",{error:s,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),![]}}async performTokenRefresh(){var e,n,o,r;try{this.logger.info("Attempting to refresh access token");const s=await this.request("/auth/refresh",{method:"POST"},![],!![]);return(null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.accessToken)&&(null===(n=null==s?void 0:s.data)||void 0===n?void 0:n.expiration)?(this.accessToken=s.data.accessToken,this.tokenExpiration=s.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Access token refreshed successfully"),!![]):(this.logger.error("Token refresh response missing required fields",{hasToken:!!(null===(o=null==s?void 0:s.data)||void 0===o?void 0:o.accessToken),hasExp:!!(null===(r=null==s?void 0:s.data)||void 0===r?void 0:r.expiration),response:null==s?void 0:s.data}),![])}catch(s){return this.logger.warn("Failed to refresh access token, will fall back to full authentication",{error:s,status:null==s?void 0:s.status,endpoint:"/auth/refresh"}),![]}}async request(e,n,o=![],r=![]){if(!o&&!r&&(!this.accessToken||this.isTokenExpired())){let e=this.accessToken?await this.refreshToken():![];if(e||(this.logger.info("Token refresh failed or unavailable, attempting full authentication"),e=await this.authenticate()),!e)throw{status:401,message:"Authentication failed - unable to obtain valid access token",isAuthError:!![]}}const s=this.buildUrl(e),a=this.buildHeaders(n.headers,o),c=await this.httpClient.request({url:s,options:{method:n.method,headers:a,body:n.body?JSON.stringify(n.body):void 0},retryConfig:{maxRetries:AuthClientService.MAX_RETRIES,retryDelay:AuthClientService.RETRY_DELAY_MS,shouldRetry:this.shouldRetryNonAuth}});return c.ok?this.handleSuccessResponse(c,e,n.method):!this.isAuthError(c)||o||r?this.handleErrorResponse(c):this.handleAuthError(c,e,n)}async handleSuccessResponse(e,n,o){try{return await e.json()}catch(r){const s=await e.text().catch(()=>"Success");return this.logger.error("Response returned 2xx status but body is not valid JSON",{path:n,method:o,status:e.status,responsePreview:s.substring(0,1e3),error:r}),{message:s}}}async handleAuthError(e,n,o){this.logger.warn("Access token rejected with "+e.status+", attempting to obtain new token and retry request",{status:e.status,path:n,method:o.method});let r=await this.refreshToken();return r||(this.logger.info("Token refresh failed after auth error, attempting full authentication"),this.clearToken(),r=await this.authenticate()),r?this.request(n,o,![],!![]):(this.logger.error("Unable to obtain new access token after receiving auth error, request cannot be retried",{status:e.status,path:n,method:o.method}),this.handleErrorResponse(e))}async handleErrorResponse(e){let n;try{n=await e.json()}catch(o){const r=await e.text().catch(()=>"HTTP error status: "+e.status);n={message:r||"Unknown error"}}throw{...n,status:e.status,message:(null==n?void 0:n.message)||"Request failed"}}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}clearToken(){this.accessToken=null,this.tokenExpiration=null}buildUrl(e){const n=this.clientConfig.getProxyConfig();return new URL("api"+e,n?n.baseUrl:this.baseUrl).toString()}buildHeaders(e,n=![]){const o={"Content-Type":"application/json","X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now().toString(),"X-Liquid-UD-ID":this.clientConfig.get("userDeviceId")||"unknown",...this.getProxyHeaders(),...e};return n?o["X-Liquid-Api-Key"]=this.apiKey:o.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(o["X-Liquid-Api-Builder"]="true"),o}getProxyHeaders(){const e=this.clientConfig.getProxyConfig();return e?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...e.headers}:{}}isAuthError(e){return 401===e.status||403===e.status}}AuthClientService.TOKEN_EXPIRATION_BUFFER_MS=6e5,AuthClientService.MAX_RETRIES=2,AuthClientService.RETRY_DELAY_MS=1e3;const _="@liquidcommerce/elements-sdk",E="LiquidCommerce Elements SDK",T="UNLICENSED",I="LiquidCommerce Team",P="2.6.0-beta.33",D="https://docs.liquidcommerce.co/elements-sdk",A={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},F={url:"https://github.com/liquidcommerce/elements-sdk/issues"},M="./dist/index.esm.js",L="./umd/elements.js",R="./dist/types/index.d.ts",N="pnpm@10.0.0",z={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./checkout":{types:"./dist/types/index.checkout.d.ts",import:"./dist/index.checkout.esm.js",browser:"./umd/elements-checkout.js",default:"./dist/index.checkout.esm.js"},"./package.json":"./package.json"},j=["dist","umd","docs","README.md","LICENSE"],B={access:"public",registry:"https://registry.npmjs.org/"},q="module",V=["dist/index.esm.js","dist/index.checkout.esm.js","umd/elements.js","umd/elements-checkout.js","src/index.ts","src/index.umd.ts","src/index.checkout.ts","src/index.checkout.umd.ts"],G={build:"rollup -c","build:checkout":"rollup -c rollup.config.checkout.mjs","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build && pnpm build:checkout",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd node_modules && pnpm install && pnpm build && pnpm build:checkout",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},K=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],Y={"@biomejs/biome":"2.3.11","@commitlint/cli":"^20.3.1","@commitlint/config-conventional":"^20.3.1","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.3","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^25.0.10","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.56.0","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},W={node:">=22"},Q={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},Z={name:_,description:E,license:T,author:I,version:P,homepage:D,repository:A,bugs:F,module:M,browser:L,types:R,packageManager:N,exports:z,files:j,publishConfig:B,type:q,sideEffects:V,scripts:G,keywords:K,devDependencies:Y,engines:W,pnpm:Q};class GoogleTagManagerService{constructor(){this.enablePartnerGTM=![],this.enableLiquidCommerceGTM=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(e=>{if("loading"!==document.readyState)return e(),void 0;document.addEventListener("DOMContentLoaded",()=>e())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(e){const n=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return n.some(n=>{const o=n.src;return o.includes("id="+e)})}isContainerInitialized(e){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(e)?window.dataLayer.some(e=>e&&"object"==typeof e&&("gtm.start"in e||"gtm.js"===e.event)):![]}async loadGTMScript(e){try{if(this.isContainerInitialized(e))return{success:!![],usingExistingGTM:!![],message:"Container "+e+" already loaded"};if(this.isContainerLoaded(e)){const n=await this.waitForContainerInit(e,1e4);return n?{success:!![],usingExistingGTM:!![],message:"Container "+e+" initialized"}:this.checkFallbackGTM(e)}return await this.injectGTMScript(e),{success:!![],usingExistingGTM:![],message:"Container "+e+" loaded successfully"}}catch(n){return this.checkFallbackGTM(e)}}waitForContainerInit(e,n){return new Promise(o=>{let r;const s=setInterval(()=>{this.isContainerInitialized(e)&&(clearInterval(s),clearTimeout(r),o(!![]))},100);r=setTimeout(()=>{clearInterval(s),o(![])},n)})}injectGTMScript(e){return new Promise((n,o)=>{const r=document.createElement("script");r.src="https://www.googletagmanager.com/gtm.js?id="+e,r.async=!![],r.crossOrigin="anonymous";let s=![];const a=setTimeout(()=>{s||(s=!![],this.isContainerInitialized(e)?n():o(new Error("GTM script timeout")))},15e3);r.onload=()=>{s||setTimeout(()=>{s||(s=!![],clearTimeout(a),this.isContainerInitialized(e)||window.dataLayer&&Array.isArray(window.dataLayer)?n():o(new Error("GTM script loaded but failed to initialize")))},500)},r.onerror=()=>{setTimeout(()=>{s||(s=!![],clearTimeout(a),this.isContainerLoaded(e)&&this.isContainerInitialized(e)?n():o(new Error("GTM script failed to load")))},100)},document.head.appendChild(r)})}checkFallbackGTM(e){if(this.isGTMAlreadyLoaded()&&window.dataLayer&&Array.isArray(window.dataLayer)){if(this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId))return{success:!![],usingExistingGTM:!![],message:"Using partner GTM container"};const e=window.dataLayer.some(e=>e&&"object"==typeof e&&("gtm.start"in e||"gtm.js"===e.event));if(e)return{success:!![],usingExistingGTM:!![],message:"Using existing GTM container"}}return window.dataLayer&&Array.isArray(window.dataLayer)?{success:!![],usingExistingGTM:!![],message:"Using basic dataLayer for event tracking"}:{success:![],usingExistingGTM:![],message:"Failed to load container "+e+" and no fallback available"}}processEventQueue(){const e=Date.now(),n=this.eventQueue.filter(n=>e-n.timestamp<3e4);for(const r of n)try{const e={event:r.eventName,...r.eventData};window.dataLayer.push(e)}catch(o){this.logger.error("Error processing queued event "+r.methodName,o)}this.eventQueue=[],n.length>0&&this.logger.info("Processed "+n.length+" queued GTM events")}getSendToTargets(){const e=[];return this.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&e.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&e.push(this.partnerGTMId),e}async initialize(e){try{if(this.isInitialized)return Promise.resolve();if(this.isInitializing&&this.initializationPromise)return this.initializationPromise;if(0,this.clientConfigService.isBuilder())return;this.isInitializing=!![],this.initializationPromise=this.doInitialize(e),await this.initializationPromise}catch(n){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",n)}}async doInitialize(e){if(!(null==e?void 0:e.partnerName)||!(null==e?void 0:e.liquidCommerceGTMId))return;if(!e.enableLiquidCommerceGTM&&!e.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=e.partnerName,this.partnerCode=e.partnerCode,this.partnerGTMId=e.partnerGTMId,this.liquidCommerceGTMId=e.liquidCommerceGTMId,this.enablePartnerGTM=e.enablePartnerGTM,this.enableLiquidCommerceGTM=e.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...e)=>window.dataLayer.push(e));const n=e.enableLiquidCommerceGTM?await this.loadGTMScript(e.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!n.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+n.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(n.message),this.processEventQueue()}executeEvent(e,n,o){try{if(this.clientConfigService.isBuilder())return;const r=this.getSendToTargets(),s={...o,...r.length>0&&{send_to:r},tenant_name:this.partnerName,tenant_code:this.partnerCode,tenant_source:Z.description+" v"+Z.version};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:e,eventName:n,eventData:s,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const a={event:n,...s};window.dataLayer.push(a)}catch(r){this.logger.error("GTM "+e+" error",r)}}calculateValue(e){const n=e.reduce((e,n)=>e+(n.price||0)*(n.quantity||1),0);return Number.parseFloat(n.toFixed(2))}viewItem(e){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}viewItemList(e,n,o){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:n,item_list_name:o,items:e})}selectItem(e,n,o){this.executeEvent("selectItem","select_item",{item_list_id:n,item_list_name:o,items:[e]})}addToCart(e){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([e]),quantity:e.quantity||1,items:[e]})}viewCart(e){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(e),items:e})}removeFromCart(e){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}beginCheckout(e,n){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(e),coupon:n,items:e})}addShippingInfo(e,n){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(e),coupon:n,items:e})}addPaymentInfo(e,n,o){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(e),payment_type:n,coupon:o,items:e})}purchase(e){this.executeEvent("purchase","purchase",{transaction_id:e.transaction_id,value:e.value,currency:this.currency,tax:e.tax,shipping:e.shipping,coupon:e.coupon,items:e.items,subtotal:e.subtotal,total:e.total_before_discounts,discounts:e.discounts,gift_cards:e.gift_cards,net_total:e.net_total})}promoCodeAttempt(e){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:e})}promoCodeApplied(e,n){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:e,discount_amount:n})}promoCodeFailed(e,n){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:e,reason:n})}giftCardAttempt(e){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:e})}giftCardApplied(e,n){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:e,applied_amount:n})}giftCardFailed(e,n){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:e,reason:n})}addressUpdated(e){this.executeEvent("addressUpdated","address_updated",{address_id:e.googlePlacesId,formatted_address:e.formattedAddress,address:e.address,coordinates:e.coordinates})}addressFailed(e){this.executeEvent("addressFailed","address_failed",{address_id:e.googlePlacesId,formatted_address:e.formattedAddress,address:e.address,address_error_message:e.error})}productNoAvailability(e){this.executeEvent("productNoAvailability","product_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}productSizeNoAvailability(e){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,size_id:e.sizeId,size_name:e.sizeName,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}productFulfillmentNoAvailability(e){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,size_id:e.sizeId,size_name:e.sizeName,fulfillment_type:e.fulfillmentType,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}}class PubSubService{constructor(){this.clientReadyEvent=null,this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub"),this.setupClientReadyBuffering()}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(e,n){this.publishSpecific("actions."+e,n)}publishForm(e,n){this.publishSpecific("forms."+e,n)}publishSpecific(e,n){const[o,r]=e.includes(".")?e.split(".",2):["actions",e];let s=r.split("_")[0];["product","cart","address","checkout"].includes(s)||(s="other");const a=Date.now(),c={eventId:"evt_"+a+"_"+Math.random().toString(36).slice(2,9),namespace:o,event:r,originalEvent:e,actionNamespace:"actions"===o?s:void 0,timestamp:a},l={data:n,metadata:c};this.dispatchNativeEvents(e,l)}dispatchNativeEvents(e,n){const[o]=e.split(".",2);try{"actions.client_ready"===e&&(this.clientReadyEvent=n);const r=new CustomEvent(this.eventPrefix+":"+e,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(r);const s=new CustomEvent(this.eventPrefix+":"+o,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(s)}catch(r){this.logger.error("Error dispatching native events for "+e,r)}}setupClientReadyBuffering(){try{const e=window.addEventListener,n=this.eventPrefix+":actions.client_ready";window.addEventListener=(o,r,s)=>{if(o!==n)return e.call(window,o,r,s);if(!this.clientReadyEvent)return e.call(window,o,r,s);try{const e=new CustomEvent(n,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof r?r(e):r&&"function"==typeof r.handleEvent&&r.handleEvent(e)}catch(a){this.logger.error("Error replaying CLIENT_READY event",a)}return e.call(window,o,r,s)}}catch(Z){this.logger.error("Error setting up CLIENT_READY buffering",Z)}}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:e,payload:n,next:o})=>{const r=performance.now();try{const s=o(),a=performance.now()-r;return this.logger.info("🏪 Store "+e+" ✓ "+a.toFixed(3)+"ms",n),s}catch(s){const o=performance.now()-r;throw this.logger.error("🏪 Store "+e+" ✗ "+o.toFixed(3)+"ms",{payload:n,error:s}),s}},this.performanceMiddleware=({action:e,next:n})=>{const o=performance.now(),r=n(),s=performance.now()-o;return s>16&&this.logger.warn('⚠️ Slow store operation "'+e+'": '+s.toFixed(2)+"ms"),r},this.state=S,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:e,isLocalStorageAvailable:n,persistedStore:o}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+e,this.isLocalStorageAvailable=n,n?await this.loadPersistedState():o&&await this.loadFromDBPersistence(o),this.state={...this.state,metadata:w},this.logger.info("Store service initialized successfully",{userDeviceId:e,isLocalStorageAvailable:n,hasPersistedState:null!==o,localStorageKey:this.localStorageKey})}get(e){if(!e)return{...this.state};const n=e.split(".");let o=this.state;for(const r of n){if(null==o)return;o=o[r]}return void 0!==o?Array.isArray(o)?[...o]:"object"==typeof o&&null!==o?{...o}:o:void 0}set(e,n){return this.runWithMiddleware("set",{path:e,value:n},()=>{const o=this.get(e);return this.state=this.immutableSet(this.state,e,n),this.notifyListeners(e,n,o),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(e,n){const o=this.get(e),r=n(o);return this.set(e,r)}remove(e){return this.runWithMiddleware("remove",{path:e},()=>{const n=this.get(e);if(void 0===n)return this.logger.warn('No value found at path "'+e+'" to remove.'),![];const o=e.split(".");let r=this.state;const s=o.pop();for(const a of o){if(void 0===r[a])return this.logger.warn('Path "'+e+'" does not exist in the state.'),![];r=r[a]}if(Array.isArray(r))r=r.filter((e,n)=>n!==Number.parseInt(s,10));else{if("object"!=typeof r||null===r)return this.logger.warn('Cannot remove property "'+s+'" from non-object type at path "'+e+'".'),![];{const{[s]:e,...n}=r;r=n}}return this.state=this.immutableSet(this.state,o.join("."),r),this.notifyListeners(e,void 0,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(e){return this.runWithMiddleware("batch",{updates:e},()=>{const n=[];if("function"==typeof e){const o=e(this.state);for(const[e,r]of Object.entries(o)){const o=this.get(e);n.push({path:e,oldValue:o,newValue:r,timestamp:Date.now()}),this.state=this.immutableSet(this.state,e,r)}}else for(const[o,r]of Object.entries(e)){const e=this.get(o);n.push({path:o,oldValue:e,newValue:r,timestamp:Date.now()}),this.state=this.immutableSet(this.state,o,r)}for(const{path:e,oldValue:o,newValue:r}of n)this.notifyListeners(e,r,o);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(e,n){const o=e;return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(n),()=>{var e;null===(e=this.listeners.get(o))||void 0===e?void 0:e.delete(n)}}watchMany(e,n){const o=[];let r;const s=e.map(e=>this.watch(e,(s,a)=>{o.push({path:e,value:s,oldValue:a}),clearTimeout(r),r=setTimeout(()=>{o.length>0&&(n([...o]),o.length=0)},0)}));return()=>{for(const e of s)e()}}createProductInstance(e){const n="products."+e,o=this.get(n);return o?!![]:this.set(n,y)}removeProductInstance(e){const n=this.get("products"),{[e]:o,...r}=n;return this.set("products",r)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(e,n,o){let r=0;const h=()=>{if(r>=this.middleware.length)return o();const s=this.middleware[r++];return s({action:e,payload:n,state:this.getState(),next:h})};return h()}immutableSet(e,n,o){const r=n.split(".");if(1===r.length){if(Array.isArray(e)){const n=[...e];return n[r[0]]=o,n}return{...e,[r[0]]:o}}const[s,...a]=r,c=e[s],l=Array.isArray(c)?[]:{};if(Array.isArray(e)){const n=[...e];return n[s]=this.immutableSet(c||l,a.join("."),o),n}return{...e,[s]:this.immutableSet(c||l,a.join("."),o)}}notifyListeners(e,n,o){const r=this.listeners.get(e);if(r)for(const l of r)try{l(n,o)}catch(a){this.logger.error('Error in store listener for path "'+e+'"',a)}const s=e.split(".");for(let l=s.length-1;l>0;l--){const e=s.slice(0,l).join("."),n=this.listeners.get(e);if(n){const r=this.get(e),a=s.slice(l).join("."),d=this.immutableSet(r,a,o);for(const o of n)try{o(r,d)}catch(c){this.logger.error('Error in store listener for parent path "'+e+'"',c)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var e;const n=this.get("address.id")||"",o=this.get("cart.id");if(!n&&!o)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:n,cartId:o}),void 0;try{const r=null!==(e=this.clientConfig.get("userDeviceId"))&&void 0!==e?e:"not_defined";await this.api.setPersistedStore(r,{p:n,c:o}),this.logger.info("Session data persisted to DB",{userDeviceId:r,addressId:n,cartId:o})}catch(r){this.logger.error("Failed to persist session data to DB",r)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.info("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.info("localStorage entry completely removed",{key:this.localStorageKey})}catch(Z){this.logger.error("Failed to clear localStorage entry",Z)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let e="";if(this.clientConfig.debuggingDisabled()){const n=this.get("address.id")||"",o=this.get("cart.id");(n||o)&&(e=n+":"+o)}else e=this.getState();e&&localStorage.setItem(this.localStorageKey,"string"!=typeof e?JSON.stringify(e):e)}catch(e){this.logger.error("Failed to persist store state",e)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const n=localStorage.getItem(this.localStorageKey);if(!n)return;try{const e=JSON.parse(n);for(const[n,o]of Object.entries(e))this.set(n,o);return}catch(e){if(n.includes(":")){const[e,o]=n.split(":");if(void 0!==e){const n=await this.getAddressDataFromId(e);this.set("address",n)}return void 0!==o&&this.set("cart.id",o||""),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:n})}}catch(n){this.logger.error("Failed to load persisted state",n),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(e){try{if(void 0!==e.p){const n=await this.getAddressDataFromId(e.p);this.set("address",n)}void 0!==e.c&&this.set("cart.id",e.c||""),this.logger.info("Session data loaded from DB persistence",{addressId:e.p,cartId:e.c})}catch(n){this.logger.error("Failed to load session data from DB persistence",n)}}async getAddressDataFromId(e){if(!e||""===e.trim())return v;try{const n=await this.api.getAddressDetails(e);return n&&0!==Object.keys(n).length?{id:e,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:{latitude:n.coordinates.latitude,longitude:n.coordinates.longitude}}:{...v,id:e}}catch(n){return{...v,id:e}}}}const X=[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL,r.PRODUCT_OPTIONS,r.PRODUCT_INTERACTIONS,r.PRODUCT_DESCRIPTION,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST,r.PRODUCT_PRICE,r.PRODUCT_ADD_TO_CART_SECTION,r.PRODUCT_DRAWER,r.PRODUCT_LOADING,r.ENGRAVING_FORM,r.ENGRAVING_VIEW],J=[r.ADDRESS_INPUT,r.ADDRESS_DISPLAY],$=[r.CART,r.CART_RETAILER,r.CART_ITEM,r.CART_FOOTER,r.CART_ITEM_QUANTITY_PRICE,r.CART_RETAILER_SUBTOTAL,r.CART_PROMO_CODE,r.CART_HEADER,r.CART_BODY,r.CART_FULFILLMENT,r.BUTTONS_CART_OPEN],tt=[r.CHECKOUT,r.CHECKOUT_INFORMATION,r.CHECKOUT_STRIPE_HANDLER,r.CHECKOUT_STRIPE_FORM,r.CHECKOUT_PAYMENT,r.CHECKOUT_BILLING,r.CHECKOUT_ORDER_SUMMARY,r.CHECKOUT_PROMO_CODE,r.CHECKOUT_GIFT_CARDS,r.CHECKOUT_AMOUNTS,r.CHECKOUT_ITEMS,r.CHECKOUT_COMPLETED,r.CHECKOUT_DELIVER_TO,r.CHECKOUT_DELIVER_TO_SUMMARY,r.CHECKOUT_BUYER,r.CHECKOUT_TIPS,r.CHECKOUT_PC_GC,r.CHECKOUT_ITEM,r.CHECKOUT_ITEM_QUANTITY,r.CHECKOUT_PLACE_ORDER_BUTTON,r.CHECKOUT_HEADER,r.CHECKOUT_PRESALE_COUNTDOWN,r.CHECKOUT_PRESALE_EXPIRED,r.CHECKOUT_SEND_AS_GIFT],et=[r.PRODUCT_LIST,r.PRODUCT_LIST_CARD,r.PRODUCT_LIST_CARD_LOADING,r.PRODUCT_LIST_FILTERS,r.PRODUCT_LIST_SEARCH];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(e,n="swap"){if(!e||0===e.length)return;const o=[...this.defaultFontFamilies,...e],r=o.map(e=>{const n=encodeURIComponent(e.name);return"family="+n+":wght@"+e.weights.join(";")}).join("&"),s="display="+n;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+r+"&"+s,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(e,n="swap"){const o=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(e,n),o&&o.remove()}injectGoogleFontsResourceHints(){const e=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),n=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!e){const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.googleapis.com",document.head.appendChild(e)}if(!n){const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.gstatic.com",e.crossOrigin="",document.head.appendChild(e)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const e=document.createElement("link");e.rel="stylesheet",e.href=this.googleFontsUrl,e.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(e)}}const nt={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",linkTextColor:"--link-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},it={backgroundColor:"--product-background-color"},ot={backgroundColor:"--cart-background-color"},rt={backgroundColor:"--address-background-color"},st={backgroundColor:"--checkout-background-color"},at={backgroundColor:"--product-list-background-color"},ct={global:nt,product:it,cart:ot,address:rt,checkout:st,productList:at};function getCSSVariableMapping(e){return ct[e]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(e,n){const o={},r=getCSSVariableMapping(n);for(const[s,a]of Object.entries(r)){const n=this.getValueByPath(e,s);void 0!==n&&this.isCSSValue(n)&&(o[a]=n,this.isColorVariable(a,n)&&this.generateOpacityVariants(o,a,n))}return o}extractVariablesFromPartialTheme(e,n){const o={},r=getCSSVariableMapping(n);for(const[s,a]of Object.entries(r))if(this.hasValueAtPath(e,s)){const n=this.getValueByPath(e,s);void 0!==n&&this.isCSSValue(n)&&(o[a]=n,this.isColorVariable(a,n)&&this.generateOpacityVariants(o,a,n))}return o}generateCSSVariablesString(e){return Object.entries(e).map(([e,n])=>" "+e+": "+n+";").join("\n")}updateCSSVariablesInStylesheet(e,n){if(0!==Object.keys(n).length)try{const o=this.findOrCreateRule(e);for(const[e,r]of Object.entries(n))o.style.setProperty(e,String(r))}catch(o){this.logger.warn("Failed to update CSS variables")}}getValueByPath(e,n){return n.split(".").reduce((e,n)=>e&&void 0!==e[n]?e[n]:void 0,e)}hasValueAtPath(e,n){const o=n.split(".");let r=e;for(const s of o){if(null==r||!(s in r))return![];r=r[s]}return!![]}findOrCreateRule(e){const n=":host";for(const r of Array.from(e.cssRules))if(r instanceof CSSStyleRule&&r.selectorText===n)return r;const o=e.insertRule(n+" {}");return e.cssRules[o]}isCSSValue(e){if("string"==typeof e){if(""===e.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(e.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(e))return!![];if(/^[a-z-]+$/.test(e))return!![]}return"number"==typeof e}generateOpacityVariants(e,n,o){for(const r of this.opacityLevels){const s=n+"-"+r.suffix,a=this.addOpacityToHexColor(o,r.value);a&&(e[s]=a)}}isColorVariable(e,n){if("string"!=typeof n)return![];const o=e.toLowerCase().includes("color"),r=/^#[0-9a-f]{3,8}$/i.test(n);return o&&r}addOpacityToHexColor(e,n){if(!e.startsWith("#"))return null;let o=e.slice(1);if(3===o.length&&(o=o.split("").map(e=>e+e).join("")),6!==o.length)return null;const r=Math.round(255*n),s=r.toString(16).padStart(2,"0");return"#"+o+s}}class StyleRegistryService{constructor(){this.registry=new Map}static getInstance(){return StyleRegistryService.instance||(StyleRegistryService.instance=new StyleRegistryService),StyleRegistryService.instance}register(e,n,o=10){this.registry.has(e)||this.registry.set(e,[]);const r=this.registry.get(e),s=r.some(e=>e.getter===n);s||(r.push({getter:n,priority:o}),r.sort((e,n)=>e.priority-n.priority))}getStyleGetters(e){const n=this.registry.get(e);return n?n.map(e=>e.getter):[]}getStyles(e){const n=this.getStyleGetters(e);return n.map(e=>e())}hasStyles(e){const n=this.registry.get(e);return!!n&&n.length>0}getRegisteredTypes(){return Array.from(this.registry.keys())}clear(){this.registry.clear()}}const lt=StyleRegistryService.getInstance();class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(e){return this.styleSheets.get(e)}generateSpecificStylesheet(e,n){const o=this.cssProcessor.extractVariablesFromTheme(n,e),r=this.cssProcessor.generateCSSVariablesString(o),s=lt.getStyles(e).join("\n\n"),a=0===r.length?"":":host { "+r+" }",c=("\n "+a+"\n\n "+s+"\n ").trim();this.createStylesheet(e,c)}createStylesheet(e,n){try{if(this.isCSSStyleSheetSupported()){const o=new CSSStyleSheet;o.replaceSync(n),this.styleSheets.set(e,o)}else this.styleSheets.set(e,n)}catch(Z){this.styleSheets.set(e,n)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const e=new CSSStyleSheet;return e.replaceSync("/* test */"),!![]}catch(e){return![]}}updateVariablesInStylesheet(e,n,o){const r=this.styleSheets.get(e);if(r&&"string"!=typeof r){const e=this.cssProcessor.extractVariablesFromPartialTheme(n,o);this.cssProcessor.updateCSSVariablesInStylesheet(r,e)}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(e){this.data=e,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme),this.stylesheetGenerator.generateSpecificStylesheet("product-list",this.data.productList.theme)}updateComponentGlobalConfigs(e){var n,o;const r=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),e),this.data.global.layout.showPoweredBy=r,((null===(n=e.theme)||void 0===n?void 0:n.headingFont)||(null===(o=e.theme)||void 0===o?void 0:o.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",e.theme,"global")}updateProductComponent(e){this.data.product=this.deepMerge(this.getConfigs("product"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",e.theme,"product")}updateAddressComponent(e){this.data.address=this.deepMerge(this.getConfigs("address"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",e.theme,"address")}updateCartComponent(e){this.data.cart=this.deepMerge(this.getConfigs("cart"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",e.theme,"cart")}updateCheckoutComponent(e){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",e.theme,"checkout")}updateProductListComponent(e){this.data.productList=this.deepMerge(this.getConfigs("productList"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product-list",e.theme,"product-list")}getConfigs(e){return"all"===e?this.data:this.data[e]}getComponentConfig(e){return-1!==X.indexOf(e)?this.getConfigs("product"):-1!==J.indexOf(e)?this.getConfigs("address"):-1!==$.indexOf(e)?this.getConfigs("cart"):-1!==tt.indexOf(e)?this.getConfigs("checkout"):-1!==et.indexOf(e)?this.getConfigs("productList"):void 0}getStylesheet(e){const n=this.getBaseStylesheets();if(e===r.DRAWER||e===r.MODAL){const e=[...n],o=this.stylesheetGenerator.getStylesheet("product"),r=this.stylesheetGenerator.getStylesheet("cart"),s=this.stylesheetGenerator.getStylesheet("checkout"),a=this.stylesheetGenerator.getStylesheet("address"),c=this.stylesheetGenerator.getStylesheet("product-list");return o&&e.push(o),r&&e.push(r),s&&e.push(s),a&&e.push(a),c&&e.push(c),e}let o;if(J.includes(e)||e===r.ADDRESS)o="address";else if(X.includes(e)||e===r.PRODUCT)o="product";else if($.includes(e)||e===r.CART)o="cart";else if(tt.includes(e)||e===r.CHECKOUT)o="checkout";else{if(!et.includes(e)&&e!==r.PRODUCT_LIST)return this.logger.warn("No stylesheets found for component type: "+e+", returning base stylesheets only."),n;o="product-list"}const s=this.stylesheetGenerator.getStylesheet(o);return s?[...n,s]:n}getBaseStylesheets(){const e=[],n=this.stylesheetGenerator.getStylesheet("global"),o=this.stylesheetGenerator.getStylesheet("ui");return n&&e.push(n),o&&e.push(o),e}deepMerge(e,n){const o={...e};for(const r in n)null!==n[r]&&void 0!==n[r]&&("object"!=typeof n[r]||Array.isArray(n[r])||"object"!=typeof e[r]||Array.isArray(e[r])?o[r]=n[r]:o[r]=this.deepMerge(e[r],n[r]));return o}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const e=this.store.get("address");if(e.address.one&&e.coordinates.longitude&&e.coordinates.latitude)return{coordinates:e.coordinates,address:e.address}}}function centToDollar(e){return e/100}function formatCentToDollarText(e,n=!![]){const o=Math.floor(e/100),r=e%100;let s="$"+o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(n||r>0)&&(s+=".",s+=r<10?"0"+r:r.toString()),s}function htmlStringToElement(e){const n=document.createElement("template");return n.innerHTML=e.trim(),n.content.firstElementChild}function formatISODateToMMDDYYYY(e){if(!e)return"";try{const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const o=(n.getMonth()+1).toString().padStart(2,"0"),r=n.getDate().toString().padStart(2,"0"),s=n.getFullYear().toString();return o+"/"+r+"/"+s}catch(n){return""}}function capitalizeFirstLetter(e){return e?e.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.substring(1)).join(" "):e}function splitCategoryPath(e){const n=(null==e?void 0:e.split(" > ").map(e=>capitalizeFirstLetter(e.trim())))||[];return{category:n[0]||"",category2:n[1]||"",category3:n[2]||""}}class CartCommands extends BaseCommand{constructor(){super(),this.store.watch("cart.shouldReset",async e=>{e===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(e,o){try{this.store.set("cart.items."+e+".updating",!![]);const r=this.store.get("cart.id"),s=this.store.get("cart.items."+e);if(!s)throw this.logger.error("Cart item not found: "+e+" - cannot update quantity by "+o),new SDKError("Item not found");const a=s.quantity+o;if(a<1)return this.removeItem(e,!![]);const c=this.buildItemUpdate(s,a),l=await this.api.updateCart({id:r,items:[c],location:this.getLocation()});this.syncItemsFromApiResponse(l,[e]),this.updateFulfillment(s.fulfillmentId,l),this.syncRetailersFromApiResponse(l),this.syncCartMetaFromApiResponse(l),this.pubSub.publishAction(o<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{cartId:r,itemId:s.id,quantity:a,previousQuantity:s.quantity});const d=splitCategoryPath(s.catPath),p={item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:d.category,item_category2:d.category2,item_category3:d.category3,quantity:Math.abs(o),price:centToDollar(s.unitPrice||0),item_image:s.mainImage,upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId};o<0?this.googleTagManager.removeFromCart(p):o>0&&this.googleTagManager.addToCart(p)}catch(r){throw this.store.set("cart.items."+e+".error",r.message),this.logger.error("Failed to update item quantity",r),r}finally{this.store.set("cart.items."+e+".updating",![])}}async removeItem(e,o){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;o||this.store.set("cart.items."+e+".updating",!![]);const r=this.store.get("cart.id"),s=this.store.get("cart.items."+e);if(!s)throw new SDKError("Item not found");const a=this.buildItemUpdate(s,0),c=await this.api.updateCart({id:r,items:[a],location:this.getLocation()}),l={itemId:s.id,fulfillmentId:s.fulfillmentId,retailerId:s.retailerId};this.syncItemsFromApiResponse(c,[]),this.cleanupAfterItemRemoval(l,c),this.syncCartMetaFromApiResponse(c),this.pubSub.publishAction(n.CART_ITEM_REMOVED,{cartId:r,itemId:s.id});const d=splitCategoryPath(s.catPath);this.googleTagManager.removeFromCart({item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:d.category,item_category2:d.category2,item_category3:d.category3,quantity:s.quantity,price:centToDollar(s.unitPrice||0),item_image:s.mainImage,upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId})}catch(r){throw this.store.set("cart.items."+e+".error",r.message),this.logger.error("Failed to remove item",r),r}}async updateItemEngraving(e,o){var r,s,a;try{const c=this.store.get("cart"),l=null===(r=c.items)||void 0===r?void 0:r[e];if(!l)throw new SDKError("Item not found");this.store.set("cart.items."+e+".updating",!![]);const d=this.getDetails(),p={id:l.id,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:l.quantity,engravingLines:o},f=await this.api.updateCart({id:c.id||"",items:[p],location:this.getLocation()});this.syncItemsFromApiResponse(f,[e]),this.syncRetailersFromApiResponse(f),this.syncCartMetaFromApiResponse(f);const g=this.getDetails();this.pubSub.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{cartId:g.cartId,itemId:l.id,engravingLines:o,previousEngravingLines:(null===(a=null===(s=l.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||[]}),this.pubSub.publishAction(n.CART_UPDATED,{previous:d,current:g})}catch(c){throw this.store.set("cart.items."+e+".error",c.message),this.logger.error("Failed to update item engraving",c),c}finally{this.store.set("cart.items."+e+".updating",![])}}async addItem(e){var o,r;try{this.store.set("cart.loading",!![]);const s=this.store.get("cart"),a=this.getDetails(),c=(null===(o=e.engravingLines)||void 0===o?void 0:o.filter(e=>""!==e.trim()))||[],l=c.length>0,d=Object.values(s.items||{}).find(n=>{var o,r,s,a,d;const p=n.fulfillmentId===e.fulfillmentId&&n.partNumber===e.partNumber;if(!p)return![];if(l){const e=(null===(r=null===(o=n.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[];return c.join(",")===e.join(",")}return!(null===(d=null===(a=null===(s=n.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||void 0===d?void 0:d.length)}),p={fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:d?e.quantity+d.quantity:e.quantity};l&&(p.engravingLines=c);const f=await this.api.updateCart({id:s.id||"",items:[p],location:this.getLocation()}),g=null===(r=Object.values(f.items))||void 0===r?void 0:r.find(e=>e.fulfillmentId===p.fulfillmentId&&e.partNumber===p.partNumber);if(!g)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(f,[]);const v=this.store.get("cart.fulfillments."+e.fulfillmentId);v?this.updateFulfillment(e.fulfillmentId,f):this.addNewFulfillmentAndRetailer(e.fulfillmentId,f),this.syncRetailersFromApiResponse(f),this.syncCartMetaFromApiResponse(f);const y=this.getDetails();this.pubSub.publishAction(n.PRODUCT_ADD_TO_CART,{...e}),this.pubSub.publishAction(n.CART_ITEM_ADDED,{cartId:y.cartId,itemId:g.id,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,engravingLines:e.engravingLines}),this.pubSub.publishAction(n.CART_UPDATED,{previous:a,current:y});const b=splitCategoryPath(g.catPath);this.googleTagManager.addToCart({item_id:g.liquidId,item_name:g.name,item_brand:g.brand,item_size:g.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,quantity:g.quantity,price:centToDollar(g.unitPrice||0),item_image:g.mainImage,upc:g.upc,grouping_id:g.salsifyGrouping,product_id:g.liquidId})}catch(s){this.store.set("cart.error",s.message),this.logger.error("Failed to add item to cart",s)}finally{this.store.set("cart.loading",![])}}async handleGoToCheckout(){try{this.store.set("cart.loading",!![]);const e=this.store.get("cart"),o=this.clientConfig.get("checkout");if(o){this.trackBeginCheckout(e);const n=await this.api.prepareCheckout({cartId:e.id||""}),r=this.resolveCheckoutRedirectUrl(o.pageUrl,n.token);return window.location.assign(r),void 0}this.pubSub.publishAction(n.INTERNAL_CART_TO_CHECKOUT,{}),this.trackBeginCheckout(e)}catch(e){throw this.store.set("cart.error",e.message),this.logger.error("Failed to proceed to checkout",e),e}finally{this.store.set("cart.loading",![])}}trackBeginCheckout(e){var n;const o=(null===(n=e.promoCode)||void 0===n?void 0:n.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(e.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],o)}resolveCheckoutRedirectUrl(e,n){return e.includes("{id}")?n?e.split("{id}").join(encodeURIComponent(n)):(this.logger.warn('Checkout redirect URL contains "{id}" placeholder but no checkout token was found. Removing placeholder.'),e.split("{id}").join("")):e}async applyPromoCode(e){var o,r,s,a,c;if(!(null==e?void 0:e.trim()))throw new SDKError("Promo code is required");const l=e.trim().toUpperCase();try{const e=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(l);const d=await this.api.updateCart({id:e,items:[],promoCode:l,location:this.getLocation()});this.store.batch({"cart.subtotal":d.subtotal,"cart.itemsQuantity":d.itemsQuantity,"cart.events":d.events});const p=(null===(r=null===(o=d.promoCode)||void 0===o?void 0:o.code)||void 0===r?void 0:r.toLowerCase())===l.toLowerCase();p?(this.store.set("cart.promoCode",{code:l,discount:(null===(s=d.promoCode)||void 0===s?void 0:s.discount)||0}),this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{cartId:e,discount:(null===(a=d.promoCode)||void 0===a?void 0:a.discount)||0,newSubtotal:d.subtotal||0}),this.googleTagManager.promoCodeApplied(l,(null===(c=d.promoCode)||void 0===c?void 0:c.discount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:e,error:"Promo code does not exist"}),this.googleTagManager.promoCodeFailed(l,'Code "'+l+'" does not exist'))}catch(d){const e=(null==d?void 0:d.message)||"Failed to apply promo code. Please try again.";this.store.set("cart.error",e);const o=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:o,error:e}),this.googleTagManager.promoCodeFailed(l,e),this.logger.error("Failed to apply promo code",d),d}}async removePromoCode(){try{const e=this.store.get("cart.id"),o=await this.api.updateCart({id:e,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":o.subtotal,"cart.itemsQuantity":o.itemsQuantity,"cart.promoCode":null}),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{cartId:e,newSubtotal:o.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(e){const o=(null==e?void 0:e.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",o);const r=this.store.get("cart.promoCode"),s=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:s,error:o}),(null==r?void 0:r.code)&&this.googleTagManager.promoCodeFailed(r.code,o),this.logger.error("Failed to remove promo code",e),e}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){try{this.store.set("cart",{...b,rerender:!![]}),this.store.set("cart.loading",!![]);const e=this.store.get("cart"),o=await this.api.getCartData(e.id);this.syncCartState(o,!![]),o.id!==e.id&&await this.store.persist(),this.pubSub.publishAction(n.CART_RESET,!![])}catch(e){const o=(null==e?void 0:e.message)||"Failed to reset cart";this.store.set("cart.error",o);const r=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_FAILED,{cartId:r,message:o}),this.logger.error("Reset cart failed",e),e}finally{this.store.set("cart.loading",![])}}getDetails(){var e;const n=this.store.get("cart"),o=this.store.get("address"),r={};for(const s in n.items||{}){const e=n.items[s];r[s]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,salsifyGrouping:e.salsifyGrouping,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,catPath:e.catPath,volume:e.volume,uom:e.uom,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,name:e.name,brand:e.brand,size:e.size,price:e.price,quantity:e.quantity,maxQuantity:e.maxQuantity,unitPrice:e.unitPrice,mainImage:e.mainImage,attributes:e.attributes}}return{cartId:n.id||"",promoCodeDiscount:(null===(e=n.promoCode)||void 0===e?void 0:e.discount)||null,subtotal:n.subtotal,itemCount:n.itemsQuantity,items:r,retailers:n.retailers||{},location:o.id?{placesId:o.id,formattedAddress:o.formattedAddress,address:o.address,coordinates:o.coordinates}:null}}buildItemUpdate(e,n){var o,r,s;const a={id:e.id,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:n},c=(null===(s=null===(r=null===(o=e.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.filter(e=>""!==e.trim()))||[];return c.length>0&&(a.engravingLines=c),a}syncItemsFromApiResponse(e,n=[]){const o=this.store.get("cart.items")||{},r=new Set(Object.keys(e.items));for(const a of Object.keys(o))r.has(a)||this.store.remove("cart.items."+a);const s={};for(const a of Object.values(e.items))0!==n.length&&!n.includes(a.id)&&o[a.id]||(s["cart.items."+a.id]=a);Object.keys(s).length>0&&this.store.batch(s)}syncCartMetaFromApiResponse(e){var n,o;const r={"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.error":null,"cart.events":e.events},s=null===(n=null==e?void 0:e.promoCode)||void 0===n?void 0:n.code;if(s)r["cart.promoCode"]={code:s.toUpperCase(),discount:(null===(o=e.promoCode)||void 0===o?void 0:o.discount)||0};else{const e=this.store.get("cart.promoCode");(null==e?void 0:e.code)&&(r["cart.promoCode"]=null)}this.store.batch(r)}syncRetailersFromApiResponse(e){var n,o;const r=this.store.get("cart.retailers")||{},s=this.store.get("cart.fulfillments")||{},a=new Set(Object.keys(e.retailers)),c=new Set;for(const l of Object.values(e.retailers))if(l.fulfillments)for(const e of Object.keys(l.fulfillments))c.add(e);for(const l of Object.keys(r))a.has(l)||this.store.remove("cart.retailers."+l);for(const l of Object.keys(s))c.has(l)||this.store.remove("cart.fulfillments."+l);if((null===(n=Object.values(e.retailers))||void 0===n?void 0:n.length)>0){const n={};for(const r of Object.values(e.retailers))if(n["cart.retailers."+r.id]=r,(null===(o=Object.values(r.fulfillments))||void 0===o?void 0:o.length)>0)for(const e of Object.values(r.fulfillments))n["cart.fulfillments."+e.id]=e;this.store.batch(n)}}updateFulfillment(e,n){var o;const r=null===(o=Object.values(n.retailers))||void 0===o?void 0:o.find(n=>{var o;return null===(o=Object.keys(n.fulfillments))||void 0===o?void 0:o.some(n=>n===e)}),s=null==r?void 0:r.fulfillments[e];s&&r&&this.store.set("cart.fulfillments."+e,s)}addNewFulfillmentAndRetailer(e,n){var o;const r=null===(o=Object.values(n.retailers))||void 0===o?void 0:o.find(n=>{var o;return null===(o=Object.keys(n.fulfillments))||void 0===o?void 0:o.some(n=>n===e)}),s=null==r?void 0:r.fulfillments[e];if(s&&r){const n={["cart.fulfillments."+e]:s,["cart.retailers."+r.id]:r};this.store.batch(n)}}cleanupAfterItemRemoval(e,n){var o,r;const s=null===(o=Object.values(n.retailers))||void 0===o?void 0:o.some(n=>{var o;return null===(o=Object.keys(n.fulfillments))||void 0===o?void 0:o.some(n=>n===e.fulfillmentId)}),a=null===(r=Object.keys(n.retailers))||void 0===r?void 0:r.some(n=>n===e.retailerId);if(s){this.updateFulfillment(e.fulfillmentId,n);const o=n.retailers[e.retailerId];o&&this.store.set("cart.retailers."+e.retailerId,o)}else if(this.store.remove("cart.fulfillments."+e.fulfillmentId),a){const o=n.retailers[e.retailerId];o&&this.store.set("cart.retailers."+e.retailerId,o)}else this.store.remove("cart.retailers."+e.retailerId)}syncCartState(e,o=![]){var r,s,a,c,l;const d=this.store.get("cart");for(const n of Object.keys(d.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(d.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(d.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const p={"cart.id":e.id,"cart.error":null,"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(r=e.promoCode)||void 0===r?void 0:r.code)?{...e.promoCode,error:null}:null};if((null===(s=Object.values(e.items))||void 0===s?void 0:s.length)>0)for(const n of Object.values(e.items))p["cart.items."+n.id]=n;if((null===(a=Object.values(e.retailers))||void 0===a?void 0:a.length)>0)for(const n of Object.values(e.retailers))if(p["cart.retailers."+n.id]=n,(null===(c=Object.values(n.fulfillments))||void 0===c?void 0:c.length)>0)for(const e of Object.values(n.fulfillments))p["cart.fulfillments."+e.id]=e;if((null===(l=e.events)||void 0===l?void 0:l.length)>0&&(p["cart.events"]=e.events),this.store.batch(p),o){const e=this.store.get("cart"),o=this.buildCartLoadedEventData(e);this.pubSub.publishAction(n.CART_LOADED,o)}}buildCartLoadedEventData(e){var n,o;const r=this.store.get("address"),s={};for(const a of Object.keys(e.items||{})){const n=e.items[a];s[a]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,salsifyGrouping:n.salsifyGrouping,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price,quantity:n.quantity,maxQuantity:n.maxQuantity,unitPrice:n.unitPrice,mainImage:n.mainImage,attributes:n.attributes}}return{cartId:e.id,promoCodeDiscount:null!==(o=null===(n=e.promoCode)||void 0===n?void 0:n.discount)&&void 0!==o?o:null,subtotal:e.subtotal,itemCount:e.itemsQuantity,items:s,retailers:e.retailers||{},location:(null==r?void 0:r.id)&&r.coordinates&&r.address?{placesId:r.id,formattedAddress:r.formattedAddress,address:r.address,coordinates:r.coordinates}:null}}}function componentError({componentType:e,message:n}){const o=document.createElement("div");o.className=e;const r=o.attachShadow({mode:"closed"}),s=document.createElement("style");s.textContent='\n div {\n padding: 10px;\n background-color: #f0f4f8;\n border-radius: 6px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: #d63031;\n line-height: 1.4;\n margin-bottom: 5px;\n }\n\n p {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n color: #18181B;\n line-height: 1.5;\n max-width: 350px;\n }\n ';const a=document.createElement("div"),c=document.createElement("h3");c.textContent="Component </"+e+">";const l=document.createElement("p");return l.textContent=n,a.appendChild(s),a.appendChild(c),a.appendChild(l),r.appendChild(a),o}function productionComponentError({title:e,message:n,componentType:o}){const r=document.createElement("div");r.setAttribute("data-component-type",o);const s=r.attachShadow({mode:"closed"}),a=document.createElement("style");a.textContent="\n div {\n padding: 20px;\n background-color: #f0f4f8;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: Poppins, sans-serif;\n max-width: 512px;\n display: block;\n }\n\n h2 {\n color: #18181B;\n margin: 0 0 8px 0;\n font-size: 18px;\n font-style: normal;\n font-weight: 600;\n line-height: 18px;\n text-transform: lowercase;\n }\n\n h2::first-letter {\n text-transform: uppercase;\n }\n\n p {\n color: #18181B;\n font-size: 14px;\n font-style: italic;\n font-weight: 400;\n line-height: 20px;\n margin: 0;\n }\n ";const c=document.createElement("div"),l=document.createElement("h2");l.textContent=e;const d=document.createElement("p");return d.textContent=n,c.appendChild(a),c.appendChild(l),c.appendChild(d),s.appendChild(c),r}class ComponentFactoryService{static get logger(){return ComponentFactoryService.i||(ComponentFactoryService.i=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.i}static get clientConfig(){return ComponentFactoryService.o||(ComponentFactoryService.o=ClientConfigService.getInstance()),ComponentFactoryService.o}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(e,n){ComponentFactoryService.getComponentRegistry().set(e,n)}static createElement(e){try{const n=ComponentFactoryService.getComponentRegistry().get(e.type);if(!n)throw new SDKError("Component type ["+e.type+"] is not registered");const o=ComponentFactoryService.getComponentTagName(e.type);window.customElements.get(o)||window.customElements.define(o,n);const s=document.createElement(o);if(s.initialize){const{type:n,useShadowDom:r,wrapInLceElement:a,...c}=e,l={type:n,tagName:o,useShadowDom:r&&a!==!![]};s.initialize({data:c,config:l})}if(e.wrapInLceElement){const n=ComponentFactoryService.getComponentRegistry().get(r.LCE_ELEMENT),o=ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT);window.customElements.get(o)||window.customElements.define(o,n);const a=document.createElement(o);return a.initialize(e.type,s),a}return s}catch(n){return ComponentFactoryService.logger.error("Failed to create component </"+e.type+">",n),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:e.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:e.type}):componentError({componentType:e.type,message:(null==n?void 0:n.message)||n})}}static componentError({componentType:e,message:n}){return ComponentFactoryService.logger.error("Component type "+e+" failed to load: "+n),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:e.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({componentType:e,message:n})}static getComponentTagName(e){const n={[r.DRAWER]:"drawer-lc",[r.INPUT]:"input-lc",[r.ENGRAVING_FORM]:"engraving-form-lc",[r.ENGRAVING_VIEW]:"engraving-view-lc",[r.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[r.POWERED_BY]:"powered-by-lc",[r.LCE_ELEMENT]:"lce-element",[r.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[r.ALERT]:"alert-lc",[r.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[r.MODAL]:"modal-lc",[r.ADDRESS]:"address-lc",[r.ADDRESS_INPUT]:"address-input-lc",[r.ADDRESS_DISPLAY]:"address-display-lc",[r.PRODUCT]:"product-lc",[r.PRODUCT_OPTIONS]:"product-options-lc",[r.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[r.PRODUCT_INTERACTIONS]:"product-interactions-lc",[r.PRODUCT_DESCRIPTION]:"product-description-lc",[r.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[r.PRODUCT_RETAILERS]:"product-retailers-lc",[r.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[r.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[r.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[r.PRODUCT_PRICE]:"product-price-lc",[r.PRODUCT_DRAWER]:"product-drawer-lc",[r.PRODUCT_LOADING]:"product-loading-lc",[r.PRODUCT_LIST]:"product-list-lc",[r.PRODUCT_LIST_CARD]:"product-list-card-lc",[r.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[r.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[r.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[r.PRODUCT_LIST_RETAILERS]:"product-list-retailers-lc",[r.PRODUCT_LIST_ENGRAVING_FORM]:"product-list-engraving-form-lc",[r.CART]:"cart-lc",[r.CART_RETAILER]:"cart-retailer-lc",[r.CART_ITEM]:"cart-item-lc",[r.CART_FOOTER]:"cart-footer-lc",[r.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[r.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[r.CART_PROMO_CODE]:"cart-promo-code-lc",[r.CART_HEADER]:"cart-header-lc",[r.CART_BODY]:"cart-body-lc",[r.CART_FULFILLMENT]:"cart-fulfillment-lc",[r.CHECKOUT]:"checkout-lc",[r.CHECKOUT_INFORMATION]:"checkout-information-lc",[r.CHECKOUT_PAYMENT]:"checkout-payment-lc",[r.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[r.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[r.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[r.CHECKOUT_BILLING]:"checkout-billing-lc",[r.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[r.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[r.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[r.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[r.CHECKOUT_ITEMS]:"checkout-items-lc",[r.CHECKOUT_COMPLETED]:"checkout-completed-lc",[r.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[r.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[r.CHECKOUT_BUYER]:"checkout-buyer-lc",[r.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[r.CHECKOUT_TIPS]:"checkout-tips-lc",[r.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[r.CHECKOUT_ITEM]:"checkout-item-lc",[r.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[r.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[r.CHECKOUT_HEADER]:"checkout-header-lc",[r.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[r.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[r.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return n[e]||e.toLowerCase()+"-lc"}}ComponentFactoryService.i=null,ComponentFactoryService.o=null,ComponentFactoryService.componentRegistry=null;class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(e,o){const s={type:e,data:o||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:s}),e===r.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),e===r.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const e=this.store.get("ui.drawer.contentConfig");(null==e?void 0:e.type)===r.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==e?void 0:e.type)===r.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}openModal(e,n){const o={type:e,data:n||{}};this.store.set("ui.modal",{isOpen:!![],contentConfig:o})}closeModal(){this.store.set("ui.modal.isOpen",![]),this.store.set("ui.modal.contentConfig",null)}}function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...e){for(;this.firstChild;)this.removeChild(this.firstChild);for(const n of e)"string"==typeof n?this.appendChild(document.createTextNode(n)):this.appendChild(n)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...e){const n=document.createDocumentFragment();for(const o of e)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o);this.insertBefore(n,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...e){const n=this.parentNode;if(!n)return;const o=document.createDocumentFragment();for(const r of e)"string"==typeof r?o.appendChild(document.createTextNode(r)):o.appendChild(r);n.replaceChild(o,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...e){const n=this.parentNode;if(!n)return;const o=document.createDocumentFragment();for(const r of e)"string"==typeof r?o.appendChild(document.createTextNode(r)):o.appendChild(r);n.insertBefore(o,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...e){const n=this.parentNode;if(!n)return;const o=document.createDocumentFragment();for(const r of e)"string"==typeof r?o.appendChild(document.createTextNode(r)):o.appendChild(r);n.insertBefore(o,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=e=>{const n={};for(const[o,r]of e)n[o]=r;return n})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(Z){console.warn("DOM polyfills initialization failed:",Z)}}function safeReplaceChildren(e,...n){try{if("replaceChildren"in e&&"function"==typeof e.replaceChildren)e.replaceChildren(...n);else{for(;e.firstChild;)e.removeChild(e.firstChild);for(const o of n)"string"==typeof o?e.appendChild(document.createTextNode(o)):e.appendChild(o)}}catch(o){console.error("replaceChildren operation failed:",o),1===n.length&&"string"==typeof n[0]&&(e.innerHTML=n[0])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),window.addEventListener("lce:actions."+n.INTERNAL_CART_TO_CHECKOUT,async()=>{this.store.set("metadata.checkout",w.checkout),await this.loadCheckout({}),this.uiCommands.openDrawer(r.CHECKOUT)}),window.addEventListener("lce:actions."+n.CART_RESET,()=>{this.store.set("checkout",{...k,rerender:!![]})})}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async addPresaleItem(e){try{const n={fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,engravingLines:e.engravingLines},o=await this.api.updateCart({id:"",items:[n],location:this.getLocation()});await this.loadCheckout({cartId:o.id,isForPresale:!![]})}catch(n){throw this.store.set("checkout.error",n.message),this.logger.error("Failed to add presale item to checkout",n),n}}async loadCheckout(e){try{this.store.set("checkout.loading",!![]);const o=void 0!==e.cartId?e.cartId:this.store.get("cart.id");if(!e.checkoutId&&!o)return this.store.set("checkout.error","Checkout token or Cart ID is required"),void 0;const r=this.themeProvider.getConfigs("checkout"),s=await this.api.prepareCheckout({token:e.checkoutId||void 0,cartId:e.checkoutId?void 0:o,marketingPreferences:{canEmail:r.layout.emailOptIn.checked,canSms:r.layout.smsOptIn.checked}});if(e.isForPresale===!![]&&0===s.itemsQuantity)return this.showPresaleExpired("items_unavailable"),void 0;const a={"checkout.cartId":s.cartId,"checkout.isGift":s.isGift,"checkout.marketingPreferences":s.marketingPreferences,"checkout.customerForm":k.customerForm,"checkout.giftRecipientForm":k.giftRecipientForm,"checkout.paymentForm":k.paymentForm,"checkout.paymentForm.billingSameAsShipping":s.billingSameAsShipping,"checkout.shippingAddress":s.shippingAddress,"checkout.presale":s.presale,"checkout.giftRecipientForm.data":s.giftOptions,"checkout.updating":![],"checkout.itemsQuantity":s.itemsQuantity};this.store.batch(a),this.syncCheckoutState(s),this.pubSub.publishAction(n.CHECKOUT_LOADED,this.getDetails())}catch(o){this.store.set("checkout.error",o.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:o.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(e){const o=this.store.get("checkout.isGift"),r=null!=e?e:!o,s={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":r,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":s});const a=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{cartId:a,isActive:r,previousIsActive:o})}async toggleBillingSameAsShipping(e){const o=this.store.get("checkout.paymentForm.billingSameAsShipping"),r=null!=e?e:!o;this.store.set("checkout.paymentForm.billingSameAsShipping",r);const s=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{cartId:s,isActive:r,previousIsActive:o})}async toggleMarketingPreferences(e,o){const r=this.store.get("checkout.marketingPreferences."+e),s=null!=o?o:!r,a=this.store.get("checkout.marketingPreferences"),c=this.dataForCheckoutPrepare({marketingPreferences:{...a,[e]:s}}),l=await this.api.prepareCheckout(c);this.store.set("checkout.marketingPreferences",l.marketingPreferences);const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{cartId:d,fieldName:e,isActive:s,previousIsActive:r})}async getPaymentSession(){try{const e=this.store.get("cart.id"),n=await this.api.getPaymentSession(e);this.store.batch({"checkout.paymentForm.paymentSession":n,"checkout.paymentForm.paymentMethod":null})}catch(e){throw this.store.batch({"checkout.error":e.message,"checkout.loading":![]}),e}}async confirmPaymentSession(e,n){try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"35"}};const o=await this.api.confirmPaymentSession({confirmationTokenId:e,setupIntentId:n});return{id:o.id,card:{brand:o.card.brand,last4:o.card.last4,expMonth:o.card.expMonth,expYear:o.card.expYear}}}catch(o){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(e){try{this.googleTagManager.promoCodeAttempt(e);const o=this.dataForCheckoutPrepare({}),r=await this.api.prepareCheckout({...o,promoCode:e}),s=0!==r.amounts.discounts,a=r.events.some(e=>e.type===c.PROMO_CODE)?r.events[0]:null;if(!s){this.store.set("checkout.promoCodeError",a?a.message:'Code "'+e+'" does not exist');const o=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:(null==a?void 0:a.message)||'Code "'+e+'" does not exist'}),this.googleTagManager.promoCodeFailed(e,(null==a?void 0:a.message)||"not_applied"),void 0}const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:l,discount:r.amounts.discounts,newTotal:r.amounts.total}),this.googleTagManager.promoCodeApplied(e,r.amounts.discounts),await this.refreshCheckout({response:r})}catch(o){const r=(null==o?void 0:o.message)||"Failed to apply promo code. Please try again.";this.store.set("checkout.error",r);const s=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:s,error:r}),this.googleTagManager.promoCodeFailed(e,r),o}}async removePromoCode(){var e,o;try{const r=this.dataForCheckoutPrepare({}),s=(null===(o=null===(e=this.store.get("checkout"))||void 0===e?void 0:e.promoCode)||void 0===o?void 0:o.code)||"",a=await this.api.prepareCheckout({...r,promoCode:""});if(0!==a.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;const c=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:c,newTotal:a.amounts.total}),this.googleTagManager.promoCodeApplied(s,0),await this.refreshCheckout({response:a})}catch(r){const e=(null==r?void 0:r.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",e);const o=this.store.get("checkout.promoCode.code")||"",s=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:s,error:e}),o&&this.googleTagManager.promoCodeFailed(o,e),r}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(Z){const n=Z.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",n),Z}}async applyGiftCard(e){const o=e.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(o);const e=this.dataForCheckoutPrepare({}),r=e.giftCards||[],s=await this.api.prepareCheckout({...e,giftCards:[...r,o]}),a=s.events.some(e=>e.type===c.GIFT_CARD&&e.level===l.ERROR)?s.events[0]:null;a&&this.store.set("checkout.giftCardError",a.message);const d=s.giftCards.find(e=>e.code.toLowerCase()===o.toLowerCase());if(!d){this.store.set("checkout.giftCardError","Gift card could not be applied");const e=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:e,error:(null==a?void 0:a.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(o,(null==a?void 0:a.message)||"not_applied"),void 0}const p=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:p,newTotal:s.amounts.total}),this.googleTagManager.giftCardApplied(o,d.applied),await this.refreshCheckout({response:s})}catch(r){const e=(null==r?void 0:r.message)||"Failed to apply gift card. Please try again.";this.store.set("checkout.error",e);const s=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:s,error:e}),this.googleTagManager.giftCardFailed(o,e),r}}async removeGiftCard(e){var o;const r=e.trim().toUpperCase();try{const e=this.dataForCheckoutPrepare({}),s=(null===(o=e.giftCards)||void 0===o?void 0:o.filter(e=>e.toLowerCase()!==r.toLowerCase()))||[],a=await this.api.prepareCheckout({...e,giftCards:s}),c=a.giftCards.find(e=>e.code.toLowerCase()===r.toLowerCase());if(c)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+r),void 0;const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:l,newTotal:a.amounts.total}),this.googleTagManager.giftCardApplied(r,0),await this.refreshCheckout({response:a})}catch(s){const e=(null==s?void 0:s.message)||"Failed to remove gift card. Please try again.";this.store.set("checkout.error",e);const o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:o,error:e}),this.googleTagManager.giftCardFailed(r,e),s}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(Z){throw this.store.set("checkout.error",(null==Z?void 0:Z.message)||"Failed to clear gift card error. Please try again."),Z}}showPresaleExpired(e="time_expired"){this.store.set("checkout",{...k,rerender:![]});const n=this.store.get("metadata.checkout.injection");if(null==n?void 0:n.containerId){const o=document.getElementById(n.containerId);if(o){const n=ComponentFactoryService.createElement({type:r.CHECKOUT_PRESALE_EXPIRED,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],reason:e});safeReplaceChildren(o,n)}return}this.uiCommands.openDrawer(r.CHECKOUT_PRESALE_EXPIRED,{reason:e})}openCheckout(){const e=this.clientConfig.get("checkout");if(null==e?void 0:e.pageUrl){this.store.set("metadata.checkout.returnUrl",window.location.href);const n=this.store.get("checkout.token")||"",o=this.resolveCheckoutPageUrl(e.pageUrl,n);return window.location.assign(o),void 0}this.uiCommands.openDrawer(r.CHECKOUT)}getReturnUrl(){return this.store.get("metadata.checkout.returnUrl")}resolveCheckoutPageUrl(e,n){return e.includes("{id}")?n?e.split("{id}").join(encodeURIComponent(n)):(this.logger.warn('Checkout page URL contains "{id}" placeholder but no checkout token was found. Removing placeholder.'),e.split("{id}").join("")):e}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(e,o){var r,s,a;try{this.store.set("checkout.items."+e+".updating",!![]);const c=this.store.get("checkout.cartId"),l=this.store.get("checkout.items."+e);if(!l)throw new SDKError("Item not found");const d=l.quantity,p=l.quantity+o;if(p<1)return this.removeItem(e,!![]);const f={id:l.cartItemId,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:p},g=(null===(a=null===(s=null===(r=l.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||void 0===a?void 0:a.filter(e=>""!==e.trim()))||[];g.length>0&&(f.engravingLines=g);const v=await this.api.updateCheckoutItems({cartId:c,items:[f],location:this.getLocation()});this.syncFromItemUpdate(v.cart,v.checkout),this.pubSub.publishAction(o>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartId:c,cartItemId:l.cartItemId,quantity:p,previousQuantity:d});const y=splitCategoryPath(l.catPath),b={item_id:l.liquidId,item_name:l.name,item_brand:l.brand,item_size:l.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,quantity:Math.abs(o),price:centToDollar(l.unitPrice||0),item_image:l.mainImage,upc:l.upc,grouping_id:l.salsifyGrouping,product_id:l.liquidId};o<0?this.googleTagManager.removeFromCart(b):o>0&&this.googleTagManager.addToCart(b)}catch(c){throw this.store.set("checkout.items."+e+".error",c.message),c}finally{this.store.set("checkout.items."+e+".updating",![])}}async removeItemEngraving(e){var o,r,s;try{const a=this.store.get("checkout.items."+e);if(!a)throw new SDKError("Item not found in checkout");if(!(null===(o=a.attributes)||void 0===o?void 0:o.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:e}),void 0;const c=(null===(s=null===(r=a.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[],l={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:[]},d=this.store.get("checkout.cartId"),p=await this.api.updateCheckoutItems({cartId:d,items:[l],location:this.getLocation()});this.syncFromItemUpdate(p.cart,p.checkout),this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartId:d,cartItemId:a.cartItemId,engravingLines:[],previousEngravingLines:c})}catch(a){throw this.store.set("checkout.items."+e+".error",a.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:e,error:a}),a}}async removeItem(e,o){var r,s,a;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;o||this.store.set("checkout.items."+e+".updating",!![]);const c=this.store.get("checkout.cartId"),l=this.store.get("checkout.items."+e);if(!l)throw new SDKError("Item not found");const d={id:l.cartItemId,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:0},p=(null===(a=null===(s=null===(r=l.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||void 0===a?void 0:a.filter(e=>""!==e.trim()))||[];p.length>0&&(d.engravingLines=p);const f=await this.api.updateCheckoutItems({cartId:c,items:[d],location:this.getLocation()});this.syncFromItemUpdate(f.cart,f.checkout),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartId:c,cartItemId:l.cartItemId})}catch(c){throw this.store.set("checkout.items."+e+".error",c.message),c}}async updateTips(e){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",e);const o=this.store.get("checkout.fulfillments"),r=Object.values(o||{}).filter(e=>e.type===s.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.amounts.tip})),a=Object.values(o||{}).filter(e=>e.type===s.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:Math.round(n.amounts.subtotal*e/100)})),c=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:a}));this.updateStoreFromCheckoutResponse(c);const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:l,deliveryTips:a,previousDeliveryTips:r})}catch(o){throw this.store.set("checkout.error",(null==o?void 0:o.message)||"Failed to update tips. Please try again."),o}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(e,o){try{this.store.set("checkout.updating",!![]);const r=this.store.get("checkout.fulfillments"),a=Object.values(r||{}).filter(e=>e.type===s.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.amounts.tip})),c=Object.values(r||{}).filter(e=>e.type===s.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:n.id===e?o:n.amounts.tip})),l=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:c}));this.updateStoreFromCheckoutResponse(l);const d=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:d,deliveryTips:c,previousDeliveryTips:a})}catch(r){throw this.store.set("checkout.error",(null==r?void 0:r.message)||"Failed to update fulfillment tip. Please try again."),r}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(e){try{this.store.set("checkout.updating",!![]);const o=this.store.get("checkout.fulfillments"),r=Object.values(o||{}).filter(e=>e.type===s.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.amounts.tip})),a=Object.values(o||{}).filter(e=>e.type===s.ON_DEMAND).map(n=>({fulfillmentId:n.id,tip:n.id===e?0:n.amounts.tip})),c=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:a}));this.updateStoreFromCheckoutResponse(c);const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{cartId:l,deliveryTips:a,previousDeliveryTips:r})}catch(o){throw this.store.set("checkout.error",(null==o?void 0:o.message)||"Failed to remove fulfillment tip. Please try again."),o}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:e,deliveryInstructions:o,customerData:r}){var s;try{this.store.set("checkout.customerForm.isSaving",!![]);const a=this.store.get("checkout.customerForm.data"),c=this.store.get("checkout.isGift"),l=this.dataForCheckoutPrepare({shippingAddressTwo:e,deliveryInstructions:o||void 0,customer:{...a,...r},isGift:c}),d=await this.api.prepareCheckout(l);this.store.batch({"checkout.customerForm.data":d.customer,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddress":d.shippingAddress,"checkout.deliveryInstructions":o});const p=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{cartId:p});const f=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(f.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],(null===(s=f.promoCode)||void 0===s?void 0:s.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:e,deliveryInstructions:o,...r}){var s;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const a=this.dataForCheckoutPrepare({shippingAddressTwo:e,deliveryInstructions:o||void 0,isGift:!![],giftRecipient:r}),c=await this.api.prepareCheckout(a);this.store.batch({"checkout.giftRecipientForm.data":c.giftOptions,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddress":c.shippingAddress,"checkout.deliveryInstructions":o});const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,{cartId:l});const d=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(d.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],(null===(s=d.promoCode)||void 0===s?void 0:s.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:e,paymentSession:o}){var r,s,a;try{this.store.set("checkout.paymentForm.isSaving",!![]);const c=this.store.get("checkout"),l={},d=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let p=null,f=null;if(d||o){const e=await this.confirmPaymentSession((null==o?void 0:o.confirmationTokenId)||"",(null==o?void 0:o.setupIntentId)||"");if(!e)throw new Error("Failed to confirm payment method");p=e.card,f=e.id}const g=this.dataForCheckoutPrepare({billingData:e,paymentMethodId:f||void 0}),v=await this.api.prepareCheckout(g);if(v.payment&&p&&(l["checkout.paymentForm.paymentMethod"]={id:v.payment,card:p}),e&&v.billingAddress){l["checkout.paymentForm.data"]={firstName:v.billingAddress.firstName||"",lastName:v.billingAddress.lastName||"",email:v.billingAddress.email||"",phone:v.billingAddress.phone||"",company:v.billingAddress.company||"",addressOne:v.billingAddress.one||"",addressTwo:v.billingAddress.two||"",city:v.billingAddress.city||"",state:v.billingAddress.state||"",zipCode:v.billingAddress.zip||""};const e=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,{cartId:e})}l["checkout.paymentForm.isEditing"]=![],l["checkout.paymentForm.isValid"]=!![],this.store.batch(l);const y=l["checkout.paymentForm.paymentMethod"]||(null===(r=c.paymentForm)||void 0===r?void 0:r.paymentMethod),b=(null===(s=null==y?void 0:y.card)||void 0===s?void 0:s.brand)?y.card.brand+" ****"+y.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(c.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}}),b,(null===(a=c.promoCode)||void 0===a?void 0:a.code)||void 0)}catch(c){throw this.logger.error("Failed to save payment form",c),this.store.set("checkout.error",c.message),c}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var e,o,s,a,c,l;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const d=this.store.get("checkout"),{orderNumber:p}=await this.api.checkoutComplete(d.token);d.presale||this.store.set("cart.shouldReset",!![]);const f={orderNumber:p,orderTotal:d.amounts.total,cardLast4:(null===(s=null===(o=null===(e=null==d?void 0:d.paymentForm)||void 0===e?void 0:e.paymentMethod)||void 0===o?void 0:o.card)||void 0===s?void 0:s.last4)||"",customerEmail:d.customerForm.data.email,giftRecipientEmail:(null===(c=null===(a=null==d?void 0:d.giftRecipientForm)||void 0===a?void 0:a.data)||void 0===c?void 0:c.email)||null},g=this.store.get("metadata.checkout.injection");if(null==g?void 0:g.containerId){const e=document.getElementById(g.containerId);if(e){const n=ComponentFactoryService.createElement({type:r.CHECKOUT_COMPLETED,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...f});safeReplaceChildren(e,n)}}else this.uiCommands.openDrawer(r.CHECKOUT_COMPLETED,f);this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:p,orderTotal:d.amounts.total}),this.googleTagManager.purchase({transaction_id:p,tax:centToDollar(d.amounts.tax+d.amounts.service+d.amounts.platform),shipping:centToDollar(d.amounts.shipping||0),coupon:(null===(l=d.promoCode)||void 0===l?void 0:l.code)||void 0,items:[...Object.values(d.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],value:centToDollar(d.amounts.total),subtotal:centToDollar(d.amounts.subtotal),total_before_discounts:centToDollar(d.amounts.subtotal+d.amounts.tax+d.amounts.service+d.amounts.platform+d.amounts.shipping+d.amounts.delivery),discounts:centToDollar(d.amounts.discounts),gift_cards:centToDollar(d.amounts.giftCards||0),net_total:centToDollar(d.amounts.total)})}catch(d){const e=(null==d?void 0:d.message)||"Checkout complete failed";this.store.batch({"checkout.error":e}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:e})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(e){const n={"checkout.amounts":e.amounts,"checkout.events":e.events,"checkout.error":null};if(e.retailers&&Object.values(e.retailers).length>0)for(const o of Object.values(e.retailers))for(const e of Object.values(o.fulfillments))n["checkout.fulfillments."+e.id]=e;this.store.batch(n)}syncFromItemUpdate(e,n){var o,r,s,a,c;try{this.store.set("checkout.updating",!![]);const l=this.store.get("cart");for(const e of Object.keys(l.items||{}))this.store.remove("cart.items."+e);for(const e of Object.keys(l.retailers||{}))this.store.remove("cart.retailers."+e);for(const e of Object.keys(l.fulfillments||{}))this.store.remove("cart.fulfillments."+e);const d={"cart.id":e.id,"cart.error":null,"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.events":e.events||[],"cart.promoCode":(null===(o=e.promoCode)||void 0===o?void 0:o.code)?{...e.promoCode,error:null}:null};if((null===(r=Object.values(e.items))||void 0===r?void 0:r.length)>0)for(const n of Object.values(e.items))d["cart.items."+n.id]=n;if((null===(s=Object.values(e.retailers))||void 0===s?void 0:s.length)>0)for(const n of Object.values(e.retailers))if(d["cart.retailers."+n.id]=n,(null===(a=Object.values(n.fulfillments))||void 0===a?void 0:a.length)>0)for(const e of Object.values(n.fulfillments))d["cart.fulfillments."+e.id]=e;this.store.batch(d);const p={"checkout.token":n.token,"checkout.events":n.events,"checkout.amounts":n.amounts,"checkout.shippingAddress":n.shippingAddress,"checkout.itemsQuantity":n.itemsQuantity,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":n.giftCards.map(e=>({code:e.code,discount:e.applied})),"checkout.promoCode":(null===(c=null==n?void 0:n.promoCode)||void 0===c?void 0:c.code)?null==n?void 0:n.promoCode:null};if(Object.values(n.items).length>0){this.store.remove("checkout.items");for(const e of Object.values(n.items))p["checkout.items."+e.cartItemId]={...e,loading:![],updating:![],error:null}}if(n.retailers&&Object.values(n.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const e of Object.values(n.retailers)){p["checkout.retailers."+e.id]=e;for(const n of Object.values(e.fulfillments))p["checkout.fulfillments."+n.id]=n}}this.store.batch(p)}finally{this.store.set("checkout.updating",![])}}syncCheckoutState(e){var n;const o={"checkout.token":e.token,"checkout.events":e.events,"checkout.amounts":e.amounts,"checkout.shippingAddress":e.shippingAddress,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":e.giftCards.map(e=>({code:e.code,discount:e.applied})),"checkout.promoCode":(null===(n=null==e?void 0:e.promoCode)||void 0===n?void 0:n.code)?null==e?void 0:e.promoCode:null};if(Object.values(e.items).length>0){this.store.remove("checkout.items");for(const n of Object.values(e.items))o["checkout.items."+n.cartItemId]={...n,loading:![],updating:![],error:null}}if(e.retailers&&Object.values(e.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const n of Object.values(e.retailers)){o["checkout.retailers."+n.id]=n;for(const e of Object.values(n.fulfillments))o["checkout.fulfillments."+e.id]=e}}this.store.batch(o)}async refreshCheckout(e){var o;try{let n;if(this.store.set("checkout.updating",!![]),null==e?void 0:e.response)n=e.response;else{const r=null!==(o=null==e?void 0:e.cartId)&&void 0!==o?o:this.store.get("checkout.cartId");if(!r)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const s=this.dataForCheckoutPrepare({});n=await this.api.prepareCheckout({...s,cartId:r})}this.syncCheckoutState(n)}catch(r){const e=(null==r?void 0:r.message)||"Failed to refresh checkout data. Please try again.";throw this.store.set("checkout.error",e),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:e}),r}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:e,giftRecipient:n,billingData:o,marketingPreferences:r,shippingAddressTwo:a,deliveryInstructions:c,deliveryTips:l,paymentMethodId:d,isGift:p}){var f,g,v,y,b,k,x,w,C,S,_,E,T,I,P,D,A,F,M,L,R,N,z;const j=this.store.get("checkout"),B=null!==(g=null===(f=j.paymentForm)||void 0===f?void 0:f.billingSameAsShipping)&&void 0!==g?g:!![],q=void 0!==p?p:j.isGift,V=n?!![]:null!==(y=null===(v=j.giftRecipientForm)||void 0===v?void 0:v.isValid)&&void 0!==y?y:![],G=q&&V,K={cartId:j.cartId,shippingAddressTwo:a,billingSameAsShipping:B,marketingPreferences:r||j.marketingPreferences,promoCode:(null===(b=j.promoCode)||void 0===b?void 0:b.code)||void 0,isGift:G,giftCards:(null===(k=null==j?void 0:j.giftCards)||void 0===k?void 0:k.map(e=>e.code))||[],deliveryTips:l||Object.values(j.fulfillments||{}).filter(e=>e.type===s.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.amounts.tip}))};d?K.payment=d:(null===(w=null===(x=j.paymentForm)||void 0===x?void 0:x.paymentMethod)||void 0===w?void 0:w.id)&&(K.payment=j.paymentForm.paymentMethod.id);const Y=c||j.deliveryInstructions;if(Y&&(K.deliveryInstructions=Object.values(j.items||{}).map(e=>({fulfillmentId:e.fulfillmentId,instructions:Y}))),K.customer=e||((null===(S=null===(C=null==j?void 0:j.customerForm)||void 0===C?void 0:C.data)||void 0===S?void 0:S.email)?{firstName:null===(E=null===(_=j.customerForm)||void 0===_?void 0:_.data)||void 0===E?void 0:E.firstName,lastName:null===(I=null===(T=j.customerForm)||void 0===T?void 0:T.data)||void 0===I?void 0:I.lastName,email:null===(D=null===(P=j.customerForm)||void 0===P?void 0:P.data)||void 0===D?void 0:D.email,phone:null===(F=null===(A=j.customerForm)||void 0===A?void 0:A.data)||void 0===F?void 0:F.phone,birthDate:null===(L=null===(M=j.customerForm)||void 0===M?void 0:M.data)||void 0===L?void 0:L.birthDate,company:null===(N=null===(R=j.customerForm)||void 0===R?void 0:R.data)||void 0===N?void 0:N.company}:void 0),G){const e=n||(null===(z=j.giftRecipientForm)||void 0===z?void 0:z.data);e&&(K.giftOptions=e)}return B||(o?K.billingAddress={firstName:o.firstName,lastName:o.lastName,email:o.email,phone:o.phone,company:o.company,one:o.one,two:o.two,city:o.city,state:o.state,zip:o.zip}:j.paymentForm.data&&(K.billingAddress=j.paymentForm.data)),K}getDetails(){var e,n,o,r;const s=this.store.get("checkout"),a={};for(const c in s.items||{}){const e=s.items[c];a[c]={liquidId:e.liquidId,variantId:e.variantId,cartItemId:c,retailerId:e.retailerId,fulfillmentId:e.fulfillmentId,salsifyPid:e.salsifyPid,salsifyGrouping:e.salsifyGrouping,name:e.name,catPath:e.catPath,volume:e.volume,uom:e.uom,proof:e.proof,abv:e.abv,containerType:e.containerType,container:e.container,size:e.size,pack:e.pack,packDesc:e.packDesc,mainImage:e.mainImage,brand:e.brand,partNumber:e.partNumber,upc:e.upc,sku:e.sku,price:e.price,unitPrice:e.unitPrice,quantity:e.quantity,tax:e.tax,unitTax:e.unitTax,bottleDeposits:e.bottleDeposits,attributes:e.attributes}}return{cartId:s.cartId,isGift:s.isGift||![],billingSameAsShipping:(null===(e=s.paymentForm)||void 0===e?void 0:e.billingSameAsShipping)||!![],marketingPreferences:{canEmail:(null===(n=s.marketingPreferences)||void 0===n?void 0:n.canEmail)||![],canSms:(null===(o=s.marketingPreferences)||void 0===o?void 0:o.canSms)||![]},hasPromoCode:Boolean(null===(r=s.promoCode)||void 0===r?void 0:r.code),hasGiftCards:Array.isArray(s.giftCards)&&s.giftCards.length>0,amounts:s.amounts,itemCount:Object.values(a).reduce((e,n)=>e+(n.quantity||0),0),items:a}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(e,n=![]){this.store.createProductInstance(e),n&&this.store.set("products."+e+".loading",!![])}async loadMultipleProducts(e){var n;if(!Array.isArray(e)||0===e.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(e.reduce((e,n)=>(e["products."+n+".loading"]=!![],e["products."+n+".error"]=null,e),{}));const o=await this.api.getProductsData(e,this.getLocation());if(!o||!o.products||0===o.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(e.reduce((e,n)=>(e["products."+n+".loading"]=![],e["products."+n+".error"]=!![],e),{})),void 0;const r=[];for(const a of o.products){const s=Object.values(a.sizes).filter(n=>e.some(e=>e===(n.upc||n.id||a.salsifyGrouping))),c=e.find(e=>s.some(n=>e===n.upc||e===n.id)||e===a.salsifyGrouping),l=c||(null===(n=null==s?void 0:s[0])||void 0===n?void 0:n.upc);await this.loadProduct(l,{products:[a],retailers:o.retailers}),r.push(l)}const s=e.filter(e=>-1===r.indexOf(e));this.store.batch(s.reduce((e,n)=>(e["products."+n+".loading"]=![],e["products."+n+".error"]="Product data not found",e),{}))}async loadProduct(e,o=null){var r,s;try{const a=this.store.get("products."+e);a.loading||this.store.set("products."+e+".loading",!![]);let c=null;if(o&&(c=o),o||(c=await this.api.getProductsData([e],this.getLocation())),!c||!(null===(r=null==c?void 0:c.products)||void 0===r?void 0:r[0]))return this.store.set("products."+e+".error","Product data not found"),void 0;const l=this.loadProductStoreUpdate(c);if(!l)return this.store.set("products."+e+".error","Failed to process product data"),void 0;this.store.set("products."+e,{...l,identifier:e}),this.pubSub.publishAction(n.PRODUCT_LOADED,this.productDataForEventFromStore(e));const d=c.products[0],p=l.sizes[l.selectedSizeId||""],f=Boolean(this.getLocation()),g=l.selectedFulfillment,v=f&&(null==g?void 0:g.variant.price)?g.variant.price:l.noAvailabilityPrice,y=splitCategoryPath(d.catPath);this.googleTagManager.viewItem({item_id:null==p?void 0:p.id,item_name:d.name,item_brand:d.brand,item_size:null==p?void 0:p.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar(v),item_type:d.type,item_subtype:d.subType,item_image:(null==p?void 0:p.image)||(null===(s=d.images)||void 0===s?void 0:s[0]),upc:null==p?void 0:p.upc,grouping_id:d.salsifyGrouping,product_id:null==p?void 0:p.id})}catch(a){this.store.set("products."+e+".error",a.message),this.logger.error("Failed to load product data for ID "+e,a)}finally{this.store.set("products."+e+".loading",![])}}async selectSize(e,o){var r,a,c;const l=this.store.get("products."+e),d=l.sizes[o],p=Object.values(d.shippingFulfillments),f=Object.values(d.onDemandFulfillments),g=p.length>0,v=f.length>0,y=g||v;let b=l.selectedFulfillmentType,k=null,x=null;const w=b===s.SHIPPING?g:v;!w&&y&&(b=b===s.SHIPPING?s.ON_DEMAND:s.SHIPPING);const C=b===s.SHIPPING?p:f;C.length>0&&(k=C[0],x=k.id);const S=C.length>0,_=splitCategoryPath(l.catPath);this.googleTagManager.viewItem({item_id:null==d?void 0:d.id,item_name:l.name,item_brand:l.brand,item_size:null==d?void 0:d.size,item_category:_.category,item_category2:_.category2,item_category3:_.category3,price:centToDollar((null==k?void 0:k.variant.price)||l.noAvailabilityPrice),item_type:l.type,item_subtype:l.subType,item_image:(null==d?void 0:d.image)||(null===(r=l.images)||void 0===r?void 0:r[0]),upc:null==d?void 0:d.upc,grouping_id:l.salsifyGrouping,product_id:null==d?void 0:d.id}),y||this.googleTagManager.productSizeNoAvailability({productId:null==d?void 0:d.id,productName:l.name,productBrand:l.brand,productCategory:_.category,productCategory2:_.category2,productCategory3:_.category3,productType:l.type,productSubtype:l.subType,productPrice:l.noAvailabilityPrice,sizeId:o,sizeName:null==d?void 0:d.size,upc:null==d?void 0:d.upc,groupingId:l.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:e,selectedSizeId:o,selectedSize:(null===(a=l.sizes[o])||void 0===a?void 0:a.size)||"",previousSizeId:l.selectedSizeId||"",previousSize:(null===(c=l.sizes[l.selectedSizeId])||void 0===c?void 0:c.size)||""}),this.store.batch({["products."+e+".selectedSizeId"]:o,["products."+e+".productHasAvailability"]:y,["products."+e+".fulfillmentHasAvailability"]:S,["products."+e+".selectedFulfillmentType"]:b,["products."+e+".selectedFulfillment"]:k,["products."+e+".selectedFulfillmentId"]:x})}async selectFulfillment(e,o){var r;const a=this.store.get("products."+e),c=a.sizes[a.selectedSizeId],l=a.selectedFulfillmentType===s.SHIPPING?c.shippingFulfillments:c.onDemandFulfillments,d=l[o];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:e,selectedFulfillmentId:o,selectedFulfillmentType:a.selectedFulfillmentType,previousFulfillmentId:a.selectedFulfillmentId||"",previousFulfillmentType:a.selectedFulfillmentType});const p=splitCategoryPath(a.catPath);this.googleTagManager.viewItem({item_id:null==c?void 0:c.id,item_name:a.name,item_brand:a.brand,item_size:null==c?void 0:c.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,price:centToDollar((null==d?void 0:d.variant.price)||a.noAvailabilityPrice),item_type:a.type,item_subtype:a.subType,item_image:(null==c?void 0:c.image)||(null===(r=a.images)||void 0===r?void 0:r[0]),upc:null==c?void 0:c.upc,grouping_id:a.salsifyGrouping,product_id:null==c?void 0:c.id}),this.store.batch({["products."+e+".selectedFulfillment"]:d,["products."+e+".selectedFulfillmentId"]:o,["products."+e+".quantity"]:1})}async updateQuantity(e,o){var r;const s=this.store.get("products."+e),a=s.quantity,c=a+o,l=1,d=(null===(r=null==s?void 0:s.selectedFulfillment)||void 0===r?void 0:r.variant.stock)||5,p=Math.max(l,Math.min(d,c));this.pubSub.publishAction(o<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:e,quantity:p,previousQuantity:a}),this.store.set("products."+e+".quantity",p)}async changeFulfillmentType(e,o){var r,a;const c=this.store.get("products."+e),l=c.sizes[c.selectedSizeId],d=o===s.SHIPPING?l.shippingFulfillments:l.onDemandFulfillments,p=Object.values(d);if(0===p.length){const e=splitCategoryPath(c.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==l?void 0:l.id,productName:c.name,productBrand:c.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:c.type,productSubtype:c.subType,productPrice:c.noAvailabilityPrice,sizeId:null!==(r=c.selectedSizeId)&&void 0!==r?r:void 0,sizeName:null==l?void 0:l.size,fulfillmentType:o,upc:null==l?void 0:l.upc,groupingId:c.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+o+" fulfillments available for selected size"}),void 0}const f=p[0]||null,g=(null==f?void 0:f.id)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:e,selectedFulfillmentType:o,selectedFulfillmentId:g,previousFulfillmentType:c.selectedFulfillmentType,previousFulfillmentId:c.selectedFulfillmentId,fulfillmentHasAvailability:p.length>0});const v=splitCategoryPath(c.catPath);this.googleTagManager.viewItem({item_id:null==l?void 0:l.id,item_name:c.name,item_brand:c.brand,item_size:null==l?void 0:l.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar((null==f?void 0:f.variant.price)||c.noAvailabilityPrice),item_type:c.type,item_subtype:c.subType,item_image:(null==l?void 0:l.image)||(null===(a=c.images)||void 0===a?void 0:a[0]),upc:null==l?void 0:l.upc,grouping_id:c.salsifyGrouping,product_id:null==l?void 0:l.id}),this.store.batch({["products."+e+".selectedFulfillmentType"]:o,["products."+e+".selectedFulfillment"]:f,["products."+e+".selectedFulfillmentId"]:g,["products."+e+".fulfillmentHasAvailability"]:p.length>0})}async removeProduct(e){this.store.removeProductInstance(e)}async openProductDrawer(e,n,o){const r={type:n,data:o||{}};this.store.batch({["products."+e+".drawer.isOpen"]:!![],["products."+e+".drawer.contentConfig"]:r})}async closeProductDrawer(e){this.store.set("products."+e+".drawer.isOpen",![])}async rerenderAllProducts(){const e=this.store.getProductInstances(),n=Object.keys(e);for(const o of n)this.store.set("products."+o+".rerender",!![])}async addToCart(e,n){try{this.store.set("products."+e+".updating",!![]),this.uiCommands.openDrawer(r.CART),await this.cartCommands.addItem(n),this.store.batch({["products."+e+".quantity"]:1,["products."+e+".updating"]:![]});const o=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(o.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})])}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+e+".updating",![])}}async addPresaleToCart(e,n){try{this.store.set("products."+e+".updating",!![]),await this.checkoutCommands.addPresaleItem(n),this.clientConfig.isBuilder()||this.checkoutCommands.openCheckout(),this.store.batch({["products."+e+".quantity"]:1,["products."+e+".updating"]:![]})}catch(o){this.logger.error("Error adding presale item to checkout",o),this.store.set("products."+e+".updating",![])}}productDataForEventFromStore(e){const n=this.store.get("products."+e);if(!n)throw new Error('Product store not found for identifier "'+e+'"');const fulfillmentEventData=e=>e?Object.entries(e).reduce((e,[n,o])=>(e[n]={...o},e),{}):{},o=Object.entries(n.sizes||{}).reduce((e,[n,o])=>{const{loading:r,error:s,shippingFulfillments:a,onDemandFulfillments:c,...l}=o;return e[n]={...l,shippingFulfillments:fulfillmentEventData(a),onDemandFulfillments:fulfillmentEventData(c)},e},{});return{identifier:e,selectedSizeId:n.selectedSizeId||null,selectedFulfillmentType:n.selectedFulfillmentType,selectedFulfillmentId:n.selectedFulfillmentId||null,productHasAvailability:Boolean(n.productHasAvailability),fulfillmentHasAvailability:Boolean(n.fulfillmentHasAvailability),id:n.id,name:n.name,brand:n.brand,catPath:n.catPath,category:n.category,classification:n.classification,type:n.type,subType:n.subType,salsifyGrouping:n.salsifyGrouping,description:n.description,htmlDescription:n.htmlDescription,tastingNotes:n.tastingNotes,images:n.images||[],region:n.region,country:n.country,material:n.material,abv:n.abv,proof:n.proof,age:n.age,color:n.color,flavor:n.flavor,variety:n.variety,appellation:n.appellation,vintage:n.vintage,noAvailabilityPrice:n.noAvailabilityPrice,sizes:o}}findFirstAvailableSize(e){const n=Object.values(e);for(const o of n){const e=o.shippingFulfillments||{},n=o.onDemandFulfillments||{},r=Object.values(e).length,s=Object.values(n).length;if(r+s>0)return o.id}return null}loadProductStoreUpdate({products:[e,...n],retailers:o}){var r,a,c,l,d;try{const n=this.themeProvider.getConfigs("product"),p={id:e.id,brand:e.brand,category:e.category,catPath:e.catPath,classification:e.classification,type:e.type,subType:e.subType,salsifyGrouping:e.salsifyGrouping,name:e.name,description:e.description,htmlDescription:e.htmlDescription,images:e.images,region:e.region,country:e.country,material:e.material,abv:e.abv,proof:e.proof,age:e.age,color:e.color,flavor:e.flavor,variety:e.variety,appellation:e.appellation,vintage:e.vintage,tastingNotes:e.tastingNotes,noAvailabilityPrice:e.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:n.layout.enableShippingFulfillment?s.SHIPPING:s.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(e.sizes&&Object.values(e.sizes).length>0)for(const{shippingVariants:r,onDemandVariants:s,...a}of Object.values(e.sizes)){p.sizes[a.id]={...a,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const e of Object.values(r)){const n=o[e.retailerId];(null==n?void 0:n.shippingFulfillment)&&(p.sizes[a.id].shippingFulfillments[n.shippingFulfillment.id]={...n.shippingFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:e})}for(const e of Object.values(s)){const n=o[e.retailerId];(null==n?void 0:n.onDemandFulfillment)&&(p.sizes[a.id].onDemandFulfillments[n.onDemandFulfillment.id]={...n.onDemandFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:e})}}const f=Object.values(p.sizes),g=this.findFirstAvailableSize(p.sizes);p.selectedSizeId=g||(null===(r=f[0])||void 0===r?void 0:r.id)||"";const v=(null===(a=p.sizes[p.selectedSizeId])||void 0===a?void 0:a.shippingFulfillments)||{},y=(null===(c=p.sizes[p.selectedSizeId])||void 0===c?void 0:c.onDemandFulfillments)||{};p.productHasAvailability=Object.values(v).length+Object.values(y).length>0;const b=p.selectedFulfillmentType===s.SHIPPING?Object.values(v):Object.values(y);if(p.fulfillmentHasAvailability=b.length>0,p.selectedFulfillment=b[0]||null,p.selectedFulfillmentId=(null===(l=p.selectedFulfillment)||void 0===l?void 0:l.id)||null,!p.fulfillmentHasAvailability){const e=p.selectedFulfillmentType===s.SHIPPING?s.ON_DEMAND:s.SHIPPING,n=e===s.SHIPPING?Object.values(v):Object.values(y);n.length>0&&(p.selectedFulfillmentType=e,p.selectedFulfillment=n[0],p.selectedFulfillmentId=(null===(d=p.selectedFulfillment)||void 0===d?void 0:d.id)||null,p.fulfillmentHasAvailability=!![])}if(!p.productHasAvailability){const n=splitCategoryPath(e.catPath),o=p.sizes[p.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==o?void 0:o.id,productName:e.name,productBrand:e.brand,productCategory:n.category,productCategory2:n.category2,productCategory3:n.category3,productType:e.type,productSubtype:e.subType,productPrice:e.noAvailabilityPrice,upc:null==o?void 0:o.upc,groupingId:e.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for any size"})}return p}catch(p){throw this.logger.error("Product data processing error",p),p}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(e){return!e||e.length<3?[]:await this.api.getAddressSuggestions(e)}async getAddressDetails(e){return await this.api.getAddressDetails(e)}async setSelectedAddress(e){try{this.store.batch({"address.id":e.id,"address.formattedAddress":e.formattedAddress,"address.address":e.address,"address.coordinates":e.coordinates});const n=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(n)),await this.cartCommands.resetCart(),await this.store.persist()}catch(o){throw this.googleTagManager.addressFailed({googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},error:(null==o?void 0:o.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates,error:(null==o?void 0:o.message)||"Failed to update downstream state after address change"}),o}this.googleTagManager.addressUpdated({googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country},coordinates:e.coordinates}),this.pubSub.publishAction(n.ADDRESS_UPDATED,{googlePlacesId:e.id,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country},coordinates:e.coordinates,formattedAddress:e.formattedAddress})}async setAddressManually(e,o){try{const n=this.buildFormattedAddressString(e),r={id:"",formattedAddress:n,address:e,coordinates:o};await this.setSelectedAddress(r)}catch(r){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(e),address:{one:e.one,two:e.two,city:e.city,state:e.state,zip:e.zip,country:e.country},error:(null==r?void 0:r.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(e),address:e,coordinates:o,error:(null==r?void 0:r.message)||"Failed to set manual address"}),r}}async clearSelectedAddress(){this.store.set("address",v),this.pubSub.publishAction(n.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const e=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(e),this.store.clearLocalStorage()}getDetails(){const e=this.store.get("address");return e.id?{id:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates}:null}buildFormattedAddressString(e){var n,o,r,s,a,c;const l=[],d=[];(null===(n=e.one)||void 0===n?void 0:n.trim())&&d.push(e.one.trim()),(null===(o=e.two)||void 0===o?void 0:o.trim())&&d.push(e.two.trim()),d.length>0&&l.push(d.join(" ")),(null===(r=e.city)||void 0===r?void 0:r.trim())&&l.push(e.city.trim());const p=[];return(null===(s=e.state)||void 0===s?void 0:s.trim())&&p.push(e.state.trim()),(null===(a=e.zip)||void 0===a?void 0:a.trim())&&p.push(e.zip.trim()),p.length>0&&l.push(p.join(" ")),(null===(c=e.country)||void 0===c?void 0:c.trim())&&l.push(e.country.trim()),l.join(", ")}}const dt={BRANDS:"brands",FLAVOR:"flavor",FULFILLMENT:"fulfillment",REGION:"region",VARIETY:"variety",ENGRAVING:"engraving",PRICE:"price",PRESALE:"presale",CATEGORIES:"categories",SIZES:"sizes",APPELLATION:"appellation",COUNTRY:"country",VINTAGE:"vintage",MATERIALS:"materials"},ht={ALL:"all",SHIPPING:"shipping",ON_DEMAND:"onDemand"},ut={MIN:"0",MAX:"1000"},pt={YES:"YES",NO:"NO"};class ProductListCommands extends BaseCommand{constructor(){super(),this.FILTER_TYPE_MAP={[dt.BRANDS]:p.BRANDS,[dt.CATEGORIES]:p.CATEGORIES,[dt.FLAVOR]:p.FLAVOR,[dt.REGION]:p.REGION,[dt.VARIETY]:p.VARIETY,[dt.VINTAGE]:p.VINTAGE,[dt.COUNTRY]:p.COUNTRY,[dt.APPELLATION]:p.APPELLATION,[dt.MATERIALS]:p.MATERIALS,[dt.SIZES]:p.SIZES,[dt.PRESALE]:p.PRESALE,[dt.ENGRAVING]:p.ENGRAVING,[dt.FULFILLMENT]:p.FULFILLMENT},this.listeners=new Set,this.selectFulfillmentType=async(e,n)=>{var o;const r=this.getStoreState(),a=r.products.find(n=>(n.salsifyGrouping||n.id)===e),c=r.userProducts[e].selectedSizeId,l=a?Object.values(a.sizes).find(e=>e.id===c):void 0;if(!l)return;const d=n===s.SHIPPING?Object.values(l.shippingFulfillments):Object.values(l.onDemandFulfillments),p=d[0];if(!p)return;const f=p.variant,g=r.retailers,v=g[f.retailerId];if(!v)return;const y=n===s.SHIPPING?v.shippingFulfillment:v.onDemandFulfillment,b={...r.userProducts,[e]:{...r.userProducts[e],selectedFulfillmentType:n,selectedFulfillment:y?{...y,id:null!==(o=y.id)&&void 0!==o?o:"",retailerName:v.name,retailerAddress:v.address,retailerAddressFormatted:v.addressFormatted,variant:f,image:l.image}:null}};this.store.set("productsList.userProducts",b),this.notifyListeners()},this.selectFulfillment=async(e,n)=>{var o,r;const a=this.getStoreState(),c=a.products.find(n=>(n.salsifyGrouping||n.id)===e),l=a.userProducts[e].selectedSizeId,d=c?Object.values(c.sizes).find(e=>e.id===l):void 0;if(!d)return;const p=Object.values(d.shippingFulfillments||{}).find(e=>e.id===n),f=Object.values(d.onDemandFulfillments||{}).find(e=>e.id===n),g=p||f;if(!g)return;const v=p?s.SHIPPING:s.ON_DEMAND,y=null===(o=g.variant)||void 0===o?void 0:o.retailerId,b=y?a.retailers[y]:void 0;if(!b)return;const k=v===s.SHIPPING?b.shippingFulfillment:b.onDemandFulfillment,x={...a.userProducts,[e]:{...a.userProducts[e],selectedFulfillmentType:v,selectedFulfillment:k?{...k,id:null!==(r=k.id)&&void 0!==r?r:"",retailerName:b.name,retailerAddress:b.address,retailerAddressFormatted:b.addressFormatted,variant:g.variant,image:d.image}:null}};this.store.set("productsList.userProducts",x),this.notifyListeners()},this.selectSize=async(e,n)=>{var o;const r=this.getStoreState(),s=r.products.find(n=>(n.salsifyGrouping||n.id)===e);if(!s)return;const a=Object.values(s.sizes).find(e=>e.id===n);if(!a)return;const{fulfillment:c,fulfillmentType:l}=this.getFulfillmentForSize(a,r.userProducts[e].selectedFulfillmentType),d={...r.userProducts,[e]:{...r.userProducts[e],selectedSizeId:n,...l?{selectedFulfillmentType:l}:{},...c?{selectedFulfillment:c?{...c,image:null!==(o=c.image)&&void 0!==o?o:null}:null}:{}}};this.store.set("productsList.userProducts",d),this.notifyListeners()},this.updateQuantity=(e,n)=>{const o=this.getStoreState(),r={...o.userProducts,[e]:{...o.userProducts[e],selectedQuantity:n}};this.store.set("productsList.userProducts",r),this.notifyListeners()},this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}subscribe(e){this.listeners.add(e);const n=this.getStoreState();try{e(n)}catch(o){this.logger.error("Error in initial state listener call:",o)}return()=>{this.listeners.delete(e)}}getStoreState(){return this.store.get("productsList")}updateSearchTerm(e){this.store.set("productsList.searchTerm",e),this.notifyListeners()}setLoading(e){this.store.set("productsList.loading",e),this.notifyListeners()}notifyListeners(){const e=this.getStoreState();this.listeners.forEach(n=>{try{n(e)}catch(o){this.logger.error("Error in state listener:",o)}})}initializeProductFulfillment(e){const n=Object.values(e.sizes)[0];if(!n)return{sizeId:"",fulfillmentType:null,fulfillment:null};const o=n.id,r=Object.values(n.shippingFulfillments)[0];if(r)return{sizeId:o,fulfillmentType:"shipping",fulfillment:{...r,image:Object.values(e.sizes)[0].image}};const s=Object.values(n.onDemandFulfillments)[0];return s?{sizeId:o,fulfillmentType:"onDemand",fulfillment:{...s,image:e.sizes[0].image}}:{sizeId:o,fulfillmentType:null,fulfillment:null}}transformProductVariantsToFulfillments(e,n){return e.map(e=>this.transformSingleProduct(e,n))}transformSingleProduct(e,n){const o={...e,sizes:{}};if(!e.sizes||0===Object.values(e.sizes).length)return o;for(const[r,s]of Object.entries(e.sizes))o.sizes[r]=this.transformProductSize(s,n);return o}transformProductSize(e,n){const{shippingVariants:o,onDemandVariants:r,...s}=e,a={...s,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};return this.addShippingFulfillments(a,o,n),this.addOnDemandFulfillments(a,r,n),a}addShippingFulfillments(e,n,o){if(n)for(const r of Object.values(n)){const n=o[r.retailerId];(null==n?void 0:n.shippingFulfillment)&&(e.shippingFulfillments[n.shippingFulfillment.id]={...n.shippingFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:r})}}addOnDemandFulfillments(e,n,o){if(n)for(const r of Object.values(n)){const n=o[r.retailerId];(null==n?void 0:n.onDemandFulfillment)&&(e.onDemandFulfillments[n.onDemandFulfillment.id]={...n.onDemandFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:r})}}async loadInitialProducts(e,n,o,r,s){try{this.setLoading(!![]);const a=this.buildSearchParams(e,n,o,r,s),c=await this.getProductList(a),l=this.transformProductVariantsToFulfillments(c.products||[],c.retailers||{}),d={};l&&l.length>0&&l.forEach(e=>{var n;const o=e.salsifyGrouping||e.id||"",r=this.initializeProductFulfillment(e);d[o]={selectedSizeId:r.sizeId,selectedQuantity:1,selectedFulfillmentType:r.fulfillmentType||"shipping",selectedFulfillment:r.fulfillment?{...r.fulfillment,image:null!==(n=r.fulfillment.image)&&void 0!==n?n:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":l,"productsList.retailers":c.retailers,"productsList.filters":c.navigation.filters,"productsList.pagination":this.updatePagination(c.navigation),"productsList.loading":![],"productsList.userProducts":d}),this.notifyListeners()}catch(a){throw this.logger.error("Error loading initial products:",a),this.store.batch({"productsList.products":[],"productsList.retailers":{},"productsList.filters":[],"productsList.pagination":{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]},"productsList.loading":![],"productsList.userProducts":{}}),this.notifyListeners(),a}}async loadMoreProducts(e,n,o,r){try{const s=this.getStoreState(),a=s.pagination;if(!a.hasMorePages)return;this.setLoading(!![]);const c=a.currentPage+1,l=this.buildSearchParams(c,e,n,o,r),d=await this.getProductList(l);if(d.products&&d.products.length>0){const e=s.products,n=s.retailers,o=s.userProducts,r=this.mergeRetailers(n,d.retailers||{}),a=this.transformProductVariantsToFulfillments(d.products,d.retailers||{}),c={...o};a.forEach(e=>{var n;const o=e.salsifyGrouping||e.id||"",r=this.initializeProductFulfillment(e);c[o]={selectedSizeId:r.sizeId,selectedQuantity:1,selectedFulfillmentType:r.fulfillmentType||"shipping",selectedFulfillment:r.fulfillment?{...r.fulfillment,image:null!==(n=r.fulfillment.image)&&void 0!==n?n:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":[...e,...a],"productsList.retailers":r,"productsList.filters":d.navigation.filters,"productsList.pagination":this.updatePagination(d.navigation),"productsList.loading":![],"productsList.userProducts":c}),this.notifyListeners()}else this.store.batch({"productsList.pagination":{...a,hasMorePages:![]},"productsList.loading":![]}),this.notifyListeners()}catch(s){throw this.logger.error("Error loading more products:",s),this.setLoading(![]),s}}async getProductList(e){e.location=this.getLocation();const n=await this.api.catalogSearch(e);return n.products&&n.products.length>0&&this.trackViewItemList(n.products),n}syncFiltersFromComponent(e){const n={};for(const[o,r]of Object.entries(e))null!=r&&(Array.isArray(r)?n[o]=r:n[o]="object"==typeof r?[JSON.stringify(r)]:[String(r)]);this.store.set("productsList.appliedFilters",n),this.notifyListeners()}getSanitizedFilters(e,n){return n&&0!==n.length?e.filter(e=>{const o=this.FILTER_TYPE_MAP[e.type];return o&&n.includes(o)}):[]}buildSearchParams(e,n,o,r,s){const a={page:e,perPage:n,filters:this.buildFilters(r,s)};return o&&o.trim().length>0&&(a.search=o.trim()),a}buildFilters(e,n){const o=[];return this.addToggleFilters(o,e,n),this.addPriceFilter(o,e,n),this.addDynamicFilters(o,e,n),o}addToggleFilters(e,n,o){this.addEngravingFilter(e,n,o),this.addPresaleFilter(e,n,o),this.addFulfillmentFilter(e,n,o)}getBooleanFilterValue(e){return"boolean"==typeof e?e:Array.isArray(e)&&e.length>0?"true"===e[0]:"string"==typeof e?"true"===e:![]}addEngravingFilter(e,n,o){if(o.includes(p.ENGRAVING)){const o=this.getBooleanFilterValue(n[dt.ENGRAVING]);e.push({key:dt.ENGRAVING,values:[o?pt.YES:pt.NO]})}}addPresaleFilter(e,n,o){if(o.includes(p.PRESALE)){const o=this.getBooleanFilterValue(n[dt.PRESALE]);e.push({key:dt.PRESALE,values:[o?pt.YES:pt.NO]})}}addFulfillmentFilter(e,n,o){if(o.includes(p.FULFILLMENT)){const o=n[dt.FULFILLMENT],r=Array.isArray(o)?o[0]:o||ht.ALL,s=r===ht.ALL?[ht.ON_DEMAND,ht.SHIPPING]:[r];e.push({key:dt.FULFILLMENT,values:s})}}addPriceFilter(e,n,o){var r,s,a,c;o.includes(p.PRICE)&&e.push({key:dt.PRICE,values:{min:null!==(s=null===(r=n.price)||void 0===r?void 0:r.min)&&void 0!==s?s:ut.MIN,max:null!==(c=null===(a=n.price)||void 0===a?void 0:a.max)&&void 0!==c?c:ut.MAX}})}addDynamicFilters(e,n,o){const r=[dt.PRICE,dt.ENGRAVING,dt.PRESALE,dt.FULFILLMENT],s=Object.keys(n).filter(e=>!r.includes(e)),a=new Set;for(const l of s)e.push({key:l,values:n[l]}),a.add(l);const c=this.getFilterKeyToTypeMap();for(const l of o){const n=c[l];!n||a.has(n)||r.includes(n)||e.push({key:n,values:[]})}}setGridConfig(e,n){this.store.set("productsList.gridConfig",{rows:e,columns:n})}getItemsPerPage(){const e=this.getStoreState(),n=e.gridConfig;return n?n.rows*n.columns:16}updatePagination(e){var n,o,r,s,a;return e?{currentPage:null!==(n=e.currentPage)&&void 0!==n?n:0,totalPages:null!==(o=e.totalPages)&&void 0!==o?o:0,totalCount:null!==(r=e.totalCount)&&void 0!==r?r:0,hasMorePages:(null!==(s=e.currentPage)&&void 0!==s?s:0)<(null!==(a=e.totalPages)&&void 0!==a?a:1)-1}:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]}}createInitialPagination(){return{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]}}mergeRetailers(e,n){const o={...e};for(const[r,s]of Object.entries(n))o[r]||(o[r]=s);return o}extractProductCardData(e,n){const o=Object.values(e.sizes)[0];if(!o)return this.logger.warn("Product "+e.id+" has no sizes"),null;const r=Object.values(o.shippingFulfillments),s=Object.values(o.onDemandFulfillments),a=r[0],c=s[0],l=(null==a?void 0:a.variant)||(null==c?void 0:c.variant);if(!l)return this.logger.warn("Product "+e.id+" has no variants"),null;const d=n[l.retailerId];return d?{product:e,retailer:d}:(this.logger.warn("Retailer "+l.retailerId+" not found for product "+e.id),null)}getFilterKeyToTypeMap(){const e={};for(const[n,o]of Object.entries(this.FILTER_TYPE_MAP))e[o]=n;return e}async addToCart(e){try{this.uiCommands.openDrawer(r.CART),await this.cartCommands.addItem(e)}catch(n){throw this.logger.error("Error adding product to cart from product list",n),n}}async addPresaleToCart(e){try{await this.checkoutCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.checkoutCommands.openCheckout()}catch(n){throw this.logger.error("Error adding presale product to checkout from product list",n),n}}trackViewItemList(e){if(0!==e.length)try{const n=this.getStoreState(),o=this.transformProductVariantsToFulfillments(e,n.retailers),r=o.map((e,n)=>({...this.convertProductToBaseItem(e),index:n+1}));this.googleTagManager.viewItemList(r,"product_list","Product List")}catch(n){this.logger.error("Error tracking view_item_list event",n)}}trackSelectItem(e){try{const n=this.convertProductToBaseItem(e);this.googleTagManager.selectItem(n,"product_list","Product List")}catch(n){this.logger.error("Error tracking select_item event",n)}}convertProductToBaseItem(e){var n,o;const r=null===(n=e.sizes)||void 0===n?void 0:n[0],s=null==r?void 0:r.shippingFulfillments[Object.keys(r.shippingFulfillments)[0]],a=splitCategoryPath(e.catPath);return{item_id:null==r?void 0:r.id,item_name:e.name,item_brand:e.brand,item_size:null==r?void 0:r.size,item_category:a.category,item_category2:a.category2,item_category3:a.category3,price:(null==s?void 0:s.variant.price)?centToDollar(s.variant.price):e.noAvailabilityPrice?centToDollar(e.noAvailabilityPrice):void 0,item_type:e.type,item_subtype:e.subType,item_image:(null==r?void 0:r.image)||(null===(o=e.images)||void 0===o?void 0:o[0]),upc:null==r?void 0:r.upc,grouping_id:e.salsifyGrouping,product_id:null==r?void 0:r.id,item_list_id:"product_list",item_list_name:"Product List"}}openProductListModal(e,n,o){const r={type:n,data:o};this.store.batch({["productsList.userProducts."+e+".modal.isOpen"]:!![],["productsList.userProducts."+e+".modal.contentConfig"]:r}),this.notifyListeners()}closeProductListModal(e){this.store.batch({["productsList.userProducts."+e+".modal.isOpen"]:![],["productsList.userProducts."+e+".modal.contentConfig"]:null}),this.notifyListeners()}getFulfillmentForSize(e,n){const o=Object.values(e.shippingFulfillments||{}),r=Object.values(e.onDemandFulfillments||{}),a=o[0],c=r[0];return n===s.SHIPPING&&a?{fulfillment:{...a,image:e.image},fulfillmentType:s.SHIPPING}:n===s.ON_DEMAND&&c?{fulfillment:{...c,image:e.image},fulfillmentType:s.ON_DEMAND}:a?{fulfillment:{...a,image:e.image},fulfillmentType:s.SHIPPING}:c?{fulfillment:{...c,image:e.image},fulfillmentType:s.ON_DEMAND}:{fulfillment:null,fulfillmentType:null}}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(e,o=![]){var r,s,a,c,l;const d=this.store.get("cart");for(const n of Object.keys(d.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(d.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(d.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const p={"cart.id":e.id,"cart.error":null,"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(r=e.promoCode)||void 0===r?void 0:r.code)?{...e.promoCode,error:null}:null};if((null===(s=Object.values(e.items))||void 0===s?void 0:s.length)>0)for(const n of Object.values(e.items))p["cart.items."+n.id]=n;if((null===(a=Object.values(e.retailers))||void 0===a?void 0:a.length)>0)for(const n of Object.values(e.retailers))if(p["cart.retailers."+n.id]=n,(null===(c=Object.values(n.fulfillments))||void 0===c?void 0:c.length)>0)for(const e of Object.values(n.fulfillments))p["cart.fulfillments."+e.id]=e;if((null===(l=e.events)||void 0===l?void 0:l.length)>0&&(p["cart.events"]=e.events),this.store.batch(p),o){const e=this.store.get("cart"),o=this.buildCartLoadedEventData(e);this.pubSub.publishAction(n.CART_LOADED,o)}}buildCartLoadedEventData(e){var n,o;const r=this.store.get("address"),s={};for(const a of Object.keys(e.items||{})){const n=e.items[a];s[a]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,salsifyGrouping:n.salsifyGrouping,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price,quantity:n.quantity,maxQuantity:n.maxQuantity,unitPrice:n.unitPrice,mainImage:n.mainImage,attributes:n.attributes}}return{cartId:e.id,promoCodeDiscount:null!==(o=null===(n=e.promoCode)||void 0===n?void 0:n.discount)&&void 0!==o?o:null,subtotal:e.subtotal,itemCount:e.itemsQuantity,items:s,retailers:e.retailers||{},location:(null==r?void 0:r.id)&&r.coordinates&&r.address?{placesId:r.id,formattedAddress:r.formattedAddress,address:r.address,coordinates:r.coordinates}:null}}async loadCart(){try{this.store.set("cart.loading",!![]);const e=this.store.get("cart"),n=await this.api.getCartData(e.id);this.syncCartFromResponse(n,!![]),n.id!==e.id&&await this.store.persist()}catch(e){const o=(null==e?void 0:e.message)||"Failed to load cart";this.store.set("cart.error",o);const r=this.store.get("cart.id");this.pubSub.publishAction(n.CART_FAILED,{cartId:r,message:o}),this.logger.error("Load cart failed",e)}finally{this.store.set("cart.loading",![])}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}const mt="lce-checkout-stripe-slot",ft={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},gt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},vt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};class BaseActionService{constructor(e){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get(e)}getLocation(){const e=this.store.get("address");if(e.address.one&&e.coordinates.latitude&&e.coordinates.longitude)return{coordinates:e.coordinates,address:e.address}}}class ClientCheckoutActionService extends BaseActionService{constructor(){super("CheckoutAction"),this.allowedCustomerFields=new Set(Object.values(ft)),this.allowedBillingFields=new Set(Object.values(vt)),this.allowedGiftFields=new Set(Object.values(gt)),this.cartActionsAddProduct=null,this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientCheckoutActionService",()=>new ClientCheckoutActionService)}setCartActionsAddProduct(e){this.cartActionsAddProduct=e}get actions(){return{openCheckout:this.openCheckout.bind(this),closeCheckout:this.closeCheckout.bind(this),toggleCheckout:this.toggleCheckout.bind(this),addProduct:this.addProduct.bind(this),applyPromoCode:this.applyPromoCode.bind(this),removePromoCode:this.removePromoCode.bind(this),applyGiftCard:this.applyGiftCard.bind(this),removeGiftCard:this.removeGiftCard.bind(this),toggleIsGift:this.toggleIsGift.bind(this),toggleBillingSameAsShipping:this.toggleBillingSameAsShipping.bind(this),toggleMarketingPreferences:this.toggleMarketingPreferences.bind(this),updateCustomerInfo:this.updateCustomerInfo.bind(this),updateBillingInfo:this.updateBillingInfo.bind(this),updateGiftInfo:this.updateGiftInfo.bind(this),getDetails:this.getDetails.bind(this)}}normalizeCheckoutFieldValue(e){return"string"==typeof e?e:null==e?"":String(e)}openCheckout(){this.command.ui.openDrawer(r.CHECKOUT)}closeCheckout(){this.command.ui.closeDrawer()}toggleCheckout(){const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CHECKOUT)}async addProduct(e,o){var a;try{if(!e||0===e.length)return this.logger.warn("No products provided to add to checkout"),void 0;o===!![]&&this.command.ui.openDrawer(r.CHECKOUT);const c=e.map(e=>e.identifier);if(this.cartActionsAddProduct)await this.cartActionsAddProduct(e);else for(const n of e){const e=this.getLocation();if(!e)throw new SDKError("Location is required to add products to checkout",!![]);const o=await this.api.getProductsData([n.identifier],e);if(!(null===(a=null==o?void 0:o.products)||void 0===a?void 0:a[0])){this.logger.warn("No product data found for identifier: "+n.identifier);continue}const r=o.products[0],c=Object.values(r.sizes)[0];if(!c)continue;const l=n.fulfillmentType===s.SHIPPING?c.shippingVariants:c.onDemandVariants,d=Object.values(l)[0];if(!d)continue;const p=n.fulfillmentType===s.ON_DEMAND?d.onDemandFulfillmentId:d.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:p,partNumber:d.partNumber,quantity:n.quantity,identifier:n.identifier})}await this.command.checkout.loadCheckout({});const l=this.store.get("cart.id");this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:l,itemsAdded:e.length,identifiers:c}),this.logger.info("Products added to checkout successfully:",c)}catch(c){this.logger.error("Error adding products to checkout:",c);const o=this.store.get("cart.id");throw this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:o,identifiers:e.map(e=>e.identifier),error:c.message||"Failed to add products to checkout"}),c}}async applyPromoCode(e){var o;try{if(!e||""===e.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const r=e.trim().toUpperCase(),s=this.themeProvider.getConfigs("global"),a=s.layout.allowPromoCodes;if(!a)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const c=this.store.get("checkout.promoCode");if(c&&c.code===r)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(e);const l=this.store.get("checkout"),d=l.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:l.cartId,discount:(null==d?void 0:d.discount)||0,newTotal:(null===(o=null==l?void 0:l.amounts)||void 0===o?void 0:o.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(r){this.logger.error("Failed to apply checkout promo code:",r);const e=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:e.cartId,error:"Promo code could not be applied"}),r}}async removePromoCode(){var e;try{const o=this.themeProvider.getConfigs("global"),r=o.layout.allowPromoCodes;if(!r)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const s=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:s.cartId,newTotal:(null===(e=null==s?void 0:s.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(o){throw this.logger.error("Failed to remove checkout promo code:",o),o}}async applyGiftCard(e){var o;try{const r=this.themeProvider.getConfigs("checkout"),s=r.layout.allowGiftCards;if(!s)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(e);const a=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:a.cartId,newTotal:(null===(o=null==a?void 0:a.amounts)||void 0===o?void 0:o.total)||0}),this.logger.info("Gift card applied successfully")}catch(r){this.logger.error("Failed to apply gift card:",r);const e=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:e.cartId,error:"Gift card could not be applied"}),r}}async removeGiftCard(e){var o;try{const r=this.themeProvider.getConfigs("checkout"),s=r.layout.allowGiftCards;if(!s)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(e);const a=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:a.cartId,newTotal:(null===(o=null==a?void 0:a.amounts)||void 0===o?void 0:o.total)||0}),this.logger.info("Gift card removed successfully")}catch(r){this.logger.error("Failed to remove gift card:",r);const e=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:e.cartId,error:"Gift card could not be removed"}),r}}async toggleIsGift(e){await this.command.checkout.toggleIsGift(e)}async toggleBillingSameAsShipping(e){await this.command.checkout.toggleBillingSameAsShipping(e)}async toggleMarketingPreferences(e,n){await this.command.checkout.toggleMarketingPreferences(e,n)}updateCustomerInfo(e){const n={};if(!e||"object"!=typeof e)return this.logger.warn("actions.checkout.updateCustomerInfo called without valid params"),void 0;for(const[o,r]of Object.entries(e)){if(!this.allowedCustomerFields.has(o))continue;const e=this.normalizeCheckoutFieldValue(r);o===ft.addressTwo?n["checkout.shippingAddress.address.two"]=e:n["checkout.customerForm.data."+o]=e}if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateCustomerInfo called without supported fields"),void 0;this.store.batch(n)}updateBillingInfo(e){const n={};if(!e||"object"!=typeof e)return this.logger.warn("actions.checkout.updateBillingInfo called without valid params"),void 0;for(const[o,r]of Object.entries(e))this.allowedBillingFields.has(o)&&(n["checkout.paymentForm.data."+o]=this.normalizeCheckoutFieldValue(r));if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateBillingInfo called without supported fields"),void 0;this.store.batch(n)}updateGiftInfo(e){const n={};if(!e||"object"!=typeof e)return this.logger.warn("actions.checkout.updateGiftInfo called without valid params"),void 0;for(const[o,r]of Object.entries(e)){if(!this.allowedGiftFields.has(o))continue;const e=this.normalizeCheckoutFieldValue(r);o===gt.addressTwo?n["checkout.shippingAddress.address.two"]=e:n["checkout.giftRecipientForm.data."+o]=e}if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateGiftInfo called without supported fields"),void 0;this.store.batch(n)}getDetails(){return this.command.checkout.getDetails()}}const yt="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",bt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const e=LoggerFactory,n=e.instances;if(n)for(const[r,s]of n)this.interceptLoggerInstance(s,r);const o=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=e=>{const n=o(e);return this.interceptLoggerInstance(n,e),n}}interceptLoggerInstance(e,n){if(e.l)return;const o=e.debug.bind(e),r=e.info.bind(e),s=e.warn.bind(e),a=e.error.bind(e),O=(e,o,r)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:e,message:o,data:r,context:n});e.debug=(e,n)=>{o(e,n),this.addLogEntry(O("debug",e,n))},e.info=(e,n)=>{r(e,n),this.addLogEntry(O("info",e,n))},e.warn=(e,n)=>{s(e,n),this.addLogEntry(O("warn",e,n))},e.error=(e,n)=>{a(e,n),this.addLogEntry(O("error",e,n))},e.l=!![]}interceptPubSubEvents(){const e=PubSubService.getInstance(),n=e.publishAction.bind(e);e.publishAction=(e,o)=>{n(e,o),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+e,data:o,context:"PubSub"})};const o=e.publishForm.bind(e);e.publishForm=(e,n)=>{o(e,n),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+e,data:n,context:"PubSub"})}}interceptGtmEvents(){const e=GoogleTagManagerService.getInstance(),n=e.executeEvent.bind(e);e.executeEvent=(e,o,r)=>{n(e,o,r),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+o,data:r,context:"GTM."+e})}}addLogEntry(e){this.logs.push(e),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const e=this.logs.filter(e=>{switch(e.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",e.forEach(e=>{const n=this.createLogElement(e);this.logContainer.appendChild(n)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const e=document.querySelector(bt);e&&e.remove(),this.panelElement=document.createElement(bt);const n=window.innerWidth<=768,o=window.innerWidth<=480;o?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):n?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const e=this.panelElement.attachShadow({mode:"closed"}),n=document.createElement("style");n.textContent=yt,e.appendChild(n),this.floatingButton=this.createFloatingButton(),e.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const o=this.createHeader();this.panelContainer.appendChild(o);const r=this.createToggles();this.panelContainer.appendChild(r),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const s=this.createResizeHandle();this.panelContainer.appendChild(s),e.appendChild(this.panelContainer),this.setupShadowEventListeners(e)}createHeader(){const e=document.createElement("div");e.className="header",e.title="Drag to move panel";const n=document.createElement("div");n.className="icon",n.innerHTML="🔍",n.title="Elements Debug Console",n.style.cursor="help";const o=document.createElement("div");o.className="title-container";const r=document.createElement("div");r.className="title",r.textContent="Elements Debug Console";const s=document.createElement("div");s.className="subtitle",s.textContent="Live SDK logs, events & GTM tracking",o.appendChild(r),o.appendChild(s);const a=document.createElement("button");return a.className="minimize",a.innerHTML="−",a.title="Minimize debug panel",a.addEventListener("click",()=>this.toggleVisibility()),e.appendChild(n),e.appendChild(o),e.appendChild(a),e}createToggles(){const e=document.createElement("div");e.className="toggles";const n=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];n.forEach(({key:n,label:o,description:r,color:s})=>{const a=document.createElement("label");a.className="toggle",a.title=r;const c=document.createElement("input");c.type="checkbox",c.checked="showLogs"!==n,c.addEventListener("change",e=>{const o=e.target;"showEvents"===n&&(this.showEvents=o.checked),"showGtmEvents"===n&&(this.showGtmEvents=o.checked),"showLogs"===n&&(this.showLogs=o.checked),this.renderLogs()});const l=document.createElement("span");l.textContent=o,l.style.color=s,a.appendChild(c),a.appendChild(l),e.appendChild(a)});const o=document.createElement("button");return o.className="clear-btn",o.innerHTML="🗑️",o.title="Clear all logs",o.addEventListener("click",()=>this.clearLogs()),e.appendChild(o),e}createResizeHandle(){const e=document.createElement("div");e.className="resize-handle",e.title="Drag to resize panel",e.style.cursor="nw-resize";let n=![],o=0,r=0,s=0,a=0;e.addEventListener("mousedown",e=>{n=!![],o=e.clientX,r=e.clientY,s=Number.parseInt(this.panelElement.style.width,10)||500,a=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",m),document.addEventListener("mouseup",i),e.preventDefault()});const m=e=>{if(!n||!this.panelElement)return;const c=e.clientX-o,l=e.clientY-r,d=window.innerWidth<=768,p=window.innerWidth<=480;let f,g,v,y;p?(f=280,g=window.innerWidth-20,v=200,y=.4*window.innerHeight):d?(f=300,g=window.innerWidth-30,v=200,y=.4*window.innerHeight):(f=300,g=800,v=200,y=600);const b=Math.max(f,Math.min(g,s+c)),k=Math.max(v,Math.min(y,a+l));this.panelElement.style.width=b+"px",this.panelElement.style.height=k+"px"},i=()=>{n=![],document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",i)};return e}setupShadowEventListeners(e){if(!this.panelElement)return;const n=e.querySelector(".header");if(n){let e=![],o=0,r=0,s=0,a=0;n.addEventListener("mousedown",n=>{if(n.target.classList.contains("minimize"))return;e=!![],o=n.clientX,r=n.clientY;const c=this.panelElement.getBoundingClientRect();s=c.left,a=c.top,document.addEventListener("mousemove",m),document.addEventListener("mouseup",i),n.preventDefault()});const m=n=>{if(!e||!this.panelElement)return;const c=n.clientX-o,l=n.clientY-r;this.panelElement.style.left=s+c+"px",this.panelElement.style.top=a+l+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},i=()=>{e=![],document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",i)}}}createFloatingButton(){const e=document.createElement("div");return e.className="floating-btn",e.innerHTML="⚙️",e.title="Open Elements Debug Console",e.style.display="none",e.addEventListener("click",()=>{this.toggleVisibility()}),e}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(e){const n=document.createElement("div");n.className="log-entry "+e.type+" "+e.level;const o=new Date(e.timestamp).toLocaleTimeString();return n.innerHTML='\n <div class="log-meta">\n <div class="log-type '+e.type+'">'+e.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+o+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(e.message)+"\n "+(e.context?'<div class="log-context">'+this.escapeHtml(e.context)+"</div>":"")+"\n "+(e.data?'<div class="log-data"><pre>'+this.formatJsonData(e.data)+"</pre></div>":"")+"\n </div>\n ",n}formatJsonData(e){try{return"object"==typeof e&&null!==e?JSON.stringify(e,null,2):String(e)}catch(n){return String(e)}}escapeHtml(e){const n=document.createElement("div");return n.textContent=e,n.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(e){if(this.h()){const n=this.u(e);if(n)return this.m(e,n)}return this.cachedFingerprint||(this.cachedFingerprint=this.v()),this.m(e,this.cachedFingerprint)}getFingerprintData(){return{screen:this.k(),browser:this.C(),timezone:this.S()}}isLocalStorageWebApiAvailable(){return this.h()}m(e,n){return(e+"_"+n).toLowerCase()}h(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const e=window.localStorage,n="__localStorage_test_"+Date.now()+"__",o="test";e.setItem(n,o);const r=e.getItem(n);return r!==o?(this.isLocalStorageAvailable=![],![]):(e.removeItem(n),this.isLocalStorageAvailable=!![],!![])}catch(e){const o=e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name);if(o)try{const e=window.localStorage;return e&&e.length>0?(this._()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(n){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],e instanceof DOMException){const n={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},o=n[e.name]||"Storage error: "+e.name,r=this._()?"webview":"browser";console.warn("localStorage unavailable in "+r+": "+o)}else console.warn("localStorage unavailable:",e.message||"Unknown error");return![]}}u(e){try{const n=this.clientConfig.get("localStorageKeyPrefix")+"_"+e.toLowerCase()+"_";for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e);if(null==o?void 0:o.startsWith(n)){const e=o.substring(n.length);if(e&&/^[a-f0-9]+$/.test(e))return e}}return null}catch(n){return null}}v(){const e=this.getFingerprintData(),n=Object.keys(e).sort().map(n=>n+":"+e[n]).join("|");return this.T(n)}k(){try{const e=screen,n=e.colorDepth||24,o=e.pixelDepth||n,r=this.I(),s=Math.round(100*(window.devicePixelRatio||1));return n+"|"+o+"|"+r+"|"+s}catch(e){return"24|24|srgb|100"}}I(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(Z){}return"srgb"}C(){var e;try{const n=navigator,o=[],r=((null===(e=n.languages)||void 0===e?void 0:e[0])||n.language||"en").substring(0,2);o.push(r),o.push(n.hardwareConcurrency||4);const s=(n.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);o.push(s),o.push(n.cookieEnabled?"1":"0"),o.push(n.maxTouchPoints||0),o.push(n.deviceMemory||0),o.push(this.P()),o.push(this._()?"webview":"browser");const a=["bluetooth"in n?"1":"0","usb"in n?"1":"0","mediaDevices"in n?"1":"0","permissions"in n?"1":"0","credentials"in n?"1":"0","storage"in n?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return o.push(a.join("")),o.join("|")}catch(n){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}P(){try{const e=navigator.userAgent.toLowerCase();return e.includes("instagram")?"ig_webview":e.includes("fban")||e.includes("fbav")?"fb_webview":e.includes("tiktok")?"tiktok_webview":e.includes("linkedin")?"linkedin_webview":e.includes("snapchat")?"snapchat_webview":e.includes("twitter")?"twitter_webview":e.includes("line/")?"line_webview":e.includes("micromessenger")?"wechat_webview":e.includes("firefox")?"gecko":e.includes("edg/")?"edge":e.includes("opr/")||e.includes("opera")?"opera":e.includes("chrome")&&!e.includes("edg")?"blink":e.includes("safari")&&!e.includes("chrome")?"webkit":"unknown"}catch(e){return"unknown"}}_(){try{const e=navigator.userAgent.toLowerCase(),n=navigator,o=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return o.some(n=>e.includes(n))?!![]:void 0===n.standalone||n.standalone?window.self!==window.top?!![]:![]:!![]}catch(e){return![]}}S(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return e.replace(/\//g,"_").substring(0,30)}catch(e){return"UTC"}}T(e){const n=16777619;let o=2166136261,r=2166136261,s=2166136261,a=2166136261;for(let c=0;c<e.length;c++){const l=e.charCodeAt(c);o^=l,o=Math.imul(o,n),r^=l<<1,r=Math.imul(r,n),s^=l<<2,s=Math.imul(s,n),a^=l<<3,a=Math.imul(a,n)}return o=Math.abs(o),r=Math.abs(r),s=Math.abs(s),a=Math.abs(a),o.toString(16)+r.toString(16)+s.toString(16)+a.toString(16)}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance();const n=this.clientConfig.get("env"),o=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:o,batchSize:n===e.PRODUCTION?5:10,batchInterval:n===e.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(e,n,o={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(e))return;const r=Date.now();try{const s={eventId:"event_"+r,timestamp:r,level:e,message:n,context:o.context,error:o.error?this.buildErrorContext(o.error):void 0,component:o.component,data:o.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(s)}catch(s){this.handleInternalError(s)}}buildErrorContext(e){return{name:e.name,message:e.message,stack:this.truncateStackTrace(e.stack),code:e.code}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const e=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:e||void 0}}buildBrowserContext(){return{userAgent:navigator.userAgent,deviceType:this.clientConfig.get("deviceType"),url:window.location.href,referrer:document.referrer||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}shouldCapture(e){switch(e){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(e){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(e),this.stats.totalEvents++,this.stats.eventsByLevel[e.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var e;if(0===this.eventQueue.length||!(null===(e=this.config)||void 0===e?void 0:e.endpoint))return;const n=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const o=this.createBatch(n);try{this.sendBatch(o),this.stats.batchesSent++}catch(r){this.stats.failedBatches++,this.handleInternalError(r),this.eventQueue.unshift(...n),this.stats.queuedEvents=this.eventQueue.length}}createBatch(e){const n=Date.now();return{batchId:"batch_"+n,timestamp:n,events:e}}sendBatch(e){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const n=new Blob([JSON.stringify(e)],{type:"text/plain"}),o=navigator.sendBeacon(this.config.endpoint,n);if(o)return}catch(n){return this.sendBatchViaXHR(e),void 0}this.sendBatchViaXHR(e)}sendBatchViaXHR(e){try{const n=new XMLHttpRequest;if(n.open("POST",this.config.endpoint,![]),n.setRequestHeader("Content-Type","text/plain"),n.send(JSON.stringify(e)),n.status<200||n.status>=300)throw new SDKError("XHR request failed with status: "+n.status)}catch(n){throw new SDKError("Both sendBeacon and XHR failed: "+n.message)}}truncateStackTrace(e){if(e)return e.split("\n").slice(0,10).join("\n")}handleInternalError(e){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",e)}shutdown(){var e;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(e=this.config)||void 0===e?void 0:e.endpoint))){const e=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(e),this.stats.batchesSent++}catch(n){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(e={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...e}}initialize({data:e,config:n}){var o;this.D=Object.freeze(e),this.A=Object.freeze({type:n.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(o=null==n?void 0:n.useShadowDom)&&void 0!==o?o:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(e){return e.map(e=>this.interpolatePath(e))}interpolatePath(e){if("string"!=typeof e)return e;const n=/\{([^}]+)}/g;return e.replace(n,(n,o)=>{const r=this.D[o];return null==r?(this.logger.warn('Parameter "'+o+'" not found in component params for path "'+e+'"'),n):String(r)})}connectedCallback(){var e,n;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.A.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(e=this.connected)||void 0===e||e.call(this)}catch(o){this.logger.error("Component connectedCallback error in "+((null===(n=this.A)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"connectedCallback")}}disconnectedCallback(){var e,n;try{this.cleanup(),null===(e=this.disconnected)||void 0===e||e.call(this)}catch(o){this.logger.error("Component disconnectedCallback error in "+((null===(n=this.A)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"disconnectedCallback")}}setup(){var e,n,o;try{this.updateHostClasses(),this.updateHostAttributes(),null===(e=this.beforeSetupStoreWatchers)||void 0===e||e.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(n=this.beforeConnected)||void 0===n||n.call(this)}catch(r){this.logger.error("Component setup error in "+((null===(o=this.A)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const n of this.unsubscribers)try{n()}catch(e){this.logger.error("Cleanup error during component destruction",e),e instanceof Error&&this.captureComponentError(e,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var e;if(!this.reactiveOptions.autoDestroy)return;let n=this.reactiveOptions.autoDestroyPath;if(!n&&(null===(e=this.reactiveOptions.watchStorePaths)||void 0===e?void 0:e.length)&&(n=this.reactiveOptions.watchStorePaths[0]),!n)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const o=this.interpolatePath(n),r=this.store.watch(o,(e,n)=>{this.isDestroyed||void 0===e&&void 0!==n&&this.handleAutoDestroy(o)});this.unsubscribers.push(r)}handleAutoDestroy(e){var n;if(this.isDestroyed)return;null===(n=this.beforeAutoDestroy)||void 0===n?void 0:n.call(this,e);const o=this.reactiveOptions.autoDestroyDelay||0;o>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},o):this.destroyComponent()}destroyComponent(){var e;if(!this.isDestroyed)try{null===(e=this.onAutoDestroy)||void 0===e?void 0:e.call(this),this.remove()}catch(n){this.logger.error("Error during auto-destroy of "+this.A.tagName,n),n instanceof Error&&this.captureComponentError(n,"auto-destroy")}}setupStoreWatchers(){var e;try{let e=this.reactiveOptions.watchStorePaths;if(!(null==e?void 0:e.length)||!this.D)return;e=this.interpolateStorePaths(e);const n=this.store.watchMany(e,e=>{var n,o;try{if(this.isDestroyed)return;const o=e.map(e=>e.path).join(", "),r="store:["+o+"]",s=null===(n=this.onStoreChanged)||void 0===n?void 0:n.call(this,e);s!==![]&&this.triggerRender(r)}catch(r){this.logger.error("Store watcher callback error in "+((null===(o=this.A)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"storeWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Store watchers setup error in "+((null===(e=this.A)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupStoreWatchers")}}setupNonRenderingWatchers(){var e;try{let e=this.reactiveOptions.watchOnlyStorePaths;if(!(null==e?void 0:e.length)||!this.D)return;e=this.interpolateStorePaths(e);const n=this.store.watchMany(e,e=>{var n,o;try{if(this.isDestroyed)return;null===(n=this.onStoreWatch)||void 0===n?void 0:n.call(this,e)}catch(r){this.logger.error("Non-rendering watcher callback error in "+((null===(o=this.A)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"nonRenderingWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Non-rendering watchers setup error in "+((null===(e=this.A)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupNonRenderingWatchers")}}triggerRender(e){this.lastRenderTrigger=e,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var e,n;if(!this.initialized||this.isDestroyed)return;const o=performance.now();this.renderCount++;try{const n=this.template();"string"==typeof n&&(this.container.innerHTML=n),n instanceof HTMLElement&&safeReplaceChildren(this.container,n),Array.isArray(n)&&safeReplaceChildren(this.container,...n);const s=performance.now()-o;this.logRenderInfo(s);try{null===(e=this.afterRender)||void 0===e?void 0:e.call(this)}catch(r){this.logger.error("❌ afterRender hook error in "+this.A.tagName,r),r instanceof Error&&this.captureComponentError(r,"afterRender")}}catch(s){const e=performance.now()-o;this.logger.error("❌ Component render error in "+this.A.tagName,s),this.captureComponentError(s,"render",e),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.A.type,message:s instanceof Error?s.message:String(s)}));try{null===(n=this.onError)||void 0===n?void 0:n.call(this,s,"render")}catch(a){this.logger.error("❌ onError hook error in "+this.A.tagName,a)}}}logRenderInfo(e){const n=this.A.type,o=this.A.tagName,r=e>16?"🐌":e>8?"⚡":"🚀";this.logger.debug("Rendered "+r+" "+n+" </"+o+"> | #"+this.renderCount+" | "+e.toFixed(2)+"ms | "+this.lastRenderTrigger),e>16&&(this.logger.warn("⚠️ Slow render in "+n+"("+o+"): "+e.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:e,threshold:16,componentType:n,tagName:o,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+e.toFixed(2)+"ms",{context:"Component:"+o+":performance",component:{type:n,tagName:o,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:e,useShadowDom:this.A.useShadowDom}}))}rerender(e){this.triggerRender(e?"manual:rerender:"+e:"manual:rerender()")}captureComponentError(e,n,o){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",e.message,{context:"Component:"+this.A.tagName+":"+n,component:{type:this.A.type,tagName:this.A.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:o,useShadowDom:this.A.useShadowDom}})}catch(r){}}updateHostClasses(){const e=this.hostClasses;if(e.length>0){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());n.length>0&&this.classList.add(...n)}}addHostClasses(...e){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());n.length>0&&this.classList.add(...n)}removeHostClasses(...e){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());n.length>0&&this.classList.remove(...n)}toggleHostClasses(...e){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());for(const o of n)this.classList.toggle(o)}addHostAttribute(e,n){e&&"string"==typeof e&&n&&"string"==typeof n&&(this.setAttribute(e,String(n)),this.hostAttributes[e]=String(n))}removeHostAttribute(e){e&&"string"==typeof e&&(this.removeAttribute(e),delete this.hostAttributes[e])}updateHostAttributes(){const e=this.hostAttributes;for(const[n,o]of Object.entries(e))n&&"string"==typeof n&&o&&"string"==typeof o&&this.setAttribute(n,String(o))}get params(){return this.D}get config(){return this.themeProvider.getComponentConfig(this.A.type)}get elementConfig(){return this.A}getConfigs(e){return this.themeProvider.getConfigs(e)}getStoreValue(e){return this.store.get(e)}setStoreValue(e,n){return this.store.set(e,n)}watchStore(e,n){const o=this.store.watch(e,n);return this.unsubscribers.push(o),o}}const kt={CT:"America/New_York",DE:"America/New_York",FL:"America/New_York",GA:"America/New_York",IN:"America/New_York",KY:"America/New_York",ME:"America/New_York",MD:"America/New_York",MA:"America/New_York",MI:"America/New_York",NH:"America/New_York",NJ:"America/New_York",NY:"America/New_York",NC:"America/New_York",OH:"America/New_York",PA:"America/New_York",RI:"America/New_York",SC:"America/New_York",TN:"America/New_York",VT:"America/New_York",VA:"America/New_York",WV:"America/New_York",AL:"America/Chicago",AR:"America/Chicago",IL:"America/Chicago",IA:"America/Chicago",KS:"America/Chicago",LA:"America/Chicago",MN:"America/Chicago",MS:"America/Chicago",MO:"America/Chicago",NE:"America/Chicago",ND:"America/Chicago",OK:"America/Chicago",SD:"America/Chicago",TX:"America/Chicago",WI:"America/Chicago",AZ:"America/Phoenix",CO:"America/Denver",ID:"America/Denver",MT:"America/Denver",NV:"America/Los_Angeles",NM:"America/Denver",UT:"America/Denver",WY:"America/Denver",CA:"America/Los_Angeles",OR:"America/Los_Angeles",WA:"America/Los_Angeles",AK:"America/Anchorage",HI:"Pacific/Honolulu"},xt="America/New_York";function detectUserTimezone(e){try{if(e){const n=e.toUpperCase(),o=kt[n];return o||xt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){return xt}}function getCurrentTimeInTimezone(e){try{const n=new Date,o=n.getTime(),r=6e4*n.getTimezoneOffset(),s=new Date(o+r),a=new Date(s.toLocaleString("en-US",{timeZone:e})),c=s.getTime()-a.getTime();return new Date(o+c)}catch(n){return new Date}}function getCurrentTimeInUserTimezone(e){const n=detectUserTimezone(e);return getCurrentTimeInTimezone(n)}function isDateTimeInRange(e){const{startDate:n,endDate:o,addressState:r}=e;try{const e=getCurrentTimeInUserTimezone(r),s=!n||e>=new Date(n),a=!o||e<=new Date(o);return s&&a}catch(s){return![]}}function filterActiveItems(e,n){return e.filter(e=>isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:n}))}function hasActiveItems(e,n){return filterActiveItems(e,n).length>0}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){const e=this.store.get("checkout.presale"),n=this.getPromoTickerData(),o=this.checkForActiveTickers(n),s=document.createElement("div");s.classList.add("checkout-container"),this.params.isIndependentComponent&&s.classList.add("independent"),s.appendChild(ComponentFactoryService.createElement({type:r.CHECKOUT_INFORMATION})),s.appendChild(ComponentFactoryService.createElement({type:r.CHECKOUT_ORDER_SUMMARY}));const a=this.createHeaderWrapper(e,n,o);return[a,s]}getPromoTickerData(){var e,n;const o=this.getConfigs("global"),r=this.clientConfig.get("promoTicker"),s=null!==(n=null===(e=null==o?void 0:o.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==n?n:[];return null!=r?r:s}checkForActiveTickers(e){var n;const o=this.store.get("address");return hasActiveItems(e,null===(n=null==o?void 0:o.address)||void 0===n?void 0:n.state)}createHeaderWrapper(e,n,o){const s=this.params.isIndependentComponent,a=document.createElement("div");return a.classList.add("checkout-header-wrapper"),s&&a.classList.add("hosted"),a.appendChild(ComponentFactoryService.createElement({type:r.CHECKOUT_HEADER,isHostedCheckout:s})),n.length>0&&o&&!e&&a.appendChild(ComponentFactoryService.createElement({context:"checkout",type:r.PROMO_CODE_TICKER,tickers:n})),e&&a.appendChild(ComponentFactoryService.createElement({type:r.CHECKOUT_PRESALE_COUNTDOWN})),a}}function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+f.DRAWER_WRAPPER+";\n pointer-events: none;\n }\n\n .drawer-wrapper.open {\n pointer-events: auto;\n }\n\n /* Backdrop overlay */\n .drawer-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: "+f.DRAWER_BACKDROP+";\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n pointer-events: none;\n }\n\n .drawer-backdrop.visible {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n /* Main drawer */\n .drawer {\n position: absolute;\n top: 0;\n right: 0;\n width: 400px;\n height: 100vh; /* Fallback for browsers that don't support dvh */\n height: 100dvh;\n z-index: "+f.DRAWER_CONTENT+";\n background-color: #ffffff;\n overflow: hidden;\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n }\n\n /* Opened drawer state */\n .drawer.open {\n transform: translateX(0);\n }\n\n .drawer.address-input .drawer-content,\n .drawer.engraving-form .drawer-content,\n .drawer.product-retailers-popup-list .drawer-content {\n padding: 16px;\n }\n\n /* Content area - fills the remaining space */\n .drawer-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n background-color: var(--drawer-background-color, #FAFAFA);\n }\n\n /* Content swap animation classes */\n .drawer-content-fade-out {\n opacity: 1;\n transition: opacity 150ms ease-out;\n }\n\n .drawer-content-fade-out.fading {\n opacity: 0;\n }\n\n .drawer-content-fade-in {\n opacity: 0;\n transition: opacity 150ms ease-in;\n }\n\n .drawer-content-fade-in.visible {\n opacity: 1;\n }\n\n /* Mobile adjustments */\n @media (max-width: 576px) {\n .drawer {\n width: 100%;\n }\n }\n\n /* Accessibility - respect user's motion preferences */\n @media (prefers-reduced-motion: reduce) {\n .drawer,\n .drawer-backdrop,\n .drawer-content-fade-out,\n .drawer-content-fade-in {\n transition: none;\n }\n }\n "}const getProductLoadingStyles=()=>"\n .skeleton-container {\n min-width: 320px;\n width: 100%;\n height: auto;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n }\n\n .skeleton-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .skeleton-container .wave {\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .skeleton-container .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+f.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n .sc-main-image {\n width: 100%;\n height: 350px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n flex: 1;\n }\n\n .sc-carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background-color: #c4d1e0;\n margin-right: 10px;\n }\n\n .sc-carousel-dot:last-child {\n margin-right: 0;\n }\n\n .sc-gallery-thumbnail {\n width: 60px;\n height: 60px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-main-image::before { animation-delay: 1.5s; }\n .sc-carousel-dot::before { animation-delay: 1.6s; }\n .sc-gallery-thumbnail::before { animation-delay: 1.7s; }\n\n @media (min-width: 480px) {\n .sc-carousel-dot {\n width: 8px;\n height: 8px;\n margin-right: 8px;\n }\n }\n\n @media (min-width: 769px) {\n .sc-gallery-thumbnail {\n width: 80px;\n height: 80px;\n }\n\n .sc-main-image {\n height: 474px;\n }\n }\n\n @keyframes wave {\n 0% {\n left: -100%;\n }\n 100% {\n left: 100%;\n }\n }\n",getProductListCardLoadingStyles=()=>"\n .product-list-card-loading__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n min-width: 226px;\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n pointer-events: none;\n background-color: transparent;\n border: none;\n border-radius: var(--card-border-radius, 0.375rem);\n overflow: hidden;\n cursor: default;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n }\n\n .slc__card .wave {\n background-color: #c4d1e0;\n position: relative;\n overflow: hidden;\n }\n\n .slc__card .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+f.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n\n @media (max-width: 639px) {\n .product-list-card-loading__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .slc__card {\n width: 100%;\n flex: 0 0 100%;\n max-width: 336px;\n }\n }\n\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-card-loading__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .slc__card {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-card-loading__container {\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .slc__card {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n @media (min-width: 1024px) {\n .product-list-card-loading__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n";function getModalStyles(){return"\n .modal-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+f.MODAL+";\n pointer-events: none;\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n }\n\n .modal-wrapper.open {\n pointer-events: auto;\n }\n\n .modal-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n opacity: 0;\n visibility: hidden;\n transition: opacity 150ms ease-out, visibility 150ms ease-out;\n }\n\n .modal-backdrop.visible {\n opacity: 1;\n visibility: visible;\n }\n\n .modal {\n position: relative;\n max-width: 512px;\n max-height: 576px;\n width: 100%;\n height: 100%;\n background: transparent;\n opacity: 0;\n transform: scale(0.95);\n transition: opacity 150ms ease-out, transform 150ms ease-out;\n z-index: 1; /* Higher than backdrop within the wrapper context */\n }\n\n .modal.open {\n opacity: 1;\n transform: scale(1);\n }\n\n .modal-content {\n position: relative;\n max-width: 512px;\n max-height: 576px;\n width: 100%;\n box-sizing: border-box;\n background: var(--drawer-background-color, #FAFAFA);\n border-radius: var(--border-radius-rounded, 6px);\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n padding: 16px;\n overflow-y: auto;\n }\n\n @media (max-width: 576px) {\n .modal-wrapper {\n padding: 8px;\n }\n\n .modal {\n max-width: 100%;\n }\n\n .modal-content {\n max-height: calc(100vh - 16px);\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .modal,\n .modal-backdrop {\n transition: none;\n }\n }\n "}function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--default-text-color, #18181B);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 5px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+f.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 500;\n }\n\n .engraving-view-container .engraving-body {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-view-container .engraving-lines {\n display: flex;\n min-width: 136px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .engraving-view-container .engraving-lines .engraving-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-transform: uppercase;\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-lines .engraving-line:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-actions {\n display: flex;\n align-items: center;\n }\n\n .engraving-view-container .engraving-actions .edit-button {\n margin-left: 16px;\n }\n\n .engraving-view-container .engraving-actions button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n';lt.register("global",getGlobalStyles,0),lt.register("ui",getDrawerStyles,1),lt.register("ui",getProductLoadingStyles,2),lt.register("ui",getProductListCardLoadingStyles,3),lt.register("ui",getPromoCodeTickerStyles,4),lt.register("ui",getModalStyles,5);const getCheckoutStyles=()=>"\n .checkout-container {\n width: 100%;\n height: auto;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n align-self: stretch;\n gap: 24px;\n }\n\n .checkout-container:not(.independent) {\n padding: 24px;\n }\n\n .checkout-container.independent {\n padding: 24px;\n }\n\n .checkout-information-section {\n min-width: 320px;\n max-width: 512px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-wrap: wrap;\n flex: 1 0 0;\n }\n\n .checkout-information-section > *:not(:first-child) {\n margin-top: 24px;\n padding-top: 24px;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-delivery-information,\n .checkout-buyer-information,\n .checkout-billing-form {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-delivery-information > *:not(:first-child),\n .checkout-buyer-information > *:not(:first-child),\n .checkout-billing-form > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-billing-form {\n margin-top: 24px;\n }\n\n .checkout-payment-form {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .checkout-payment-form > *:not(:last-child) {\n margin-bottom: 24px;\n }\n\n .delivery-header-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .delivery-title-container {\n display: flex;\n min-width: 200px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .delivery-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .section-title-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .section-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .delivery-title-container > .delivery-title,\n .section-title-container > .section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .delivery-title-container > .delivery-subtitle,\n .section-title-container > .section-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-self: stretch;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .gift-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .gift-toggle-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .gift-label-wrapper {\n display: flex;\n flex-direction: column;\n min-width: 200px;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .gift-toggle-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n z-index: "+f.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .checkout-tips-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tips-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-tip-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-distribution-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-distribution-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-tips-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list.show {\n display: flex;\n }\n\n .checkout-tip-distribution-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-fulfillment-input-wrapper {\n display: flex;\n align-items: center;\n }\n\n .checkout-tip-fulfillment-input-wrapper > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-tip-remove-button {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .checkout-tip-distribution-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-sub-header {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-tip-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-tip-config-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-config-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-tip-selection-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-selection-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-tip-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-tip-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-tip-button > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-tip-input-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-input-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-sections-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-sections-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-pc-gc-sub-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-pc-gc-sub-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-pc-gc-applied {\n display: flex;\n width: 100%;\n flex-direction: row;\n align-self: stretch;\n display: flex;\n padding: 0px 12px;\n justify-content: space-between;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-pc-gc-applied span {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .checkout-pc-gc-applied button {\n display: flex;\n height: 36px;\n padding: 8px 0px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+f.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-send-to-subtitle,\n .checkout-your-info-subtitle,\n .checkout-billing-subtitle,\n .checkout-payment-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-summary-section {\n min-width: 320px;\n max-width: 400px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-summary-section > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-disclaimer-title,\n .checkout-summary-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-disclaimer-subtitle,\n .checkout-summary-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-promo-code-container,\n .checkout-gift-cards-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-promo-code-container > *:not(:first-child),\n .checkout-gift-cards-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .input-promo-code-container,\n .input-gift-card-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n }\n\n .input-promo-code-container > *:not(:first-child),\n .input-gift-card-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .input-promo-code-container .apply-button,\n .input-gift-card-container .apply-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-self: flex-start;\n align-items: center;\n\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .input-promo-code-container .apply-button.disabled,\n .input-gift-card-container .apply-button.disabled {\n background: var(--primary-color-50, #1D4ED8);\n }\n\n .checkout-amounts-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-amounts-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-amount-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-amount-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-total {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n\n }\n\n .checkout-amount-total span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-separator {\n width: 100%;\n height: 1px;\n margin: 0px;\n background: var(--accent-color, #E4E4E7);\n }\n\n .checkout-place-order-button-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-place-order-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n font-family: var(--paragraph-font-family, Poppins);\n align-self: stretch;\n font-weight: 600;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n transition: all 0.2s ease;\n cursor: pointer;\n position: relative;\n }\n\n .checkout-place-order-button-container .alert-container, .checkout-place-order-button-container .alert-wrapper {\n margin-bottom: 24px;\n }\n\n .checkout-place-order-button.ready {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-place-order-button.ready:hover {\n filter: brightness(0.9);\n transform: translateY(-1px);\n }\n\n .checkout-place-order-button.ready:active {\n transform: translateY(0);\n }\n\n /* States when things are missing/wrong - use your opacity variants */\n .checkout-place-order-button.form-invalid,\n .checkout-place-order-button.payment-incomplete,\n .checkout-place-order-button.payment-error {\n background: var(--primary-color-70);\n color: var(--selected-text-color);\n }\n\n .checkout-place-order-button.form-invalid:hover,\n .checkout-place-order-button.payment-incomplete:hover,\n .checkout-place-order-button.payment-error:hover {\n background: var(--primary-color-70);\n }\n\n /* Processing state - keep full primary color to show confidence */\n .checkout-place-order-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .checkout-place-order-button.processing::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+f.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n line-height: 100%;\n }\n\n .checkout-completed-help-section a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section {\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child,\n .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+f.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\n }\n\n /* Hosted checkout header - non-sticky */\n .checkout-header-wrapper.hosted {\n position: relative;\n background-color: transparent;\n }\n\n .checkout-header-container {\n display: flex;\n min-width: 320px;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 8px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-header-button {\n display: flex;\n height: 36px;\n padding: 12px 16px;\n padding-right: 0px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-button > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-header-button-close {\n display: flex;\n height: 36px;\n width: 36px;\n padding: 2px 4px;\n justify-content: center;\n align-items: center;\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Spacer to maintain layout balance when close button is hidden */\n .checkout-header-spacer {\n width: 36px;\n height: 36px;\n flex-shrink: 0;\n }\n\n .checkout-header-title {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-presale-countdown-container {\n display: flex;\n min-width: 320px;\n padding: 12px 24px 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n\n &.is-scrolled {\n box-shadow: 0px 6px 10px -2px var(--primary-color-30);\n }\n\n &.time-warning {\n box-shadow: 0px 6px 10px -2px var(--error-color-30, #FDE68A);\n }\n }\n\n .checkout-presale-countdown {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: 0;\n overflow: hidden;\n }\n\n .checkout-presale-countdown.time-warning {\n background: var(--error-color-30, #FDE68A);\n border: 1px solid var(--error-color, #E4E4E7);\n }\n\n .checkout-presale-countdown.time-warning {\n background: transparent;\n border: none;\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-bar {\n background: var(--error-color-70, #FDE68A);\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-fill {\n background: var(--error-color, #EF4444);\n }\n\n .checkout-presale-text-container {\n display: flex;\n padding: 0px 0px 6px;\n justify-content: flex-end;\n align-self: stretch;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-presale-progress-bar {\n display: flex;\n height: 6px;\n align-items: center;\n align-self: stretch;\n border-radius: 40px;\n background: var(--primary-color-50, #E4E4E7);\n position: relative;\n overflow: hidden;\n }\n\n .checkout-presale-progress-fill {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n z-index: "+f.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ';lt.register("checkout",getCheckoutStyles,10);const ArrowRightIcon=({width:e=16,height:n=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="arrow-right-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},CheckboxIcon=({width:e=16,height:n=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="checkbox-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:e=16,height:n=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="'+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:e=16,height:n=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="chevron-left-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},CloseIcon=({width:e=16,height:n=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="close-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:e=16,height:n=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="error-info-icon '+o+'" style="'+s+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:e=16,height:n=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="info-icon '+o+'" style="'+s+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SuccessIcon=({width:e=16,height:n=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="success-icon '+o+'" style="'+s+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:e=16,height:n=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="trash-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:e=16,height:n=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="warning-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var e,n,o;const r=this.getStoreValue("checkout"),a=Boolean(r.promoCode),c=Boolean(null===(e=r.giftCards)||void 0===e?void 0:e.length),l=this.getConfigs("global"),d=Object.values(r.fulfillments).some(e=>e.type===s.SHIPPING),p=Object.values(r.fulfillments).some(e=>e.type===s.ON_DEMAND),f=[],g=document.createElement("div");g.classList.add("checkout-amount-line");const v=document.createElement("span");v.textContent="Subtotal ("+r.itemsQuantity+" item"+(r.itemsQuantity>1?"s":"")+")",g.appendChild(v);const y=document.createElement("span");if(y.textContent=formatCentToDollarText(r.amounts.subtotal),g.appendChild(y),f.push(g),d){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Shipping",e.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(r.amounts.shipping),e.appendChild(o),f.push(e)}if(p){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Delivery",e.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(r.amounts.delivery),e.appendChild(o),f.push(e)}if((null===(n=null==r?void 0:r.amounts)||void 0===n?void 0:n.engraving)>0){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Engraving",e.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(r.amounts.engraving),e.appendChild(o),f.push(e)}const b=document.createElement("div");b.classList.add("checkout-amount-line");const k=document.createElement("span");k.textContent="Taxes & Fees",b.appendChild(k);const x=document.createElement("span");if(x.textContent=formatCentToDollarText(r.amounts.tax+r.amounts.service+r.amounts.platform),b.appendChild(x),f.push(b),a){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Promo Code ("+(null===(o=r.promoCode)||void 0===o?void 0:o.code.toUpperCase())+")",e.appendChild(n);const s=document.createElement("span");s.textContent="-"+formatCentToDollarText(r.amounts.discounts),e.appendChild(s),f.push(e)}if(c){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Gift Cards Applied",e.appendChild(n);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(r.amounts.giftCards),e.appendChild(o),f.push(e)}if(p){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Tips",e.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(r.amounts.tip),e.appendChild(o),f.push(e)}const w=document.createElement("div");w.classList.add("checkout-separator"),f.push(w);const C=document.createElement("div");C.classList.add("checkout-amount-total");const S=document.createElement("span");S.textContent="Total",C.appendChild(S);const _=document.createElement("span");if(_.textContent=formatCentToDollarText(r.amounts.total),C.appendChild(_),f.push(C),r.presale){const e=document.createElement("div");e.classList.add("checkout-amount-due");const n=document.createElement("span");n.textContent="Amount due today",e.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(0),e.appendChild(o),f.push(e);const r=document.createElement("div");r.classList.add("checkout-presale-locked-message");const s=htmlStringToElement(InfoIcon({color:l.theme.defaultTextColor}));r.appendChild(s);const a=document.createElement("p");a.textContent="Pre-ordered items will be charged when shipped.",r.appendChild(a),f.push(r)}return f}}class CheckoutBillingComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.paymentForm.billingSameAsShipping"]}),this.billingData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},addressOne:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},city:{isValid:![],value:""},state:{isValid:![],value:""},zipCode:{isValid:![],value:""}}}billingSameAsShippingToggle(){const e=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"),n=document.createElement("div");n.classList.add("checkout-billing-same-as-shipping-toggle-container");const o=document.createElement("div");o.classList.add("checkout-checkbox-container");const r=document.createElement("span");r.id="billingSameAsShipping",r.classList.add("checkout-checkbox-visual"),r.setAttribute("role","checkbox"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","Billing same as shipping checkbox"),r.setAttribute("aria-checked",e?"true":"false"),e&&r.classList.add("checked"),r.innerHTML=CheckboxIcon({width:16,height:16}),n.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),n.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const s=document.createElement("label");return s.textContent="Billing address same as shipping address",s.setAttribute("for","billingSameAsShipping"),s.classList.add("billing-checkbox-label"),o.appendChild(r),o.appendChild(s),n.appendChild(o),n}updateSaveButtonState(){const e=!Object.values(this.billingData).every(e=>e.isValid),n={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,one:this.billingData.addressOne.value,two:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zip:this.billingData.zipCode.value};this.params.isFormValid(!e,n)}template(){const e=this.getStoreValue("checkout.paymentForm"),n=[],s=this.billingSameAsShippingToggle();if(n.push(s),e.billingSameAsShipping)return n;e.data&&(e.data.firstName&&(this.billingData.firstName={isValid:!![],value:e.data.firstName}),e.data.lastName&&(this.billingData.lastName={isValid:!![],value:e.data.lastName}),e.data.email&&(this.billingData.email={isValid:!![],value:e.data.email}),e.data.phone&&(this.billingData.phone={isValid:!![],value:e.data.phone}),e.data.company&&(this.billingData.company={isValid:!![],value:e.data.company}),e.data.one&&(this.billingData.addressOne={isValid:!![],value:e.data.one}),e.data.two&&(this.billingData.addressTwo={isValid:!![],value:e.data.two}),e.data.city&&(this.billingData.city={isValid:!![],value:e.data.city}),e.data.state&&(this.billingData.state={isValid:!![],value:e.data.state}),e.data.zip&&(this.billingData.zipCode={isValid:!![],value:e.data.zip})),this.updateSaveButtonState();const a=document.createElement("div");a.classList.add("section-title-container");const c=document.createElement("h3");c.textContent="Your billing info",c.classList.add("section-title"),a.appendChild(c);const l=document.createElement("p");l.textContent="Provide the info relevant to your payment method",l.classList.add("section-subtitle"),a.appendChild(l),n.push(a);const d=document.createElement("div");d.classList.add("section-form-container");const p=document.createElement("div");p.classList.add("checkout-two-col-container");const f=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:vt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.firstName.value=e,this.pubSub.publishForm(o.BILLING,{fieldName:vt.firstName})},onValidation:e=>{this.billingData.firstName.isValid=e,this.updateSaveButtonState()}});f.setAttribute("aria-label","First name input"),p.appendChild(f);const g=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:vt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.lastName.value=e,this.pubSub.publishForm(o.BILLING,{fieldName:vt.lastName})},onValidation:e=>{this.billingData.lastName.isValid=e,this.updateSaveButtonState()}});g.setAttribute("aria-label","Last name input"),p.appendChild(g),d.appendChild(p);const v=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:vt.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.email.value=e,this.pubSub.publishForm(o.BILLING,{fieldName:vt.email})},onValidation:e=>{this.billingData.email.isValid=e,this.updateSaveButtonState()}});v.setAttribute("aria-label","Email input"),d.appendChild(v);const y=document.createElement("div");y.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:vt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.phone.value=e,this.pubSub.publishForm(o.BILLING,{fieldName:vt.phone})},onValidation:e=>{this.billingData.phone.isValid=e,this.updateSaveButtonState()}});b.setAttribute("aria-label","Phone input"),y.appendChild(b);const k=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:vt.company,label:"Company (optional)",autocomplete:!![],onChange:async e=>{this.billingData.company.value=e,this.pubSub.publishForm(o.BILLING,{fieldName:vt.company})},onValidation:e=>{this.billingData.company.isValid=e,this.updateSaveButtonState()}});k.setAttribute("aria-label","Company input"),y.appendChild(k),d.appendChild(y);const x=document.createElement("div");x.classList.add("checkout-two-col-container");const w=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:vt.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.addressOne.value=e,this.pubSub.publishForm(o.BILLING,{fieldName:vt.addressOne})},onValidation:e=>{this.billingData.addressOne.isValid=e,this.updateSaveButtonState()}});w.setAttribute("aria-label","Street address input"),x.appendChild(w);const C=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:vt.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async e=>{this.billingData.addressTwo.value=e,this.pubSub.publishForm(o.BILLING,{fieldName:vt.addressTwo})},onValidation:e=>{this.billingData.addressTwo.isValid=e,this.updateSaveButtonState()}});C.setAttribute("aria-label","Apt, suite, etc. (optional) input"),x.appendChild(C),d.appendChild(x);const S=document.createElement("div");S.classList.add("checkout-three-col-container");const _=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:vt.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.city.value=e,this.pubSub.publishForm(o.BILLING,{fieldName:vt.city})},onValidation:e=>{this.billingData.city.isValid=e,this.updateSaveButtonState()}});_.setAttribute("aria-label","City input"),S.appendChild(_);const E=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:vt.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:e=>e&&2===e.length&&/^[A-Z]{2}$/.test(e)?null:"State must be 2 uppercase characters"},onChange:async e=>{this.billingData.state.value=e,this.pubSub.publishForm(o.BILLING,{fieldName:vt.state})},onValidation:e=>{this.billingData.state.isValid=e,this.updateSaveButtonState()}});E.setAttribute("aria-label","State input"),S.appendChild(E);const T=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:vt.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.zipCode.value=e,this.pubSub.publishForm(o.BILLING,{fieldName:vt.zipCode})},onValidation:e=>{this.billingData.zipCode.isValid=e,this.updateSaveButtonState()}});return T.setAttribute("aria-label","Zip Code input"),S.appendChild(T),d.appendChild(S),n.push(d),n}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(e){const n=e.find(e=>"checkout.customerForm.isSaving"===e.path);n&&(n.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const e=this.store.get("checkout.customerForm.data");e.firstName&&(this.customerData.firstName={isValid:!![],value:e.firstName}),e.lastName&&(this.customerData.lastName={isValid:!![],value:e.lastName}),e.email&&(this.customerData.email={isValid:!![],value:e.email}),e.phone&&(this.customerData.phone={isValid:!![],value:e.phone}),e.company&&(this.customerData.company={isValid:!![],value:e.company}),e.birthDate&&(this.customerData.birthDate={isValid:!![],value:e.birthDate});const n=[],s=document.createElement("div");s.classList.add("section-title-container");const a=document.createElement("h3");a.textContent="Buyer Information",a.classList.add("section-title"),s.appendChild(a);const c=document.createElement("p");c.textContent="Buyer information is used to process your order and for delivery purposes.",c.classList.add("section-subtitle"),s.appendChild(c),n.push(s);const l=document.createElement("div");l.classList.add("section-form-container");const d=document.createElement("div");d.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ft.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:e.firstName,onChange:async e=>{this.customerData.firstName.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.firstName})},onValidation:e=>{this.customerData.firstName.isValid=e,this.updateSaveButtonState()}});d.appendChild(p);const f=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ft.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:e.lastName,onChange:async e=>{this.customerData.lastName.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.lastName})},onValidation:e=>{this.customerData.lastName.isValid=e,this.updateSaveButtonState()}});d.appendChild(f),l.appendChild(d);const g=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ft.company,label:"Company (optional)",autocomplete:!![],value:e.company,onChange:async e=>{this.customerData.company.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.company})},onValidation:e=>{this.customerData.company.isValid=e,this.updateSaveButtonState()}});l.appendChild(g);const v=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:ft.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:e.email,onChange:async e=>{this.customerData.email.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.email})},onValidation:e=>{this.customerData.email.isValid=e,this.updateSaveButtonState()}});l.appendChild(v);const y=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:ft.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:e.phone,onChange:async e=>{this.customerData.phone.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.phone})},onValidation:e=>{this.customerData.phone.isValid=e,this.updateSaveButtonState()}});l.appendChild(y);const b=ComponentFactoryService.createElement({type:r.INPUT,inputType:"birthdate",name:ft.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:e.birthDate,onChange:async e=>{this.customerData.birthDate.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.birthDate})},onValidation:e=>{this.customerData.birthDate.isValid=e,this.updateSaveButtonState()}});return l.appendChild(b),n.push(l),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),n.push(this.saveButton),this.updateSaveButtonState(),n}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const e=[],n=this.getStoreValue("checkout.customerForm.data"),o=document.createElement("div");o.classList.add("checkout-summary-form-header");const r=document.createElement("h2");r.textContent="Buyer: "+n.firstName+" "+n.lastName,o.appendChild(r);const s=document.createElement("span");if(s.textContent="Edit",s.setAttribute("aria-label","Edit Buyer Information"),s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),s.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.editCustomerForm())}),o.appendChild(s),e.push(o),n.company){const o=document.createElement("p");o.classList.add("checkout-summary-form-line"),o.textContent=n.company,e.push(o)}const a=document.createElement("p");a.classList.add("checkout-summary-form-line"),a.textContent=n.email,e.push(a);const c=document.createElement("p");c.classList.add("checkout-summary-form-line"),c.textContent=n.phone,e.push(c);const l=document.createElement("p");return l.classList.add("checkout-summary-form-line"),l.textContent=formatISODateToMMDDYYYY(n.birthDate),e.push(l),e}}const wt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],Ct={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(e,n){return"href"===e?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(n)?n:null:"src"===e?/^https?:\/\/[^\s<>"']+$/i.test(n)?n:null:"class"===e?n.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():n.replace(/[<>"']/g,"").trim()}function cleanNode(e){if(e.nodeType===Node.TEXT_NODE){const n=e.textContent||"",o=n.replace(/<[^>]*>/g,"");if(o.trim()){const e=document.createTextNode(o);return e}return null}if(e.nodeType===Node.ELEMENT_NODE){const n=e,o=n.tagName.toLowerCase();if(wt.includes(o)){const e=document.createElement(o),r=Ct[o]||[];for(const o of Array.from(n.attributes)){const n=o.name.toLowerCase();if(r.includes(n)){const r=sanitizeAttributeValue(n,o.value);null!==r&&e.setAttribute(n,r)}}"a"===o&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"));for(const o of Array.from(n.childNodes)){const n=cleanNode(o);n&&e.appendChild(n)}return e}const r=document.createDocumentFragment();for(const e of Array.from(n.childNodes)){const n=cleanNode(e);n&&r.appendChild(n)}return r.childNodes.length>0?r:null}return null}function sanitizeHTML(e){if(!e||"string"!=typeof e)return"";try{const n=new DOMParser,o=n.parseFromString(e,"text/html"),r=o.querySelector("parsererror");if(r)return console.warn("HTML parsing error detected"),"";const s=document.createDocumentFragment();for(const e of Array.from(o.body.childNodes)){const n=cleanNode(e);n&&s.appendChild(n)}const a=document.createElement("div");return a.appendChild(s),a.innerHTML}catch(n){return console.error("HTML sanitization error:",n),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var e,n,o,s,a,c;const l=[],d=this.getConfigs("configurations"),p=this.getConfigs("global"),f=this.getConfigs("checkout"),g=this.config.layout.continueShoppingUrl||window.location.host,v=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(n=null===(e=this.config.layout)||void 0===e?void 0:e.checkoutCompleted)||void 0===n?void 0:n.customLogo){const e=document.createElement("div");e.classList.add("checkout-completed-header-container");const n=document.createElement("img");n.src=null===(s=null===(o=this.config.layout)||void 0===o?void 0:o.checkoutCompleted)||void 0===s?void 0:s.customLogo,n.alt=d.partnerName+" Logo",e.appendChild(n),l.push(e)}const y=document.createElement("div");y.classList.add("checkout-completed-section-container");const b=document.createElement("div");b.classList.add("checkout-completed-title-container");const k=document.createElement("div");k.classList.add("checkout-completed-title-section");const x=document.createElement("h3");x.innerHTML=(null===(c=null===(a=this.config.layout)||void 0===a?void 0:a.checkoutCompleted)||void 0===c?void 0:c.customText)||"Thank You for Your Order!",k.appendChild(x);const w=document.createElement("p");w.textContent="Your payment has been successfully processed.",k.appendChild(w),b.appendChild(k),y.appendChild(b);const C=document.createElement("div");C.classList.add("checkout-completed-sub-section");const S=document.createElement("div");S.classList.add("checkout-completed-line");const _=document.createElement("h3");_.textContent="Order Number",S.appendChild(_);const E=document.createElement("span");E.textContent=this.params.orderNumber,S.appendChild(E),C.appendChild(S);const T=document.createElement("div");T.classList.add("checkout-completed-line");const I=document.createElement("h3");I.textContent="Order Amount",T.appendChild(I);const P=document.createElement("span");P.textContent=""+formatCentToDollarText(this.params.orderTotal),T.appendChild(P),C.appendChild(T);const D=document.createElement("div");D.classList.add("checkout-completed-line");const A=document.createElement("h3");A.textContent="Payment Method",D.appendChild(A);const F=document.createElement("span");F.textContent="** "+this.params.cardLast4,D.appendChild(F),C.appendChild(D),y.appendChild(C);const M=document.createElement("div");M.classList.add("checkout-completed-sub-section");const L=document.createElement("p");L.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<br><br>A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.":"A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.",M.appendChild(L),y.appendChild(M),l.push(y);const R=document.createElement("div");R.classList.add("checkout-completed-section-container");const N=document.createElement("button");N.type="button";const z=document.createElement("span");z.textContent=v,N.setAttribute("tabindex","0"),N.setAttribute("role","button"),N.setAttribute("aria-label",v),N.appendChild(z);const j=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:p.theme.selectedTextColor}));N.appendChild(j),N.addEventListener("click",()=>{window.location.href=g}),N.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),window.location.href=g)}),R.appendChild(N),l.push(R);const B=document.createElement("div");B.classList.add("checkout-completed-section-container");const q=document.createElement("div");q.classList.add("checkout-completed-help-section"),B.appendChild(q);const V=document.createElement("p");V.textContent="Questions about your order? Contact us at ";const G=document.createElement("a");G.href="mailto:"+d.supportEmail,G.textContent=d.supportEmail,V.appendChild(G),q.appendChild(V);const K=document.createElement("p"),Y=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(K.textContent="Order placed on "+Y,q.appendChild(K),l.push(B),f.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(f.layout.legalMessage.text);const o=document.createElement("div");o.classList.add("checkout-separator"),l.push(e),l.push(n),l.push(o)}if(p.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});l.push(e)}return l}}class CheckoutDeliverToComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift"],watchOnlyStorePaths:["checkout.customerForm.isSaving","checkout.giftRecipientForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},birthDate:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.giftData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},message:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.saveButtonText="Save Delivery Information"}onStoreWatch(e){const n=e.find(e=>"checkout.customerForm.isSaving"===e.path),o=e.find(e=>"checkout.giftRecipientForm.isSaving"===e.path);(null==n?void 0:n.value)||(null==o?void 0:o.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const e=this.getStoreValue("checkout.isGift")||![];let n;n=e?!(this.giftData.firstName.isValid&&this.giftData.lastName.isValid&&this.giftData.email.isValid&&this.giftData.phone.isValid&&this.giftData.message.isValid&&this.giftData.addressTwo.isValid):!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid),this.saveButton.disabled=n}template(){const e=this.getConfigs("global"),n=this.getStoreValue("checkout.isGift"),a=this.store.get("checkout.giftRecipientForm.data"),c=this.store.get("checkout.customerForm.data"),l=this.store.get("checkout.shippingAddress"),d=n?a:c,p=this.store.get("checkout.deliveryInstructions");c.firstName&&(this.customerData.firstName={isValid:!![],value:c.firstName}),c.lastName&&(this.customerData.lastName={isValid:!![],value:c.lastName}),c.email&&(this.customerData.email={isValid:!![],value:c.email}),c.phone&&(this.customerData.phone={isValid:!![],value:c.phone}),c.company&&(this.customerData.company={isValid:!![],value:c.company}),c.birthDate&&(this.customerData.birthDate={isValid:!![],value:c.birthDate}),a.firstName&&(this.giftData.firstName={isValid:!![],value:a.firstName}),a.lastName&&(this.giftData.lastName={isValid:!![],value:a.lastName}),a.email&&(this.giftData.email={isValid:!![],value:a.email}),a.phone&&(this.giftData.phone={isValid:!![],value:a.phone}),a.message&&(this.giftData.message={isValid:!![],value:a.message}),l.address.two&&(this.customerData.addressTwo={isValid:!![],value:l.address.two},this.giftData.addressTwo={isValid:!![],value:l.address.two}),p&&(this.customerData.deliveryInstructions={isValid:!![],value:p},this.giftData.deliveryInstructions={isValid:!![],value:p});const f=this.store.get("checkout.fulfillments")||{},g=Object.values(f).some(e=>e.type===s.ON_DEMAND),v=[],y=document.createElement("div");y.classList.add("delivery-header-container");const b=document.createElement("div");b.classList.add("delivery-header-content");const k=document.createElement("div");k.classList.add("delivery-title-container");const x=document.createElement("h3");x.textContent="Deliver to",x.classList.add("delivery-title");const w=document.createElement("p");w.textContent="Package recipient must be 21+",w.classList.add("delivery-subtitle"),k.appendChild(x),k.appendChild(w),y.appendChild(k),v.push(y);const C=document.createElement("div");C.classList.add("section-form-container");const S=document.createElement("div");S.classList.add("checkout-two-col-container");const _=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:n?gt.firstName:ft.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:d.firstName,onChange:e=>{n?(this.giftData.firstName.value=e,this.pubSub.publishForm(o.GIFT,{fieldName:gt.firstName})):(this.customerData.firstName.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.firstName}))},onValidation:e=>{n?this.giftData.firstName.isValid=e:this.customerData.firstName.isValid=e,this.updateSaveButtonState()}});_.setAttribute("aria-label","First Name Input"),S.appendChild(_);const E=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:n?gt.lastName:ft.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:d.lastName,onChange:e=>{n?(this.giftData.lastName.value=e,this.pubSub.publishForm(o.GIFT,{fieldName:gt.lastName})):(this.customerData.lastName.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.lastName}))},onValidation:e=>{n?this.giftData.lastName.isValid=e:this.customerData.lastName.isValid=e,this.updateSaveButtonState()}});if(E.setAttribute("aria-label","Last Name Input"),S.appendChild(E),C.appendChild(S),!n){const e=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:ft.company,label:"Company (optional)",autocomplete:!![],value:d.company,onChange:async e=>{this.customerData.company.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.company})},onValidation:e=>{this.customerData.company.isValid=e,this.updateSaveButtonState()}});e.setAttribute("aria-label","Company Input"),C.appendChild(e)}const T=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:n?gt.email:ft.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:d.email,onChange:e=>{n?(this.giftData.email.value=e,this.pubSub.publishForm(o.GIFT,{fieldName:gt.email})):(this.customerData.email.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.email}))},onValidation:e=>{n?this.giftData.email.isValid=e:this.customerData.email.isValid=e,this.updateSaveButtonState()}});T.setAttribute("aria-label","Email Input"),C.appendChild(T);const I=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:n?gt.phone:ft.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:d.phone,onChange:e=>{n?(this.giftData.phone.value=e,this.pubSub.publishForm(o.GIFT,{fieldName:gt.phone})):(this.customerData.phone.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.phone}))},onValidation:e=>{n?this.giftData.phone.isValid=e:this.customerData.phone.isValid=e,this.updateSaveButtonState()}});if(I.setAttribute("aria-label","Phone Input"),C.appendChild(I),!n){const e=ComponentFactoryService.createElement({type:r.INPUT,inputType:"birthdate",name:ft.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:d.birthDate,onChange:async e=>{this.customerData.birthDate.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.birthDate})},onValidation:e=>{this.customerData.birthDate.isValid=e,this.updateSaveButtonState()}});e.setAttribute("aria-label","Birthdate Input"),C.appendChild(e)}const P=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:l.formattedAddress,disabled:!![],className:"disabled-input"});P.setAttribute("aria-label","Delivery Address Input"),C.appendChild(P);const D=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:n?gt.addressTwo:ft.addressTwo,label:"Apt, suite, etc. (optional)",value:l.address.two,onChange:e=>{n?(this.giftData.addressTwo.value=e,this.pubSub.publishForm(o.GIFT,{fieldName:gt.addressTwo})):(this.customerData.addressTwo.value=e,this.pubSub.publishForm(o.CUSTOMER,{fieldName:ft.addressTwo}))},onValidation:e=>{n?this.giftData.addressTwo.isValid=e:this.customerData.addressTwo.isValid=e,this.updateSaveButtonState()}});if(D.setAttribute("aria-label","Address Line 2 Input"),C.appendChild(D),n){const n=document.createElement("div");n.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const r=document.createElement("label");r.textContent="Gift Message*",r.setAttribute("for",gt.message);const s=document.createElement("textarea");s.name=gt.message,s.id=gt.message,s.rows=4,s.value=a.message||"",s.setAttribute("aria-label","Gift Message Textarea"),s.addEventListener("input",async e=>{const n=e.target.value;this.giftData.message.value=n,this.giftData.message.isValid=n.length>0,this.pubSub.publishForm(o.GIFT,{fieldName:gt.message}),this.updateSaveButtonState()});const c=document.createElement("p");c.textContent="Your gift message will be emailed to the recipient along with delivery details.",c.classList.add("textarea-message-disclaimer"),n.appendChild(r),n.appendChild(s),n.appendChild(c),C.appendChild(n)}if(g){const o=document.createElement("div");o.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const r=document.createElement("label");r.textContent="Delivery Instructions",r.setAttribute("for","delivery_instructions");const s=document.createElement("textarea");s.id="delivery_instructions",s.name="delivery_instructions",s.rows=4,s.setAttribute("aria-label","Delivery Instructions Textarea"),s.value=p,s.addEventListener("input",async e=>{const o=e.target.value;n?(this.giftData.deliveryInstructions.value=o,this.giftData.deliveryInstructions.isValid=o.length>0):(this.customerData.deliveryInstructions.value=o,this.customerData.deliveryInstructions.isValid=o.length>0)});const a=document.createElement("p");a.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",a.classList.add("textarea-message-disclaimer"),o.appendChild(r),o.appendChild(s),o.appendChild(a),C.appendChild(o)}v.push(C),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const t=async()=>{n?await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}):await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:this.customerData.deliveryInstructions.value})};return this.saveButton.addEventListener("click",t),this.saveButton.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await t())}),v.push(this.saveButton),this.updateSaveButtonState(),v}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const e=[],n=this.getStoreValue("checkout.isGift"),o=this.getStoreValue("checkout.customerForm.data"),r=this.getStoreValue("checkout.giftRecipientForm.data"),s=this.getStoreValue("checkout.shippingAddress"),a=this.getStoreValue("checkout.deliveryInstructions"),c=document.createElement("div");c.classList.add("checkout-summary-form-header");const l=document.createElement("h2");l.textContent=n?"Delivering to "+r.firstName+" "+r.lastName:"Delivering to "+o.firstName+" "+o.lastName,c.appendChild(l);const d=document.createElement("span");d.textContent="Edit",d.setAttribute("aria-label","Edit Delivery Information"),d.setAttribute("role","button"),d.setAttribute("tabindex","0");const O=async()=>{n?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(d.addEventListener("click",O),d.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await O())}),c.appendChild(d),e.push(c),!n&&o.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=o.company,e.push(n)}const p=document.createElement("p");p.classList.add("checkout-summary-form-line"),p.textContent=s.formattedAddress,e.push(p);const f=document.createElement("p");f.classList.add("checkout-summary-form-line"),f.textContent=n?r.email:o.email,e.push(f);const g=document.createElement("p");if(g.classList.add("checkout-summary-form-line"),g.textContent=n?r.phone:o.phone,e.push(g),!n&&o.birthDate){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=formatISODateToMMDDYYYY(o.birthDate),e.push(n)}if(n){const n=document.createElement("div");n.classList.add("checkout-summary-form-line-container");const o=document.createElement("span");o.classList.add("checkout-summary-form-line-container-label"),o.textContent="Gift Message:",n.appendChild(o);const s=document.createElement("span");s.classList.add("checkout-summary-form-line"),s.textContent=r.message||"No message provided.",n.appendChild(s),e.push(n)}if(a){const n=document.createElement("div");n.classList.add("checkout-summary-form-line-container");const o=document.createElement("span");o.classList.add("checkout-summary-form-line-container-label"),o.textContent="Delivery Instructions:",n.appendChild(o);const r=document.createElement("span");r.classList.add("checkout-summary-form-line"),r.textContent=a||"No instructions provided.",n.appendChild(r),e.push(n)}return e}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(e){var n;const o=e.find(e=>"checkout.giftCards"===e.path),r=e.find(e=>"checkout.loading"===e.path);o&&o.value.length>((null===(n=o.oldValue)||void 0===n?void 0:n.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),r&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const e=this.giftCardInput.getValue().trim(),n=e.length>=3&&e.length<=255,o=this.getStoreValue("checkout.loading"),r=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!n||o||Boolean(r)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:e=>{const n=e.toUpperCase(),o=this.giftCardInput;o.setValue(n),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const U=async()=>{const e=this.giftCardInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(e)}catch(n){this.logger.error("Checkout gift card application failed",{giftCardCode:e,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",U),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),U())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const e=[];return e.push(this.createGiftCardInput()),e.push(this.createApplyButton()),e}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){var e,n;const o=this.store.get("checkout.presale"),s=this.getConfigs("checkout"),a=null!==(n=null===(e=this.params)||void 0===e?void 0:e.isHostedCheckout)&&void 0!==n?n:![];let c=null;if(!o){c=document.createElement("button"),c.type="button",c.classList.add("checkout-header-button"),c.setAttribute("aria-label",a?"Back":"Back to Cart"),c.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back Button Is Disabled In Builder Mode"),void 0;if(a){const e=null==s?void 0:s.layout.continueShoppingUrl;e&&(window.location.href=e)}else this.commands.ui.openDrawer(r.CART)});const e=document.createElement("span");e.innerHTML=ChevronLeftIcon({}),c.appendChild(e)}const l=document.createElement("h1");if(l.textContent=(null==s?void 0:s.layout.drawerHeaderText)||"Checkout",l.classList.add("checkout-header-title"),l.setAttribute("aria-label","Checkout Page"),a){const e=document.createElement("div");return e.classList.add("checkout-header-spacer"),c?[c,l,e]:[l,e]}const d=document.createElement("button");return d.innerHTML=CloseIcon({width:16,height:16}),d.classList.add("checkout-header-button-close"),d.setAttribute("aria-label","Close Checkout"),d.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),c?[c,l,d]:[l,d]}}class CheckoutInformationComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift","checkout.customerForm.isEditing","checkout.giftRecipientForm.isEditing","checkout.paymentForm.isEditing"]})}onStoreWatch(){const e=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm.isEditing"),o=this.getStoreValue("checkout.giftRecipientForm.isEditing"),r=this.getStoreValue("checkout.paymentForm.isEditing");e?(this.buyerForm.style.display=n?"block":"none",this.buyerSummary.style.display=n?"none":"block",this.deliveryToForm.style.display=o?"block":"none",this.deliverToSummary.style.display=o?"none":"block"):(this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=r?"block":"none",this.paymentSummary.style.display=r?"none":"block"}template(){const e=[],n=this.getStoreValue("checkout.isGift"),o=this.getStoreValue("checkout.customerForm"),s=this.getStoreValue("checkout.giftRecipientForm"),a=this.getStoreValue("checkout.paymentForm"),c=ComponentFactoryService.createElement({type:r.CHECKOUT_SEND_AS_GIFT});return e.push(c),this.deliveryToForm=ComponentFactoryService.createElement({type:r.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=n?s.isEditing?"block":"none":o.isEditing?"block":"none",e.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:r.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=n?s.isEditing?"none":"block":o.isEditing?"none":"block",e.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:r.CHECKOUT_BUYER}),this.buyerForm.style.display=n&&o.isEditing?"block":"none",e.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:r.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=n&&!o.isEditing?"block":"none",e.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:r.CHECKOUT_PAYMENT}),this.paymentForm.style.display=a.isEditing?"block":"none",e.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:r.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=a.isEditing?"none":"block",e.push(this.paymentSummary),e}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(e){var n,o,r,s;const a=e.find(e=>"checkout.items"===e.path);a&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const c=e.find(e=>e.path==="checkout.items."+this.params.itemId);if(c){const e=c.oldValue,a=c.value;if(a.updating)return![];const l=(null==e?void 0:e.quantity)!==(null==a?void 0:a.quantity),d=(null===(o=null===(n=null==e?void 0:e.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.lines)||[],p=(null===(s=null===(r=null==a?void 0:a.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[],f=JSON.stringify(d)!==JSON.stringify(p);(l||f)&&this.updateEngravingElement(a)}return![]}updateEngravingElement(e){var n,o;const s=this.getConfigs("global"),a=this.container.querySelector(".engraving-view-container");if(a&&a.remove(),(null===(o=null===(n=null==e?void 0:e.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.hasEngraving)===!![]&&s.layout.enablePersonalization){const n=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:e.cartItemId,context:"checkout"}),o=this.container.querySelector(".checkout-item-card-footer");o&&o.before(n)}}setupMinimumPurchaseAlert(){const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return;const n=e.fulfillmentId;if(!n)return;if(!this.container)return;const o=this.container.querySelector(".checkout-item-card-header");if(o){const e=this.getStoreValue("cart.fulfillments."+n),s=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(s&&s.remove(),e.hasUnmetMinimumPurchaseAmount){const n=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(e.minimumPurchaseAmount-e.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:e.subtotal,config:{showIcon:!![],alertType:"minimal"}});n.setAttribute("data-component-type","checkout-retailer-alert"),o.before(n)}}}updateTrashButtonState(){if(!this.trashButton)return;const e=this.getStoreValue("checkout"),n=Object.keys(e.items).length,o=1===n;this.trashButton.disabled=o,o?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const e=document.createElement("div");e.className="cart-loading-backdrop",e.setAttribute("data-loading-id","item-loading-overlay");const n=document.createElement("div");n.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(o),e.appendChild(n),e}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const e=this.createLoadingOverlay();this.container.appendChild(e),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const e=this.container.querySelector('[data-loading-id="item-loading-overlay"]');e&&(e.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const e=this.getStoreValue("checkout.items."+this.params.itemId);return e?e.updating===!![]:![]}checkAndUpdateLoadingState(){const e=this.isItemUpdating(),n=this.hasLoadingOverlay();e&&!n?this.showLoadingOverlay():!e&&n&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var e,n,o;const s=this.getConfigs("global"),a=this.getStoreValue("checkout.items."+this.params.itemId),c=null===(e=null==a?void 0:a.attributes)||void 0===e?void 0:e.presale,l=(null==c?void 0:c.isActive)&&(null==c?void 0:c.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(c.estimatedShipBy):"";if(!a)return[];const d=this.getStoreValue("checkout.fulfillments."+a.fulfillmentId),p=this.getStoreValue("checkout.retailers."+a.retailerId),f=document.createElement("div");f.classList.add("checkout-item-card-header");const g=document.createElement("div");g.classList.add("checkout-item-image");const v=document.createElement("img");v.src=a.mainImage,v.alt=a.name,v.loading="lazy",g.appendChild(v),f.appendChild(g);const y=document.createElement("div");y.classList.add("checkout-item-details-container");const b=document.createElement("h4");b.classList.add("checkout-item-title"),b.textContent=a.name,y.appendChild(b);const k=document.createElement("div");k.classList.add("checkout-item-subtitle");const x=document.createElement("span");x.textContent=c.isActive?l+",":(a.attributes.engraving.hasEngraving?null==d?void 0:d.engravingExpectation:null==d?void 0:d.expectation)+",",k.appendChild(x);const w=document.createElement("span");w.textContent="From "+((null==p?void 0:p.name)||"Retailer"),k.appendChild(w),y.appendChild(k),f.appendChild(y),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async e=>{var n;if(e.preventDefault(),e.stopPropagation(),!(null===(n=this.trashButton)||void 0===n?void 0:n.disabled))try{await this.commands.checkout.removeItem(a.cartItemId)}catch(o){this.logger.error("Checkout item removal failed",o)}}),f.appendChild(this.trashButton);const C=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM_QUANTITY,itemId:a.cartItemId}),S=[];if(S.push(f),s.layout.enablePersonalization&&(null===(o=null===(n=null==a?void 0:a.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.hasEngraving)===!![]){const e=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:a.cartItemId,context:"checkout"});S.push(e)}return S.push(C),S}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(e){const n=e.find(e=>"checkout.items"===e.path);if(n){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getAvailableQuantity(){var e,n,o;const r=this.getStoreValue("checkout.items."+this.params.itemId);if(!r)return 0;const s=this.getStoreValue("products");if(!s)return 0;const a=r.partNumber,c=r.fulfillmentId,l=null===(o=null===(n=null===(e=Object.values(s).find(e=>e.sizes[r.liquidId]))||void 0===e?void 0:e.sizes)||void 0===n?void 0:n[r.liquidId])||void 0===o?void 0:o.maxQuantityPerOrder;if(!l)return 0;const d=this.getStoreValue("checkout.items")||{},p=Object.values(d).filter(e=>e.partNumber===a&&e.fulfillmentId===c),f=p.reduce((e,n)=>e+n.quantity,0);return l-f}calculateQuantityLimits(){var e;const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const o=this.getStoreValue("checkout"),r=1===(null===(e=Object.values(o.items))||void 0===e?void 0:e.length),s=n.quantity,a=this.getAvailableQuantity(),c=a>0,l=!(r&&1===s);return{currentQuantity:s,availableQuantity:a,isTheOnlyItem:r,canIncrease:c,canDecrease:l}}updateButtonStates(e){this.decreaseButton&&(this.decreaseButton.disabled=!e.canDecrease,this.decreaseButton.classList.toggle("disabled",!e.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!e.canIncrease,this.increaseButton.classList.toggle("disabled",!e.canIncrease),e.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=e.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+e.currentQuantity))}async handleQuantityChange(e){const n=this.calculateQuantityLimits(),o=this.params.itemId;if((!(e<0)||n.canDecrease)&&(!(e>0)||n.canIncrease)){if(!o)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:e}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(o,e)}catch(r){this.logger.error("Checkout item quantity change operation failed",r)}}}template(){const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const n=this.calculateQuantityLimits(),o=document.createElement("div");o.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(-1)}),o.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),o.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(1)}),o.appendChild(this.increaseButton),this.updateButtonStates(n);const r=document.createElement("span");if(r.classList.add("checkout-item-price-text"),r.textContent=formatCentToDollarText(e.price),e.quantity>1){const n=document.createElement("span");n.classList.add("checkout-item-price-each-text"),n.textContent=" ("+formatCentToDollarText(e.unitPrice)+" ea)",r.appendChild(n)}return[o,r]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]}),this.togglerElement=null,this.togglerButton=null,this.togglerLabel=null,this.itemsList=null}createItemElement(e){return ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM,itemId:e})}getCurrentItemsMap(){const e=this.getStoreValue("checkout.items")||{},n=new Map;for(const o of Object.values(e))o&&o.cartItemId&&n.set(o.cartItemId,o);return n}syncItemsWithStore(){if(!this.itemsList)return;const e=this.getCurrentItemsMap(),n=this.itemsList.querySelectorAll("[data-item-id]"),o=new Set;for(const r of n){const e=r.getAttribute("data-item-id");e&&o.add(e)}for(const r of n){const n=r.getAttribute("data-item-id");n&&!e.has(n)&&r.remove()}for(const[r]of e)if(!o.has(r)){const e=this.createItemElement(r);e.setAttribute("data-item-id",r),this.itemsList.appendChild(e)}if(this.togglerLabel){const e=this.getStoreValue("checkout.itemsQuantity");this.togglerLabel.textContent=e+" item"+(e>1?"s":"")}}onStoreChanged(e){let n=null;for(let o=0;o<e.length;o++){const r=e[o];if("checkout"===r.path||"checkout.items"===r.path||"checkout.items."===r.path.substring(0,15)){n=r;break}}return n?(this.syncItemsWithStore(),![]):![]}handleToggle(){if(!this.togglerButton||!this.itemsList)return;const e=this.itemsList.classList.contains("show");this.itemsList.classList.toggle("show"),this.togglerButton.classList.toggle("expanded"),e?(this.togglerButton.setAttribute("aria-expanded","false"),this.togglerButton.setAttribute("aria-label","Expand checkout items")):(this.togglerButton.setAttribute("aria-expanded","true"),this.togglerButton.setAttribute("aria-label","Collapse checkout items"))}setupToggler(){if(!this.togglerElement||!this.togglerButton||!this.itemsList)return;const e=this.itemsList.classList.contains("show");this.togglerButton.setAttribute("tabindex","0"),this.togglerButton.setAttribute("aria-expanded",e?"true":"false"),this.togglerButton.setAttribute("aria-label",e?"Collapse checkout items":"Expand checkout items"),this.togglerElement.addEventListener("click",()=>this.handleToggle()),this.togglerElement.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleToggle())})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const e=this.getStoreValue("checkout.itemsQuantity"),n=this.getStoreValue("checkout.items");this.togglerElement=document.createElement("div"),this.togglerElement.classList.add("checkout-items-toggler"),this.togglerLabel=document.createElement("span"),this.togglerLabel.classList.add("checkout-items-toggler-label"),this.togglerLabel.textContent=e+" item"+(e>1?"s":""),this.togglerElement.appendChild(this.togglerLabel),this.togglerButton=document.createElement("button"),this.togglerButton.type="button",this.togglerButton.classList.add("checkout-items-toggler-button"),this.togglerButton.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),this.togglerElement.appendChild(this.togglerButton),this.itemsList=document.createElement("div"),this.itemsList.classList.add("checkout-items-list","show");for(const o of Object.values(n)){const e=this.createItemElement(o.cartItemId);e.setAttribute("data-item-id",o.cartItemId),this.itemsList.appendChild(e)}return[this.togglerElement,this.itemsList]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(e){const n=e.find(e=>"checkout.amounts"===e.path);if(n){const e=this.getStoreValue("checkout"),n=Object.values(e.items||{}).length;this.updateZeroAmountElement(0===e.amounts.total&&n>0)}}updateZeroAmountElement(e){const n=this.container.querySelector(".checkout-zero-amount-container");if(e&&!n){const e=document.createElement("div");e.classList.add("checkout-zero-amount-container"),e.textContent="Credit card required to complete order (even when fully covered by gift card)";const n=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");n&&n.after(e)}else!e&&n&&n.remove()}afterRender(){const e=this.getStoreValue("checkout.amounts");e&&this.updateZeroAmountElement(0===e.total)}handleEmailToggle(e){this.commands.checkout.toggleMarketingPreferences("canEmail"),e.classList.toggle("checked");const n=e.classList.contains("checked");e.setAttribute("aria-checked",n?"true":"false")}handleSmsToggle(e){this.commands.checkout.toggleMarketingPreferences("canSms"),e.classList.toggle("checked");const n=e.classList.contains("checked");e.setAttribute("aria-checked",n?"true":"false")}marketingOptInsContainer(){const e=this.config.layout.emailOptIn,n=this.config.layout.smsOptIn;if(!e.show&&!n.show)return null;const o=document.createElement("div");if(o.classList.add("checkout-marketing-opt-ins-container"),e.show){const n=document.createElement("div");let r;n.classList.add("checkout-checkbox-container"),r=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canEmail");const s=document.createElement("span");s.id="emailOptIn",s.classList.add("checkout-checkbox-visual"),r&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),s.setAttribute("role","checkbox"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Email opt-in checkbox"),s.setAttribute("aria-checked",r?"true":"false"),s.addEventListener("click",()=>this.handleEmailToggle(s)),s.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleEmailToggle(s))});const a=document.createElement("label");a.setAttribute("for","emailOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(e.text),a.addEventListener("click",e=>{const n=e.target,o="A"===n.tagName||n.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canEmail"),s.classList.toggle("checked"))}),n.appendChild(s),n.appendChild(a),o.appendChild(n)}if(n.show){const e=document.createElement("div");let r;e.classList.add("checkout-checkbox-container"),r=this.clientConfig.isBuilder()?n.checked:this.store.get("checkout.marketingPreferences.canSms");const s=document.createElement("span");s.classList.add("checkout-checkbox-visual"),s.id="smsOptIn",r&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),s.setAttribute("role","checkbox"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","SMS opt-in checkbox"),s.setAttribute("aria-checked",r?"true":"false"),s.addEventListener("click",()=>this.handleSmsToggle(s)),s.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleSmsToggle(s))});const a=document.createElement("label");a.setAttribute("for","smsOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(n.text),a.addEventListener("click",e=>{const n=e.target,o="A"===n.tagName||n.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canSms"),s.classList.toggle("checked"))}),e.appendChild(s),e.appendChild(a),o.appendChild(e)}return o}hasOnDemandOrder(){const e=this.getStoreValue("checkout.fulfillments")||{};return Object.values(e).some(e=>e.type===s.ON_DEMAND)}template(){var e;const n=[],o=this.getConfigs("global"),s=this.getConfigs("checkout"),a=this.getConfigs("global"),c=s.layout.allowGiftCards,l=null===(e=null==a?void 0:a.layout)||void 0===e?void 0:e.allowPromoCodes,d=document.createElement("div");d.classList.add("section-title-container");const p=document.createElement("h3");p.textContent="Order Summary",p.classList.add("section-title"),d.appendChild(p),n.push(d);const f=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEMS});n.push(f);const g=document.createElement("div");g.classList.add("checkout-separator");const v=document.createElement("div");if(v.classList.add("checkout-separator"),n.push(g),c||l){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_PC_GC});n.push(e)}if(this.hasOnDemandOrder()){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_TIPS});n.push(e),n.push(v)}const y=document.createElement("div");y.classList.add("section-title-container");const b=document.createElement("h3");b.textContent="100% Secure Payments",b.classList.add("disclaimer-header"),y.appendChild(b);const k=document.createElement("p");k.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",k.classList.add("disclaimer-description"),y.appendChild(k),n.push(y);const x=ComponentFactoryService.createElement({type:r.CHECKOUT_AMOUNTS});n.push(x);const w=ComponentFactoryService.createElement({type:r.CHECKOUT_PLACE_ORDER_BUTTON});n.push(w);const C=this.marketingOptInsContainer();if(C&&n.push(C),s.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const o=document.createElement("div");o.classList.add("checkout-legal-message"),o.innerHTML=sanitizeHTML(s.layout.legalMessage.text),n.push(e),n.push(o)}const S=document.createElement("div");if(S.classList.add("checkout-separator"),n.push(S),o.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});n.push(e)}return n}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.hardcodedPaymentElement=null,this.billingFormData=null,this.isValidBillingForm=![],this.isBillingSameAsShipping=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.savedCardInfo=null,this.showingStripeSummary=![],this.isSavingPayment=![]}onStoreWatch(e){for(const n of e)switch(n.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=n.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(n.value)}}handleBillingSameAsShippingChange(e){this.isBillingSameAsShipping=e,e&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var e;this.isBillingSameAsShipping=null!==(e=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==e?e:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let e=!![],n="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)n="Saving...",e=!![];else if(this.stripeFormStatus.hasError)n="Fix Errors and Retry",e=![];else if(this.showingStripeSummary&&this.savedCardInfo){const n=this.isBillingSameAsShipping||this.isValidBillingForm;e=!n}else{const n=this.stripeFormStatus.isFormComplete,o=this.isBillingSameAsShipping||this.isValidBillingForm;e=!(n&&o)}this.saveButton.disabled=e,this.saveButton.textContent=n,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let e="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?e=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(e="Please complete the billing address form"),e?(this.errorMessageElement.textContent=e,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(e){this.errorMessageElement&&(this.errorMessageElement.textContent=e,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===e&&(this.errorMessageElement.style.display="none")},5e3))}template(){const e=[],n=document.createElement("div");n.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Payment",o.classList.add("section-title"),n.appendChild(o);const s=document.createElement("p");if(s.textContent="All transactions are secure and encrypted.",s.classList.add("section-subtitle"),n.appendChild(s),e.push(n),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const n=document.createElement("p");n.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(n),e.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:r.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:e=>{this.stripeFormStatus=e,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:e=>{this.savedCardInfo=e},onEditModeVisibilityChanged:e=>{this.showingStripeSummary=e,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(e,n)=>{const o={paymentSession:{confirmationTokenId:e,setupIntentId:n}};!this.isBillingSameAsShipping&&this.billingFormData&&(o.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(o)}}}),e.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),e.push(this.errorMessageElement);const a=ComponentFactoryService.createElement({type:r.CHECKOUT_BILLING,isFormValid:(e,n)=>{this.billingFormData=n,this.isValidBillingForm=e,this.updateSaveButtonState(),this.updateErrorMessage()}});return e.push(a),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),this.saveButton.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.handleSaveButtonClick())}),e.push(this.saveButton),e}async handleSaveButtonClick(){var e;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const e={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(e.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(e)}catch(n){this.logger.error("Failed to save payment form in edit mode",n),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const e={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(e.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(e)}catch(o){this.logger.error("Failed to save payment form in beta mode",o),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(e=this.stripeHandlerElement)||void 0===e||e.submitStripeForm())}validatePrerequisites(){return this.isBillingSameAsShipping||this.isValidBillingForm?this.stripeFormStatus.isFormComplete?!![]:(this.showError("Please complete all required payment fields."),![]):(this.showError("Please complete the billing address form before saving."),![])}disconnected(){var e;this.isSavingPayment=![],null===(e=super.disconnected)||void 0===e||e.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var e,n,o,r,s,a,c,l,d;const p=[],f=this.getStoreValue("checkout.paymentForm"),g=document.createElement("div");g.classList.add("checkout-summary-form-header");const v=document.createElement("h2");v.textContent="Paying with "+(null!==(o=null===(n=null===(e=f.paymentMethod)||void 0===e?void 0:e.card)||void 0===n?void 0:n.brand)&&void 0!==o?o:"")+" "+(null===(s=null===(r=f.paymentMethod)||void 0===r?void 0:r.card)||void 0===s?void 0:s.last4),g.appendChild(v);const y=document.createElement("span");y.textContent="Edit",y.setAttribute("aria-label","Edit Payment Information"),y.setAttribute("role","button"),y.setAttribute("tabindex","0"),y.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),y.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.editPaymentForm())}),g.appendChild(y),p.push(g);const b=document.createElement("p");return b.classList.add("checkout-summary-form-line"),b.textContent="Exp. "+(null===(c=null===(a=f.paymentMethod)||void 0===a?void 0:a.card)||void 0===c?void 0:c.expMonth)+"/"+(null===(d=null===(l=f.paymentMethod)||void 0===l?void 0:l.card)||void 0===d?void 0:d.expYear),p.push(b),p}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.error","checkout.customerForm.isValid","checkout.giftRecipientForm.isValid","checkout.paymentForm.isValid"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreWatch(e){const n=e.some(e=>"checkout.loading"===e.path||"checkout.error"===e.path||"checkout.customerForm.isValid"===e.path||"checkout.giftRecipientForm.isValid"===e.path||"checkout.paymentForm.isValid"===e.path);n&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const e=this.store.get("checkout.loading")||![],n=this.store.get("checkout.error")||null;this.updateErrorDisplay(n);const o=this.determineButtonState({isCheckoutLoading:e,hasCheckoutError:!!n});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(o.state),this.placeOrderButton.disabled=o.disabled,this.placeOrderButton.textContent=o.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(e){if(!this.errorContainer)return;const n=this.errorContainer.querySelector(".error-text");n&&(this.clearErrorTimeout(),e?(n.textContent=e,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(n.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:e,hasCheckoutError:n}){const o=this.config.layout.placeOrderButtonText,r=this.store.get("checkout.presale");let s=![];if(!r){const e=this.getStoreValue("cart.fulfillments")||{};s=Object.values(e).some(e=>e.hasUnmetMinimumPurchaseAmount)}const a=this.store.get("checkout.isGift"),c=this.store.get("checkout.customerForm.isValid"),l=this.store.get("checkout.giftRecipientForm.isValid"),d=this.store.get("checkout.paymentForm.isValid");return s||a&&!l||!c||!d?{state:"disabled",text:o,disabled:!![]}:e?{state:"processing",text:"Placing Order...",disabled:!![]}:n?{state:"disabled",text:o,disabled:!![]}:{state:"ready",text:o,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const e=this.store.get("checkout.loading");if(e)return;await this.commands.checkout.checkoutComplete()}catch(e){this.logger.error("Error handling place order click",e)}}template(){const e=document.createElement("button");e.type="button",e.textContent=this.config.layout.placeOrderButtonText,e.classList.add("checkout-place-order-button"),e.disabled=!![],e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label","Place Order"),e.addEventListener("click",this.handlePlaceOrderClick.bind(this)),e.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.handlePlaceOrderClick())});const n=document.createElement("div");n.classList.add("checkout-error-wrapper"),n.setAttribute("role","alert"),n.style.display="none";const o=document.createElement("div");o.classList.add("checkout-error");const s=document.createElement("span");s.classList.add("icon-error"),s.innerHTML=ErrorInfoIcon({});const a=document.createElement("span");a.classList.add("error-text"),o.appendChild(s),o.appendChild(a),n.appendChild(o);const c=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[n,c,e]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.initialDurationSeconds=null,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(e){var n;const o=e.find(e=>"checkout.presale"===e.path);if(null==o?void 0:o.value)return this.updateExpiresAt(o.value.expiresAt),!![];const r=e.find(e=>"ui.drawer"===e.path);return(null===(n=null==r?void 0:r.value)||void 0===n?void 0:n.isOpen)===![]&&this.resetCountdownState(),![]}resetCountdownState(){this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}afterRender(){const e=this.store.get("checkout.presale");(null==e?void 0:e.expiresAt)&&this.updateExpiresAt(e.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){if(this.scrollContainer=this.findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;const e=70,n=10;this.scrollHandler=()=>{if(!this.scrollContainer)return;const o=this.scrollContainer.scrollTop;!this.isCurrentlyScrolled&&o>e?this.setScrolledState(!![]):this.isCurrentlyScrolled&&o<n&&this.setScrolledState(![])},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}findScrollContainer(){var e,n;const o=[".drawer-content"];for(const s of o){const n=null===(e=this.rootElement)||void 0===e?void 0:e.closest(s);if(n&&this.isScrollable(n))return n}let r=null===(n=this.rootElement)||void 0===n?void 0:n.parentElement;for(;r&&r!==document.body;){if(this.isScrollable(r))return r;r=r.parentElement}return null}setScrolledState(e){var n,o;this.isCurrentlyScrolled=e,e?(null===(n=this.rootElement)||void 0===n?void 0:n.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):(null===(o=this.rootElement)||void 0===o?void 0:o.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))}isScrollable(e){const n=window.getComputedStyle(e),o=n.overflowY;return e.scrollHeight>=e.clientHeight&&("auto"===o||"scroll"===o||"overlay"===o)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(e){this.stopCountdown();try{if(this.expiresAt=new Date(e),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:e}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const n=new Date,o=Math.floor((this.expiresAt.getTime()-n.getTime())/1e3);this.initialDurationSeconds=Math.min(o,CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS),this.startCountdown()}catch(n){this.logger.error("Failed to parse presale expiration date",n),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement||!this.initialDurationSeconds)return;const e=new Date,n=Math.max(0,this.expiresAt.getTime()-e.getTime()),o=n/1e3,r=this.initialDurationSeconds-o,s=Math.max(0,Math.min(100,r/this.initialDurationSeconds*100)),a=o<CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS;a!==this.isUnderOneMinute&&(this.isUnderOneMinute=a,this.updateWarningState()),this.updateTimerDisplay(n),this.updateProgressBar(s),0===n&&this.handleExpire()}updateWarningState(){if(!this.rootElement)return;const e=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==e||e.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==e||e.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}updateTimerDisplay(e){if(!this.rootElement)return;const n=this.rootElement.querySelector("[data-timer]");n&&(n.textContent=this.formatTime(e))}updateProgressBar(e){if(!this.rootElement)return;const n=this.rootElement.querySelector("[data-progress-fill]");n&&(n.style.width=e+"%")}formatTime(e){const n=Math.floor(e/1e3),o=Math.floor(n/60),r=n%60,s=Math.floor(e%1e3/10);return o.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")}handleExpire(){this.clientConfig.isBuilder()||(this.stopCountdown(),this.commands.checkout.showPresaleExpired())}template(){const e=document.createElement("div");e.classList.add("checkout-presale-countdown"),this.rootElement=e;const n=this.createTextContainer(),o=this.createProgressBar();return e.appendChild(n),e.appendChild(o),e}createTextContainer(){const e=document.createElement("div");e.classList.add("checkout-presale-text-container");const n=this.createHeader(),o=this.createSubtitle();return e.appendChild(n),e.appendChild(o),e}createHeader(){const e=document.createElement("div");e.classList.add("checkout-presale-heading");const n=document.createElement("h2");n.textContent="LIMITED PRE-ORDER:";const o=document.createElement("div");return o.classList.add("checkout-presale-timer"),o.setAttribute("data-timer",""),o.textContent="00:00:00",e.appendChild(n),e.appendChild(o),e}createSubtitle(){const e=document.createElement("p");return e.classList.add("checkout-presale-subtitle"),e.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",e}createProgressBar(){const e=document.createElement("div");e.className="checkout-presale-progress-bar",e.setAttribute("data-progress","");const n=document.createElement("div");return n.className="checkout-presale-progress-fill",n.setAttribute("data-progress-fill",""),n.style.width="0%",e.appendChild(n),e}}CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS=300,CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS=60,CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS=10;class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}isItemsUnavailable(){var e;return"items_unavailable"===(null===(e=this.params)||void 0===e?void 0:e.reason)}isTimeExpired(){var e,n;return"time_expired"===(null===(e=this.params)||void 0===e?void 0:e.reason)||!(null===(n=this.params)||void 0===n?void 0:n.reason)}afterRender(){this.isTimeExpired()&&this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown();const e=this.commands.checkout.getReturnUrl();if(e)return window.location.assign(e),void 0;this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const e=[],n=this.getConfigs("global"),o=document.createElement("div");o.classList.add("checkout-completed-section-container");const s=document.createElement("div");s.classList.add("checkout-completed-title-section");const a=document.createElement("div");a.classList.add("checkout-completed-title-section");const c=document.createElement("p");c.classList.add("presale-expired-title");const l=document.createElement("p"),d=document.createElement("div");d.classList.add("checkout-completed-help-section"),this.isItemsUnavailable()&&(c.textContent="Items No Longer Available",l.textContent="The presale items you were trying to purchase are no longer available.",d.textContent="These items may have sold out or are no longer part of the presale. Please check our catalog for other available products."),this.isTimeExpired()&&(c.textContent="Session Expired",l.textContent="Your reservation time has ended. The item has been released for other customers.",d.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available."),a.appendChild(c),a.appendChild(l),s.appendChild(a),o.appendChild(s),o.appendChild(d),e.push(o);const p=document.createElement("div");p.classList.add("checkout-completed-section-container");const f=document.createElement("button");f.setAttribute("aria-label","Continue shopping"),f.type="button";const g=document.createElement("span");g.textContent="Continue Shopping",f.setAttribute("tabindex","0"),f.setAttribute("role","button"),f.setAttribute("aria-label","Continue Shopping"),f.appendChild(g);const v=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:n.theme.selectedTextColor}));if(f.appendChild(v),f.addEventListener("click",()=>this.handleExit()),f.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleExit())}),p.appendChild(f),e.push(p),this.isTimeExpired()){const n=document.createElement("div");n.classList.add("checkout-completed-section-container");const o=document.createElement("p");o.classList.add("checkout-completed-auto-close-text"),o.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const r=document.createElement("span");r.classList.add("checkout-completed-auto-close-text"),r.textContent="seconds",n.appendChild(o),n.appendChild(this.autoCloseElement),n.appendChild(r),e.push(n)}if(n.layout.showPoweredBy){const n=document.createElement("div");n.classList.add("checkout-completed-powered-by-container");const o=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});n.appendChild(o),e.push(n)}return e}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(e){const n=e.find(e=>"checkout.promoCode"===e.path),o=e.find(e=>"checkout.loading"===e.path);if(n){const{value:e,oldValue:o}=n,r=Boolean(o),s=Boolean(e);if(!r&&s)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(r&&!s)return this.container.innerHTML="",this.createInputContainer(),void 0;s&&this.promoCodeText&&e.discount!==(null==o?void 0:o.discount)&&(this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discount)+")")}o&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const e=this.promoInput.getValue().trim(),n=e.length>=3&&e.length<=255,o=this.getStoreValue("checkout.loading"),r=this.getStoreValue("checkout.promoCode"),s=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!n||o||Boolean(r)||Boolean(s)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:e=>{const n=e.toUpperCase(),o=this.promoInput;o.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const U=async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(e)}catch(n){this.logger.error("Checkout promo code application failed",{promoCode:e,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",U),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),U())}),this.applyButton}createAppliedContainer(e){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==e?void 0:e.code)+" (- "+formatCentToDollarText((null==e?void 0:e.discount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(o),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const e=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,e){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(o),n}const n=[];return n.push(this.createPromoInput()),n.push(this.createApplyButton()),n}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const e=this.getStoreValue("checkout.isGift"),n=document.createElement("div");n.classList.add("gift-label-wrapper");const o=document.createElement("span");o.textContent="Send as Gift? (Free)",o.classList.add("gift-toggle-label"),n.appendChild(o);const r=document.createElement("span");r.textContent="With personalized note & gift receipt.",r.classList.add("gift-toggle-description"),n.appendChild(r);const s=document.createElement("div");s.classList.add("toggle-switch"),s.classList.toggle("active",e);const a=document.createElement("div");return a.classList.add("toggle-slider"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Toggle Gift Option"),s.setAttribute("role","switch"),s.setAttribute("aria-checked",e?"true":"false"),s.appendChild(a),s.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),s.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.toggleIsGift())}),[n,s]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.F=![],this.O=null,this.M=null,this.L=null,this.R=![],this.N=![],this.j=![],this.B=null}async initialize({data:e}){if(this.F)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=e.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.F=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const e=this.q;this.O=window.Stripe(e.publishableKey),this.M=this.O.elements({clientSecret:e.clientSecret,appearance:e.appearance}),this.L=this.M.create("payment",e.elementOptions),this.L.mount(this),this.L.on("change",async e=>{const n=!!e.error,o=e.complete,r=n?e.error.message:null;this.N=o,this.R||await this.updateStripeFormStatus({isFormComplete:o,isProcessing:![],hasCompletedPayment:![],errorMessage:r,hasError:n})}),this.L.on("focus",async()=>{this.R||await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.j=![]}catch(e){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),e}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(e){const{stripeConfig:n}=e.detail;n&&(this.q=n,await this.refreshPaymentSession())}async handleSubmit(){var e,n;if(this.R)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.N)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.R=!![],await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.j&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const e=await this.createConfirmationTokenId(),n=this.q.clientSecret,o=n.split("_secret_")[0];this.j=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:e,setupIntentId:o},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(o){console.error("Payment submission error:",o),this.j=!![],await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==o?void 0:o.message)||"Payment processing failed. Please try again."}),((null===(e=null==o?void 0:o.message)||void 0===e?void 0:e.includes("expired"))||(null===(n=null==o?void 0:o.message)||void 0===n?void 0:n.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.R=![]}}async requestSessionRefresh(){return this.B||(this.B=new Promise((e,n)=>{const o=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",H),this.B=null,n(new Error("Session refresh timeout"))},1e4),H=()=>{clearTimeout(o),this.removeEventListener("lce:s:refreshSession",H),this.B=null,e()};this.addEventListener("lce:s:refreshSession",H,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.B}async refreshPaymentSession(){try{this.M&&this.M.update({clientSecret:this.q.clientSecret}),this.j=![],await this.updateStripeFormStatus({isFormComplete:this.N,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(Z){console.error("Failed to refresh payment session:",Z),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.L&&this.L.clear(),this.N=![],this.j=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(Z){console.error("Failed to reset form:",Z)}}async updateStripeFormStatus(e){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:e},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.M)throw new SDKError("Payment elements not initialized");try{const{error:e}=await this.M.submit();if(e)throw new SDKError(e.message||"Failed to submit payment information");const n={elements:this.M,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:o,confirmationToken:r}=await this.O.createConfirmationToken(n);if(o)throw new SDKError(o.message||"Failed to create confirmation token");if(!r||!r.id)throw new SDKError("Invalid confirmation token received");return r.id}catch(e){if(e instanceof SDKError)throw e;throw new SDKError("Payment processing error: "+(e.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(e=>{console.error("Error during Stripe form disconnection cleanup:",e)})}async cleanupForm(){var e,n;try{this.B=null,this.L&&(this.L.unmount(),this.L=null),this.M&&(null===(n=(e=this.M).destroy)||void 0===n?void 0:n.call(e),this.M=null),this.O=null,this.R=![],this.N=![],this.j=![],this.F=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(o){console.warn("Error during Stripe form cleanup:",o)}}loadStripeJS(){return new Promise((e,n)=>{const o=document.querySelector('script[src*="stripe.com"]');if(o)return o.addEventListener("load",()=>e()),o.addEventListener("error",()=>n(new Error("Failed to load Stripe.js"))),void 0;const r=document.createElement("script");r.src="https://js.stripe.com/basil/stripe.js",r.async=!![],r.onload=()=>e(),r.onerror=()=>n(new Error("Failed to load Stripe.js")),document.head.appendChild(r)})}}class CheckoutStripeHandlerComponent extends BaseComponent{get hostClasses(){return["checkout-stripe-handler"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.paymentMethod","checkout.paymentForm.isEditing"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.isInEditMode=![],this.savedCardInfo=null,this.isChangingPayment=![],this.callbacks={}}beforeConnected(){this.callbacks=this.params.callbacks||{}}onStoreWatch(e){for(const n of e)switch(n.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(n.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(n.value)}}handleSavedCardChange(e){var n,o,r,s;(null===(n=null==e?void 0:e.card)||void 0===n?void 0:n.brand)&&(null===(o=null==e?void 0:e.card)||void 0===o?void 0:o.last4)?this.savedCardInfo={brand:e.card.brand,last4:e.card.last4}:this.savedCardInfo=null,null===(s=(r=this.callbacks).onSavedCardInfoChanged)||void 0===s||s.call(r,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(e){this.isInEditMode=e,this.updateDisplayState()}updateDisplayState(){var e,n,o,r,s,a;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(n=(e=this.callbacks).onEditModeVisibilityChanged)||void 0===n||n.call(e,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(r=(o=this.callbacks).onEditModeVisibilityChanged)||void 0===r||r.call(o,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(e=>{this.logger.error("Failed to create stripe form in updateDisplayState",e)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(a=(s=this.callbacks).onEditModeVisibilityChanged)||void 0===a||a.call(s,![]))}async afterRender(){var e,n,o,r;this.isInEditMode=null!==(e=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==e?e:![];const s=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(n=null==s?void 0:s.card)||void 0===n?void 0:n.brand)&&s.card.last4&&(this.savedCardInfo={brand:s.card.brand,last4:s.card.last4}),null===(r=(o=this.callbacks).onSavedCardInfoChanged)||void 0===r||r.call(o,this.savedCardInfo),this.updateDisplayState(),(this.isInEditMode&&!this.savedCardInfo||this.isChangingPayment)&&await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",e=>{var n,o;this.stripeFormStatus=e.detail.status,null===(o=(n=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(n,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async e=>{var n,o,r,s,a;try{const{confirmationTokenId:r,setupIntentId:s}=e.detail;await(null===(o=(n=this.callbacks).onPaymentSessionConfirmed)||void 0===o?void 0:o.call(n,r,s)),this.isChangingPayment=![]}catch(c){this.logger.error("Failed to save payment form",c),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==c?void 0:c.message)||"Failed to save payment information. Please try again."},null===(s=(r=this.callbacks).onStripeFormStatusChanged)||void 0===s||s.call(r,this.stripeFormStatus),null===(a=this.stripeFormElement)||void 0===a||a.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var e;try{const n=await this.doStripeConfig();null===(e=this.stripeFormElement)||void 0===e?void 0:e.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:n}}))}catch(n){this.logger.error("Failed to refresh payment session",n)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const e=document.createElement("span");e.classList.add("stripe-summary-text"),e.textContent=(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const n=document.createElement("button");n.type="button",n.classList.add("change-payment-link"),n.textContent="Change",n.setAttribute("aria-label","Change Payment Method"),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.addEventListener("click",()=>this.handleChangePayment()),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(e,n),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var e,n;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus),this.updateDisplayState()}template(){const e=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",e.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const n=document.createElement("slot");return n.setAttribute("name",mt),this.stripeFormContainer.appendChild(n),e.push(this.stripeFormContainer),e}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let e=this,n=null;for(;e&&e!==document.body;){const o=e.hasAttribute("checkout"),s=e.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT),a=e.hasAttribute("drawer"),c=(null==n?void 0:n.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(r.DRAWER),l="checkout"===(null==n?void 0:n.getAttribute("data-target"));if(o||s&&a&&c&&l)return this.rootComponent=e,e;n=e,e=e.parentElement||e.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){const e=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==e?void 0:e.key)&&(null==e?void 0:e.secret)||await this.commands.checkout.getPaymentSession();const n=this.store.get("checkout.paymentForm.paymentSession"),o=this.getConfigs("global");return{publishableKey:n.key,clientSecret:n.secret,appearance:{theme:"dark"===o.layout.poweredByMode?"night":"stripe",variables:{fontFamily:o.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:o.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===o.layout.inputFieldStyle?"none":"1px solid "+o.theme.accentColor,backgroundColor:"filled"===o.layout.inputFieldStyle?o.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var e,n,o;if(this.isCreatingStripeForm)return this.logger.info("Stripe form creation already in progress, skipping"),void 0;if(this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment)return this.logger.info("In edit mode with saved card, skipping stripe form creation"),void 0;const s=this.findRootComponent();if(!s)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(e=this.stripeFormElement)||void 0===e?void 0:e.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const a=s.querySelectorAll('[slot="'+mt+'"]');if(a.length>0)for(const r of a)r.remove();this.isCreatingStripeForm=!![];try{const e=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:r.CHECKOUT_STRIPE_FORM,stripeConfig:e}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",mt),s.appendChild(this.stripeFormElement)}catch(c){this.logger.error("Stripe form element creation failed",c),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(o=(n=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(n,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var e;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(e=super.disconnected)||void 0===e||e.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.fulfillments","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const e=this.getStoreValue("checkout.tipSelection");return null!=e?e:10}getOnDemandFulfillments(){const e=this.getStoreValue("checkout.fulfillments")||{};return Object.values(e).filter(e=>e.type===s.ON_DEMAND)}getRetailerNameForFulfillment(e){const n=this.getStoreValue("checkout.items")||{},o=this.getStoreValue("checkout.retailers")||{},r=Object.values(n).find(n=>n.fulfillmentId===e);if(!r)return"Retailer";const s=o[r.retailerId];return(null==s?void 0:s.name)||"Retailer"}async handlePercentageSelect(e){const n=this.getStoreValue("checkout.updating")||![];if(!n)try{await this.commands.checkout.updateTips(e)}catch(o){this.logger.error("Checkout tips update failed",o)}}async handleFulfillmentTipInput(e,n){const o=this.getStoreValue("checkout.updating")||![];if(o)return;const r=this.getOnDemandFulfillments();if(!r.find(n=>n.id===e))return;const s=Math.round(100*n);try{await this.commands.checkout.updateFulfillmentTip(e,s)}catch(a){this.logger.error("Checkout fulfillment tip update failed",a)}}async removeTipFromFulfillment(e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const o=this.getOnDemandFulfillments();if(o.find(n=>n.id===e))try{await this.commands.checkout.removeFulfillmentTip(e)}catch(r){this.logger.error("Checkout fulfillment tip removal failed",r)}}createTipSelectionButtons(){const e=document.createElement("div");e.classList.add("checkout-tip-selection-container");const n=[10,18,20],o=this.getStoreValue("checkout.updating")||![],r=this.getTipSelection();for(const s of n){const n=document.createElement("button");n.type="button",n.textContent=s+"%",n.classList.add("checkout-tip-button"),n.disabled=o,r===s&&n.classList.add("selected"),n.addEventListener("click",()=>this.handlePercentageSelect(s)),e.appendChild(n)}return e}setupToggler(){const e=this.container.querySelector(".checkout-tip-distribution-header"),n=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".retailers-tips-list");e&&n&&o&&e.addEventListener("click",()=>{const e=o.classList.contains("show");o.classList.toggle("show"),e?(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-label","Expand tips section")):(n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse tips section")),n.classList.toggle("expanded")})}createTipDistribution(){const e=document.createElement("section");e.classList.add("checkout-tip-distribution-container");const n=this.getOnDemandFulfillments();if(0===n.length)return e;const o=document.createElement("div");o.classList.add("checkout-tip-distribution-header");const r=document.createElement("h3");r.textContent="View Tip Distribution",r.classList.add("checkout-sub-header"),o.appendChild(r);const s=document.createElement("button");s.type="button",s.classList.add("checkout-items-toggler-button"),s.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),o.appendChild(s),e.appendChild(o);const a=document.createElement("div");a.classList.add("retailers-tips-list","show");for(const c of n){const e=document.createElement("div");e.classList.add("checkout-tip-distribution-item");const n=document.createElement("h4");n.textContent=this.getRetailerNameForFulfillment(c.id),n.classList.add("checkout-sub-header"),e.appendChild(n);const o=document.createElement("div");o.classList.add("checkout-tip-fulfillment-input-wrapper");const r=document.createElement("div");r.classList.add("dollar-input-container");const s=document.createElement("span");s.classList.add("dollar-sign"),s.textContent="$";const l=document.createElement("input");let d;l.type="number",l.id="tip-input-"+c.id,l.name="tip-"+c.id,l.min="0",l.step="0.01",l.placeholder="0.00",l.classList.add("dollar-input"),l.value=c.amounts.tip>0?(c.amounts.tip/100).toFixed(2):"",l.disabled=this.getStoreValue("checkout.updating")||![],l.addEventListener("wheel",e=>{e.preventDefault()}),l.addEventListener("keydown",e=>{"-"!==e.key&&"+"!==e.key||e.preventDefault()}),l.addEventListener("keydown",e=>{"ArrowUp"!==e.key&&"ArrowDown"!==e.key||e.preventDefault()}),l.addEventListener("paste",e=>{e.preventDefault()}),l.addEventListener("contextmenu",e=>{e.preventDefault()}),l.addEventListener("input",e=>{const n=e.target;let o=n.value;if(Number.parseFloat(o)<0&&(n.value=Math.abs(Number.parseFloat(o)).toString(),o=n.value),o.includes(".")){const e=o.split(".");e.length>1&&e[1].length>2&&(n.value=e[0]+"."+e[1].substring(0,2))}}),l.addEventListener("input",e=>{const n=e.target,o=Number.parseFloat(n.value)||0;d&&clearTimeout(d),d=setTimeout(()=>{this.handleFulfillmentTipInput(c.id,o)},500)}),r.appendChild(s),r.appendChild(l),o.appendChild(r);const p=document.createElement("button");p.type="button",p.textContent="Remove",p.classList.add("checkout-tip-remove-button"),p.disabled=this.getStoreValue("checkout.updating")||![],p.addEventListener("click",()=>this.removeTipFromFulfillment(c.id)),o.appendChild(p),e.appendChild(o),a.appendChild(e)}return e.appendChild(a),e}async initializeDefaultTip(){if(this.isInitialized)return;const e=this.getStoreValue("checkout.tipSelection"),n=this.getOnDemandFulfillments();if(e&&n.length>0){const r=n.every(e=>e.amounts.tip>0);if(r)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(e)}catch(o){this.logger.error("Default tip initialization failed",o),this.isInitialized=![]}}if(null==e)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(r){this.logger.error("Default tip initialization failed during fallback",r),this.isInitialized=![]}}template(){const e=[],n=this.getOnDemandFulfillments();if(0===n.length)return e;n.length>0&&this.initializeDefaultTip();const o=document.createElement("section");o.classList.add("checkout-tip-container");const r=document.createElement("h3");r.classList.add("checkout-sub-header"),r.textContent="Add a tip",o.appendChild(r);const s=document.createElement("div");s.classList.add("checkout-tip-config-container");const a=this.createTipSelectionButtons();s.appendChild(a),o.appendChild(s);const c=document.createElement("p");c.classList.add("checkout-tip-disclaimer"),c.textContent="Tips will be split proportionally between retailers.",o.appendChild(c);const l=this.createTipDistribution();return e.push(o,l),e}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(e){var n,o;const r=e.find(e=>"checkout.giftCardError"===e.path),s=e.find(e=>"checkout.promoCodeError"===e.path),a=e.find(e=>"checkout.giftCards"===e.path);if(a&&this.updateAppliedGiftCards(a.value),r){const e=this.container.querySelector(".input-gift-card-container");if(e){const o=e.nextElementSibling;if((null===(n=null==o?void 0:o.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==o?void 0:o.remove()),r.value){const n=this.createErrorElement(r.value);e.after(n)}const s=e.querySelector(".apply-button");s&&(s.disabled=Boolean(r.value))}}if(s){const e=this.container.querySelector(".input-promo-code-container");if(e){const n=e.nextElementSibling;if((null===(o=null==n?void 0:n.classList)||void 0===o?void 0:o.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),s.value){const n=this.createErrorElement(s.value);e.after(n)}const r=e.querySelector(".apply-button");r&&(r.disabled=Boolean(s.value))}}}updateAppliedGiftCards(e){const n=e&&e.length>0;if(!n)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",e.forEach(e=>{const n=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(n)})}createAppliedGiftCardElement(e){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),n.setAttribute("data-gift-card-code",e.code);const o=document.createElement("span");o.textContent=e.code+" (- "+formatCentToDollarText(e.applied)+")",n.appendChild(o);const r=document.createElement("button");return r.type="button",r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(e.code)}),n.appendChild(r),n}inputContainer(){var e;const n=this.getConfigs("checkout"),o=this.getConfigs("global"),s=n.layout.allowGiftCards,a=null===(e=null==o?void 0:o.layout)||void 0===e?void 0:e.allowPromoCodes,c=document.createElement("div");c.classList.add("checkout-pc-gc-sub-container");const l=ComponentFactoryService.createElement({type:r.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]}),d=ComponentFactoryService.createElement({type:r.CHECKOUT_GIFT_CARDS});a&&c.appendChild(l);const p=this.getStoreValue("checkout.promoCodeError");if(p){const e=this.createErrorElement(p);e.classList.add("promo-code-error-wrapper"),c.appendChild(e)}s&&c.appendChild(d);const f=this.getStoreValue("checkout.giftCardError");if(f){const e=this.createErrorElement(f);c.appendChild(e)}return c}createErrorElement(e){const n=document.createElement("div");n.classList.add("error-banner-checkout");const o=document.createElement("div");o.innerHTML=ErrorInfoIcon({});const r=document.createElement("p");return r.textContent=e.toString(),n.appendChild(o),n.appendChild(r),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),n.remove()},3e3),n}template(){const e=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const n=[];return n.push(this.inputContainer()),e&&e.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),e.forEach(e=>{const n=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(n)}),n.push(this.appliedGiftCardsContainer)),n}disconnected(){this.appliedGiftCardsContainer=null}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(e){e.length>0&&this.updateAlert()}getErrorMessages(){var e,n;const o=null!==(e=this.params.fromEvents)&&void 0!==e?e:![],r=null!==(n=this.params.showFirstEvent)&&void 0!==n?n:!![];if(o){const e=this.store.get(this.params.errorStorePath)||[],n=e.filter(e=>null==e?void 0:e.message).map(e=>({message:e.message,level:e.level||"error",type:e.type}));return r?n.slice(0,1):n}const s=this.store.get(this.params.errorStorePath);return s?[{message:s,level:"error"}]:[]}createErrorElement(e){const n=document.createElement("div");n.classList.add("alert-container","alert-"+e.level);const o=document.createElement("span");o.classList.add("alert-icon"),o.innerHTML=ErrorInfoIcon({className:e.level+"-icon"});const r=document.createElement("span");return r.classList.add("alert-text"),r.textContent=e.message,n.appendChild(o),n.appendChild(r),n}scheduleHide(){var e;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const n=null!==(e=this.params.autoHideDelay)&&void 0!==e?e:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},n)}hideAllErrors(){var e;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.elements=[];const n=null!==(e=this.params.fromEvents)&&void 0!==e?e:![];n?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const e=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.elements=[],0===e.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=e.map(e=>this.createErrorElement(e)),this.elements.forEach(e=>{this.container.appendChild(e)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const e=this.getConfigs("global");return["engraving-view-container",e.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const e=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+e),o=(null==n?void 0:n.attributes.engraving.fee)||0,r=(null==n?void 0:n.quantity)||1;return{quantity:r,fee:o,total:o*r}}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+e),o=(null==n?void 0:n.attributes.engraving.fee)||0,r=(null==n?void 0:n.quantity)||1;return{quantity:r,fee:o,total:o*r}}return{quantity:0,fee:0,total:0}}engravingLines(){const e=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+e);return(null==n?void 0:n.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+e);return(null==n?void 0:n.attributes.engraving.lines)||[]}return[]}handleEdit(){var e,n,o,s,a,c,l,d,p,f,g,v,y,b,k,x,w,C,S,_;const E=this.params.identifier,T={identifier:E,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const r=this.getStoreValue("cart.items."+E);T.lines=(null===(n=null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],T.maxLines=(null===(s=null===(o=null==r?void 0:r.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.maxLines)||1,T.maxCharsPerLine=(null===(c=null===(a=null==r?void 0:r.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.maxCharsPerLine)||16,T.fee=(null===(d=null===(l=null==r?void 0:r.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.fee)||0,T.location=(null===(f=null===(p=null==r?void 0:r.attributes)||void 0===p?void 0:p.engraving)||void 0===f?void 0:f.location)||""}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+E);T.lines=(null===(v=null===(g=null==e?void 0:e.attributes)||void 0===g?void 0:g.engraving)||void 0===v?void 0:v.lines)||[],T.maxLines=(null===(b=null===(y=null==e?void 0:e.attributes)||void 0===y?void 0:y.engraving)||void 0===b?void 0:b.maxLines)||1,T.maxCharsPerLine=(null===(x=null===(k=null==e?void 0:e.attributes)||void 0===k?void 0:k.engraving)||void 0===x?void 0:x.maxCharsPerLine)||16,T.fee=(null===(C=null===(w=null==e?void 0:e.attributes)||void 0===w?void 0:w.engraving)||void 0===C?void 0:C.fee)||0,T.location=(null===(_=null===(S=null==e?void 0:e.attributes)||void 0===S?void 0:S.engraving)||void 0===_?void 0:_.location)||""}this.commands.ui.openDrawer(r.ENGRAVING_FORM,T)}async handleRemove(){const e=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(e,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(e)}template(){const e=this.engravingQuantityFee(),n=this.engravingLines();if(0===n.length)return"";const o=document.createElement("div");o.className="engraving-header";const r=document.createElement("h3");r.textContent="Personalization";const s=document.createElement("span");if(s.className="engraving-fee",1===e.quantity&&(s.textContent=formatCentToDollarText(e.total,![])),e.quantity>1){s.textContent=formatCentToDollarText(e.total,![]);const n=document.createElement("span");n.className="engraving-fee-each",n.textContent=" ("+formatCentToDollarText(e.fee,![])+" ea)",s.appendChild(n)}o.appendChild(r),o.appendChild(s);const a=document.createElement("div");a.className="engraving-body";const c=document.createElement("div");c.className="engraving-lines";for(const p of n){const e=document.createElement("span");e.className="engraving-line",e.textContent=p,c.appendChild(e)}const l=document.createElement("div");l.className="engraving-actions";const d=document.createElement("button");d.type="button",d.classList.add("remove-button"),d.textContent="Remove",d.setAttribute("aria-label","Remove engraving");const u=async()=>{await this.handleRemove()};if(d.addEventListener("click",u),d.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await u())}),l.appendChild(d),"checkout"!==this.params.context){const e=document.createElement("button");e.type="button",e.classList.add("edit-button"),e.textContent="Edit",e.setAttribute("aria-label","Edit engraving"),e.addEventListener("click",this.handleEdit.bind(this)),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleEdit())}),l.appendChild(e)}return a.appendChild(c),a.appendChild(l),[o,a]}}class InputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const e=this.getConfigs("global");return["custom-input",e.layout.inputFieldStyle]}handlePhoneKeydown(e){if("Backspace"===e.key){const n=e.target,o=n.selectionStart||0,r=n.value;o>0&&/\D/.test(r[o-1])&&setTimeout(()=>{const e=Math.max(0,o-2);n.setSelectionRange(e,e)},0)}}formatPhoneNumber(e){const n=e.target;let o=n.value.replace(/\D/g,"");o.length>10&&(o=o.substring(0,10)),o.length>=6?o="("+o.substring(0,3)+") "+o.substring(3,6)+"-"+o.substring(6):o.length>=3&&(o="("+o.substring(0,3)+") "+o.substring(3)),n.value=o}formatDate(e){const n=e.target,o=n.value,r=n.selectionStart||0;let s=0,a;if(r>2&&(s=1),r>5&&(s=2),o.includes("/")){const e=o.split("/");let n=(e[0]||"").replace(/\D/g,"").substring(0,2);const r=(e[1]||"").replace(/\D/g,"");let s=r.substring(0,2);const c=r.substring(2);let l=(e[2]||"").replace(/\D/g,"");if(l=(c+l).substring(0,4),""===n&&3===e.length&&(n="01"),2===n.length){let e=Number.parseInt(n,10);e>12&&(e=12),e<1&&(e=1),n=e.toString().padStart(2,"0")}if(""===s&&3===e.length&&(s="01"),2===s.length){let e=Number.parseInt(s,10);e>31&&(e=31),e<1&&(e=1),s=e.toString().padStart(2,"0")}a=n,(e.length>1||s)&&(a+="/"+s),(l||e.length>2)&&(a+="/"+l)}else{let e=o.replace(/\D/g,"");if(e.length>8&&(e=e.substring(0,8)),e.length>=2){let n=Number.parseInt(e.substring(0,2),10);n>12&&(n=12),e=n.toString().padStart(2,"0")+e.substring(2)}if(e.length>=4){let n=Number.parseInt(e.substring(2,4),10);n>31&&(n=31),e=e.substring(0,2)+n.toString().padStart(2,"0")+e.substring(4)}a=e.length>=5?e.substring(0,2)+"/"+e.substring(2,4)+"/"+e.substring(4):e.length>=3?e.substring(0,2)+"/"+e.substring(2):e}if(n.value=a,o.includes("/")){let e;e=0===s?Math.min(r,2):1===s?Math.min(r,5):a.length,n.setSelectionRange(e,e)}}validateEmail(e){const n=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return n.test(e)}validateTel(e){const n=/^\(\d{3}\) \d{3}-\d{4}$/;return n.test(e)}validateDate(e){const n=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!n.test(e))return![];const[o,r,s]=e.split("/").map(Number),a=new Date(s,o-1,r);return a.getFullYear()===s&&a.getMonth()===o-1&&a.getDate()===r}parseDateString(e){if(!this.validateDate(e))return null;const[n,o,r]=e.split("/").map(Number);return new Date(r,n-1,o)}calculateAge(e){const n=new Date;let o=n.getFullYear()-e.getFullYear();const r=n.getMonth()-e.getMonth();return(r<0||0===r&&n.getDate()<e.getDate())&&o--,o}validateDateConstraints(e){const n=[],o=this.params.validation;if(!o)return n;const r=this.parseDateString(e);if(!r)return n;const s=r.getFullYear();void 0!==o.minYear&&s<o.minYear&&n.push("Year must be "+o.minYear+" or later"),void 0!==o.maxYear&&s>o.maxYear&&n.push("Year must be "+o.maxYear+" or earlier");const a=this.calculateAge(r);return void 0!==o.minAge&&a<o.minAge&&n.push("Must be at least "+o.minAge+" years old"),void 0!==o.maxAge&&a>o.maxAge&&n.push("Must be no more than "+o.maxAge+" years old"),n}isFieldComplete(){var e,n,o;const r=this.inputElement.value.trim();if(!r)return![];switch(this.params.inputType){case"tel":return this.validateTel(r);case"date":case"birthdate":return this.validateDate(r);case"email":return r.includes("@")&&(null===(e=r.split("@")[1])||void 0===e?void 0:e.includes("."));case"number":return!Number.isNaN(Number.parseFloat(r));default:return(null===(n=this.params.validation)||void 0===n?void 0:n.max)&&r.length>=this.params.validation.max||(null===(o=this.params.validation)||void 0===o?void 0:o.min)&&r.length>=this.params.validation.min?!![]:r.length>=3}}validateInput(){const e=this.inputElement.value,n=[],o=this.params.validation;if(!o)return this.showErrors([]),!![];if(o.required&&!e.trim()&&n.push("This field is required"),!o.required&&!e.trim())return this.showErrors([]),!![];if(e.trim()){if("email"!==this.params.inputType||this.validateEmail(e)||n.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(e)||n.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"===this.params.inputType||"birthdate"===this.params.inputType)if(this.validateDate(e)){const o=this.validateDateConstraints(e);n.push(...o)}else n.push("Please enter a valid date (MM/DD/YYYY)");if("number"===this.params.inputType){const r=Number.parseFloat(e);Number.isNaN(r)?e.trim()&&n.push("Please enter a valid number"):(void 0!==o.min&&r<o.min&&n.push("Value must be at least "+o.min),void 0!==o.max&&r>o.max&&n.push("Value must be no more than "+o.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==o.min&&e.length<o.min&&n.push("Must be at least "+o.min+" characters"),void 0!==o.max&&e.length>o.max&&n.push("Must be no more than "+o.max+" characters")),o.pattern){const r=new RegExp(o.pattern);r.test(e)||n.push("Invalid format")}if(o.customValidator){const r=o.customValidator(e);r&&n.push(r)}}this.showErrors(n);const r=0===n.length;return this.params.onValidation&&this.params.onValidation(r,n),r}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}showErrors(e){if(this.errorContainer.innerHTML="",e.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const n of e){const e=document.createElement("div");e.className="error-message",e.textContent=n,this.errorContainer.appendChild(e)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(e){this.inputElement.value=e,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var e;const n=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(e=this.params.validation)||void 0===e?void 0:e.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name),n.push(o)}return this.inputElement=document.createElement("input"),this.inputElement.type="birthdate"===this.params.inputType?"text":this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||(this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.params.placeholder||(this.inputElement.placeholder="MM/DD/YYYY")),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",e=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(e.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",n.push(this.inputElement),n.push(this.errorContainer),n}}class LceElementComponent extends HTMLElement{constructor(){super(),this.F=![],this.U=null;const e=ClientConfigService.getInstance();this.V=this.attachShadow({mode:e.get("openShadowDom")?"open":"closed"})}initialize(e,n){if(this.F)return;if(!e||"string"!=typeof e)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(n&&n instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(e.toLowerCase(),""),!this.V)throw new SDKError("LceElementComponent: Shadow DOM container is not available");n&&"function"==typeof n.rerender&&(this.U=e=>{n.rerender(e||"LceElementRerender")}),this.V.appendChild(n),this.applyBasicStyles();const o=ThemeProviderService.getInstance(),r=o.getStylesheet(e);this.applyThemeStyles(r),this.F=!![],this.V=null}rerender(e){this.U&&this.U(e)}applyBasicStyles(){const e="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n width: 100%;\n height: auto;\n }\n\n :host([drawer]),\n :host([modal]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(e),this.V.adoptedStyleSheets=[n,...this.V.adoptedStyleSheets]}else this.createFallbackStylesheet(e)}catch(Z){this.createFallbackStylesheet(e)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const e=new CSSStyleSheet;return e.replaceSync("/* test */"),!![]}catch(e){return![]}}applyThemeStyles(e){e.forEach(e=>{"string"==typeof e?this.createFallbackStylesheet(e):this.V.adoptedStyleSheets=[...this.V.adoptedStyleSheets,e]})}createFallbackStylesheet(e){const n=document.createElement("style");n.textContent=e,this.V&&this.V.appendChild(n)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const e=document.createElement("div");e.className="pb-title-container";const n=document.createElement("span");n.className="pb-text",n.textContent="Powered by",e.appendChild(n);const o=document.createElement("span");o.className="pb-lc",o.textContent="LiquidCommerce",e.appendChild(o);const r=document.createElement("span");return r.className="pb-dot",r.textContent=".",e.appendChild(r),e}createDisclaimerSection(){const e=document.createElement("div");e.className="pb-disclaimer-container";const n=this.getDisclaimerConfig();return n.parts.forEach(n=>{"text"===n.type?e.appendChild(document.createTextNode(n.content)):"link"===n.type&&e.appendChild(this.createLink(n.href,n.text))}),e}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(e,n){const o=document.createElement("a");return o.href=e,o.target="_blank",o.rel="noopener noreferrer",o.className="pb-link",o.textContent=n,o.setAttribute("role","link"),o.setAttribute("aria-label","Read "+n),o}template(){const e=this.createPoweredBySection(),n=this.createDisclaimerSection();return[e,n]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(e){const n=e.find(e=>"cart.promoCode"===e.path||"checkout.promoCode"===e.path);if(!n||!this.applyButton||!this.currentActiveTicker)return;const o=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);o&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!o&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(e){const n=this.store.get("cart.promoCode"),o=this.store.get("checkout.promoCode");return(null==n?void 0:n.code)===e||(null==o?void 0:o.code)===e}getActiveTickers(){var e;const n=this.store.get("address");return null===(e=this.params.tickers)||void 0===e?void 0:e.filter(e=>{var o;return isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:null===(o=null==n?void 0:n.address)||void 0===o?void 0:o.state})})}selectCurrentTicker(e){return 0===e.length?null:e[0]}generateTextContent(e){const n=document.createElement("div");n.classList.add("promo-ticker__text-group");const o=e.text.map(e=>e.trim()).map(e=>e.substring(0,50)).filter(e=>""!==e.trim()).slice(0,5);for(const r of o){const o=r.trim();if(!o)continue;const s=document.createElement("span");s.classList.add("promo-ticker__text-item"),s.textContent=o,n.appendChild(s);const a=document.createElement("span");a.classList.add("promo-ticker__separator"),a.textContent=e.separator,n.appendChild(a)}return n}async handlePromoClick(){var e;(null===(e=this.currentActiveTicker)||void 0===e?void 0:e.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const e=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(e),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const n=document.createElement("div");n.classList.add("promo-ticker__content");const o=document.createElement("div");o.classList.add("promo-ticker__track");for(let s=0;s<5;s++)o.appendChild(this.generateTextContent(this.currentActiveTicker));n.appendChild(o);const r=document.createElement("button");return r.type="button",r.classList.add("promo-ticker__cta"),r.textContent="APPLY",r.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(r.disabled=!![],r.textContent="APPLIED"),r.addEventListener("click",()=>this.handlePromoClick()),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handlePromoClick())}),this.applyButton=r,[n,r]}}class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const e=this.config||{};if(e.showIcon===![])return null;const n={warning:"warning",success:"success",info:"info"},o={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},r=n[this.params.messageType]||"warning",s=document.createElement("div");return s.className="alert-icon alert-icon-"+this.params.messageType,s.appendChild(htmlStringToElement(o[r]({width:16,height:16,className:"alert-icon-svg"}))),s}template(){var e;const n=[],o=this.getIconElement();o&&n.push(o);const r=document.createElement("span");if(r.className="alert-message",r.textContent=this.params.message,n.push(r),"detailed"===(null===(e=this.config)||void 0===e?void 0:e.alertType)&&this.params.currentTotal){const e=document.createElement("div");e.className="alert-details";const o=document.createElement("small");o.className="alert-details-text",o.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),e.appendChild(o),n.push(e)}return n}}const St=LoggerFactory.get("ClientHelpers"),isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),getType=e=>null===e?"null":Array.isArray(e)?"array":typeof e;function deepMergeConfigs(e,n){if(!e||!n)return e;const o={...e},r=[];for(const s in n){const a=n[s],c=o[s];if(!(s in e)){r.push('Property "'+s+'" does not exist in target schema, skipping merge.');continue}const l=getType(a),d=getType(c);l===d?isObject(a)&&isObject(c)?o[s]=deepMergeConfigs(c,a):o[s]=a:r.push('Type mismatch for key "'+s+'": source is '+l+", target is "+d+". Skipping merge.")}return r.length>0&&St.warn("Merging configurations with warnings:",r),o}class ElementsCheckoutClient{constructor(e){this.clientPrepared=![],this.componentsRegistered=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.checkoutActionService=ClientCheckoutActionService.getInstance(),this.logger=LoggerFactory.get("CheckoutClient"),this.authClient=AuthClientService.getInstance({apiKey:e.apiKey,env:e.env,baseUrl:e.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareServices(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(e){throw this.logger.error("Checkout client preparation failed",e),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),e}}async prepareServices(){this.clientConfig.set("version",Z.version);const e=this.clientConfig.isProduction(),n=this.clientConfig.isDebuggingEnabled();!e&&n&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled")),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),!e&&n&&this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized")),this.logger.info("🔐 Starting authentication...");const{success:o,configs:r}=await this.authClient.authenticateAndGetConfigs();if(!o||!r)throw this.clientPrepared=![],new SDKError("Authentication failed",!![]);this.logger.info("✅ Authentication completed"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed");let s=r;this.clientConfig.set("partnerCode",s.configurations.partnerCode),this.clientConfig.set("partnerName",s.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const a=await this.fingerPrintService.getId(s.configurations.partnerCode),c=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",a),this.clientConfig.set("isLocalStorageAvailable",c);const l=c?null:await this.apiClient.getPersistedStore(a);if(await this.store.initialize({userDeviceId:a,isLocalStorageAvailable:c,persistedStore:l}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const e=this.clientConfig.get("customTheme"),n=s.global.layout.showPoweredBy;s=deepMergeConfigs(s,e),s.global.layout.showPoweredBy=n}await this.themeProvider.initialize(s),this.logger.info("✅ Theme provider initialized"),this.logger.info("📦 Registering checkout components..."),this.registerCheckoutComponents(),this.logger.info("✅ Checkout components registered"),this.initializeGTM(),this.logger.info("🎯 Checkout client preparation completed")}async initializeGTM(){try{const e=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:e.partnerName,partnerCode:e.partnerCode,enablePartnerGTM:e.enablePartnerGTM,partnerGTMId:e.partnerGTMId||void 0,enableLiquidCommerceGTM:e.enableLiquidCommerceGTM,liquidCommerceGTMId:e.liquidCommerceGTMId})}catch(e){this.logger.warn("GTM initialization failed",e)}}registerCheckoutComponents(){this.componentsRegistered||(ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.INPUT,InputComponent),ComponentFactoryService.registerComponent(r.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(r.ALERT,AlertComponent),ComponentFactoryService.registerComponent(r.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(r.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(r.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(r.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent),this.componentsRegistered=!![])}async injectCheckout(e,n){if(!e||"string"!=typeof e)throw new SDKError("Checkout requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);const o=e.replace("#",""),s=document.getElementById(o);if(!s)throw new SDKError('Cannot find element with ID "'+e+'". Make sure the element exists before injecting checkout.',!![]);const a=ComponentFactoryService.createElement({type:r.CHECKOUT,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});return s.innerHTML="",safeReplaceChildren(s,a),this.store.set("metadata.checkout.injection",{containerId:o,injectedAt:Date.now()}),await this.checkoutCommands.loadCheckout({checkoutId:void 0===n?"":n}),this.createInjectedComponentWrapper(o,a)}createInjectedComponentWrapper(e,n){return{getType:()=>r.CHECKOUT,getElement:()=>document.getElementById(e),rerender:()=>{try{n&&"function"==typeof n.rerender&&n.rerender("CheckoutRerender")}catch(o){this.logger.warn("Failed to rerender checkout in container '"+e+"'")}}}}get actions(){const e=this.checkoutActionService.actions;return{checkout:{applyPromoCode:e.applyPromoCode,removePromoCode:e.removePromoCode,applyGiftCard:e.applyGiftCard,removeGiftCard:e.removeGiftCard,toggleIsGift:e.toggleIsGift,toggleBillingSameAsShipping:e.toggleBillingSameAsShipping,toggleMarketingPreferences:e.toggleMarketingPreferences,updateCustomerInfo:e.updateCustomerInfo,updateBillingInfo:e.updateBillingInfo,updateGiftInfo:e.updateGiftInfo,getDetails:e.getDetails}}}}async function ElementsCheckout(e,o){try{SingletonManager.setContext({isBuilder:![]});const r=ClientConfigService.getInstance();r.initialize(e,{env:o.env,isBuilder:![],debugMode:o.debugMode,customTheme:o.customTheme,promoTicker:void 0,proxy:o.proxy,development:o.development,checkout:o.checkout});const s=r.getConfigs(),a=new ElementsCheckoutClient(s);if(await a.prepare(),!a.clientPrepared)throw new SDKError("Failed to initialize checkout client.",!![]);const c={injectCheckout:a.injectCheckout.bind(a),actions:a.actions};window.elementsCheckout=c;const l=PubSubService.getInstance();return l.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Checkout Client Is Ready",timestamp:Date.now(),version:r.get("version")}),c}catch(r){return console.error("[LiquidCommerce Elements] Checkout client initialization failed",r),null}}const _t={SCRIPT:{CHECKOUT_PARAM:"data-checkout-param"},ELEMENT:{CHECKOUT:"data-lce-checkout"},JSON_SCRIPT:{DEVELOPMENT:"data-liquid-commerce-elements-development"}};function startsWithLcePrefix(e){return null!==e&&"lce_"===e.substring(0,4)}function getDevelopmentConfigs(){const e=document.querySelector("script["+_t.JSON_SCRIPT.DEVELOPMENT+"]");if(e)try{return JSON.parse(e.textContent||"{}")}catch(n){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",n),void 0}}function triggerAutoInit(e,n){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await e()}catch(o){console.error(n+" Failed to initialize:",o)}},50)}):setTimeout(async()=>{try{await e()}catch(o){console.error(n+" Failed to initialize:",o)}},50)}catch(o){console.error(n+" Failed to setup initialization:",o)}}async function setupCheckout(e,n,o){try{const r=document.querySelector("div["+_t.ELEMENT.CHECKOUT+"]");if(!r)return o.requireCheckoutId||console.warn(o.errorPrefix+" No checkout container found. Add a div with data-lce-checkout attribute."),void 0;const s="lce-checkout-container";let a;r.className="lce-checkout-container",r.id=s;const c=e.getAttribute(_t.SCRIPT.CHECKOUT_PARAM)||"lce_checkout";if(c&&startsWithLcePrefix(c)){const e=new URLSearchParams(window.location.search);if(a=e.get(c)||void 0,!a&&o.requireCheckoutId)return console.warn(o.errorPrefix+" Checkout ID not found in query parameters."),void 0}else if(console.warn(o.errorPrefix+' Ignoring checkout query parameter "'+c+'" because it does not start with "lce_" prefix.'),o.requireCheckoutId)return;await n(s,a)}catch(r){console.error(o.errorPrefix+" Failed to setup checkout:",r)}}const Et={SCRIPT:{MAIN:"data-liquid-commerce-checkout",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode",CHECKOUT_URL:"data-checkout-url"}};async function ElementsCheckoutAutoInitialize(){try{const n=document.querySelector("script["+Et.SCRIPT.MAIN+"]");if(!n)return;const o=n.getAttribute(Et.SCRIPT.TOKEN),r=n.getAttribute(Et.SCRIPT.ENV)||e.PRODUCTION,s=n.getAttribute(Et.SCRIPT.DEBUG_MODE);if(!o)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements Checkout script tag.',!![]);const c=n.getAttribute(Et.SCRIPT.CHECKOUT_URL)||void 0;let l=a.NONE;s&&r!==e.PRODUCTION&&(l=s);const d=await ElementsCheckout(o,{env:r,debugMode:l,checkout:c?{pageUrl:c}:void 0,development:getDevelopmentConfigs()});if(!d)throw new SDKError("ElementsCheckout SDK client initialization failed",!![]);await setupCheckout(n,d.injectCheckout.bind(d),{requireCheckoutId:![],errorPrefix:"[LiquidCommerce Checkout Auto Initialization]"})}catch(n){console.error("[LiquidCommerce Checkout Auto Initialization]",n)}}function triggerElementsCheckoutAutoInit(){triggerAutoInit(ElementsCheckoutAutoInitialize,"[LiquidCommerce Checkout Auto Initialization]")}if(void 0===window.customElements)console.error("[LiquidCommerce Checkout] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Checkout] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const e=window.onerror;window.onerror=(n,o,r,s,a)=>isSDKError(a,o)?(console.error("[LiquidCommerce Checkout] Unhandled SDK error:",{message:n,source:o,lineno:r,colno:s,error:a}),!![]):e?e(n,o,r,s,a):![];const n=window.onunhandledrejection;window.onunhandledrejection=e=>{if(e.reason&&isSDKError(e.reason))return console.error("[LiquidCommerce Checkout] Unhandled SDK promise rejection:",e.reason),e.preventDefault(),void 0;n&&n.call(window,e)};try{initializeDOMPolyfills()}catch(Tt){console.error("[LiquidCommerce Checkout] DOM polyfills initialization failed:",Tt)}window.ElementsCheckout=ElementsCheckout;try{triggerElementsCheckoutAutoInit()}catch(It){console.error("[LiquidCommerce Checkout] Auto-initialization failed:",It)}}catch(Pt){console.error("[LiquidCommerce Checkout] SDK initialization failed:",Pt)}exports.ElementsCheckout=ElementsCheckout,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|