@liquidcommerce/elements-sdk 2.2.0-beta.32 → 2.2.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/umd/elements.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";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 e of t)"string"==typeof e?this.appendChild(document.createTextNode(e)):this.appendChild(e)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const e=document.createDocumentFragment();for(const n of t)"string"==typeof n?e.appendChild(document.createTextNode(n)):e.appendChild(n);this.insertBefore(e,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 e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const a of t)"string"==typeof a?n.appendChild(document.createTextNode(a)):n.appendChild(a);e.replaceChild(n,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const a of t)"string"==typeof a?n.appendChild(document.createTextNode(a)):n.appendChild(a);e.insertBefore(n,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const a of t)"string"==typeof a?n.appendChild(document.createTextNode(a)):n.appendChild(a);e.insertBefore(n,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const e={};for(const[n,a]of t)e[n]=a;return e})}function safeScrollIntoView(t,e){try{e&&"function"==typeof t.scrollIntoView?t.scrollIntoView(e):t.scrollIntoView()}catch(n){try{t.scrollIntoView()}catch(a){console.warn("scrollIntoView failed:",a)}}}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(j){console.warn("DOM polyfills initialization failed:",j)}}function safeReplaceChildren(t,...e){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...e);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const n of e)"string"==typeof n?t.appendChild(document.createTextNode(n)):t.appendChild(n)}}catch(n){console.error("replaceChildren operation failed:",n),1===e.length&&"string"==typeof e[0]&&(t.innerHTML=e[0])}}class SingletonManager{static getInstances(){return SingletonManager.instances||(SingletonManager.instances=new Map),SingletonManager.instances}constructor(){}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,e){const n=SingletonManager.getInstances();n.has(t)||n.set(t,e());const a=n.get(t);if(!a)throw new Error("ElementsSdk: Instance for class "+t+" could not be created.");return a}static async getClient(t){const e=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),n="LiquidCommerceElementsClient_"+e,a=SingletonManager.getInstances();if(a.has(n))return a.get(n);if(!SingletonManager.clientConstructor)throw new Error("LiquidCommerce Elements: Client constructor is not set.");const c=new SingletonManager.clientConstructor(t);return await c.prepare(),a.set(n,c),c}}SingletonManager.instances=null,SingletonManager.clientConstructor=null;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 e=(new Date).toISOString().slice(11,23);return["%c["+e+"%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,e){if(this.sendToTelemetry("debug",t,void 0,e),!this.enableLogging)return;const[n,...a]=this.getPrefix("debug");void 0!==e?console.debug(n,...a,t,e):console.debug(n,...a,t)}info(t,e){if(!this.enableLogging)return;const[n,...a]=this.getPrefix("info");void 0!==e?console.info(n,...a,t,e):console.info(n,...a,t)}warn(t,e){if(this.sendToTelemetry("warn",t,void 0,e),!this.enableLogging)return;const[n,...a]=this.getPrefix("warn");void 0!==e?console.warn(n,...a,t,e):console.warn(n,...a,t)}error(t,e){const n=e instanceof Error,a=n?e:void 0,c=!n&&e?e:void 0;if(this.sendToTelemetry("error",t,a,c),!this.enableLogging)return;const[l,...d]=this.getPrefix("error");void 0!==e?console.error(l,...d,t,e):console.error(l,...d,t)}group(t,e=![]){if(!this.enableLogging)return;const[n,...a]=this.getPrefix("log");e?console.groupCollapsed(n,...a,t):console.group(n,...a,t)}groupEnd(){this.enableLogging&&console.groupEnd()}sendToTelemetry(t,e,n,a){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,e,{context:this.context,error:n,data:a})}catch(c){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const e=this.getInstances();if(!e.has(t)){const n=LoggerService.getInstance(t);n.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&n.setTelemetryService(this.telemetryService),e.set(t,n)}return e.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const e=this.getInstances();for(const[,n]of e)n.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const e=this.getInstances();for(const[,n]of e)n.setTelemetryService(t)}}var t;LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null,function(t){t.CLOSED="CLOSED",t.OPEN="OPEN",t.HALF_OPEN="HALF_OPEN"}(t||(t={}));class CircuitBreakerService{constructor(e){this.state=t.CLOSED,this.failures=0,this.successes=0,this.totalCalls=0,this.rejectedCalls=0,this.lastFailureTime=null,this.lastSuccessTime=null,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.config={failureThreshold:5,recoveryTimeout:3e4,halfOpenMaxCalls:3,successThreshold:2,timeout:1e4,countClientErrorsAsFailures:![],...e},this.logger=LoggerFactory.get("CircuitBreaker")}static getInstance(t){return SingletonManager.getClassInstance("CircuitBreakerService",()=>new CircuitBreakerService(t))}async execute(e,n,a){switch(this.totalCalls++,this.state===t.OPEN&&Date.now()>=this.nextAttemptTime&&this.halfOpenCircuit(n),this.state){case t.OPEN:if(null==a?void 0:a.critical)return this.logger.warn("Critical operation bypassing OPEN circuit breaker",{context:n,failures:this.failures}),this.executeWithTimeout(e,a.critical);if(null==a?void 0:a.fallback)return this.logger.info("Circuit breaker OPEN - using fallback",{context:n}),this.rejectedCalls++,a.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker is OPEN - failing fast",{context:n,failures:this.failures}),new Error("Service unavailable - circuit breaker is open ("+(n||"unknown")+")");case t.HALF_OPEN:if(this.halfOpenCallsInProgress>=this.config.halfOpenMaxCalls){if(null==a?void 0:a.fallback)return this.logger.info("Circuit breaker HALF_OPEN limit reached - using fallback",{context:n}),this.rejectedCalls++,a.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker HALF_OPEN - max calls reached",{context:n,halfOpenCalls:this.halfOpenCallsInProgress,maxCalls:this.config.halfOpenMaxCalls}),new Error("Service unavailable - circuit breaker half-open limit reached ("+(n||"unknown")+")")}this.halfOpenCallsInProgress++}try{const t=await this.executeWithTimeout(e,null==a?void 0:a.critical);return this.onSuccess(n),t}catch(c){throw this.onFailure(c,n),c}}async executeWithFallback(t,e,n,a){return this.execute(t,n,{fallback:e,critical:a})}getStats(){return{state:this.state,failures:this.failures,successes:this.successes,totalCalls:this.totalCalls,rejectedCalls:this.rejectedCalls,lastFailureTime:this.lastFailureTime,lastSuccessTime:this.lastSuccessTime,isHealthy:this.state===t.CLOSED&&0===this.failures}}reset(){this.state=t.CLOSED,this.failures=0,this.successes=0,this.totalCalls=0,this.rejectedCalls=0,this.lastFailureTime=null,this.lastSuccessTime=null,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker reset to initial state")}forceOpen(t){this.openCircuit(t)}forceClose(e){this.state=t.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker manually closed",{context:e})}async executeWithTimeout(t,e){const n=e?2*this.config.timeout:this.config.timeout;return new Promise((e,a)=>{const c=setTimeout(()=>{a(new Error("Request timeout after "+n+"ms"))},n);t().then(t=>{clearTimeout(c),e(t)}).catch(t=>{clearTimeout(c),a(t)})})}onSuccess(e){this.lastSuccessTime=Date.now(),this.state===t.HALF_OPEN?(this.halfOpenCallsInProgress--,this.successes++,this.successes>=this.config.successThreshold&&this.closeCircuit(e)):this.state===t.CLOSED&&(this.successes++,this.failures=0),this.logger.debug("Circuit breaker success",{context:e,state:this.state,successes:this.successes,failures:this.failures})}onFailure(e,n){const a=(null==e?void 0:e.status)&&e.status>=400&&e.status<500;if(a&&!this.config.countClientErrorsAsFailures)return this.logger.debug("Client error (4xx) - not counting as circuit breaker failure",{context:n,status:e.status,message:e.message}),void 0;this.lastFailureTime=Date.now(),this.failures++,this.state===t.HALF_OPEN&&(this.halfOpenCallsInProgress--,this.openCircuit(n)),this.state===t.CLOSED&&this.failures>=this.config.failureThreshold&&this.openCircuit(n),this.logger.warn("Circuit breaker failure",{context:n,state:this.state,failures:this.failures,error:(null==e?void 0:e.message)||e,status:null==e?void 0:e.status,threshold:this.config.failureThreshold,isClientError:a})}openCircuit(e){this.state=t.OPEN,this.nextAttemptTime=Date.now()+this.config.recoveryTimeout,this.halfOpenCallsInProgress=0,this.logger.error("Circuit breaker OPENED",{context:e,failures:this.failures,threshold:this.config.failureThreshold,nextAttemptTime:new Date(this.nextAttemptTime).toISOString()})}halfOpenCircuit(e){this.state=t.HALF_OPEN,this.halfOpenCallsInProgress=0,this.successes=0,this.logger.info("Circuit breaker HALF_OPEN - testing service recovery",{context:e,maxCalls:this.config.halfOpenMaxCalls,successThreshold:this.config.successThreshold})}closeCircuit(e){this.state=t.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker CLOSED - service recovered",{context:e,totalRecoveryTime:this.lastFailureTime?Date.now()-this.lastFailureTime:0})}}const e={LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",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",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",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_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_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"},a={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},c={DRAWER:"drawer",INPUT:"input",BIRTHDATE_INPUT:"birthdate-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",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",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_SECTION:"checkout-information-section",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT_FORM:"checkout-payment-form",CHECKOUT_BILLING_FORM:"checkout-billing-form",CHECKOUT_SUMMARY_SECTION:"checkout-summary-section",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_DELIVERY_INFORMATION_FORM:"checkout-delivery-information-form",CHECKOUT_BUYER_INFORMATION_FORM:"checkout-buyer-information-form",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"},l={ON_DEMAND:"onDemand",SHIPPING:"shipping"},d={NONE:"none",CONSOLE:"console",PANEL:"panel"},u={[e.LOCAL]:"http://127.0.0.1:8080",[e.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[e.STAGING]:"https://staging-elements.liquidcommerce.us",[e.PRODUCTION]:"https://elements.liquidcommerce.us"},h={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};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,e={}){this.validateInputs(t,e),this.config=Object.freeze(this.buildConfiguration(t,e))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,e){if(!this.config)throw new Error("ClientConfigService is not initialized. Please call initialize() first.");this.config=Object.freeze({...this.config,[t]:e})}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 t=this.get("debugMode");return t===d.CONSOLE||t===d.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===d.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===d.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}getProxyConfig(){return this.get("proxy")}validateInputs(t,n){if(!(null==t?void 0:t.trim()))throw new Error("API key is required");if(n.env&&!Object.values(e).includes(n.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+n.env+'". Using default environment.'),n.env=void 0),void 0!==n.isBuilder&&"boolean"!=typeof n.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),n.isBuilder=void 0),void 0===n.debugMode||Object.values(d).includes(n.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+n.debugMode+'". Must be one of: '+Object.values(d).join(", ")+". Using default value."),n.debugMode=void 0),n.promoTicker&&"object"!=typeof n.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),n.promoTicker=void 0),n.promoTicker)if(Array.isArray(n.promoTicker)){const t=n.promoTicker.filter((t,e)=>{if("string"!=typeof t.promoCode||!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].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["+e+"].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["+e+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom is required. Skipping this promo."),![];const n="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(n instanceof Date)||Number.isNaN(n.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil is required. Skipping this promo."),![];const a="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return a instanceof Date&&!Number.isNaN(a.getTime())?n>=a?(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});n.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),n.promoTicker=void 0;n.proxy&&("object"!=typeof n.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),n.proxy=void 0):n.proxy.baseUrl&&"string"==typeof n.proxy.baseUrl?n.proxy.headers&&"object"!=typeof n.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),n.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),n.proxy=void 0))}buildConfiguration(t,n){var a,c;const l=n.env||e.STAGING,h=u[l];return{apiKey:t.trim(),env:l,isBuilder:null!==(a=n.isBuilder)&&void 0!==a?a:![],debugMode:null!==(c=n.debugMode)&&void 0!==c?c:d.NONE,baseUrl:h,partnerCode:void 0,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null}}detectDeviceType(){var t,e;if("undefined"==typeof navigator)return"desktop";const n=navigator.userAgent.toLowerCase(),a="ontouchstart"in window||navigator.maxTouchPoints>0,c=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,l=(null===(e=window.screen)||void 0===e?void 0:e.height)||0,d=Math.max(c,l),u=[/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/],h=[/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 u.some(t=>t.test(n))?"tablet":h.some(t=>t.test(n))||a&&d<768?"mobile":a&&d>=768&&d<=1200||a&&/macintosh/i.test(n)&&navigator.maxTouchPoints>1||/android/i.test(n)&&a&&d>=768||/windows nt/i.test(n)&&a&&d>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(n),"desktop")}}function fetchAdapter(t){return async(e,n)=>{var a;const c=await t(e,n);let l;if("function"==typeof(null===(a=c.headers)||void 0===a?void 0:a.entries))l=Object.fromEntries(c.headers.entries());else{l={};for(const[t,e]of c.headers)l[t]=e}return{ok:c.ok,status:c.status,statusText:c.statusText,headers:l,json:()=>c.json(),text:()=>c.text()}}}const xhrFetch=(t,e)=>new Promise((n,a)=>{const c=new XMLHttpRequest;c.open(e.method||"GET",t);for(const[t,l]of objectEntries(e.headers))c.setRequestHeader(t,l);c.onload=()=>{n({ok:c.status>=200&&c.status<300,status:c.status,statusText:c.statusText,headers:c.getAllResponseHeaders().split("\r\n").reduce((t,e)=>{const[n,a]=e.split(": ");return n&&a&&(t[n]=a),t},{}),json:()=>Promise.resolve(JSON.parse(c.responseText)),text:()=>Promise.resolve(c.responseText)})},c.onerror=()=>{a(new TypeError("Network request failed"))},c.send(e.body)});function getFetchImplementation(){return"undefined"!=typeof fetch?fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?fetchAdapter(global.fetch):window.fetch?fetchAdapter(window.fetch):xhrFetch}function objectValues(t){const e=[];for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(t[n]);return e}function objectEntries(t){const e=[];for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push([n,t[n]]);return e}class AuthService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=getFetchImplementation(),this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance(),this.circuitBreaker=CircuitBreakerService.getInstance({failureThreshold:5,recoveryTimeout:3e4,halfOpenMaxCalls:3,successThreshold:2,timeout:15e3,countClientErrorsAsFailures:![]})}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(t))}async authenticate(){var t,e;if(this.isAuthenticating)return await new Promise(t=>{const C=()=>{this.isAuthenticating?setTimeout(C,100):t(void 0)};C()}),!!this.accessToken;this.isAuthenticating=!![];try{const n=await this.requestWithoutAuth("/auth",{method:"GET"},!![]);return this.accessToken=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.token,this.tokenExpiration=Date.now()+1e3*(null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.exp),!![]}catch(n){return this.logger.error("Authentication failed",n),![]}finally{this.isAuthenticating=![]}}async requestWithoutAuth(t,e,n=![]){return this.circuitBreaker.execute(async()=>{const n=this.buildUrl(t),a={"Content-Type":"application/json","X-Liquid-Api-Key":this.apiKey,"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(),...this.getProxyHeaders(),...e.headers};this.clientConfig.isBuilder()&&(a["X-Liquid-Api-Builder"]=!![]);const c={method:e.method,headers:a,body:e.body?JSON.stringify(e.body):void 0},l=await this.httpClient(n,c);if(!l.ok)throw{message:"HTTP error status: "+l.status,status:l.status};return l.json()},e.method+" "+t+" (no-auth)",{critical:n})}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(t,e,n=![]){return this.circuitBreaker.execute(async()=>{this.accessToken&&!this.isTokenExpired()||await this.authenticate();const n=this.buildUrl(t),a={"Content-Type":"application/json",Authorization:"Bearer "+this.accessToken,"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(),...this.getProxyHeaders(),...e.headers};this.clientConfig.isBuilder()&&(a["X-Liquid-Api-Builder"]=!![]);const c={method:e.method,headers:a,body:e.body?JSON.stringify(e.body):void 0},l=await this.httpClient(n,c);let d;try{d=await l.json()}catch(u){const t=await l.text().catch(()=>"HTTP error status: "+l.status);d={message:t||u},this.logger.error("Failed to parse response data",u)}if(!l.ok)throw{...d,status:l.status,message:(null==d?void 0:d.message)||"HTTP error status: "+l.status};return d},e.method+" "+t,{critical:n})}buildUrl(t){const e=this.clientConfig.getProxyConfig();return new URL("api"+t,e?e.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}async get(t,e){return this.request(t,{method:"GET",headers:null==e?void 0:e.headers},null==e?void 0:e.critical)}async post(t,e){return this.request(t,{method:"POST",body:null==e?void 0:e.body,headers:null==e?void 0:e.headers},null==e?void 0:e.critical)}async put(t,e){return this.request(t,{method:"PUT",body:null==e?void 0:e.body,headers:null==e?void 0:e.headers},null==e?void 0:e.critical)}async delete(t,e){return this.request(t,{method:"DELETE",headers:null==e?void 0:e.headers},null==e?void 0:e.critical)}}const p="@liquidcommerce/elements-sdk",m="LiquidCommerce Elements SDK",f="UNLICENSED",g="LiquidCommerce Team",v="2.2.0-beta.32",y="https://docs.liquidcommerce.co/elements-sdk",b={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},w={url:"https://github.com/liquidcommerce/elements-sdk/issues"},S="./dist/index.esm.js",E="./umd/elements.js",P="./dist/types/index.d.ts",F="pnpm@10.0.0",D={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},A=["dist","umd","docs","README.md","LICENSE"],_={access:"public",registry:"https://registry.npmjs.org/"},z="module",O=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],M={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","clean:hard":"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"},L=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],R={"@biomejs/biome":"2.2.6","@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@rollup/plugin-alias":"^5.1.1","@rollup/plugin-commonjs":"^28.0.8","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.2","@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.0","@semantic-release/npm":"^13.1.1","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.9.0","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.52.5","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^24.2.9","ts-node":"^10.9.2",typescript:"^5.9.3"},B={node:">=20"},q={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"]},j={name:p,description:m,license:f,author:g,version:v,homepage:y,repository:b,bugs:w,module:S,browser:E,types:P,packageManager:F,exports:D,files:A,publishConfig:_,type:z,sideEffects:O,scripts:M,keywords:L,devDependencies:R,engines:B,pnpm:q};class GoogleTagManagerService{constructor(){this.partnerEnableGaTracking=![],this.liquidCommerceEnableGaTracking=![],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(){if("function"==="object".gtag)return!![];const t=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return t.length>0}isContainerLoaded(t){const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.some(e=>{const n=e.src;return n.includes("id="+t)})}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...t)=>window.dataLayer.push(t),window.dataLayer.push({"gtm.start":Date.now(),event:"gtm.js"}),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(t){return new Promise((e,n)=>{if(this.isContainerLoaded(t))return this.logger.info("GTM container "+t+" already loaded, skipping script injection"),e(),void 0;this.logger.info("Loading GTM container "+t);const a=document.createElement("script");a.src="https://www.googletagmanager.com/gtm.js?id="+t,a.async=!![];const c=setTimeout(()=>n(new Error("GTM script timeout: "+t)),5e3);a.onload=()=>{clearTimeout(c),this.logger.info("GTM container "+t+" loaded successfully"),e()},a.onerror=()=>{clearTimeout(c),n(new Error("GTM script failed: "+t))},document.head.appendChild(a)})}processEventQueue(){const t=Date.now(),e=this.eventQueue.filter(e=>t-e.timestamp<3e4);for(const a of e)try{const t={event:a.eventName,...a.eventData};window.dataLayer.push(t),"function"==="object".gtag&&window.gtag("event",a.eventName,a.eventData),this.logger.debug("Processed queued GTM event: "+a.eventName,{data:a.eventData})}catch(n){this.logger.error("Error processing queued event "+a.methodName,n)}this.eventQueue=[],e.length>0&&this.logger.info("Processed "+e.length+" queued GTM events")}getSendToTargets(){const t=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&(!this.isContainerLoaded(this.liquidCommerceGtmId)&&this.isGTMAlreadyLoaded()||t.push(this.liquidCommerceGtmId)),this.partnerEnableGaTracking&&this.partnerGtmId&&(this.isGTMAlreadyLoaded()||this.isContainerLoaded(this.partnerGtmId))&&t.push(this.partnerGtmId),0===t.length&&this.isGTMAlreadyLoaded()&&this.logger.debug("No specific targets configured, letting GTM route events naturally"),t}async initialize(t){if(this.isInitialized||this.isInitializing)return this.initializationPromise;if(!this.clientConfigService.isBuilder()){this.isInitializing=!![],this.initializationPromise=this.doInitialize(t);try{await this.initializationPromise}catch(e){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",e)}}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGtmId))throw new Error("GTM config missing required fields");if(!t.liquidCommerceEnableGaTracking&&!t.partnerEnableGaTracking)return this.logger.warn("GTM initialization skipped: No tracking enabled"),this.isInitialized=!![],this.isInitializing=![],void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerGtmId=t.partnerGtmId,this.liquidCommerceGtmId=t.liquidCommerceGtmId,this.partnerEnableGaTracking=t.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=t.liquidCommerceEnableGaTracking;const e=this.isGTMAlreadyLoaded();e&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let n=![],a="";if(t.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(t.liquidCommerceGtmId),n=!![],a=e?"GTM integrated with existing setup (Partner GTM detected, LC container: "+t.liquidCommerceGtmId+")":"GTM initialized with container "+t.liquidCommerceGtmId}catch(c){this.logger.error("Failed to load LiquidCommerce GTM container: "+c+". Checking if partner GTM is available.",c)}if(n||(e&&window.dataLayer?(n=!![],a="GTM integrated with existing partner setup"):window.dataLayer&&Array.isArray(window.dataLayer)&&(n=!![],a="GTM initialized with dataLayer (basic functionality available)")),!n)throw this.isInitializing=![],new Error("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(a),this.processEventQueue()}executeEvent(t,e,n){try{if(this.clientConfigService.isBuilder())return;const a=this.getSendToTargets(),c={...n,...a.length>0&&{send_to:a},tenant_source:j.description+" v"+j.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:e,eventData:c,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+e+" (initialization pending)",{data:c}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+e+" skipped: dataLayer not available"),void 0;const l={event:e,...c};window.dataLayer.push(l),"function"==="object".gtag&&window.gtag("event",e,c),this.logger.debug("Sent GTM event: "+e,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:a.length>0?a:"no targeting",data:c})}catch(a){this.logger.error("GTM "+t+" error",a)}}calculateValue(t){const e=t.reduce((t,e)=>t+(e.price||0)*(e.quantity||1),0);return Number.parseFloat(e.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,e,n){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:e,item_list_name:n,items:t})}selectItem(t,e,n){this.executeEvent("selectItem","select_item",{item_list_id:e,item_list_name:n,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,e){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfo(t,e){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfoWithCustomerData(t,e,n,a){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:t,coupon:e,phone:null==n?void 0:n.phone,email:null==n?void 0:n.email,birth_date:null==n?void 0:n.birth_date,customer_id:null==n?void 0:n.customer_id,subtotal:null==a?void 0:a.subtotal,total:null==a?void 0:a.total_before_discounts,discounts:null==a?void 0:a.discounts,gift_cards:null==a?void 0:a.gift_cards,net_total:null==a?void 0:a.net_total})}addPaymentInfo(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:e,coupon:n,items:t})}addPaymentInfoWithoutItems(t,e,n,a){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:t,payment_type:e,coupon:n,subtotal:null==a?void 0:a.subtotal,total:null==a?void 0:a.total_before_discounts,discounts:null==a?void 0:a.discounts,gift_cards:null==a?void 0:a.gift_cards,net_total:null==a?void 0:a.net_total})}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,e){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:e})}promoCodeFailed(t,e){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:e})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,e){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:e})}giftCardFailed(t,e){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:e})}increaseQuantity(t){this.executeEvent("increaseQuantity","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}decreaseQuantity(t){this.executeEvent("decreaseQuantity","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}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.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub")}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,e){this.publishSpecific("actions."+t,e)}publishForm(t,e){this.publishSpecific("forms."+t,e)}publishSpecific(t,e){const[n,a]=t.includes(".")?t.split(".",2):["actions",t];let c=a.split("_")[0];["product","cart","address","checkout"].includes(c)||(c="other");const l=Date.now(),d={eventId:this.generateEventId(l),namespace:n,event:a,originalEvent:t,actionNamespace:"actions"===n?c:void 0,timestamp:l},u={data:e,metadata:d};this.dispatchNativeEvents(t,u)}dispatchNativeEvents(t,e){const[n]=t.split(".",2);try{const a=new CustomEvent(this.eventPrefix+":"+t,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(a);const c=new CustomEvent(this.eventPrefix+":"+n,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(c)}catch(a){this.logger.error("Error dispatching native events for "+t,a)}}generateEventId(t){return"evt_"+t+"_"+Math.random().toString(36).slice(2,9)}}const G="liquid_elements",U={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},mainImage:null,region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:l.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,drawer:{isOpen:![],contentConfig:null},rerender:![]},H={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee:0,giftCardTotal:0,deliveryFee:0,discounts:0,quantity:0},promoCode:null,fulfillments:{},rerender:![],shouldReset:![],updatedAt:"",createdAt:"",events:[]},V={token:"",cartId:"",loading:![],updating:![],error:null,warning:[],isPresaleLocked:![],presaleExpiresAt:null,acceptedAccountCreation:![],deliveryTips:[],hasAgeVerify:![],hasSubstitutionPolicy:![],isGift:![],billingSameAsShipping:!![],marketingPreferences:{canEmail:![],canSms:![]},giftRecipient:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",addressTwo:null,message:null},customer:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",addressTwo:"",company:""},payment:{key:"",secret:"",paymentMethodId:null,sendSubmitSignal:![]},billing:null,promoCode:null,giftCards:[],orderNumber:null,items:{},readyForSubmit:{customer:![],gift:![],billing:![],payment:![],prepared:![]},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,platform:0,tax:0,engraving:0,giftCards:0,service:0,tip:0,details:{taxes:{bag:0,bottleDeposits:0,retailDelivery:0,products:0,delivery:0,shipping:0},discounts:{products:0,delivery:0,shipping:0,service:0,engraving:0}}},rerender:![],isFormValid:![],invalidFields:[],focusField:null,onDemandFulfillmentTipInfo:{},tipSelection:10,stripeFormStatus:{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},deliveryInstructions:null,card:{brand:null,country:null,expMonth:null,expYear:null,last4:null,funding:null},giftCardError:null,promoCodeError:null,events:[]},Y={drawer:{isOpen:![],contentConfig:null}},W={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},K={products:{},cart:H,address:W,checkout:V,ui:Y};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 getAllConfigs(){try{this.ensureClientInitialized();const t=await this.client.get("/configs",{critical:!![]});if(!this.validResponseData(t))throw this.logger.error("Invalid response data",t),new Error("Failed to fetch all configs: Invalid response data");return t.data}catch(t){throw this.logger.error("Error fetching configs",t),t}}async setPersistedStore(t,e){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!e||0===Object.keys(e).length)return this.logger.error("No data provided to set persisted store"),void 0;const n=await this.client.post("/configs/store/"+t,{body:e});200!==n.statusCode&&this.logger.error("Failed to set persisted store",n)}catch(n){this.logger.error("Error setting persisted store",n)}}async getPersistedStore(t){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to get persisted store"),null;const e=await this.client.get("/configs/store/"+t);return 200!==e.statusCode?(this.logger.error("Failed to fetch persisted store",e),null):e.data}catch(e){return this.logger.error("Error fetching persisted store",e),null}}async getProductsData(t,e){try{if(this.ensureClientInitialized(),0===t.length)return this.logger.error("No product identifiers provided"),null;const n={upcs:t,ids:t,grouping:t,shouldShowOffHours:!![],isLegacy:!![],loc:e},a=await this.client.post("/cloud/catalog/availability",{body:n});return 200===a.statusCode&&a.products&&0!==a.products.length?{products:a.products,retailers:a.retailers}:(this.logger.error("Failed to fetch product data",a),null)}catch(n){return this.logger.error("Error fetching product data",n),null}}async getCartData(t){try{this.ensureClientInitialized();const e=await this.client.get("/cloud/cart"+(t?"?id="+t:""));if(200!==e.statusCode)throw this.logger.error("Failed to fetch cart data",e),new Error("Failed to fetch cart data: "+e.message);return e.cart}catch(e){throw this.logger.error("Error fetching cart data",e),e}}async updateCart(t){try{this.ensureClientInitialized();const e=await this.client.put("/cloud/cart",{body:t});if(200!==e.statusCode)throw this.logger.error("Failed to update cart",e),new Error("Failed to update cart: "+e.message);return e.cart}catch(e){throw this.logger.error("Error updating cart",e),e}}async getAddressSuggestions(t){try{if(this.ensureClientInitialized(),!t||0===t.trim().length)return this.logger.error("Query is required to fetch address suggestions"),[];const e=await this.client.get("/cloud/address/autocomplete?input="+t);return 200!==e.statusCode?(this.logger.error("Failed to fetch address suggestions",e),[]):e.data}catch(e){return this.logger.error("Error fetching address suggestions",e),[]}}async getAddressDetails(t){try{if(this.ensureClientInitialized(),!t||0===t.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new Error("Address ID is required to fetch address details");const e=await this.client.get("/cloud/address/details/"+t);if(200!==e.statusCode)throw this.logger.error("Failed to fetch address details",e),new Error("Failed to fetch address details: "+e.message);return e.data}catch(e){throw this.logger.error("Error fetching address details",e),e}}async prepareCheckout(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/checkout/prepare",{body:t,critical:!![]});if(200!==e.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",e),new Error("Failed to fetch prepare checkout data: "+e.message);return e.checkout}catch(n){throw this.logger.error("Error fetching prepare checkout data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async getPaymentSession(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/payment/session",{body:t,critical:!![]});if(201!==e.statusCode)throw this.logger.error("Failed to get payment session",e),new Error("Failed to get payment session: "+e.message);return e.data}catch(n){throw this.logger.error("Error fetching payment session:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async confirmPaymentSession(t,e){try{this.ensureClientInitialized();const n=await this.client.post("/cloud/payment/confirm",{body:{confirmationTokenId:t,setupIntentId:e},critical:!![]});if(200!==n.statusCode)throw this.logger.error("Failed to confirm payment session",n),new Error("Failed to confirm payment session: "+n.message);return n.data}catch(n){throw this.logger.error("Error confirming payment session",n),n}}async checkoutComplete(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/checkout/complete",{body:t,critical:!![]});if(200!==e.statusCode)throw this.logger.error("Failed to complete checkout",e),new Error("Failed to complete checkout: "+e.message);return e.order}catch(n){if(this.logger.error("Error completing checkout:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),null==n?void 0:n.error)throw new Error(n.error);throw n}}validResponseData(t){return t.data&&"object"==typeof t.data&&Object.keys(t.data).length>0}ensureClientInitialized(){if(!this.client)throw new Error("API client is not initialized")}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:e,next:n})=>{const a=performance.now();this.logger.group("🏪 Store "+t+" ---------------------------------"),this.logger.debug("Payload:",e);try{const t=n(),e=performance.now()-a;return this.logger.debug("Completed in "+e.toFixed(3)+"ms"),t}catch(c){throw this.logger.error('Error during store action "'+t+'"',c),c}finally{this.logger.groupEnd()}},this.performanceMiddleware=({action:t,next:e})=>{const n=performance.now(),a=e(),c=performance.now()-n;return c>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+c.toFixed(2)+"ms"),a},this.state=K,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:e,persistedStore:n}){this.localStorageKey=G+"_"+t,this.isLocalStorageAvailable=e,e?await this.loadPersistedState():n&&await this.loadFromDBPersistence(n),this.addBeforeUnloadHandler(),this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:e,hasPersistedState:null!==n,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const e=t.split(".");let n=this.state;for(const a of e){if(null==n)return;n=n[a]}return void 0!==n?Array.isArray(n)?[...n]:"object"==typeof n&&null!==n?{...n}:n:void 0}set(t,e){return this.runWithMiddleware("set",{path:t,value:e},()=>{const n=this.get(t);return this.state=this.immutableSet(this.state,t,e),this.notifyListeners(t,e,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,e){const n=this.get(t),a=e(n);return this.set(t,a)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const e=this.get(t);if(void 0===e)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const n=t.split(".");let a=this.state;const c=n.pop();for(const l of n){if(void 0===a[l])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];a=a[l]}if(Array.isArray(a))a=a.filter((t,e)=>e!==Number.parseInt(c,10));else{if("object"!=typeof a||null===a)return this.logger.warn('Cannot remove property "'+c+'" from non-object type at path "'+t+'".'),![];{const{[c]:t,...e}=a;a=e}}return this.state=this.immutableSet(this.state,n.join("."),a),this.notifyListeners(t,void 0,e),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const e=[];if("function"==typeof t){const n=t(this.state);for(const[t,a]of Object.entries(n)){const n=this.get(t);e.push({path:t,oldValue:n,newValue:a,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,a)}}else for(const[n,a]of Object.entries(t)){const t=this.get(n);e.push({path:n,oldValue:t,newValue:a,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,a)}for(const{path:t,oldValue:n,newValue:a}of e)this.notifyListeners(t,a,n);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,e){const n=t;return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),()=>{var t;null===(t=this.listeners.get(n))||void 0===t?void 0:t.delete(e)}}watchMany(t,e){const n=[];let a;const c=t.map(t=>this.watch(t,(c,l)=>{n.push({path:t,value:c,oldValue:l}),clearTimeout(a),a=setTimeout(()=>{n.length>0&&(e([...n]),n.length=0)},0)}));return()=>{for(const t of c)t()}}createProductInstance(t){const e="products."+t,n=this.get(e);return n?!![]:this.set(e,U)}removeProductInstance(t){const e=this.get("products"),{[t]:n,...a}=e;return this.set("products",a)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(t,e,n){let a=0;const o=()=>{if(a>=this.middleware.length)return n();const c=this.middleware[a++];return c({action:t,payload:e,state:this.getState(),next:o})};return o()}immutableSet(t,e,n){const a=e.split(".");if(1===a.length){if(Array.isArray(t)){const e=[...t];return e[a[0]]=n,e}return{...t,[a[0]]:n}}const[c,...l]=a,d=t[c],u=Array.isArray(d)?[]:{};if(Array.isArray(t)){const e=[...t];return e[c]=this.immutableSet(d||u,l.join("."),n),e}return{...t,[c]:this.immutableSet(d||u,l.join("."),n)}}notifyListeners(t,e,n){const a=this.listeners.get(t);if(a)for(const u of a)try{u(e,n)}catch(l){this.logger.error('Error in store listener for path "'+t+'"',l)}const c=t.split(".");for(let u=c.length-1;u>0;u--){const t=c.slice(0,u).join("."),e=this.listeners.get(t);if(e){const a=this.get(t),l=c.slice(u).join("."),h=this.immutableSet(a,l,n);for(const n of e)try{n(a,h)}catch(d){this.logger.error('Error in store listener for parent path "'+t+'"',d)}}}}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 e=this.get("address.id")||"",n=this.get("cart.id")||"";if(!e&&!n)return this.logger.debug("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.debug("Session data persisted to localStorage",{addressId:e,cartId:n}),void 0;try{const a=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(a,{p:e,c:n}),this.logger.info("Session data persisted to DB",{userDeviceId:a,addressId:e,cartId:n})}catch(a){this.logger.error("Failed to persist session data to DB",a)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const e=this.get("address.id")||"",n=this.get("cart.id")||"";(e||n)&&(t=e+"_"+n)}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 e=localStorage.getItem(this.localStorageKey);if(!e)return;try{const t=JSON.parse(e);for(const[e,n]of Object.entries(t))this.set(e,n);return}catch(t){if(e.includes("_")){const[t,n]=e.split("_");if(void 0!==t){const e=await this.getAddressDataFromId(t);this.set("address",e)}return void 0!==n&&this.set("cart.id",n||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:e})}}catch(e){this.logger.error("Failed to load persisted state",e),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const e=await this.getAddressDataFromId(t.p);this.set("address",e)}void 0!==t.c&&this.set("cart.id",t.c||null),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(e){this.logger.error("Failed to load session data from DB persistence",e)}}addBeforeUnloadHandler(){window.addEventListener("beforeunload",()=>{this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())})}async getAddressDataFromId(t){if(!t||""===t.trim())return W;try{const e=await this.api.getAddressDetails(t);return e&&0!==Object.keys(e).length?{id:t,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:{lat:e.coords.lat,long:e.coords.long}}:{...W,id:t}}catch(e){return{...W,id:t}}}}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()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}const includeCartEvents=(t,e)=>t.filter(t=>e.includes(t.type)),excludeCartEvents=(t,e)=>t.filter(t=>!e.includes(t.type)),eventsForCart=t=>excludeCartEvents(t,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=t=>{const e=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],n=includeCartEvents(t,e);return n.length>0},includeCheckoutEvents=(t,e)=>t.filter(t=>e.includes(t.type)),eventsForCheckout=t=>includeCheckoutEvents(t,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=t=>includeCheckoutEvents(t,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=t=>includeCheckoutEvents(t,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=t=>{const e=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return t.some(t=>e.includes(t.type))},Q={OutOfStock:"error",ItemsNotAdded:"warning",ItemsRequestedNotAdded:"warning",ItemEngravingError:"error",AddressChange:"warning",LocationAvailability:"warning",PartnerProductConfigs:"warning",RemovedExistingCartItems:"warning",RetailerMinNotMet:"warning",NoItemsInCart:"warning",InvalidId:"warning",NoId:"warning",CartCheckoutProcessed:"success",NewCart:"warning",CartError:"error",ItemQuantityChange:"warning",ItemIdNotFound:"error",ItemsRemoved:"warning",CouponProcessingError:"error",CouponNotFound:"error",CouponExpired:"error",NoApplicableDiscount:"warning",CouponNotStarted:"error",MinimumOrderValueNotMet:"warning",MinimumOrderUnitsNotMet:"warning",MinimumDistinctItemsNotMet:"warning",QuotaExceeded:"error",UserLimitExceeded:"error",NotFirstPurchase:"warning",InvalidCoupon:"error",InvalidMembership:"error",InvalidDomain:"error",InvalidRequirements:"error",InvalidOrganization:"error",ProductNotEligible:"warning",NotEnoughPreviousOrders:"warning",PresaleItemsNotAllowed:"error",PresaleLimitExceeded:"error",PresaleNotStarted:"error",PresaleExpired:"error",PresaleMixedCart:"error",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning"},Z={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:Q[t.type]||"error"})),transformCheckoutEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:Z[t.type]||"error"})),transformEventsForCart=t=>{const e=eventsForCart(t);return transformCartEventsRaw(e)},transformEventsForCheckout=t=>{const e=eventsForCheckout(t);return transformCheckoutEventsRaw(e)},transformPromoCodeCheckoutEvents=t=>{const e=promoCodeCheckoutEvents(t);return transformCheckoutEventsRaw(e)},transformGiftCardCheckoutEvents=t=>{const e=giftCardCheckoutEvents(t);return transformCheckoutEventsRaw(e)};function buildCartItemStore(t){return{id:t.id,variantId:t.variantId,liquidId:t.liquidId,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,salsifyGrouping:t.salsifyGrouping,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,loading:![],updating:![],error:null}}function buildCartTotals(t){return{subtotal:t.subtotal||0,total:t.total||0,shippingFee:t.shippingFee||0,platformFee:t.platformFee||0,giftCardTotal:t.giftCardTotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,discounts:t.discounts||0,quantity:t.quantity||0}}function buildRetailerStore(t){var e;return{id:t.id,name:t.name,platformFee:t.platformFee||0,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,address:t.address,total:t.total||0,deliveryFee:t.deliveryFee||0,engravingFee:t.engravingFee||0,fulfillments:(null===(e=t.fulfillments)||void 0===e?void 0:e.map(t=>t.id))||[]}}function buildFulfillmentStore(t,e){return{id:t.id,canEngrave:t.canEngrave||![],type:t.type,fees:t.fees,expectation:t.expectation,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,items:t.items||[],retailerId:e.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(t,e){var n;const a=e.formattedAddress?e:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},c={};for(const l in t.items||{}){const e=t.items[l];c[l]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,salsifyGrouping:e.salsifyGrouping,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||0,quantity:e.quantity||0,maxQuantity:e.maxQuantity||0,unitPrice:e.unitPrice||0,mainImage:e.mainImage||"",attributes:e.attributes||{}}}return{id:t.id,promoCode:(null===(n=t.promoCode)||void 0===n?void 0:n.code)||"",items:c,location:{placesId:a.id,address:{one:a.address.one,two:a.address.two,city:a.address.city,state:a.address.state,zip:a.address.zip,country:a.address.country},coordinates:{latitude:a.coordinates.lat,longitude:a.coordinates.long}},amounts:{deliveryFee:t.totals.deliveryFee,discounts:t.totals.discounts,engravingFee:t.totals.engravingFee,giftCardTotal:0,platformFee:t.totals.platformFee,shippingFee:t.totals.shippingFee,subtotal:t.totals.subtotal,total:t.totals.total},itemCount:Object.values(c||{}).reduce((t,e)=>t+(e.quantity||0),0),updatedAt:t.updatedAt,createdAt:t.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,e=![]){var a,c,l,d,u,h;const p=this.store.get("cart");for(const n of Object.keys(p.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(p.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(p.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const m={"cart.id":t.id,"cart.error":null,"cart.totals":buildCartTotals(t),"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(c=null===(a=t.attributes)||void 0===a?void 0:a.promoCode)||void 0===c?void 0:c.value)?{code:t.attributes.promoCode.value.toUpperCase(),discountAmount:t.attributes.promoCode.discount||0,error:null}:null};if((null===(l=t.items)||void 0===l?void 0:l.length)>0)for(const n of t.items)m["cart.items."+n.id]=buildCartItemStore(n);if((null===(d=t.retailers)||void 0===d?void 0:d.length)>0)for(const n of t.retailers)if(m["cart.retailers."+n.id]=buildRetailerStore(n),(null===(u=n.fulfillments)||void 0===u?void 0:u.length)>0)for(const t of n.fulfillments)m["cart.fulfillments."+t.id]=buildFulfillmentStore(t,n);if((null===(h=t.events)||void 0===h?void 0:h.length)>0&&(m["cart.events"]=transformEventsForCart(t.events||[])),this.store.batch(m),e){const t=this.store.get("cart"),e=this.store.get("address");this.pubSub.publishAction(n.CART_LOADED,cartDataForEventFromStore(t,e))}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartFromResponse(e,!![]),e.id!==t.id&&await this.store.persist()}catch(t){throw this.store.set("cart.error",(null==t?void 0:t.message)||"Failed to load cart"),this.logger.error("Load cart failed",t),t}finally{this.store.set("cart.loading",![])}}}const $="lce-checkout-stripe-slot",J={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},tt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},et={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};function centToDollar(t){return t/100}function formatCentToDollarText(t,e=!![]){const n=Math.floor(t/100),a=t%100;let c="$"+n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(e||a>0)&&(c+=".",c+=a<10?"0"+a:a.toString()),c}function htmlStringToElement(t){const e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstElementChild}function format24TimeTo12$1(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new Error("Invalid time format: "+t);const n=Number.parseInt(e[1],10),a=Number.parseInt(e[2],10);if(n<0||n>23||a<0||a>59)throw new Error("Invalid time values: "+t);const c=n>=12?"PM":"AM",l=n%12||12;return l+":"+a.toString().padStart(2,"0")+" "+c}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const e=new Date(t);if(Number.isNaN(e.getTime()))return"";const n=(e.getMonth()+1).toString().padStart(2,"0"),a=e.getDate().toString().padStart(2,"0"),c=e.getFullYear().toString();return n+"/"+a+"/"+c}catch(e){return""}}function validateMinimumAge(t,e=21,n=1930){if(!t)return{isValid:![],age:null,error:"Birth date is required"};try{const a=t instanceof Date?t:new Date(t);if(Number.isNaN(a.getTime()))return{isValid:![],age:null,error:"Invalid date format"};const c=new Date;if(a>c)return{isValid:![],age:null,error:"Birth date cannot be in the future"};const l=a.getFullYear();if(l<n)return{isValid:![],age:null,error:"Birth year cannot be before "+n+". Please check your birth date."};const d=calculateAge(a,c);return d<e?{isValid:![],age:d,error:"Must be at least "+e+" years old"}:{isValid:!![],age:d}}catch(a){return{isValid:![],age:null,error:"Error processing birth date"}}}function calculateAge(t,e){let n=e.getFullYear()-t.getFullYear();const a=e.getMonth()-t.getMonth();return(a<0||0===a&&e.getDate()<t.getDate())&&n--,Math.max(0,n)}function buildFormattedAddressString(t){const e=[],n=[];t.one&&t.one.trim()&&n.push(t.one.trim()),t.two&&t.two.trim()&&n.push(t.two.trim()),n.length>0&&e.push(n.join(" ")),t.city&&t.city.trim()&&e.push(t.city.trim());const a=[];return t.state&&t.state.trim()&&a.push(t.state.trim()),t.zip&&t.zip.trim()&&a.push(t.zip.trim()),a.length>0&&e.push(a.join(" ")),t.country&&t.country.trim()&&e.push(t.country.trim()),e.join(", ")}function capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const e=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:e[0]||"",category2:e[1]||"",category3:e[2]||""}}function validateCustomerInfo(t){const e=[J.firstName,J.lastName,J.email,J.phone,J.birthDate];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const a of e){const e=t[a];if(!e||"string"==typeof e&&""===e.trim())n.push(a);else if("birthDate"===a){const t=validateMinimumAge(e,21,1930);t.isValid||n.push(a)}}return{isValid:0===n.length,invalidFields:n}}function validateGiftRecipientInfo(t){const e=[tt.firstName,tt.lastName,tt.email,tt.phone,tt.message];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const a of e){const e=t[a];(!e||"string"==typeof e&&""===e.trim())&&n.push(a)}return{isValid:0===n.length,invalidFields:n}}function validateBillingInfo(t){const e=[et.firstName,et.lastName,et.email,et.phone,et.addressOne,et.city,et.state,et.zipCode];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const a of e){const e=t[a];(!e||"string"==typeof e&&""===e.trim())&&n.push(a)}return{isValid:0===n.length,invalidFields:n}}const nt=[c.PRODUCT,c.PRODUCT_IMAGE_CAROUSEL,c.PRODUCT_OPTIONS,c.PRODUCT_INTERACTIONS,c.PRODUCT_DESCRIPTION,c.PRODUCT_RETAILERS,c.PRODUCT_RETAILERS_CAROUSEL,c.PRODUCT_RETAILERS_POPUP,c.PRODUCT_RETAILERS_POPUP_LIST,c.PRODUCT_PRICE,c.PRODUCT_ADD_TO_CART_SECTION,c.PRODUCT_DRAWER,c.PRODUCT_LOADING,c.ENGRAVING_FORM,c.ENGRAVING_VIEW],it=[c.ADDRESS_INPUT,c.ADDRESS_DISPLAY],ot=[c.CART,c.CART_RETAILER,c.CART_ITEM,c.CART_FOOTER,c.CART_ITEM_QUANTITY_PRICE,c.CART_RETAILER_SUBTOTAL,c.CART_PROMO_CODE,c.CART_HEADER,c.CART_BODY,c.CART_FULFILLMENT,c.BUTTONS_CART_OPEN],rt=[c.CHECKOUT,c.CHECKOUT_INFORMATION_SECTION,c.CHECKOUT_STRIPE_FORM,c.CHECKOUT_PAYMENT_FORM,c.CHECKOUT_BILLING_FORM,c.CHECKOUT_SUMMARY_SECTION,c.CHECKOUT_PROMO_CODE,c.CHECKOUT_GIFT_CARDS,c.CHECKOUT_AMOUNTS,c.CHECKOUT_ITEMS,c.CHECKOUT_COMPLETED,c.CHECKOUT_DELIVERY_INFORMATION_FORM,c.CHECKOUT_BUYER_INFORMATION_FORM,c.CHECKOUT_TIPS,c.CHECKOUT_PC_GC,c.CHECKOUT_ITEM,c.CHECKOUT_ITEM_QUANTITY,c.CHECKOUT_PLACE_ORDER_BUTTON,c.CHECKOUT_HEADER,c.CHECKOUT_PRESALE_COUNTDOWN,c.CHECKOUT_PRESALE_EXPIRED];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,e="swap"){if(!t||0===t.length)return;const n=[...this.defaultFontFamilies,...t],a=n.map(t=>{const e=encodeURIComponent(t.name);return"family="+e+":wght@"+t.weights.join(";")}).join("&"),c="display="+e;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+a+"&"+c,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,e="swap"){const n=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,e),n&&n.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),e=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(!e){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 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: 500;\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 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(--heading-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: "+h.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 /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\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 .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: "+h.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: "+h.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: 500;\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 }\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .address-display-container > button {\n color: var(--primary-color, #1D4ED8);\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 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",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: "+h.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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 flex-direction: column;\n align-items: flex-start;\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: 400;\n line-height: 20px;\n }\n\n .item-shipping-container {\n display: flex;\n flex-wrap: wrap;\n }\n\n .cart-add-personalization-span {\n color: var(--primary-color, #1E40AF);\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 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: 400;\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 }\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 500;\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: 400;\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: 500;\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: "+h.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: "+h.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\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\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--primary-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 }\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: 400;\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: "+h.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-container.no-header .checkout-information-section,\n .checkout-container.no-header .checkout-summary-section {\n padding: 0;\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 }\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-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 margin-top: 20px;\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(--heading-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: 400;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-items: center;\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(--heading-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: 400;\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: "+h.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: 400;\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: 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 .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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--primary-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: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+h.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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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(--heading-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(--heading-font-family, Poppins);\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 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: "+h.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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 width: 64px;\n height: 64px;\n border-radius: var(--card-border-radius, 6px);\n object-fit: cover;\n flex-shrink: 0;}\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 400;\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: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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: 400;\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: 400;\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: 400;\n line-height: 100%;\n text-align: center;\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 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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 > *: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, .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(--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 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: 400;\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: 400;\n line-height: 20px;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #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 .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: 500;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-payment-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-payment-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-payment-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-payment-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-payment-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: 400;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-payment-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-payment-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-payment-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--primary-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: 400;\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: '+h.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\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: 500;\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 .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(--heading-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: "+h.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(--heading-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: 400;\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 display: flex;\n flex-direction: column;\n align-items: flex-start;\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-weight: 400;\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(--primary-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: 400;\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: 400;\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: 400;\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 ',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 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 /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\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(--heading-font-family, Poppins);\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: 400;\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: 8px;\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 gap: 16px;\n flex-direction: row;\n align-items: center;\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 }\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: 400;\n line-height: 20px;\n align-self: stretch;\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: 400;\n line-height: 16px;\n align-self: stretch;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\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 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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\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 gap: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child {\n font-weight: 500;\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(--primary-color, #1E40AF);\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 .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(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\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: 400;\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 gap: 16px;\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 gap: 4px;\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 .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: 400;\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: 400;\n line-height: 20px;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n gap: 16px;\n align-self: stretch;\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: 500;\n line-height: 20px;\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: 500;\n line-height: 20px;\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: 400;\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 }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\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, .dark .pb-lc {\n color: #0F172A;\n }\n\n .dark .pb-text, .dark .pb-lc, .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--heading-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\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: 400;\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: "+h.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: 500;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 400;\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: 400;\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(--primary-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-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: 400;\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: 400;\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: "+h.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 }\n\n .gallery-image {\n width: 60px;\n height: 60px;\n object-fit: cover;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n background: var(--accent-color, #3b82f6);\n opacity: 0.5;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n }\n\n .gallery-image-wrapper.selected .gallery-image {\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 {\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-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(--primary-color, #1E40AF);\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 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: 400;\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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: "+h.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\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-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\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(--primary-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 }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+h.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: 225px;\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 }\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 500;\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 cursor: not-allowed;\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; /* 2 lines * 1.4 line-height */\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-weight:700;\n font-style: normal;\n line-height: 20px;\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; /* 2 lines * 1.4 line-height */\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(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--primary-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 }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\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: 500;\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 max-height: 350px;\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 cursor: not-allowed;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\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 .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 500;\n }\n\n .fulfillments-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";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: "+h.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: "+h.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: "+h.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: "+h.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 /* Image skeleton styles */\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 queries for responsive skeleton images */\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";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(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 400;\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: 400;\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 st={"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",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},at={backgroundColor:"--product-background-color"},ct={backgroundColor:"--cart-background-color"},lt={backgroundColor:"--address-background-color"},dt={backgroundColor:"--checkout-background-color"},ut={global:st,product:at,cart:ct,address:lt,checkout:dt};function getCSSVariableMapping(t){return ut[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,e){const n={},a=getCSSVariableMapping(e);for(const[c,l]of Object.entries(a)){const e=this.getValueByPath(t,c);void 0!==e&&this.isCSSValue(e)&&(n[l]=e,this.isColorVariable(l,e)&&this.generateOpacityVariants(n,l,e))}return n}extractVariablesFromPartialTheme(t,e){const n={},a=getCSSVariableMapping(e);for(const[c,l]of Object.entries(a))if(this.hasValueAtPath(t,c)){const e=this.getValueByPath(t,c);void 0!==e&&this.isCSSValue(e)&&(n[l]=e,this.isColorVariable(l,e)&&this.generateOpacityVariants(n,l,e))}return n}generateCSSVariablesString(t){return Object.entries(t).map(([t,e])=>" "+t+": "+e+";").join("\n")}updateCSSVariablesInStylesheet(t,e){if(0!==Object.keys(e).length)try{const n=this.findOrCreateRule(t);for(const[t,a]of Object.entries(e))n.style.setProperty(t,String(a))}catch(n){this.logger.warn("Failed to update CSS variables")}}getValueByPath(t,e){return e.split(".").reduce((t,e)=>t&&void 0!==t[e]?t[e]:void 0,t)}hasValueAtPath(t,e){const n=e.split(".");let a=t;for(const c of n){if(null==a||!(c in a))return![];a=a[c]}return!![]}findOrCreateRule(t){const e=":host";for(const a of Array.from(t.cssRules))if(a instanceof CSSStyleRule&&a.selectorText===e)return a;const n=t.insertRule(e+" {}");return t.cssRules[n]}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,e,n){for(const a of this.opacityLevels){const c=e+"-"+a.suffix,l=this.addOpacityToHexColor(n,a.value);l&&(t[c]=l)}}isColorVariable(t,e){if("string"!=typeof e)return![];const n=t.toLowerCase().includes("color"),a=/^#[0-9a-f]{3,8}$/i.test(e);return n&&a}addOpacityToHexColor(t,e){if(!t.startsWith("#"))return null;let n=t.slice(1);if(3===n.length&&(n=n.split("").map(t=>t+t).join("")),6!==n.length)return null;const a=Math.round(255*e),c=a.toString(16).padStart(2,"0");return"#"+n+c}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,e){const n=this.cssProcessor.extractVariablesFromTheme(e,t),a=this.cssProcessor.generateCSSVariablesString(n),c=this.getStylesheetStyles(t).join("\n\n"),l=0===a.length?"":":host { "+a+" }",d=("\n "+l+"\n\n "+c+"\n ").trim();this.createStylesheet(t,d)}createStylesheet(t,e){try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(e),this.styleSheets.set(t,n)}else this.styleSheets.set(t,e)}catch(j){this.styleSheets.set(t,e)}}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,e,n){const a=this.styleSheets.get(t);if(a&&"string"!=typeof a){const t=this.cssProcessor.extractVariablesFromPartialTheme(e,n);this.cssProcessor.updateCSSVariablesInStylesheet(a,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];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)}updateComponentGlobalConfigs(t){var e,n;const a=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=a,((null===(e=t.theme)||void 0===e?void 0:e.headingFont)||(null===(n=t.theme)||void 0===n?void 0:n.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")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==nt.indexOf(t)?this.getConfigs("product"):-1!==it.indexOf(t)?this.getConfigs("address"):-1!==ot.indexOf(t)?this.getConfigs("cart"):-1!==rt.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===c.DRAWER){const t=[...e],n=this.stylesheetGenerator.getStylesheet("product"),a=this.stylesheetGenerator.getStylesheet("cart"),c=this.stylesheetGenerator.getStylesheet("checkout"),l=this.stylesheetGenerator.getStylesheet("address");return n&&t.push(n),a&&t.push(a),c&&t.push(c),l&&t.push(l),t}let n;if(it.includes(t)||t===c.ADDRESS)n="address";else if(nt.includes(t)||t===c.PRODUCT)n="product";else if(ot.includes(t)||t===c.CART)n="cart";else{if(!rt.includes(t)&&t!==c.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;n="checkout"}const a=this.stylesheetGenerator.getStylesheet(n);return a?[...e,a]:e}getBaseStylesheets(){const t=[],e=this.stylesheetGenerator.getStylesheet("global"),n=this.stylesheetGenerator.getStylesheet("ui");return e&&t.push(e),n&&t.push(n),t}deepMerge(t,e){const n={...t};for(const a in e)null!==e[a]&&void 0!==e[a]&&("object"!=typeof e[a]||Array.isArray(e[a])||"object"!=typeof t[a]||Array.isArray(t[a])?n[a]=e[a]:n[a]=this.deepMerge(t[a],e[a]));return n}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,e){const a={type:t,data:e||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:a}),t===c.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),t===c.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)===c.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==t?void 0:t.type)===c.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}}function buildCheckoutItemStore(t,e,n){return{liquidId:t.liquidId,variantId:t.variantId,cartItemId:t.cartItemId,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,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,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes,retailerName:e.name,expectationDetail:n.expectation.detail,loading:![],updating:![],error:null}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(t){var e,a,c;try{this.store.set("checkout.loading",!![]);const d=t||this.store.get("cart.id"),u=this.store.get("cart");if(0===(null===(e=Object.values(u.items))||void 0===e?void 0:e.length)&&!t)return;const h=this.themeProvider.getConfigs("checkout"),p={canEmail:h.layout.emailOptIn.checked,canSms:h.layout.smsOptIn.checked};if(!d)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const m={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.readyForSubmit":null,"checkout.isPresaleLocked":![],"checkout.presaleExpiresAt":null,"checkout.events":[],"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,firstName:"",lastName:"",email:"",phone:"",message:""}},f=await this.api.prepareCheckout({cartId:d,marketingPreferences:p});if((null===(a=f.retailers)||void 0===a?void 0:a.length)>0)for(const t of f.retailers)for(const e of t.fulfillments)e.type===l.ON_DEMAND&&(m["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});if((null===(c=f.items)||void 0===c?void 0:c.length)>0){this.store.remove("checkout.items");for(const t of f.items){const e=f.retailers.find(e=>e.id===t.retailerId),n=e.fulfillments.find(e=>e.id===t.fulfillmentId);m["checkout.items."+t.cartItemId]=buildCheckoutItemStore(t,e,n)}}f.isPresaleLocked&&f.presaleExpiresAt&&(m["checkout.isPresaleLocked"]=f.isPresaleLocked,m["checkout.presaleExpiresAt"]=f.presaleExpiresAt),m["checkout.token"]=f.token,m["checkout.cartId"]=f.cartId,m["checkout.customer"]=f.customer,m["checkout.acceptedAccountCreation"]=f.acceptedAccountCreation,m["checkout.billingSameAsShipping"]=f.billingSameAsShipping,m["checkout.hasAgeVerify"]=f.hasAgeVerify,m["checkout.hasSubstitutionPolicy"]=f.hasSubstitutionPolicy,m["checkout.isGift"]=f.isGift,m["checkout.marketingPreferences"]=f.marketingPreferences,m["checkout.giftCards"]=f.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),m["checkout.promoCode"]=f.promoCode.value?{code:f.promoCode.value,discountAmount:f.promoCode.discount}:null,m["checkout.marketingPreferences.canEmail"]=f.marketingPreferences.canEmail,m["checkout.marketingPreferences.canSms"]=f.marketingPreferences.canSms,m["checkout.amounts"]=f.amounts,m["checkout.error"]=null,m["checkout.updating"]=![],m["checkout.events"]=f.events||[],this.store.batch(m),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_LOADED,{cartId:f.cartId})}catch(d){throw this.store.set("checkout.error",d.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:d.message}),d}finally{this.store.set("checkout.loading",![])}}async partialLoadCheckout(t){var e,a,c,d,u;try{let n;if(this.store.set("checkout.updating",!![]),(null==t?void 0:t.cartResponse)?this.commonCommands.syncCartFromResponse(t.cartResponse):await this.commonCommands.loadCart(),null==t?void 0:t.response)n=t.response;else{const a=null!==(e=null==t?void 0:t.cartId)&&void 0!==e?e:this.store.get("checkout.cartId");if(!a)return this.store.set("checkout.error","Cart ID is not provided"),void 0;n=await this.api.prepareCheckout({cartId:a})}const h={"checkout.token":n.token,"checkout.events":transformEventsForCheckout(n.events||[]),"checkout.amounts":n.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":n.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),"checkout.promoCode":(null===(c=null===(a=null==n?void 0:n.promoCode)||void 0===a?void 0:a.value)||void 0===c?void 0:c.trim())?{code:n.promoCode.value,discountAmount:n.promoCode.discount}:null};if((null===(d=n.retailers)||void 0===d?void 0:d.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const t of n.retailers)for(const e of t.fulfillments)e.type===l.ON_DEMAND&&(h["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal})}if((null===(u=n.items)||void 0===u?void 0:u.length)>0){this.store.remove("checkout.items");for(const t of n.items){const e=n.retailers.find(e=>e.id===t.retailerId),a=e.fulfillments.find(e=>e.id===t.fulfillmentId);h["checkout.items."+t.cartItemId]=buildCheckoutItemStore(t,e,a)}}this.store.batch(h),this.validateAndUpdateFormStatus()}catch(h){const t=(null==h?void 0:h.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:t}),h}finally{this.store.set("checkout.updating",![])}}async toggleIsGift(t){const e=this.store.get("checkout.isGift"),a=null!=t?t:!e;this.store.batch({"checkout.isGift":a,"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,email:"",firstName:"",lastName:"",message:null,phone:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{isActive:a})}async toggleBillingSameAsShipping(t){const e=this.store.get("checkout.billingSameAsShipping"),a=null!=t?t:!e;this.store.batch({"checkout.billingSameAsShipping":a,"checkout.billing":{firstName:"",lastName:"",email:"",phone:"",addressOne:"",addressTwo:"",city:"",state:"",zipCode:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:a})}toggleMarketingPreferences(t,e){const a=this.store.get("checkout.marketingPreferences."+t),c=null!=e?e:!a;this.store.set("checkout.marketingPreferences."+t,c),this.pubSub.publishAction(n.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:t,isActive:c})}async getPaymentSession(){try{const t=this.store.get("cart.id"),e=await this.api.getPaymentSession({cartId:t});this.store.set("checkout.payment",{key:e.key,secret:e.secret,paymentMethodId:null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){try{const n=await this.api.confirmPaymentSession(t,e);this.store.batch({"checkout.payment.paymentMethodId":n.id,"checkout.readyForSubmit.payment":!![],"checkout.card":{...n.card}})}catch(n){throw new Error("Failed to confirm payment session. Please try again.")}}async applyPromoCode(t){var e;try{this.googleTagManager.promoCodeAttempt(t);const n=this.dataForCheckoutPrepare(),a=await this.api.prepareCheckout({...n,promoCode:t}),c=0!==a.amounts.discounts,l=null===(e=transformPromoCodeCheckoutEvents(a.events||[]))||void 0===e?void 0:e[0];if(!c)return this.store.set("checkout.promoCodeError",l?l.message:'Code "'+t+'" does not exist'),this.googleTagManager.promoCodeFailed(t,(null==l?void 0:l.message)||"not_applied"),void 0;this.googleTagManager.promoCodeApplied(t,a.amounts.discounts),await this.partialLoadCheckout({response:a})}catch(n){const e=(null==n?void 0:n.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",e),this.googleTagManager.promoCodeFailed(t,e),n}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(j){const e=j.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),j}}async removePromoCode(){var t,e;try{const n=this.dataForCheckoutPrepare(),a=(null===(e=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===e?void 0:e.code)||"",c=await this.api.prepareCheckout({...n,promoCode:""});if(0!==c.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.googleTagManager.promoCodeApplied(a,0),await this.partialLoadCheckout({response:c})}catch(n){const t=(null==n?void 0:n.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.promoCode.code")||"";throw e&&this.googleTagManager.promoCodeFailed(e,t),n}}async applyGiftCard(t){var e;const n=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(n);const t=this.dataForCheckoutPrepare(),a=t.giftCards||[],c=await this.api.prepareCheckout({...t,giftCards:[...a,n]}),l=null===(e=transformGiftCardCheckoutEvents(c.events||[]))||void 0===e?void 0:e[0],d=hasAnyRetailerGiftCardRestriction(c.events||[]);if(l&&(this.store.set("checkout.giftCardError",l.message),!d))return;const u=c.giftCards.find(t=>t.code.toLowerCase()===n.toLowerCase());if(!u)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.googleTagManager.giftCardFailed(n,(null==l?void 0:l.message)||"not_applied"),void 0;this.googleTagManager.giftCardApplied(n,u.applied),await this.partialLoadCheckout({response:c})}catch(a){const t=(null==a?void 0:a.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",t),this.googleTagManager.giftCardFailed(n,t),a}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(j){throw this.store.set("checkout.error",(null==j?void 0:j.message)||"Failed to clear gift card error. Please try again."),j}}async removeGiftCard(t){var e;const n=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare(),a=(null===(e=t.giftCards)||void 0===e?void 0:e.filter(t=>t.toLowerCase()!==n.toLowerCase()))||[],c=await this.api.prepareCheckout({...t,giftCards:a}),l=c.giftCards.find(t=>t.code.toLowerCase()===n.toLowerCase());if(l)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+n),void 0;this.googleTagManager.giftCardApplied(n,0),await this.partialLoadCheckout({response:c})}catch(a){const t=(null==a?void 0:a.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",t),this.googleTagManager.giftCardFailed(n,t),a}}updateCustomerInfo(t,e){try{this.store.set("checkout.customer."+t,e),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{fieldName:t})}catch(a){throw this.store.set("checkout.error",a.message),a}}updateBillingInfo(t,e){try{this.store.set("checkout.billing."+t,e),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,{fieldName:t})}catch(a){throw this.store.set("checkout.error",a.message),a}}updateGiftInfo(t,e){try{this.store.set("checkout.giftRecipient."+t,e),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,{fieldName:t})}catch(a){throw this.store.set("checkout.error",a.message),a}}triggerAddShippingInfoEvent(){var t,e;const n=this.store.get("checkout");if(n.customer.email||n.customer.phone){const a=(null===(t=null==n?void 0:n.customer)||void 0===t?void 0:t.id)||(null===(e=null==n?void 0:n.customer)||void 0===e?void 0:e.email),c={subtotal:centToDollar(n.amounts.subtotal),total_before_discounts:centToDollar(n.amounts.subtotal+n.amounts.tax+n.amounts.shipping+n.amounts.delivery+n.amounts.platform+n.amounts.service),discounts:centToDollar(n.amounts.discounts),gift_cards:centToDollar(n.amounts.giftCards||0),net_total:centToDollar(n.amounts.total)};this.googleTagManager.addShippingInfoWithCustomerData(centToDollar(n.amounts.total),void 0,{phone:n.customer.phone,email:n.customer.email,birth_date:n.customer.birthDate,customer_id:a},c)}}validateAndUpdateFormStatus(){const t=this.store.get("checkout"),e=validateCustomerInfo(t.customer),n=t.isGift?validateGiftRecipientInfo(t.giftRecipient):{isValid:!![],invalidFields:[]},a=t.billingSameAsShipping?{isValid:!![],invalidFields:[]}:validateBillingInfo(t.billing),c=e.isValid&&n.isValid&&a.isValid,l=[...e.invalidFields.map(t=>"customer."+t),...n.invalidFields.map(t=>"giftRecipient."+t),...a.invalidFields.map(t=>"billing."+t)];this.store.batch({"checkout.isFormValid":c,"checkout.invalidFields":l,"checkout.readyForSubmit.customer":e.isValid,"checkout.readyForSubmit.gift":n.isValid,"checkout.readyForSubmit.billing":a.isValid})}async checkoutComplete(){var t;try{const e=this.store.get("checkout"),a=this.store.get("checkout.payment.paymentMethodId");if(!e.token||!a)return;const l=await this.api.checkoutComplete({token:e.token,payment:a}),d=l.legacyOrderNumber||l.referenceId||"N/A";e.isPresaleLocked||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(c.CHECKOUT_COMPLETED,{orderNumber:d,orderTotal:e.amounts.total,cardLast4:e.card.last4,customerEmail:e.customer.email,giftRecipientEmail:(null===(t=e.giftRecipient)||void 0===t?void 0:t.email)||null}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:d,orderTotal:e.amounts.total}),this.googleTagManager.purchase({transaction_id:d,tax:centToDollar(e.amounts.tax||0),shipping:centToDollar(e.amounts.shipping||0),items:[...Object.values(e.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(e.amounts.total),subtotal:centToDollar(e.amounts.subtotal),total_before_discounts:centToDollar(e.amounts.subtotal+e.amounts.tax+e.amounts.shipping+e.amounts.delivery+e.amounts.platform+e.amounts.service),discounts:centToDollar(e.amounts.discounts),gift_cards:centToDollar(e.amounts.giftCards||0),net_total:centToDollar(e.amounts.total)})}catch(e){const t=(null==e?void 0:e.message)||"Checkout complete failed";throw this.store.batch({"checkout.error":t,"checkout.readyForSubmit.prepared":![],"checkout.readyForSubmit.payment":![],"checkout.payment.sendSubmitSignal":![]}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t}),e}finally{this.store.set("checkout.loading",![])}}async startPreparingCheckoutSubmit(){var t,e,a,c;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const l=this.store.get("checkout");this.store.set("checkout.payment.sendSubmitSignal",!![]);const d={cartId:l.cartId,customer:{firstName:l.customer.firstName,lastName:l.customer.lastName,email:l.customer.email,phone:l.customer.phone,birthDate:l.customer.birthDate,company:l.customer.company},...l.isGift&&{giftOptions:{recipient:{email:l.giftRecipient.email,phone:l.giftRecipient.phone,name:l.giftRecipient.firstName+" "+l.giftRecipient.lastName},message:l.giftRecipient.message||""}},...!l.billingSameAsShipping&&(null==l?void 0:l.billing)&&{billingAddress:{firstName:null==l?void 0:l.billing.firstName,lastName:l.billing.lastName,email:l.billing.email,phone:l.billing.phone,company:null!==(t=l.billing.company)&&void 0!==t?t:void 0,city:l.billing.city,state:l.billing.state,zip:l.billing.zipCode,one:l.billing.addressOne,two:l.billing.addressTwo||""}},billingSameAsShipping:l.billingSameAsShipping,acceptedAccountCreation:l.acceptedAccountCreation,hasAgeVerify:l.hasAgeVerify,shippingAddressTwo:null!==(e=l.isGift?l.giftRecipient.addressTwo:l.customer.addressTwo)&&void 0!==e?e:void 0,hasSubstitutionPolicy:l.hasSubstitutionPolicy,isGift:l.isGift,marketingPreferences:l.marketingPreferences,promoCode:(null===(a=l.promoCode)||void 0===a?void 0:a.code)||void 0,giftCards:(null===(c=l.giftCards)||void 0===c?void 0:c.map(t=>t.code))||[],deliveryInstructions:Object.values(l.onDemandFulfillmentTipInfo||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:l.deliveryInstructions||""}))},u=await this.api.prepareCheckout(d);this.store.batch({"checkout.customer":u.customer,"checkout.acceptedAccountCreation":u.acceptedAccountCreation,"checkout.billingSameAsShipping":u.billingSameAsShipping,"checkout.hasAgeVerify":u.hasAgeVerify,"checkout.hasSubstitutionPolicy":u.hasSubstitutionPolicy,"checkout.isGift":u.isGift,"checkout.marketingPreferences":u.marketingPreferences,"checkout.events":u.events||[],"checkout.readyForSubmit.prepared":!![]}),this.triggerAddShippingInfoEvent();const h={subtotal:centToDollar(l.amounts.subtotal),total_before_discounts:centToDollar(l.amounts.subtotal+l.amounts.tax+l.amounts.shipping+l.amounts.delivery+l.amounts.platform+l.amounts.service),discounts:centToDollar(l.amounts.discounts),gift_cards:centToDollar(l.amounts.giftCards||0),net_total:centToDollar(l.amounts.total)};this.googleTagManager.addPaymentInfoWithoutItems(centToDollar(l.amounts.total),"card",void 0,h)}catch(l){const t=(null==l?void 0:l.message)||"Checkout preparation failed";throw this.store.batch({"checkout.error":t,"checkout.loading":![]}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t}),l}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(c.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async focusFirstInvalidField(){try{const t=this.store.get("checkout.invalidFields")||[];if(0===t.length)return;const e=t[0];this.store.set("checkout.focusField",e),setTimeout(()=>{this.store.set("checkout.focusField",null)},100)}catch(t){this.logger.error("Checkout form validation focus operation failed",{error:t instanceof Error?t.message:String(t)})}}buildItemUpdate(t,e){var n,a,c;const l={id:t.cartItemId,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},d=(null===(c=null===(a=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===a?void 0:a.lines)||void 0===c?void 0:c.filter(t=>""!==t.trim()))||[];return d.length>0&&(l.engravingLines=d),l}async updateCheckoutItemQuantity(t,e){try{this.store.set("checkout.items."+t+".updating",!![]);const a=this.store.get("checkout.cartId"),c=this.store.get("checkout.items."+t);if(!c)throw new Error("Item not found");const l=c.quantity,d=c.quantity+e;if(d<1)return this.removeItem(t,!![]);const u=this.buildItemUpdate(c,d),h=await this.api.updateCart({id:a,items:[u],loc:this.getLocation()});this.pubSub.publishAction(e>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:c.cartItemId,quantity:d,previousQuantity:l});const p=splitCategoryPath(c.catPath),m={item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,quantity:Math.abs(e),price:centToDollar(c.unitPrice||0),upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId};e<0?this.googleTagManager.removeFromCart(m):e>0&&this.googleTagManager.addToCart(m),await this.partialLoadCheckout({cartResponse:h})}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,a,c;try{const l=this.store.get("checkout.items."+t);if(!l)throw new Error("Item not found in checkout");if(!(null===(e=l.attributes)||void 0===e?void 0:e.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const d=(null===(c=null===(a=l.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.lines)||[],u={id:l.cartItemId,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:l.quantity,engravingLines:[]},h=this.store.get("checkout.cartId"),p=await this.api.updateCart({id:h,items:[u],loc:this.getLocation()});this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:l.cartItemId,engravingLines:[],previousEngravingLines:d}),await this.partialLoadCheckout({cartResponse:p})}catch(l){throw this.store.set("checkout.items."+t+".error",l.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:l.message}),l}}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("checkout.items."+t+".updating",!![]);const a=this.store.get("checkout.cartId"),c=this.store.get("checkout.items."+t);if(!c)throw new Error("Item not found");const l=this.buildItemUpdate(c,0),d=await this.api.updateCart({id:a,items:[l],loc:this.getLocation()});this.store.remove("checkout.items."+t),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartItemId:c.cartItemId}),await this.partialLoadCheckout({cartResponse:d})}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.onDemandFulfillmentTipInfo")||{},a=Object.values(e).map(e=>{const n=Math.round(e.subtotal*t/100);return{fulfillmentId:e.fulfillmentId,tip:n}}),c=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:a});this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:a})}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 a=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},c=Object.values(a).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===t?e:n.tip})),l={...this.dataForCheckoutPrepare(),deliveryTips:c},d=await this.api.prepareCheckout(l);this.updateStoreFromCheckoutResponse(d),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:c})}catch(a){throw this.store.set("checkout.error",(null==a?void 0:a.message)||"Failed to update fulfillment tip. Please try again."),a}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const e=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},a=Object.values(e).map(e=>({fulfillmentId:e.fulfillmentId,tip:e.fulfillmentId===t?0:e.tip})),c=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:a});this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:a})}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",![])}}updateStoreFromCheckoutResponse(t){var e;const n={"checkout.amounts":t.amounts,"checkout.warning":t.warning,"checkout.events":transformEventsForCheckout(t.events||[]),"checkout.error":null};if((null===(e=t.retailers)||void 0===e?void 0:e.length)>0)for(const a of t.retailers)for(const t of a.fulfillments)t.type===l.ON_DEMAND&&(n["checkout.onDemandFulfillmentTipInfo."+t.id]={retailerId:a.id,retailerName:a.name,fulfillmentId:t.id,tip:t.tip,subtotal:t.subtotal});this.store.batch(n)}async updateStripeFormStatus(t){try{const e=this.store.get("checkout.stripeFormStatus")||{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},n={...e,...t};this.store.set("checkout.stripeFormStatus",n)}catch(e){throw this.logger.error("Error updating Stripe form status",{error:e instanceof Error?e.message:String(e)}),e}}async removeCheckoutError(){this.store.set("checkout.error",null)}async updateDeliveryInstructions(t){this.store.set("checkout.deliveryInstructions",t)}dataForCheckoutPrepare(){var t,e,n;const a=this.store.get("checkout"),c=(null===(t=null==a?void 0:a.customer)||void 0===t?void 0:t.email)?{firstName:a.customer.firstName,lastName:a.customer.lastName,email:a.customer.email,phone:a.customer.phone,birthDate:a.customer.birthDate,company:a.customer.company}:void 0;return{cartId:a.cartId,customer:c,billingSameAsShipping:a.billingSameAsShipping,acceptedAccountCreation:a.acceptedAccountCreation,hasAgeVerify:a.hasAgeVerify,hasSubstitutionPolicy:a.hasSubstitutionPolicy,marketingPreferences:a.marketingPreferences,promoCode:(null===(e=a.promoCode)||void 0===e?void 0:e.code)||void 0,giftCards:(null===(n=null==a?void 0:a.giftCards)||void 0===n?void 0:n.map(t=>t.code))||[]}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.pubSubService=PubSubService.getInstance(),this.commonCommands=CommonCommands.getInstance(),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 a=this.store.get("cart.id"),c=this.store.get("cart.items."+t);if(!c)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+e),new Error("Item not found");const l=c.quantity+e;if(l<1)return this.removeItem(t,!![]);const d=this.buildItemUpdate(c,l),u=await this.api.updateCart({id:a,items:[d],loc:this.getLocation()});this.syncItemsFromApiResponse(u,[t]),this.updateFulfillment(c.fulfillmentId,u),this.syncRetailersFromApiResponse(u),this.syncCartMetaFromApiResponse(u),this.pubSubService.publishAction(e<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{id:c.id,quantity:l,previousQuantity:c.quantity});const h=splitCategoryPath(c.catPath),p={item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:Math.abs(e),price:centToDollar(c.unitPrice||0),upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId};e<0?this.googleTagManager.removeFromCart(p):e>0&&this.googleTagManager.addToCart(p)}catch(a){throw this.store.set("cart.items."+t+".error",a.message),this.logger.error("Failed to update item quantity",a),a}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 a=this.store.get("cart.id"),c=this.store.get("cart.items."+t);if(!c)throw new Error("Item not found");const l={itemId:c.id,fulfillmentId:c.fulfillmentId,retailerId:c.retailerId},d=this.buildItemUpdate(c,0),u=await this.api.updateCart({id:a,items:[d],loc:this.getLocation()});this.syncItemsFromApiResponse(u,[]),this.cleanupAfterItemRemoval(l,u),this.syncCartMetaFromApiResponse(u),this.pubSubService.publishAction(n.CART_ITEM_REMOVED,{id:c.id});const h=splitCategoryPath(c.catPath);this.googleTagManager.removeFromCart({item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:c.quantity,price:centToDollar(c.unitPrice||0),upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId})}catch(a){throw this.store.set("cart.items."+t+".error",a.message),this.logger.error("Failed to remove item",a),a}}async updateItemEngraving(t,e){var a,c,l;try{const d=this.store.get("cart"),u=null===(a=d.items)||void 0===a?void 0:a[t];if(!u)throw new Error("Item not found");this.store.set("cart.items."+t+".updating",!![]);const h={id:u.id,fulfillmentId:u.fulfillmentId,partNumber:u.partNumber,quantity:u.quantity,engravingLines:e},p=await this.api.updateCart({id:d.id||"",items:[h],loc:this.getLocation()});this.syncItemsFromApiResponse(p,[t]),this.syncRetailersFromApiResponse(p),this.syncCartMetaFromApiResponse(p);const m=this.store.get("cart"),f=this.store.get("address");this.pubSubService.publishAction(n.CART_UPDATED,{previous:cartDataForEventFromStore(d,f),current:cartDataForEventFromStore(m,f)}),this.pubSubService.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{id:u.id,engravingLines:e,previousEngravingLines:(null===(l=null===(c=u.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.lines)||[]})}catch(d){throw this.store.set("cart.items."+t+".error",d.message),this.logger.error("Failed to update item engraving",d),d}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var e,a;try{this.store.set("cart.loading",!![]);const c=this.store.get("cart"),l={...c},d=(null===(e=t.engravingLines)||void 0===e?void 0:e.filter(t=>""!==t.trim()))||[],u=d.length>0,h=Object.values(c.items||{}).find(e=>{var n,a,c,l,h;const p=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!p)return![];if(u){const t=(null===(a=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===a?void 0:a.lines)||[];return d.join(",")===t.join(",")}return!(null===(h=null===(l=null===(c=e.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.lines)||void 0===h?void 0:h.length)}),p={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:h?t.quantity+h.quantity:t.quantity};u&&(p.engravingLines=d);const m=await this.api.updateCart({id:c.id||"",items:[p],loc:this.getLocation()}),f=null===(a=m.items)||void 0===a?void 0:a.find(t=>t.fulfillmentId===p.fulfillmentId&&t.partNumber===p.partNumber&&t.upc===p.upc);if(!f)throw new Error("Added item not found in cart response");this.syncItemsFromApiResponse(m,[]);const g=this.store.get("cart.fulfillments."+t.fulfillmentId);g?this.updateFulfillment(t.fulfillmentId,m):this.addNewFulfillmentAndRetailer(t.fulfillmentId,m),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const v=this.store.get("cart"),y=this.store.get("address");this.pubSubService.publishAction(n.PRODUCT_ADD_TO_CART,{...t}),this.pubSubService.publishAction(n.CART_ITEM_ADDED,{id:f.id,upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSubService.publishAction(n.CART_UPDATED,{previous:cartDataForEventFromStore(l,y),current:cartDataForEventFromStore(v,y)});const b=splitCategoryPath(f.catPath);this.googleTagManager.addToCart({item_id:f.liquidId,item_name:f.name,item_brand:f.brand,item_size:f.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,item_type:f.type,item_subtype:f.subType,quantity:f.quantity,price:centToDollar(f.unitPrice||0),upc:f.upc,grouping_id:f.salsifyGrouping,product_id:f.liquidId})}catch(c){throw this.store.set("cart.error",c.message),this.logger.error("Failed to add item to cart",c),c}finally{this.store.set("cart.loading",![])}}async addPresaleItem(t){var e;try{const n={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity};(null==t?void 0:t.engravingLines)&&(null===(e=null==t?void 0:t.engravingLines)||void 0===e?void 0:e.length)>0&&(n.engravingLines=t.engravingLines);const a=await this.api.updateCart({id:"",items:[n],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(a.id)}catch(n){throw this.store.set("cart.error",n.message),this.logger.error("Failed to add presale item to cart",n),n}}async handleGoToCheckout(){var t;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(c.CHECKOUT);const e=this.store.get("cart"),n=(null===(t=e.promoCode)||void 0===t?void 0:t.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(e.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],n)}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",![])}}async applyPromoCode(t){var e,n,a;if(!(null==t?void 0:t.trim()))throw new Error("Promo code is required");const c=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(c);const l=await this.api.updateCart({id:t,items:[],promoCode:c,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(l)),this.store.set("cart.events",transformEventsForCart(l.events||[]));const d=(null===(a=null===(n=null===(e=l.attributes)||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.value)||void 0===a?void 0:a.toLowerCase())===c.toLowerCase();d?(this.store.set("cart.promoCode",{code:c,discountAmount:l.discounts||0}),this.googleTagManager.promoCodeApplied(c,l.discounts||0)):(this.store.set("cart.promoCode",null),this.googleTagManager.promoCodeFailed(c,'Code "'+c+'" does not exist'))}catch(l){const t=(null==l?void 0:l.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",t),this.googleTagManager.promoCodeFailed(c,t),this.logger.error("Failed to apply promo code",l),l}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(e),"cart.promoCode":null}),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 n=this.store.get("cart.promoCode");throw(null==n?void 0:n.code)&&this.googleTagManager.promoCodeFailed(n.code,e),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...V,rerender:!![]}),this.store.set("cart",{...H,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSubService.publishAction(n.CART_RESET,!![])}getDetails(){var t;const e=this.store.get("cart"),n=this.store.get("address"),a=n.id?n:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},c={};for(const l in e.items||{}){const t=e.items[l];c[l]={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||0,quantity:t.quantity||0,maxQuantity:t.maxQuantity||0,unitPrice:t.unitPrice||0,mainImage:t.mainImage||"",attributes:t.attributes||{}}}return{id:e.id,promoCode:(null===(t=e.promoCode)||void 0===t?void 0:t.code)||"",items:c,location:{placesId:a.id,address:{one:a.address.one,two:a.address.two,city:a.address.city,state:a.address.state,zip:a.address.zip,country:a.address.country},coordinates:{latitude:a.coordinates.lat,longitude:a.coordinates.long}},amounts:{deliveryFee:e.totals.deliveryFee,discounts:e.totals.discounts,engravingFee:e.totals.engravingFee,giftCardTotal:e.totals.giftCardTotal,platformFee:e.totals.platformFee,shippingFee:e.totals.shippingFee,subtotal:e.totals.subtotal,total:e.totals.total},itemCount:Object.values(c||{}).reduce((t,e)=>t+(e.quantity||0),0),updatedAt:e.updatedAt,createdAt:e.createdAt}}buildItemUpdate(t,e){var n,a,c;const l={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},d=(null===(c=null===(a=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===a?void 0:a.lines)||void 0===c?void 0:c.filter(t=>""!==t.trim()))||[];return d.length>0&&(l.engravingLines=d),l}syncItemsFromApiResponse(t,e=[]){var n;const a=this.store.get("cart.items")||{},c=new Set((null===(n=t.items)||void 0===n?void 0:n.map(t=>t.id))||[]);for(const d of Object.keys(a))c.has(d)||this.store.remove("cart.items."+d);const l={};for(const d of t.items)0!==e.length&&!e.includes(d.id)&&a[d.id]||(l["cart.items."+d.id]=buildCartItemStore(d));Object.keys(l).length>0&&this.store.batch(l)}syncCartMetaFromApiResponse(t){var e,n;const a={"cart.totals":buildCartTotals(t),"cart.error":null,"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(t.events||[])},c=null===(n=null===(e=t.attributes)||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.value;if(c)a["cart.promoCode"]={code:c.toUpperCase(),discountAmount:t.discounts||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(a["cart.promoCode"]=null)}this.store.batch(a)}syncRetailersFromApiResponse(t){var e;if((null===(e=t.retailers)||void 0===e?void 0:e.length)>0){const e={};for(const n of t.retailers)e["cart.retailers."+n.id]=buildRetailerStore(n);this.store.batch(e)}}updateFulfillment(t,e){var n,a;const c=null===(n=e.retailers)||void 0===n?void 0:n.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t)}),l=null===(a=null==c?void 0:c.fulfillments)||void 0===a?void 0:a.find(e=>e.id===t);l&&c&&this.store.set("cart.fulfillments."+t,buildFulfillmentStore(l,c))}addNewFulfillmentAndRetailer(t,e){var n,a;const c=null===(n=e.retailers)||void 0===n?void 0:n.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t)}),l=null===(a=null==c?void 0:c.fulfillments)||void 0===a?void 0:a.find(e=>e.id===t);if(l&&c){const e={["cart.fulfillments."+t]:buildFulfillmentStore(l,c),["cart.retailers."+c.id]:buildRetailerStore(c)};this.store.batch(e)}}cleanupAfterItemRemoval(t,e){var n,a,c,l;const d=this.store.get("cart.fulfillments."+t.fulfillmentId),u=this.store.get("cart.retailers."+t.retailerId);if(!d||!u)return;const h=null===(n=e.retailers)||void 0===n?void 0:n.some(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t.fulfillmentId)}),p=null===(a=e.retailers)||void 0===a?void 0:a.some(e=>e.id===t.retailerId);if(h){this.updateFulfillment(t.fulfillmentId,e);const n=null===(l=e.retailers)||void 0===l?void 0:l.find(e=>e.id===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(n))}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),p){const n=null===(c=e.retailers)||void 0===c?void 0:c.find(e=>e.id===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(n))}else this.store.remove("cart.retailers."+t.retailerId)}}class ProductCommands extends BaseCommand{constructor(){super(),this.themeProvider=ThemeProviderService.getInstance(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,e=![]){this.store.createProductInstance(t),e&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var e;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,e)=>(t["products."+e+".loading"]=!![],t["products."+e+".error"]=null,t),{}));const n=await this.api.getProductsData(t,this.getLocation());if(!n||!n.products||0===n.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]=!![],t),{})),void 0;const a=[];for(const l of n.products){const c=l.sizes.filter(e=>t.some(t=>t===(e.upc||e.id||l.salsifyGrouping))),d=t.find(t=>c.some(e=>t===e.upc||t===e.id)||t===l.salsifyGrouping),u=d||(null===(e=null==c?void 0:c[0])||void 0===e?void 0:e.upc);await this.loadProduct(u,{products:[l],retailers:n.retailers}),a.push(u)}const c=t.filter(t=>-1===a.indexOf(t));this.store.batch(c.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]="Product data not found",t),{}))}async loadProduct(t,e=null){var a,c;try{const l=this.store.get("products."+t);l.loading||this.store.set("products."+t+".loading",!![]);let d=null;if(e&&(d=e),e||(d=await this.api.getProductsData([t],this.getLocation())),!d||!(null===(a=null==d?void 0:d.products)||void 0===a?void 0:a[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const u=this.loadProductStoreUpdate(d);if(!u)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...u,identifier:t}),this.pubSub.publishAction(n.PRODUCT_LOADED,this.productDataForEventFromStore(t));const h=d.products[0],p=u.sizes[u.selectedSizeId||""],m=Boolean(this.getLocation()),f=u.selectedFulfillment,g=m&&(null==f?void 0:f.price)?f.price:(null===(c=u.priceInfo)||void 0===c?void 0:c.avg)||0,v=splitCategoryPath(h.catPath);this.googleTagManager.viewItem({item_id:null==p?void 0:p.id,item_name:h.name,item_brand:h.brand,item_size:null==p?void 0:p.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar(g),item_type:h.type,item_subtype:h.subType,upc:null==p?void 0:p.upc,grouping_id:h.salsifyGrouping,product_id:null==p?void 0:p.id})}catch(l){throw this.store.set("products."+t+".error",l.message),this.logger.error("Failed to load product data for ID "+t,l),l}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,e){var a,c,d,u,h,p,m;const f=this.store.get("products."+t);let g=f.selectedFulfillmentType;const v=null===(a=f.sizes[e])||void 0===a?void 0:a.shippingFulfillments,y=null===(c=f.sizes[e])||void 0===c?void 0:c.onDemandFulfillments;let b=null,w=null;if(g!==l.SHIPPING||objectValues(v).length)if(g!==l.ON_DEMAND||objectValues(y).length){const t=g===l.SHIPPING?v:y,e=objectValues(t);b=e[0]||null,w=(null==b?void 0:b.fulfillmentId)||null}else{g=l.SHIPPING;const t=objectValues(v);b=t[0]||null,w=(null==b?void 0:b.fulfillmentId)||null}else{g=l.ON_DEMAND;const t=objectValues(y);b=t[0]||null,w=(null==b?void 0:b.fulfillmentId)||null}const S=g===l.SHIPPING?v:y,E=f.sizes[e],P=splitCategoryPath(f.catPath),F=(null==b?void 0:b.price)||(null===(d=f.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==E?void 0:E.id,item_name:f.name,item_brand:f.brand,item_size:null==E?void 0:E.size,item_category:P.category,item_category2:P.category2,item_category3:P.category3,price:centToDollar(F),item_type:f.type,item_subtype:f.subType,upc:null==E?void 0:E.upc,grouping_id:f.salsifyGrouping,product_id:null==E?void 0:E.id});const D=Object.keys(v).length>0,A=Object.keys(y).length>0,_=D||A;if(!_){const t=this.store.get("address");this.googleTagManager.productSizeNoAvailability({productId:null==E?void 0:E.id,productName:f.name,productBrand:f.brand,productCategory:P.category,productCategory2:P.category2,productCategory3:P.category3,productType:f.type,productSubtype:f.subType,productPrice:(null===(u=f.priceInfo)||void 0===u?void 0:u.avg)||0,sizeId:e,sizeName:null==E?void 0:E.size,upc:null==E?void 0:E.upc,groupingId:f.salsifyGrouping,address:(null==t?void 0:t.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||""}:void 0,reason:"No fulfillments available for this size"})}this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:e,size:(null===(h=f.sizes[e])||void 0===h?void 0:h.size)||"",previousSizeId:f.selectedSizeId||"",previousSize:(null===(p=f.sizes[f.selectedSizeId])||void 0===p?void 0:p.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:e,["products."+t+".mainImage"]:(null===(m=f.sizes[e])||void 0===m?void 0:m.image)||null,["products."+t+".productHasAvailability"]:Object.keys(v).length+Object.keys(y).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(S).length),["products."+t+".selectedFulfillmentType"]:g,["products."+t+".selectedFulfillment"]:b,["products."+t+".selectedFulfillmentId"]:w})}async selectFulfillment(t,e){var a,c,d;const u=this.store.get("products."+t),h=null===(a=u.sizes[u.selectedSizeId])||void 0===a?void 0:a.shippingFulfillments,p=null===(c=u.sizes[u.selectedSizeId])||void 0===c?void 0:c.onDemandFulfillments,m=u.selectedFulfillmentType===l.SHIPPING?h:p,f=m[e];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:e,selectedFulfillmentType:u.selectedFulfillmentType,previousFulfillmentId:u.selectedFulfillmentId||"",previousFulfillmentType:u.selectedFulfillmentType});const g=u.sizes[u.selectedSizeId||""],v=splitCategoryPath(u.catPath),y=(null==f?void 0:f.price)||(null===(d=u.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==g?void 0:g.id,item_name:u.name,item_brand:u.brand,item_size:null==g?void 0:g.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar(y),item_type:u.type,item_subtype:u.subType,upc:null==g?void 0:g.upc,grouping_id:u.salsifyGrouping,product_id:null==g?void 0:g.id}),this.store.batch({["products."+t+".selectedFulfillment"]:f,["products."+t+".selectedFulfillmentId"]:e,["products."+t+".quantity"]:1})}async updateQuantity(t,e){var a;const c=this.store.get("products."+t),l=c.quantity,d=l+e,u=1,h=(null===(a=null==c?void 0:c.selectedFulfillment)||void 0===a?void 0:a.stock)||5,p=Math.max(u,Math.min(h,d));this.pubSub.publishAction(e<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:p,previousQuantity:l}),this.store.set("products."+t+".quantity",p)}async changeFulfillmentType(t,e){var a,c,d;const u=this.store.get("products."+t),{shippingFulfillments:h,onDemandFulfillments:p}=u.sizes[u.selectedSizeId],m=e===l.SHIPPING?h:p,f=objectValues(m);if(0===f.length){this.logger.warn("No fulfillments available for type "+e+" on product "+t);const n=this.store.get("address"),l=u.sizes[u.selectedSizeId],d=splitCategoryPath(u.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==l?void 0:l.id,productName:u.name,productBrand:u.brand,productCategory:d.category,productCategory2:d.category2,productCategory3:d.category3,productType:u.type,productSubtype:u.subType,productPrice:(null===(a=u.priceInfo)||void 0===a?void 0:a.avg)||0,sizeId:null!==(c=u.selectedSizeId)&&void 0!==c?c:void 0,sizeName:null==l?void 0:l.size,fulfillmentType:e,upc:null==l?void 0:l.upc,groupingId:u.salsifyGrouping,address:(null==n?void 0:n.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||""}:void 0,reason:"No "+e+" fulfillments available for selected size"}),void 0}const g=f[0]||null,v=(null==g?void 0:g.fulfillmentId)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:e,selectedFulfillmentId:v,previousFulfillmentType:u.selectedFulfillmentType,previousFulfillmentId:u.selectedFulfillmentId,fulfillmentHasAvailability:f.length>0});const y=u.sizes[u.selectedSizeId||""],b=splitCategoryPath(u.catPath),w=(null==g?void 0:g.price)||(null===(d=u.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==y?void 0:y.id,item_name:u.name,item_brand:u.brand,item_size:null==y?void 0:y.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,price:centToDollar(w),item_type:u.type,item_subtype:u.subType,upc:null==y?void 0:y.upc,grouping_id:u.salsifyGrouping,product_id:null==y?void 0:y.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:e,["products."+t+".selectedFulfillment"]:g,["products."+t+".selectedFulfillmentId"]:v,["products."+t+".fulfillmentHasAvailability"]:f.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,e,n){const a={type:e,data:n||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:a})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),e=Object.keys(t);for(const n of e)this.store.set("products."+n+".rerender",!![])}async addToCart(t,e){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(c.CART),await this.cartCommands.addItem(e),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const n=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(n.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,e){try{this.store.set("products."+t+".updating",!![]),await this.cartCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(c.CHECKOUT),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const e=this.store.get("products."+t),n={},fulfillmentEventData=t=>{const e={};for(const n in t){const a=t[n];e[n]={retailerId:a.retailerId,retailerName:a.retailerName,retailerAddress:a.retailerAddress,retailerTimezone:a.timezone,price:a.price,partNumber:a.partNumber,stock:a.stock,isEngravable:a.isVariantEngravable,fulfillmentId:a.fulfillmentId,fulfillmentType:a.fulfillmentType,modalities:a.modalities||[]}}return e};for(const a in e.sizes||{}){const t=e.sizes[a];n[a]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc||"",container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.attributes.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:{engraving:t.attributes.engraving||void 0,presale:t.attributes.presale||void 0},shippingFulfillments:fulfillmentEventData(t.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(t.onDemandFulfillments||{})}}return{identifier:t,selectedSizeId:e.selectedSizeId||null,selectedFulfillmentId:e.selectedFulfillmentId||null,selectedFulfillmentType:e.selectedFulfillmentType,id:e.id,name:e.name,brand:e.brand,catPath:e.catPath,category:e.category,classification:e.classification,type:e.type,salsifyGrouping:e.salsifyGrouping,subType:e.subType,mainImage:e.mainImage||null,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,description:e.description,htmlDescription:e.htmlDescription,tastingNotes:e.tastingNotes,priceInfo:e.priceInfo||null,sizes:n}}findFirstAvailableSize(t){const e=objectValues(t);for(const n of e){const t=n.shippingFulfillments||{},e=n.onDemandFulfillments||{},a=objectValues(t).length,c=objectValues(e).length;if(a+c>0)return n.id}return null}loadProductStoreUpdate(t){var e,n,a,c,d,u,h,p,m,f,g;try{const{products:[v,...y],retailers:b}=t,w=this.themeProvider.getConfigs("product"),S={};let E=![],P=![],F="",D=null,A=w.layout.enableShippingFulfillment?l.SHIPPING:l.ON_DEMAND,_=null,z=null;const O={};if(b&&Array.isArray(b)&&b.length>0)for(const t of b)for(const e of t.fulfillments)O[e.id]={retailerName:t.name,retailerAddress:t.address||null,type:e.type,timezone:e.timezone||"",canEngrave:e.canEngrave||![],expectation:e.expectation,fees:e.fees,hours:e.hours,retailerId:t.id,fulfillmentId:e.id,fulfillmentType:e.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]};if(v.sizes&&Array.isArray(v.sizes)&&v.sizes.length>0)for(const t of v.sizes){const d={},u={};for(const h of t.variants){if((null===(e=null==h?void 0:h.fulfillmentTypes)||void 0===e?void 0:e.onDemand)&&""!==h.fulfillmentTypes.onDemand){const t=h.fulfillmentTypes.onDemand,e=O[t];e?u[t]={...e,isVariantEngravable:h.isEngravable,stock:h.stock,price:h.price,retailerId:h.retailerId,fulfillmentId:t,fulfillmentType:l.ON_DEMAND,modalities:[...e.modalities,...null!==(n=null==h?void 0:h.modalities)&&void 0!==n?n:[]],partNumber:h.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId "+t)}if((null===(a=null==h?void 0:h.fulfillmentTypes)||void 0===a?void 0:a.shipping)&&""!==h.fulfillmentTypes.shipping){const t=h.fulfillmentTypes.shipping,e=O[t];e?d[t]={...e,isVariantEngravable:h.isEngravable,stock:h.stock,price:h.price,retailerId:h.retailerId,fulfillmentId:t,fulfillmentType:l.SHIPPING,modalities:[...e.modalities,...null!==(c=null==h?void 0:h.modalities)&&void 0!==c?c:[]],partNumber:h.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+t)}}S[t.id]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.attributes.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:t.attributes,loading:![],error:null,shippingFulfillments:d,onDemandFulfillments:u}}const M=objectValues(S),L=this.findFirstAvailableSize(S);F=L||M[0]&&M[0].id||"",D=(null===(d=S[F])||void 0===d?void 0:d.image)||null;const R=(null===(u=S[F])||void 0===u?void 0:u.shippingFulfillments)||{},B=(null===(h=S[F])||void 0===h?void 0:h.onDemandFulfillments)||{},q=objectValues(R).length,j=objectValues(B).length;E=q+j>0;const G=A===l.SHIPPING?objectValues(R):objectValues(B);if(P=G.length>0,z=G[0]||null,_=(null==z?void 0:z.fulfillmentId)||null,!P){const t=A===l.SHIPPING?l.ON_DEMAND:l.SHIPPING,e=t===l.SHIPPING?objectValues(R):objectValues(B);e.length>0&&(A=t,z=e[0],_=(null==z?void 0:z.fulfillmentId)||null,P=!![])}if(!E){const t=this.store.get("address"),e=splitCategoryPath(v.catPath),n=S[F];this.googleTagManager.productNoAvailability({productId:null==n?void 0:n.id,productName:v.name,productBrand:v.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:v.type,productSubtype:v.subType,productPrice:(null===(p=v.priceInfo)||void 0===p?void 0:p.average)||0,upc:null==n?void 0:n.upc,groupingId:v.salsifyGrouping,address:(null==t?void 0:t.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||""}:void 0,reason:"No fulfillments available for any size"})}return{identifier:"",id:v.id||"",name:v.name,description:v.description,htmlDescription:v.htmlDescription,images:v.images,priceInfo:{min:(null===(m=v.priceInfo)||void 0===m?void 0:m.minimum)||0,max:(null===(f=v.priceInfo)||void 0===f?void 0:f.maximum)||0,avg:(null===(g=v.priceInfo)||void 0===g?void 0:g.average)||0},brand:v.brand,region:v.region||"",country:v.country||"",material:v.material||"",abv:v.abv||"",proof:v.proof||"",age:v.age||"",color:v.color||"",flavor:v.flavor||"",variety:v.variety||"",appellation:v.appellation||"",vintage:v.vintage||"",tastingNotes:v.tastingNotes||"",catPath:v.catPath,category:v.category,classification:v.classification,type:v.type,subType:v.subType,salsifyGrouping:v.salsifyGrouping,sizes:S,productHasAvailability:E,fulfillmentHasAvailability:P,selectedSizeId:F,mainImage:D,selectedFulfillmentType:A,selectedFulfillmentId:_,selectedFulfillment:z,drawer:{isOpen:![],contentConfig:null},error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(v){throw this.logger.error("Product data processing error",v),v}}}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 e=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(e)),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=buildFormattedAddressString(t),a={id:"",formattedAddress:n,address:t,coordinates:e};await this.setSelectedAddress(a)}catch(a){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country||""},error:(null==a?void 0:a.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:t,coordinates:e,error:(null==a?void 0:a.message)||"Failed to set manual address"}),a}}async clearSelectedAddress(){this.store.set("address",W),this.pubSub.publishAction(n.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart(),await this.store.persist()}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}class ClientActionService{constructor(){this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:t=>this.command.product.productDataForEventFromStore(t)},this.addressActions={setAddressByPlacesId:async t=>{try{if(!t||""===t.trim())throw new Error("Invalid placesId provided");const e=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:e.address,coordinates:e.coords,formattedAddress:e.formattedAddress})}catch(e){throw this.logger.error("Error setting address by placesId:",e),e}},setAddressManually:async(t,e)=>{try{if(!t||!e)throw new Error("Invalid address or coordinates provided");if(!(t.one&&t.city&&t.state&&t.zip))throw new Error("Address must include street address, city, state, and zip code");if("number"!=typeof e.lat||"number"!=typeof e.long)throw new Error("Coordinates must be valid numbers");if(e.lat<-90||e.lat>90)throw new Error("Latitude must be between -90 and 90");if(e.long<-180||e.long>180)throw new Error("Longitude must be between -180 and 180");await this.command.address.setAddressManually(t,e)}catch(n){throw this.logger.error("Error setting manual address:",n),n}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(c.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(c.CART)},addProduct:async(t,e)=>{var a,d;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;const u=this.getLocation();if(void 0===u)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=e?e:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(c.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;e===!![]&&this.command.ui.openDrawer(c.CART);const h=[...new Set(t.map(t=>t.identifier))],p=await this.api.getProductsData(h,u);if(!p||!p.products||0===p.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const e of t){let t=null;for(let a=0;a<p.products.length;a++){const n=p.products[a];let c=![];for(let t=0;t<n.sizes.length;t++){const a=n.sizes[t];if(a.upc===e.identifier||a.id===e.identifier||n.salsifyGrouping===e.identifier){c=!![];break}}if(c){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=t.sizes[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(d=null===(a=null==n?void 0:n.attributes)||void 0===a?void 0:a.presale)||void 0===d?void 0:d.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+e.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let c=null;for(let a=0;a<n.variants.length;a++){const t=n.variants[a];let d=![];if(e.fulfillmentType===l.ON_DEMAND&&(d=!(!t.fulfillmentTypes||!t.fulfillmentTypes.onDemand||""===t.fulfillmentTypes.onDemand)),e.fulfillmentType===l.SHIPPING&&(d=!(!t.fulfillmentTypes||!t.fulfillmentTypes.shipping||""===t.fulfillmentTypes.shipping)),d){c=t;break}}if(!c){this.logger.warn("No supported variant found for product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const u=e.fulfillmentType===l.ON_DEMAND?c.fulfillmentTypes.onDemand:c.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:n.upc,fulfillmentId:u,partNumber:c.partNumber,quantity:e.quantity,identifier:e.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(n.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:h}),this.logger.info("Products added to cart successfully:",h)}catch(u){throw this.logger.error("Error adding products to cart:",u),this.clearPendingCartOperation(),this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:u.message||"Failed to add products to cart"}),u}},applyPromoCode:async t=>{try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const e=t.trim().toUpperCase(),a=this.themeProvider.getConfigs("global"),c=a.layout.allowPromoCodes;if(!c)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const l=this.store.get("cart.promoCode");if(l&&l.code===e)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(e);const d=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{applied:!![],discountAmount:d.amounts.discounts,newTotal:d.amounts.total}),this.logger.info("Promo code applied successfully")}catch(e){throw this.logger.error("Failed to apply promo code:",e),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),e}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),e=t.layout.allowPromoCodes;if(!e)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode(),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(n.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(c.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(c.CHECKOUT)},addProduct:async(t,e)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;e===!![]&&this.command.ui.openDrawer(c.CHECKOUT);const a=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:a}),this.logger.info("Products added to checkout successfully:",a)}catch(a){throw this.logger.error("Error adding products to checkout:",a),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:a.message||"Failed to add products to checkout"}),a}},addPresaleProduct:async t=>{var e,a;try{if(!t||"object"!=typeof t||!t.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;const d=this.getLocation();if(void 0===d)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(c.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const u=await this.api.getProductsData([t.identifier],d);if(!u||!u.products||0===u.products.length)return this.logger.warn("No product data found for the provided presale identifier"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No product found",isPresale:!![]}),void 0;const h=u.products[0],p=h.sizes[0];if(!p)return this.logger.warn("No sizes found for presale product: "+t.identifier),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No sizes found for product",isPresale:!![]}),void 0;if((null===(a=null===(e=null==p?void 0:p.attributes)||void 0===e?void 0:e.presale)||void 0===a?void 0:a.isActive)!==!![])return this.logger.warn("Product is not a presale item: "+t.identifier),this.store.set("checkout.error","Product is not available for presale"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0;let m=null;for(let e=0;e<p.variants.length;e++){const n=p.variants[e];let a=![];if(t.fulfillmentType===l.ON_DEMAND&&(a=!(!n.fulfillmentTypes||!n.fulfillmentTypes.onDemand||""===n.fulfillmentTypes.onDemand)),t.fulfillmentType===l.SHIPPING&&(a=!(!n.fulfillmentTypes||!n.fulfillmentTypes.shipping||""===n.fulfillmentTypes.shipping)),a){m=n;break}}if(!m)return this.logger.warn("No supported variant found for presale product: "+t.identifier+" with fulfillment type: "+t.fulfillmentType),this.store.set("checkout.error","Presale product has no availability"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0;const f=t.fulfillmentType===l.ON_DEMAND?m.fulfillmentTypes.onDemand:m.fulfillmentTypes.shipping;await this.command.cart.addPresaleItem({upc:p.upc,fulfillmentId:f,partNumber:m.partNumber,quantity:t.quantity,engravingLines:[],identifier:t.identifier}),this.command.ui.openDrawer(c.CHECKOUT),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:1,identifiers:[t.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+t.identifier)}catch(d){throw this.logger.error("Error adding presale product to checkout:",d),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:d.message||"Failed to add presale product to checkout",isPresale:!![]}),d}},applyPromoCode:async 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 a=t.trim().toUpperCase(),c=this.themeProvider.getConfigs("global"),l=c.layout.allowPromoCodes;if(!l)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const d=this.store.get("checkout.promoCode");if(d&&d.code===a)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const u=this.store.get("checkout"),h=null==u?void 0:u.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{applied:!![],discountAmount:(null==h?void 0:h.discountAmount)||0,newTotal:(null===(e=null==u?void 0:u.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(a){throw this.logger.error("Failed to apply checkout promo code:",a),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),a}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),e=t.layout.allowPromoCodes;if(!e)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(),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Checkout promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove checkout promo code:",t),t}},applyGiftCard:async t=>{var e;try{const a=this.themeProvider.getConfigs("checkout"),c=a.layout.allowGiftCards;if(!c)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 l=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{applied:!![],newTotal:(null===(e=null==l?void 0:l.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card applied successfully")}catch(a){throw this.logger.error("Failed to apply gift card:",a),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be applied"}),a}},removeGiftCard:async t=>{try{const e=this.themeProvider.getConfigs("checkout"),a=e.layout.allowGiftCards;if(!a)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),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{applied:![]}),this.logger.info("Gift card removed successfully")}catch(e){throw this.logger.error("Failed to remove gift card:",e),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be removed"}),e}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:(t,e)=>{this.command.checkout.toggleMarketingPreferences(t,e)},updateCustomerInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateCustomerInfo(e,n)},updateBillingInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateBillingInfo(e,n)},updateGiftInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateGiftInfo(e,n)},getDetails:()=>{var t,e,n;const a=this.store.get("checkout"),c=a.items||{},l={};for(const[d,u]of Object.entries(c))l[d]={liquidId:u.liquidId,variantId:u.variantId,cartItemId:d,retailerId:u.retailerId,fulfillmentId:u.fulfillmentId,salsifyGrouping:u.salsifyGrouping,name:u.name,catPath:u.catPath,volume:u.volume,uom:u.uom,proof:u.proof,abv:u.abv,containerType:u.containerType,container:u.container,size:u.size,pack:u.pack,packDesc:u.packDesc,mainImage:u.mainImage,brand:u.brand,partNumber:u.partNumber,upc:u.upc,sku:u.sku,price:u.price,unitPrice:u.unitPrice,quantity:u.quantity,unitTax:u.unitTax,bottleDeposits:u.bottleDeposits,attributes:u.attributes,retailerName:u.retailerName,expectationDetail:u.expectationDetail};return{cartId:a.cartId||"",acceptedAccountCreation:a.acceptedAccountCreation,hasAgeVerify:a.hasAgeVerify||![],hasSubstitutionPolicy:a.hasSubstitutionPolicy,isGift:a.isGift||![],billingSameAsShipping:a.billingSameAsShipping,marketingPreferences:{canEmail:(null===(t=a.marketingPreferences)||void 0===t?void 0:t.canEmail)||![],canSms:(null===(e=a.marketingPreferences)||void 0===e?void 0:e.canSms)||![]},hasPromoCode:!!(null===(n=a.promoCode)||void 0===n?void 0:n.code),hasGiftCards:Array.isArray(a.giftCards)&&a.giftCards.length>0,itemCount:Object.values(l||{}).reduce((t,e)=>t+(e.quantity||0),0),amounts:a.amounts,items:l}}},this.actions={product:this.productActions,address:this.addressActions,cart:this.cartActions,checkout:this.checkoutActions},this.store=StoreService.getInstance(),this.command=CommandService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get("ClientAction"),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}setupAddressUpdateListener(){const I=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+n.ADDRESS_UPDATED,I)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,e=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(t,e)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}function componentError({componentType:t,message:e}){const n=document.createElement("div");n.className=t;const a=n.attachShadow({mode:"closed"}),c=document.createElement("style");c.textContent='\n div {\n padding: 10px;\n background-color: #1d4ed81a;\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 l=document.createElement("div"),d=document.createElement("h3");d.textContent="Component </"+t+">";const u=document.createElement("p");return u.textContent=e,l.appendChild(c),l.appendChild(d),l.appendChild(u),a.appendChild(l),n}function productionComponentError({title:t,message:e,componentType:n}){const a=document.createElement("div");a.setAttribute("data-component-type",n);const c=a.attachShadow({mode:"closed"}),l=document.createElement("style");l.textContent="\n div {\n padding: 20px;\n background-color: #1d4ed81a;\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 d=document.createElement("div"),u=document.createElement("h2");u.textContent=t;const h=document.createElement("p");return h.textContent=e,d.appendChild(l),d.appendChild(u),d.appendChild(h),c.appendChild(d),a}class ComponentFactoryService{static get logger(){return ComponentFactoryService.t||(ComponentFactoryService.t=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.t}static get clientConfig(){return ComponentFactoryService.i||(ComponentFactoryService.i=ClientConfigService.getInstance()),ComponentFactoryService.i}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(t,e){ComponentFactoryService.getComponentRegistry().set(t,e)}static createElement(t){try{const e=ComponentFactoryService.getComponentRegistry().get(t.type);if(!e)throw new Error("Component type ["+t.type+"] is not registered");const n=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(n)||window.customElements.define(n,e);const a=document.createElement(n);if(a.initialize){const{type:e,useShadowDom:c,wrapInLceElement:l,...d}=t,u={type:e,tagName:n,useShadowDom:c&&l!==!![]};a.initialize({data:d,config:u})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(c.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(c.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const l=document.createElement(n);return l.initialize(t.type,a),l}return a}catch(e){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",e),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==e?void 0:e.message)||e})}}static componentError({componentType:t,message:e}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+e),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:e})}static getComponentTagName(t){const e={[c.DRAWER]:"drawer-lc",[c.INPUT]:"input-lc",[c.BIRTHDATE_INPUT]:"birthdate-input-lc",[c.ENGRAVING_FORM]:"engraving-form-lc",[c.ENGRAVING_VIEW]:"engraving-view-lc",[c.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[c.POWERED_BY]:"powered-by-lc",[c.LCE_ELEMENT]:"lce-element",[c.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[c.ALERT]:"alert-lc",[c.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[c.ADDRESS]:"address-lc",[c.ADDRESS_INPUT]:"address-input-lc",[c.ADDRESS_DISPLAY]:"address-display-lc",[c.PRODUCT]:"product-lc",[c.PRODUCT_OPTIONS]:"product-options-lc",[c.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[c.PRODUCT_INTERACTIONS]:"product-interactions-lc",[c.PRODUCT_DESCRIPTION]:"product-description-lc",[c.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[c.PRODUCT_RETAILERS]:"product-retailers-lc",[c.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[c.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[c.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[c.PRODUCT_PRICE]:"product-price-lc",[c.PRODUCT_DRAWER]:"product-drawer-lc",[c.PRODUCT_LOADING]:"product-loading-lc",[c.CART]:"cart-lc",[c.CART_RETAILER]:"cart-retailer-lc",[c.CART_ITEM]:"cart-item-lc",[c.CART_FOOTER]:"cart-footer-lc",[c.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[c.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[c.CART_PROMO_CODE]:"cart-promo-code-lc",[c.CART_HEADER]:"cart-header-lc",[c.CART_BODY]:"cart-body-lc",[c.CART_FULFILLMENT]:"cart-fulfillment-lc",[c.CHECKOUT]:"checkout-lc",[c.CHECKOUT_INFORMATION_SECTION]:"checkout-information-section-lc",[c.CHECKOUT_PAYMENT_FORM]:"checkout-payment-form-lc",[c.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[c.CHECKOUT_BILLING_FORM]:"checkout-billing-form-lc",[c.CHECKOUT_SUMMARY_SECTION]:"checkout-summary-section-lc",[c.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[c.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[c.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[c.CHECKOUT_ITEMS]:"checkout-items-lc",[c.CHECKOUT_COMPLETED]:"checkout-completed-lc",[c.CHECKOUT_DELIVERY_INFORMATION_FORM]:"checkout-delivery-information-form-lc",[c.CHECKOUT_BUYER_INFORMATION_FORM]:"checkout-buyer-information-form-lc",[c.CHECKOUT_TIPS]:"checkout-tips-lc",[c.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[c.CHECKOUT_ITEM]:"checkout-item-lc",[c.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[c.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[c.CHECKOUT_HEADER]:"checkout-header-lc",[c.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[c.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc"};return e[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;const ht="\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 gap: 2px;\n flex: 1;\n margin: 0 12px;\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 gap: 12px;\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 .toggle {\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\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 gap: 8px;\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: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 gap: 2px;\n min-width: 50px;\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 gap: 8px;\n flex-wrap: wrap;\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 gap: 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 gap: 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",pt="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,e=t.instances;if(e)for(const[a,c]of e)this.interceptLoggerInstance(c,a);const n=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const e=n(t);return this.interceptLoggerInstance(e,t),e}}interceptLoggerInstance(t,e){if(t.o)return;const n=t.debug.bind(t),a=t.info.bind(t),c=t.warn.bind(t),l=t.error.bind(t),k=(t,n,a)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:n,data:a,context:e});t.debug=(t,e)=>{n(t,e),this.addLogEntry(k("debug",t,e))},t.info=(t,e)=>{a(t,e),this.addLogEntry(k("info",t,e))},t.warn=(t,e)=>{c(t,e),this.addLogEntry(k("warn",t,e))},t.error=(t,e)=>{l(t,e),this.addLogEntry(k("error",t,e))},t.o=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),e=t.publishAction.bind(t);t.publishAction=(t,n)=>{e(t,n),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:n,context:"PubSub"})};const n=t.publishForm.bind(t);t.publishForm=(t,e)=>{n(t,e),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:e,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),e=t.executeEvent.bind(t);t.executeEvent=(t,n,a)=>{e(t,n,a),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+n,data:a,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 e=this.createLogElement(t);this.logContainer.appendChild(e)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(pt);t&&t.remove(),this.panelElement=document.createElement(pt);const e=window.innerWidth<=768,n=window.innerWidth<=480;n?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):e?(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"}),e=document.createElement("style");e.textContent=ht,t.appendChild(e),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const n=this.createHeader();this.panelContainer.appendChild(n);const a=this.createToggles();this.panelContainer.appendChild(a),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const c=this.createResizeHandle();this.panelContainer.appendChild(c),t.appendChild(this.panelContainer),this.setupShadowEventListeners(t)}createHeader(){const t=document.createElement("div");t.className="header",t.title="Drag to move panel";const e=document.createElement("div");e.className="icon",e.innerHTML="🔍",e.title="Elements Debug Console",e.style.cursor="help";const n=document.createElement("div");n.className="title-container";const a=document.createElement("div");a.className="title",a.textContent="Elements Debug Console";const c=document.createElement("div");c.className="subtitle",c.textContent="Live SDK logs, events & GTM tracking",n.appendChild(a),n.appendChild(c);const l=document.createElement("button");return l.className="minimize",l.innerHTML="−",l.title="Minimize debug panel",l.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(e),t.appendChild(n),t.appendChild(l),t}createToggles(){const t=document.createElement("div");t.className="toggles";const e=[{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"}];e.forEach(({key:e,label:n,description:a,color:c})=>{const l=document.createElement("label");l.className="toggle",l.title=a;const d=document.createElement("input");d.type="checkbox",d.checked="showLogs"!==e,d.addEventListener("change",t=>{const n=t.target;"showEvents"===e&&(this.showEvents=n.checked),"showGtmEvents"===e&&(this.showGtmEvents=n.checked),"showLogs"===e&&(this.showLogs=n.checked),this.renderLogs()});const u=document.createElement("span");u.textContent=n,u.style.color=c,l.appendChild(d),l.appendChild(u),t.appendChild(l)});const n=document.createElement("button");return n.className="clear-btn",n.innerHTML="🗑️",n.title="Clear all logs",n.addEventListener("click",()=>this.clearLogs()),t.appendChild(n),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let e=![],n=0,a=0,c=0,l=0;t.addEventListener("mousedown",t=>{e=!![],n=t.clientX,a=t.clientY,c=Number.parseInt(this.panelElement.style.width,10)||500,l=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",x),document.addEventListener("mouseup",s),t.preventDefault()});const x=t=>{if(!e||!this.panelElement)return;const d=t.clientX-n,u=t.clientY-a,h=window.innerWidth<=768,p=window.innerWidth<=480;let m,f,g,v;p?(m=280,f=window.innerWidth-20,g=200,v=.4*window.innerHeight):h?(m=300,f=window.innerWidth-30,g=200,v=.4*window.innerHeight):(m=300,f=800,g=200,v=600);const y=Math.max(m,Math.min(f,c+d)),b=Math.max(g,Math.min(v,l+u));this.panelElement.style.width=y+"px",this.panelElement.style.height=b+"px"},s=()=>{e=![],document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",s)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const e=t.querySelector(".header");if(e){let t=![],n=0,a=0,c=0,l=0;e.addEventListener("mousedown",e=>{if(e.target.classList.contains("minimize"))return;t=!![],n=e.clientX,a=e.clientY;const d=this.panelElement.getBoundingClientRect();c=d.left,l=d.top,document.addEventListener("mousemove",x),document.addEventListener("mouseup",s),e.preventDefault()});const x=e=>{if(!t||!this.panelElement)return;const d=e.clientX-n,u=e.clientY-a;this.panelElement.style.left=c+d+"px",this.panelElement.style.top=l+u+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},s=()=>{t=![],document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",s)}}}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 e=document.createElement("div");e.className="log-entry "+t.type+" "+t.level;const n=new Date(t.timestamp).toLocaleTimeString();return e.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+n+'</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 ",e}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(e){return String(t)}}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}}class FingerPrintService{constructor(){this.keyPrefix=G,this.isLocalStorageAvailable=null,this.cachedFingerprint=null}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.l()){const e=this.u(t);if(e)return this.h(t,e)}this.cachedFingerprint||(this.cachedFingerprint=this.m());const e=this.h(t,this.cachedFingerprint);if(this.l())try{const t=this.keyPrefix+"_"+e;localStorage.setItem(t,Date.now().toString())}catch(n){}return e}getFingerprintData(){return{screen:this.v(),browser:this.C(),timezone:this.k()}}isLocalStorageWebApiAvailable(){return this.l()}h(t,e){return(t+"_"+e).toLowerCase()}l(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{if(0,!("localStorage"in window))return this.isLocalStorageAvailable=![],![];if(void 0===window.localStorage||null===window.localStorage)return this.isLocalStorageAvailable=![],![];if("object"!=="object".localStorage)return this.isLocalStorageAvailable=![],![];const e=["setItem","getItem","removeItem","clear"];for(const t of e)if("function"!=="object".localStorage[t])return this.isLocalStorageAvailable=![],![];const n="__localStorage_test_"+Date.now()+"__",a="test";window.localStorage.setItem(n,a);const c=window.localStorage.getItem(n);if(c!==a)return this.isLocalStorageAvailable=![],![];window.localStorage.removeItem(n);try{const t="__quota_test__",e="x".repeat(100);window.localStorage.setItem(t,e),window.localStorage.removeItem(t)}catch(t){this.S()&&console.warn("localStorage has quota limitations in webview environment")}return this.isLocalStorageAvailable=!![],!![]}catch(e){if(this.isLocalStorageAvailable=![],e instanceof DOMException){const t={QuotaExceededError:"Storage quota exceeded",SecurityError:"Access denied due to security policies",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage"},n=t[e.name]||"Storage error: "+e.name,a=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+a+": "+n)}return![]}}u(t){try{const e=this.keyPrefix+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(null==n?void 0:n.startsWith(e)){const t=n.substring(e.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(e){return null}}m(){const t=this.getFingerprintData(),e=Object.keys(t).sort().map(e=>e+":"+t[e]).join("|");return this.T(e)}v(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,a=this.I(),c=Math.round(100*(window.devicePixelRatio||1));return e+"|"+n+"|"+a+"|"+c}catch(t){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(j){}return"srgb"}C(){var t;try{const e=navigator,n=[],a=((null===(t=e.languages)||void 0===t?void 0:t[0])||e.language||"en").substring(0,2);n.push(a),n.push(e.hardwareConcurrency||4);const c=(e.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);n.push(c),n.push(e.cookieEnabled?"1":"0"),n.push(e.maxTouchPoints||0),n.push(e.deviceMemory||0),n.push(this.P()),n.push(this.S()?"webview":"browser");const l=["bluetooth"in e?"1":"0","usb"in e?"1":"0","mediaDevices"in e?"1":"0","permissions"in e?"1":"0","credentials"in e?"1":"0","storage"in e?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return n.push(l.join("")),n.join("|")}catch(e){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}P(){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(),e=navigator,n=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return n.some(e=>t.includes(e))?!![]:void 0===e.standalone||e.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}k(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}T(t){const e=16777619;let n=2166136261,a=2166136261,c=2166136261,l=2166136261;for(let d=0;d<t.length;d++){const u=t.charCodeAt(d);n^=u,n=Math.imul(n,e),a^=u<<1,a=Math.imul(a,e),c^=u<<2,c=Math.imul(c,e),l^=u<<3,l=Math.imul(l,e)}return n=Math.abs(n),a=Math.abs(a),c=Math.abs(c),l=Math.abs(l),n.toString(16)+a.toString(16)+c.toString(16)+l.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();const t=this.clientConfig.get("env"),n=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!![],endpoint:n,batchSize:t===e.PRODUCTION?5:10,batchInterval:t===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(t,e,n={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const a=Date.now(),c="event_"+a+"_"+Math.random().toString(36).slice(2,11);try{const l={eventId:c,timestamp:a,level:t,message:e,context:n.context,error:n.error?this.buildErrorContext(n.error):void 0,component:n.component,data:n.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(l)}catch(l){this.handleInternalError(l)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code,statusCode:t.status||t.statusCode}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![]}}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 e=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const n=this.createBatch(e);try{this.sendBatch(n),this.stats.batchesSent++}catch(a){this.stats.failedBatches++,this.handleInternalError(a),this.eventQueue.unshift(...e),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const e=Date.now(),n="batch_"+e+"_"+Math.random().toString(36).slice(2,9);return{batchId:n,timestamp:e,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const e=new Blob([JSON.stringify(t)],{type:"text/plain"}),n=navigator.sendBeacon(this.config.endpoint,e);if(n)return}catch(e){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const e=new XMLHttpRequest;if(e.open("POST",this.config.endpoint,![]),e.setRequestHeader("Content-Type","text/plain"),e.send(JSON.stringify(t)),e.status<200||e.status>=300)throw new Error("XHR request failed with status: "+e.status)}catch(e){throw new Error("Both sendBeacon and XHR failed: "+e.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(e){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:e}){var n;this.F=Object.freeze(t),this.D=Object.freeze({type:e.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(n=null==e?void 0:e.useShadowDom)&&void 0!==n?n:![]}),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 e=/\{([^}]+)}/g;return t.replace(e,(e,n)=>{const a=this.F[n];return null==a?(this.logger.warn('Parameter "'+n+'" not found in component params for path "'+t+'"'),e):String(a)})}connectedCallback(){var t,e;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.D.useShadowDom?this.attachShadow({mode:this.clientConfig.isDevelopment()?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component connectedCallback error in "+((null===(e=this.D)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"connectedCallback")}}disconnectedCallback(){var t,e;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component disconnectedCallback error in "+((null===(e=this.D)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"disconnectedCallback")}}setup(){var t,e,n;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(e=this.beforeConnected)||void 0===e||e.call(this)}catch(a){this.logger.error("Component setup error in "+((null===(n=this.D)||void 0===n?void 0:n.tagName)||"unknown"),a),a instanceof Error&&this.captureComponentError(a,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const e of this.unsubscribers)try{e()}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 e=this.reactiveOptions.autoDestroyPath;if(!e&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(e=this.reactiveOptions.watchStorePaths[0]),!e)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const n=this.interpolatePath(e),a=this.store.watch(n,(t,e)=>{this.isDestroyed||void 0===t&&void 0!==e&&this.handleAutoDestroy(n)});this.unsubscribers.push(a),this.logger.debug("🔥 AutoDestroy enabled for "+this.D.tagName+" watching path: "+n)}handleAutoDestroy(t){var e;if(this.isDestroyed)return;this.logger.debug("🔥 AutoDestroy triggered for "+this.D.tagName+' - path "'+t+'" was removed'),null===(e=this.beforeAutoDestroy)||void 0===e||e.call(this,t);const n=this.reactiveOptions.autoDestroyDelay||0;n>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},n):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(e){this.logger.error("Error during auto-destroy of "+this.D.tagName,e),e instanceof Error&&this.captureComponentError(e,"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 e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;const n=t.map(t=>t.path).join(", "),a="store:["+n+"]",c=null===(e=this.onStoreChanged)||void 0===e?void 0:e.call(this,t);c!==![]&&this.triggerRender(a)}catch(a){this.logger.error("Store watcher callback error in "+((null===(n=this.D)||void 0===n?void 0:n.tagName)||"unknown"),a),a instanceof Error&&this.captureComponentError(a,"storeWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Store watchers setup error in "+((null===(t=this.D)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"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 e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;null===(e=this.onStoreWatch)||void 0===e?void 0:e.call(this,t)}catch(a){this.logger.error("Non-rendering watcher callback error in "+((null===(n=this.D)||void 0===n?void 0:n.tagName)||"unknown"),a),a instanceof Error&&this.captureComponentError(a,"nonRenderingWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.D)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"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,e;if(!this.initialized||this.isDestroyed)return;const n=performance.now();this.renderCount++;try{const e=this.template();"string"==typeof e&&(this.container.innerHTML=e),e instanceof HTMLElement&&safeReplaceChildren(this.container,e),Array.isArray(e)&&safeReplaceChildren(this.container,...e);const c=performance.now()-n;this.logRenderInfo(c);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(a){this.logger.error("❌ afterRender hook error in "+this.D.tagName,a),a instanceof Error&&this.captureComponentError(a,"afterRender")}}catch(c){const t=performance.now()-n;this.logger.error("❌ Component render error in "+this.D.tagName,c),this.captureComponentError(c,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.D.type,message:c instanceof Error?c.message:String(c)}));try{null===(e=this.onError)||void 0===e?void 0:e.call(this,c,"render")}catch(l){this.logger.error("❌ onError hook error in "+this.D.tagName,l)}}}logRenderInfo(t){const e=this.D.type,n=this.D.tagName,a=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+a+" "+e+" </"+n+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&(this.logger.warn("⚠️ Slow render in "+e+"("+n+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:t,threshold:16,componentType:e,tagName:n,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+n+":performance",component:{type:e,tagName:n,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.D.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,e,n){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.D.tagName+":"+e,component:{type:this.D.type,tagName:this.D.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this.D.useShadowDom}})}catch(a){}}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}}addHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}removeHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.remove(...e)}toggleHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const n of e)this.classList.toggle(n)}addHostAttribute(t,e){t&&"string"==typeof t&&e&&"string"==typeof e&&(this.setAttribute(t,String(e)),this.hostAttributes[t]=String(e))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[e,n]of Object.entries(t))e&&"string"==typeof e&&n&&"string"==typeof n&&this.setAttribute(e,String(n))}get params(){return this.F}get config(){return this.themeProvider.getComponentConfig(this.D.type)}get elementConfig(){return this.D}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,e){return this.store.set(t,e)}watchStore(t,e){const n=this.store.watch(t,e);return this.unsubscribers.push(n),n}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const e=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:c.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,a;const l=this.getStoreValue("address"),d=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],u=null!==(e=this.params.productId)&&void 0!==e?e:"",h=null!==(n=this.params.options)&&void 0!==n?n:{},p=null!==(a=h.showLabel)&&void 0!==a?a:!![],m=[];if(p){const t=document.createElement("span");t.textContent="Delivers to:",m.push(t)}const f=document.createElement("button");f.type="button",f.textContent=l.formattedAddress||"Select an address";const g=l.formattedAddress?"Change delivery address, currently set to "+l.formattedAddress:"Select delivery address";return f.setAttribute("aria-label",g),f.addEventListener("click",async()=>{if(d)return this.commands.ui.openDrawer(c.ADDRESS_INPUT,{productId:u,isIndependentComponent:!![]}),void 0;!d&&u&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(c.ADDRESS_INPUT,{productId:u}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(u,c.ADDRESS_INPUT,{productId:u}))}),m.push(f),m}}const ArrowRightIcon=({width:t=16,height:e=16,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="arrow-right-icon '+n+'" style="'+c+'" 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 '},BagIcon=({width:t=24,height:e=24,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 489 489" class="bag-icon '+n+'" style="'+c+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckboxIcon=({width:t=16,height:e=16,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="checkbox-icon '+n+'" style="'+c+'" 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:e=16,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+c+'" 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:e=16,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="chevron-left-icon '+n+'" style="'+c+'" 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:e=16,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="close-icon '+n+'" style="'+c+'" 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:e=16,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="error-info-icon '+n+'" style="'+c+'" 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:e=16,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="info-icon '+n+'" style="'+c+'" 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 '},SearchIcon=({width:t=16,height:e=16,className:n="",color:a=null})=>{const c=a||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="search-icon '+n+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+c+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:e=16,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="success-icon '+n+'" style="'+c+'" 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:e=16,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="trash-icon '+n+'" style="'+c+'" 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:e=16,className:n="",color:a=null})=>{const c=a?"--icon-color: "+a:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="warning-icon '+n+'" style="'+c+'" 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 AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const e=t.target,n=e.value.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const a=/^\d/.test(n);if(n.length<this.minSearchLength||!a)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(n)},300)},this.closeDrawer=async()=>{const t=this.params.productId,e=this.clientConfig.isMobile(),n=this.isIndependentComponent();(e||n)&&this.commands.ui.closeDrawer(),!e&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(j){this.logger.error("Address edit cancellation failed",j)}},this.handleCheckAvailability=async()=>{if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const t=this.getStoreValue("address"),e=(null==t?void 0:t.coordinates.lat)!==this.selectedAddress.coordinates.lat||(null==t?void 0:t.coordinates.long)!==this.selectedAddress.coordinates.long;e&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(t){this.logger.error("Address selection and availability check failed",t),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async t=>{const e=t.currentTarget.dataset.suggestionId;if(e)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(e);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:e,address:t.address,coordinates:t.coords,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(n){this.logger.error("Address details retrieval failed",n),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=t=>{this.container.contains(t.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const t=this.getStoreValue("address");(null==t?void 0:t.formattedAddress)&&(this.selectedAddress=t)}async searchAddresses(t){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const e=await this.commands.address.searchAddresses(t);this.suggestions=e.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(e){this.logger.error("Address search operation failed",e),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const t=this.errorContainer.querySelector(".error-text");t&&(t.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const t=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(t),void 0}for(const t of this.suggestions){const e=this.createElement("li",{className:"suggestion-item"}),n=this.createElement("span",{textContent:t.description});e.appendChild(n),e.setAttribute("data-suggestion-id",t.id),e.setAttribute("role","option"),e.setAttribute("aria-label","Select address: "+t.description),e.setAttribute("tabindex","0"),e.addEventListener("click",this.handleSuggestionClick),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())}),this.suggestionsContainer.appendChild(e)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,e){const n=document.createElement(t);return e&&Object.assign(n,e),n}createErrorContainer(){const t=this.createElement("div",{className:"error-message"});t.style.display="none",t.setAttribute("role","alert"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true");const e=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),n=this.createElement("span",{className:"error-text"});return t.appendChild(e),t.appendChild(n),t}createCheckButton(){const t=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return t.setAttribute("aria-label","Save and check address availability"),t.addEventListener("click",this.handleCheckAvailability),t}createCancelButton(){const t=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return t.setAttribute("aria-label","Cancel address selection"),t.addEventListener("click",this.handleCancel),t}template(){var t,e,n;const a=this.getConfigs("global"),c=null!==(t=this.params.options)&&void 0!==t?t:{},l=null!==(e=c.showLabel)&&void 0!==e?e:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),l){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const d=this.createElement("div",{className:"input-wrapper "+a.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(n=this.selectedAddress)||void 0===n?void 0:n.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),d.appendChild(this.inputElement);const u=this.createElement("span");u.className="input-icon",u.innerHTML=SearchIcon({width:16,height:16,className:""}),d.appendChild(u),this.inputContainer.appendChild(d),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const h=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),p=[this.inputContainer,h,this.errorContainer],m=this.createElement("div",{className:"action-buttons"}),f=this.createCancelButton();m.appendChild(f);const g=this.createCheckButton();return m.appendChild(g),p.push(m),document.addEventListener("click",this.handleDocumentClick),p}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const t=[],e=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!e){const e=ComponentFactoryService.createElement({type:c.CART_HEADER});t.push(e)}const n=ComponentFactoryService.createElement({type:c.CART_BODY});t.push(n);const a=ComponentFactoryService.createElement({type:c.CART_FOOTER});return t.push(a),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=document.createElement("div");t.className="empty-cart-container";const e=document.createElement("h3");return e.className="empty-cart-content",e.textContent="Your cart is empty",t.appendChild(e),t}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" 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 </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:c.CART_RETAILER,retailerId:t.id})}catch(e){return this.logger.error("Cart retailer component creation failed",e),document.createElement("div")}}getRetailerElementById(t){return this.container.querySelector('[data-retailer-id="'+t+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const t=this.createEmptyCartElement();this.container.appendChild(t),this.setupEmptyCartListeners()}addLoadingOverlay(){const t=this.getLoadingElement();if(!t){const t=this.createLoadingElement();this.container.appendChild(t)}}removeLoadingOverlay(){const t=this.getLoadingElement();t&&t.remove()}setupEmptyCartListeners(){const t=this.container.querySelector('[data-action="continue-shopping"]');t&&t.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(t,e){const n=this.createRetailerElement(e);n.setAttribute("data-retailer-id",t),this.container.appendChild(n)}removeRetailerElement(t){const e=this.getRetailerElementById(t);e&&e.remove()}updateRetailerElement(t,e){const n=this.getRetailerElementById(t);if(n){const a=this.createRetailerElement(e);a.setAttribute("data-retailer-id",t),n.replaceWith(a)}}hasRetailerDataChanged(t,e){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const e={};for(const[n,a]of Object.entries(t))a&&"object"==typeof a&&a.id&&(e[n]=a);return e}getValidRetailerIds(t){const e=this.getValidRetailers(t);return new Set(Object.keys(e))}onStoreChanged(t){const e=t.find(t=>"cart.retailers"===t.path),n=t.find(t=>"cart.loading"===t.path);if(e){const t=this.getValidRetailers(e.oldValue),n=this.getValidRetailers(e.value),a=this.getValidRetailerIds(e.oldValue),c=this.getValidRetailerIds(e.value),l=a.size,d=c.size,u=this.getValidRetailers(this.getStoreValue("cart.retailers")),h=Object.keys(u).length;if(d>0&&0===h)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===l&&d>0){this.container.innerHTML="";for(const[t,e]of Object.entries(n))this.addRetailerElement(t,e)}else if(l>0&&0===d)this.showEmptyCartState();else if(d>0){for(const t of a)c.has(t)||this.removeRetailerElement(t);for(const e of c){const c=n[e],l=t[e];a.has(e)?this.hasRetailerDataChanged(l,c)&&this.updateRetailerElement(e,c):this.addRetailerElement(e,c)}}else 0===l&&0===d&&this.showEmptyCartState()}if(n){const t=n.value,e=n.oldValue;t!==e&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return n||e,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},e=Object.values(t);if(0===e.length)return this.createEmptyCartElement();const n=[];for(const a of e){const t=this.createRetailerElement(a);t.setAttribute("data-retailer-id",a.id),n.push(t)}return n}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const e=t.some(t=>t.path.includes("cart.items")),n=t.some(t=>t.path.includes("cart.totals")),a=t.some(t=>t.path.includes("cart.fulfillments")),c=t.some(t=>"cart.loading"===t.path),l=t.some(t=>t.path.includes("cart.retailers"));if(e&&this.updateSubtotalItemsCount(),n&&this.subtotalPrice){const t=this.getStoreValue("cart.totals");this.subtotalPrice.textContent=""+formatCentToDollarText(t.subtotal+t.engravingFee-t.discounts)}(a||n||c||e||l)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const e=this.getStoreValue("cart.items")||{},n=Object.values(e).some(t=>t.updating);if(n)return!![];const a=this.getStoreValue("cart.fulfillments")||{},c=Object.values(a).some(t=>t.updating);if(c)return!![];const l=this.getStoreValue("cart.retailers")||{},d=Object.values(l).some(t=>t.updating);return d?!![]:![]}hasUnmetMinimum(t){var e;const n=t.subtotal;if(t.type===l.SHIPPING){const a=t.fees;if((null===(e=a.individual)||void 0===e?void 0:e.active)&&a.individual.min>0&&n<a.individual.min)return!![]}if(t.type===l.ON_DEMAND){const e=t.fees;if(e.min>0&&n<e.min)return!![]}return![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments")||{};return Object.values(t).some(t=>this.hasUnmetMinimum(t))}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},e=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),n=this.shouldDisableCheckout(),a=t||n||!e;this.checkoutButton.disabled=a,this.checkoutButton.classList.toggle("checkout-btn-disabled",a),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),e=Object.values(t).reduce((t,e)=>t+e.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+e+" item"+(1!==e?"s":"")+"):")}async handleCheckout(t){return this.clientConfig.isBuilder()?(t.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(t.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const t=this.getConfigs("global"),e=this.getStoreValue("cart.totals"),n=[],a=document.createElement("div");a.className="cart-footer-header";const l=document.createElement("div");l.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",l.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(e.subtotal+e.engravingFee-e.discounts),l.appendChild(this.subtotalPrice);const d=document.createElement("p");if(d.textContent="Taxes & fees will be calculated at checkout",d.className="taxes-fees-info",a.appendChild(l),a.appendChild(d),n.push(a),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:c.CART_PROMO_CODE});n.push(t)}const u=ComponentFactoryService.createElement({type:c.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(n.push(u),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleCheckout(t)}),this.checkoutButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleCheckout(t))}),n.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:c.POWERED_BY,context:"general"});n.push(t)}return n}}const mt={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"},ft="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=mt[e];return n||ft}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return ft}}function getCurrentTimeInTimezone$1(t){try{const e=new Date,n=e.getTime(),a=6e4*e.getTimezoneOffset(),c=new Date(n+a),l=new Date(c.toLocaleString("en-US",{timeZone:t})),d=c.getTime()-l.getTime();return new Date(n+d)}catch(e){return new Date}}function getCurrentTimeInUserTimezone(t){const e=detectUserTimezone(t);return getCurrentTimeInTimezone$1(e)}function isDateTimeInRange(t){const{startDate:e,endDate:n,addressState:a}=t;try{const t=getCurrentTimeInUserTimezone(a),c=!e||t>=new Date(e),l=!n||t<=new Date(n);return c&&l}catch(c){return![]}}function filterActiveItems(t,e){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:e}))}function hasActiveItems(t,e){return filterActiveItems(t,e).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,e,n;const a=this.config.layout.drawerHeaderText,l=this.getConfigs("global"),d=document.createElement("div");d.className="cart-header-content";const u=document.createElement("h2");u.className="cart-title",u.textContent=a,d.appendChild(u);const h=document.createElement("button");h.type="button",h.className="cart-header-close-btn",h.innerHTML=CloseIcon({width:16,height:16}),h.setAttribute("aria-label","Close cart drawer"),h.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),d.appendChild(h);const p=this.clientConfig.get("promoTicker"),m=null!==(e=null===(t=null==l?void 0:l.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],f=null!=p?p:m,g=this.store.get("address"),v=hasActiveItems(f,null===(n=null==g?void 0:g.address)||void 0===n?void 0:n.state);if(!f.length||!v)return[d];const y=ComponentFactoryService.createElement({context:"cart",type:c.PROMO_CODE_TICKER,tickers:f});return[d,y]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.params.itemId}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}handleOpenEngravingForm(t,e){var n,a,l,d,u,h,p,m,f,g;this.commands.ui.openDrawer(c.ENGRAVING_FORM,{identifier:t,context:"cart",lines:(null===(a=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===a?void 0:a.lines)||[],maxLines:(null===(d=null===(l=e.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.maxLines)||1,maxCharsPerLine:(null===(h=null===(u=e.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.maxCharsPerLine)||16,fee:(null===(m=null===(p=e.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.fee)||0,location:null===(g=null===(f=e.attributes)||void 0===f?void 0:f.engraving)||void 0===g?void 0:g.location})}template(){var t,e,n,a,l,d,u,h,p;const m=this.params.itemId,f=this.getStoreValue("cart.items."+m),g=this.getConfigs("global"),v=this.getStoreValue("cart.fulfillments."+f.fulfillmentId),y=f.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(t=null==v?void 0:v.expectation)||void 0===t?void 0:t.detail)||"",b=document.createElement("article");b.className="cart-item";const w=document.createElement("div");w.className="item-image";const S=document.createElement("img");S.src=f.mainImage,S.alt=f.name,w.appendChild(S);const E=document.createElement("div");E.className="item-details";const P=document.createElement("div");P.className="item-header";const F=document.createElement("h3");F.className="item-title",F.textContent=f.name;const D=document.createElement("button");D.className="item-delete",D.innerHTML=TrashIcon({}),D.setAttribute("role","button"),D.setAttribute("tabindex","0"),D.setAttribute("aria-label","Remove "+f.name+" from cart"),D.setAttribute("aria-expanded","true"),D.addEventListener("click",async()=>{await this.commands.cart.removeItem(m)}),D.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(m))}),P.appendChild(F),P.appendChild(D);const A=document.createElement("div");A.className="item-specs",A.textContent=f.size+", "+f.container;const _=document.createElement("div");_.className="item-shipping-container";const z=document.createElement("div");if(z.className="item-shipping",z.textContent=y,_.appendChild(z),g.layout.enablePersonalization&&(null===(n=null===(e=null==f?void 0:f.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.isEngravable)&&(null===(l=null===(a=null==f?void 0:f.attributes)||void 0===a?void 0:a.engraving)||void 0===l?void 0:l.hasEngraving)===![]&&v.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=g.layout.personalizationText+" +"+formatCentToDollarText((null===(u=null===(d=f.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.fee)||0,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+f.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(m,f)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(m,f))}),_.appendChild(t)}E.appendChild(P),E.appendChild(A),E.appendChild(_),b.appendChild(w),b.appendChild(E);const O=[b],M=ComponentFactoryService.createElement({type:c.CART_ITEM_QUANTITY_PRICE,itemId:m});if((null===(p=null===(h=null==f?void 0:f.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:c.ENGRAVING_VIEW,identifier:m,context:"cart"});O.push(t)}return O.push(M),O}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const e=t.find(t=>"cart.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,e=this.getStoreValue("cart.items."+t);return e||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const e=t.quantity,n=this.getAvailableQuantity(),a=n>0;return{currentQuantity:e,availableQuantity:n,canIncrease:a,canDecrease:!![]}}getAvailableQuantity(){var t,e,n,a;const c=this.getItemStore();if(!c)return 0;const l=c.partNumber,d=c.fulfillmentId,u=this.getStoreValue("cart.items")||{},h=Object.values(u).filter(t=>t.partNumber===l&&t.fulfillmentId===d),p=h.reduce((t,e)=>t+e.quantity,0),m=this.getStoreValue("products."+c.upc)||this.getStoreValue("products."+c.salsifyGrouping);if(!m)return c.maxQuantity-p;const f=null!==(a=null===(n=null===(e=null===(t=null==m?void 0:m.sizes)||void 0===t?void 0:t[c.liquidId])||void 0===e?void 0:e.attributes)||void 0===n?void 0:n.maxQuantityPerOrder)&&void 0!==a?a:0;return!f||f<=0?c.maxQuantity-p:f-p}updateButtonStates(t){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!t.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!t.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!t.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!t.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits();t>0&&!e.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),e=this.getItemStore();if(!e)return document.createElement("div");const n=document.createElement("div");return n.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),this.quantitySpan=document.createElement("span"),this.quantitySpan.className="quantity-value",this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-btn-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(t),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantitySpan),n.appendChild(this.qtyIncreaseButton),n}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const e=document.createElement("div");e.className="item-price-container";const n=document.createElement("span");if(n.className="item-price",n.textContent=formatCentToDollarText(t.price),e.appendChild(n),t.quantity>1){const n=document.createElement("span");n.className="item-price-per-unit",n.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",e.appendChild(n)}return e}template(){const t=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer();t.push(e)}const e=this.createPriceContainer();return t.push(e),t}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path);if(e){const{value:t,oldValue:n}=e,a=Boolean(null==n?void 0:n.code),c=Boolean(null==t?void 0:t.code);if(!a&&c)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(a&&!c)return this.container.innerHTML="",this.createInputContainer(),void 0;if(c&&this.promoCodePill&&t.discountAmount!==(null==n?void 0:n.discountAmount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",void 0}}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+(null==t?void 0:t.code)),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const e=document.createElement("div");e.classList.add("promo-container"),e.appendChild(this.createPromoInput()),e.appendChild(this.createApplyButton()),t.appendChild(e),this.container.appendChild(t),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("cart.loading"),a=this.getStoreValue("cart.promoCode"),c=this.getStoreValue("cart.events")||[],l=hasCartAnyPromoCodeEvents(c);this.applyButton.disabled=!e||n||Boolean(null==a?void 0:a.discountAmount)||this.isApplying||l}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),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 I=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(t),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(e){this.logger.error("Cart promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}};return this.applyButton.addEventListener("click",I),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I())}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==t?void 0:t.code){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+t.code),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),e}const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");return n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:c.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const e=this.container.querySelectorAll("[data-fulfillment-id]");if(e.length>0){const t=e[e.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const e=this.getFulfillmentInsertionPoint();if(e){const n=this.createFulfillmentElement(t);n.setAttribute("data-fulfillment-id",t);const a=this.getFulfillmentContainer();a&&a.remove(),e.nextSibling?e.parent.insertBefore(n,e.nextSibling):e.parent.appendChild(n)}}removeFulfillmentElement(t){const e=this.getFulfillmentElementById(t);if(e){const t=e.parentElement,n=e.nextElementSibling;e.remove();const a=this.container.querySelectorAll("[data-fulfillment-id]");if(0===a.length){const e=document.createElement("div");e.id="retailer-fulfillment-container",n?t.insertBefore(e,n):t.appendChild(e)}}}handleFulfillmentsUpdate(t,e){const n=new Set(t||[]),a=new Set(e||[]);for(const c of n)a.has(c)||this.removeFulfillmentElement(c);for(const c of a)n.has(c)||this.addFulfillmentElement(c)}setupFulfillmentElements(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],n=this.container.querySelectorAll("[data-fulfillment-id]");for(const c of n)c.remove();let a=this.getFulfillmentContainer();if(!a){const t=this.container.querySelector(".retailer-body-container"),e=this.container.querySelector("#retailer-subtotal-container");a=document.createElement("div"),a.id="retailer-fulfillment-container",t&&e&&t.insertBefore(a,e)}for(const c of e)this.addFulfillmentElement(c)}setupSubtotalElement(){const t=this.getRetailerId(),e=this.container.querySelector("#retailer-subtotal-container");if(e){const n=ComponentFactoryService.createElement({type:c.CART_RETAILER_SUBTOTAL,retailerId:t});e.replaceWith(n)}}onStoreChanged(t){const e=this.getRetailerId(),n="cart.retailers."+e,a=t.find(t=>t.path===n);if(a){const t=a.oldValue,e=a.value,n=(null==t?void 0:t.fulfillments)||[],c=(null==e?void 0:e.fulfillments)||[];JSON.stringify(n)!==JSON.stringify(c)&&this.handleFulfillmentsUpdate(n,c)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),e=this.container.querySelector(".retailer-section"),n=this.container.querySelector(".section-header-label");if(t&&e&&n){const N=()=>{const e=t.checked;n.setAttribute("aria-label",e?"Expand retailer section":"Collapse retailer section"),n.setAttribute("aria-expanded",e?"false":"true")};t.addEventListener("change",()=>{t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),N()}),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),N()}}beforeAutoDestroy(){this.logger.debug("Cart retailer component cleanup initiated",{retailerId:this.getRetailerId()})}onAutoDestroy(){this.logger.debug("Cart retailer component successfully destroyed",{retailerId:this.getRetailerId()})}template(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t),n=document.createElement("section");n.className="retailer-section";const a=document.createElement("div");a.className="cart-retailer-header";const c=document.createElement("div");c.className="retailer-info";const l=document.createElement("h2");l.className="section-title",l.textContent=e.name,c.appendChild(l);const d=document.createElement("input");d.type="checkbox",d.id=e.id,d.className="section-toggle",c.appendChild(d);const u=document.createElement("label");u.htmlFor=e.id,u.className="section-header-label",u.setAttribute("role","button"),u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Collapse retailer section"),u.setAttribute("aria-expanded","true");const h=document.createElement("span");h.className="chevron",h.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),u.appendChild(h),c.appendChild(u),a.appendChild(c),n.appendChild(a);const p=document.createElement("div");p.className="retailer-body-container";const m=document.createElement("div");m.id="retailer-fulfillment-container",p.appendChild(m);const f=document.createElement("div");return f.id="retailer-subtotal-container",p.appendChild(f),n.appendChild(p),n}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,e){const n=Object.values(t||{}).filter(t=>t.retailerId===e);let a=0;for(const c of n)a+=c.quantity;return a}template(){const t=this.params.retailerId,e=this.getStoreValue("cart.retailers."+t+".subtotal")||0,n=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,a=this.getStoreValue("cart.items"),c=this.getRetailerItemCount(a,t),l=1===c?"item":"items",d=document.createElement("h3");d.className="retailer-subtotal-header",d.textContent="Subtotal ("+c+" "+l+"):";const u=document.createElement("span");return u.className="retailer-subtotal-amount",u.textContent=formatCentToDollarText(e+n),[d,u]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.isPresaleLocked","checkout.presaleExpiresAt"]})}template(){var t,e,n;const a=this.store.get("checkout.isPresaleLocked"),l=this.store.get("checkout.presaleExpiresAt"),d=this.getConfigs("global"),u=this.clientConfig.get("promoTicker"),h=null!==(e=null===(t=null==d?void 0:d.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],p=null!=u?u:h,m=this.store.get("address"),f=hasActiveItems(p,null===(n=null==m?void 0:m.address)||void 0===n?void 0:n.state),g=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),v=a&&l,y=document.createElement("div");y.classList.add("checkout-container"),g&&y.classList.add("no-header"),this.params.isIndependentComponent&&y.classList.add("independent");const b=ComponentFactoryService.createElement({type:c.CHECKOUT_INFORMATION_SECTION});y.appendChild(b);const w=ComponentFactoryService.createElement({type:c.CHECKOUT_SUMMARY_SECTION});if(y.appendChild(w),!v&&(!p.length||!f)&&g)return[y];const S=document.createElement("div");if(S.classList.add("checkout-header-wrapper"),!g){const t=ComponentFactoryService.createElement({type:c.CHECKOUT_HEADER});S.appendChild(t)}if(p.length&&f&&!v){const t=ComponentFactoryService.createElement({context:"checkout",type:c.PROMO_CODE_TICKER,tickers:p});S.appendChild(t)}if(v){const t=ComponentFactoryService.createElement({type:c.CHECKOUT_PRESALE_COUNTDOWN});S.appendChild(t)}return[S,y]}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.isPresaleLocked"),e=this.getConfigs("checkout");let n=null;if(!t){n=document.createElement("button"),n.classList.add("checkout-header-button"),n.setAttribute("aria-label","Back to Cart"),n.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(c.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),n.appendChild(t)}const a=document.createElement("h1");a.textContent=(null==e?void 0:e.layout.drawerHeaderText)||"Checkout",a.classList.add("checkout-header-title"),a.setAttribute("aria-label","Checkout Page");const l=document.createElement("button");return l.innerHTML=CloseIcon({width:16,height:16}),l.classList.add("checkout-header-button-close"),l.setAttribute("aria-label","Close Checkout"),l.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),n?[n,a,l]:[a,l]}}class CheckoutInformationSectionComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift"]})}onStoreWatch(t){const e=t.find(t=>"checkout.isGift"===t.path);e&&this.handleBuyerInformationVisibility(e.value)}handleBuyerInformationVisibility(t){const e=this.container.querySelector("#buyer-information-container");if(t&&!e){const t=ComponentFactoryService.createElement({type:c.CHECKOUT_BUYER_INFORMATION_FORM});t.id="buyer-information-container";const e=this.container.querySelector(".checkout-delivery-information");e&&e.insertAdjacentElement("afterend",t)}else!t&&e&&setTimeout(()=>{e.remove()},300)}template(){const t=[],e=ComponentFactoryService.createElement({type:c.CHECKOUT_DELIVERY_INFORMATION_FORM});t.push(e);const n=ComponentFactoryService.createElement({type:c.CHECKOUT_PAYMENT_FORM});t.push(n);const a=ComponentFactoryService.createElement({type:c.CHECKOUT_BILLING_FORM});return t.push(a),t}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presaleExpiresAt","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var e;const n=t.find(t=>"checkout.presaleExpiresAt"===t.path);if(null==n?void 0:n.value)return this.updateExpiresAt(n.value),!![];const a=t.find(t=>"ui.drawer"===t.path);return(null===(e=null==a?void 0:a.value)||void 0===e?void 0:e.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const t=this.store.get("checkout.presaleExpiresAt");t&&this.updateExpiresAt(t),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var t,e;const n=[".drawer-content"];for(const c of n){const e=null===(t=this.rootElement)||void 0===t?void 0:t.closest(c);if(e&&this.isScrollable(e))return e}let a=null===(e=this.rootElement)||void 0===e?void 0:e.parentElement;for(;a&&a!==document.body;){if(this.isScrollable(a))return a;a=a.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var t,e;if(!this.scrollContainer)return;const n=this.scrollContainer.scrollTop,a=70,c=10;!this.isCurrentlyScrolled&&n>a?(this.isCurrentlyScrolled=!![],null===(t=this.rootElement)||void 0===t||t.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&n<c&&(this.isCurrentlyScrolled=![],null===(e=this.rootElement)||void 0===e||e.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(t){const e=window.getComputedStyle(t),n=e.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===n||"scroll"===n||"overlay"===n)}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 e=new Date,n=Math.floor((this.expiresAt.getTime()-e.getTime())/1e3);n<this.totalDuration&&(this.totalDuration=Math.max(n,240)),this.startCountdown()}catch(e){this.logger.error("Failed to parse presale expiration date",e),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const t=new Date,e=Math.max(0,this.expiresAt.getTime()-t.getTime()),n=e/1e3,a=this.totalDuration-n,c=Math.max(0,Math.min(100,a/this.totalDuration*100)),l=n<60;if(l!==this.isUnderOneMinute){this.isUnderOneMinute=l;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"))}const d=this.rootElement.querySelector("[data-timer]");d&&(d.textContent=this.formatTime(e));const u=this.rootElement.querySelector("[data-progress-fill]");u&&(u.style.width=c+"%"),0===e&&this.handleExpire()}formatTime(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),a=e%60,c=Math.floor(t%1e3/10);return n.toString().padStart(2,"0")+":"+a.toString().padStart(2,"0")+":"+c.toString().padStart(2,"0")}handleExpire(){this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer()}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const e=document.createElement("div");e.classList.add("checkout-presale-text-container");const n=document.createElement("div");n.classList.add("checkout-presale-heading");const a=document.createElement("h2");a.textContent="LIMITED PRE-ORDER:";const c=document.createElement("div");c.classList.add("checkout-presale-timer"),c.setAttribute("data-timer",""),c.textContent="00:00:00",n.appendChild(a),n.appendChild(c);const l=document.createElement("p");l.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",l.classList.add("checkout-presale-subtitle"),e.appendChild(n),e.appendChild(l);const d=document.createElement("div");d.className="checkout-presale-progress-bar",d.setAttribute("data-progress","");const u=document.createElement("div");return u.className="checkout-presale-progress-fill",u.setAttribute("data-progress-fill",""),u.style.width="0%",d.appendChild(u),t.appendChild(e),t.appendChild(d),t}}const gt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],vt={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,e){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(e)?e:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(e)?e:null:"class"===t?e.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():e.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const e=t.textContent||"",n=e.replace(/<[^>]*>/g,"");if(n.trim()){const t=document.createTextNode(n);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const e=t,n=e.tagName.toLowerCase();if(gt.includes(n)){const t=document.createElement(n),a=vt[n]||[];for(const n of Array.from(e.attributes)){const e=n.name.toLowerCase();if(a.includes(e)){const a=sanitizeAttributeValue(e,n.value);null!==a&&t.setAttribute(e,a)}}"a"===n&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const n of Array.from(e.childNodes)){const e=cleanNode(n);e&&t.appendChild(e)}return t}const a=document.createDocumentFragment();for(const t of Array.from(e.childNodes)){const e=cleanNode(t);e&&a.appendChild(e)}return a.childNodes.length>0?a:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const e=new DOMParser,n=e.parseFromString(t,"text/html"),a=n.querySelector("parsererror");if(a)return console.warn("HTML parsing error detected"),"";const c=document.createDocumentFragment();for(const t of Array.from(n.body.childNodes)){const e=cleanNode(t);e&&c.appendChild(e)}const l=document.createElement("div");return l.appendChild(c),l.innerHTML}catch(e){return console.error("HTML sanitization error:",e),""}}class CheckoutSummarySectionComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const e=t.find(t=>"checkout.amounts"===t.path);if(e){const t=this.getStoreValue("checkout"),e=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&e>0)}}updateZeroAmountElement(t){const e=this.container.querySelector(".checkout-zero-amount-container");if(t&&!e){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 e=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");e&&e.after(t)}else!t&&e&&e.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 e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,e=this.config.layout.smsOptIn;if(!t.show&&!e.show)return null;const n=document.createElement("div");if(n.classList.add("checkout-marketing-opt-ins-container"),t.show){const e=document.createElement("div");let a;e.classList.add("checkout-checkbox-container"),a=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const c=document.createElement("span");c.id="emailOptIn",c.classList.add("checkout-checkbox-visual"),a&&c.classList.add("checked"),c.innerHTML=CheckboxIcon({width:16,height:16}),c.setAttribute("role","checkbox"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","Email opt-in checkbox"),c.setAttribute("aria-checked",a?"true":"false"),c.addEventListener("click",()=>this.handleEmailToggle(c)),c.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(c))});const l=document.createElement("label");l.setAttribute("for","emailOptIn"),l.classList.add("checkbox-label"),l.innerHTML=sanitizeHTML(t.text),l.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canEmail"),c.classList.toggle("checked"))}),e.appendChild(c),e.appendChild(l),n.appendChild(e)}if(e.show){const t=document.createElement("div");let a;t.classList.add("checkout-checkbox-container"),a=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canSms");const c=document.createElement("span");c.classList.add("checkout-checkbox-visual"),c.id="smsOptIn",a&&c.classList.add("checked"),c.innerHTML=CheckboxIcon({width:16,height:16}),c.setAttribute("role","checkbox"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","SMS opt-in checkbox"),c.setAttribute("aria-checked",a?"true":"false"),c.addEventListener("click",()=>this.handleSmsToggle(c)),c.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(c))});const l=document.createElement("label");l.setAttribute("for","smsOptIn"),l.classList.add("checkbox-label"),l.innerHTML=sanitizeHTML(e.text),l.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canSms"),c.classList.toggle("checked"))}),t.appendChild(c),t.appendChild(l),n.appendChild(t)}return n}hasOnDemandOrder(){const t=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}template(){var t;const e=[],n=this.getConfigs("global"),a=this.getConfigs("checkout"),l=this.getConfigs("global"),d=a.layout.allowGiftCards,u=null===(t=null==l?void 0:l.layout)||void 0===t?void 0:t.allowPromoCodes,h=document.createElement("div");h.classList.add("section-title-container");const p=document.createElement("h3");p.textContent="Order Summary",p.classList.add("section-title"),h.appendChild(p),e.push(h);const m=ComponentFactoryService.createElement({type:c.CHECKOUT_ITEMS});e.push(m);const f=document.createElement("div");f.classList.add("checkout-separator");const g=document.createElement("div");if(g.classList.add("checkout-separator"),e.push(f),d||u){const t=ComponentFactoryService.createElement({type:c.CHECKOUT_PC_GC});e.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:c.CHECKOUT_TIPS});e.push(t),e.push(g)}const v=document.createElement("div");v.classList.add("section-title-container");const y=document.createElement("h3");y.textContent="100% Secure Payments",y.classList.add("disclaimer-header"),v.appendChild(y);const b=document.createElement("p");b.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.",b.classList.add("disclaimer-description"),v.appendChild(b),e.push(v);const w=ComponentFactoryService.createElement({type:c.CHECKOUT_AMOUNTS});e.push(w);const S=ComponentFactoryService.createElement({type:c.CHECKOUT_PLACE_ORDER_BUTTON});e.push(S);const E=this.marketingOptInsContainer();if(E&&e.push(E),a.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(a.layout.legalMessage.text);const c=document.createElement("div");c.classList.add("checkout-separator"),e.push(t),e.push(n),e.push(c)}if(n.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:c.POWERED_BY,context:"checkout"});e.push(t)}return e}}class CheckoutBillingFormComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.billingSameAsShipping"]})}async handleFirstNameChange(t){this.commands.checkout.updateBillingInfo(et.firstName,t),this.pubSub.publishForm(a.BILLING,{fieldName:et.firstName})}async handleLastNameChange(t){this.commands.checkout.updateBillingInfo(et.lastName,t),this.pubSub.publishForm(a.BILLING,{fieldName:et.lastName})}async handleEmailChange(t){this.commands.checkout.updateBillingInfo(et.email,t),this.pubSub.publishForm(a.BILLING,{fieldName:et.email})}async handlePhoneChange(t){this.commands.checkout.updateBillingInfo(et.phone,t),this.pubSub.publishForm(a.BILLING,{fieldName:et.phone})}async handleCompanyChange(t){this.commands.checkout.updateBillingInfo(et.company,t),this.pubSub.publishForm(a.BILLING,{fieldName:et.company})}async handleAddressOneChange(t){this.commands.checkout.updateBillingInfo(et.addressOne,t),this.pubSub.publishForm(a.BILLING,{fieldName:et.addressOne})}async handleAddressTwoChange(t){this.commands.checkout.updateBillingInfo(et.addressTwo,t),this.pubSub.publishForm(a.BILLING,{fieldName:et.addressTwo})}async handleCityChange(t){this.commands.checkout.updateBillingInfo(et.city,t),this.pubSub.publishForm(a.BILLING,{fieldName:et.city})}async handleStateChange(t){this.commands.checkout.updateBillingInfo(et.state,t),this.pubSub.publishForm(a.BILLING,{fieldName:et.state})}async handleZipCodeChange(t){this.commands.checkout.updateBillingInfo(et.zipCode,t),this.pubSub.publishForm(a.BILLING,{fieldName:et.zipCode})}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.billingSameAsShipping"),e=document.createElement("div");e.classList.add("checkout-billing-same-as-shipping-toggle-container");const n=document.createElement("div");n.classList.add("checkout-checkbox-container");const a=document.createElement("span");a.id="billingSameAsShipping",a.classList.add("checkout-checkbox-visual"),a.setAttribute("role","checkbox"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label","Billing same as shipping checkbox"),a.setAttribute("aria-checked",t?"true":"false"),t&&a.classList.add("checked"),a.innerHTML=CheckboxIcon({width:16,height:16}),e.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),e.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const c=document.createElement("label");return c.textContent="Billing address same as shipping address",c.setAttribute("for","billingSameAsShipping"),c.classList.add("billing-checkbox-label"),n.appendChild(a),n.appendChild(c),e.appendChild(n),e}template(){const t=this.getStoreValue("checkout.billingSameAsShipping"),e=[],n=this.billingSameAsShippingToggle();if(e.push(n),t)return e;const a=document.createElement("div");a.classList.add("section-title-container");const l=document.createElement("h3");l.textContent="Your billing info",l.classList.add("section-title"),a.appendChild(l);const d=document.createElement("p");d.textContent="Provide the info relevant to your payment method",d.classList.add("section-subtitle"),a.appendChild(d),e.push(a);const u=document.createElement("div");u.classList.add("section-form-container");const h=document.createElement("div");h.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:et.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleFirstNameChange.bind(this),storePath:"billing.firstName"});p.setAttribute("aria-label","First name input"),h.appendChild(p);const m=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:et.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleLastNameChange.bind(this),storePath:"billing.lastName"});m.setAttribute("aria-label","Last name input"),h.appendChild(m),u.appendChild(h);const f=ComponentFactoryService.createElement({type:c.INPUT,inputType:"email",name:et.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:this.handleEmailChange.bind(this),storePath:"billing.email"});f.setAttribute("aria-label","Email input"),u.appendChild(f);const g=document.createElement("div");g.classList.add("checkout-two-col-container");const v=ComponentFactoryService.createElement({type:c.INPUT,inputType:"tel",name:et.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:this.handlePhoneChange.bind(this),storePath:"billing.phone"});v.setAttribute("aria-label","Phone input"),g.appendChild(v);const y=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:et.company,label:"Company (optional)",autocomplete:!![],onChange:this.handleCompanyChange.bind(this)});y.setAttribute("aria-label","Company input"),g.appendChild(y),u.appendChild(g);const b=document.createElement("div");b.classList.add("checkout-two-col-container");const w=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:et.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:this.handleAddressOneChange.bind(this),storePath:"billing.addressOne"});w.setAttribute("aria-label","Street address input"),b.appendChild(w);const S=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:et.addressTwo,label:"Apt, suite, etc. (optional)",onChange:this.handleAddressTwoChange.bind(this)});S.setAttribute("aria-label","Apt, suite, etc. (optional) input"),b.appendChild(S),u.appendChild(b);const E=document.createElement("div");E.classList.add("checkout-three-col-container");const P=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:et.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:this.handleCityChange.bind(this),storePath:"billing.city"});P.setAttribute("aria-label","City input"),E.appendChild(P);const F=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:et.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:this.handleStateChange.bind(this),storePath:"billing.state"});F.setAttribute("aria-label","State input"),E.appendChild(F);const D=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:et.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:this.handleZipCodeChange.bind(this),storePath:"billing.zipCode"});return D.setAttribute("aria-label","Zip Code input"),E.appendChild(D),u.appendChild(E),e.push(u),e}}class CheckoutBuyerInformationComponent extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}async handleFirstNameChange(t){this.commands.checkout.updateCustomerInfo(J.firstName,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.firstName})}async handleLastNameChange(t){this.commands.checkout.updateCustomerInfo(J.lastName,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.lastName})}async handleEmailChange(t){this.commands.checkout.updateCustomerInfo(J.email,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.email})}async handlePhoneChange(t){this.commands.checkout.updateCustomerInfo(J.phone,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.phone})}async handleCompanyChange(t){this.commands.checkout.updateCustomerInfo(J.company,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.company})}async handleDobChange(t){this.commands.checkout.updateCustomerInfo(J.birthDate,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.birthDate})}template(){const t=this.store.get("checkout.customer"),e=[],n=document.createElement("div");n.classList.add("section-title-container");const a=document.createElement("h3");a.textContent="Buyer Information",a.classList.add("section-title"),n.appendChild(a);const l=document.createElement("p");l.textContent="Buyer information is used to process your order and for delivery purposes.",l.classList.add("section-subtitle"),n.appendChild(l),e.push(n);const d=document.createElement("div");d.classList.add("section-form-container");const u=document.createElement("div");u.classList.add("checkout-two-col-container");const h=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:J.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:"customer.firstName"});u.appendChild(h);const p=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:J.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:this.handleLastNameChange.bind(this),storePath:"customer.lastName"});u.appendChild(p),d.appendChild(u);const m=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:J.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:this.handleCompanyChange.bind(this)});d.appendChild(m);const f=ComponentFactoryService.createElement({type:c.INPUT,inputType:"email",name:J.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:this.handleEmailChange.bind(this),storePath:"customer.email"});d.appendChild(f);const g=ComponentFactoryService.createElement({type:c.INPUT,inputType:"tel",name:J.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:this.handlePhoneChange.bind(this),storePath:"customer.phone"});d.appendChild(g);const v=ComponentFactoryService.createElement({type:c.BIRTHDATE_INPUT,inputType:"date",name:J.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:this.handleDobChange.bind(this),storePath:"customer.birthDate"});return d.appendChild(v),e.push(d),e}}class CheckoutDeliveryInformationComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift","address.formattedAddress","checkout.onDemandFulfillmentTipInfo"]})}hasOnDemandFulfillments(){const t=this.store.get("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}async handleDeliveryInstructionsChange(t){await this.commands.checkout.updateDeliveryInstructions(t)}async handleFirstNameChange(t){const e=this.getStoreValue("checkout.isGift");e?(this.commands.checkout.updateGiftInfo(tt.firstName,t),this.pubSub.publishForm(a.GIFT,{fieldName:tt.firstName})):(this.commands.checkout.updateCustomerInfo(J.firstName,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.firstName}))}async handleLastNameChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(tt.lastName,t),this.pubSub.publishForm(a.GIFT,{fieldName:tt.lastName})):(this.commands.checkout.updateCustomerInfo(J.lastName,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.lastName}))}async handleEmailChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(tt.email,t),this.pubSub.publishForm(a.GIFT,{fieldName:tt.email})):(this.commands.checkout.updateCustomerInfo(J.email,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.email}))}async handlePhoneChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(tt.phone,t),this.pubSub.publishForm(a.GIFT,{fieldName:tt.phone})):(this.commands.checkout.updateCustomerInfo(J.phone,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.phone}))}async handleAddressTwoChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(tt.addressTwo,t),this.pubSub.publishForm(a.GIFT,{fieldName:tt.addressTwo})):(this.commands.checkout.updateCustomerInfo(J.addressTwo,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.addressTwo}))}async handleCompanyChange(t){this.commands.checkout.updateCustomerInfo(J.company,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.company})}async handleBirthdateChange(t){this.commands.checkout.updateCustomerInfo(J.birthDate,t),this.pubSub.publishForm(a.CUSTOMER,{fieldName:J.birthDate})}async handleGiftMessageChange(t){this.commands.checkout.updateGiftInfo(tt.message,t),this.pubSub.publishForm(a.GIFT,{fieldName:tt.message})}template(){const t=this.getConfigs("global"),e=this.getStoreValue("checkout.isGift")||![],n=this.store.get("checkout.giftRecipient"),a=this.store.get("checkout.customer"),l=this.store.get("address.formattedAddress"),d=e?n:a,u=[],h=document.createElement("div");h.classList.add("delivery-header-container");const p=document.createElement("div");p.classList.add("delivery-header-content");const m=document.createElement("div");m.classList.add("delivery-title-container");const f=document.createElement("h3");f.textContent="Deliver to",f.classList.add("delivery-title");const g=document.createElement("p");g.textContent="Package recipient must be 21+",g.classList.add("delivery-subtitle"),m.appendChild(f),m.appendChild(g);const v=document.createElement("div");v.classList.add("gift-toggle-container");const y=document.createElement("div");y.classList.add("gift-label-wrapper");const b=document.createElement("span");b.textContent="Send as Gift? (Free)",b.classList.add("gift-toggle-label"),y.appendChild(b);const w=document.createElement("span");w.textContent="With personalized note & gift receipt.",w.classList.add("gift-toggle-description"),y.appendChild(w);const S=document.createElement("div");S.classList.add("toggle-switch"),S.classList.toggle("active",e);const E=document.createElement("div");E.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(E),v.appendChild(y),v.appendChild(S),S.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),S.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),h.appendChild(v),h.appendChild(m),u.push(h);const P=document.createElement("div");P.classList.add("section-form-container");const F=document.createElement("div");F.classList.add("checkout-two-col-container");const D=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:e?tt.firstName:J.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:d.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:e?"giftRecipient.firstName":"customer.firstName"});D.setAttribute("aria-label","First Name Input"),F.appendChild(D);const A=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:e?tt.lastName:J.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:d.lastName,onChange:this.handleLastNameChange.bind(this),storePath:e?"giftRecipient.lastName":"customer.lastName"});if(A.setAttribute("aria-label","Last Name Input"),F.appendChild(A),P.appendChild(F),!e){const t=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:J.company,label:"Company (optional)",autocomplete:!![],value:d.company,onChange:this.handleCompanyChange.bind(this),storePath:"customer.company"});t.setAttribute("aria-label","Company Input"),P.appendChild(t)}const _=ComponentFactoryService.createElement({type:c.INPUT,inputType:"email",name:e?tt.email:J.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:d.email,onChange:this.handleEmailChange.bind(this),storePath:e?"giftRecipient.email":"customer.email"});_.setAttribute("aria-label","Email Input"),P.appendChild(_);const z=ComponentFactoryService.createElement({type:c.INPUT,inputType:"tel",name:e?tt.phone:J.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:d.phone,onChange:this.handlePhoneChange.bind(this),storePath:e?"giftRecipient.phone":"customer.phone"});if(z.setAttribute("aria-label","Phone Input"),P.appendChild(z),!e){const t=ComponentFactoryService.createElement({type:c.BIRTHDATE_INPUT,inputType:"date",name:J.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:formatISODateToMMDDYYYY(d.birthDate),onChange:this.handleBirthdateChange.bind(this),storePath:"customer.birthDate"});t.setAttribute("aria-label","Birthdate Input"),P.appendChild(t)}const O=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:l,disabled:!![],className:"disabled-input",validation:{required:!![]}});O.setAttribute("aria-label","Delivery Address Input"),P.appendChild(O);const M=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:e?tt.addressTwo:J.addressTwo,label:"Apt, suite, etc. (optional)",value:d.addressTwo,onChange:this.handleAddressTwoChange.bind(this),storePath:e?"giftRecipient.addressTwo":"customer.addressTwo"});if(M.setAttribute("aria-label","Address Line 2 Input"),P.appendChild(M),this.hasOnDemandFulfillments()){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const n=document.createElement("label");n.textContent="Delivery Instructions",n.setAttribute("for","delivery_instructions");const a=document.createElement("textarea");a.id="delivery_instructions",a.name="delivery_instructions",a.rows=4,a.setAttribute("aria-label","Delivery Instructions Textarea"),a.value=this.store.get("checkout.deliveryInstructions")||"",a.addEventListener("blur",async t=>{await this.handleDeliveryInstructionsChange(t.target.value)}),a.addEventListener("keydown",async t=>{"Enter"!==t.key||t.shiftKey||(t.preventDefault(),await this.handleDeliveryInstructionsChange(t.target.value))});const c=document.createElement("p");c.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",c.classList.add("textarea-message-disclaimer"),e.appendChild(n),e.appendChild(a),e.appendChild(c),P.appendChild(e)}if(e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const a=document.createElement("label");a.textContent="Gift Message*",a.setAttribute("for",tt.message);const c=document.createElement("textarea");c.name=tt.message,c.id=tt.message,c.rows=4,c.value=n.message||"",c.setAttribute("aria-label","Gift Message Textarea"),c.addEventListener("input",async t=>{await this.handleGiftMessageChange(t.target.value)});const l=document.createElement("p");l.textContent="Your gift message will be emailed to the recipient along with delivery details.",l.classList.add("textarea-message-disclaimer"),e.appendChild(a),e.appendChild(c),e.appendChild(l),P.appendChild(e)}return u.push(P),u}}class CheckoutPaymentFormComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchStorePaths:["checkout.payment.sendSubmitSignal"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![]}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,e=null;for(;t&&t!==document.body;){const n=t.hasAttribute("checkout"),a=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(c.LCE_ELEMENT),l=t.hasAttribute("drawer"),d=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(c.DRAWER),u="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||a&&l&&d&&u)return this.rootComponent=t,t;e=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){await this.commands.checkout.getPaymentSession();const t=this.store.get("checkout.payment"),e=this.getConfigs("global");return{publishableKey:t.key,clientSecret:t.secret,appearance:{theme:"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;if(this.isCreatingStripeForm)return this.logger.debug("Stripe form creation already in progress, skipping"),void 0;const e=this.findRootComponent();if(!e)return;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.debug("Stripe form already exists and is connected, skipping creation"),void 0;const n=e.querySelectorAll('[slot="'+$+'"]');if(n.length>0)for(const c of n)c.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:c.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.stripeFormElement.setAttribute("slot",$),e.appendChild(this.stripeFormElement),this.setupStripeFormEventListeners()}catch(a){this.logger.error("Stripe form element creation failed",a),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}async afterRender(){this.removeExistingStripeForm(),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",async t=>{await this.commands.checkout.updateStripeFormStatus(t.detail.status),t.detail.status.hasError&&this.logger.error("Stripe form status update failed",t.detail)}),this.stripeFormElement.addEventListener("lce:s:confirmPaymentSession",async t=>{try{const{confirmationTokenId:e,setupIntentId:n}=t.detail;await this.commands.checkout.confirmPaymentSession(e,n)}catch(e){this.logger.error("Failed to confirm payment session",e),this.store.set("checkout.payment.sendSubmitSignal",![])}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const e=await this.doStripeConfig(),n=new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:e}});null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(n)}catch(e){this.logger.error("Failed to refresh payment session",e)}})}onStoreChanged(t){const e=t.some(t=>"checkout.payment.sendSubmitSignal"===t.path&&t.value===!![]);if(e&&this.stripeFormElement){const t=new CustomEvent("lce:s:submit");this.stripeFormElement.dispatchEvent(t)}return![]}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],null===(t=super.disconnected)||void 0===t||t.call(this)}template(){const t=[],e=document.createElement("div");e.classList.add("section-title-container");const n=document.createElement("h3");n.textContent="Payment",n.classList.add("section-title"),e.appendChild(n);const a=document.createElement("p");a.textContent="All transactions are secure and encrypted.",a.classList.add("section-subtitle"),e.appendChild(a),t.push(e);const c=document.createElement("slot");return c.setAttribute("name",$),t.push(c),t}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this._=null,this.O=null,this.N=null,this.M=![],this.L=![],this.R=![]}async initialize({data:t}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.B=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.B;this._=window.Stripe(t.publishableKey),this.O=this._.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.N=this.O.create("payment",t.elementOptions),this.N.mount(this),this.N.on("change",async t=>{const e=!!t.error,n=t.complete,a=e?t.error.message:null;this.L=n,await this.updateStripeFormStatus({isComplete:n,hasError:e,errorMessage:a,isProcessing:this.M})}),this.N.on("focus",async()=>{await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:this.M})}),this.R=![]}catch(t){throw await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",this.handleSubmitEvent.bind(this)),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this))}async handleSubmitEvent(){await this.handleSubmit()}async handleRefreshSession(t){const{stripeConfig:e}=t.detail;e&&(this.B=e,await this.refreshPaymentSession())}async handleSubmit(){if(!this.M){this.M=!![],await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:!![]});try{if(!this.L)throw new Error("Please complete all required payment fields");this.R&&await this.requestSessionRefresh();const t=await this.createConfirmationTokenId(),e=this.B.clientSecret,n=e.split("_secret_")[0],a=new CustomEvent("lce:s:confirmPaymentSession",{detail:{confirmationTokenId:t,setupIntentId:n}});this.dispatchEvent(a),this.R=!![],await this.updateStripeFormStatus({isComplete:!![],isProcessing:![],hasError:![],errorMessage:null})}catch(t){this.R||(this.R=!![]),await this.updateStripeFormStatus({isComplete:this.L,isProcessing:![],hasError:!![],errorMessage:(null==t?void 0:t.message)||"An unexpected error with payment occurred"})}finally{this.M=![]}}}async requestSessionRefresh(){const t=new CustomEvent("lce:s:requestSessionRefresh");return this.dispatchEvent(t),new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",r),e(new Error("Session refresh timeout"))},5e3),r=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",r),t()};this.addEventListener("lce:s:refreshSession",r,{once:!![]})})}async refreshPaymentSession(){try{this.O&&this.O.update({clientSecret:this.B.clientSecret}),this.R=![]}catch(j){await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to refresh payment session"})}}async updateStripeFormStatus(t){const e=new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t}});this.dispatchEvent(e)}async createConfirmationTokenId(){if(!this.O)throw new Error("Elements must be provided");try{const{error:t}=await this.O.submit();if(t)throw new Error(t.message);const e={elements:this.O,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:n,confirmationToken:a}=await this._.createConfirmationToken(e);if(n)throw new Error(n.message);if(!a||!a.id)throw new Error("Confirmation token not found");return a.id}catch(t){throw new Error(t.message)}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,e;try{this.N&&(this.N.unmount(),this.N=null),this.O&&(null===(e=(t=this.O).destroy)||void 0===e?void 0:e.call(t),this.O=null),this._=null,this.M=![],this.L=![],this.R=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}catch(n){console.warn("Error during Stripe form cleanup:",n)}}loadStripeJS(){return new Promise((t,e)=>{const n=document.createElement("script");n.src="https://js.stripe.com/basil/stripe.js",n.onload=()=>t(),n.onerror=()=>e(new Error("Failed to load Stripe.js")),document.head.appendChild(n)})}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,e,n;const a=this.getStoreValue("checkout"),c=Boolean(a.promoCode),l=Boolean(null===(t=a.giftCards)||void 0===t?void 0:t.length),d=this.getConfigs("global"),u=Object.keys(a.onDemandFulfillmentTipInfo||{}).length>0,h=Object.values(a.items||{}),p=[],m=document.createElement("div");m.classList.add("checkout-amount-line");const f=document.createElement("span");f.textContent="Subtotal ("+h.length+" item"+(h.length>1?"s":"")+")",m.appendChild(f);const g=document.createElement("span");g.textContent=formatCentToDollarText(a.amounts.subtotal),m.appendChild(g),p.push(m);const v=document.createElement("div");v.classList.add("checkout-amount-line");const y=document.createElement("span");y.textContent="Shipping",v.appendChild(y);const b=document.createElement("span");b.textContent=formatCentToDollarText(a.amounts.shipping),v.appendChild(b),p.push(v);const w=document.createElement("div");w.classList.add("checkout-amount-line");const S=document.createElement("span");S.textContent="Delivery",w.appendChild(S);const E=document.createElement("span");if(E.textContent=formatCentToDollarText(a.amounts.delivery),w.appendChild(E),p.push(w),(null===(e=null==a?void 0:a.amounts)||void 0===e?void 0:e.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Engraving",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(a.amounts.engraving),t.appendChild(n),p.push(t)}const P=document.createElement("div");P.classList.add("checkout-amount-line");const F=document.createElement("span");F.textContent="Taxes & Fees",P.appendChild(F);const D=document.createElement("span");if(D.textContent=formatCentToDollarText(a.amounts.tax+a.amounts.service+a.amounts.platform),P.appendChild(D),p.push(P),c){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Promo Code ("+(null===(n=a.promoCode)||void 0===n?void 0:n.code)+")",t.appendChild(e);const c=document.createElement("span");c.textContent="-"+formatCentToDollarText(a.amounts.discounts),t.appendChild(c),p.push(t)}if(l){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Gift Cards Applied",t.appendChild(e);const n=document.createElement("span");n.textContent="-"+formatCentToDollarText(a.amounts.giftCards),t.appendChild(n),p.push(t)}if(u){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Tips",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(a.amounts.tip),t.appendChild(n),p.push(t)}const A=document.createElement("div");A.classList.add("checkout-separator"),p.push(A);const _=document.createElement("div");_.classList.add("checkout-amount-total");const z=document.createElement("span");z.textContent="Total",_.appendChild(z);const O=document.createElement("span");O.textContent=formatCentToDollarText(a.amounts.total),_.appendChild(O),p.push(_);const M=this.store.get("checkout.isPresaleLocked");if(M){const t=document.createElement("div");t.classList.add("checkout-amount-due");const e=document.createElement("span");e.textContent="Amount due today",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(0),t.appendChild(n),p.push(t);const a=document.createElement("div");a.classList.add("checkout-presale-locked-message");const c=htmlStringToElement(InfoIcon({color:d.theme.defaultTextColor}));a.appendChild(c);const l=document.createElement("p");l.textContent="Pre-ordered items will be charged when shipped.",a.appendChild(l),p.push(a)}return p}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,e,n,a,l,d,u,h,p,m,f,g;const v=[],y=this.getConfigs("configurations"),b=this.getConfigs("global"),w=this.getConfigs("checkout"),S=this.config.layout.exitUrl||window.location.host,E=this.config.layout.thankYouButtonText||"Continue Shopping";if((null===(e=null===(t=this.config.theme)||void 0===t?void 0:t.checkoutCompleted)||void 0===e?void 0:e.customLogo)||(null===(a=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===a?void 0:a.customLogo)){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const e=document.createElement("img");e.src=(null===(d=null===(l=this.config.theme)||void 0===l?void 0:l.checkoutCompleted)||void 0===d?void 0:d.customLogo)||(null===(h=null===(u=this.config.layout)||void 0===u?void 0:u.checkoutCompleted)||void 0===h?void 0:h.customLogo),e.alt=y.partnerName+" Logo",t.appendChild(e),v.push(t)}const P=document.createElement("div");P.classList.add("checkout-completed-section-container");const F=document.createElement("div");F.classList.add("checkout-completed-title-container");const D=document.createElement("div");D.classList.add("checkout-completed-title-section");const A=document.createElement("h3");A.innerHTML=(null===(m=null===(p=this.config.theme)||void 0===p?void 0:p.checkoutCompleted)||void 0===m?void 0:m.customText)||(null===(g=null===(f=this.config.layout)||void 0===f?void 0:f.checkoutCompleted)||void 0===g?void 0:g.customText)||"Thank You for Your Order!",D.appendChild(A);const _=document.createElement("p");_.textContent="Your payment has been successfully processed.",D.appendChild(_),F.appendChild(D),P.appendChild(F);const z=document.createElement("div");z.classList.add("checkout-completed-sub-section");const O=document.createElement("div");O.classList.add("checkout-completed-line");const M=document.createElement("h3");M.textContent="Order Number",O.appendChild(M);const L=document.createElement("span");L.textContent=this.params.orderNumber,O.appendChild(L),z.appendChild(O);const R=document.createElement("div");R.classList.add("checkout-completed-line");const B=document.createElement("h3");B.textContent="Order Amount",R.appendChild(B);const q=document.createElement("span");q.textContent=""+formatCentToDollarText(this.params.orderTotal),R.appendChild(q),z.appendChild(R);const j=document.createElement("div");j.classList.add("checkout-completed-line");const G=document.createElement("h3");G.textContent="Payment Method",j.appendChild(G);const U=document.createElement("span");U.textContent="** "+this.params.cardLast4,j.appendChild(U),z.appendChild(j),P.appendChild(z);const H=document.createElement("div");H.classList.add("checkout-completed-sub-section");const V=document.createElement("p");V.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>.",H.appendChild(V),P.appendChild(H),v.push(P);const Y=document.createElement("div");Y.classList.add("checkout-completed-section-container");const W=document.createElement("button");W.type="button";const K=document.createElement("span");K.textContent=E,W.setAttribute("tabindex","0"),W.setAttribute("role","button"),W.setAttribute("aria-label",E),W.appendChild(K);const Q=htmlStringToElement(ArrowRightIcon({width:16,height:16}));W.appendChild(Q),W.addEventListener("click",()=>{window.location.href=S}),W.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=S)}),Y.appendChild(W),v.push(Y);const Z=document.createElement("div");Z.classList.add("checkout-completed-section-container");const $=document.createElement("div");$.classList.add("checkout-completed-help-section"),Z.appendChild($);const J=document.createElement("p");J.textContent="Questions about your order? Contact us at "+y.supportEmail,$.appendChild(J);const tt=document.createElement("p"),et=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(tt.textContent="Order placed on "+et,$.appendChild(tt),v.push(Z),w.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(w.layout.legalMessage.text);const n=document.createElement("div");n.classList.add("checkout-separator"),v.push(t),v.push(e),v.push(n)}if(b.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:c.POWERED_BY,context:"general"});v.push(t)}return v}}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 e;const n=t.find(t=>"checkout.giftCards"===t.path),a=t.find(t=>"checkout.loading"===t.path);n&&n.value.length>((null===(e=n.oldValue)||void 0===e?void 0:e.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),a&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),a=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!e||n||Boolean(a)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.giftCardInput;n.setValue(e),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 I=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(e){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",I),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I())}),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}}const shouldShowMinimumPurchaseAlert=(t,e=![])=>{var n,a;const c=t.subtotal;if(t.type===l.SHIPPING){const l=t.fees;if(e&&(null===(n=l.pack)||void 0===n?void 0:n.active)&&l.pack.min>0&&c<l.pack.min)return!![];if(!e&&(null===(a=l.individual)||void 0===a?void 0:a.active)&&l.individual.min>0&&c<l.individual.min)return!![]}else if(t.type===l.ON_DEMAND){const e=t.fees;if(e.min>0&&c<e.min)return!![]}return![]},getMinimumPurchaseMessage=(t,e=![])=>{var n,a;const c=t.subtotal;if(t.type===l.SHIPPING){const l=t.fees;let d=0;if(e&&(null===(n=l.pack)||void 0===n?void 0:n.active)&&l.pack.min>0?d=l.pack.min:(null===(a=l.individual)||void 0===a?void 0:a.active)&&l.individual.min>0&&(d=l.individual.min),d>0&&c<d)return{message:"+"+formatCentToDollarText(d-c)+" needed for order minimum",type:"warning"}}if(t.type===l.ON_DEMAND){const e=t.fees,n=e.min>0?e.min:0;if(n>0&&c<n)return{message:"+"+formatCentToDollarText(n-c)+" needed for order minimum",type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(t,e=![])=>{var n,a;const c=t.subtotal;if(t.type===l.SHIPPING){const l=t.fees;if(e&&(null===(n=l.pack)||void 0===n?void 0:n.active)&&l.pack.min>0&&c<l.pack.min)return!![];if(!e&&(null===(a=l.individual)||void 0===a?void 0:a.active)&&l.individual.min>0&&c<l.individual.min)return!![]}if(t.type===l.ON_DEMAND){const e=t.fees;if(e.min>0&&c<e.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const e={warning:"warning",success:"success",info:"info"},n={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},a=e[this.params.messageType]||"warning",c=document.createElement("div");return c.className="alert-icon alert-icon-"+this.params.messageType,c.appendChild(htmlStringToElement(n[a]({width:16,height:16,className:"alert-icon-svg"}))),c}template(){var t;const e=[],n=this.getIconElement();n&&e.push(n);const a=document.createElement("span");if(a.className="alert-message",a.textContent=this.params.message,e.push(a),"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 n=document.createElement("small");n.className="alert-details-text",n.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(n),e.push(t)}return 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(t){var e,n,a,c;const l=t.find(t=>"checkout.items"===t.path);l&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const d=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(d){const t=d.oldValue,l=d.value;if(l.updating)return![];const u=(null==t?void 0:t.quantity)!==(null==l?void 0:l.quantity),h=(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],p=(null===(c=null===(a=null==l?void 0:l.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.lines)||[],m=JSON.stringify(h)!==JSON.stringify(p);(u||m)&&this.updateEngravingElement(l)}return![]}updateEngravingElement(t){var e,n;const a=this.getConfigs("global"),l=this.container.querySelector(".engraving-view-container");if(l&&l.remove(),(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]&&a.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:c.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),n=this.container.querySelector(".checkout-item-card-footer");n&&n.before(e)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const e=t.fulfillmentId;if(!e)return;if(!this.container)return;const n=this.container.querySelector(".checkout-item-card-header");if(n){const a=this.getStoreValue("cart.fulfillments."+e),l=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(l&&l.remove(),shouldShowMinimumPurchaseAlert(a,t.pack)){const e=getMinimumPurchaseMessage(a,t.pack),l=ComponentFactoryService.createElement({type:c.PURCHASE_MIN_ALERT,message:e.message,messageType:e.type,currentTotal:a.subtotal,config:{showIcon:!![],alertType:"minimal"}});l.setAttribute("data-component-type","checkout-retailer-alert"),n.before(l)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),e=Object.keys(t.items).length,n=1===e;this.trashButton.disabled=n,n?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 e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.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 ',e.appendChild(n),t.appendChild(e),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(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,e,n;const a=this.getConfigs("global"),l=this.getStoreValue("checkout.items."+this.params.itemId),d=null===(t=null==l?void 0:l.attributes)||void 0===t?void 0:t.presale,u=(null==d?void 0:d.isActive)&&(null==d?void 0:d.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(d.estimatedShipBy):"";if(!l)return[];const h=document.createElement("div");h.classList.add("checkout-item-card-header");const p=document.createElement("img");p.classList.add("checkout-item-image"),p.src=l.mainImage,p.alt=l.name,p.loading="lazy",h.appendChild(p);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=l.name,m.appendChild(f);const g=document.createElement("div");g.classList.add("checkout-item-subtitle");const v=document.createElement("span");v.textContent=d.isActive?""+u:((null==l?void 0:l.expectationDetail)||"")+",",g.appendChild(v);const y=document.createElement("span");y.textContent="From "+((null==l?void 0:l.retailerName)||""),g.appendChild(y),m.appendChild(g),h.appendChild(m),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var e;if(t.preventDefault(),t.stopPropagation(),!(null===(e=this.trashButton)||void 0===e?void 0:e.disabled))try{await this.commands.checkout.removeItem(l.cartItemId)}catch(n){this.logger.error("Checkout item removal failed",n)}}),h.appendChild(this.trashButton);const b=ComponentFactoryService.createElement({type:c.CHECKOUT_ITEM_QUANTITY,itemId:l.cartItemId}),w=[];if(w.push(h),a.layout.enablePersonalization&&(null===(n=null===(e=null==l?void 0:l.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:c.ENGRAVING_VIEW,identifier:l.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 e=t.find(t=>"checkout.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,e,n;const a=this.getStoreValue("checkout.items."+this.params.itemId);if(!a)return 0;const c=this.getStoreValue("products");if(!c)return 0;const l=a.partNumber,d=a.fulfillmentId,u=null===(n=null===(e=null===(t=Object.values(c).find(t=>t.sizes[a.liquidId]))||void 0===t?void 0:t.sizes)||void 0===e?void 0:e[a.liquidId])||void 0===n?void 0:n.attributes.maxQuantityPerOrder;if(!u)return 0;const h=this.getStoreValue("checkout.items")||{},p=Object.values(h).filter(t=>t.partNumber===l&&t.fulfillmentId===d),m=p.reduce((t,e)=>t+e.quantity,0);return u-m}calculateQuantityLimits(){var t;const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const n=this.getStoreValue("checkout"),a=1===(null===(t=Object.values(n.items))||void 0===t?void 0:t.length),c=e.quantity,l=this.getAvailableQuantity(),d=l>0,u=!(a&&1===c);return{currentQuantity:c,availableQuantity:l,isTheOnlyItem:a,canIncrease:d,canDecrease:u}}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 e=this.calculateQuantityLimits(),n=this.params.itemId;if((!(t<0)||e.canDecrease)&&(!(t>0)||e.canIncrease)){if(!n)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(n,t)}catch(a){this.logger.error("Checkout item quantity change operation failed",a)}}}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 e=this.calculateQuantityLimits(),n=document.createElement("div");n.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)}),n.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),n.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)}),n.appendChild(this.increaseButton),this.updateButtonStates(e);const a=document.createElement("span");if(a.classList.add("checkout-item-price-text"),a.textContent=formatCentToDollarText(t.price),t.quantity>1){const e=document.createElement("span");e.classList.add("checkout-item-price-each-text"),e.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",a.appendChild(e)}return[n,a]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(t){return ComponentFactoryService.createElement({type:c.CHECKOUT_ITEM,itemId:t})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},e=new Map;for(const n of objectValues(t))n&&n.cartItemId&&e.set(n.cartItemId,n);return e}syncItemsWithStore(){const t=this.getItemsListContainer();if(!t)return;const e=this.getCurrentItemsMap(),n=t.querySelectorAll("[data-item-id]"),a=new Set;for(const c of n){const t=c.getAttribute("data-item-id");t&&a.add(t)}for(const c of n){const t=c.getAttribute("data-item-id");t&&!e.has(t)&&c.remove()}for(const[c]of e)if(!a.has(c)){const e=this.createItemElement(c);e.setAttribute("data-item-id",c),t.appendChild(e)}this.updateItemCount()}updateItemCount(){const t=this.getTogglerLabel();if(!t)return;const e=this.getCurrentItemsMap(),n=e.size;t.textContent=n+" item"+(1!==n?"s":"")}onStoreChanged(t){let e;for(let n=0;n<t.length;n++){const a=t[n];if("checkout"===a.path||"checkout.items"===a.path||"checkout.items."===a.path.substring(0,15)){e=a;break}}return e?(this.syncItemsWithStore(),![]):![]}handleToggle(){const t=this.container.querySelector(".checkout-items-toggler-button"),e=this.container.querySelector(".checkout-items-list");if(t&&e){const n=e.classList.contains("show");e.classList.toggle("show"),t.classList.toggle("expanded"),n?(t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label","Expand checkout items")):(t.setAttribute("aria-expanded","true"),t.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const t=this.container.querySelector(".checkout-items-toggler"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");if(t&&e&&n){const a=n.classList.contains("show");e.setAttribute("tabindex","0"),e.setAttribute("aria-expanded",a?"true":"false"),e.setAttribute("aria-label",a?"Collapse checkout items":"Expand checkout items"),t.addEventListener("click",()=>this.handleToggle()),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.items"),e=objectValues(t||{}),n=document.createElement("div");n.classList.add("checkout-items-toggler");const a=document.createElement("span");a.classList.add("checkout-items-toggler-label"),a.textContent=e.length+" item"+(1!==e.length?"s":""),n.appendChild(a);const c=document.createElement("button");c.type="button",c.classList.add("checkout-items-toggler-button"),c.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(c);const l=document.createElement("div");l.classList.add("checkout-items-list","show");for(const d of e){const t=this.createItemElement(d.cartItemId);t.setAttribute("data-item-id",d.cartItemId),l.appendChild(t)}return[n,l]}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchStorePaths:["checkout.isFormValid","checkout.invalidFields","checkout.stripeFormStatus","checkout.stripeFormStatus.isComplete","checkout.stripeFormStatus.hasError","checkout.stripeFormStatus.isProcessing","checkout.stripeFormStatus.errorMessage","checkout.readyForSubmit","checkout.readyForSubmit.payment","checkout.readyForSubmit.prepared","checkout.loading","checkout.error","checkout.payment.sendSubmitSignal"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-payment-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreChanged(t){const e=t.some(t=>"checkout.isFormValid"===t.path||"checkout.invalidFields"===t.path||"checkout.stripeFormStatus"===t.path||"checkout.stripeFormStatus."===t.path.substring(0,26)||"checkout.readyForSubmit"===t.path||"checkout.readyForSubmit."===t.path.substring(0,23)||"checkout.loading"===t.path||"checkout.error"===t.path);e&&this.updateButtonState();const n=t.find(t=>"checkout.readyForSubmit"===t.path);return n&&this.handleCheckoutReadyForSubmit(n.value),![]}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.isFormValid")||![],e=this.store.get("checkout.invalidFields")||[],n=this.store.get("checkout.stripeFormStatus")||{},a=this.store.get("checkout.loading")||![],c=this.store.get("checkout.error")||null,l=n.isComplete||![],d=n.hasError||![],u=n.isProcessing||![],h=n.errorMessage||null;this.updateErrorDisplay(this.determineErrorMessage(c,h));const p=this.determineButtonState({isFormValid:t,invalidFieldsCount:e.length,isPaymentComplete:l,hasPaymentError:d,isStripeProcessing:u,isCheckoutLoading:a,hasCheckoutError:!!c});this.applyButtonState(p)}determineErrorMessage(t,e){return t&&e?e:e||t}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const e=this.errorContainer.querySelector(".error-text");e&&(this.clearErrorTimeout(),t?(e.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(()=>{this.errorTimeoutId=null,this.commands.checkout.removeCheckoutError();const t=this.store.get("checkout.stripeFormStatus");(null==t?void 0:t.errorMessage)&&this.commands.checkout.updateStripeFormStatus({errorMessage:null})},3e3)):(e.textContent="",this.errorContainer.style.display="none"))}determineButtonState(t){const{isFormValid:e,invalidFieldsCount:n,isPaymentComplete:a,hasPaymentError:c,isStripeProcessing:l,isCheckoutLoading:d,hasCheckoutError:u}=t,h=this.config.layout.placeOrderButtonText,p=this.config.layout.placeOrderButtonShowRequiredFields,m=e&&a&&!c&&!l&&!u,f=this.store.get("checkout.readyForSubmit.payment")||![],g=this.store.get("checkout.readyForSubmit.prepared")||![],v=this.store.get("checkout.payment.sendSubmitSignal")||![],y=this.store.get("checkout.isPresaleLocked")||![];let b=![];if(!y){const t=this.getStoreValue("cart.fulfillments")||{};b=Object.values(t).some(t=>hasUnmetMinimum(t))}const w=l||d||v;if(d&&!l&&!v)return{state:"processing",text:h,disabled:!![]};if(b)return{state:"disabled",text:h,disabled:!![]};if(w)return f&&g?{state:"processing",text:"Placing Order...",disabled:!![]}:f&&!g?{state:"processing",text:"Preparing Order...",disabled:!![]}:g&&!f&&(l||v)||v||l?{state:"processing",text:"Processing Payment...",disabled:!![]}:{state:"processing",text:"Placing Order...",disabled:!![]};if(!e){const t=n>0?" ("+n+")":"";return{state:"form-invalid",text:p?"Complete Required Fields"+t:h,disabled:![]}}return a?c?{state:"payment-error",text:h,disabled:![]}:m?{state:"ready",text:h,disabled:![]}:{state:"disabled",text:h,disabled:!![]}:{state:"payment-incomplete",text:"Complete Payment Information",disabled:![]}}applyButtonState(t){if(!this.placeOrderButton)return;const e=["processing","form-invalid","payment-incomplete","payment-error","ready","disabled"];this.placeOrderButton.classList.remove(...e),this.placeOrderButton.classList.add(t.state),this.placeOrderButton.disabled=t.disabled,this.placeOrderButton.textContent=t.text}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.isFormValid")||![],e=this.store.get("checkout.stripeFormStatus")||{},n=this.store.get("checkout.loading")||![],a=e.isComplete||![],c=e.hasError||![],l=e.isProcessing||![];if(l||n)return;if(!t)return await this.commands.checkout.focusFirstInvalidField(),void 0;if(!a||c)return this.showPaymentError(),void 0;await this.commands.checkout.startPreparingCheckoutSubmit()}catch(t){this.logger.error("Error handling place order click",t)}}showPaymentError(){const t=document.querySelector(".checkout-stripe-form");t&&safeScrollIntoView(t,{behavior:"smooth",block:"center"})}async handleCheckoutReadyForSubmit(t){if(!t)return;const{payment:e,prepared:n,customer:a,gift:c,billing:l}=t,d=e&&n&&a&&l&&c;d&&await this.commands.checkout.checkoutComplete()}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",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePlaceOrderClick())});const e=document.createElement("div");e.classList.add("checkout-payment-error-wrapper"),e.setAttribute("role","alert"),e.style.display="none";const n=document.createElement("div");n.classList.add("checkout-payment-error");const a=document.createElement("span");a.classList.add("icon-error"),a.innerHTML=ErrorInfoIcon({});const l=document.createElement("span");l.classList.add("error-text"),n.appendChild(a),n.appendChild(l),e.appendChild(n);const d=ComponentFactoryService.createElement({type:c.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,d,t]}}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"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),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=[],e=this.getConfigs("global"),n=document.createElement("div");n.classList.add("checkout-completed-section-container");const a=document.createElement("div");a.classList.add("checkout-completed-title-section");const l=document.createElement("div");l.classList.add("checkout-completed-title-section");const d=document.createElement("p");d.textContent="Session Expired",l.appendChild(d);const u=document.createElement("p");u.textContent="Your reservation time has ended. The item has been released for other customers.",l.appendChild(u),a.appendChild(l),n.appendChild(a);const h=document.createElement("div");h.classList.add("checkout-completed-help-section");const p=document.createElement("p");p.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.",h.appendChild(p),n.appendChild(h),t.push(n);const m=document.createElement("div");m.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}));f.appendChild(v),f.addEventListener("click",()=>this.handleExit()),f.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),m.appendChild(f),t.push(m);const y=document.createElement("div");y.classList.add("checkout-completed-section-container");const b=document.createElement("p");b.classList.add("checkout-completed-auto-close-text"),b.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 w=document.createElement("span");if(w.classList.add("checkout-completed-auto-close-text"),w.textContent="seconds",y.appendChild(b),y.appendChild(this.autoCloseElement),y.appendChild(w),t.push(y),e.layout.showPoweredBy){const e=document.createElement("div");e.classList.add("checkout-completed-powered-by-container");const n=ComponentFactoryService.createElement({type:c.POWERED_BY,context:"checkout"});e.appendChild(n),t.push(e)}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 e=t.find(t=>"checkout.promoCode"===t.path),n=t.find(t=>"checkout.loading"===t.path);if(e){const{value:t,oldValue:n}=e,a=Boolean(n),c=Boolean(t);if(!a&&c)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(a&&!c)return this.container.innerHTML="",this.createInputContainer(),void 0;c&&this.promoCodeText&&t.discountAmount!==(null==n?void 0:n.discountAmount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")")}n&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),a=this.getStoreValue("checkout.promoCode"),c=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!e||n||Boolean(a)||Boolean(c)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:c.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),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 I=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(e){this.logger.error("Checkout promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",I),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I())}),this.applyButton}createAppliedContainer(t){const e=document.createElement("div");e.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.discountAmount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),this.container.appendChild(e),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 e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),e}const e=[];return e.push(this.createPromoInput()),e.push(this.createApplyButton()),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(t){const e=this.getStoreValue("checkout.updating")||![];if(!e)try{await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Checkout tips update failed",n)}}async handleFulfillmentTipInput(t,e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const a=this.getOnDemandFulfillmentTipInfo();if(!a[t])return;const c=Math.round(100*e);try{await this.commands.checkout.updateFulfillmentTip(t,c)}catch(l){this.logger.error("Checkout fulfillment tip update failed",l)}}async removeTipFromFulfillment(t){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const n=this.getOnDemandFulfillmentTipInfo();if(n[t])try{await this.commands.checkout.removeFulfillmentTip(t)}catch(a){this.logger.error("Checkout fulfillment tip removal failed",a)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const e=[10,18,20],n=this.getStoreValue("checkout.updating")||![],a=this.getTipSelection();for(const c of e){const e=document.createElement("button");e.type="button",e.textContent=c+"%",e.classList.add("checkout-tip-button"),e.disabled=n,a===c&&e.classList.add("selected"),e.addEventListener("click",()=>this.handlePercentageSelect(c)),t.appendChild(e)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".retailers-tips-list");t&&e&&n&&t.addEventListener("click",()=>{const t=n.classList.contains("show");n.classList.toggle("show"),t?(e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand tips section")):(e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse tips section")),e.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;const n=document.createElement("div");n.classList.add("checkout-tip-distribution-header");const a=document.createElement("h3");a.textContent="View Tip Distribution",a.classList.add("checkout-sub-header"),n.appendChild(a);const c=document.createElement("button");c.type="button",c.classList.add("checkout-items-toggler-button"),c.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(c),t.appendChild(n);const l=document.createElement("div");l.classList.add("retailers-tips-list","show");for(const d of e){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const e=document.createElement("h4");e.textContent=d.retailerName,e.classList.add("checkout-sub-header"),t.appendChild(e);const n=document.createElement("div");n.classList.add("checkout-tip-fulfillment-input-wrapper");const a=document.createElement("div");a.classList.add("dollar-input-container");const c=document.createElement("span");c.classList.add("dollar-sign"),c.textContent="$";const u=document.createElement("input");let h;u.type="number",u.id="tip-input-"+d.fulfillmentId,u.name="tip-"+d.fulfillmentId,u.min="0",u.step="0.01",u.placeholder="0.00",u.classList.add("dollar-input"),u.value=d.tip>0?(d.tip/100).toFixed(2):"",u.disabled=this.getStoreValue("checkout.updating")||![],u.addEventListener("wheel",t=>{t.preventDefault()}),u.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),u.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),u.addEventListener("paste",t=>{t.preventDefault()}),u.addEventListener("contextmenu",t=>{t.preventDefault()}),u.addEventListener("input",t=>{const e=t.target;let n=e.value;if(Number.parseFloat(n)<0&&(e.value=Math.abs(Number.parseFloat(n)).toString(),n=e.value),n.includes(".")){const t=n.split(".");t.length>1&&t[1].length>2&&(e.value=t[0]+"."+t[1].substring(0,2))}}),u.addEventListener("input",t=>{const e=t.target,n=Number.parseFloat(e.value)||0;h&&clearTimeout(h),h=setTimeout(()=>{this.handleFulfillmentTipInput(d.fulfillmentId,n)},500)}),a.appendChild(c),a.appendChild(u),n.appendChild(a);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(d.fulfillmentId)),n.appendChild(p),t.appendChild(n),l.appendChild(t)}return t.appendChild(l),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),e=this.getFulfillmentTipInfoArray();if(t&&e.length>0){const t=e.some(t=>t.tip>0);if(t)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(n){this.logger.error("Default tip initialization failed",n),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(a){this.logger.error("Default tip initialization failed during fallback",a),this.isInitialized=![]}}template(){const t=[],e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;e.length>0&&this.initializeDefaultTip();const n=document.createElement("section");n.classList.add("checkout-tip-container");const a=document.createElement("h3");a.classList.add("checkout-sub-header"),a.textContent="Add a tip",n.appendChild(a);const c=document.createElement("div");c.classList.add("checkout-tip-config-container");const l=this.createTipSelectionButtons();c.appendChild(l),n.appendChild(c);const d=document.createElement("p");d.classList.add("checkout-tip-disclaimer"),d.textContent="Tips will be split proportionally between retailers.",n.appendChild(d);const u=this.createTipDistribution();return t.push(n,u),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 e,n;const a=t.find(t=>"checkout.giftCardError"===t.path),c=t.find(t=>"checkout.promoCodeError"===t.path),l=t.find(t=>"checkout.giftCards"===t.path);if(l&&this.updateAppliedGiftCards(l.value),a){const t=this.container.querySelector(".input-gift-card-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()),a.value){const e=this.createErrorElement(a.value);t.after(e)}const c=t.querySelector(".apply-button");c&&(c.disabled=Boolean(a.value))}}if(c){const t=this.container.querySelector(".input-promo-code-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()),c.value){const e=this.createErrorElement(c.value);t.after(e)}const a=t.querySelector(".apply-button");a&&(a.disabled=Boolean(c.value))}}}updateAppliedGiftCards(t){const e=t&&t.length>0;if(!e)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 e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)})}createAppliedGiftCardElement(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),e.setAttribute("data-gift-card-code",t.code);const n=document.createElement("span");n.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",e.appendChild(n);const a=document.createElement("button");return a.type="button",a.textContent="Remove",a.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),e.appendChild(a),e}pcInputContainer(){const t=ComponentFactoryService.createElement({type:c.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return t}gcInputContainer(){const t=ComponentFactoryService.createElement({type:c.CHECKOUT_GIFT_CARDS});return t}inputContainer(){var t;const e=this.getConfigs("checkout"),n=this.getConfigs("global"),a=e.layout.allowGiftCards,c=null===(t=null==n?void 0:n.layout)||void 0===t?void 0:t.allowPromoCodes,l=document.createElement("div");l.classList.add("checkout-pc-gc-sub-container");const d=this.pcInputContainer(),u=this.gcInputContainer();c&&l.appendChild(d);const h=this.getStoreValue("checkout.promoCodeError");if(h){const t=this.createErrorElement(h);t.classList.add("promo-code-error-wrapper"),l.appendChild(t)}a&&l.appendChild(u);const p=this.getStoreValue("checkout.giftCardError");if(p){const t=this.createErrorElement(p);l.appendChild(t)}return l}createErrorElement(t){const e=document.createElement("div");e.classList.add("error-banner-checkout");const n=document.createElement("div");n.innerHTML=ErrorInfoIcon({});const a=document.createElement("p");return a.textContent=t.toString(),e.appendChild(n),e.appendChild(a),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),e.remove()},3e3),e}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const e=[];return e.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 e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)}),e.push(this.appliedGiftCardsContainer)),e}disconnected(){this.appliedGiftCardsContainer=null}}class ProductComponent extends BaseComponent{constructor(){super({watchStorePaths:["products.{productId}.loading","products.{productId}.error"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen","products.{productId}.rerender"]}),this.titleElement=null}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen"),a=t.find(t=>t.path==="products."+e+".rerender");n&&this.titleElement&&this.titleElement.classList.toggle("hide",n.value),(null==a?void 0:a.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:c.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:c.PRODUCT_LOADING});const a=n.sizes[n.selectedSizeId],l=document.createElement("div");l.classList.add("product-content-wrapper"),l.setAttribute("role","region"),l.setAttribute("aria-label",""+n.name);const d=document.createElement("div");if(d.classList.add("product-content"),d.setAttribute("role","region"),d.setAttribute("aria-label",""+n.name),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=n.name,this.titleElement=t,d.appendChild(t)}const u=ComponentFactoryService.createElement({type:c.PRODUCT_OPTIONS,productId:e});d.appendChild(u);const h=ComponentFactoryService.createElement({type:c.PRODUCT_DRAWER,productId:e});if(d.appendChild(h),l.appendChild(d),!this.config.layout.showImages||!(null===(t=n.images)||void 0===t?void 0:t.length))return l;l.classList.add("has-images");const p=ComponentFactoryService.createElement({type:c.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:a.image,productId:e});return l.prepend(p),p.setAttribute("aria-label","Product images"),l}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["engraving-form"]}beforeConnected(){var t;if(this.engravingLines=this.params.lines,"product"===this.params.context){const e=this.store.get("products."+this.params.identifier);this.fulfillmentId=e.selectedFulfillmentId,this.partNumber=(null===(t=e.selectedFulfillment)||void 0===t?void 0:t.partNumber)||null}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,e;if("product"===this.params.context){const n=this.store.get("products."+this.params.identifier),a=n.sizes[n.selectedSizeId],c=a.shippingFulfillments[this.fulfillmentId],l=c.price,d=(null===(e=null===(t=null==a?void 0:a.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.fee)||0;return l+d}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier),e=t.unitPrice,n=t.attributes.engraving.fee||0;return e+n}return 0}productInformationSection(){const t=[];let e="",n="";if("product"===this.params.context){const a=this.store.get("products."+this.params.identifier);a.mainImage?t.push(a.mainImage):t.push(...a.images||[]),e=a.name,n=a.sizes[a.selectedSizeId].size}if("cart"===this.params.context){const a=this.store.get("cart.items."+this.params.identifier);a.mainImage&&t.push(a.mainImage),e=a.name,n=a.size}const a=document.createElement("div");if(a.className="product-info-section",t.length>0){const n=document.createElement("div");n.className="product-image-container";const c=document.createElement("img");c.src=t[0],c.alt=e,c.loading="lazy",c.className="product-image",n.appendChild(c),a.appendChild(n)}const c=document.createElement("div");c.className="product-details-container";const l=document.createElement("div");l.className="product-header";const d=document.createElement("h4");d.className="product-title",d.textContent=e,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),l.appendChild(d),l.appendChild(this.productPriceSpan),c.appendChild(l);const u=document.createElement("p");u.className="product-size-text",u.textContent=n,c.appendChild(u);const h=document.createElement("p");return h.className="engraving-fees-disclaimer",h.textContent="Personalization fees included in total, varies by retailer.",c.appendChild(h),a.appendChild(c),a}addToCartButtonText(t){if("product"!==this.params.context)return"Save";const e=this.getConfigs("product"),n=e.layout.addToCartButtonText;return e.layout.addToCartButtonShowTotalPrice?n+" - "+formatCentToDollarText(t):n}retailersSection(){var t,e,n,a,c,l,d;const u=this.store.get("products."+this.params.identifier),h=u.sizes[u.selectedSizeId],p=objectValues(h.shippingFulfillments).filter(t=>t.isVariantEngravable&&t.canEngrave),m=document.createElement("div");m.className="fulfillment-section";const f=document.createElement("p");if(f.className="shipping-from-text",f.innerHTML="Shipping from: <b>"+(null===(t=u.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",m.appendChild(f),1===p.length)return m;const g=document.createElement("div");g.className="fulfillment-options-container",m.appendChild(g);const v=document.createElement("span");v.className="see-more-fulfillments",v.textContent="See More Delivery Options ("+p.length+")",v.setAttribute("role","button"),v.setAttribute("tabindex","0"),v.setAttribute("aria-label","See More Delivery Options ("+p.length+")"),v.setAttribute("aria-expanded","false");const T=()=>{const t=g.classList.contains("expanded");g.classList.toggle("expanded"),t?(v.textContent="See More Delivery Options ("+p.length+")",v.setAttribute("aria-label","See More Delivery Options ("+p.length+")"),v.setAttribute("aria-expanded","false")):(v.textContent="See Less Delivery Options",v.setAttribute("aria-label","See Less Delivery Options"),v.setAttribute("aria-expanded","true"))};v.addEventListener("click",T),v.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),T())}),m.appendChild(v);for(const y of p){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",y.fulfillmentId),y.fulfillmentId===(null===(e=u.selectedFulfillment)||void 0===e?void 0:e.fulfillmentId)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+y.retailerName+", "+formatCentToDollarText(y.price+((null===(a=null===(n=u.sizes[u.selectedSizeId].attributes)||void 0===n?void 0:n.engraving)||void 0===a?void 0:a.fee)||0))+", "+y.expectation.engraving),t.setAttribute("aria-pressed",y.fulfillmentId===(null===(c=u.selectedFulfillment)||void 0===c?void 0:c.fulfillmentId)?"true":"false");const i=()=>{this.fulfillmentId=y.fulfillmentId,this.partNumber=y.partNumber;const e=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(e),this.productPriceSpan.textContent=formatCentToDollarText(e);const n=g.querySelector(".fulfillment-option.selected");n&&(n.classList.remove("selected"),n.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),f.innerHTML="Shipping from: <b>"+y.retailerName+"</b>"};t.addEventListener("click",i),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())});const h=y.price+((null===(d=null===(l=u.sizes[u.selectedSizeId].attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.fee)||0),p=document.createElement("div");p.className="option-row row-1",t.appendChild(p);const m=document.createElement("span");m.className="retailer-name",m.textContent=y.retailerName,p.appendChild(m);const v=document.createElement("span");v.className="fulfillment-price",v.textContent=formatCentToDollarText(h),p.appendChild(v),t.appendChild(p);const b=document.createElement("div");b.className="option-row row-2",t.appendChild(b);const w=document.createElement("span");w.className="estimated-time",w.textContent=""+y.expectation.engraving,b.appendChild(w),t.appendChild(b),g.appendChild(t)}return m}engravingLinesSection(){var t;const{lines:e,maxLines:n,location:a,maxCharsPerLine:c}=this.params,l=document.createElement("div");l.className="engraving-section";const d=document.createElement("p");if(d.className="engraving-title",d.textContent="Personalize Your Bottle",l.appendChild(d),a&&(null===(t=null==a?void 0:a.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-location-text",t.textContent="Your message will appear "+a.toLowerCase()+".",l.appendChild(t)}const u=Array.from({length:n},(t,n)=>{const a=n+1,l=document.createElement("div");l.className="engraving-input-wrapper",l.setAttribute("data-line-number",a.toString());const d=document.createElement("input");d.type="text",d.id="engraving-line-"+a,d.dataset.lineNumber=a.toString(),d.maxLength=c,d.value=e[n]||"",d.placeholder=a>1?"Line "+a+" (optional)":"Line "+a,d.className="engraving-input",d.autocomplete="off",d.setAttribute("aria-label",a>1?"Engraving line "+a+", optional, maximum "+c+" characters":"Engraving line "+a+", maximum "+c+" characters");const u=document.createElement("span");return u.className="engraving-char-count",u.textContent=d.value.length+"/"+c,u.setAttribute("aria-live","polite"),u.setAttribute("aria-atomic","true"),d.addEventListener("input",()=>{u.textContent=d.value.length+"/"+c,this.engravingLines[n]=d.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),l.appendChild(d),l.appendChild(u),l}),h=document.createElement("div");return h.className="engraving-inputs-container",h.append(...u),l.appendChild(h),l}actionButtonsSection(){const{identifier:t,context:e}=this.params,n=document.createElement("div");n.className="action-buttons-container";const a=document.createElement("button");a.type="button",a.className="cancel-action-button",a.textContent="Cancel",a.setAttribute("aria-label","Cancel personalization and close");const o=async()=>{"product"===e&&await this.commands.product.closeProductDrawer(t),"cart"===e&&this.commands.ui.openDrawer(c.CART)};a.addEventListener("click",o),a.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o())}),n.appendChild(a),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===e?"Add personalized item to cart":"Update personalization and return to cart");const k=async()=>{const n=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);if("product"===e&&this.fulfillmentId&&this.partNumber){const e=this.store.get("products."+t);await this.commands.product.addToCart(t,{upc:e.sizes[e.selectedSizeId].upc,fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:n,identifier:t}),await this.commands.product.closeProductDrawer(t)}"cart"===e&&(await this.commands.cart.updateItemEngraving(t,n),this.commands.ui.openDrawer(c.CART))};return this.addToCartButton.addEventListener("click",k),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),k())}),n.appendChild(this.addToCartButton),n}template(){const t=[],e=this.productInformationSection();if(t.push(e),"product"===this.params.context){const e=this.retailersSection();t.push(e)}const n=this.engravingLinesSection();t.push(n);const a=this.actionButtonsSection();t.push(a);const c=document.createElement("p");return c.className="engraving-disclaimer",c.innerHTML="Personalized orders require up to 10 business days to be processed and then shipped. Tracking information will be provided once processed. <b>Personalized bottle orders cannot be cancelled.</b>",t.push(c),t}}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 e=this.getStoreValue("cart.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,a=(null==e?void 0:e.quantity)||1;return{quantity:a,fee:n,total:n*a}}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,a=(null==e?void 0:e.quantity)||1;return{quantity:a,fee:n,total:n*a}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,e,n,a,l,d,u,h,p,m,f,g,v,y,b,w,S,E,P,F;const D=this.params.identifier,A={identifier:D,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const c=this.getStoreValue("cart.items."+D);A.lines=(null===(e=null===(t=null==c?void 0:c.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.lines)||[],A.maxLines=(null===(a=null===(n=null==c?void 0:c.attributes)||void 0===n?void 0:n.engraving)||void 0===a?void 0:a.maxLines)||1,A.maxCharsPerLine=(null===(d=null===(l=null==c?void 0:c.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.maxCharsPerLine)||16,A.fee=(null===(h=null===(u=null==c?void 0:c.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.fee)||0,A.location=(null===(m=null===(p=null==c?void 0:c.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+D);A.lines=(null===(g=null===(f=null==t?void 0:t.attributes)||void 0===f?void 0:f.engraving)||void 0===g?void 0:g.lines)||[],A.maxLines=(null===(y=null===(v=null==t?void 0:t.attributes)||void 0===v?void 0:v.engraving)||void 0===y?void 0:y.maxLines)||1,A.maxCharsPerLine=(null===(w=null===(b=null==t?void 0:t.attributes)||void 0===b?void 0:b.engraving)||void 0===w?void 0:w.maxCharsPerLine)||16,A.fee=(null===(E=null===(S=null==t?void 0:t.attributes)||void 0===S?void 0:S.engraving)||void 0===E?void 0:E.fee)||0,A.location=(null===(F=null===(P=null==t?void 0:t.attributes)||void 0===P?void 0:P.engraving)||void 0===F?void 0:F.location)||""}this.commands.ui.openDrawer(c.ENGRAVING_FORM,A)}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(),e=this.engravingLines();if(0===e.length)return"";const n=document.createElement("div");n.className="engraving-header";const a=document.createElement("h3");a.textContent="Personalization";const c=document.createElement("span");if(c.className="engraving-fee",1===t.quantity&&(c.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){c.textContent=formatCentToDollarText(t.total,![]);const e=document.createElement("span");e.className="engraving-fee-each",e.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",c.appendChild(e)}n.appendChild(a),n.appendChild(c);const l=document.createElement("div");l.className="engraving-body";const d=document.createElement("div");d.className="engraving-lines";for(const p of e){const t=document.createElement("span");t.className="engraving-line",t.textContent=p,d.appendChild(t)}const u=document.createElement("div");u.className="engraving-actions";const h=document.createElement("button");h.type="button",h.classList.add("remove-button"),h.textContent="Remove",h.setAttribute("aria-label","Remove engraving");const X=async()=>{await this.handleRemove()};if(h.addEventListener("click",X),h.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await X())}),u.appendChild(h),"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())}),u.appendChild(t)}return l.appendChild(d),l.appendChild(u),[n,l]}}function fulfillmentAddress(t,e){if(!t)return"";if(e===l.SHIPPING){const e=[t.city,t.state].filter(Boolean);return e.join(", ")}const n=[t.one,t.two,t.city,t.state].filter(Boolean);return n.join(", ")}const yt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],bt=1440;function timeToMinutes(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new Error("Invalid time format: "+t);const n=Number.parseInt(e[1],10),a=Number.parseInt(e[2],10);if(n<0||n>47||a<0||a>59)throw new Error("Invalid time values: "+t);return 60*n+a}function getCurrentTimeInTimezone(t){var e,n,a;const c=new Date,l={timeZone:t,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const t=new Intl.DateTimeFormat("en-US",l),d=t.formatToParts(c),u=(null===(e=d.find(t=>"weekday"===t.type))||void 0===e?void 0:e.value.toLowerCase())||"",h=(null===(n=d.find(t=>"hour"===t.type))||void 0===n?void 0:n.value)||"0",p=(null===(a=d.find(t=>"minute"===t.type))||void 0===a?void 0:a.value)||"0",m=60*Number.parseInt(h,10)+Number.parseInt(p,10);return{weekday:u,timeInMinutes:m}}catch(d){throw new Error("Invalid timezone: "+t)}}function format24TimeTo12(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e||"object"==typeof e)return t;let n=Number.parseInt(e[1],10);const a=e[2];n>=24&&(n-=24);const c=n>=12?"PM":"AM",l=0===n?12:n>12?n-12:n;return l+":"+a+" "+c}function isWithinTimeSlot(t,e){try{const n=timeToMinutes(e.startsAt),a=timeToMinutes(e.endsAt);if(a>bt){if(t>=n||t<a-bt)return"during"}else if(a<n){if(t>=n||t<a)return"during"}else if(t>=n&&t<a)return"during";return t<n?"before":"after"}catch(n){return"after"}}function getNextOpeningTime(t,e,n=7){var a,c;const l=yt.indexOf(e);for(let u=1;u<=n;u++){const e=(l+u)%7,n=yt[e],h=t[n];if((null==h?void 0:h.active)&&h.times&&h.times.length>0)try{const t=1===u?"tomorrow":n;return"Opens "+t+" at "+format24TimeTo12(null!==(c=null===(a=null==h?void 0:h.times[0])||void 0===a?void 0:a.startsAt)&&void 0!==c?c:"")}catch(d){}}return null}function validateFulfillmentData(t){return t&&"object"==typeof t&&t.hours&&t.timezone?"string"!=typeof t.timezone?![]:!![]:![]}function getRetailerOffHours(t){var e;if(!(null==t?void 0:t.type)||(null==t?void 0:t.type)!==l.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(t))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:n,timeInMinutes:a}=getCurrentTimeInTimezone(t.timezone),c=t.hours[n];if(!(null==c?void 0:c.active)||!(null===(e=c.times)||void 0===e?void 0:e.length)){const e=getNextOpeningTime(t.hours,n);return{message:e,isOpen:![],isClosed:!![]}}for(const t of c.times){const e=isWithinTimeSlot(a,t);switch(e){case"before":return{message:"Opens at "+format24TimeTo12(t.startsAt),isOpen:![],isClosed:!![],openTime:t.startsAt,closeTime:t.endsAt};case"during":{let e=t.endsAt;const n=timeToMinutes(e);if(n>bt){const t=Math.floor(n/60)-24,a=n%60;e=t.toString().padStart(2,"0")+":"+a.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(e),isOpen:!![],isClosed:![],openTime:t.startsAt,closeTime:t.endsAt}}}}const l=getNextOpeningTime(t.hours,n);return{message:l,isOpen:![],isClosed:!![]}}catch(n){return{message:null,isOpen:![],isClosed:!![]}}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,fulfillmentStatus:a,selectedSizeAttributes:c}){var d,u,h,p,m;let f=0;const g=null==c?void 0:c.presale,v=(null==g?void 0:g.isActive)&&(null==g?void 0:g.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(g.estimatedShipBy):"",y=e===l.SHIPPING,b=e===l.ON_DEMAND;y&&(f=(null===(u=null===(d=null==t?void 0:t.fees)||void 0===d?void 0:d.individual)||void 0===u?void 0:u.fee)||0),b&&(f=(null===(h=null==t?void 0:t.fees)||void 0===h?void 0:h.fee)||0);const w=fulfillmentAddress(t.retailerAddress,e);let S=null;e===l.ON_DEMAND&&a.openTime&&(null==a?void 0:a.closeTime)&&(S=a.isOpen?"Closes at "+format24TimeTo12$1(null==a?void 0:a.closeTime):"Opens at "+format24TimeTo12$1(null==a?void 0:a.openTime));const E=e===l.ON_DEMAND&&a&&a.isClosed?"closed":"",P=document.createElement("div");P.className="popup-retailer-card "+(n?"selected":"")+" "+E,P.setAttribute("data-fulfillment-id",t.fulfillmentId),P.setAttribute("role","button"),P.setAttribute("tabindex","0"),P.setAttribute("aria-pressed",n?"true":"false");const F=e===l.SHIPPING?"Shipping":"Same-day delivery";P.setAttribute("aria-label",F+" from "+t.retailerName+", "+formatCentToDollarText(null!==(p=t.price)&&void 0!==p?p:0));const D=document.createElement("div");D.className="row";const A=document.createElement("span");A.className="name",A.textContent=t.retailerName,D.appendChild(A);const _=document.createElement("span");_.className="price",_.textContent=formatCentToDollarText(null!==(m=t.price)&&void 0!==m?m:0),D.appendChild(_),P.appendChild(D);const z=document.createElement("div");z.className="row";const O=document.createElement("span");O.className="expectation",O.textContent=a.isClosed?S:(null==g?void 0:g.isActive)?v:(null==t?void 0:t.expectation.detail)||"No expectation available",z.appendChild(O);const M=document.createElement("span");if(M.className="fee",M.textContent=f>0?formatCentToDollarText(f):"Free Delivery",z.appendChild(M),P.appendChild(z),b){const t=document.createElement("div");t.className="row";const e=document.createElement("span");e.className="address",e.textContent=w,t.appendChild(e),P.appendChild(t)}return P}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:e,shippingSelected:n,onDemandSelected:a,onTabClick:c,enableShippingFulfillment:d,enableOnDemandFulfillment:u}){const h=e.length>0,p=document.createElement("div");if(p.className="fulfillment-tabs-container",p.setAttribute("role","tablist"),p.setAttribute("aria-label","Delivery method options"),d){const e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",l.SHIPPING),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",n?"true":"false"),e.setAttribute("aria-label","Shipping, "+t.length+" options"),e.addEventListener("click",c),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())});const a=document.createElement("span");a.className="fulfillment-tab-label "+(n?"selected":""),a.textContent="Shipping ("+t.length+")",e.appendChild(a),p.appendChild(e)}if(u){const t=document.createElement("div");t.className="fulfillment-tab "+(a?"selected":"")+" "+(h?"":"disabled"),t.setAttribute("data-fulfillment-type",l.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",a?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+e.length+" options"),h||t.setAttribute("aria-disabled","true"),t.addEventListener("click",c),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())});const n=document.createElement("span");n.className="fulfillment-tab-label "+(a?"selected":""),n.textContent="Same-Day Delivery ("+e.length+")",t.appendChild(n),p.appendChild(t)}return p}class ProductAddToCartSectionComponent extends BaseComponent{get hostClasses(){return["add-to-cart-container"]}get hostAttributes(){return{role:"region","aria-live":"polite","aria-atomic":"false","aria-label":"Add to cart section"}}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment||!n.selectedSizeId)return 0;const a=n.selectedFulfillment.partNumber,c=n.selectedFulfillment.fulfillmentId,l=null===(t=n.sizes[n.selectedSizeId].attributes)||void 0===t?void 0:t.maxQuantityPerOrder;if(!l)return 0;const d=this.getStoreValue("cart.items")||{},u=Object.values(d).filter(t=>t.partNumber===a&&t.fulfillmentId===c),h=u.reduce((t,e)=>t+e.quantity,0);return l-h}isFulfillmentClosed(){const t=this.getProductId(),e=this.getStoreValue("products."+t);if(!e.selectedFulfillment)return![];const n=getRetailerOffHours(e.selectedFulfillment);return e.selectedFulfillmentType===l.ON_DEMAND&&n&&n.isClosed}isButtonLoading(){const t=this.getProductId();return this.getStoreValue("products."+t+".updating")}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),e=this.getAvailableQuantity(),n=t<e;return{currentQuantity:t,availableQuantity:e,canIncrease:n,canDecrease:t>1}}async handleAddToCart(){var t,e,n;const a=this.getProductId(),c=this.getStoreValue("products."+a);if(!c.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:a,selectedSizeId:c.selectedSizeId}),void 0;const l=this.getSizeAttributes(),d=(null===(t=null==l?void 0:l.presale)||void 0===t?void 0:t.isActive)===!![],u=this.isPresaleActive(l);d&&u?await this.commands.product.addPresaleToCart(a,{upc:c.sizes[c.selectedSizeId].upc,fulfillmentId:c.selectedFulfillment.fulfillmentId,partNumber:null===(e=c.selectedFulfillment)||void 0===e?void 0:e.partNumber,quantity:c.quantity,identifier:a}):await this.commands.product.addToCart(a,{upc:c.sizes[c.selectedSizeId].upc,fulfillmentId:c.selectedFulfillment.fulfillmentId,partNumber:null===(n=c.selectedFulfillment)||void 0===n?void 0:n.partNumber,quantity:c.quantity,identifier:a})}async handleQuantityChange(t){const e=this.getProductId();await this.commands.product.updateQuantity(e,t)}calculateTotalPrice(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=e.selectedFulfillment,a=n.price*e.quantity;return{quantity:e.quantity,totalPrice:a}}createQuantityContainer(t){const e=this.calculateQuantityLimits(),n=document.createElement("div");return n.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!e.canDecrease).toString()),e.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=e.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+e.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!e.canIncrease).toString()),e.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantityText),n.appendChild(this.qtyIncreaseButton),n}getSizeAttributes(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".selectedSizeId"),n=this.getStoreValue("products."+t+".sizes."+e);return(null==n?void 0:n.attributes)||{}}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:e}=this.calculateTotalPrice(),n=this.getSizeAttributes(),a=this.calculateQuantityLimits(),c=(null===(t=null==n?void 0:n.presale)||void 0===t?void 0:t.isActive)===!![],l=this.isPresaleActive(n),d=c?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?d+" - "+formatCentToDollarText(e):d;const u=c&&!l||0===a.availableQuantity||this.isFulfillmentClosed(),h=this.isButtonLoading(),p=this.config.layout.addToCartButtonShowTotalPrice?d+" for "+formatCentToDollarText(e):d;return this.addToCartButton.setAttribute("aria-label",p),this.addToCartButton.setAttribute("aria-busy",h.toString()),this.addToCartButton.setAttribute("aria-disabled",u.toString()),u&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),h&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async t=>{if(t.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),n=this.getConfigs("configurations");if(!e||!n.isElementsEnabled)return[];const a=[],c=this.config.layout.showQuantityCounter;if(c){const t=this.config.layout.quantityCounterStyle,e=this.createQuantityContainer(t);a.push(e)}const l=this.createAddToCartButton();return a.push(l),a}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const t=this.params.productId,e=this.getStoreValue("products."+t+".description"),n=this.getStoreValue("products."+t+".htmlDescription"),a="About this product:",c="See More",l="See Less",d=document.createElement("h3");d.className="title",d.textContent=a;const u=document.createElement("div");u.className="content collapsed",u.innerHTML=""===(null==n?void 0:n.trim())?e:sanitizeHTML(n);const h=document.createElement("span");h.className="collapse-button",h.textContent=c,h.setAttribute("role","button"),h.setAttribute("tabindex","0"),h.setAttribute("aria-label","Show more product information"),h.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,u.classList.toggle("collapsed"),h.textContent=this.isCollapsed?c:l,h.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),h.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return h.addEventListener("click",toggleContent),h.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[d,u,h]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(t){var e;const n=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!n)return![];const a=n.value,c=a.isOpen,l=null===(e=a.contentConfig)||void 0===e?void 0:e.type,d=l!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=l,this.openWithContent(a),![]):c&&this.isOpen&&!d?![]:c&&this.isOpen&&d?(this.currentContentType=l,this.openWithContent(a),![]):!c&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const e=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:e}),void 0;const{type:n,data:a}=t||{},c=ComponentFactoryService.createElement({type:n,...a});this.contentContainer&&this.contentContainer.appendChild(c),this.open()}catch(n){this.logger.error("Failed to open product drawer",n),this.commands.product.closeProductDrawer(e)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay;return["product-image-carousel",t]}constructor(){super({watchOnlyStorePaths:["products.{productId}.mainImage"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){const e=this.params.productId,n=t.find(t=>t.path==="products."+e+".mainImage");if(null==n?void 0:n.value){const t=this.params.images.indexOf(null==n?void 0:n.value);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+n.value+"')")}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let e=0;e<this.thumbnails.length;e++){const t=this.thumbnails[e];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(e)})}const t=this.container.querySelectorAll(".carousel-dot");for(let e=0;e<t.length;e++){const n=t[e];n.addEventListener("click",()=>this.selectImage(e))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var e,n;if(t<0||t>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[t]+"')",this.mainImageElement.title="Product image "+(t+1)),null===(e=this.thumbnails[this.currentImageIndex])||void 0===e||e.classList.remove("selected"),null===(n=this.thumbnails[t])||void 0===n||n.classList.add("selected");const a=this.container.querySelectorAll(".carousel-dot");for(let c=0;c<a.length;c++){const e=a[c];e.classList.toggle("active",c===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const e=this.thumbnails[t],n=this.galleryViewport.offsetWidth,a=e.offsetLeft+e.offsetWidth/2,c=n/2,l=c-a,d=0,u=-(this.galleryContainer.scrollWidth-n);this.translateX=Math.max(u,Math.min(d,l)),this.updateTransform(!![])}setupMainImageSwipe(){var t,e;let n=0,a=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{n=t.touches[0].clientX,a=t.touches[0].clientY},{passive:!![]}),null===(e=this.mainImageElement)||void 0===e||e.addEventListener("touchend",t=>{const e=t.changedTouches[0].clientX-n,c=t.changedTouches[0].clientY-a;Math.abs(e)>Math.abs(c)&&Math.abs(e)>50&&(e>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const t of this.galleryContainer.querySelectorAll("img"))t.addEventListener("dragstart",t=>t.preventDefault())}}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const a=this.currentTranslateX+n,c=0,l=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(l,Math.min(c,a)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const t=[],e=this.params.images.length>1,n=document.createElement("div");if(n.className="main-image",n.title="Product main image",n.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",e){const t=document.createElement("div");t.className="carousel-dots";for(let e=0;e<this.params.images.length;e++){const n=document.createElement("button");n.type="button",n.className="carousel-dot "+(0===e?"active":""),n.setAttribute("data-index",e.toString()),t.appendChild(n)}n.appendChild(t)}this.mainImageElement=n,t.push(n);const a=document.createElement("div");a.className="gallery-viewport";const c=document.createElement("div");c.className="gallery-container";for(let l=0;l<this.params.images.length;l++){const t=this.params.images[l],e=document.createElement("div");e.className="gallery-image-wrapper "+(0===l?"selected":"");const n=document.createElement("img");n.src=t,n.className="gallery-image",n.alt="Product thumbnail "+(l+1),n.loading="lazy",e.appendChild(n),c.appendChild(e)}return a.appendChild(c),t.push(a),t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var e,n,a,c;const d=this.getProductId();if(!t.some(t=>t.path==="products."+d+".selectedFulfillmentType"))return;const u=this.getStoreValue("products."+d),h=u.sizes[u.selectedSizeId],p=this.getConfigs("global");this.addPersonalizationSpan&&(u.selectedFulfillmentType===l.SHIPPING&&p.layout.enablePersonalization&&u.productHasAvailability&&(null===(n=null===(e=null==h?void 0:h.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.status)===!![]&&(null===(a=null==u?void 0:u.selectedFulfillment)||void 0===a?void 0:a.isVariantEngravable)===!![]&&(null===(c=null==u?void 0:u.selectedFulfillment)||void 0===c?void 0:c.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),e=this.container.querySelectorAll("[select-size]");for(const n of e){const a=n.textContent||"",c=n.classList.contains("selected");n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select "+a),n.setAttribute("aria-pressed",c?"true":"false"),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),n.addEventListener("click",async()=>{var a,c,l,d;const u=n.dataset.sizeId;if(!u)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:n.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,u);for(const t of e)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");n.classList.add("selected"),n.setAttribute("aria-pressed","true");const h=this.getStoreValue("products."+t),p=h.sizes[u],m=this.getConfigs("global");this.addPersonalizationSpan&&(m.layout.enablePersonalization&&(null===(c=null===(a=null==p?void 0:p.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.status)===!![]&&h.productHasAvailability&&(null===(l=h.selectedFulfillment)||void 0===l?void 0:l.isVariantEngravable)===!![]&&(null===(d=h.selectedFulfillment)||void 0===d?void 0:d.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,e){const n=document.createElement("div");n.className="size-container";const a=document.createElement("h3");a.className="size-label",a.textContent="Size",a.id="size-label",n.appendChild(a);const c=document.createElement("div");c.className="size-buttons-container",c.setAttribute("role","group"),c.setAttribute("aria-labelledby","size-label");for(const l of Object.values(e)){const e=document.createElement("span");e.setAttribute("data-size-id",l.id),e.setAttribute("select-size",""),e.className="size-button "+(l.id===t?"selected":"");const n=l.packDesc?" ("+l.packDesc+")":"";e.textContent=""+l.size+n,c.appendChild(e)}return n.appendChild(c),n}hasIndependentAddressComponent(){var t;return(null===(t=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===t?void 0:t.length)>0}template(){var t,e,n,a;const l=this.getProductId(),d=this.getStoreValue("products."+l),u=d.sizes[d.selectedSizeId],h=this.getConfigs("global"),p=[],m=document.createElement("div");m.className="price-personalization-container";const f=ComponentFactoryService.createElement({type:c.PRODUCT_PRICE,productId:l});if(m.appendChild(f),h.layout.enablePersonalization&&d.productHasAvailability&&(null===(e=null===(t=null==u?void 0:u.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.status)===!![]&&(null===(n=null==d?void 0:d.selectedFulfillment)||void 0===n?void 0:n.canEngrave)===!![]&&(null===(a=null==d?void 0:d.selectedFulfillment)||void 0===a?void 0:a.isVariantEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var t,e,n,a,u,h,p,m;const f=d.sizes[d.selectedSizeId];await this.commands.product.openProductDrawer(l,c.ENGRAVING_FORM,{identifier:l,context:"product",lines:[],maxLines:(null===(e=null===(t=f.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.maxLines)||1,maxCharsPerLine:(null===(a=null===(n=f.attributes)||void 0===n?void 0:n.engraving)||void 0===a?void 0:a.maxCharsPerLine)||16,fee:(null===(h=null===(u=f.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.fee)||0,location:null===(m=null===(p=f.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),m.appendChild(this.addPersonalizationSpan)}p.push(m);const g=this.renderProductSizes(d.selectedSizeId,d.sizes);if(p.push(g),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:c.ADDRESS_DISPLAY,productId:l});p.push(t)}const v=ComponentFactoryService.createElement({type:c.PRODUCT_RETAILERS,productId:l});p.push(v);const y=ComponentFactoryService.createElement({type:c.PRODUCT_ADD_TO_CART_SECTION,productId:l});if(p.push(y),this.config.layout.showDescription){const t=ComponentFactoryService.createElement({type:c.PRODUCT_DESCRIPTION,productId:l});p.push(t)}return p}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen");if(n){const t=n.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),e=this.getStoreValue("address.formattedAddress");if(e)return ComponentFactoryService.createElement({type:c.PRODUCT_INTERACTIONS,productId:this.getProductId()});const n=document.createElement("button");return n.type="button",n.className="product-options-open-address-button",n.textContent=this.config.layout.buyNowButtonText,n.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(c.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,c.ADDRESS_INPUT,{productId:t})}),n}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);let a=(null===(t=n.priceInfo)||void 0===t?void 0:t.avg)||0;return n.selectedFulfillment&&(a=n.selectedFulfillment.price),formatCentToDollarText(a)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getConfigs("product"),a=[],l=this.getConfigs("configurations");if(!e.productHasAvailability||!l.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.textContent="We're sorry, this product is not at nearby vendors and unavailable to ship to your state.",a.push(t),a}const d="carousel"===n.layout.fulfillmentDisplay?c.PRODUCT_RETAILERS_CAROUSEL:c.PRODUCT_RETAILERS_POPUP,u=ComponentFactoryService.createElement({type:d,productId:t});return a.push(u),a}}const xt="This product is currently unavailable to ship to your location.",wt="Same-day delivery is currently unavailable for your location.";class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const t=this.retailerCards.findIndex(t=>t.classList.contains("selected"));-1!==t&&this.scrollToIndex(t)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".selectedFulfillmentId");(null==n?void 0:n.value)&&this.updateSelectedCard(n.value)}updateSelectedCard(t){for(const n of this.retailerCards)n.classList.remove("selected"),n.setAttribute("aria-pressed","false");const e=this.retailerCards.findIndex(e=>e.dataset.fulfillmentId===t);-1!==e&&(this.retailerCards[e].classList.add("selected"),this.retailerCards[e].setAttribute("aria-pressed","true"),this.scrollToIndex(e))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const e=this.retailerCards[t],n=this.listViewport.offsetWidth,a=e.offsetLeft+e.offsetWidth/2,c=n/2,l=c-a,d=0,u=-(this.listContainer.scrollWidth-n);this.translateX=Math.max(u,Math.min(d,l)),this.updateTransform(!![])}setupDrag(){this.listContainer&&(this.listContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.listContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this)))}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.listViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const a=this.currentTranslateX+n,c=0,l=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(l,Math.min(c,a)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.listContainer&&(this.listContainer.style.transition=t?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){if(this.hasMoved)return;const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const a=this.getStoreValue("products."+e+".selectedFulfillment");if(a&&a.fulfillmentId===n)return this.logger.debug("Product retailer selection skipped: Same fulfillment already selected",{productId:e,fulfillmentId:n}),void 0;await this.commands.product.selectFulfillment(e,n)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,fulfillmentStatus:a,selectedSizeAttributes:c}){var d,u,h,p,m;let f=0;const g=null==c?void 0:c.presale,v=(null==g?void 0:g.isActive)&&(null==g?void 0:g.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(g.estimatedShipBy):"",y=e===l.SHIPPING,b=e===l.ON_DEMAND;y&&(f=(null===(u=null===(d=null==t?void 0:t.fees)||void 0===d?void 0:d.individual)||void 0===u?void 0:u.fee)||0),b&&(f=(null===(h=null==t?void 0:t.fees)||void 0===h?void 0:h.fee)||0);const w=fulfillmentAddress(t.retailerAddress,e);let S=null;e===l.ON_DEMAND&&a.openTime&&(null==a?void 0:a.closeTime)&&(S=a.isOpen?"Closes at "+format24TimeTo12$1(null==a?void 0:a.closeTime):"Opens at "+format24TimeTo12$1(null==a?void 0:a.openTime));const E=e===l.ON_DEMAND&&a&&a.isClosed?"closed":"",P=document.createElement("div");P.className="carousel-retailer-card "+(n?"selected":"")+" "+E,P.setAttribute("data-fulfillment-id",t.fulfillmentId),P.setAttribute("role","button"),P.setAttribute("tabindex","0"),P.setAttribute("aria-pressed",n?"true":"false");const F=e===l.SHIPPING?"Shipping":"Same-day delivery";P.setAttribute("aria-label",F+" from "+t.retailerName+", "+formatCentToDollarText(null!==(p=t.price)&&void 0!==p?p:0));const D=document.createElement("div");D.className="retailer-header";const A=document.createElement("h3");if(A.className="name",A.textContent=t.retailerName,D.appendChild(A),b){const t=document.createElement("h3");t.className="address",t.textContent=w,D.appendChild(t)}const _=document.createElement("div");_.className="retailer-body";const z=document.createElement("span");z.className="product-price",z.textContent=formatCentToDollarText(null!==(m=t.price)&&void 0!==m?m:0);const O=document.createElement("span");O.className="shipping-price",O.textContent=f>0?"+ "+formatCentToDollarText(f):"FREE Delivery";const M=document.createElement("span");return M.className="expectation",M.textContent=a.isClosed?S:(null==g?void 0:g.isActive)?v:(null==t?void 0:t.expectation.detail)||"No expectation available",_.append(z,O,M),P.append(D,_),P}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),a=(null==n?void 0:n.attributes)||null,c=this.config.layout.enableShippingFulfillment,d=this.config.layout.enableOnDemandFulfillment,u=[];for(const l in n.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(n.shippingFulfillments,l)){const t=n.shippingFulfillments[l],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;u.push(t)}const h=[];for(const l in n.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,l)){const t=n.onDemandFulfillments[l],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;h.push(t)}const p=e.selectedFulfillmentType===l.SHIPPING,m=e.selectedFulfillmentType===l.ON_DEMAND,f=p?u:h,g=renderFulfillmentTabsContainer({shippingFulfillments:u,onDemandFulfillments:h,shippingSelected:p,onDemandSelected:m,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:c,enableOnDemandFulfillment:d});if(!e.fulfillmentHasAvailability||0===f.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.textContent=p?xt:wt,[g,t]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const v of f){const t=getRetailerOffHours(v),n=this.generateRetailerCard({fulfillment:v,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:v.fulfillmentId===e.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:a}),c=e.selectedFulfillmentType===l.ON_DEMAND&&t&&t.isClosed;c?n.setAttribute("aria-disabled","true"):(n.addEventListener("click",this.onRetailerCardClick.bind(this)),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())})),this.listContainer.appendChild(n)}return this.listViewport.appendChild(this.listContainer),[g,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),a=(null==n?void 0:n.attributes)||null,d=this.config.layout.enableShippingFulfillment,u=this.config.layout.enableOnDemandFulfillment,h=Object.values(n.shippingFulfillments),p=Object.values(n.onDemandFulfillments),m=(d?h.length:0)+(u?p.length:0),f=document.createElement("div");f.className="header";const g=document.createElement("span");g.className="header-label",g.textContent=e.selectedFulfillmentType===l.SHIPPING?"Shipping From:":"Delivering From:";const v=document.createElement("button");if(v.className="delivery-options",v.type="button",v.textContent="See Delivery Options ("+m+")",v.setAttribute("aria-label","View all "+m+" delivery options"),v.addEventListener("click",async()=>{0!==m&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(c.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,c.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),f.appendChild(g),f.appendChild(v),!e.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.textContent=e.selectedFulfillmentType===l.SHIPPING?xt:wt,[f,t]}const y=document.createElement("div");y.className="popup-fulfillment-list-container";const b=getRetailerOffHours(e.selectedFulfillment),w=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],fulfillmentStatus:b,selectedSizeAttributes:a});return y.appendChild(w),[f,y]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const N=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(e),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},a=this.getStoreValue("products."+e+".selectedFulfillment");if(a&&a.fulfillmentId===n)return await N(),void 0;await this.commands.product.selectFulfillment(e,n),await N()}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),a=(null==n?void 0:n.attributes)||null,c=this.config.layout.enableShippingFulfillment,d=this.config.layout.enableOnDemandFulfillment,u=[];for(const l in n.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(n.shippingFulfillments,l)){const t=n.shippingFulfillments[l],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;u.push(t)}const h=[];for(const l in n.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,l)){const t=n.onDemandFulfillments[l],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;h.push(t)}const p=e.selectedFulfillmentType===l.SHIPPING,m=e.selectedFulfillmentType===l.ON_DEMAND,f=p?u:h,g=document.createElement("h5");g.className="popup-retailers-section-title",g.textContent="Delivery Options";const v=renderFulfillmentTabsContainer({shippingFulfillments:u,onDemandFulfillments:h,shippingSelected:p,onDemandSelected:m,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:c,enableOnDemandFulfillment:d});if(!e.fulfillmentHasAvailability||0===f.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.textContent=p?xt:wt,[g,v,t]}const y=document.createElement("div");y.className="popup-fulfillment-list-container";for(const l of f){const t=getRetailerOffHours(l),n=renderPopupRetailerCard({fulfillment:l,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:l.fulfillmentId===e.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:a});n.addEventListener("click",this.onRetailerCardClick.bind(this)),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),y.appendChild(n)}return[g,v,y]}}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,e;const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],a=null!==(e=this.params.showFirstEvent)&&void 0!==e?e:!![];if(n){const t=this.store.get(this.params.errorStorePath)||[],e=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return a?e.slice(0,1):e}const c=this.store.get(this.params.errorStorePath);return c?[{message:c,level:"error"}]:[]}createErrorElement(t){const e=document.createElement("div");e.classList.add("alert-container","alert-"+t.level);const n=document.createElement("span");n.classList.add("alert-icon"),n.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const a=document.createElement("span");return a.classList.add("alert-text"),a.textContent=t.message,e.appendChild(n),e.appendChild(a),e}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const e=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},e)}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 e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];e?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 ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(c.CART)});const e=document.createElement("span");if(e.className="lce-cart-button-icon",e.innerHTML=BagIcon({color:t.theme.primaryColor}),this.params.showItemsCount){const t=document.createElement("span");return t.className="lce-cart-button-badge",t.style.visibility="hidden",[e,t]}return[e]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const e=this.getStoreValue("cart.totals.quantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const e=this.getStoreValue("cart.totals.quantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var e;const n=t.find(t=>"ui.drawer"===t.path);if(!n)return![];const a=n.value,c=a.isOpen,l=null===(e=a.contentConfig)||void 0===e?void 0:e.type,d=l!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=l,this.openWithContent(a),![]):c&&this.isOpen&&!d?![]:c&&this.isOpen&&d?(this.currentContentType=l,this.openWithContent(a),![]):!c&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:e,data:n}=t||{};let a;a=this.isElementsEnabled()?ComponentFactoryService.createElement({type:e,...n}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(a,e):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(a),this.updateDrawerContentTypeClass(e),this.open()),this.addHostAttribute("data-target",e.toString().toLowerCase())}catch(e){this.logger.error("Drawer content loading failed",e),this.commands.ui.closeDrawer()}}animateContentSwap(t,e){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const n=this.contentContainer.firstElementChild;n.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{n.classList.add("fading")}),setTimeout(()=>{n.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(e),requestAnimationFrame(()=>{t.classList.add("visible"),setTimeout(()=>{t.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(t){if(!this.drawerElement)return;const e=["drawer"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.drawerElement.className=e.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",e),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class BirthdateInputComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["custom-input","birthdate",t.layout.inputFieldStyle]}constructor(){super({watchOnlyStorePaths:["checkout.focusField"]})}onStoreWatch(t){const e=t.find(t=>"checkout.focusField"===t.path);e&&e.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"}))}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const t=this.params.value.split("/");3===t.length&&(this.monthInput.value=t[0],this.dayInput.value=t[1],this.yearInput.value=t[2])}}setupEventListeners(){this.monthInput.addEventListener("input",t=>{this.formatMonth(t),this.handleNavigation(t,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",t=>{this.formatDay(t),this.handleNavigation(t,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",t=>{this.formatYear(t),this.handleChange()}),this.monthInput.addEventListener("blur",()=>this.validateInput()),this.dayInput.addEventListener("blur",()=>this.validateInput()),this.yearInput.addEventListener("blur",()=>this.validateInput());for(const t of[this.monthInput,this.dayInput,this.yearInput])t.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length&&Number.parseInt(n,10)>1)n="0"+n;else if(2===n.length){const t=Number.parseInt(n,10);t>12?n="12":t<1&&(n="01")}e.value=n}formatDay(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length&&Number.parseInt(n,10)>3)n="0"+n;else if(2===n.length){const t=Number.parseInt(n,10);t>31?n="31":t<1&&(n="01")}e.value=n}formatYear(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>4&&(n=n.substring(0,4)),e.value=n}handleNavigation(t,e){const n=t.target,a=n===this.yearInput?4:2;n.value.length===a&&e&&e.focus()}handleChange(){if(this.clearErrors(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}getFormattedValue(){const t=this.monthInput.value.padStart(2,"0"),e=this.dayInput.value.padStart(2,"0"),n=this.yearInput.value;return t&&e&&n&&4===n.length?n+"-"+t+"-"+e:""}validateDate(t,e,n){if(!t||!e||!n||4!==n.length)return![];const a=Number.parseInt(t,10),c=Number.parseInt(e,10),l=Number.parseInt(n,10);if(a<1||a>12||c<1||c>31||l<1e3)return![];const d=new Date(l,a-1,c);return d.getFullYear()===l&&d.getMonth()===a-1&&d.getDate()===c}calculateAge(t){const e=new Date;let n=e.getFullYear()-t.getFullYear();const a=e.getMonth()-t.getMonth();return(a<0||0===a&&e.getDate()<t.getDate())&&n--,n}validateInput(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value,a=[],c=this.params.validation;if(!c)return this.showErrors([]),!![];const l=t&&e&&n&&4===n.length,d=t||e||n;if(c.required&&!d||d&&!l)a.push("Please enter a complete date (MM/DD/YYYY)");else if(l)if(this.validateDate(t,e,n)){const l=Number.parseInt(t,10),d=Number.parseInt(e,10),u=Number.parseInt(n,10),h=new Date(u,l-1,d);if(void 0!==c.minYear&&u<c.minYear&&a.push("Year must be "+c.minYear+" or later"),void 0!==c.maxYear&&u>c.maxYear&&a.push("Year must be "+c.maxYear+" or earlier"),void 0!==c.minAge||void 0!==c.maxAge){const t=this.calculateAge(h);void 0!==c.minAge&&t<c.minAge&&a.push("Must be at least "+c.minAge+" years old"),void 0!==c.maxAge&&t>c.maxAge&&a.push("Must be no more than "+c.maxAge+" years old")}if(c.customValidator){const t=c.customValidator(this.getFormattedValue());t&&a.push(t)}}else a.push("Please enter a valid date");this.showErrors(a);const u=0===a.length;return this.params.onValidation&&this.params.onValidation(u,a),u}showErrors(t){this.errorContainer.innerHTML="";const e=[this.monthInput,this.dayInput,this.yearInput];if(t.length>0){this.errorContainer.classList.add("show");for(const t of e)t.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else for(const n of e)n.classList.remove("input-error")}clearErrors(){const t=[this.monthInput,this.dayInput,this.yearInput],e=t.some(t=>t.classList.contains("input-error"));if(e){for(const e of t)e.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(t){if(t){const e=t.split("/");3===e.length&&(this.monthInput.value=e[0],this.dayInput.value=e[1],this.yearInput.value=e[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name+"-month"),e.push(n)}const n=document.createElement("div");n.className="date-input-container";const a=document.createElement("input");a.type="text",a.placeholder="MM",a.name=this.params.name+"-month",a.id=this.params.name+"-month",a.maxLength=2,a.className="date-field month-field",a.setAttribute("data-field","month"),a.inputMode="numeric";const c=document.createElement("span");c.className="date-separator",c.textContent="/";const l=document.createElement("input");l.type="text",l.placeholder="DD",l.name=this.params.name+"-day",l.id=this.params.name+"-day",l.maxLength=2,l.className="date-field day-field",l.setAttribute("data-field","day"),l.inputMode="numeric";const d=document.createElement("span");d.className="date-separator",d.textContent="/";const u=document.createElement("input");u.type="text",u.placeholder="YYYY",u.name=this.params.name+"-year",u.id=this.params.name+"-year",u.maxLength=4,u.className="date-field year-field",u.setAttribute("data-field","year"),u.inputMode="numeric",this.params.disabled&&(a.disabled=!![],l.disabled=!![],u.disabled=!![]),this.params.className&&(n.className+=" "+this.params.className),n.appendChild(a),n.appendChild(c),n.appendChild(l),n.appendChild(d),n.appendChild(u);const h=document.createElement("div");return h.className="error-container",e.push(n),e.push(h),e}}class InputComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}constructor(){super({watchStorePaths:["checkout.focusField"]})}onStoreChanged(t){const e=t.find(t=>"checkout.focusField"===t.path);return e&&e.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"})),![]}handlePhoneKeydown(t){if("Backspace"===t.key){const e=t.target,n=e.selectionStart||0,a=e.value;n>0&&/\D/.test(a[n-1])&&setTimeout(()=>{const t=Math.max(0,n-2);e.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>10&&(n=n.substring(0,10)),n.length>=6?n="("+n.substring(0,3)+") "+n.substring(3,6)+"-"+n.substring(6):n.length>=3&&(n="("+n.substring(0,3)+") "+n.substring(3)),e.value=n}formatDate(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>8&&(n=n.substring(0,8)),n.length>=5?n=n.substring(0,2)+"/"+n.substring(2,4)+"/"+n.substring(4):n.length>=3&&(n=n.substring(0,2)+"/"+n.substring(2)),e.value=n}validateEmail(t){const e=/^[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 e.test(t)}validateTel(t){const e=/^\(\d{3}\) \d{3}-\d{4}$/;return e.test(t)}validateDate(t){const e=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!e.test(t))return![];const[n,a,c]=t.split("/").map(Number),l=new Date(c,n-1,a);return l.getFullYear()===c&&l.getMonth()===n-1&&l.getDate()===a}validateInput(){const t=this.inputElement.value,e=[],n=this.params.validation;if(!n)return this.showErrors([]),!![];if(n.required&&!t.trim()&&e.push("This field is required"),t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||e.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||e.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(t)||e.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const a=Number.parseFloat(t);Number.isNaN(a)?t.trim()&&e.push("Please enter a valid number"):(void 0!==n.min&&a<n.min&&e.push("Value must be at least "+n.min),void 0!==n.max&&a>n.max&&e.push("Value must be no more than "+n.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==n.min&&t.length<n.min&&e.push("Must be at least "+n.min+" characters"),void 0!==n.max&&t.length>n.max&&e.push("Must be no more than "+n.max+" characters")),n.pattern){const a=new RegExp(n.pattern);a.test(t)||e.push("Invalid format")}if(n.customValidator){const a=n.customValidator(t);a&&e.push(a)}}this.showErrors(e);const a=0===e.length;return this.params.onValidation&&this.params.onValidation(a,e),a}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,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&&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 e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name),e.push(n)}return this.inputElement=document.createElement("input"),this.inputElement.type=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&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("blur",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",e.push(this.inputElement),e.push(this.errorContainer),e}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.q=null,this.j=this.attachShadow({mode:"closed"})}initialize(t,e){if(this.A)return;if(!t||"string"!=typeof t)throw new Error("LceElementComponent: contentType must be a non-empty string");if(!(e&&e instanceof HTMLElement))throw new Error("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.j)throw new Error("LceElementComponent: Shadow DOM container is not available");e&&"function"==typeof e.rerender&&(this.q=t=>{e.rerender(t||"LceElementRerender")}),this.j.appendChild(e),this.applyBasicStyles();const n=ThemeProviderService.getInstance(),a=n.getStylesheet(t);this.applyThemeStyles(a),this.A=!![],this.j=null}rerender(t){this.q&&this.q(t)}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\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 e=new CSSStyleSheet;e.replaceSync(t),this.j.adoptedStyleSheets=[e,...this.j.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(j){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.j.adoptedStyleSheets=[...this.j.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const e=document.createElement("style");e.textContent=t,this.j&&this.j.appendChild(e)}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:e,showDescription:n,showQuantityCounter:a,fulfillmentDisplay:c,showImages:l}=this.config.layout,d=document.createElement("div");d.classList.add("product-content-wrapper");const u=document.createElement("div");if(u.classList.add("skeleton-container"),e){const t=document.createElement("div");t.classList.add("wave","sc-title"),u.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),u.appendChild(t),u}const h=document.createElement("div");h.classList.add("wave","sc-price"),u.appendChild(h);const p=document.createElement("div");p.classList.add("sc-sizes");const m=document.createElement("div");m.classList.add("wave","sc-size-button"),p.appendChild(m);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),p.appendChild(f);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),p.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),p.appendChild(v);const y=document.createElement("div");y.classList.add("wave","sc-size-button"),p.appendChild(y),u.appendChild(p);const b=document.createElement("div");b.classList.add("sc-row");const w=document.createElement("div");w.classList.add("wave","sc-price"),b.appendChild(w);const S=document.createElement("div");S.classList.add("wave","sc-personalization"),b.appendChild(S),u.appendChild(b);const E=document.createElement("div");E.classList.add("wave","sc-deliver-to"),u.appendChild(E);const P=document.createElement("div");P.classList.add("wave","sc-address"),u.appendChild(P);const F=document.createElement("div");F.classList.add("wave","sc-retailers",c),u.appendChild(F);const D=document.createElement("div");if(D.classList.add("sc-row"),a){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),D.appendChild(t)}const A=document.createElement("div");if(A.classList.add("wave","sc-add-to-cart"),D.appendChild(A),u.appendChild(D),n){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),u.appendChild(t);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),u.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),u.appendChild(n);const a=document.createElement("div");a.classList.add("wave","sc-description-line"),u.appendChild(a);const c=document.createElement("div");c.classList.add("wave","sc-description-more"),u.appendChild(c)}const _=document.createElement("div");if(_.classList.add("product-content"),_.appendChild(u),d.appendChild(_),l){d.classList.add("has-images");const t=this.createImageSkeletons();d.prepend(t)}return d}createImageSkeletons(){const t=document.createElement("div");t.classList.add("product-image-carousel","skeleton");const e=document.createElement("div");e.classList.add("wave","sc-main-image"),e.title="Product main image loading";const n=document.createElement("div");n.classList.add("carousel-dots");for(let l=0;l<3;l++){const t=document.createElement("div");t.classList.add("wave","sc-carousel-dot"),n.appendChild(t)}e.appendChild(n),t.appendChild(e);const a=document.createElement("div");a.classList.add("gallery-viewport");const c=document.createElement("div");c.classList.add("gallery-container");for(let l=0;l<4;l++){const t=document.createElement("div");t.classList.add("gallery-image-wrapper");const e=document.createElement("div");e.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(e),c.appendChild(t)}return a.appendChild(c),t.appendChild(a),t}}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 e=document.createElement("span");e.className="pb-text",e.textContent="Powered by",t.appendChild(e);const n=document.createElement("span");n.className="pb-lc",n.textContent="LiquidCommerce",t.appendChild(n);const a=document.createElement("span");return a.className="pb-dot",a.textContent=".",t.appendChild(a),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const e=this.getDisclaimerConfig();return e.parts.forEach(e=>{"text"===e.type?t.appendChild(document.createTextNode(e.content)):"link"===e.type&&t.appendChild(this.createLink(e.href,e.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,e){const n=document.createElement("a");return n.href=t,n.target="_blank",n.rel="noopener noreferrer",n.className="pb-link",n.textContent=e,n.setAttribute("role","link"),n.setAttribute("aria-label","Read "+e),n}template(){const t=this.createPoweredBySection(),e=this.createDisclaimerSection();return[t,e]}}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 e=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!e||!this.applyButton||!this.currentActiveTicker)return;const n=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);n&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!n&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const e=this.store.get("cart.promoCode"),n=this.store.get("checkout.promoCode");return(null==e?void 0:e.code)===t||(null==n?void 0:n.code)===t}getActiveTickers(){var t;const e=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var n;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const e=document.createElement("div");e.classList.add("promo-ticker__text-group");const n=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const a of n){const n=a.trim();if(!n)continue;const c=document.createElement("span");c.classList.add("promo-ticker__text-item"),c.textContent=n,e.appendChild(c);const l=document.createElement("span");l.classList.add("promo-ticker__separator"),l.textContent=t.separator,e.appendChild(l)}return e}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 e=document.createElement("div");e.classList.add("promo-ticker__content");const n=document.createElement("div");n.classList.add("promo-ticker__track");for(let c=0;c<5;c++)n.appendChild(this.generateTextContent(this.currentActiveTicker));e.appendChild(n);const a=document.createElement("button");return a.type="button",a.classList.add("promo-ticker__cta"),a.textContent="APPLY",a.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(a.disabled=!![],a.textContent="APPLIED"),a.addEventListener("click",()=>this.handlePromoClick()),a.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=a,[e,a]}}const Ct=LoggerFactory.get("ElementsClientHelper"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,e){if(!t||!e)return t;const n={...t},a=[];for(const c in e){const l=e[c],d=n[c];if(!(c in t)){a.push('Property "'+c+'" does not exist in target schema, skipping merge.');continue}const u=getType(l),h=getType(d);u===h?isObject(l)&&isObject(d)?n[c]=deepMergeConfigs(d,l):n[c]=l:a.push('Type mismatch for key "'+c+'": source is '+u+", target is "+h+". Skipping merge.")}return a.length>0&&Ct.warn("Merging configurations with warnings:",a),n}const kt=new Map([["global.layout.enablePersonalization",[c.PRODUCT,c.CART,c.CHECKOUT,c.ENGRAVING_FORM,c.ENGRAVING_VIEW]],["global.layout.personalizationText",[c.PRODUCT,c.CART,c.CHECKOUT,c.ENGRAVING_FORM,c.ENGRAVING_VIEW]],["global.layout.personalizationCardStyle",[c.PRODUCT,c.CART,c.CHECKOUT,c.ENGRAVING_FORM,c.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[c.CART,c.CART_PROMO_CODE]],["global.layout.inputFieldStyle",[c.CART,c.CHECKOUT,c.ADDRESS,c.INPUT,c.BIRTHDATE_INPUT,c.ADDRESS_INPUT,c.CHECKOUT_DELIVERY_INFORMATION_FORM,c.CHECKOUT_BUYER_INFORMATION_FORM,c.CHECKOUT_BILLING_FORM,c.CHECKOUT_PAYMENT_FORM]],["global.layout.showPoweredBy",[c.CART,c.CHECKOUT,c.CHECKOUT_COMPLETED,c.POWERED_BY,c.CART_FOOTER,c.CHECKOUT_SUMMARY_SECTION]],["global.layout.poweredByMode",[c.CART,c.CHECKOUT,c.CHECKOUT_COMPLETED,c.POWERED_BY,c.CART_FOOTER,c.CHECKOUT_SUMMARY_SECTION]],["product.layout.showImages",[c.PRODUCT,c.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[c.PRODUCT]],["product.layout.showDescription",[c.PRODUCT,c.PRODUCT_DESCRIPTION]],["product.layout.showQuantityCounter",[c.PRODUCT,c.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[c.PRODUCT,c.PRODUCT_RETAILERS,c.PRODUCT_RETAILERS_CAROUSEL,c.PRODUCT_RETAILERS_POPUP,c.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[c.PRODUCT,c.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[c.PRODUCT,c.PRODUCT_IMAGE_CAROUSEL]],["product.layout.enableShippingFulfillment",[c.PRODUCT,c.PRODUCT_RETAILERS,c.PRODUCT_RETAILERS_CAROUSEL,c.PRODUCT_RETAILERS_POPUP,c.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[c.PRODUCT,c.PRODUCT_RETAILERS,c.PRODUCT_RETAILERS_CAROUSEL,c.PRODUCT_RETAILERS_POPUP,c.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[c.PRODUCT,c.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.addToCartButtonShowTotalPrice",[c.PRODUCT,c.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.buyNowButtonText",[c.PRODUCT,c.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[c.PRODUCT,c.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[c.CART,c.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[c.CART,c.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[c.CART,c.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[c.CART,c.CART_FOOTER]],["checkout.layout.emailOptIn",[c.CHECKOUT,c.CHECKOUT_SUMMARY_SECTION]],["checkout.layout.smsOptIn",[c.CHECKOUT,c.CHECKOUT_SUMMARY_SECTION]],["checkout.layout.allowGiftCards",[c.CHECKOUT,c.CHECKOUT_GIFT_CARDS]],["checkout.layout.legalMessage",[c.CHECKOUT,c.CHECKOUT_SUMMARY_SECTION]],["checkout.layout.exitUrl",[c.CHECKOUT,c.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[c.CHECKOUT,c.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[c.CHECKOUT,c.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[c.CHECKOUT,c.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.placeOrderButtonShowRequiredFields",[c.CHECKOUT,c.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[c.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,e){const n=new Set;for(const a of Object.keys(e)){const e=kt.get(t+"."+a);if(e)for(const t of e)n.add(t)}return Array.from(n)}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}getProductStore(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".items")||{};return Object.values(e).find(e=>e.fulfillmentId===t)}handleItemsUpdate(t,e){const n=new Set(t||[]),a=new Set(e||[]);for(const c of n)if(!a.has(c)){const t=this.container.querySelector('[data-item-id="'+c+'"]');t&&t.remove()}for(const l of a)if(!n.has(l)){const t=ComponentFactoryService.createElement({type:c.CART_ITEM,itemId:l});t.setAttribute("data-item-id",l),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".items")||[],n=this.container.querySelectorAll("[data-item-id]");for(const a of n)a.remove();for(const a of e){const t=ComponentFactoryService.createElement({type:c.CART_ITEM,itemId:a});t.setAttribute("data-item-id",a),this.container.appendChild(t)}}setupMinimumPurchaseAlert(){var t;const e=this.getFulfillmentId(),n=(null===(t=this.getProductStore())||void 0===t?void 0:t.pack)||![],a=this.getStoreValue("cart.fulfillments."+e),l=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(l&&l.remove(),shouldShowMinimumPurchaseAlert(a,n)){const t=getMinimumPurchaseMessage(a,n),e=ComponentFactoryService.createElement({type:c.PURCHASE_MIN_ALERT,message:t.message,messageType:t.type,currentTotal:a.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(e)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.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 ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-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="fulfillment-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var t;const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e);return(null===(t=null==n?void 0:n.items)||void 0===t?void 0:t.length)?n.items.some(t=>{const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.updating)===!![]}):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}onStoreChanged(t){const e=this.getFulfillmentId(),n="cart.fulfillments."+e,a=t.find(t=>t.path===n),c=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(c.length>0&&this.checkAndUpdateLoadingState(),a){const t=a.oldValue,e=a.value,n=(null==t?void 0:t.items)||[],c=(null==e?void 0:e.items)||[],l=JSON.stringify(n)!==JSON.stringify(c);l&&(this.handleItemsUpdate(n,c),this.checkAndUpdateLoadingState());const d=this.hasFulfillmentFeesChanged(t,e),u=this.hasFulfillmentDataChanged(t,e,["items","updating"]);if(d&&!u&&this.setupMinimumPurchaseAlert(),!u)return![]}return![]}hasFulfillmentFeesChanged(t,e){return t?t.subtotal!==e.subtotal||t.shippingFee!==e.shippingFee||t.deliveryFee!==e.deliveryFee||JSON.stringify(t.fees)!==JSON.stringify(e.fees):!![]}hasFulfillmentDataChanged(t,e,n=[]){if(!t)return!![];const a=["type","canEngrave","retailerId"];for(const c of a)if(!n.includes(c)&&t[c]!==e[c])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}class LiquidCommerceElementsClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],this.injectedComponents=new Map,this.builder={updateComponentGlobalConfigs:async t=>{if(this.ensuredIsBuilder("updateComponentGlobalConfigs"))try{if(!t)throw new Error("Global theme configuration is required");if(this.themeProvider.updateComponentGlobalConfigs(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("global.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(e){throw this.logger.error("❌ Failed to update global theme configuration",e),new Error("Global theme update failed")}},updateProductComponent:async t=>{if(this.ensuredIsBuilder("updateProductComponent"))try{if(!t)throw new Error("Product component configuration is required");if(this.themeProvider.updateProductComponent(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts();for(const e of getComponentTypesForLayoutFields("product.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(e){throw this.logger.error("❌ Failed to update product component theme",e),new Error("Product theme update failed")}},updateCartComponent:t=>{if(this.ensuredIsBuilder("updateCartComponent"))try{if(!t)throw new Error("Cart component configuration is required");if(this.themeProvider.updateCartComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.cart.rerenderCart();for(const e of getComponentTypesForLayoutFields("cart.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(e){throw this.logger.error("❌ Failed to update cart component theme",e),new Error("Cart theme update failed")}},updateCheckoutComponent:t=>{if(this.ensuredIsBuilder("updateCheckoutComponent"))try{if(!t)throw new Error("Checkout component configuration is required");if(this.themeProvider.updateCheckoutComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("checkout.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(e){throw this.logger.error("❌ Failed to update checkout component theme",e),new Error("Checkout theme update failed")}},updateAddressComponent:t=>{if(this.ensuredIsBuilder("updateAddressComponent"))try{if(!t)throw new Error("Address component configuration is required");this.themeProvider.updateAddressComponent(t),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(e){throw this.logger.error("❌ Failed to update address component theme",e),new Error("Address theme update failed")}},injectElement:async t=>this.ensuredIsBuilder("injectElement")?await this.processInjectElement(t):null,injectProductElement:async t=>this.ensuredIsBuilder("injectProductElement")?await this.processInjectProduct(t):[],injectAddressElement:async(t,e)=>this.ensuredIsBuilder("injectAddressElement")?await this.processInjectElement({type:c.ADDRESS,containerId:t,options:e}):null,injectCartElement:async t=>this.ensuredIsBuilder("injectCartElement")?this.hasInjectedComponentType(c.CART)?(this.logger.warn("❌ Only one cart component can be injected at a time"),null):await this.processInjectElement({type:c.CART,containerId:t}):null,injectCheckoutElement:async t=>this.ensuredIsBuilder("injectCheckoutElement")?this.hasInjectedComponentType(c.CHECKOUT)?(this.logger.warn("❌ Only one checkout component can be injected at a time"),null):await this.processInjectElement({type:c.CHECKOUT,containerId:t}):null},this.ui={cartButton:(t,e)=>{var n;this.ensureCartDrawerExists();const a=document.getElementById(null!==(n=null==t?void 0:t.replace("#",""))&&void 0!==n?n:"");if(!a)throw new Error("Container with ID '"+t+"' not found");const l=ComponentFactoryService.createElement({type:c.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});a.innerHTML="",safeReplaceChildren(a,l)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:c.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(e)},cartSubtotal:t=>{var e;const n=document.getElementById(null!==(e=null==t?void 0:t.replace("#",""))&&void 0!==e?e:"");if(!n)throw new Error("Element with ID '"+t+"' not found");n.innerHTML="";const a=this.store.get("cart.totals.subtotal")||0;n.textContent=formatCentToDollarText(a),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.subtotal")||0;n.textContent=formatCentToDollarText(t)})},cartItemsCount:t=>{var e;const n=document.getElementById(null!==(e=null==t?void 0:t.replace("#",""))&&void 0!==e?e:"");if(!n)throw new Error("Element with ID '"+t+"' not found");n.innerHTML="";const a=this.store.get("cart.totals.quantity")||0;n.textContent=a.toString(),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.quantity")||0;n.textContent=t.toString()})}},this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authService=AuthService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Failed to prepare client",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",j.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.debug("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.debug("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.debug("📊 Telemetry initialized")),this.logger.debug("🔐 Starting authentication...");const t=await this.authService.authenticate();if(!t)throw this.clientPrepared=![],new Error("Authentication failed");this.logger.debug("✅ Authentication completed"),this.logger.debug("🌐 Setting up API client..."),await this.apiClient.setClient(this.authService),this.logger.debug("✅ API client setup completed"),this.logger.debug("⚙️ Loading configurations...");let e=await this.apiClient.getAllConfigs();this.logger.debug("✅ Configurations loaded"),this.clientConfig.set("partnerCode",e.configurations.partnerCode),this.logger.debug("🔍 Setting up fingerprinting and store...");const n=await this.fingerPrintService.getId(e.configurations.partnerCode),a=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",n),this.clientConfig.set("isLocalStorageAvailable",a);const c=a?null:await this.apiClient.getPersistedStore(n);if(await this.store.initialize({userDeviceId:n,isLocalStorageAvailable:a,persistedStore:c}),this.logger.debug("✅ Store setup completed"),this.logger.debug("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),n=e.global.layout.showPoweredBy;e=deepMergeConfigs(e,t),e.global.layout.showPoweredBy=n}await this.themeProvider.initialize(e),this.logger.debug("✅ Theme provider initialized"),this.logger.debug("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.debug("✅ Essential components registered"),this.logger.debug("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(t){this.logger.error("Heavy initialization failed",t)}},0)}async initializeHeavyServices(){const t=this.themeProvider.getConfigs("configurations");if(!this.gtmInitialized)try{await this.googleTagManager.initialize({partnerName:t.partnerName,partnerGtmId:t.googleTagManagerId,partnerEnableGaTracking:t.enablePartnerGaTracking,liquidCommerceEnableGaTracking:t.enableLiquidCommerceGaTracking,liquidCommerceGtmId:t.liquidCommerceGoogleTagManagerId}),this.gtmInitialized=!![]}catch(e){this.logger.error("GTM initialization failed",e)}try{this.isElementsEnabled()&&await this.commands.common.loadCart()}catch(n){this.logger.error("Cart pre-loading failed",n)}this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}async injectProductElement(t){if(!this.isElementsEnabled()){for(const e of t)this.injectDisabledElementsError(e.containerId,c.PRODUCT);return[]}return await this.processInjectProduct(t)}async injectAddressElement(t,e){return this.isElementsEnabled()?await this.processInjectElement({type:c.ADDRESS,containerId:t,options:e}):(this.injectDisabledElementsError(t,c.ADDRESS),null)}async injectCartElement(t){return this.isElementsEnabled()?this.hasInjectedComponentType(c.CART)?(this.logger.warn("❌ Only one cart component can be injected at a time"),null):await this.processInjectElement({type:c.CART,containerId:t}):(this.injectDisabledElementsError(t,c.CART),null)}async injectCheckoutElement(t){return this.isElementsEnabled()?this.hasInjectedComponentType(c.CHECKOUT)?(this.logger.warn("❌ Only one checkout component can be injected at a time"),null):await this.processInjectElement({type:c.CHECKOUT,containerId:t}):(this.injectDisabledElementsError(t,c.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}get actions(){return this.clientAction.actions}async processInjectProduct(t){var e,n;if(this.ensureAllComponentsRegistered(),0===t.length)throw new Error("At least one product must be provided");t.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const a=t.slice(0,20),l=[],d=[];for(const c of a){const t=null===(n=null===(e=c.containerId)||void 0===e?void 0:e.replace("#",""))||void 0===n?void 0:n.trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+c.identifier+"'");continue}const a=document.getElementById(t);if(!a){this.logger.warn("Container with ID '"+t+"' not found for product '"+c.identifier+"'");continue}const d=l.every(e=>e.containerId!==t);if(!d){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!c.identifier){this.logger.warn("Product identifier is required for container ID '"+t+"'");continue}const u=l.every(t=>t.identifier!==c.identifier);u?l.push({containerId:t,identifier:c.identifier}):this.logger.warn("Duplicate product identifier '"+c.identifier+"' found, skipping")}for(const u of l){const t=ComponentFactoryService.createElement({type:c.PRODUCT,useShadowDom:!![],productId:u.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(u.containerId);e?(e.innerHTML="",safeReplaceChildren(e,t),d.push(this.createInjectedComponentWrapper(u.containerId,c.PRODUCT,t)),await this.commands.product.createProductInstance(u.identifier,!![])):this.logger.warn("Product ("+u.identifier+") container with ID '"+u.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(l.map(t=>t.identifier)),d}async processInjectElement(t){this.ensureAllComponentsRegistered();const{type:e,containerId:n,...a}=t;if(!n)throw new Error("Container ID is required");if(!e)throw new Error("Component type is required");const l=t.containerId.replace("#",""),d=document.getElementById(l);if(!d)return console.warn("Container with ID '"+l+"' not found"),null;d.innerHTML="";const u={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...a},h=ComponentFactoryService.createElement(u);return safeReplaceChildren(d,h),t.type===c.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(l,t.type,h)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:c.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}hasInjectedComponentType(t){for(const[e,n]of this.injectedComponents)if(n.getType()===t)return!![];return![]}createInjectedComponentWrapper(t,e,n){const a={getType:()=>e,getElement:()=>document.getElementById(t),rerender:()=>{try{n&&"function"==typeof n.rerender?n.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+t+"' does not support rerender")}catch(e){this.logger.warn("Failed to rerender component in container '"+t+"'")}}};return this.injectedComponents.set(t,a),a}rerenderInjectedComponentsByType(t){for(const[e,n]of this.injectedComponents)n.getType()===t&&n.rerender()}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",e),!![]}}injectDisabledElementsError(t,e){const n=document.getElementById(t.replace("#",""));if(!n)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let a;a=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),n.innerHTML="",safeReplaceChildren(n,a)}registerEssentialComponents(){ComponentFactoryService.registerComponent(c.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(c.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(c.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(c.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(c.CART,AddressInputComponent),ComponentFactoryService.registerComponent(c.ADDRESS_INPUT,AddressInputComponent)}registerComponents(){this.componentFactoryInitialized||(ComponentFactoryService.registerComponent(c.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(c.INPUT,InputComponent),ComponentFactoryService.registerComponent(c.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(c.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(c.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(c.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(c.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(c.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(c.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(c.ALERT,AlertComponent),ComponentFactoryService.registerComponent(c.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(c.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(c.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(c.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(c.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(c.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(c.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(c.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(c.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(c.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(c.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(c.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(c.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(c.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(c.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(c.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(c.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(c.CART,CartComponent),ComponentFactoryService.registerComponent(c.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(c.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(c.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(c.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(c.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(c.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(c.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(c.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(c.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(c.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_INFORMATION_SECTION,CheckoutInformationSectionComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PAYMENT_FORM,CheckoutPaymentFormComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_BILLING_FORM,CheckoutBillingFormComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_SUMMARY_SECTION,CheckoutSummarySectionComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_DELIVERY_INFORMATION_FORM,CheckoutDeliveryInformationComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_BUYER_INFORMATION_FORM,CheckoutBuyerInformationComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(c.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent))}ensuredIsBuilder(t){return this.clientConfig.isBuilder()?!![]:(this.logger.error("This method ("+t+") is only available in builder mode"),![])}}async function Elements(t,e){try{const a=ClientConfigService.getInstance();a.initialize(t,{env:e.env,isBuilder:e.isBuilder,debugMode:e.debugMode,customTheme:e.customTheme,proxy:e.proxy,promoTicker:e.promoTicker});const c=a.getConfigs();SingletonManager.setClientConstructor(LiquidCommerceElementsClient);const l=await SingletonManager.getClient(c);if(!l.clientPrepared)throw new Error("Failed to initialize properly");const d={builder:l.builder,injectProductElement:l.injectProductElement.bind(l),injectAddressElement:l.injectAddressElement.bind(l),injectCartElement:l.injectCartElement.bind(l),injectCheckoutElement:l.injectCheckoutElement.bind(l),ui:l.ui,actions:l.actions,getInjectedComponents:l.getInjectedComponents.bind(l)};window.elements=d;const u=PubSubService.getInstance();return u.publishAction(n.CLIENT_READY,{isReady:!![],message:"Client Is Ready",timestamp:Date.now(),version:a.get("version")}),d}catch(a){try{const t=LoggerFactory.get("ElementsClientInit");t.error("Elements Client Initialization failed",a)}catch(c){console.error("[LiquidCommerce Elements] Client initialization failed:",null==a?void 0:a.message)}try{const t=ClientConfigService.getInstance(),e=PubSubService.getInstance();e.publishAction(n.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==a?void 0:a.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(l){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}function pairsFromMainScript(t){const e=[];try{const a=t.getAttributeNames().filter(t=>"data-product"===t.substring(0,12));for(const c of a)try{const n=c.match(/^data-product(-(.+))?$/),a=(null==n?void 0:n[2])?"-"+n[2]:"",l="data-container"+a;t.hasAttribute(l)&&e.push({containerId:t.getAttribute(l),identifier:t.getAttribute(c)})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",n)}}catch(a){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",a)}return e}function pairsFromProductsScript(){const t=[];try{const n=document.querySelectorAll("script[data-liquid-commerce-elements-products]");for(const a of n)try{const e=JSON.parse(a.textContent||"[]");if(!Array.isArray(e))continue;for(const n of e)n.containerId&&n.identifier&&t.push({containerId:n.containerId,identifier:n.identifier})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",n)}return t}function pairsFromAttributedElements(){const t=[];try{const n=document.querySelectorAll("div[data-lce-product]");for(const a of n)try{const e="lcep-"+(Date.now().toString(36)+Math.random().toString(36).substring(2,15));a.setAttribute("id",e);const n=a.getAttribute("data-lce-product");e&&n&&t.push({containerId:e,identifier:n})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",n)}return t}function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}async function addProductToCartViaQueryParam(t,e){const n=e.getAttribute("data-product-param"),a=e.getAttribute("data-product-fulfillment-type-param");if(!n)return;if(!startsWithLcePrefix(n))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+n+'" because it does not start with "lce_" prefix.'),void 0;const c=new URLSearchParams(window.location.search),d=c.get(n);if(!d)return;let u=l.SHIPPING;if(a)if(startsWithLcePrefix(a)){const t=c.get(a);t!==l.ON_DEMAND&&t!==l.SHIPPING||(u=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+a+'" because it does not start with "lce_" prefix.');try{await t.actions.cart.addProduct([{identifier:d,fulfillmentType:u,quantity:1}],!![])}catch(h){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",h)}}async function addPromoCodeToCartViaQueryParam(t,e){const n=e.getAttribute("data-promo-code-param");if(!n)return;if(!startsWithLcePrefix(n))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+n+'" because it does not start with "lce_" prefix.'),void 0;const a=new URLSearchParams(window.location.search),c=a.get(n);if(c)try{await t.actions.cart.applyPromoCode(c)}catch(l){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",l)}}async function ElementsAutoInitialize(){var t,n,a,c,l,u;try{const u=document.querySelector("script[data-liquid-commerce-elements]");if(!u)return;const g=u.getAttribute("data-token"),v=u.getAttribute("data-env")||e.PRODUCTION,y=u.getAttribute("data-debug-mode");if(!g)throw new Error("Missing API Key (data-token attribute).");const b=u.getAttribute("data-cart-id"),w=u.hasAttribute("data-show-cart-items"),S=u.hasAttribute("data-hide-cart-floating-button"),E=u.getAttribute("data-promo-code"),P=u.getAttribute("data-promo-text"),F=null!==(t=u.getAttribute("data-promo-separator"))&&void 0!==t?t:"•",D=null!==(n=u.getAttribute("data-promo-active-from"))&&void 0!==n?n:void 0,A=null!==(a=u.getAttribute("data-promo-active-until"))&&void 0!==a?a:void 0,_=pairsFromMainScript(u),z=pairsFromProductsScript(),O=pairsFromAttributedElements(),M=[..._,...z,...O],L=E&&P&&D&&A?{promoCode:E,text:P.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:F,activeFrom:null===(c=new Date(D))||void 0===c?void 0:c.toISOString(),activeUntil:null===(l=new Date(A))||void 0===l?void 0:l.toISOString()}:void 0;let R=d.NONE;y&&v!==e.PRODUCTION&&(R=y);const B=await Elements(g,{env:v,debugMode:R,promoTicker:L?[L]:void 0});if(!B)throw new Error("Failed to initialize client.");if(0!==M.length)try{await B.injectProductElement(M)}catch(h){console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",h)}try{const t=b&&document.getElementById(b.replace("#",""));t?B.ui.cartButton(b,w):S||(B.ui.floatingCartButton(w),b&&console.warn('[LiquidCommerce Elements Auto Initialization] Cart container with ID "'+b+'" not found. Falling back to floating cart button.'))}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",p)}try{await addProductToCartViaQueryParam(B,u)}catch(m){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",m)}try{await addPromoCodeToCartViaQueryParam(B,u)}catch(f){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",f)}}catch(g){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(u=null==g?void 0:g.message)&&void 0!==u?u:String(g))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(j){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",j)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(j){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",j)}},50)}catch(j){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",j)}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] 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 Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const t=window.onerror;window.onerror=(e,n,a,c,l)=>{var d,u;const h=(null==n?void 0:n.includes("elements"))||(null==n?void 0:n.includes("liquidcommerce"))||(null===(d=null==l?void 0:l.stack)||void 0===d?void 0:d.includes("LiquidCommerce"))||(null===(u=null==l?void 0:l.stack)||void 0===u?void 0:u.includes("elements-sdk"));return h?(console.error("[LiquidCommerce Elements] Unhandled error:",{message:e,source:n,lineno:a,colno:c,error:l}),!![]):t?t(e,n,a,c,l):![]};const e=window.onunhandledrejection;window.onunhandledrejection=t=>{var n,a,c,l,d,u;const h=(null===(a=null===(n=t.reason)||void 0===n?void 0:n.stack)||void 0===a?void 0:a.includes("LiquidCommerce"))||(null===(l=null===(c=t.reason)||void 0===c?void 0:c.stack)||void 0===l?void 0:l.includes("elements-sdk"))||(null===(u=null===(d=t.reason)||void 0===d?void 0:d.message)||void 0===u?void 0:u.includes("LiquidCommerce"));if(h)return console.error("[LiquidCommerce Elements] Unhandled promise rejection:",t.reason),t.preventDefault(),void 0;e&&e.call(window,t)};try{initializeDOMPolyfills()}catch(St){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",St)}try{triggerElementsAutoInit()}catch(Et){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Et)}}catch(Tt){console.error("[LiquidCommerce Elements] SDK initialization failed:",Tt)}initializeDOMPolyfills(),window.Elements=Elements,exports.Elements=Elements,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";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 e of t)"string"==typeof e?this.appendChild(document.createTextNode(e)):this.appendChild(e)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const e=document.createDocumentFragment();for(const n of t)"string"==typeof n?e.appendChild(document.createTextNode(n)):e.appendChild(n);this.insertBefore(e,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 e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const o of t)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o);e.replaceChild(n,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const o of t)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o);e.insertBefore(n,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const o of t)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o);e.insertBefore(n,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const e={};for(const[n,o]of t)e[n]=o;return e})}function safeScrollIntoView(t,e){try{e&&"function"==typeof t.scrollIntoView?t.scrollIntoView(e):t.scrollIntoView()}catch(n){try{t.scrollIntoView()}catch(o){console.warn("scrollIntoView failed:",o)}}}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(B){console.warn("DOM polyfills initialization failed:",B)}}function safeReplaceChildren(t,...e){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...e);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const n of e)"string"==typeof n?t.appendChild(document.createTextNode(n)):t.appendChild(n)}}catch(n){console.error("replaceChildren operation failed:",n),1===e.length&&"string"==typeof e[0]&&(t.innerHTML=e[0])}}class SingletonManager{static getInstances(){return SingletonManager.instances||(SingletonManager.instances=new Map),SingletonManager.instances}constructor(){}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,e){const n=SingletonManager.getInstances();n.has(t)||n.set(t,e());const o=n.get(t);if(!o)throw new Error("ElementsSdk: Instance for class "+t+" could not be created.");return o}static async getClient(t){const e=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),n="LiquidCommerceElementsClient_"+e,o=SingletonManager.getInstances();if(o.has(n))return o.get(n);if(!SingletonManager.clientConstructor)throw new Error("LiquidCommerce Elements: Client constructor is not set.");const s=new SingletonManager.clientConstructor(t);return await s.prepare(),o.set(n,s),s}}SingletonManager.instances=null,SingletonManager.clientConstructor=null;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 e=(new Date).toISOString().slice(11,23);return["%c["+e+"%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,e){if(this.sendToTelemetry("debug",t,void 0,e),!this.enableLogging)return;const[n,...o]=this.getPrefix("debug");void 0!==e?console.debug(n,...o,t,e):console.debug(n,...o,t)}info(t,e){if(!this.enableLogging)return;const[n,...o]=this.getPrefix("info");void 0!==e?console.info(n,...o,t,e):console.info(n,...o,t)}warn(t,e){if(this.sendToTelemetry("warn",t,void 0,e),!this.enableLogging)return;const[n,...o]=this.getPrefix("warn");void 0!==e?console.warn(n,...o,t,e):console.warn(n,...o,t)}error(t,e){const n=e instanceof Error,o=n?e:void 0,s=!n&&e?e:void 0;if(this.sendToTelemetry("error",t,o,s),!this.enableLogging)return;const[a,...c]=this.getPrefix("error");void 0!==e?console.error(a,...c,t,e):console.error(a,...c,t)}group(t,e=![]){if(!this.enableLogging)return;const[n,...o]=this.getPrefix("log");e?console.groupCollapsed(n,...o,t):console.group(n,...o,t)}groupEnd(){this.enableLogging&&console.groupEnd()}sendToTelemetry(t,e,n,o){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,e,{context:this.context,error:n,data:o})}catch(s){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const e=this.getInstances();if(!e.has(t)){const n=LoggerService.getInstance(t);n.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&n.setTelemetryService(this.telemetryService),e.set(t,n)}return e.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const e=this.getInstances();for(const[,n]of e)n.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const e=this.getInstances();for(const[,n]of e)n.setTelemetryService(t)}}var t;LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null,function(t){t.CLOSED="CLOSED",t.OPEN="OPEN",t.HALF_OPEN="HALF_OPEN"}(t||(t={}));class CircuitBreakerService{constructor(e){this.state=t.CLOSED,this.failures=0,this.successes=0,this.totalCalls=0,this.rejectedCalls=0,this.lastFailureTime=null,this.lastSuccessTime=null,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.config={failureThreshold:5,recoveryTimeout:3e4,halfOpenMaxCalls:3,successThreshold:2,timeout:1e4,countClientErrorsAsFailures:![],...e},this.logger=LoggerFactory.get("CircuitBreaker")}static getInstance(t){return SingletonManager.getClassInstance("CircuitBreakerService",()=>new CircuitBreakerService(t))}async execute(e,n,o){switch(this.totalCalls++,this.state===t.OPEN&&Date.now()>=this.nextAttemptTime&&this.halfOpenCircuit(n),this.state){case t.OPEN:if(null==o?void 0:o.critical)return this.logger.warn("Critical operation bypassing OPEN circuit breaker",{context:n,failures:this.failures}),this.executeWithTimeout(e,o.critical);if(null==o?void 0:o.fallback)return this.logger.info("Circuit breaker OPEN - using fallback",{context:n}),this.rejectedCalls++,o.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker is OPEN - failing fast",{context:n,failures:this.failures}),new Error("Service unavailable - circuit breaker is open ("+(n||"unknown")+")");case t.HALF_OPEN:if(this.halfOpenCallsInProgress>=this.config.halfOpenMaxCalls){if(null==o?void 0:o.fallback)return this.logger.info("Circuit breaker HALF_OPEN limit reached - using fallback",{context:n}),this.rejectedCalls++,o.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker HALF_OPEN - max calls reached",{context:n,halfOpenCalls:this.halfOpenCallsInProgress,maxCalls:this.config.halfOpenMaxCalls}),new Error("Service unavailable - circuit breaker half-open limit reached ("+(n||"unknown")+")")}this.halfOpenCallsInProgress++}try{const t=await this.executeWithTimeout(e,null==o?void 0:o.critical);return this.onSuccess(n),t}catch(s){throw this.onFailure(s,n),s}}async executeWithFallback(t,e,n,o){return this.execute(t,n,{fallback:e,critical:o})}getStats(){return{state:this.state,failures:this.failures,successes:this.successes,totalCalls:this.totalCalls,rejectedCalls:this.rejectedCalls,lastFailureTime:this.lastFailureTime,lastSuccessTime:this.lastSuccessTime,isHealthy:this.state===t.CLOSED&&0===this.failures}}reset(){this.state=t.CLOSED,this.failures=0,this.successes=0,this.totalCalls=0,this.rejectedCalls=0,this.lastFailureTime=null,this.lastSuccessTime=null,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker reset to initial state")}forceOpen(t){this.openCircuit(t)}forceClose(e){this.state=t.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker manually closed",{context:e})}async executeWithTimeout(t,e){const n=e?2*this.config.timeout:this.config.timeout;return new Promise((e,o)=>{const s=setTimeout(()=>{o(new Error("Request timeout after "+n+"ms"))},n);t().then(t=>{clearTimeout(s),e(t)}).catch(t=>{clearTimeout(s),o(t)})})}onSuccess(e){this.lastSuccessTime=Date.now(),this.state===t.HALF_OPEN?(this.halfOpenCallsInProgress--,this.successes++,this.successes>=this.config.successThreshold&&this.closeCircuit(e)):this.state===t.CLOSED&&(this.successes++,this.failures=0),this.logger.debug("Circuit breaker success",{context:e,state:this.state,successes:this.successes,failures:this.failures})}onFailure(e,n){const o=(null==e?void 0:e.status)&&e.status>=400&&e.status<500;if(o&&!this.config.countClientErrorsAsFailures)return this.logger.debug("Client error (4xx) - not counting as circuit breaker failure",{context:n,status:e.status,message:e.message}),void 0;this.lastFailureTime=Date.now(),this.failures++,this.state===t.HALF_OPEN&&(this.halfOpenCallsInProgress--,this.openCircuit(n)),this.state===t.CLOSED&&this.failures>=this.config.failureThreshold&&this.openCircuit(n),this.logger.warn("Circuit breaker failure",{context:n,state:this.state,failures:this.failures,error:(null==e?void 0:e.message)||e,status:null==e?void 0:e.status,threshold:this.config.failureThreshold,isClientError:o})}openCircuit(e){this.state=t.OPEN,this.nextAttemptTime=Date.now()+this.config.recoveryTimeout,this.halfOpenCallsInProgress=0,this.logger.error("Circuit breaker OPENED",{context:e,failures:this.failures,threshold:this.config.failureThreshold,nextAttemptTime:new Date(this.nextAttemptTime).toISOString()})}halfOpenCircuit(e){this.state=t.HALF_OPEN,this.halfOpenCallsInProgress=0,this.successes=0,this.logger.info("Circuit breaker HALF_OPEN - testing service recovery",{context:e,maxCalls:this.config.halfOpenMaxCalls,successThreshold:this.config.successThreshold})}closeCircuit(e){this.state=t.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker CLOSED - service recovered",{context:e,totalRecoveryTime:this.lastFailureTime?Date.now()-this.lastFailureTime:0})}}const e={LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",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",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",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_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_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"},s={DRAWER:"drawer",INPUT:"input",BIRTHDATE_INPUT:"birthdate-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",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",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_SECTION:"checkout-information-section",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT_FORM:"checkout-payment-form",CHECKOUT_BILLING_FORM:"checkout-billing-form",CHECKOUT_SUMMARY_SECTION:"checkout-summary-section",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_DELIVERY_INFORMATION_FORM:"checkout-delivery-information-form",CHECKOUT_BUYER_INFORMATION_FORM:"checkout-buyer-information-form",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"},a={ON_DEMAND:"onDemand",SHIPPING:"shipping"},c={NONE:"none",CONSOLE:"console",PANEL:"panel"},l={[e.LOCAL]:"http://127.0.0.1:8080",[e.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[e.STAGING]:"https://staging-elements.liquidcommerce.us",[e.PRODUCTION]:"https://elements.liquidcommerce.us"},h={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};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,e={}){this.validateInputs(t,e),this.config=Object.freeze(this.buildConfiguration(t,e))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,e){if(!this.config)throw new Error("ClientConfigService is not initialized. Please call initialize() first.");this.config=Object.freeze({...this.config,[t]:e})}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 t=this.get("debugMode");return t===c.CONSOLE||t===c.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===c.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===c.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}getProxyConfig(){return this.get("proxy")}validateInputs(t,n){if(!(null==t?void 0:t.trim()))throw new Error("API key is required");if(n.env&&!Object.values(e).includes(n.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+n.env+'". Using default environment.'),n.env=void 0),void 0!==n.isBuilder&&"boolean"!=typeof n.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),n.isBuilder=void 0),void 0===n.debugMode||Object.values(c).includes(n.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+n.debugMode+'". Must be one of: '+Object.values(c).join(", ")+". Using default value."),n.debugMode=void 0),n.promoTicker&&"object"!=typeof n.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),n.promoTicker=void 0),n.promoTicker)if(Array.isArray(n.promoTicker)){const t=n.promoTicker.filter((t,e)=>{if("string"!=typeof t.promoCode||!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].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["+e+"].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["+e+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom is required. Skipping this promo."),![];const n="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(n instanceof Date)||Number.isNaN(n.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil is required. Skipping this promo."),![];const o="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return o instanceof Date&&!Number.isNaN(o.getTime())?n>=o?(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});n.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),n.promoTicker=void 0;n.proxy&&("object"!=typeof n.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),n.proxy=void 0):n.proxy.baseUrl&&"string"==typeof n.proxy.baseUrl?n.proxy.headers&&"object"!=typeof n.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),n.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),n.proxy=void 0))}buildConfiguration(t,n){var o,s;const a=n.env||e.STAGING,h=l[a];return{apiKey:t.trim(),env:a,isBuilder:null!==(o=n.isBuilder)&&void 0!==o?o:![],debugMode:null!==(s=n.debugMode)&&void 0!==s?s:c.NONE,baseUrl:h,partnerCode:void 0,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null}}detectDeviceType(){var t,e;if("undefined"==typeof navigator)return"desktop";const n=navigator.userAgent.toLowerCase(),o="ontouchstart"in window||navigator.maxTouchPoints>0,s=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,a=(null===(e=window.screen)||void 0===e?void 0:e.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/],h=[/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(t=>t.test(n))?"tablet":h.some(t=>t.test(n))||o&&c<768?"mobile":o&&c>=768&&c<=1200||o&&/macintosh/i.test(n)&&navigator.maxTouchPoints>1||/android/i.test(n)&&o&&c>=768||/windows nt/i.test(n)&&o&&c>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(n),"desktop")}}function fetchAdapter(t){return async(e,n)=>{var o;const s=await t(e,n);let a;if("function"==typeof(null===(o=s.headers)||void 0===o?void 0:o.entries))a=Object.fromEntries(s.headers.entries());else{a={};for(const[t,e]of s.headers)a[t]=e}return{ok:s.ok,status:s.status,statusText:s.statusText,headers:a,json:()=>s.json(),text:()=>s.text()}}}const xhrFetch=(t,e)=>new Promise((n,o)=>{const s=new XMLHttpRequest;s.open(e.method||"GET",t);for(const[t,a]of objectEntries(e.headers))s.setRequestHeader(t,a);s.onload=()=>{n({ok:s.status>=200&&s.status<300,status:s.status,statusText:s.statusText,headers:s.getAllResponseHeaders().split("\r\n").reduce((t,e)=>{const[n,o]=e.split(": ");return n&&o&&(t[n]=o),t},{}),json:()=>Promise.resolve(JSON.parse(s.responseText)),text:()=>Promise.resolve(s.responseText)})},s.onerror=()=>{o(new TypeError("Network request failed"))},s.send(e.body)});function getFetchImplementation(){return"undefined"!=typeof fetch?fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?fetchAdapter(global.fetch):window.fetch?fetchAdapter(window.fetch):xhrFetch}function objectValues(t){const e=[];for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(t[n]);return e}function objectEntries(t){const e=[];for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push([n,t[n]]);return e}class AuthService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=getFetchImplementation(),this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance(),this.circuitBreaker=CircuitBreakerService.getInstance({failureThreshold:5,recoveryTimeout:3e4,halfOpenMaxCalls:3,successThreshold:2,timeout:15e3,countClientErrorsAsFailures:![]})}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(t))}async authenticate(){var t,e;if(this.isAuthenticating)return await new Promise(t=>{const i=()=>{this.isAuthenticating?setTimeout(i,100):t(void 0)};i()}),!!this.accessToken;this.isAuthenticating=!![];try{const n=await this.requestWithoutAuth("/auth",{method:"GET"},!![]);return this.accessToken=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.token,this.tokenExpiration=Date.now()+1e3*(null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.exp),!![]}catch(n){return this.logger.error("Authentication failed",n),![]}finally{this.isAuthenticating=![]}}async requestWithoutAuth(t,e,n=![]){return this.circuitBreaker.execute(async()=>{const n=this.buildUrl(t),o={"Content-Type":"application/json","X-Liquid-Api-Key":this.apiKey,"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(),...this.getProxyHeaders(),...e.headers};this.clientConfig.isBuilder()&&(o["X-Liquid-Api-Builder"]=!![]);const s={method:e.method,headers:o,body:e.body?JSON.stringify(e.body):void 0},a=await this.httpClient(n,s);if(!a.ok)throw{message:"HTTP error status: "+a.status,status:a.status};return a.json()},e.method+" "+t+" (no-auth)",{critical:n})}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(t,e,n=![]){return this.circuitBreaker.execute(async()=>{this.accessToken&&!this.isTokenExpired()||await this.authenticate();const n=this.buildUrl(t),o={"Content-Type":"application/json",Authorization:"Bearer "+this.accessToken,"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(),...this.getProxyHeaders(),...e.headers};this.clientConfig.isBuilder()&&(o["X-Liquid-Api-Builder"]=!![]);const s={method:e.method,headers:o,body:e.body?JSON.stringify(e.body):void 0},a=await this.httpClient(n,s);let c;try{c=await a.json()}catch(l){const t=await a.text().catch(()=>"HTTP error status: "+a.status);c={message:t||l},this.logger.error("Failed to parse response data",l)}if(!a.ok)throw{...c,status:a.status,message:(null==c?void 0:c.message)||"HTTP error status: "+a.status};return c},e.method+" "+t,{critical:n})}buildUrl(t){const e=this.clientConfig.getProxyConfig();return new URL("api"+t,e?e.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}async get(t,e){return this.request(t,{method:"GET",headers:null==e?void 0:e.headers},null==e?void 0:e.critical)}async post(t,e){return this.request(t,{method:"POST",body:null==e?void 0:e.body,headers:null==e?void 0:e.headers},null==e?void 0:e.critical)}async put(t,e){return this.request(t,{method:"PUT",body:null==e?void 0:e.body,headers:null==e?void 0:e.headers},null==e?void 0:e.critical)}async delete(t,e){return this.request(t,{method:"DELETE",headers:null==e?void 0:e.headers},null==e?void 0:e.critical)}}const p="@liquidcommerce/elements-sdk",m="LiquidCommerce Elements SDK",f="UNLICENSED",v="LiquidCommerce Team",b="2.2.0-beta.34",x="https://docs.liquidcommerce.co/elements-sdk",w={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},C={url:"https://github.com/liquidcommerce/elements-sdk/issues"},k="./dist/index.esm.js",S="./umd/elements.js",E="./dist/types/index.d.ts",T="pnpm@10.0.0",I={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},P=["dist","umd","docs","README.md","LICENSE"],F={access:"public",registry:"https://registry.npmjs.org/"},D="module",_=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],O={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","clean:hard":"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"},N=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],M={"@biomejs/biome":"2.2.6","@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@rollup/plugin-alias":"^5.1.1","@rollup/plugin-commonjs":"^28.0.8","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.2","@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.0","@semantic-release/npm":"^13.1.1","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.9.0","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.52.5","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^24.2.9","ts-node":"^10.9.2",typescript:"^5.9.3"},L={node:">=20"},R={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"]},B={name:p,description:m,license:f,author:v,version:b,homepage:x,repository:w,bugs:C,module:k,browser:S,types:E,packageManager:T,exports:I,files:P,publishConfig:F,type:D,sideEffects:_,scripts:O,keywords:N,devDependencies:M,engines:L,pnpm:R};class GoogleTagManagerService{constructor(){this.partnerEnableGaTracking=![],this.liquidCommerceEnableGaTracking=![],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(){if("function"==="object".gtag)return!![];const t=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return t.length>0}isContainerLoaded(t){const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.some(e=>{const n=e.src;return n.includes("id="+t)})}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...t)=>window.dataLayer.push(t),window.dataLayer.push({"gtm.start":Date.now(),event:"gtm.js"}),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(t){return new Promise((e,n)=>{if(this.isContainerLoaded(t))return this.logger.info("GTM container "+t+" already loaded, skipping script injection"),e(),void 0;this.logger.info("Loading GTM container "+t);const o=document.createElement("script");o.src="https://www.googletagmanager.com/gtm.js?id="+t,o.async=!![];const s=setTimeout(()=>n(new Error("GTM script timeout: "+t)),5e3);o.onload=()=>{clearTimeout(s),this.logger.info("GTM container "+t+" loaded successfully"),e()},o.onerror=()=>{clearTimeout(s),n(new Error("GTM script failed: "+t))},document.head.appendChild(o)})}processEventQueue(){const t=Date.now(),e=this.eventQueue.filter(e=>t-e.timestamp<3e4);for(const o of e)try{const t={event:o.eventName,...o.eventData};window.dataLayer.push(t),"function"==="object".gtag&&window.gtag("event",o.eventName,o.eventData),this.logger.debug("Processed queued GTM event: "+o.eventName,{data:o.eventData})}catch(n){this.logger.error("Error processing queued event "+o.methodName,n)}this.eventQueue=[],e.length>0&&this.logger.info("Processed "+e.length+" queued GTM events")}getSendToTargets(){const t=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&(!this.isContainerLoaded(this.liquidCommerceGtmId)&&this.isGTMAlreadyLoaded()||t.push(this.liquidCommerceGtmId)),this.partnerEnableGaTracking&&this.partnerGtmId&&(this.isGTMAlreadyLoaded()||this.isContainerLoaded(this.partnerGtmId))&&t.push(this.partnerGtmId),0===t.length&&this.isGTMAlreadyLoaded()&&this.logger.debug("No specific targets configured, letting GTM route events naturally"),t}async initialize(t){if(this.isInitialized||this.isInitializing)return this.initializationPromise;if(!this.clientConfigService.isBuilder()){this.isInitializing=!![],this.initializationPromise=this.doInitialize(t);try{await this.initializationPromise}catch(e){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",e)}}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGtmId))throw new Error("GTM config missing required fields");if(!t.liquidCommerceEnableGaTracking&&!t.partnerEnableGaTracking)return this.logger.warn("GTM initialization skipped: No tracking enabled"),this.isInitialized=!![],this.isInitializing=![],void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerGtmId=t.partnerGtmId,this.liquidCommerceGtmId=t.liquidCommerceGtmId,this.partnerEnableGaTracking=t.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=t.liquidCommerceEnableGaTracking;const e=this.isGTMAlreadyLoaded();e&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let n=![],o="";if(t.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(t.liquidCommerceGtmId),n=!![],o=e?"GTM integrated with existing setup (Partner GTM detected, LC container: "+t.liquidCommerceGtmId+")":"GTM initialized with container "+t.liquidCommerceGtmId}catch(s){this.logger.error("Failed to load LiquidCommerce GTM container: "+s+". Checking if partner GTM is available.",s)}if(n||(e&&window.dataLayer?(n=!![],o="GTM integrated with existing partner setup"):window.dataLayer&&Array.isArray(window.dataLayer)&&(n=!![],o="GTM initialized with dataLayer (basic functionality available)")),!n)throw this.isInitializing=![],new Error("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(o),this.processEventQueue()}executeEvent(t,e,n){try{if(this.clientConfigService.isBuilder())return;const o=this.getSendToTargets(),s={...n,...o.length>0&&{send_to:o},tenant_source:B.description+" v"+B.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:e,eventData:s,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+e+" (initialization pending)",{data:s}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+e+" skipped: dataLayer not available"),void 0;const a={event:e,...s};window.dataLayer.push(a),"function"==="object".gtag&&window.gtag("event",e,s),this.logger.debug("Sent GTM event: "+e,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:o.length>0?o:"no targeting",data:s})}catch(o){this.logger.error("GTM "+t+" error",o)}}calculateValue(t){const e=t.reduce((t,e)=>t+(e.price||0)*(e.quantity||1),0);return Number.parseFloat(e.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,e,n){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:e,item_list_name:n,items:t})}selectItem(t,e,n){this.executeEvent("selectItem","select_item",{item_list_id:e,item_list_name:n,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,e){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfo(t,e){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfoWithCustomerData(t,e,n,o){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:t,coupon:e,phone:null==n?void 0:n.phone,email:null==n?void 0:n.email,birth_date:null==n?void 0:n.birth_date,customer_id:null==n?void 0:n.customer_id,subtotal:null==o?void 0:o.subtotal,total:null==o?void 0:o.total_before_discounts,discounts:null==o?void 0:o.discounts,gift_cards:null==o?void 0:o.gift_cards,net_total:null==o?void 0:o.net_total})}addPaymentInfo(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:e,coupon:n,items:t})}addPaymentInfoWithoutItems(t,e,n,o){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:t,payment_type:e,coupon:n,subtotal:null==o?void 0:o.subtotal,total:null==o?void 0:o.total_before_discounts,discounts:null==o?void 0:o.discounts,gift_cards:null==o?void 0:o.gift_cards,net_total:null==o?void 0:o.net_total})}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,e){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:e})}promoCodeFailed(t,e){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:e})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,e){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:e})}giftCardFailed(t,e){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:e})}increaseQuantity(t){this.executeEvent("increaseQuantity","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}decreaseQuantity(t){this.executeEvent("decreaseQuantity","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}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.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub")}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,e){this.publishSpecific("actions."+t,e)}publishForm(t,e){this.publishSpecific("forms."+t,e)}publishSpecific(t,e){const[n,o]=t.includes(".")?t.split(".",2):["actions",t];let s=o.split("_")[0];["product","cart","address","checkout"].includes(s)||(s="other");const a=Date.now(),c={eventId:this.generateEventId(a),namespace:n,event:o,originalEvent:t,actionNamespace:"actions"===n?s:void 0,timestamp:a},l={data:e,metadata:c};this.dispatchNativeEvents(t,l)}dispatchNativeEvents(t,e){const[n]=t.split(".",2);try{const o=new CustomEvent(this.eventPrefix+":"+t,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(o);const s=new CustomEvent(this.eventPrefix+":"+n,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(s)}catch(o){this.logger.error("Error dispatching native events for "+t,o)}}generateEventId(t){return"evt_"+t+"_"+Math.random().toString(36).slice(2,9)}}const q="liquid_elements",j={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},mainImage:null,region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:a.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,drawer:{isOpen:![],contentConfig:null},rerender:![]},G={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee:0,giftCardTotal:0,deliveryFee:0,discounts:0,quantity:0},promoCode:null,fulfillments:{},rerender:![],shouldReset:![],updatedAt:"",createdAt:"",events:[]},H={token:"",cartId:"",loading:![],updating:![],error:null,warning:[],isPresaleLocked:![],presaleExpiresAt:null,acceptedAccountCreation:![],deliveryTips:[],hasAgeVerify:![],hasSubstitutionPolicy:![],isGift:![],billingSameAsShipping:!![],marketingPreferences:{canEmail:![],canSms:![]},giftRecipient:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",addressTwo:null,message:null},customer:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",addressTwo:"",company:""},payment:{key:"",secret:"",paymentMethodId:null,sendSubmitSignal:![]},billing:null,promoCode:null,giftCards:[],orderNumber:null,items:{},readyForSubmit:{customer:![],gift:![],billing:![],payment:![],prepared:![]},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,platform:0,tax:0,engraving:0,giftCards:0,service:0,tip:0,details:{taxes:{bag:0,bottleDeposits:0,retailDelivery:0,products:0,delivery:0,shipping:0},discounts:{products:0,delivery:0,shipping:0,service:0,engraving:0}}},rerender:![],isFormValid:![],invalidFields:[],focusField:null,onDemandFulfillmentTipInfo:{},tipSelection:10,stripeFormStatus:{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},deliveryInstructions:null,card:{brand:null,country:null,expMonth:null,expYear:null,last4:null,funding:null},giftCardError:null,promoCodeError:null,events:[]},V={drawer:{isOpen:![],contentConfig:null}},Y={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},W={products:{},cart:G,address:Y,checkout:H,ui:V};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 getAllConfigs(){try{this.ensureClientInitialized();const t=await this.client.get("/configs",{critical:!![]});if(!this.validResponseData(t))throw this.logger.error("Invalid response data",t),new Error("Failed to fetch all configs: Invalid response data");return t.data}catch(t){throw this.logger.error("Error fetching configs",t),t}}async setPersistedStore(t,e){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!e||0===Object.keys(e).length)return this.logger.error("No data provided to set persisted store"),void 0;const n=await this.client.post("/configs/store/"+t,{body:e});200!==n.statusCode&&this.logger.error("Failed to set persisted store",n)}catch(n){this.logger.error("Error setting persisted store",n)}}async getPersistedStore(t){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to get persisted store"),null;const e=await this.client.get("/configs/store/"+t);return 200!==e.statusCode?(this.logger.error("Failed to fetch persisted store",e),null):e.data}catch(e){return this.logger.error("Error fetching persisted store",e),null}}async getProductsData(t,e){try{if(this.ensureClientInitialized(),0===t.length)return this.logger.error("No product identifiers provided"),null;const n={upcs:t,ids:t,grouping:t,shouldShowOffHours:!![],isLegacy:!![],loc:e},o=await this.client.post("/cloud/catalog/availability",{body:n});return 200===o.statusCode&&o.products&&0!==o.products.length?{products:o.products,retailers:o.retailers}:(this.logger.error("Failed to fetch product data",o),null)}catch(n){return this.logger.error("Error fetching product data",n),null}}async getCartData(t){try{this.ensureClientInitialized();const e=await this.client.get("/cloud/cart"+(t?"?id="+t:""));if(200!==e.statusCode)throw this.logger.error("Failed to fetch cart data",e),new Error("Failed to fetch cart data: "+e.message);return e.cart}catch(e){throw this.logger.error("Error fetching cart data",e),e}}async updateCart(t){try{this.ensureClientInitialized();const e=await this.client.put("/cloud/cart",{body:t});if(200!==e.statusCode)throw this.logger.error("Failed to update cart",e),new Error("Failed to update cart: "+e.message);return e.cart}catch(e){throw this.logger.error("Error updating cart",e),e}}async getAddressSuggestions(t){try{if(this.ensureClientInitialized(),!t||0===t.trim().length)return this.logger.error("Query is required to fetch address suggestions"),[];const e=await this.client.get("/cloud/address/autocomplete?input="+t);return 200!==e.statusCode?(this.logger.error("Failed to fetch address suggestions",e),[]):e.data}catch(e){return this.logger.error("Error fetching address suggestions",e),[]}}async getAddressDetails(t){try{if(this.ensureClientInitialized(),!t||0===t.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new Error("Address ID is required to fetch address details");const e=await this.client.get("/cloud/address/details/"+t);if(200!==e.statusCode)throw this.logger.error("Failed to fetch address details",e),new Error("Failed to fetch address details: "+e.message);return e.data}catch(e){throw this.logger.error("Error fetching address details",e),e}}async prepareCheckout(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/checkout/prepare",{body:t,critical:!![]});if(200!==e.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",e),new Error("Failed to fetch prepare checkout data: "+e.message);return e.checkout}catch(n){throw this.logger.error("Error fetching prepare checkout data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async getPaymentSession(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/payment/session",{body:t,critical:!![]});if(201!==e.statusCode)throw this.logger.error("Failed to get payment session",e),new Error("Failed to get payment session: "+e.message);return e.data}catch(n){throw this.logger.error("Error fetching payment session:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async confirmPaymentSession(t,e){try{this.ensureClientInitialized();const n=await this.client.post("/cloud/payment/confirm",{body:{confirmationTokenId:t,setupIntentId:e},critical:!![]});if(200!==n.statusCode)throw this.logger.error("Failed to confirm payment session",n),new Error("Failed to confirm payment session: "+n.message);return n.data}catch(n){throw this.logger.error("Error confirming payment session",n),n}}async checkoutComplete(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/checkout/complete",{body:t,critical:!![]});if(200!==e.statusCode)throw this.logger.error("Failed to complete checkout",e),new Error("Failed to complete checkout: "+e.message);return e.order}catch(n){if(this.logger.error("Error completing checkout:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),null==n?void 0:n.error)throw new Error(n.error);throw n}}validResponseData(t){return t.data&&"object"==typeof t.data&&Object.keys(t.data).length>0}ensureClientInitialized(){if(!this.client)throw new Error("API client is not initialized")}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:e,next:n})=>{const o=performance.now();this.logger.group("🏪 Store "+t+" ---------------------------------"),this.logger.debug("Payload:",e);try{const t=n(),e=performance.now()-o;return this.logger.debug("Completed in "+e.toFixed(3)+"ms"),t}catch(s){throw this.logger.error('Error during store action "'+t+'"',s),s}finally{this.logger.groupEnd()}},this.performanceMiddleware=({action:t,next:e})=>{const n=performance.now(),o=e(),s=performance.now()-n;return s>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+s.toFixed(2)+"ms"),o},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:e,persistedStore:n}){this.localStorageKey=q+"_"+t,this.isLocalStorageAvailable=e,e?await this.loadPersistedState():n&&await this.loadFromDBPersistence(n),this.addBeforeUnloadHandler(),this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:e,hasPersistedState:null!==n,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const e=t.split(".");let n=this.state;for(const o of e){if(null==n)return;n=n[o]}return void 0!==n?Array.isArray(n)?[...n]:"object"==typeof n&&null!==n?{...n}:n:void 0}set(t,e){return this.runWithMiddleware("set",{path:t,value:e},()=>{const n=this.get(t);return this.state=this.immutableSet(this.state,t,e),this.notifyListeners(t,e,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,e){const n=this.get(t),o=e(n);return this.set(t,o)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const e=this.get(t);if(void 0===e)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const n=t.split(".");let o=this.state;const s=n.pop();for(const a of n){if(void 0===o[a])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];o=o[a]}if(Array.isArray(o))o=o.filter((t,e)=>e!==Number.parseInt(s,10));else{if("object"!=typeof o||null===o)return this.logger.warn('Cannot remove property "'+s+'" from non-object type at path "'+t+'".'),![];{const{[s]:t,...e}=o;o=e}}return this.state=this.immutableSet(this.state,n.join("."),o),this.notifyListeners(t,void 0,e),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const e=[];if("function"==typeof t){const n=t(this.state);for(const[t,o]of Object.entries(n)){const n=this.get(t);e.push({path:t,oldValue:n,newValue:o,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,o)}}else for(const[n,o]of Object.entries(t)){const t=this.get(n);e.push({path:n,oldValue:t,newValue:o,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,o)}for(const{path:t,oldValue:n,newValue:o}of e)this.notifyListeners(t,o,n);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,e){const n=t;return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),()=>{var t;null===(t=this.listeners.get(n))||void 0===t?void 0:t.delete(e)}}watchMany(t,e){const n=[];let o;const s=t.map(t=>this.watch(t,(s,a)=>{n.push({path:t,value:s,oldValue:a}),clearTimeout(o),o=setTimeout(()=>{n.length>0&&(e([...n]),n.length=0)},0)}));return()=>{for(const t of s)t()}}createProductInstance(t){const e="products."+t,n=this.get(e);return n?!![]:this.set(e,j)}removeProductInstance(t){const e=this.get("products"),{[t]:n,...o}=e;return this.set("products",o)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(t,e,n){let o=0;const y=()=>{if(o>=this.middleware.length)return n();const s=this.middleware[o++];return s({action:t,payload:e,state:this.getState(),next:y})};return y()}immutableSet(t,e,n){const o=e.split(".");if(1===o.length){if(Array.isArray(t)){const e=[...t];return e[o[0]]=n,e}return{...t,[o[0]]:n}}const[s,...a]=o,c=t[s],l=Array.isArray(c)?[]:{};if(Array.isArray(t)){const e=[...t];return e[s]=this.immutableSet(c||l,a.join("."),n),e}return{...t,[s]:this.immutableSet(c||l,a.join("."),n)}}notifyListeners(t,e,n){const o=this.listeners.get(t);if(o)for(const l of o)try{l(e,n)}catch(a){this.logger.error('Error in store listener for path "'+t+'"',a)}const s=t.split(".");for(let l=s.length-1;l>0;l--){const t=s.slice(0,l).join("."),e=this.listeners.get(t);if(e){const o=this.get(t),a=s.slice(l).join("."),h=this.immutableSet(o,a,n);for(const n of e)try{n(o,h)}catch(c){this.logger.error('Error in store listener for parent path "'+t+'"',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 t;const e=this.get("address.id")||"",n=this.get("cart.id")||"";if(!e&&!n)return this.logger.debug("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.debug("Session data persisted to localStorage",{addressId:e,cartId:n}),void 0;try{const o=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(o,{p:e,c:n}),this.logger.info("Session data persisted to DB",{userDeviceId:o,addressId:e,cartId:n})}catch(o){this.logger.error("Failed to persist session data to DB",o)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const e=this.get("address.id")||"",n=this.get("cart.id")||"";(e||n)&&(t=e+"_"+n)}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 e=localStorage.getItem(this.localStorageKey);if(!e)return;try{const t=JSON.parse(e);for(const[e,n]of Object.entries(t))this.set(e,n);return}catch(t){if(e.includes("_")){const[t,n]=e.split("_");if(void 0!==t){const e=await this.getAddressDataFromId(t);this.set("address",e)}return void 0!==n&&this.set("cart.id",n||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:e})}}catch(e){this.logger.error("Failed to load persisted state",e),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const e=await this.getAddressDataFromId(t.p);this.set("address",e)}void 0!==t.c&&this.set("cart.id",t.c||null),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(e){this.logger.error("Failed to load session data from DB persistence",e)}}addBeforeUnloadHandler(){window.addEventListener("beforeunload",()=>{this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())})}async getAddressDataFromId(t){if(!t||""===t.trim())return Y;try{const e=await this.api.getAddressDetails(t);return e&&0!==Object.keys(e).length?{id:t,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:{lat:e.coords.lat,long:e.coords.long}}:{...Y,id:t}}catch(e){return{...Y,id:t}}}}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()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}const includeCartEvents=(t,e)=>t.filter(t=>e.includes(t.type)),excludeCartEvents=(t,e)=>t.filter(t=>!e.includes(t.type)),eventsForCart=t=>excludeCartEvents(t,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=t=>{const e=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],n=includeCartEvents(t,e);return n.length>0},includeCheckoutEvents=(t,e)=>t.filter(t=>e.includes(t.type)),eventsForCheckout=t=>includeCheckoutEvents(t,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=t=>includeCheckoutEvents(t,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=t=>includeCheckoutEvents(t,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=t=>{const e=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return t.some(t=>e.includes(t.type))},Q={OutOfStock:"error",ItemsNotAdded:"warning",ItemsRequestedNotAdded:"warning",ItemEngravingError:"error",AddressChange:"warning",LocationAvailability:"warning",PartnerProductConfigs:"warning",RemovedExistingCartItems:"warning",RetailerMinNotMet:"warning",NoItemsInCart:"warning",InvalidId:"warning",NoId:"warning",CartCheckoutProcessed:"success",NewCart:"warning",CartError:"error",ItemQuantityChange:"warning",ItemIdNotFound:"error",ItemsRemoved:"warning",CouponProcessingError:"error",CouponNotFound:"error",CouponExpired:"error",NoApplicableDiscount:"warning",CouponNotStarted:"error",MinimumOrderValueNotMet:"warning",MinimumOrderUnitsNotMet:"warning",MinimumDistinctItemsNotMet:"warning",QuotaExceeded:"error",UserLimitExceeded:"error",NotFirstPurchase:"warning",InvalidCoupon:"error",InvalidMembership:"error",InvalidDomain:"error",InvalidRequirements:"error",InvalidOrganization:"error",ProductNotEligible:"warning",NotEnoughPreviousOrders:"warning",PresaleItemsNotAllowed:"error",PresaleLimitExceeded:"error",PresaleNotStarted:"error",PresaleExpired:"error",PresaleMixedCart:"error",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning"},Z={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:Q[t.type]||"error"})),transformCheckoutEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:Z[t.type]||"error"})),transformEventsForCart=t=>{const e=eventsForCart(t);return transformCartEventsRaw(e)},transformEventsForCheckout=t=>{const e=eventsForCheckout(t);return transformCheckoutEventsRaw(e)},transformPromoCodeCheckoutEvents=t=>{const e=promoCodeCheckoutEvents(t);return transformCheckoutEventsRaw(e)},transformGiftCardCheckoutEvents=t=>{const e=giftCardCheckoutEvents(t);return transformCheckoutEventsRaw(e)};function buildCartItemStore(t){return{id:t.id,variantId:t.variantId,liquidId:t.liquidId,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,salsifyGrouping:t.salsifyGrouping,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,loading:![],updating:![],error:null}}function buildCartTotals(t){return{subtotal:t.subtotal||0,total:t.total||0,shippingFee:t.shippingFee||0,platformFee:t.platformFee||0,giftCardTotal:t.giftCardTotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,discounts:t.discounts||0,quantity:t.quantity||0}}function buildRetailerStore(t){var e;return{id:t.id,name:t.name,platformFee:t.platformFee||0,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,address:t.address,total:t.total||0,deliveryFee:t.deliveryFee||0,engravingFee:t.engravingFee||0,fulfillments:(null===(e=t.fulfillments)||void 0===e?void 0:e.map(t=>t.id))||[]}}function buildFulfillmentStore(t,e){return{id:t.id,canEngrave:t.canEngrave||![],type:t.type,fees:t.fees,expectation:t.expectation,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,items:t.items||[],retailerId:e.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(t,e){var n;const o=e.formattedAddress?e:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},s={};for(const a in t.items||{}){const e=t.items[a];s[a]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,salsifyGrouping:e.salsifyGrouping,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||0,quantity:e.quantity||0,maxQuantity:e.maxQuantity||0,unitPrice:e.unitPrice||0,mainImage:e.mainImage||"",attributes:e.attributes||{}}}return{id:t.id,promoCode:(null===(n=t.promoCode)||void 0===n?void 0:n.code)||"",items:s,location:{placesId:o.id,address:{one:o.address.one,two:o.address.two,city:o.address.city,state:o.address.state,zip:o.address.zip,country:o.address.country},coordinates:{latitude:o.coordinates.lat,longitude:o.coordinates.long}},amounts:{deliveryFee:t.totals.deliveryFee,discounts:t.totals.discounts,engravingFee:t.totals.engravingFee,giftCardTotal:0,platformFee:t.totals.platformFee,shippingFee:t.totals.shippingFee,subtotal:t.totals.subtotal,total:t.totals.total},itemCount:Object.values(s||{}).reduce((t,e)=>t+(e.quantity||0),0),updatedAt:t.updatedAt,createdAt:t.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,e=![]){var o,s,a,c,l,h;const p=this.store.get("cart");for(const n of Object.keys(p.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(p.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(p.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const m={"cart.id":t.id,"cart.error":null,"cart.totals":buildCartTotals(t),"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(s=null===(o=t.attributes)||void 0===o?void 0:o.promoCode)||void 0===s?void 0:s.value)?{code:t.attributes.promoCode.value.toUpperCase(),discountAmount:t.attributes.promoCode.discount||0,error:null}:null};if((null===(a=t.items)||void 0===a?void 0:a.length)>0)for(const n of t.items)m["cart.items."+n.id]=buildCartItemStore(n);if((null===(c=t.retailers)||void 0===c?void 0:c.length)>0)for(const n of t.retailers)if(m["cart.retailers."+n.id]=buildRetailerStore(n),(null===(l=n.fulfillments)||void 0===l?void 0:l.length)>0)for(const t of n.fulfillments)m["cart.fulfillments."+t.id]=buildFulfillmentStore(t,n);if((null===(h=t.events)||void 0===h?void 0:h.length)>0&&(m["cart.events"]=transformEventsForCart(t.events||[])),this.store.batch(m),e){const t=this.store.get("cart"),e=this.store.get("address");this.pubSub.publishAction(n.CART_LOADED,cartDataForEventFromStore(t,e))}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartFromResponse(e,!![]),e.id!==t.id&&await this.store.persist()}catch(t){throw this.store.set("cart.error",(null==t?void 0:t.message)||"Failed to load cart"),this.logger.error("Load cart failed",t),t}finally{this.store.set("cart.loading",![])}}}const $="lce-checkout-stripe-slot",J={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},tt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},et={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};function centToDollar(t){return t/100}function formatCentToDollarText(t,e=!![]){const n=Math.floor(t/100),o=t%100;let s="$"+n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(e||o>0)&&(s+=".",s+=o<10?"0"+o:o.toString()),s}function htmlStringToElement(t){const e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstElementChild}function format24TimeTo12$1(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new Error("Invalid time format: "+t);const n=Number.parseInt(e[1],10),o=Number.parseInt(e[2],10);if(n<0||n>23||o<0||o>59)throw new Error("Invalid time values: "+t);const s=n>=12?"PM":"AM",a=n%12||12;return a+":"+o.toString().padStart(2,"0")+" "+s}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const e=new Date(t);if(Number.isNaN(e.getTime()))return"";const n=(e.getMonth()+1).toString().padStart(2,"0"),o=e.getDate().toString().padStart(2,"0"),s=e.getFullYear().toString();return n+"/"+o+"/"+s}catch(e){return""}}function validateMinimumAge(t,e=21,n=1930){if(!t)return{isValid:![],age:null,error:"Birth date is required"};try{const o=t instanceof Date?t:new Date(t);if(Number.isNaN(o.getTime()))return{isValid:![],age:null,error:"Invalid date format"};const s=new Date;if(o>s)return{isValid:![],age:null,error:"Birth date cannot be in the future"};const a=o.getFullYear();if(a<n)return{isValid:![],age:null,error:"Birth year cannot be before "+n+". Please check your birth date."};const c=calculateAge(o,s);return c<e?{isValid:![],age:c,error:"Must be at least "+e+" years old"}:{isValid:!![],age:c}}catch(o){return{isValid:![],age:null,error:"Error processing birth date"}}}function calculateAge(t,e){let n=e.getFullYear()-t.getFullYear();const o=e.getMonth()-t.getMonth();return(o<0||0===o&&e.getDate()<t.getDate())&&n--,Math.max(0,n)}function buildFormattedAddressString(t){const e=[],n=[];t.one&&t.one.trim()&&n.push(t.one.trim()),t.two&&t.two.trim()&&n.push(t.two.trim()),n.length>0&&e.push(n.join(" ")),t.city&&t.city.trim()&&e.push(t.city.trim());const o=[];return t.state&&t.state.trim()&&o.push(t.state.trim()),t.zip&&t.zip.trim()&&o.push(t.zip.trim()),o.length>0&&e.push(o.join(" ")),t.country&&t.country.trim()&&e.push(t.country.trim()),e.join(", ")}function capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const e=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:e[0]||"",category2:e[1]||"",category3:e[2]||""}}function validateCustomerInfo(t){const e=[J.firstName,J.lastName,J.email,J.phone,J.birthDate];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const o of e){const e=t[o];if(!e||"string"==typeof e&&""===e.trim())n.push(o);else if("birthDate"===o){const t=validateMinimumAge(e,21,1930);t.isValid||n.push(o)}}return{isValid:0===n.length,invalidFields:n}}function validateGiftRecipientInfo(t){const e=[tt.firstName,tt.lastName,tt.email,tt.phone,tt.message];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const o of e){const e=t[o];(!e||"string"==typeof e&&""===e.trim())&&n.push(o)}return{isValid:0===n.length,invalidFields:n}}function validateBillingInfo(t){const e=[et.firstName,et.lastName,et.email,et.phone,et.addressOne,et.city,et.state,et.zipCode];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const o of e){const e=t[o];(!e||"string"==typeof e&&""===e.trim())&&n.push(o)}return{isValid:0===n.length,invalidFields:n}}const nt=[s.PRODUCT,s.PRODUCT_IMAGE_CAROUSEL,s.PRODUCT_OPTIONS,s.PRODUCT_INTERACTIONS,s.PRODUCT_DESCRIPTION,s.PRODUCT_RETAILERS,s.PRODUCT_RETAILERS_CAROUSEL,s.PRODUCT_RETAILERS_POPUP,s.PRODUCT_RETAILERS_POPUP_LIST,s.PRODUCT_PRICE,s.PRODUCT_ADD_TO_CART_SECTION,s.PRODUCT_DRAWER,s.PRODUCT_LOADING,s.ENGRAVING_FORM,s.ENGRAVING_VIEW],it=[s.ADDRESS_INPUT,s.ADDRESS_DISPLAY],ot=[s.CART,s.CART_RETAILER,s.CART_ITEM,s.CART_FOOTER,s.CART_ITEM_QUANTITY_PRICE,s.CART_RETAILER_SUBTOTAL,s.CART_PROMO_CODE,s.CART_HEADER,s.CART_BODY,s.CART_FULFILLMENT,s.BUTTONS_CART_OPEN],rt=[s.CHECKOUT,s.CHECKOUT_INFORMATION_SECTION,s.CHECKOUT_STRIPE_FORM,s.CHECKOUT_PAYMENT_FORM,s.CHECKOUT_BILLING_FORM,s.CHECKOUT_SUMMARY_SECTION,s.CHECKOUT_PROMO_CODE,s.CHECKOUT_GIFT_CARDS,s.CHECKOUT_AMOUNTS,s.CHECKOUT_ITEMS,s.CHECKOUT_COMPLETED,s.CHECKOUT_DELIVERY_INFORMATION_FORM,s.CHECKOUT_BUYER_INFORMATION_FORM,s.CHECKOUT_TIPS,s.CHECKOUT_PC_GC,s.CHECKOUT_ITEM,s.CHECKOUT_ITEM_QUANTITY,s.CHECKOUT_PLACE_ORDER_BUTTON,s.CHECKOUT_HEADER,s.CHECKOUT_PRESALE_COUNTDOWN,s.CHECKOUT_PRESALE_EXPIRED];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,e="swap"){if(!t||0===t.length)return;const n=[...this.defaultFontFamilies,...t],o=n.map(t=>{const e=encodeURIComponent(t.name);return"family="+e+":wght@"+t.weights.join(";")}).join("&"),s="display="+e;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+o+"&"+s,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,e="swap"){const n=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,e),n&&n.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),e=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(!e){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 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: 500;\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 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(--heading-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: "+h.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 /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\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 .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: "+h.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: "+h.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: 500;\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 }\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .address-display-container > button {\n color: var(--primary-color, #1D4ED8);\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 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",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: "+h.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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 flex-direction: column;\n align-items: flex-start;\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: 400;\n line-height: 20px;\n }\n\n .item-shipping-container {\n display: flex;\n flex-wrap: wrap;\n }\n\n .cart-add-personalization-span {\n color: var(--primary-color, #1E40AF);\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 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: 400;\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 }\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 500;\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: 400;\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: 500;\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: "+h.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: "+h.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\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\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--primary-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 }\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: 400;\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: "+h.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-container.no-header .checkout-information-section,\n .checkout-container.no-header .checkout-summary-section {\n padding: 0;\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 }\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-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 margin-top: 20px;\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(--heading-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: 400;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-items: center;\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(--heading-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: 400;\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: "+h.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: 400;\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: 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 .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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--primary-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: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+h.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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: 400;\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(--heading-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(--heading-font-family, Poppins);\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 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: "+h.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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 width: 64px;\n height: 64px;\n border-radius: var(--card-border-radius, 6px);\n object-fit: cover;\n flex-shrink: 0;}\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 400;\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: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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: 400;\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: 400;\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: 400;\n line-height: 100%;\n text-align: center;\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 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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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 > *: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, .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(--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 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: 400;\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: 400;\n line-height: 20px;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #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 .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: 500;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-payment-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-payment-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-payment-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-payment-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-payment-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: 400;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-payment-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-payment-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-payment-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--primary-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: 400;\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: '+h.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\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: 500;\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 .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(--heading-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: "+h.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(--heading-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: 400;\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 display: flex;\n flex-direction: column;\n align-items: flex-start;\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-weight: 400;\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(--primary-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: 400;\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: 400;\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: 400;\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 ',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 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 /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\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(--heading-font-family, Poppins);\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: 400;\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: 8px;\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 gap: 16px;\n flex-direction: row;\n align-items: center;\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 }\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: 400;\n line-height: 20px;\n align-self: stretch;\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: 400;\n line-height: 16px;\n align-self: stretch;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\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 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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\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 gap: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child {\n font-weight: 500;\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(--primary-color, #1E40AF);\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 .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(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\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: 400;\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 gap: 16px;\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 gap: 4px;\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 .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: 400;\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: 400;\n line-height: 20px;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n gap: 16px;\n align-self: stretch;\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: 500;\n line-height: 20px;\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: 500;\n line-height: 20px;\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: 400;\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 }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\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, .dark .pb-lc {\n color: #0F172A;\n }\n\n .dark .pb-text, .dark .pb-lc, .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--heading-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\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: 400;\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: "+h.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: 500;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 400;\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: 400;\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(--primary-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\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(--heading-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: 400;\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: 400;\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: "+h.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 }\n\n .gallery-image {\n width: 60px;\n height: 60px;\n object-fit: cover;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n background: var(--accent-color, #3b82f6);\n opacity: 0.5;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n }\n\n .gallery-image-wrapper.selected .gallery-image {\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 {\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-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(--primary-color, #1E40AF);\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 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: 400;\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(--heading-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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: "+h.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\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-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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\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(--primary-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 }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+h.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: 225px;\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 }\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 500;\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 cursor: not-allowed;\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; /* 2 lines * 1.4 line-height */\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-weight:700;\n font-style: normal;\n line-height: 20px;\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; /* 2 lines * 1.4 line-height */\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(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--primary-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 }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\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: 500;\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 max-height: 350px;\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 cursor: not-allowed;\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(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\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 .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 500;\n }\n\n .fulfillments-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";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: "+h.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: "+h.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: "+h.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: "+h.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 /* Image skeleton styles */\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 queries for responsive skeleton images */\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";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(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 400;\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: 400;\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 st={"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",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},at={backgroundColor:"--product-background-color"},ct={backgroundColor:"--cart-background-color"},lt={backgroundColor:"--address-background-color"},dt={backgroundColor:"--checkout-background-color"},ut={global:st,product:at,cart:ct,address:lt,checkout:dt};function getCSSVariableMapping(t){return ut[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,e){const n={},o=getCSSVariableMapping(e);for(const[s,a]of Object.entries(o)){const e=this.getValueByPath(t,s);void 0!==e&&this.isCSSValue(e)&&(n[a]=e,this.isColorVariable(a,e)&&this.generateOpacityVariants(n,a,e))}return n}extractVariablesFromPartialTheme(t,e){const n={},o=getCSSVariableMapping(e);for(const[s,a]of Object.entries(o))if(this.hasValueAtPath(t,s)){const e=this.getValueByPath(t,s);void 0!==e&&this.isCSSValue(e)&&(n[a]=e,this.isColorVariable(a,e)&&this.generateOpacityVariants(n,a,e))}return n}generateCSSVariablesString(t){return Object.entries(t).map(([t,e])=>" "+t+": "+e+";").join("\n")}updateCSSVariablesInStylesheet(t,e){if(0!==Object.keys(e).length)try{const n=this.findOrCreateRule(t);for(const[t,o]of Object.entries(e))n.style.setProperty(t,String(o))}catch(n){this.logger.warn("Failed to update CSS variables")}}getValueByPath(t,e){return e.split(".").reduce((t,e)=>t&&void 0!==t[e]?t[e]:void 0,t)}hasValueAtPath(t,e){const n=e.split(".");let o=t;for(const s of n){if(null==o||!(s in o))return![];o=o[s]}return!![]}findOrCreateRule(t){const e=":host";for(const o of Array.from(t.cssRules))if(o instanceof CSSStyleRule&&o.selectorText===e)return o;const n=t.insertRule(e+" {}");return t.cssRules[n]}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,e,n){for(const o of this.opacityLevels){const s=e+"-"+o.suffix,a=this.addOpacityToHexColor(n,o.value);a&&(t[s]=a)}}isColorVariable(t,e){if("string"!=typeof e)return![];const n=t.toLowerCase().includes("color"),o=/^#[0-9a-f]{3,8}$/i.test(e);return n&&o}addOpacityToHexColor(t,e){if(!t.startsWith("#"))return null;let n=t.slice(1);if(3===n.length&&(n=n.split("").map(t=>t+t).join("")),6!==n.length)return null;const o=Math.round(255*e),s=o.toString(16).padStart(2,"0");return"#"+n+s}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,e){const n=this.cssProcessor.extractVariablesFromTheme(e,t),o=this.cssProcessor.generateCSSVariablesString(n),s=this.getStylesheetStyles(t).join("\n\n"),a=0===o.length?"":":host { "+o+" }",c=("\n "+a+"\n\n "+s+"\n ").trim();this.createStylesheet(t,c)}createStylesheet(t,e){try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(e),this.styleSheets.set(t,n)}else this.styleSheets.set(t,e)}catch(B){this.styleSheets.set(t,e)}}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,e,n){const o=this.styleSheets.get(t);if(o&&"string"!=typeof o){const t=this.cssProcessor.extractVariablesFromPartialTheme(e,n);this.cssProcessor.updateCSSVariablesInStylesheet(o,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];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)}updateComponentGlobalConfigs(t){var e,n;const o=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=o,((null===(e=t.theme)||void 0===e?void 0:e.headingFont)||(null===(n=t.theme)||void 0===n?void 0:n.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")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==nt.indexOf(t)?this.getConfigs("product"):-1!==it.indexOf(t)?this.getConfigs("address"):-1!==ot.indexOf(t)?this.getConfigs("cart"):-1!==rt.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===s.DRAWER){const t=[...e],n=this.stylesheetGenerator.getStylesheet("product"),o=this.stylesheetGenerator.getStylesheet("cart"),s=this.stylesheetGenerator.getStylesheet("checkout"),a=this.stylesheetGenerator.getStylesheet("address");return n&&t.push(n),o&&t.push(o),s&&t.push(s),a&&t.push(a),t}let n;if(it.includes(t)||t===s.ADDRESS)n="address";else if(nt.includes(t)||t===s.PRODUCT)n="product";else if(ot.includes(t)||t===s.CART)n="cart";else{if(!rt.includes(t)&&t!==s.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;n="checkout"}const o=this.stylesheetGenerator.getStylesheet(n);return o?[...e,o]:e}getBaseStylesheets(){const t=[],e=this.stylesheetGenerator.getStylesheet("global"),n=this.stylesheetGenerator.getStylesheet("ui");return e&&t.push(e),n&&t.push(n),t}deepMerge(t,e){const n={...t};for(const o in e)null!==e[o]&&void 0!==e[o]&&("object"!=typeof e[o]||Array.isArray(e[o])||"object"!=typeof t[o]||Array.isArray(t[o])?n[o]=e[o]:n[o]=this.deepMerge(t[o],e[o]));return n}}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===s.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),t===s.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)===s.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==t?void 0:t.type)===s.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}}function buildCheckoutItemStore(t,e,n){return{liquidId:t.liquidId,variantId:t.variantId,cartItemId:t.cartItemId,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,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,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes,retailerName:e.name,expectationDetail:n.expectation.detail,loading:![],updating:![],error:null}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(t){var e,o,s;try{this.store.set("checkout.loading",!![]);const c=t||this.store.get("cart.id"),l=this.store.get("cart");if(0===(null===(e=Object.values(l.items))||void 0===e?void 0:e.length)&&!t)return;const h=this.themeProvider.getConfigs("checkout"),p={canEmail:h.layout.emailOptIn.checked,canSms:h.layout.smsOptIn.checked};if(!c)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const m={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.readyForSubmit":null,"checkout.isPresaleLocked":![],"checkout.presaleExpiresAt":null,"checkout.events":[],"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,firstName:"",lastName:"",email:"",phone:"",message:""}},f=await this.api.prepareCheckout({cartId:c,marketingPreferences:p});if((null===(o=f.retailers)||void 0===o?void 0:o.length)>0)for(const t of f.retailers)for(const e of t.fulfillments)e.type===a.ON_DEMAND&&(m["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});if((null===(s=f.items)||void 0===s?void 0:s.length)>0){this.store.remove("checkout.items");for(const t of f.items){const e=f.retailers.find(e=>e.id===t.retailerId),n=e.fulfillments.find(e=>e.id===t.fulfillmentId);m["checkout.items."+t.cartItemId]=buildCheckoutItemStore(t,e,n)}}f.isPresaleLocked&&f.presaleExpiresAt&&(m["checkout.isPresaleLocked"]=f.isPresaleLocked,m["checkout.presaleExpiresAt"]=f.presaleExpiresAt),m["checkout.token"]=f.token,m["checkout.cartId"]=f.cartId,m["checkout.customer"]=f.customer,m["checkout.acceptedAccountCreation"]=f.acceptedAccountCreation,m["checkout.billingSameAsShipping"]=f.billingSameAsShipping,m["checkout.hasAgeVerify"]=f.hasAgeVerify,m["checkout.hasSubstitutionPolicy"]=f.hasSubstitutionPolicy,m["checkout.isGift"]=f.isGift,m["checkout.marketingPreferences"]=f.marketingPreferences,m["checkout.giftCards"]=f.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),m["checkout.promoCode"]=f.promoCode.value?{code:f.promoCode.value,discountAmount:f.promoCode.discount}:null,m["checkout.marketingPreferences.canEmail"]=f.marketingPreferences.canEmail,m["checkout.marketingPreferences.canSms"]=f.marketingPreferences.canSms,m["checkout.amounts"]=f.amounts,m["checkout.error"]=null,m["checkout.updating"]=![],m["checkout.events"]=f.events||[],this.store.batch(m),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_LOADED,{cartId:f.cartId})}catch(c){throw this.store.set("checkout.error",c.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:c.message}),c}finally{this.store.set("checkout.loading",![])}}async partialLoadCheckout(t){var e,o,s,c,l;try{let n;if(this.store.set("checkout.updating",!![]),(null==t?void 0:t.cartResponse)?this.commonCommands.syncCartFromResponse(t.cartResponse):await this.commonCommands.loadCart(),null==t?void 0:t.response)n=t.response;else{const o=null!==(e=null==t?void 0:t.cartId)&&void 0!==e?e:this.store.get("checkout.cartId");if(!o)return this.store.set("checkout.error","Cart ID is not provided"),void 0;n=await this.api.prepareCheckout({cartId:o})}const h={"checkout.token":n.token,"checkout.events":transformEventsForCheckout(n.events||[]),"checkout.amounts":n.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":n.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),"checkout.promoCode":(null===(s=null===(o=null==n?void 0:n.promoCode)||void 0===o?void 0:o.value)||void 0===s?void 0:s.trim())?{code:n.promoCode.value,discountAmount:n.promoCode.discount}:null};if((null===(c=n.retailers)||void 0===c?void 0:c.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const t of n.retailers)for(const e of t.fulfillments)e.type===a.ON_DEMAND&&(h["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal})}if((null===(l=n.items)||void 0===l?void 0:l.length)>0){this.store.remove("checkout.items");for(const t of n.items){const e=n.retailers.find(e=>e.id===t.retailerId),o=e.fulfillments.find(e=>e.id===t.fulfillmentId);h["checkout.items."+t.cartItemId]=buildCheckoutItemStore(t,e,o)}}this.store.batch(h),this.validateAndUpdateFormStatus()}catch(h){const t=(null==h?void 0:h.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:t}),h}finally{this.store.set("checkout.updating",![])}}async toggleIsGift(t){const e=this.store.get("checkout.isGift"),o=null!=t?t:!e;this.store.batch({"checkout.isGift":o,"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,email:"",firstName:"",lastName:"",message:null,phone:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{isActive:o})}async toggleBillingSameAsShipping(t){const e=this.store.get("checkout.billingSameAsShipping"),o=null!=t?t:!e;this.store.batch({"checkout.billingSameAsShipping":o,"checkout.billing":{firstName:"",lastName:"",email:"",phone:"",addressOne:"",addressTwo:"",city:"",state:"",zipCode:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:o})}toggleMarketingPreferences(t,e){const o=this.store.get("checkout.marketingPreferences."+t),s=null!=e?e:!o;this.store.set("checkout.marketingPreferences."+t,s),this.pubSub.publishAction(n.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:t,isActive:s})}async getPaymentSession(){try{const t=this.store.get("cart.id"),e=await this.api.getPaymentSession({cartId:t});this.store.set("checkout.payment",{key:e.key,secret:e.secret,paymentMethodId:null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){try{const n=await this.api.confirmPaymentSession(t,e);this.store.batch({"checkout.payment.paymentMethodId":n.id,"checkout.readyForSubmit.payment":!![],"checkout.card":{...n.card}})}catch(n){throw new Error("Failed to confirm payment session. Please try again.")}}async applyPromoCode(t){var e;try{this.googleTagManager.promoCodeAttempt(t);const n=this.dataForCheckoutPrepare(),o=await this.api.prepareCheckout({...n,promoCode:t}),s=0!==o.amounts.discounts,a=null===(e=transformPromoCodeCheckoutEvents(o.events||[]))||void 0===e?void 0:e[0];if(!s)return this.store.set("checkout.promoCodeError",a?a.message:'Code "'+t+'" does not exist'),this.googleTagManager.promoCodeFailed(t,(null==a?void 0:a.message)||"not_applied"),void 0;this.googleTagManager.promoCodeApplied(t,o.amounts.discounts),await this.partialLoadCheckout({response:o})}catch(n){const e=(null==n?void 0:n.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",e),this.googleTagManager.promoCodeFailed(t,e),n}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(B){const e=B.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),B}}async removePromoCode(){var t,e;try{const n=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)||"",s=await this.api.prepareCheckout({...n,promoCode:""});if(0!==s.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.googleTagManager.promoCodeApplied(o,0),await this.partialLoadCheckout({response:s})}catch(n){const t=(null==n?void 0:n.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.promoCode.code")||"";throw e&&this.googleTagManager.promoCodeFailed(e,t),n}}async applyGiftCard(t){var e;const n=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(n);const t=this.dataForCheckoutPrepare(),o=t.giftCards||[],s=await this.api.prepareCheckout({...t,giftCards:[...o,n]}),a=null===(e=transformGiftCardCheckoutEvents(s.events||[]))||void 0===e?void 0:e[0],c=hasAnyRetailerGiftCardRestriction(s.events||[]);if(a&&(this.store.set("checkout.giftCardError",a.message),!c))return;const l=s.giftCards.find(t=>t.code.toLowerCase()===n.toLowerCase());if(!l)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.googleTagManager.giftCardFailed(n,(null==a?void 0:a.message)||"not_applied"),void 0;this.googleTagManager.giftCardApplied(n,l.applied),await this.partialLoadCheckout({response:s})}catch(o){const t=(null==o?void 0:o.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",t),this.googleTagManager.giftCardFailed(n,t),o}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(B){throw this.store.set("checkout.error",(null==B?void 0:B.message)||"Failed to clear gift card error. Please try again."),B}}async removeGiftCard(t){var e;const n=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare(),o=(null===(e=t.giftCards)||void 0===e?void 0:e.filter(t=>t.toLowerCase()!==n.toLowerCase()))||[],s=await this.api.prepareCheckout({...t,giftCards:o}),a=s.giftCards.find(t=>t.code.toLowerCase()===n.toLowerCase());if(a)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+n),void 0;this.googleTagManager.giftCardApplied(n,0),await this.partialLoadCheckout({response:s})}catch(o){const t=(null==o?void 0:o.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",t),this.googleTagManager.giftCardFailed(n,t),o}}updateCustomerInfo(t,e){try{this.store.set("checkout.customer."+t,e),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{fieldName:t})}catch(o){throw this.store.set("checkout.error",o.message),o}}updateBillingInfo(t,e){try{this.store.set("checkout.billing."+t,e),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,{fieldName:t})}catch(o){throw this.store.set("checkout.error",o.message),o}}updateGiftInfo(t,e){try{this.store.set("checkout.giftRecipient."+t,e),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,{fieldName:t})}catch(o){throw this.store.set("checkout.error",o.message),o}}triggerAddShippingInfoEvent(){var t,e;const n=this.store.get("checkout");if(n.customer.email||n.customer.phone){const o=(null===(t=null==n?void 0:n.customer)||void 0===t?void 0:t.id)||(null===(e=null==n?void 0:n.customer)||void 0===e?void 0:e.email),s={subtotal:centToDollar(n.amounts.subtotal),total_before_discounts:centToDollar(n.amounts.subtotal+n.amounts.tax+n.amounts.shipping+n.amounts.delivery+n.amounts.platform+n.amounts.service),discounts:centToDollar(n.amounts.discounts),gift_cards:centToDollar(n.amounts.giftCards||0),net_total:centToDollar(n.amounts.total)};this.googleTagManager.addShippingInfoWithCustomerData(centToDollar(n.amounts.total),void 0,{phone:n.customer.phone,email:n.customer.email,birth_date:n.customer.birthDate,customer_id:o},s)}}validateAndUpdateFormStatus(){const t=this.store.get("checkout"),e=validateCustomerInfo(t.customer),n=t.isGift?validateGiftRecipientInfo(t.giftRecipient):{isValid:!![],invalidFields:[]},o=t.billingSameAsShipping?{isValid:!![],invalidFields:[]}:validateBillingInfo(t.billing),s=e.isValid&&n.isValid&&o.isValid,a=[...e.invalidFields.map(t=>"customer."+t),...n.invalidFields.map(t=>"giftRecipient."+t),...o.invalidFields.map(t=>"billing."+t)];this.store.batch({"checkout.isFormValid":s,"checkout.invalidFields":a,"checkout.readyForSubmit.customer":e.isValid,"checkout.readyForSubmit.gift":n.isValid,"checkout.readyForSubmit.billing":o.isValid})}async checkoutComplete(){var t;try{const e=this.store.get("checkout"),o=this.store.get("checkout.payment.paymentMethodId");if(!e.token||!o)return;const a=await this.api.checkoutComplete({token:e.token,payment:o}),c=a.legacyOrderNumber||a.referenceId||"N/A";e.isPresaleLocked||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(s.CHECKOUT_COMPLETED,{orderNumber:c,orderTotal:e.amounts.total,cardLast4:e.card.last4,customerEmail:e.customer.email,giftRecipientEmail:(null===(t=e.giftRecipient)||void 0===t?void 0:t.email)||null}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:c,orderTotal:e.amounts.total}),this.googleTagManager.purchase({transaction_id:c,tax:centToDollar(e.amounts.tax||0),shipping:centToDollar(e.amounts.shipping||0),items:[...Object.values(e.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(e.amounts.total),subtotal:centToDollar(e.amounts.subtotal),total_before_discounts:centToDollar(e.amounts.subtotal+e.amounts.tax+e.amounts.shipping+e.amounts.delivery+e.amounts.platform+e.amounts.service),discounts:centToDollar(e.amounts.discounts),gift_cards:centToDollar(e.amounts.giftCards||0),net_total:centToDollar(e.amounts.total)})}catch(e){const t=(null==e?void 0:e.message)||"Checkout complete failed";throw this.store.batch({"checkout.error":t,"checkout.readyForSubmit.prepared":![],"checkout.readyForSubmit.payment":![],"checkout.payment.sendSubmitSignal":![]}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t}),e}finally{this.store.set("checkout.loading",![])}}async startPreparingCheckoutSubmit(){var t,e,o,s;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const a=this.store.get("checkout");this.store.set("checkout.payment.sendSubmitSignal",!![]);const c={cartId:a.cartId,customer:{firstName:a.customer.firstName,lastName:a.customer.lastName,email:a.customer.email,phone:a.customer.phone,birthDate:a.customer.birthDate,company:a.customer.company},...a.isGift&&{giftOptions:{recipient:{email:a.giftRecipient.email,phone:a.giftRecipient.phone,name:a.giftRecipient.firstName+" "+a.giftRecipient.lastName},message:a.giftRecipient.message||""}},...!a.billingSameAsShipping&&(null==a?void 0:a.billing)&&{billingAddress:{firstName:null==a?void 0:a.billing.firstName,lastName:a.billing.lastName,email:a.billing.email,phone:a.billing.phone,company:null!==(t=a.billing.company)&&void 0!==t?t:void 0,city:a.billing.city,state:a.billing.state,zip:a.billing.zipCode,one:a.billing.addressOne,two:a.billing.addressTwo||""}},billingSameAsShipping:a.billingSameAsShipping,acceptedAccountCreation:a.acceptedAccountCreation,hasAgeVerify:a.hasAgeVerify,shippingAddressTwo:null!==(e=a.isGift?a.giftRecipient.addressTwo:a.customer.addressTwo)&&void 0!==e?e:void 0,hasSubstitutionPolicy:a.hasSubstitutionPolicy,isGift:a.isGift,marketingPreferences:a.marketingPreferences,promoCode:(null===(o=a.promoCode)||void 0===o?void 0:o.code)||void 0,giftCards:(null===(s=a.giftCards)||void 0===s?void 0:s.map(t=>t.code))||[],deliveryInstructions:Object.values(a.onDemandFulfillmentTipInfo||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:a.deliveryInstructions||""}))},l=await this.api.prepareCheckout(c);this.store.batch({"checkout.customer":l.customer,"checkout.acceptedAccountCreation":l.acceptedAccountCreation,"checkout.billingSameAsShipping":l.billingSameAsShipping,"checkout.hasAgeVerify":l.hasAgeVerify,"checkout.hasSubstitutionPolicy":l.hasSubstitutionPolicy,"checkout.isGift":l.isGift,"checkout.marketingPreferences":l.marketingPreferences,"checkout.events":l.events||[],"checkout.readyForSubmit.prepared":!![]}),this.triggerAddShippingInfoEvent();const h={subtotal:centToDollar(a.amounts.subtotal),total_before_discounts:centToDollar(a.amounts.subtotal+a.amounts.tax+a.amounts.shipping+a.amounts.delivery+a.amounts.platform+a.amounts.service),discounts:centToDollar(a.amounts.discounts),gift_cards:centToDollar(a.amounts.giftCards||0),net_total:centToDollar(a.amounts.total)};this.googleTagManager.addPaymentInfoWithoutItems(centToDollar(a.amounts.total),"card",void 0,h)}catch(a){const t=(null==a?void 0:a.message)||"Checkout preparation failed";throw this.store.batch({"checkout.error":t,"checkout.loading":![]}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t}),a}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(s.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async focusFirstInvalidField(){try{const t=this.store.get("checkout.invalidFields")||[];if(0===t.length)return;const e=t[0];this.store.set("checkout.focusField",e),setTimeout(()=>{this.store.set("checkout.focusField",null)},100)}catch(t){this.logger.error("Checkout form validation focus operation failed",{error:t instanceof Error?t.message:String(t)})}}buildItemUpdate(t,e){var n,o,s;const a={id:t.cartItemId,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},c=(null===(s=null===(o=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];return c.length>0&&(a.engravingLines=c),a}async updateCheckoutItemQuantity(t,e){try{this.store.set("checkout.items."+t+".updating",!![]);const o=this.store.get("checkout.cartId"),s=this.store.get("checkout.items."+t);if(!s)throw new Error("Item not found");const a=s.quantity,c=s.quantity+e;if(c<1)return this.removeItem(t,!![]);const l=this.buildItemUpdate(s,c),h=await this.api.updateCart({id:o,items:[l],loc:this.getLocation()});this.pubSub.publishAction(e>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:s.cartItemId,quantity:c,previousQuantity:a});const p=splitCategoryPath(s.catPath),m={item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,quantity:Math.abs(e),price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId};e<0?this.googleTagManager.removeFromCart(m):e>0&&this.googleTagManager.addToCart(m),await this.partialLoadCheckout({cartResponse:h})}catch(o){throw this.store.set("checkout.items."+t+".error",o.message),o}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var e,o,s;try{const a=this.store.get("checkout.items."+t);if(!a)throw new Error("Item not found in checkout");if(!(null===(e=a.attributes)||void 0===e?void 0:e.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const c=(null===(s=null===(o=a.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||[],l={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:[]},h=this.store.get("checkout.cartId"),p=await this.api.updateCart({id:h,items:[l],loc:this.getLocation()});this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:a.cartItemId,engravingLines:[],previousEngravingLines:c}),await this.partialLoadCheckout({cartResponse:p})}catch(a){throw this.store.set("checkout.items."+t+".error",a.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:a.message}),a}}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("checkout.items."+t+".updating",!![]);const o=this.store.get("checkout.cartId"),s=this.store.get("checkout.items."+t);if(!s)throw new Error("Item not found");const a=this.buildItemUpdate(s,0),c=await this.api.updateCart({id:o,items:[a],loc:this.getLocation()});this.store.remove("checkout.items."+t),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartItemId:s.cartItemId}),await this.partialLoadCheckout({cartResponse:c})}catch(o){throw this.store.set("checkout.items."+t+".error",o.message),o}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const e=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},o=Object.values(e).map(e=>{const n=Math.round(e.subtotal*t/100);return{fulfillmentId:e.fulfillmentId,tip:n}}),s=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:o});this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}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 o=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},s=Object.values(o).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===t?e:n.tip})),a={...this.dataForCheckoutPrepare(),deliveryTips:s},c=await this.api.prepareCheckout(a);this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:s})}catch(o){throw this.store.set("checkout.error",(null==o?void 0:o.message)||"Failed to update fulfillment tip. Please try again."),o}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const e=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},o=Object.values(e).map(e=>({fulfillmentId:e.fulfillmentId,tip:e.fulfillmentId===t?0:e.tip})),s=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:o});this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}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",![])}}updateStoreFromCheckoutResponse(t){var e;const n={"checkout.amounts":t.amounts,"checkout.warning":t.warning,"checkout.events":transformEventsForCheckout(t.events||[]),"checkout.error":null};if((null===(e=t.retailers)||void 0===e?void 0:e.length)>0)for(const o of t.retailers)for(const t of o.fulfillments)t.type===a.ON_DEMAND&&(n["checkout.onDemandFulfillmentTipInfo."+t.id]={retailerId:o.id,retailerName:o.name,fulfillmentId:t.id,tip:t.tip,subtotal:t.subtotal});this.store.batch(n)}async updateStripeFormStatus(t){try{const e=this.store.get("checkout.stripeFormStatus")||{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},n={...e,...t};this.store.set("checkout.stripeFormStatus",n)}catch(e){throw this.logger.error("Error updating Stripe form status",{error:e instanceof Error?e.message:String(e)}),e}}async removeCheckoutError(){this.store.set("checkout.error",null)}async updateDeliveryInstructions(t){this.store.set("checkout.deliveryInstructions",t)}dataForCheckoutPrepare(){var t,e,n;const o=this.store.get("checkout"),s=(null===(t=null==o?void 0:o.customer)||void 0===t?void 0:t.email)?{firstName:o.customer.firstName,lastName:o.customer.lastName,email:o.customer.email,phone:o.customer.phone,birthDate:o.customer.birthDate,company:o.customer.company}:void 0;return{cartId:o.cartId,customer:s,billingSameAsShipping:o.billingSameAsShipping,acceptedAccountCreation:o.acceptedAccountCreation,hasAgeVerify:o.hasAgeVerify,hasSubstitutionPolicy:o.hasSubstitutionPolicy,marketingPreferences:o.marketingPreferences,promoCode:(null===(e=o.promoCode)||void 0===e?void 0:e.code)||void 0,giftCards:(null===(n=null==o?void 0:o.giftCards)||void 0===n?void 0:n.map(t=>t.code))||[]}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.pubSubService=PubSubService.getInstance(),this.commonCommands=CommonCommands.getInstance(),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 o=this.store.get("cart.id"),s=this.store.get("cart.items."+t);if(!s)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+e),new Error("Item not found");const a=s.quantity+e;if(a<1)return this.removeItem(t,!![]);const c=this.buildItemUpdate(s,a),l=await this.api.updateCart({id:o,items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(l,[t]),this.updateFulfillment(s.fulfillmentId,l),this.syncRetailersFromApiResponse(l),this.syncCartMetaFromApiResponse(l),this.pubSubService.publishAction(e<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{id:s.id,quantity:a,previousQuantity:s.quantity});const h=splitCategoryPath(s.catPath),p={item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:Math.abs(e),price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId};e<0?this.googleTagManager.removeFromCart(p):e>0&&this.googleTagManager.addToCart(p)}catch(o){throw this.store.set("cart.items."+t+".error",o.message),this.logger.error("Failed to update item quantity",o),o}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 o=this.store.get("cart.id"),s=this.store.get("cart.items."+t);if(!s)throw new Error("Item not found");const a={itemId:s.id,fulfillmentId:s.fulfillmentId,retailerId:s.retailerId},c=this.buildItemUpdate(s,0),l=await this.api.updateCart({id:o,items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(l,[]),this.cleanupAfterItemRemoval(a,l),this.syncCartMetaFromApiResponse(l),this.pubSubService.publishAction(n.CART_ITEM_REMOVED,{id:s.id});const h=splitCategoryPath(s.catPath);this.googleTagManager.removeFromCart({item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_size:s.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:s.quantity,price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId})}catch(o){throw this.store.set("cart.items."+t+".error",o.message),this.logger.error("Failed to remove item",o),o}}async updateItemEngraving(t,e){var o,s,a;try{const c=this.store.get("cart"),l=null===(o=c.items)||void 0===o?void 0:o[t];if(!l)throw new Error("Item not found");this.store.set("cart.items."+t+".updating",!![]);const h={id:l.id,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:l.quantity,engravingLines:e},p=await this.api.updateCart({id:c.id||"",items:[h],loc:this.getLocation()});this.syncItemsFromApiResponse(p,[t]),this.syncRetailersFromApiResponse(p),this.syncCartMetaFromApiResponse(p);const m=this.store.get("cart"),f=this.store.get("address");this.pubSubService.publishAction(n.CART_UPDATED,{previous:cartDataForEventFromStore(c,f),current:cartDataForEventFromStore(m,f)}),this.pubSubService.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{id:l.id,engravingLines:e,previousEngravingLines:(null===(a=null===(s=l.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||[]})}catch(c){throw this.store.set("cart.items."+t+".error",c.message),this.logger.error("Failed to update item engraving",c),c}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var e,o;try{this.store.set("cart.loading",!![]);const s=this.store.get("cart"),a={...s},c=(null===(e=t.engravingLines)||void 0===e?void 0:e.filter(t=>""!==t.trim()))||[],l=c.length>0,h=Object.values(s.items||{}).find(e=>{var n,o,s,a,h;const p=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!p)return![];if(l){const t=(null===(o=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.lines)||[];return c.join(",")===t.join(",")}return!(null===(h=null===(a=null===(s=e.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||void 0===h?void 0:h.length)}),p={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:h?t.quantity+h.quantity:t.quantity};l&&(p.engravingLines=c);const m=await this.api.updateCart({id:s.id||"",items:[p],loc:this.getLocation()}),f=null===(o=m.items)||void 0===o?void 0:o.find(t=>t.fulfillmentId===p.fulfillmentId&&t.partNumber===p.partNumber&&t.upc===p.upc);if(!f)throw new Error("Added item not found in cart response");this.syncItemsFromApiResponse(m,[]);const v=this.store.get("cart.fulfillments."+t.fulfillmentId);v?this.updateFulfillment(t.fulfillmentId,m):this.addNewFulfillmentAndRetailer(t.fulfillmentId,m),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const b=this.store.get("cart"),x=this.store.get("address");this.pubSubService.publishAction(n.PRODUCT_ADD_TO_CART,{...t}),this.pubSubService.publishAction(n.CART_ITEM_ADDED,{id:f.id,upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSubService.publishAction(n.CART_UPDATED,{previous:cartDataForEventFromStore(a,x),current:cartDataForEventFromStore(b,x)});const w=splitCategoryPath(f.catPath);this.googleTagManager.addToCart({item_id:f.liquidId,item_name:f.name,item_brand:f.brand,item_size:f.size,item_category:w.category,item_category2:w.category2,item_category3:w.category3,item_type:f.type,item_subtype:f.subType,quantity:f.quantity,price:centToDollar(f.unitPrice||0),upc:f.upc,grouping_id:f.salsifyGrouping,product_id:f.liquidId})}catch(s){throw this.store.set("cart.error",s.message),this.logger.error("Failed to add item to cart",s),s}finally{this.store.set("cart.loading",![])}}async addPresaleItem(t){var e;try{const n={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity};(null==t?void 0:t.engravingLines)&&(null===(e=null==t?void 0:t.engravingLines)||void 0===e?void 0:e.length)>0&&(n.engravingLines=t.engravingLines);const o=await this.api.updateCart({id:"",items:[n],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(o.id)}catch(n){throw this.store.set("cart.error",n.message),this.logger.error("Failed to add presale item to cart",n),n}}async handleGoToCheckout(){var t;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(s.CHECKOUT);const e=this.store.get("cart"),n=(null===(t=e.promoCode)||void 0===t?void 0:t.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(e.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],n)}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",![])}}async applyPromoCode(t){var e,n,o;if(!(null==t?void 0:t.trim()))throw new Error("Promo code is required");const s=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(s);const a=await this.api.updateCart({id:t,items:[],promoCode:s,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(a)),this.store.set("cart.events",transformEventsForCart(a.events||[]));const c=(null===(o=null===(n=null===(e=a.attributes)||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.value)||void 0===o?void 0:o.toLowerCase())===s.toLowerCase();c?(this.store.set("cart.promoCode",{code:s,discountAmount:a.discounts||0}),this.googleTagManager.promoCodeApplied(s,a.discounts||0)):(this.store.set("cart.promoCode",null),this.googleTagManager.promoCodeFailed(s,'Code "'+s+'" does not exist'))}catch(a){const t=(null==a?void 0:a.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",t),this.googleTagManager.promoCodeFailed(s,t),this.logger.error("Failed to apply promo code",a),a}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(e),"cart.promoCode":null}),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 n=this.store.get("cart.promoCode");throw(null==n?void 0:n.code)&&this.googleTagManager.promoCodeFailed(n.code,e),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...H,rerender:!![]}),this.store.set("cart",{...G,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSubService.publishAction(n.CART_RESET,!![])}getDetails(){var t;const e=this.store.get("cart"),n=this.store.get("address"),o=n.id?n:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},s={};for(const a in e.items||{}){const t=e.items[a];s[a]={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||0,quantity:t.quantity||0,maxQuantity:t.maxQuantity||0,unitPrice:t.unitPrice||0,mainImage:t.mainImage||"",attributes:t.attributes||{}}}return{id:e.id,promoCode:(null===(t=e.promoCode)||void 0===t?void 0:t.code)||"",items:s,location:{placesId:o.id,address:{one:o.address.one,two:o.address.two,city:o.address.city,state:o.address.state,zip:o.address.zip,country:o.address.country},coordinates:{latitude:o.coordinates.lat,longitude:o.coordinates.long}},amounts:{deliveryFee:e.totals.deliveryFee,discounts:e.totals.discounts,engravingFee:e.totals.engravingFee,giftCardTotal:e.totals.giftCardTotal,platformFee:e.totals.platformFee,shippingFee:e.totals.shippingFee,subtotal:e.totals.subtotal,total:e.totals.total},itemCount:Object.values(s||{}).reduce((t,e)=>t+(e.quantity||0),0),updatedAt:e.updatedAt,createdAt:e.createdAt}}buildItemUpdate(t,e){var n,o,s;const a={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},c=(null===(s=null===(o=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];return c.length>0&&(a.engravingLines=c),a}syncItemsFromApiResponse(t,e=[]){var n;const o=this.store.get("cart.items")||{},s=new Set((null===(n=t.items)||void 0===n?void 0:n.map(t=>t.id))||[]);for(const c of Object.keys(o))s.has(c)||this.store.remove("cart.items."+c);const a={};for(const c of t.items)0!==e.length&&!e.includes(c.id)&&o[c.id]||(a["cart.items."+c.id]=buildCartItemStore(c));Object.keys(a).length>0&&this.store.batch(a)}syncCartMetaFromApiResponse(t){var e,n;const o={"cart.totals":buildCartTotals(t),"cart.error":null,"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(t.events||[])},s=null===(n=null===(e=t.attributes)||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.value;if(s)o["cart.promoCode"]={code:s.toUpperCase(),discountAmount:t.discounts||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(o["cart.promoCode"]=null)}this.store.batch(o)}syncRetailersFromApiResponse(t){var e;if((null===(e=t.retailers)||void 0===e?void 0:e.length)>0){const e={};for(const n of t.retailers)e["cart.retailers."+n.id]=buildRetailerStore(n);this.store.batch(e)}}updateFulfillment(t,e){var n,o;const s=null===(n=e.retailers)||void 0===n?void 0:n.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t)}),a=null===(o=null==s?void 0:s.fulfillments)||void 0===o?void 0:o.find(e=>e.id===t);a&&s&&this.store.set("cart.fulfillments."+t,buildFulfillmentStore(a,s))}addNewFulfillmentAndRetailer(t,e){var n,o;const s=null===(n=e.retailers)||void 0===n?void 0:n.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t)}),a=null===(o=null==s?void 0:s.fulfillments)||void 0===o?void 0:o.find(e=>e.id===t);if(a&&s){const e={["cart.fulfillments."+t]:buildFulfillmentStore(a,s),["cart.retailers."+s.id]:buildRetailerStore(s)};this.store.batch(e)}}cleanupAfterItemRemoval(t,e){var n,o,s,a;const c=this.store.get("cart.fulfillments."+t.fulfillmentId),l=this.store.get("cart.retailers."+t.retailerId);if(!c||!l)return;const h=null===(n=e.retailers)||void 0===n?void 0:n.some(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t.fulfillmentId)}),p=null===(o=e.retailers)||void 0===o?void 0:o.some(e=>e.id===t.retailerId);if(h){this.updateFulfillment(t.fulfillmentId,e);const n=null===(a=e.retailers)||void 0===a?void 0:a.find(e=>e.id===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(n))}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),p){const n=null===(s=e.retailers)||void 0===s?void 0:s.find(e=>e.id===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(n))}else this.store.remove("cart.retailers."+t.retailerId)}}class ProductCommands extends BaseCommand{constructor(){super(),this.themeProvider=ThemeProviderService.getInstance(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,e=![]){this.store.createProductInstance(t),e&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var e;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,e)=>(t["products."+e+".loading"]=!![],t["products."+e+".error"]=null,t),{}));const n=await this.api.getProductsData(t,this.getLocation());if(!n||!n.products||0===n.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]=!![],t),{})),void 0;const o=[];for(const a of n.products){const s=a.sizes.filter(e=>t.some(t=>t===(e.upc||e.id||a.salsifyGrouping))),c=t.find(t=>s.some(e=>t===e.upc||t===e.id)||t===a.salsifyGrouping),l=c||(null===(e=null==s?void 0:s[0])||void 0===e?void 0:e.upc);await this.loadProduct(l,{products:[a],retailers:n.retailers}),o.push(l)}const s=t.filter(t=>-1===o.indexOf(t));this.store.batch(s.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]="Product data not found",t),{}))}async loadProduct(t,e=null){var o,s;try{const a=this.store.get("products."+t);a.loading||this.store.set("products."+t+".loading",!![]);let c=null;if(e&&(c=e),e||(c=await this.api.getProductsData([t],this.getLocation())),!c||!(null===(o=null==c?void 0:c.products)||void 0===o?void 0:o[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const l=this.loadProductStoreUpdate(c);if(!l)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...l,identifier:t}),this.pubSub.publishAction(n.PRODUCT_LOADED,this.productDataForEventFromStore(t));const h=c.products[0],p=l.sizes[l.selectedSizeId||""],m=Boolean(this.getLocation()),f=l.selectedFulfillment,v=m&&(null==f?void 0:f.price)?f.price:(null===(s=l.priceInfo)||void 0===s?void 0:s.avg)||0,b=splitCategoryPath(h.catPath);this.googleTagManager.viewItem({item_id:null==p?void 0:p.id,item_name:h.name,item_brand:h.brand,item_size:null==p?void 0:p.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,price:centToDollar(v),item_type:h.type,item_subtype:h.subType,upc:null==p?void 0:p.upc,grouping_id:h.salsifyGrouping,product_id:null==p?void 0:p.id})}catch(a){throw this.store.set("products."+t+".error",a.message),this.logger.error("Failed to load product data for ID "+t,a),a}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,e){var o,s,c,l,h,p,m;const f=this.store.get("products."+t);let v=f.selectedFulfillmentType;const b=null===(o=f.sizes[e])||void 0===o?void 0:o.shippingFulfillments,x=null===(s=f.sizes[e])||void 0===s?void 0:s.onDemandFulfillments;let w=null,C=null;if(v!==a.SHIPPING||objectValues(b).length)if(v!==a.ON_DEMAND||objectValues(x).length){const t=v===a.SHIPPING?b:x,e=objectValues(t);w=e[0]||null,C=(null==w?void 0:w.fulfillmentId)||null}else{v=a.SHIPPING;const t=objectValues(b);w=t[0]||null,C=(null==w?void 0:w.fulfillmentId)||null}else{v=a.ON_DEMAND;const t=objectValues(x);w=t[0]||null,C=(null==w?void 0:w.fulfillmentId)||null}const k=v===a.SHIPPING?b:x,S=f.sizes[e],E=splitCategoryPath(f.catPath),T=(null==w?void 0:w.price)||(null===(c=f.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==S?void 0:S.id,item_name:f.name,item_brand:f.brand,item_size:null==S?void 0:S.size,item_category:E.category,item_category2:E.category2,item_category3:E.category3,price:centToDollar(T),item_type:f.type,item_subtype:f.subType,upc:null==S?void 0:S.upc,grouping_id:f.salsifyGrouping,product_id:null==S?void 0:S.id});const I=Object.keys(b).length>0,P=Object.keys(x).length>0,F=I||P;if(!F){const t=this.store.get("address");this.googleTagManager.productSizeNoAvailability({productId:null==S?void 0:S.id,productName:f.name,productBrand:f.brand,productCategory:E.category,productCategory2:E.category2,productCategory3:E.category3,productType:f.type,productSubtype:f.subType,productPrice:(null===(l=f.priceInfo)||void 0===l?void 0:l.avg)||0,sizeId:e,sizeName:null==S?void 0:S.size,upc:null==S?void 0:S.upc,groupingId:f.salsifyGrouping,address:(null==t?void 0:t.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||""}:void 0,reason:"No fulfillments available for this size"})}this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:e,size:(null===(h=f.sizes[e])||void 0===h?void 0:h.size)||"",previousSizeId:f.selectedSizeId||"",previousSize:(null===(p=f.sizes[f.selectedSizeId])||void 0===p?void 0:p.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:e,["products."+t+".mainImage"]:(null===(m=f.sizes[e])||void 0===m?void 0:m.image)||null,["products."+t+".productHasAvailability"]:Object.keys(b).length+Object.keys(x).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(k).length),["products."+t+".selectedFulfillmentType"]:v,["products."+t+".selectedFulfillment"]:w,["products."+t+".selectedFulfillmentId"]:C})}async selectFulfillment(t,e){var o,s,c;const l=this.store.get("products."+t),h=null===(o=l.sizes[l.selectedSizeId])||void 0===o?void 0:o.shippingFulfillments,p=null===(s=l.sizes[l.selectedSizeId])||void 0===s?void 0:s.onDemandFulfillments,m=l.selectedFulfillmentType===a.SHIPPING?h:p,f=m[e];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:e,selectedFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId||"",previousFulfillmentType:l.selectedFulfillmentType});const v=l.sizes[l.selectedSizeId||""],b=splitCategoryPath(l.catPath),x=(null==f?void 0:f.price)||(null===(c=l.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==v?void 0:v.id,item_name:l.name,item_brand:l.brand,item_size:null==v?void 0:v.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,price:centToDollar(x),item_type:l.type,item_subtype:l.subType,upc:null==v?void 0:v.upc,grouping_id:l.salsifyGrouping,product_id:null==v?void 0:v.id}),this.store.batch({["products."+t+".selectedFulfillment"]:f,["products."+t+".selectedFulfillmentId"]:e,["products."+t+".quantity"]:1})}async updateQuantity(t,e){var o;const s=this.store.get("products."+t),a=s.quantity,c=a+e,l=1,h=(null===(o=null==s?void 0:s.selectedFulfillment)||void 0===o?void 0:o.stock)||5,p=Math.max(l,Math.min(h,c));this.pubSub.publishAction(e<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:p,previousQuantity:a}),this.store.set("products."+t+".quantity",p)}async changeFulfillmentType(t,e){var o,s,c;const l=this.store.get("products."+t),{shippingFulfillments:h,onDemandFulfillments:p}=l.sizes[l.selectedSizeId],m=e===a.SHIPPING?h:p,f=objectValues(m);if(0===f.length){this.logger.warn("No fulfillments available for type "+e+" on product "+t);const n=this.store.get("address"),a=l.sizes[l.selectedSizeId],c=splitCategoryPath(l.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==a?void 0:a.id,productName:l.name,productBrand:l.brand,productCategory:c.category,productCategory2:c.category2,productCategory3:c.category3,productType:l.type,productSubtype:l.subType,productPrice:(null===(o=l.priceInfo)||void 0===o?void 0:o.avg)||0,sizeId:null!==(s=l.selectedSizeId)&&void 0!==s?s:void 0,sizeName:null==a?void 0:a.size,fulfillmentType:e,upc:null==a?void 0:a.upc,groupingId:l.salsifyGrouping,address:(null==n?void 0:n.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||""}:void 0,reason:"No "+e+" fulfillments available for selected size"}),void 0}const v=f[0]||null,b=(null==v?void 0:v.fulfillmentId)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:e,selectedFulfillmentId:b,previousFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId,fulfillmentHasAvailability:f.length>0});const x=l.sizes[l.selectedSizeId||""],w=splitCategoryPath(l.catPath),C=(null==v?void 0:v.price)||(null===(c=l.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==x?void 0:x.id,item_name:l.name,item_brand:l.brand,item_size:null==x?void 0:x.size,item_category:w.category,item_category2:w.category2,item_category3:w.category3,price:centToDollar(C),item_type:l.type,item_subtype:l.subType,upc:null==x?void 0:x.upc,grouping_id:l.salsifyGrouping,product_id:null==x?void 0:x.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:e,["products."+t+".selectedFulfillment"]:v,["products."+t+".selectedFulfillmentId"]:b,["products."+t+".fulfillmentHasAvailability"]:f.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,e,n){const o={type:e,data:n||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:o})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),e=Object.keys(t);for(const n of e)this.store.set("products."+n+".rerender",!![])}async addToCart(t,e){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(s.CART),await this.cartCommands.addItem(e),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const n=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(n.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,e){try{this.store.set("products."+t+".updating",!![]),await this.cartCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(s.CHECKOUT),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const e=this.store.get("products."+t),n={},fulfillmentEventData=t=>{const e={};for(const n in t){const o=t[n];e[n]={retailerId:o.retailerId,retailerName:o.retailerName,retailerAddress:o.retailerAddress,retailerTimezone:o.timezone,price:o.price,partNumber:o.partNumber,stock:o.stock,isEngravable:o.isVariantEngravable,fulfillmentId:o.fulfillmentId,fulfillmentType:o.fulfillmentType,modalities:o.modalities||[]}}return e};for(const o in e.sizes||{}){const t=e.sizes[o];n[o]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc||"",container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.attributes.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:{engraving:t.attributes.engraving||void 0,presale:t.attributes.presale||void 0},shippingFulfillments:fulfillmentEventData(t.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(t.onDemandFulfillments||{})}}return{identifier:t,selectedSizeId:e.selectedSizeId||null,selectedFulfillmentId:e.selectedFulfillmentId||null,selectedFulfillmentType:e.selectedFulfillmentType,id:e.id,name:e.name,brand:e.brand,catPath:e.catPath,category:e.category,classification:e.classification,type:e.type,salsifyGrouping:e.salsifyGrouping,subType:e.subType,mainImage:e.mainImage||null,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,description:e.description,htmlDescription:e.htmlDescription,tastingNotes:e.tastingNotes,priceInfo:e.priceInfo||null,sizes:n}}findFirstAvailableSize(t){const e=objectValues(t);for(const n of e){const t=n.shippingFulfillments||{},e=n.onDemandFulfillments||{},o=objectValues(t).length,s=objectValues(e).length;if(o+s>0)return n.id}return null}loadProductStoreUpdate(t){var e,n,o,s,c,l,h,p,m,f,v;try{const{products:[b,...x],retailers:w}=t,C=this.themeProvider.getConfigs("product"),k={};let S=![],E=![],T="",I=null,P=C.layout.enableShippingFulfillment?a.SHIPPING:a.ON_DEMAND,F=null,D=null;const _={};if(w&&Array.isArray(w)&&w.length>0)for(const t of w)for(const e of t.fulfillments)_[e.id]={retailerName:t.name,retailerAddress:t.address||null,type:e.type,timezone:e.timezone||"",canEngrave:e.canEngrave||![],expectation:e.expectation,fees:e.fees,hours:e.hours,retailerId:t.id,fulfillmentId:e.id,fulfillmentType:e.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]};if(b.sizes&&Array.isArray(b.sizes)&&b.sizes.length>0)for(const t of b.sizes){const c={},l={};for(const h of t.variants){if((null===(e=null==h?void 0:h.fulfillmentTypes)||void 0===e?void 0:e.onDemand)&&""!==h.fulfillmentTypes.onDemand){const t=h.fulfillmentTypes.onDemand,e=_[t];e?l[t]={...e,isVariantEngravable:h.isEngravable,stock:h.stock,price:h.price,retailerId:h.retailerId,fulfillmentId:t,fulfillmentType:a.ON_DEMAND,modalities:[...e.modalities,...null!==(n=null==h?void 0:h.modalities)&&void 0!==n?n:[]],partNumber:h.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId "+t)}if((null===(o=null==h?void 0:h.fulfillmentTypes)||void 0===o?void 0:o.shipping)&&""!==h.fulfillmentTypes.shipping){const t=h.fulfillmentTypes.shipping,e=_[t];e?c[t]={...e,isVariantEngravable:h.isEngravable,stock:h.stock,price:h.price,retailerId:h.retailerId,fulfillmentId:t,fulfillmentType:a.SHIPPING,modalities:[...e.modalities,...null!==(s=null==h?void 0:h.modalities)&&void 0!==s?s:[]],partNumber:h.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+t)}}k[t.id]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.attributes.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:t.attributes,loading:![],error:null,shippingFulfillments:c,onDemandFulfillments:l}}const O=objectValues(k),N=this.findFirstAvailableSize(k);T=N||O[0]&&O[0].id||"",I=(null===(c=k[T])||void 0===c?void 0:c.image)||null;const M=(null===(l=k[T])||void 0===l?void 0:l.shippingFulfillments)||{},L=(null===(h=k[T])||void 0===h?void 0:h.onDemandFulfillments)||{},R=objectValues(M).length,B=objectValues(L).length;S=R+B>0;const q=P===a.SHIPPING?objectValues(M):objectValues(L);if(E=q.length>0,D=q[0]||null,F=(null==D?void 0:D.fulfillmentId)||null,!E){const t=P===a.SHIPPING?a.ON_DEMAND:a.SHIPPING,e=t===a.SHIPPING?objectValues(M):objectValues(L);e.length>0&&(P=t,D=e[0],F=(null==D?void 0:D.fulfillmentId)||null,E=!![])}if(!S){const t=this.store.get("address"),e=splitCategoryPath(b.catPath),n=k[T];this.googleTagManager.productNoAvailability({productId:null==n?void 0:n.id,productName:b.name,productBrand:b.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:b.type,productSubtype:b.subType,productPrice:(null===(p=b.priceInfo)||void 0===p?void 0:p.average)||0,upc:null==n?void 0:n.upc,groupingId:b.salsifyGrouping,address:(null==t?void 0:t.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||""}:void 0,reason:"No fulfillments available for any size"})}return{identifier:"",id:b.id||"",name:b.name,description:b.description,htmlDescription:b.htmlDescription,images:b.images,priceInfo:{min:(null===(m=b.priceInfo)||void 0===m?void 0:m.minimum)||0,max:(null===(f=b.priceInfo)||void 0===f?void 0:f.maximum)||0,avg:(null===(v=b.priceInfo)||void 0===v?void 0:v.average)||0},brand:b.brand,region:b.region||"",country:b.country||"",material:b.material||"",abv:b.abv||"",proof:b.proof||"",age:b.age||"",color:b.color||"",flavor:b.flavor||"",variety:b.variety||"",appellation:b.appellation||"",vintage:b.vintage||"",tastingNotes:b.tastingNotes||"",catPath:b.catPath,category:b.category,classification:b.classification,type:b.type,subType:b.subType,salsifyGrouping:b.salsifyGrouping,sizes:k,productHasAvailability:S,fulfillmentHasAvailability:E,selectedSizeId:T,mainImage:I,selectedFulfillmentType:P,selectedFulfillmentId:F,selectedFulfillment:D,drawer:{isOpen:![],contentConfig:null},error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(b){throw this.logger.error("Product data processing error",b),b}}}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 e=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(e)),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=buildFormattedAddressString(t),o={id:"",formattedAddress:n,address:t,coordinates:e};await this.setSelectedAddress(o)}catch(o){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country||""},error:(null==o?void 0:o.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:t,coordinates:e,error:(null==o?void 0:o.message)||"Failed to set manual address"}),o}}async clearSelectedAddress(){this.store.set("address",Y),this.pubSub.publishAction(n.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart(),await this.store.persist()}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}class ClientActionService{constructor(){this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:t=>this.command.product.productDataForEventFromStore(t)},this.addressActions={setAddressByPlacesId:async t=>{try{if(!t||""===t.trim())throw new Error("Invalid placesId provided");const e=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:e.address,coordinates:e.coords,formattedAddress:e.formattedAddress})}catch(e){throw this.logger.error("Error setting address by placesId:",e),e}},setAddressManually:async(t,e)=>{try{if(!t||!e)throw new Error("Invalid address or coordinates provided");if(!(t.one&&t.city&&t.state&&t.zip))throw new Error("Address must include street address, city, state, and zip code");if("number"!=typeof e.lat||"number"!=typeof e.long)throw new Error("Coordinates must be valid numbers");if(e.lat<-90||e.lat>90)throw new Error("Latitude must be between -90 and 90");if(e.long<-180||e.long>180)throw new Error("Longitude must be between -180 and 180");await this.command.address.setAddressManually(t,e)}catch(n){throw this.logger.error("Error setting manual address:",n),n}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(s.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(s.CART)},addProduct:async(t,e)=>{var o,c;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;const l=this.getLocation();if(void 0===l)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=e?e:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(s.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;e===!![]&&this.command.ui.openDrawer(s.CART);const h=[...new Set(t.map(t=>t.identifier))],p=await this.api.getProductsData(h,l);if(!p||!p.products||0===p.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const e of t){let t=null;for(let o=0;o<p.products.length;o++){const n=p.products[o];let s=![];for(let t=0;t<n.sizes.length;t++){const o=n.sizes[t];if(o.upc===e.identifier||o.id===e.identifier||n.salsifyGrouping===e.identifier){s=!![];break}}if(s){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=t.sizes[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(c=null===(o=null==n?void 0:n.attributes)||void 0===o?void 0:o.presale)||void 0===c?void 0:c.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+e.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let s=null;for(let o=0;o<n.variants.length;o++){const t=n.variants[o];let c=![];if(e.fulfillmentType===a.ON_DEMAND&&(c=!(!t.fulfillmentTypes||!t.fulfillmentTypes.onDemand||""===t.fulfillmentTypes.onDemand)),e.fulfillmentType===a.SHIPPING&&(c=!(!t.fulfillmentTypes||!t.fulfillmentTypes.shipping||""===t.fulfillmentTypes.shipping)),c){s=t;break}}if(!s){this.logger.warn("No supported variant found for product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const l=e.fulfillmentType===a.ON_DEMAND?s.fulfillmentTypes.onDemand:s.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:n.upc,fulfillmentId:l,partNumber:s.partNumber,quantity:e.quantity,identifier:e.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(n.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:h}),this.logger.info("Products added to cart successfully:",h)}catch(l){throw this.logger.error("Error adding products to cart:",l),this.clearPendingCartOperation(),this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:l.message||"Failed to add products to cart"}),l}},applyPromoCode:async t=>{try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const e=t.trim().toUpperCase(),o=this.themeProvider.getConfigs("global"),s=o.layout.allowPromoCodes;if(!s)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const a=this.store.get("cart.promoCode");if(a&&a.code===e)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(e);const c=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{applied:!![],discountAmount:c.amounts.discounts,newTotal:c.amounts.total}),this.logger.info("Promo code applied successfully")}catch(e){throw this.logger.error("Failed to apply promo code:",e),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),e}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),e=t.layout.allowPromoCodes;if(!e)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode(),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(n.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(s.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(s.CHECKOUT)},addProduct:async(t,e)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;e===!![]&&this.command.ui.openDrawer(s.CHECKOUT);const o=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:o}),this.logger.info("Products added to checkout successfully:",o)}catch(o){throw this.logger.error("Error adding products to checkout:",o),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:o.message||"Failed to add products to checkout"}),o}},addPresaleProduct:async t=>{var e,o;try{if(!t||"object"!=typeof t||!t.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;const c=this.getLocation();if(void 0===c)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(s.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const l=await this.api.getProductsData([t.identifier],c);if(!l||!l.products||0===l.products.length)return this.logger.warn("No product data found for the provided presale identifier"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No product found",isPresale:!![]}),void 0;const h=l.products[0],p=h.sizes[0];if(!p)return this.logger.warn("No sizes found for presale product: "+t.identifier),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No sizes found for product",isPresale:!![]}),void 0;if((null===(o=null===(e=null==p?void 0:p.attributes)||void 0===e?void 0:e.presale)||void 0===o?void 0:o.isActive)!==!![])return this.logger.warn("Product is not a presale item: "+t.identifier),this.store.set("checkout.error","Product is not available for presale"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0;let m=null;for(let e=0;e<p.variants.length;e++){const n=p.variants[e];let o=![];if(t.fulfillmentType===a.ON_DEMAND&&(o=!(!n.fulfillmentTypes||!n.fulfillmentTypes.onDemand||""===n.fulfillmentTypes.onDemand)),t.fulfillmentType===a.SHIPPING&&(o=!(!n.fulfillmentTypes||!n.fulfillmentTypes.shipping||""===n.fulfillmentTypes.shipping)),o){m=n;break}}if(!m)return this.logger.warn("No supported variant found for presale product: "+t.identifier+" with fulfillment type: "+t.fulfillmentType),this.store.set("checkout.error","Presale product has no availability"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0;const f=t.fulfillmentType===a.ON_DEMAND?m.fulfillmentTypes.onDemand:m.fulfillmentTypes.shipping;await this.command.cart.addPresaleItem({upc:p.upc,fulfillmentId:f,partNumber:m.partNumber,quantity:t.quantity,engravingLines:[],identifier:t.identifier}),this.command.ui.openDrawer(s.CHECKOUT),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:1,identifiers:[t.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+t.identifier)}catch(c){throw this.logger.error("Error adding presale product to checkout:",c),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:c.message||"Failed to add presale product to checkout",isPresale:!![]}),c}},applyPromoCode:async 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 o=t.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===o)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const l=this.store.get("checkout"),h=null==l?void 0:l.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{applied:!![],discountAmount:(null==h?void 0:h.discountAmount)||0,newTotal:(null===(e=null==l?void 0:l.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(o){throw this.logger.error("Failed to apply checkout promo code:",o),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),o}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),e=t.layout.allowPromoCodes;if(!e)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(),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Checkout promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove checkout promo code:",t),t}},applyGiftCard:async t=>{var e;try{const o=this.themeProvider.getConfigs("checkout"),s=o.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(t);const a=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{applied:!![],newTotal:(null===(e=null==a?void 0:a.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card applied successfully")}catch(o){throw this.logger.error("Failed to apply gift card:",o),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be applied"}),o}},removeGiftCard:async t=>{try{const e=this.themeProvider.getConfigs("checkout"),o=e.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),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{applied:![]}),this.logger.info("Gift card removed successfully")}catch(e){throw this.logger.error("Failed to remove gift card:",e),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be removed"}),e}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:(t,e)=>{this.command.checkout.toggleMarketingPreferences(t,e)},updateCustomerInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateCustomerInfo(e,n)},updateBillingInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateBillingInfo(e,n)},updateGiftInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateGiftInfo(e,n)},getDetails:()=>{var t,e,n;const o=this.store.get("checkout"),s=o.items||{},a={};for(const[c,l]of Object.entries(s))a[c]={liquidId:l.liquidId,variantId:l.variantId,cartItemId:c,retailerId:l.retailerId,fulfillmentId:l.fulfillmentId,salsifyGrouping:l.salsifyGrouping,name:l.name,catPath:l.catPath,volume:l.volume,uom:l.uom,proof:l.proof,abv:l.abv,containerType:l.containerType,container:l.container,size:l.size,pack:l.pack,packDesc:l.packDesc,mainImage:l.mainImage,brand:l.brand,partNumber:l.partNumber,upc:l.upc,sku:l.sku,price:l.price,unitPrice:l.unitPrice,quantity:l.quantity,unitTax:l.unitTax,bottleDeposits:l.bottleDeposits,attributes:l.attributes,retailerName:l.retailerName,expectationDetail:l.expectationDetail};return{cartId:o.cartId||"",acceptedAccountCreation:o.acceptedAccountCreation,hasAgeVerify:o.hasAgeVerify||![],hasSubstitutionPolicy:o.hasSubstitutionPolicy,isGift:o.isGift||![],billingSameAsShipping:o.billingSameAsShipping,marketingPreferences:{canEmail:(null===(t=o.marketingPreferences)||void 0===t?void 0:t.canEmail)||![],canSms:(null===(e=o.marketingPreferences)||void 0===e?void 0:e.canSms)||![]},hasPromoCode:!!(null===(n=o.promoCode)||void 0===n?void 0:n.code),hasGiftCards:Array.isArray(o.giftCards)&&o.giftCards.length>0,itemCount:Object.values(a||{}).reduce((t,e)=>t+(e.quantity||0),0),amounts:o.amounts,items:a}}},this.actions={product:this.productActions,address:this.addressActions,cart:this.cartActions,checkout:this.checkoutActions},this.store=StoreService.getInstance(),this.command=CommandService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get("ClientAction"),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}setupAddressUpdateListener(){const A=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+n.ADDRESS_UPDATED,A)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,e=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(t,e)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}function componentError({componentType:t,message:e}){const n=document.createElement("div");n.className=t;const o=n.attachShadow({mode:"closed"}),s=document.createElement("style");s.textContent='\n div {\n padding: 10px;\n background-color: #1d4ed81a;\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 </"+t+">";const l=document.createElement("p");return l.textContent=e,a.appendChild(s),a.appendChild(c),a.appendChild(l),o.appendChild(a),n}function productionComponentError({title:t,message:e,componentType:n}){const o=document.createElement("div");o.setAttribute("data-component-type",n);const s=o.attachShadow({mode:"closed"}),a=document.createElement("style");a.textContent="\n div {\n padding: 20px;\n background-color: #1d4ed81a;\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=t;const h=document.createElement("p");return h.textContent=e,c.appendChild(a),c.appendChild(l),c.appendChild(h),s.appendChild(c),o}class ComponentFactoryService{static get logger(){return ComponentFactoryService.t||(ComponentFactoryService.t=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.t}static get clientConfig(){return ComponentFactoryService.i||(ComponentFactoryService.i=ClientConfigService.getInstance()),ComponentFactoryService.i}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(t,e){ComponentFactoryService.getComponentRegistry().set(t,e)}static createElement(t){try{const e=ComponentFactoryService.getComponentRegistry().get(t.type);if(!e)throw new Error("Component type ["+t.type+"] is not registered");const n=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(n)||window.customElements.define(n,e);const o=document.createElement(n);if(o.initialize){const{type:e,useShadowDom:s,wrapInLceElement:a,...c}=t,l={type:e,tagName:n,useShadowDom:s&&a!==!![]};o.initialize({data:c,config:l})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(s.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(s.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const a=document.createElement(n);return a.initialize(t.type,o),a}return o}catch(e){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",e),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==e?void 0:e.message)||e})}}static componentError({componentType:t,message:e}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+e),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:e})}static getComponentTagName(t){const e={[s.DRAWER]:"drawer-lc",[s.INPUT]:"input-lc",[s.BIRTHDATE_INPUT]:"birthdate-input-lc",[s.ENGRAVING_FORM]:"engraving-form-lc",[s.ENGRAVING_VIEW]:"engraving-view-lc",[s.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[s.POWERED_BY]:"powered-by-lc",[s.LCE_ELEMENT]:"lce-element",[s.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[s.ALERT]:"alert-lc",[s.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[s.ADDRESS]:"address-lc",[s.ADDRESS_INPUT]:"address-input-lc",[s.ADDRESS_DISPLAY]:"address-display-lc",[s.PRODUCT]:"product-lc",[s.PRODUCT_OPTIONS]:"product-options-lc",[s.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[s.PRODUCT_INTERACTIONS]:"product-interactions-lc",[s.PRODUCT_DESCRIPTION]:"product-description-lc",[s.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[s.PRODUCT_RETAILERS]:"product-retailers-lc",[s.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[s.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[s.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[s.PRODUCT_PRICE]:"product-price-lc",[s.PRODUCT_DRAWER]:"product-drawer-lc",[s.PRODUCT_LOADING]:"product-loading-lc",[s.CART]:"cart-lc",[s.CART_RETAILER]:"cart-retailer-lc",[s.CART_ITEM]:"cart-item-lc",[s.CART_FOOTER]:"cart-footer-lc",[s.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[s.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[s.CART_PROMO_CODE]:"cart-promo-code-lc",[s.CART_HEADER]:"cart-header-lc",[s.CART_BODY]:"cart-body-lc",[s.CART_FULFILLMENT]:"cart-fulfillment-lc",[s.CHECKOUT]:"checkout-lc",[s.CHECKOUT_INFORMATION_SECTION]:"checkout-information-section-lc",[s.CHECKOUT_PAYMENT_FORM]:"checkout-payment-form-lc",[s.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[s.CHECKOUT_BILLING_FORM]:"checkout-billing-form-lc",[s.CHECKOUT_SUMMARY_SECTION]:"checkout-summary-section-lc",[s.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[s.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[s.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[s.CHECKOUT_ITEMS]:"checkout-items-lc",[s.CHECKOUT_COMPLETED]:"checkout-completed-lc",[s.CHECKOUT_DELIVERY_INFORMATION_FORM]:"checkout-delivery-information-form-lc",[s.CHECKOUT_BUYER_INFORMATION_FORM]:"checkout-buyer-information-form-lc",[s.CHECKOUT_TIPS]:"checkout-tips-lc",[s.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[s.CHECKOUT_ITEM]:"checkout-item-lc",[s.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[s.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[s.CHECKOUT_HEADER]:"checkout-header-lc",[s.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[s.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc"};return e[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;const ht="\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 gap: 2px;\n flex: 1;\n margin: 0 12px;\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 gap: 12px;\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 .toggle {\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\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 gap: 8px;\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: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 gap: 2px;\n min-width: 50px;\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 gap: 8px;\n flex-wrap: wrap;\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 gap: 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 gap: 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",pt="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,e=t.instances;if(e)for(const[o,s]of e)this.interceptLoggerInstance(s,o);const n=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const e=n(t);return this.interceptLoggerInstance(e,t),e}}interceptLoggerInstance(t,e){if(t.o)return;const n=t.debug.bind(t),o=t.info.bind(t),s=t.warn.bind(t),a=t.error.bind(t),X=(t,n,o)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:n,data:o,context:e});t.debug=(t,e)=>{n(t,e),this.addLogEntry(X("debug",t,e))},t.info=(t,e)=>{o(t,e),this.addLogEntry(X("info",t,e))},t.warn=(t,e)=>{s(t,e),this.addLogEntry(X("warn",t,e))},t.error=(t,e)=>{a(t,e),this.addLogEntry(X("error",t,e))},t.o=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),e=t.publishAction.bind(t);t.publishAction=(t,n)=>{e(t,n),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:n,context:"PubSub"})};const n=t.publishForm.bind(t);t.publishForm=(t,e)=>{n(t,e),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:e,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),e=t.executeEvent.bind(t);t.executeEvent=(t,n,o)=>{e(t,n,o),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+n,data:o,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 e=this.createLogElement(t);this.logContainer.appendChild(e)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(pt);t&&t.remove(),this.panelElement=document.createElement(pt);const e=window.innerWidth<=768,n=window.innerWidth<=480;n?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):e?(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"}),e=document.createElement("style");e.textContent=ht,t.appendChild(e),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const n=this.createHeader();this.panelContainer.appendChild(n);const o=this.createToggles();this.panelContainer.appendChild(o),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),t.appendChild(this.panelContainer),this.setupShadowEventListeners(t)}createHeader(){const t=document.createElement("div");t.className="header",t.title="Drag to move panel";const e=document.createElement("div");e.className="icon",e.innerHTML="🔍",e.title="Elements Debug Console",e.style.cursor="help";const n=document.createElement("div");n.className="title-container";const o=document.createElement("div");o.className="title",o.textContent="Elements Debug Console";const s=document.createElement("div");s.className="subtitle",s.textContent="Live SDK logs, events & GTM tracking",n.appendChild(o),n.appendChild(s);const a=document.createElement("button");return a.className="minimize",a.innerHTML="−",a.title="Minimize debug panel",a.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(e),t.appendChild(n),t.appendChild(a),t}createToggles(){const t=document.createElement("div");t.className="toggles";const e=[{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"}];e.forEach(({key:e,label:n,description:o,color:s})=>{const a=document.createElement("label");a.className="toggle",a.title=o;const c=document.createElement("input");c.type="checkbox",c.checked="showLogs"!==e,c.addEventListener("change",t=>{const n=t.target;"showEvents"===e&&(this.showEvents=n.checked),"showGtmEvents"===e&&(this.showGtmEvents=n.checked),"showLogs"===e&&(this.showLogs=n.checked),this.renderLogs()});const l=document.createElement("span");l.textContent=n,l.style.color=s,a.appendChild(c),a.appendChild(l),t.appendChild(a)});const n=document.createElement("button");return n.className="clear-btn",n.innerHTML="🗑️",n.title="Clear all logs",n.addEventListener("click",()=>this.clearLogs()),t.appendChild(n),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let e=![],n=0,o=0,s=0,a=0;t.addEventListener("mousedown",t=>{e=!![],n=t.clientX,o=t.clientY,s=Number.parseInt(this.panelElement.style.width,10)||500,a=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",K),document.addEventListener("mouseup",r),t.preventDefault()});const K=t=>{if(!e||!this.panelElement)return;const c=t.clientX-n,l=t.clientY-o,h=window.innerWidth<=768,p=window.innerWidth<=480;let m,f,v,b;p?(m=280,f=window.innerWidth-20,v=200,b=.4*window.innerHeight):h?(m=300,f=window.innerWidth-30,v=200,b=.4*window.innerHeight):(m=300,f=800,v=200,b=600);const x=Math.max(m,Math.min(f,s+c)),w=Math.max(v,Math.min(b,a+l));this.panelElement.style.width=x+"px",this.panelElement.style.height=w+"px"},r=()=>{e=![],document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",r)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const e=t.querySelector(".header");if(e){let t=![],n=0,o=0,s=0,a=0;e.addEventListener("mousedown",e=>{if(e.target.classList.contains("minimize"))return;t=!![],n=e.clientX,o=e.clientY;const c=this.panelElement.getBoundingClientRect();s=c.left,a=c.top,document.addEventListener("mousemove",K),document.addEventListener("mouseup",r),e.preventDefault()});const K=e=>{if(!t||!this.panelElement)return;const c=e.clientX-n,l=e.clientY-o;this.panelElement.style.left=s+c+"px",this.panelElement.style.top=a+l+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},r=()=>{t=![],document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",r)}}}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 e=document.createElement("div");e.className="log-entry "+t.type+" "+t.level;const n=new Date(t.timestamp).toLocaleTimeString();return e.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+n+'</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 ",e}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(e){return String(t)}}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}}class FingerPrintService{constructor(){this.keyPrefix=q,this.isLocalStorageAvailable=null,this.cachedFingerprint=null}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.l()){const e=this.u(t);if(e)return this.h(t,e)}this.cachedFingerprint||(this.cachedFingerprint=this.m());const e=this.h(t,this.cachedFingerprint);if(this.l())try{const t=this.keyPrefix+"_"+e;localStorage.setItem(t,Date.now().toString())}catch(n){}return e}getFingerprintData(){return{screen:this.v(),browser:this.C(),timezone:this.k()}}isLocalStorageWebApiAvailable(){return this.l()}h(t,e){return(t+"_"+e).toLowerCase()}l(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{if(0,!("localStorage"in window))return this.isLocalStorageAvailable=![],![];if(void 0===window.localStorage||null===window.localStorage)return this.isLocalStorageAvailable=![],![];if("object"!=="object".localStorage)return this.isLocalStorageAvailable=![],![];const e=["setItem","getItem","removeItem","clear"];for(const t of e)if("function"!=="object".localStorage[t])return this.isLocalStorageAvailable=![],![];const n="__localStorage_test_"+Date.now()+"__",o="test";window.localStorage.setItem(n,o);const s=window.localStorage.getItem(n);if(s!==o)return this.isLocalStorageAvailable=![],![];window.localStorage.removeItem(n);try{const t="__quota_test__",e="x".repeat(100);window.localStorage.setItem(t,e),window.localStorage.removeItem(t)}catch(t){this.S()&&console.warn("localStorage has quota limitations in webview environment")}return this.isLocalStorageAvailable=!![],!![]}catch(e){if(this.isLocalStorageAvailable=![],e instanceof DOMException){const t={QuotaExceededError:"Storage quota exceeded",SecurityError:"Access denied due to security policies",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage"},n=t[e.name]||"Storage error: "+e.name,o=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+o+": "+n)}return![]}}u(t){try{const e=this.keyPrefix+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(null==n?void 0:n.startsWith(e)){const t=n.substring(e.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(e){return null}}m(){const t=this.getFingerprintData(),e=Object.keys(t).sort().map(e=>e+":"+t[e]).join("|");return this.T(e)}v(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,o=this.I(),s=Math.round(100*(window.devicePixelRatio||1));return e+"|"+n+"|"+o+"|"+s}catch(t){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(B){}return"srgb"}C(){var t;try{const e=navigator,n=[],o=((null===(t=e.languages)||void 0===t?void 0:t[0])||e.language||"en").substring(0,2);n.push(o),n.push(e.hardwareConcurrency||4);const s=(e.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);n.push(s),n.push(e.cookieEnabled?"1":"0"),n.push(e.maxTouchPoints||0),n.push(e.deviceMemory||0),n.push(this.P()),n.push(this.S()?"webview":"browser");const a=["bluetooth"in e?"1":"0","usb"in e?"1":"0","mediaDevices"in e?"1":"0","permissions"in e?"1":"0","credentials"in e?"1":"0","storage"in e?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return n.push(a.join("")),n.join("|")}catch(e){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}P(){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(),e=navigator,n=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return n.some(e=>t.includes(e))?!![]:void 0===e.standalone||e.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}k(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}T(t){const e=16777619;let n=2166136261,o=2166136261,s=2166136261,a=2166136261;for(let c=0;c<t.length;c++){const l=t.charCodeAt(c);n^=l,n=Math.imul(n,e),o^=l<<1,o=Math.imul(o,e),s^=l<<2,s=Math.imul(s,e),a^=l<<3,a=Math.imul(a,e)}return n=Math.abs(n),o=Math.abs(o),s=Math.abs(s),a=Math.abs(a),n.toString(16)+o.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();const t=this.clientConfig.get("env"),n=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!![],endpoint:n,batchSize:t===e.PRODUCTION?5:10,batchInterval:t===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(t,e,n={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const o=Date.now(),s="event_"+o+"_"+Math.random().toString(36).slice(2,11);try{const a={eventId:s,timestamp:o,level:t,message:e,context:n.context,error:n.error?this.buildErrorContext(n.error):void 0,component:n.component,data:n.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(a)}catch(a){this.handleInternalError(a)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code,statusCode:t.status||t.statusCode}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![]}}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 e=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const n=this.createBatch(e);try{this.sendBatch(n),this.stats.batchesSent++}catch(o){this.stats.failedBatches++,this.handleInternalError(o),this.eventQueue.unshift(...e),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const e=Date.now(),n="batch_"+e+"_"+Math.random().toString(36).slice(2,9);return{batchId:n,timestamp:e,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const e=new Blob([JSON.stringify(t)],{type:"text/plain"}),n=navigator.sendBeacon(this.config.endpoint,e);if(n)return}catch(e){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const e=new XMLHttpRequest;if(e.open("POST",this.config.endpoint,![]),e.setRequestHeader("Content-Type","text/plain"),e.send(JSON.stringify(t)),e.status<200||e.status>=300)throw new Error("XHR request failed with status: "+e.status)}catch(e){throw new Error("Both sendBeacon and XHR failed: "+e.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(e){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:e}){var n;this.F=Object.freeze(t),this.D=Object.freeze({type:e.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(n=null==e?void 0:e.useShadowDom)&&void 0!==n?n:![]}),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 e=/\{([^}]+)}/g;return t.replace(e,(e,n)=>{const o=this.F[n];return null==o?(this.logger.warn('Parameter "'+n+'" not found in component params for path "'+t+'"'),e):String(o)})}connectedCallback(){var t,e;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.D.useShadowDom?this.attachShadow({mode:this.clientConfig.isDevelopment()?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component connectedCallback error in "+((null===(e=this.D)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"connectedCallback")}}disconnectedCallback(){var t,e;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component disconnectedCallback error in "+((null===(e=this.D)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"disconnectedCallback")}}setup(){var t,e,n;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(e=this.beforeConnected)||void 0===e||e.call(this)}catch(o){this.logger.error("Component setup error in "+((null===(n=this.D)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const e of this.unsubscribers)try{e()}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 e=this.reactiveOptions.autoDestroyPath;if(!e&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(e=this.reactiveOptions.watchStorePaths[0]),!e)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const n=this.interpolatePath(e),o=this.store.watch(n,(t,e)=>{this.isDestroyed||void 0===t&&void 0!==e&&this.handleAutoDestroy(n)});this.unsubscribers.push(o),this.logger.debug("🔥 AutoDestroy enabled for "+this.D.tagName+" watching path: "+n)}handleAutoDestroy(t){var e;if(this.isDestroyed)return;this.logger.debug("🔥 AutoDestroy triggered for "+this.D.tagName+' - path "'+t+'" was removed'),null===(e=this.beforeAutoDestroy)||void 0===e||e.call(this,t);const n=this.reactiveOptions.autoDestroyDelay||0;n>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},n):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(e){this.logger.error("Error during auto-destroy of "+this.D.tagName,e),e instanceof Error&&this.captureComponentError(e,"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 e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;const n=t.map(t=>t.path).join(", "),o="store:["+n+"]",s=null===(e=this.onStoreChanged)||void 0===e?void 0:e.call(this,t);s!==![]&&this.triggerRender(o)}catch(o){this.logger.error("Store watcher callback error in "+((null===(n=this.D)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"storeWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Store watchers setup error in "+((null===(t=this.D)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"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 e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;null===(e=this.onStoreWatch)||void 0===e?void 0:e.call(this,t)}catch(o){this.logger.error("Non-rendering watcher callback error in "+((null===(n=this.D)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"nonRenderingWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.D)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"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,e;if(!this.initialized||this.isDestroyed)return;const n=performance.now();this.renderCount++;try{const e=this.template();"string"==typeof e&&(this.container.innerHTML=e),e instanceof HTMLElement&&safeReplaceChildren(this.container,e),Array.isArray(e)&&safeReplaceChildren(this.container,...e);const s=performance.now()-n;this.logRenderInfo(s);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(o){this.logger.error("❌ afterRender hook error in "+this.D.tagName,o),o instanceof Error&&this.captureComponentError(o,"afterRender")}}catch(s){const t=performance.now()-n;this.logger.error("❌ Component render error in "+this.D.tagName,s),this.captureComponentError(s,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.D.type,message:s instanceof Error?s.message:String(s)}));try{null===(e=this.onError)||void 0===e?void 0:e.call(this,s,"render")}catch(a){this.logger.error("❌ onError hook error in "+this.D.tagName,a)}}}logRenderInfo(t){const e=this.D.type,n=this.D.tagName,o=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+o+" "+e+" </"+n+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&(this.logger.warn("⚠️ Slow render in "+e+"("+n+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:t,threshold:16,componentType:e,tagName:n,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+n+":performance",component:{type:e,tagName:n,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.D.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,e,n){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.D.tagName+":"+e,component:{type:this.D.type,tagName:this.D.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this.D.useShadowDom}})}catch(o){}}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}}addHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}removeHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.remove(...e)}toggleHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const n of e)this.classList.toggle(n)}addHostAttribute(t,e){t&&"string"==typeof t&&e&&"string"==typeof e&&(this.setAttribute(t,String(e)),this.hostAttributes[t]=String(e))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[e,n]of Object.entries(t))e&&"string"==typeof e&&n&&"string"==typeof n&&this.setAttribute(e,String(n))}get params(){return this.F}get config(){return this.themeProvider.getComponentConfig(this.D.type)}get elementConfig(){return this.D}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,e){return this.store.set(t,e)}watchStore(t,e){const n=this.store.watch(t,e);return this.unsubscribers.push(n),n}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const e=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:s.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,o;const a=this.getStoreValue("address"),c=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],l=null!==(e=this.params.productId)&&void 0!==e?e:"",h=null!==(n=this.params.options)&&void 0!==n?n:{},p=null!==(o=h.showLabel)&&void 0!==o?o:!![],m=[];if(p){const t=document.createElement("span");t.textContent="Delivers to:",m.push(t)}const f=document.createElement("button");f.type="button",f.textContent=a.formattedAddress||"Select an address";const v=a.formattedAddress?"Change delivery address, currently set to "+a.formattedAddress:"Select delivery address";return f.setAttribute("aria-label",v),f.addEventListener("click",async()=>{if(c)return this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:l,isIndependentComponent:!![]}),void 0;!c&&l&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:l}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(l,s.ADDRESS_INPUT,{productId:l}))}),m.push(f),m}}const ArrowRightIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="arrow-right-icon '+n+'" 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 '},BagIcon=({width:t=24,height:e=24,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 489 489" class="bag-icon '+n+'" style="'+s+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckboxIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="checkbox-icon '+n+'" 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:t=16,height:e=16,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" 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:t=16,height:e=16,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="chevron-left-icon '+n+'" 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:t=16,height:e=16,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="close-icon '+n+'" 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:t=16,height:e=16,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="error-info-icon '+n+'" 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:t=16,height:e=16,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="info-icon '+n+'" 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 '},SearchIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const s=o||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="search-icon '+n+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+s+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:e=16,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="success-icon '+n+'" 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:t=16,height:e=16,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="trash-icon '+n+'" 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:t=16,height:e=16,className:n="",color:o=null})=>{const s=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="warning-icon '+n+'" 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 AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const e=t.target,n=e.value.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const o=/^\d/.test(n);if(n.length<this.minSearchLength||!o)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(n)},300)},this.closeDrawer=async()=>{const t=this.params.productId,e=this.clientConfig.isMobile(),n=this.isIndependentComponent();(e||n)&&this.commands.ui.closeDrawer(),!e&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(B){this.logger.error("Address edit cancellation failed",B)}},this.handleCheckAvailability=async()=>{if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const t=this.getStoreValue("address"),e=(null==t?void 0:t.coordinates.lat)!==this.selectedAddress.coordinates.lat||(null==t?void 0:t.coordinates.long)!==this.selectedAddress.coordinates.long;e&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(t){this.logger.error("Address selection and availability check failed",t),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async t=>{const e=t.currentTarget.dataset.suggestionId;if(e)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(e);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:e,address:t.address,coordinates:t.coords,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(n){this.logger.error("Address details retrieval failed",n),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=t=>{this.container.contains(t.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const t=this.getStoreValue("address");(null==t?void 0:t.formattedAddress)&&(this.selectedAddress=t)}async searchAddresses(t){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const e=await this.commands.address.searchAddresses(t);this.suggestions=e.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(e){this.logger.error("Address search operation failed",e),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const t=this.errorContainer.querySelector(".error-text");t&&(t.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const t=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(t),void 0}for(const t of this.suggestions){const e=this.createElement("li",{className:"suggestion-item"}),n=this.createElement("span",{textContent:t.description});e.appendChild(n),e.setAttribute("data-suggestion-id",t.id),e.setAttribute("role","option"),e.setAttribute("aria-label","Select address: "+t.description),e.setAttribute("tabindex","0"),e.addEventListener("click",this.handleSuggestionClick),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())}),this.suggestionsContainer.appendChild(e)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,e){const n=document.createElement(t);return e&&Object.assign(n,e),n}createErrorContainer(){const t=this.createElement("div",{className:"error-message"});t.style.display="none",t.setAttribute("role","alert"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true");const e=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),n=this.createElement("span",{className:"error-text"});return t.appendChild(e),t.appendChild(n),t}createCheckButton(){const t=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return t.setAttribute("aria-label","Save and check address availability"),t.addEventListener("click",this.handleCheckAvailability),t}createCancelButton(){const t=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return t.setAttribute("aria-label","Cancel address selection"),t.addEventListener("click",this.handleCancel),t}template(){var t,e,n;const o=this.getConfigs("global"),s=null!==(t=this.params.options)&&void 0!==t?t:{},a=null!==(e=s.showLabel)&&void 0!==e?e:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),a){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const c=this.createElement("div",{className:"input-wrapper "+o.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(n=this.selectedAddress)||void 0===n?void 0:n.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),c.appendChild(this.inputElement);const l=this.createElement("span");l.className="input-icon",l.innerHTML=SearchIcon({width:16,height:16,className:""}),c.appendChild(l),this.inputContainer.appendChild(c),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const h=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),p=[this.inputContainer,h,this.errorContainer],m=this.createElement("div",{className:"action-buttons"}),f=this.createCancelButton();m.appendChild(f);const v=this.createCheckButton();return m.appendChild(v),p.push(m),document.addEventListener("click",this.handleDocumentClick),p}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const t=[],e=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!e){const e=ComponentFactoryService.createElement({type:s.CART_HEADER});t.push(e)}const n=ComponentFactoryService.createElement({type:s.CART_BODY});t.push(n);const o=ComponentFactoryService.createElement({type:s.CART_FOOTER});return t.push(o),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=document.createElement("div");t.className="empty-cart-container";const e=document.createElement("h3");return e.className="empty-cart-content",e.textContent="Your cart is empty",t.appendChild(e),t}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" 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 </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:s.CART_RETAILER,retailerId:t.id})}catch(e){return this.logger.error("Cart retailer component creation failed",e),document.createElement("div")}}getRetailerElementById(t){return this.container.querySelector('[data-retailer-id="'+t+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const t=this.createEmptyCartElement();this.container.appendChild(t),this.setupEmptyCartListeners()}addLoadingOverlay(){const t=this.getLoadingElement();if(!t){const t=this.createLoadingElement();this.container.appendChild(t)}}removeLoadingOverlay(){const t=this.getLoadingElement();t&&t.remove()}setupEmptyCartListeners(){const t=this.container.querySelector('[data-action="continue-shopping"]');t&&t.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(t,e){const n=this.createRetailerElement(e);n.setAttribute("data-retailer-id",t),this.container.appendChild(n)}removeRetailerElement(t){const e=this.getRetailerElementById(t);e&&e.remove()}updateRetailerElement(t,e){const n=this.getRetailerElementById(t);if(n){const o=this.createRetailerElement(e);o.setAttribute("data-retailer-id",t),n.replaceWith(o)}}hasRetailerDataChanged(t,e){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const e={};for(const[n,o]of Object.entries(t))o&&"object"==typeof o&&o.id&&(e[n]=o);return e}getValidRetailerIds(t){const e=this.getValidRetailers(t);return new Set(Object.keys(e))}onStoreChanged(t){const e=t.find(t=>"cart.retailers"===t.path),n=t.find(t=>"cart.loading"===t.path);if(e){const t=this.getValidRetailers(e.oldValue),n=this.getValidRetailers(e.value),o=this.getValidRetailerIds(e.oldValue),s=this.getValidRetailerIds(e.value),a=o.size,c=s.size,l=this.getValidRetailers(this.getStoreValue("cart.retailers")),h=Object.keys(l).length;if(c>0&&0===h)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===a&&c>0){this.container.innerHTML="";for(const[t,e]of Object.entries(n))this.addRetailerElement(t,e)}else if(a>0&&0===c)this.showEmptyCartState();else if(c>0){for(const t of o)s.has(t)||this.removeRetailerElement(t);for(const e of s){const s=n[e],a=t[e];o.has(e)?this.hasRetailerDataChanged(a,s)&&this.updateRetailerElement(e,s):this.addRetailerElement(e,s)}}else 0===a&&0===c&&this.showEmptyCartState()}if(n){const t=n.value,e=n.oldValue;t!==e&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return n||e,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},e=Object.values(t);if(0===e.length)return this.createEmptyCartElement();const n=[];for(const o of e){const t=this.createRetailerElement(o);t.setAttribute("data-retailer-id",o.id),n.push(t)}return n}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const e=t.some(t=>t.path.includes("cart.items")),n=t.some(t=>t.path.includes("cart.totals")),o=t.some(t=>t.path.includes("cart.fulfillments")),s=t.some(t=>"cart.loading"===t.path),a=t.some(t=>t.path.includes("cart.retailers"));if(e&&this.updateSubtotalItemsCount(),n&&this.subtotalPrice){const t=this.getStoreValue("cart.totals");this.subtotalPrice.textContent=""+formatCentToDollarText(t.subtotal+t.engravingFee-t.discounts)}(o||n||s||e||a)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const e=this.getStoreValue("cart.items")||{},n=Object.values(e).some(t=>t.updating);if(n)return!![];const o=this.getStoreValue("cart.fulfillments")||{},s=Object.values(o).some(t=>t.updating);if(s)return!![];const a=this.getStoreValue("cart.retailers")||{},c=Object.values(a).some(t=>t.updating);return c?!![]:![]}hasUnmetMinimum(t){var e;const n=t.subtotal;if(t.type===a.SHIPPING){const o=t.fees;if((null===(e=o.individual)||void 0===e?void 0:e.active)&&o.individual.min>0&&n<o.individual.min)return!![]}if(t.type===a.ON_DEMAND){const e=t.fees;if(e.min>0&&n<e.min)return!![]}return![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments")||{};return Object.values(t).some(t=>this.hasUnmetMinimum(t))}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},e=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),n=this.shouldDisableCheckout(),o=t||n||!e;this.checkoutButton.disabled=o,this.checkoutButton.classList.toggle("checkout-btn-disabled",o),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),e=Object.values(t).reduce((t,e)=>t+e.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+e+" item"+(1!==e?"s":"")+"):")}async handleCheckout(t){return this.clientConfig.isBuilder()?(t.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(t.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const t=this.getConfigs("global"),e=this.getStoreValue("cart.totals"),n=[],o=document.createElement("div");o.className="cart-footer-header";const a=document.createElement("div");a.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",a.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(e.subtotal+e.engravingFee-e.discounts),a.appendChild(this.subtotalPrice);const c=document.createElement("p");if(c.textContent="Taxes & fees will be calculated at checkout",c.className="taxes-fees-info",o.appendChild(a),o.appendChild(c),n.push(o),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:s.CART_PROMO_CODE});n.push(t)}const l=ComponentFactoryService.createElement({type:s.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(n.push(l),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleCheckout(t)}),this.checkoutButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleCheckout(t))}),n.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"general"});n.push(t)}return n}}const shouldShowMinimumPurchaseAlert=(t,e=![])=>{var n,o;const s=t.subtotal;if(t.type===a.SHIPPING){const a=t.fees;if(e&&(null===(n=a.pack)||void 0===n?void 0:n.active)&&a.pack.min>0&&s<a.pack.min)return!![];if(!e&&(null===(o=a.individual)||void 0===o?void 0:o.active)&&a.individual.min>0&&s<a.individual.min)return!![]}else if(t.type===a.ON_DEMAND){const e=t.fees;if(e.min>0&&s<e.min)return!![]}return![]},getMinimumPurchaseMessage=(t,e=![])=>{var n,o;const s=t.subtotal;if(t.type===a.SHIPPING){const a=t.fees;let c=0;if(e&&(null===(n=a.pack)||void 0===n?void 0:n.active)&&a.pack.min>0?c=a.pack.min:(null===(o=a.individual)||void 0===o?void 0:o.active)&&a.individual.min>0&&(c=a.individual.min),c>0&&s<c)return{message:"+"+formatCentToDollarText(c-s)+" needed for order minimum",type:"warning"}}if(t.type===a.ON_DEMAND){const e=t.fees,n=e.min>0?e.min:0;if(n>0&&s<n)return{message:"+"+formatCentToDollarText(n-s)+" needed for order minimum",type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(t,e=![])=>{var n,o;const s=t.subtotal;if(t.type===a.SHIPPING){const a=t.fees;if(e&&(null===(n=a.pack)||void 0===n?void 0:n.active)&&a.pack.min>0&&s<a.pack.min)return!![];if(!e&&(null===(o=a.individual)||void 0===o?void 0:o.active)&&a.individual.min>0&&s<a.individual.min)return!![]}if(t.type===a.ON_DEMAND){const e=t.fees;if(e.min>0&&s<e.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const e={warning:"warning",success:"success",info:"info"},n={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},o=e[this.params.messageType]||"warning",s=document.createElement("div");return s.className="alert-icon alert-icon-"+this.params.messageType,s.appendChild(htmlStringToElement(n[o]({width:16,height:16,className:"alert-icon-svg"}))),s}template(){var t;const e=[],n=this.getIconElement();n&&e.push(n);const o=document.createElement("span");if(o.className="alert-message",o.textContent=this.params.message,e.push(o),"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 n=document.createElement("small");n.className="alert-details-text",n.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(n),e.push(t)}return e}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}getProductStore(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".items")||{};return Object.values(e).find(e=>e.fulfillmentId===t)}handleItemsUpdate(t,e){const n=new Set(t||[]),o=new Set(e||[]);for(const s of n)if(!o.has(s)){const t=this.container.querySelector('[data-item-id="'+s+'"]');t&&t.remove()}for(const a of o)if(!n.has(a)){const t=ComponentFactoryService.createElement({type:s.CART_ITEM,itemId:a});t.setAttribute("data-item-id",a),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".items")||[],n=this.container.querySelectorAll("[data-item-id]");for(const o of n)o.remove();for(const o of e){const t=ComponentFactoryService.createElement({type:s.CART_ITEM,itemId:o});t.setAttribute("data-item-id",o),this.container.appendChild(t)}}setupMinimumPurchaseAlert(){var t;const e=this.getFulfillmentId(),n=(null===(t=this.getProductStore())||void 0===t?void 0:t.pack)||![],o=this.getStoreValue("cart.fulfillments."+e),a=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(a&&a.remove(),shouldShowMinimumPurchaseAlert(o,n)){const t=getMinimumPurchaseMessage(o,n),e=ComponentFactoryService.createElement({type:s.PURCHASE_MIN_ALERT,message:t.message,messageType:t.type,currentTotal:o.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(e)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.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 ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-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="fulfillment-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var t;const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e);return(null===(t=null==n?void 0:n.items)||void 0===t?void 0:t.length)?n.items.some(t=>{const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.updating)===!![]}):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}onStoreChanged(t){const e=this.getFulfillmentId(),n="cart.fulfillments."+e,o=t.find(t=>t.path===n),s=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(s.length>0&&this.checkAndUpdateLoadingState(),o){const t=o.oldValue,e=o.value,n=(null==t?void 0:t.items)||[],s=(null==e?void 0:e.items)||[],a=JSON.stringify(n)!==JSON.stringify(s);a&&(this.handleItemsUpdate(n,s),this.checkAndUpdateLoadingState());const c=this.hasFulfillmentFeesChanged(t,e),l=this.hasFulfillmentDataChanged(t,e,["items","updating"]);if(c&&!l&&this.setupMinimumPurchaseAlert(),!l)return![]}return![]}hasFulfillmentFeesChanged(t,e){return t?t.subtotal!==e.subtotal||t.shippingFee!==e.shippingFee||t.deliveryFee!==e.deliveryFee||JSON.stringify(t.fees)!==JSON.stringify(e.fees):!![]}hasFulfillmentDataChanged(t,e,n=[]){if(!t)return!![];const o=["type","canEngrave","retailerId"];for(const s of o)if(!n.includes(s)&&t[s]!==e[s])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const mt={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"},ft="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=mt[e];return n||ft}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return ft}}function getCurrentTimeInTimezone$1(t){try{const e=new Date,n=e.getTime(),o=6e4*e.getTimezoneOffset(),s=new Date(n+o),a=new Date(s.toLocaleString("en-US",{timeZone:t})),c=s.getTime()-a.getTime();return new Date(n+c)}catch(e){return new Date}}function getCurrentTimeInUserTimezone(t){const e=detectUserTimezone(t);return getCurrentTimeInTimezone$1(e)}function isDateTimeInRange(t){const{startDate:e,endDate:n,addressState:o}=t;try{const t=getCurrentTimeInUserTimezone(o),s=!e||t>=new Date(e),a=!n||t<=new Date(n);return s&&a}catch(s){return![]}}function filterActiveItems(t,e){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:e}))}function hasActiveItems(t,e){return filterActiveItems(t,e).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,e,n;const o=this.config.layout.drawerHeaderText,a=this.getConfigs("global"),c=document.createElement("div");c.className="cart-header-content";const l=document.createElement("h2");l.className="cart-title",l.textContent=o,c.appendChild(l);const h=document.createElement("button");h.type="button",h.className="cart-header-close-btn",h.innerHTML=CloseIcon({width:16,height:16}),h.setAttribute("aria-label","Close cart drawer"),h.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),c.appendChild(h);const p=this.clientConfig.get("promoTicker"),m=null!==(e=null===(t=null==a?void 0:a.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],f=null!=p?p:m,v=this.store.get("address"),b=hasActiveItems(f,null===(n=null==v?void 0:v.address)||void 0===n?void 0:n.state);if(!f.length||!b)return[c];const x=ComponentFactoryService.createElement({context:"cart",type:s.PROMO_CODE_TICKER,tickers:f});return[c,x]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.params.itemId}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}handleOpenEngravingForm(t,e){var n,o,a,c,l,h,p,m,f,v;this.commands.ui.openDrawer(s.ENGRAVING_FORM,{identifier:t,context:"cart",lines:(null===(o=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.lines)||[],maxLines:(null===(c=null===(a=e.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.maxLines)||1,maxCharsPerLine:(null===(h=null===(l=e.attributes)||void 0===l?void 0:l.engraving)||void 0===h?void 0:h.maxCharsPerLine)||16,fee:(null===(m=null===(p=e.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.fee)||0,location:null===(v=null===(f=e.attributes)||void 0===f?void 0:f.engraving)||void 0===v?void 0:v.location})}template(){var t,e,n,o,a,c,l,h,p;const m=this.params.itemId,f=this.getStoreValue("cart.items."+m),v=this.getConfigs("global"),b=this.getStoreValue("cart.fulfillments."+f.fulfillmentId),x=f.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(t=null==b?void 0:b.expectation)||void 0===t?void 0:t.detail)||"",w=document.createElement("article");w.className="cart-item";const C=document.createElement("div");C.className="item-image";const k=document.createElement("img");k.src=f.mainImage,k.alt=f.name,C.appendChild(k);const S=document.createElement("div");S.className="item-details";const E=document.createElement("div");E.className="item-header";const T=document.createElement("h3");T.className="item-title",T.textContent=f.name;const I=document.createElement("button");I.className="item-delete",I.innerHTML=TrashIcon({}),I.setAttribute("role","button"),I.setAttribute("tabindex","0"),I.setAttribute("aria-label","Remove "+f.name+" from cart"),I.setAttribute("aria-expanded","true"),I.addEventListener("click",async()=>{await this.commands.cart.removeItem(m)}),I.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(m))}),E.appendChild(T),E.appendChild(I);const P=document.createElement("div");P.className="item-specs",P.textContent=f.size+", "+f.container;const F=document.createElement("div");F.className="item-shipping-container";const D=document.createElement("div");if(D.className="item-shipping",D.textContent=x,F.appendChild(D),v.layout.enablePersonalization&&(null===(n=null===(e=null==f?void 0:f.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.isEngravable)&&(null===(a=null===(o=null==f?void 0:f.attributes)||void 0===o?void 0:o.engraving)||void 0===a?void 0:a.hasEngraving)===![]&&b.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=v.layout.personalizationText+" +"+formatCentToDollarText((null===(l=null===(c=f.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.fee)||0,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+f.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(m,f)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(m,f))}),F.appendChild(t)}S.appendChild(E),S.appendChild(P),S.appendChild(F),w.appendChild(C),w.appendChild(S);const _=[w],O=ComponentFactoryService.createElement({type:s.CART_ITEM_QUANTITY_PRICE,itemId:m});if((null===(p=null===(h=null==f?void 0:f.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:m,context:"cart"});_.push(t)}return _.push(O),_}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const e=t.find(t=>"cart.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,e=this.getStoreValue("cart.items."+t);return e||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const e=t.quantity,n=this.getAvailableQuantity(),o=n>0;return{currentQuantity:e,availableQuantity:n,canIncrease:o,canDecrease:!![]}}getAvailableQuantity(){var t,e,n,o;const s=this.getItemStore();if(!s)return 0;const a=s.partNumber,c=s.fulfillmentId,l=this.getStoreValue("cart.items")||{},h=Object.values(l).filter(t=>t.partNumber===a&&t.fulfillmentId===c),p=h.reduce((t,e)=>t+e.quantity,0),m=this.getStoreValue("products."+s.upc)||this.getStoreValue("products."+s.salsifyGrouping);if(!m)return s.maxQuantity-p;const f=null!==(o=null===(n=null===(e=null===(t=null==m?void 0:m.sizes)||void 0===t?void 0:t[s.liquidId])||void 0===e?void 0:e.attributes)||void 0===n?void 0:n.maxQuantityPerOrder)&&void 0!==o?o:0;return!f||f<=0?s.maxQuantity-p:f-p}updateButtonStates(t){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!t.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!t.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!t.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!t.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits();t>0&&!e.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),e=this.getItemStore();if(!e)return document.createElement("div");const n=document.createElement("div");return n.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),this.quantitySpan=document.createElement("span"),this.quantitySpan.className="quantity-value",this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-btn-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(t),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantitySpan),n.appendChild(this.qtyIncreaseButton),n}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const e=document.createElement("div");e.className="item-price-container";const n=document.createElement("span");if(n.className="item-price",n.textContent=formatCentToDollarText(t.price),e.appendChild(n),t.quantity>1){const n=document.createElement("span");n.className="item-price-per-unit",n.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",e.appendChild(n)}return e}template(){const t=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer();t.push(e)}const e=this.createPriceContainer();return t.push(e),t}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path);if(e){const{value:t,oldValue:n}=e,o=Boolean(null==n?void 0:n.code),s=Boolean(null==t?void 0:t.code);if(!o&&s)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(o&&!s)return this.container.innerHTML="",this.createInputContainer(),void 0;if(s&&this.promoCodePill&&t.discountAmount!==(null==n?void 0:n.discountAmount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",void 0}}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+(null==t?void 0:t.code)),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const e=document.createElement("div");e.classList.add("promo-container"),e.appendChild(this.createPromoInput()),e.appendChild(this.createApplyButton()),t.appendChild(e),this.container.appendChild(t),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("cart.loading"),o=this.getStoreValue("cart.promoCode"),s=this.getStoreValue("cart.events")||[],a=hasCartAnyPromoCodeEvents(s);this.applyButton.disabled=!e||n||Boolean(null==o?void 0:o.discountAmount)||this.isApplying||a}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),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 A=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(t),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(e){this.logger.error("Cart promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}};return this.applyButton.addEventListener("click",A),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),A())}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==t?void 0:t.code){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+t.code),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),e}const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");return n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:s.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const e=this.container.querySelectorAll("[data-fulfillment-id]");if(e.length>0){const t=e[e.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const e=this.getFulfillmentInsertionPoint();if(e){const n=this.createFulfillmentElement(t);n.setAttribute("data-fulfillment-id",t);const o=this.getFulfillmentContainer();o&&o.remove(),e.nextSibling?e.parent.insertBefore(n,e.nextSibling):e.parent.appendChild(n)}}removeFulfillmentElement(t){const e=this.getFulfillmentElementById(t);if(e){const t=e.parentElement,n=e.nextElementSibling;e.remove();const o=this.container.querySelectorAll("[data-fulfillment-id]");if(0===o.length){const e=document.createElement("div");e.id="retailer-fulfillment-container",n?t.insertBefore(e,n):t.appendChild(e)}}}handleFulfillmentsUpdate(t,e){const n=new Set(t||[]),o=new Set(e||[]);for(const s of n)o.has(s)||this.removeFulfillmentElement(s);for(const s of o)n.has(s)||this.addFulfillmentElement(s)}setupFulfillmentElements(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],n=this.container.querySelectorAll("[data-fulfillment-id]");for(const s of n)s.remove();let o=this.getFulfillmentContainer();if(!o){const t=this.container.querySelector(".retailer-body-container"),e=this.container.querySelector("#retailer-subtotal-container");o=document.createElement("div"),o.id="retailer-fulfillment-container",t&&e&&t.insertBefore(o,e)}for(const s of e)this.addFulfillmentElement(s)}setupSubtotalElement(){const t=this.getRetailerId(),e=this.container.querySelector("#retailer-subtotal-container");if(e){const n=ComponentFactoryService.createElement({type:s.CART_RETAILER_SUBTOTAL,retailerId:t});e.replaceWith(n)}}onStoreChanged(t){const e=this.getRetailerId(),n="cart.retailers."+e,o=t.find(t=>t.path===n);if(o){const t=o.oldValue,e=o.value,n=(null==t?void 0:t.fulfillments)||[],s=(null==e?void 0:e.fulfillments)||[];JSON.stringify(n)!==JSON.stringify(s)&&this.handleFulfillmentsUpdate(n,s)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),e=this.container.querySelector(".retailer-section"),n=this.container.querySelector(".section-header-label");if(t&&e&&n){const d=()=>{const e=t.checked;n.setAttribute("aria-label",e?"Expand retailer section":"Collapse retailer section"),n.setAttribute("aria-expanded",e?"false":"true")};t.addEventListener("change",()=>{t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),d()}),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),d()}}beforeAutoDestroy(){this.logger.debug("Cart retailer component cleanup initiated",{retailerId:this.getRetailerId()})}onAutoDestroy(){this.logger.debug("Cart retailer component successfully destroyed",{retailerId:this.getRetailerId()})}template(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t),n=document.createElement("section");n.className="retailer-section";const o=document.createElement("div");o.className="cart-retailer-header";const s=document.createElement("div");s.className="retailer-info";const a=document.createElement("h2");a.className="section-title",a.textContent=e.name,s.appendChild(a);const c=document.createElement("input");c.type="checkbox",c.id=e.id,c.className="section-toggle",s.appendChild(c);const l=document.createElement("label");l.htmlFor=e.id,l.className="section-header-label",l.setAttribute("role","button"),l.setAttribute("tabindex","0"),l.setAttribute("aria-label","Collapse retailer section"),l.setAttribute("aria-expanded","true");const h=document.createElement("span");h.className="chevron",h.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),l.appendChild(h),s.appendChild(l),o.appendChild(s),n.appendChild(o);const p=document.createElement("div");p.className="retailer-body-container";const m=document.createElement("div");m.id="retailer-fulfillment-container",p.appendChild(m);const f=document.createElement("div");return f.id="retailer-subtotal-container",p.appendChild(f),n.appendChild(p),n}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,e){const n=Object.values(t||{}).filter(t=>t.retailerId===e);let o=0;for(const s of n)o+=s.quantity;return o}template(){const t=this.params.retailerId,e=this.getStoreValue("cart.retailers."+t+".subtotal")||0,n=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,o=this.getStoreValue("cart.items"),s=this.getRetailerItemCount(o,t),a=1===s?"item":"items",c=document.createElement("h3");c.className="retailer-subtotal-header",c.textContent="Subtotal ("+s+" "+a+"):";const l=document.createElement("span");return l.className="retailer-subtotal-amount",l.textContent=formatCentToDollarText(e+n),[c,l]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.isPresaleLocked","checkout.presaleExpiresAt"]})}template(){var t,e,n;const o=this.store.get("checkout.isPresaleLocked"),a=this.store.get("checkout.presaleExpiresAt"),c=this.getConfigs("global"),l=this.clientConfig.get("promoTicker"),h=null!==(e=null===(t=null==c?void 0:c.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],p=null!=l?l:h,m=this.store.get("address"),f=hasActiveItems(p,null===(n=null==m?void 0:m.address)||void 0===n?void 0:n.state),v=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),b=o&&a,x=document.createElement("div");x.classList.add("checkout-container"),v&&x.classList.add("no-header"),this.params.isIndependentComponent&&x.classList.add("independent");const w=ComponentFactoryService.createElement({type:s.CHECKOUT_INFORMATION_SECTION});x.appendChild(w);const C=ComponentFactoryService.createElement({type:s.CHECKOUT_SUMMARY_SECTION});if(x.appendChild(C),!b&&(!p.length||!f)&&v)return[x];const k=document.createElement("div");if(k.classList.add("checkout-header-wrapper"),!v){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_HEADER});k.appendChild(t)}if(p.length&&f&&!b){const t=ComponentFactoryService.createElement({context:"checkout",type:s.PROMO_CODE_TICKER,tickers:p});k.appendChild(t)}if(b){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_PRESALE_COUNTDOWN});k.appendChild(t)}return[k,x]}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.isPresaleLocked"),e=this.getConfigs("checkout");let n=null;if(!t){n=document.createElement("button"),n.classList.add("checkout-header-button"),n.setAttribute("aria-label","Back to Cart"),n.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(s.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),n.appendChild(t)}const o=document.createElement("h1");o.textContent=(null==e?void 0:e.layout.drawerHeaderText)||"Checkout",o.classList.add("checkout-header-title"),o.setAttribute("aria-label","Checkout Page");const a=document.createElement("button");return a.innerHTML=CloseIcon({width:16,height:16}),a.classList.add("checkout-header-button-close"),a.setAttribute("aria-label","Close Checkout"),a.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),n?[n,o,a]:[o,a]}}class CheckoutInformationSectionComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift"]})}onStoreWatch(t){const e=t.find(t=>"checkout.isGift"===t.path);e&&this.handleBuyerInformationVisibility(e.value)}handleBuyerInformationVisibility(t){const e=this.container.querySelector("#buyer-information-container");if(t&&!e){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_BUYER_INFORMATION_FORM});t.id="buyer-information-container";const e=this.container.querySelector(".checkout-delivery-information");e&&e.insertAdjacentElement("afterend",t)}else!t&&e&&setTimeout(()=>{e.remove()},300)}template(){const t=[],e=ComponentFactoryService.createElement({type:s.CHECKOUT_DELIVERY_INFORMATION_FORM});t.push(e);const n=ComponentFactoryService.createElement({type:s.CHECKOUT_PAYMENT_FORM});t.push(n);const o=ComponentFactoryService.createElement({type:s.CHECKOUT_BILLING_FORM});return t.push(o),t}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presaleExpiresAt","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var e;const n=t.find(t=>"checkout.presaleExpiresAt"===t.path);if(null==n?void 0:n.value)return this.updateExpiresAt(n.value),!![];const o=t.find(t=>"ui.drawer"===t.path);return(null===(e=null==o?void 0:o.value)||void 0===e?void 0:e.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const t=this.store.get("checkout.presaleExpiresAt");t&&this.updateExpiresAt(t),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var t,e;const n=[".drawer-content"];for(const s of n){const e=null===(t=this.rootElement)||void 0===t?void 0:t.closest(s);if(e&&this.isScrollable(e))return e}let o=null===(e=this.rootElement)||void 0===e?void 0:e.parentElement;for(;o&&o!==document.body;){if(this.isScrollable(o))return o;o=o.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var t,e;if(!this.scrollContainer)return;const n=this.scrollContainer.scrollTop,o=70,s=10;!this.isCurrentlyScrolled&&n>o?(this.isCurrentlyScrolled=!![],null===(t=this.rootElement)||void 0===t||t.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&n<s&&(this.isCurrentlyScrolled=![],null===(e=this.rootElement)||void 0===e||e.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(t){const e=window.getComputedStyle(t),n=e.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===n||"scroll"===n||"overlay"===n)}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 e=new Date,n=Math.floor((this.expiresAt.getTime()-e.getTime())/1e3);n<this.totalDuration&&(this.totalDuration=Math.max(n,240)),this.startCountdown()}catch(e){this.logger.error("Failed to parse presale expiration date",e),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const t=new Date,e=Math.max(0,this.expiresAt.getTime()-t.getTime()),n=e/1e3,o=this.totalDuration-n,s=Math.max(0,Math.min(100,o/this.totalDuration*100)),a=n<60;if(a!==this.isUnderOneMinute){this.isUnderOneMinute=a;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"))}const c=this.rootElement.querySelector("[data-timer]");c&&(c.textContent=this.formatTime(e));const l=this.rootElement.querySelector("[data-progress-fill]");l&&(l.style.width=s+"%"),0===e&&this.handleExpire()}formatTime(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),o=e%60,s=Math.floor(t%1e3/10);return n.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")}handleExpire(){this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer()}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const e=document.createElement("div");e.classList.add("checkout-presale-text-container");const n=document.createElement("div");n.classList.add("checkout-presale-heading");const o=document.createElement("h2");o.textContent="LIMITED PRE-ORDER:";const s=document.createElement("div");s.classList.add("checkout-presale-timer"),s.setAttribute("data-timer",""),s.textContent="00:00:00",n.appendChild(o),n.appendChild(s);const a=document.createElement("p");a.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",a.classList.add("checkout-presale-subtitle"),e.appendChild(n),e.appendChild(a);const c=document.createElement("div");c.className="checkout-presale-progress-bar",c.setAttribute("data-progress","");const l=document.createElement("div");return l.className="checkout-presale-progress-fill",l.setAttribute("data-progress-fill",""),l.style.width="0%",c.appendChild(l),t.appendChild(e),t.appendChild(c),t}}const gt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],vt={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,e){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(e)?e:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(e)?e:null:"class"===t?e.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():e.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const e=t.textContent||"",n=e.replace(/<[^>]*>/g,"");if(n.trim()){const t=document.createTextNode(n);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const e=t,n=e.tagName.toLowerCase();if(gt.includes(n)){const t=document.createElement(n),o=vt[n]||[];for(const n of Array.from(e.attributes)){const e=n.name.toLowerCase();if(o.includes(e)){const o=sanitizeAttributeValue(e,n.value);null!==o&&t.setAttribute(e,o)}}"a"===n&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const n of Array.from(e.childNodes)){const e=cleanNode(n);e&&t.appendChild(e)}return t}const o=document.createDocumentFragment();for(const t of Array.from(e.childNodes)){const e=cleanNode(t);e&&o.appendChild(e)}return o.childNodes.length>0?o:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const e=new DOMParser,n=e.parseFromString(t,"text/html"),o=n.querySelector("parsererror");if(o)return console.warn("HTML parsing error detected"),"";const s=document.createDocumentFragment();for(const t of Array.from(n.body.childNodes)){const e=cleanNode(t);e&&s.appendChild(e)}const a=document.createElement("div");return a.appendChild(s),a.innerHTML}catch(e){return console.error("HTML sanitization error:",e),""}}class CheckoutSummarySectionComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const e=t.find(t=>"checkout.amounts"===t.path);if(e){const t=this.getStoreValue("checkout"),e=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&e>0)}}updateZeroAmountElement(t){const e=this.container.querySelector(".checkout-zero-amount-container");if(t&&!e){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 e=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");e&&e.after(t)}else!t&&e&&e.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 e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,e=this.config.layout.smsOptIn;if(!t.show&&!e.show)return null;const n=document.createElement("div");if(n.classList.add("checkout-marketing-opt-ins-container"),t.show){const e=document.createElement("div");let o;e.classList.add("checkout-checkbox-container"),o=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const s=document.createElement("span");s.id="emailOptIn",s.classList.add("checkout-checkbox-visual"),o&&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",o?"true":"false"),s.addEventListener("click",()=>this.handleEmailToggle(s)),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(s))});const a=document.createElement("label");a.setAttribute("for","emailOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(t.text),a.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canEmail"),s.classList.toggle("checked"))}),e.appendChild(s),e.appendChild(a),n.appendChild(e)}if(e.show){const t=document.createElement("div");let o;t.classList.add("checkout-checkbox-container"),o=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canSms");const s=document.createElement("span");s.classList.add("checkout-checkbox-visual"),s.id="smsOptIn",o&&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",o?"true":"false"),s.addEventListener("click",()=>this.handleSmsToggle(s)),s.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(s))});const a=document.createElement("label");a.setAttribute("for","smsOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(e.text),a.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canSms"),s.classList.toggle("checked"))}),t.appendChild(s),t.appendChild(a),n.appendChild(t)}return n}hasOnDemandOrder(){const t=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}template(){var t;const e=[],n=this.getConfigs("global"),o=this.getConfigs("checkout"),a=this.getConfigs("global"),c=o.layout.allowGiftCards,l=null===(t=null==a?void 0:a.layout)||void 0===t?void 0:t.allowPromoCodes,h=document.createElement("div");h.classList.add("section-title-container");const p=document.createElement("h3");p.textContent="Order Summary",p.classList.add("section-title"),h.appendChild(p),e.push(h);const m=ComponentFactoryService.createElement({type:s.CHECKOUT_ITEMS});e.push(m);const f=document.createElement("div");f.classList.add("checkout-separator");const v=document.createElement("div");if(v.classList.add("checkout-separator"),e.push(f),c||l){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_PC_GC});e.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_TIPS});e.push(t),e.push(v)}const b=document.createElement("div");b.classList.add("section-title-container");const x=document.createElement("h3");x.textContent="100% Secure Payments",x.classList.add("disclaimer-header"),b.appendChild(x);const w=document.createElement("p");w.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.",w.classList.add("disclaimer-description"),b.appendChild(w),e.push(b);const C=ComponentFactoryService.createElement({type:s.CHECKOUT_AMOUNTS});e.push(C);const k=ComponentFactoryService.createElement({type:s.CHECKOUT_PLACE_ORDER_BUTTON});e.push(k);const S=this.marketingOptInsContainer();if(S&&e.push(S),o.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(o.layout.legalMessage.text);const s=document.createElement("div");s.classList.add("checkout-separator"),e.push(t),e.push(n),e.push(s)}if(n.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"checkout"});e.push(t)}return e}}class CheckoutBillingFormComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.billingSameAsShipping"]})}async handleFirstNameChange(t){this.commands.checkout.updateBillingInfo(et.firstName,t),this.pubSub.publishForm(o.BILLING,{fieldName:et.firstName})}async handleLastNameChange(t){this.commands.checkout.updateBillingInfo(et.lastName,t),this.pubSub.publishForm(o.BILLING,{fieldName:et.lastName})}async handleEmailChange(t){this.commands.checkout.updateBillingInfo(et.email,t),this.pubSub.publishForm(o.BILLING,{fieldName:et.email})}async handlePhoneChange(t){this.commands.checkout.updateBillingInfo(et.phone,t),this.pubSub.publishForm(o.BILLING,{fieldName:et.phone})}async handleCompanyChange(t){this.commands.checkout.updateBillingInfo(et.company,t),this.pubSub.publishForm(o.BILLING,{fieldName:et.company})}async handleAddressOneChange(t){this.commands.checkout.updateBillingInfo(et.addressOne,t),this.pubSub.publishForm(o.BILLING,{fieldName:et.addressOne})}async handleAddressTwoChange(t){this.commands.checkout.updateBillingInfo(et.addressTwo,t),this.pubSub.publishForm(o.BILLING,{fieldName:et.addressTwo})}async handleCityChange(t){this.commands.checkout.updateBillingInfo(et.city,t),this.pubSub.publishForm(o.BILLING,{fieldName:et.city})}async handleStateChange(t){this.commands.checkout.updateBillingInfo(et.state,t),this.pubSub.publishForm(o.BILLING,{fieldName:et.state})}async handleZipCodeChange(t){this.commands.checkout.updateBillingInfo(et.zipCode,t),this.pubSub.publishForm(o.BILLING,{fieldName:et.zipCode})}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.billingSameAsShipping"),e=document.createElement("div");e.classList.add("checkout-billing-same-as-shipping-toggle-container");const n=document.createElement("div");n.classList.add("checkout-checkbox-container");const o=document.createElement("span");o.id="billingSameAsShipping",o.classList.add("checkout-checkbox-visual"),o.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Billing same as shipping checkbox"),o.setAttribute("aria-checked",t?"true":"false"),t&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),e.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),e.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.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"),n.appendChild(o),n.appendChild(s),e.appendChild(n),e}template(){const t=this.getStoreValue("checkout.billingSameAsShipping"),e=[],n=this.billingSameAsShippingToggle();if(e.push(n),t)return e;const o=document.createElement("div");o.classList.add("section-title-container");const a=document.createElement("h3");a.textContent="Your billing info",a.classList.add("section-title"),o.appendChild(a);const c=document.createElement("p");c.textContent="Provide the info relevant to your payment method",c.classList.add("section-subtitle"),o.appendChild(c),e.push(o);const l=document.createElement("div");l.classList.add("section-form-container");const h=document.createElement("div");h.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:et.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleFirstNameChange.bind(this),storePath:"billing.firstName"});p.setAttribute("aria-label","First name input"),h.appendChild(p);const m=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:et.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleLastNameChange.bind(this),storePath:"billing.lastName"});m.setAttribute("aria-label","Last name input"),h.appendChild(m),l.appendChild(h);const f=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:et.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:this.handleEmailChange.bind(this),storePath:"billing.email"});f.setAttribute("aria-label","Email input"),l.appendChild(f);const v=document.createElement("div");v.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:et.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:this.handlePhoneChange.bind(this),storePath:"billing.phone"});b.setAttribute("aria-label","Phone input"),v.appendChild(b);const x=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:et.company,label:"Company (optional)",autocomplete:!![],onChange:this.handleCompanyChange.bind(this)});x.setAttribute("aria-label","Company input"),v.appendChild(x),l.appendChild(v);const w=document.createElement("div");w.classList.add("checkout-two-col-container");const C=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:et.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:this.handleAddressOneChange.bind(this),storePath:"billing.addressOne"});C.setAttribute("aria-label","Street address input"),w.appendChild(C);const k=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:et.addressTwo,label:"Apt, suite, etc. (optional)",onChange:this.handleAddressTwoChange.bind(this)});k.setAttribute("aria-label","Apt, suite, etc. (optional) input"),w.appendChild(k),l.appendChild(w);const S=document.createElement("div");S.classList.add("checkout-three-col-container");const E=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:et.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:this.handleCityChange.bind(this),storePath:"billing.city"});E.setAttribute("aria-label","City input"),S.appendChild(E);const T=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:et.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:this.handleStateChange.bind(this),storePath:"billing.state"});T.setAttribute("aria-label","State input"),S.appendChild(T);const I=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:et.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:this.handleZipCodeChange.bind(this),storePath:"billing.zipCode"});return I.setAttribute("aria-label","Zip Code input"),S.appendChild(I),l.appendChild(S),e.push(l),e}}class CheckoutBuyerInformationComponent extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}async handleFirstNameChange(t){this.commands.checkout.updateCustomerInfo(J.firstName,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.firstName})}async handleLastNameChange(t){this.commands.checkout.updateCustomerInfo(J.lastName,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.lastName})}async handleEmailChange(t){this.commands.checkout.updateCustomerInfo(J.email,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.email})}async handlePhoneChange(t){this.commands.checkout.updateCustomerInfo(J.phone,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.phone})}async handleCompanyChange(t){this.commands.checkout.updateCustomerInfo(J.company,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.company})}async handleDobChange(t){this.commands.checkout.updateCustomerInfo(J.birthDate,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.birthDate})}template(){const t=this.store.get("checkout.customer"),e=[],n=document.createElement("div");n.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Buyer Information",o.classList.add("section-title"),n.appendChild(o);const a=document.createElement("p");a.textContent="Buyer information is used to process your order and for delivery purposes.",a.classList.add("section-subtitle"),n.appendChild(a),e.push(n);const c=document.createElement("div");c.classList.add("section-form-container");const l=document.createElement("div");l.classList.add("checkout-two-col-container");const h=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:"customer.firstName"});l.appendChild(h);const p=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:this.handleLastNameChange.bind(this),storePath:"customer.lastName"});l.appendChild(p),c.appendChild(l);const m=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:this.handleCompanyChange.bind(this)});c.appendChild(m);const f=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:J.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:this.handleEmailChange.bind(this),storePath:"customer.email"});c.appendChild(f);const v=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:J.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:this.handlePhoneChange.bind(this),storePath:"customer.phone"});c.appendChild(v);const b=ComponentFactoryService.createElement({type:s.BIRTHDATE_INPUT,inputType:"date",name:J.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:this.handleDobChange.bind(this),storePath:"customer.birthDate"});return c.appendChild(b),e.push(c),e}}class CheckoutDeliveryInformationComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift","address.formattedAddress","checkout.onDemandFulfillmentTipInfo"]})}hasOnDemandFulfillments(){const t=this.store.get("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}async handleDeliveryInstructionsChange(t){await this.commands.checkout.updateDeliveryInstructions(t)}async handleFirstNameChange(t){const e=this.getStoreValue("checkout.isGift");e?(this.commands.checkout.updateGiftInfo(tt.firstName,t),this.pubSub.publishForm(o.GIFT,{fieldName:tt.firstName})):(this.commands.checkout.updateCustomerInfo(J.firstName,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.firstName}))}async handleLastNameChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(tt.lastName,t),this.pubSub.publishForm(o.GIFT,{fieldName:tt.lastName})):(this.commands.checkout.updateCustomerInfo(J.lastName,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.lastName}))}async handleEmailChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(tt.email,t),this.pubSub.publishForm(o.GIFT,{fieldName:tt.email})):(this.commands.checkout.updateCustomerInfo(J.email,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.email}))}async handlePhoneChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(tt.phone,t),this.pubSub.publishForm(o.GIFT,{fieldName:tt.phone})):(this.commands.checkout.updateCustomerInfo(J.phone,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.phone}))}async handleAddressTwoChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(tt.addressTwo,t),this.pubSub.publishForm(o.GIFT,{fieldName:tt.addressTwo})):(this.commands.checkout.updateCustomerInfo(J.addressTwo,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.addressTwo}))}async handleCompanyChange(t){this.commands.checkout.updateCustomerInfo(J.company,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.company})}async handleBirthdateChange(t){this.commands.checkout.updateCustomerInfo(J.birthDate,t),this.pubSub.publishForm(o.CUSTOMER,{fieldName:J.birthDate})}async handleGiftMessageChange(t){this.commands.checkout.updateGiftInfo(tt.message,t),this.pubSub.publishForm(o.GIFT,{fieldName:tt.message})}template(){const t=this.getConfigs("global"),e=this.getStoreValue("checkout.isGift")||![],n=this.store.get("checkout.giftRecipient"),o=this.store.get("checkout.customer"),a=this.store.get("address.formattedAddress"),c=e?n:o,l=[],h=document.createElement("div");h.classList.add("delivery-header-container");const p=document.createElement("div");p.classList.add("delivery-header-content");const m=document.createElement("div");m.classList.add("delivery-title-container");const f=document.createElement("h3");f.textContent="Deliver to",f.classList.add("delivery-title");const v=document.createElement("p");v.textContent="Package recipient must be 21+",v.classList.add("delivery-subtitle"),m.appendChild(f),m.appendChild(v);const b=document.createElement("div");b.classList.add("gift-toggle-container");const x=document.createElement("div");x.classList.add("gift-label-wrapper");const w=document.createElement("span");w.textContent="Send as Gift? (Free)",w.classList.add("gift-toggle-label"),x.appendChild(w);const C=document.createElement("span");C.textContent="With personalized note & gift receipt.",C.classList.add("gift-toggle-description"),x.appendChild(C);const k=document.createElement("div");k.classList.add("toggle-switch"),k.classList.toggle("active",e);const S=document.createElement("div");S.classList.add("toggle-slider"),k.setAttribute("tabindex","0"),k.setAttribute("aria-label","Toggle Gift Option"),k.setAttribute("role","switch"),k.setAttribute("aria-checked",e?"true":"false"),k.appendChild(S),b.appendChild(x),b.appendChild(k),k.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),k.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),h.appendChild(b),h.appendChild(m),l.push(h);const E=document.createElement("div");E.classList.add("section-form-container");const T=document.createElement("div");T.classList.add("checkout-two-col-container");const I=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:e?tt.firstName:J.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:c.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:e?"giftRecipient.firstName":"customer.firstName"});I.setAttribute("aria-label","First Name Input"),T.appendChild(I);const P=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:e?tt.lastName:J.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:c.lastName,onChange:this.handleLastNameChange.bind(this),storePath:e?"giftRecipient.lastName":"customer.lastName"});if(P.setAttribute("aria-label","Last Name Input"),T.appendChild(P),E.appendChild(T),!e){const t=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.company,label:"Company (optional)",autocomplete:!![],value:c.company,onChange:this.handleCompanyChange.bind(this),storePath:"customer.company"});t.setAttribute("aria-label","Company Input"),E.appendChild(t)}const F=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:e?tt.email:J.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:c.email,onChange:this.handleEmailChange.bind(this),storePath:e?"giftRecipient.email":"customer.email"});F.setAttribute("aria-label","Email Input"),E.appendChild(F);const D=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:e?tt.phone:J.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:c.phone,onChange:this.handlePhoneChange.bind(this),storePath:e?"giftRecipient.phone":"customer.phone"});if(D.setAttribute("aria-label","Phone Input"),E.appendChild(D),!e){const t=ComponentFactoryService.createElement({type:s.BIRTHDATE_INPUT,inputType:"date",name:J.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:formatISODateToMMDDYYYY(c.birthDate),onChange:this.handleBirthdateChange.bind(this),storePath:"customer.birthDate"});t.setAttribute("aria-label","Birthdate Input"),E.appendChild(t)}const _=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:a,disabled:!![],className:"disabled-input",validation:{required:!![]}});_.setAttribute("aria-label","Delivery Address Input"),E.appendChild(_);const O=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:e?tt.addressTwo:J.addressTwo,label:"Apt, suite, etc. (optional)",value:c.addressTwo,onChange:this.handleAddressTwoChange.bind(this),storePath:e?"giftRecipient.addressTwo":"customer.addressTwo"});if(O.setAttribute("aria-label","Address Line 2 Input"),E.appendChild(O),this.hasOnDemandFulfillments()){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const n=document.createElement("label");n.textContent="Delivery Instructions",n.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=this.store.get("checkout.deliveryInstructions")||"",o.addEventListener("blur",async t=>{await this.handleDeliveryInstructionsChange(t.target.value)}),o.addEventListener("keydown",async t=>{"Enter"!==t.key||t.shiftKey||(t.preventDefault(),await this.handleDeliveryInstructionsChange(t.target.value))});const s=document.createElement("p");s.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",s.classList.add("textarea-message-disclaimer"),e.appendChild(n),e.appendChild(o),e.appendChild(s),E.appendChild(e)}if(e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const o=document.createElement("label");o.textContent="Gift Message*",o.setAttribute("for",tt.message);const s=document.createElement("textarea");s.name=tt.message,s.id=tt.message,s.rows=4,s.value=n.message||"",s.setAttribute("aria-label","Gift Message Textarea"),s.addEventListener("input",async t=>{await this.handleGiftMessageChange(t.target.value)});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"),e.appendChild(o),e.appendChild(s),e.appendChild(a),E.appendChild(e)}return l.push(E),l}}class CheckoutPaymentFormComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchStorePaths:["checkout.payment.sendSubmitSignal"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![]}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,e=null;for(;t&&t!==document.body;){const n=t.hasAttribute("checkout"),o=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(s.LCE_ELEMENT),a=t.hasAttribute("drawer"),c=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(s.DRAWER),l="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||o&&a&&c&&l)return this.rootComponent=t,t;e=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){await this.commands.checkout.getPaymentSession();const t=this.store.get("checkout.payment"),e=this.getConfigs("global");return{publishableKey:t.key,clientSecret:t.secret,appearance:{theme:"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;if(this.isCreatingStripeForm)return this.logger.debug("Stripe form creation already in progress, skipping"),void 0;const e=this.findRootComponent();if(!e)return;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.debug("Stripe form already exists and is connected, skipping creation"),void 0;const n=e.querySelectorAll('[slot="'+$+'"]');if(n.length>0)for(const s of n)s.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:s.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.stripeFormElement.setAttribute("slot",$),e.appendChild(this.stripeFormElement),this.setupStripeFormEventListeners()}catch(o){this.logger.error("Stripe form element creation failed",o),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}async afterRender(){this.removeExistingStripeForm(),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",async t=>{await this.commands.checkout.updateStripeFormStatus(t.detail.status),t.detail.status.hasError&&this.logger.error("Stripe form status update failed",t.detail)}),this.stripeFormElement.addEventListener("lce:s:confirmPaymentSession",async t=>{try{const{confirmationTokenId:e,setupIntentId:n}=t.detail;await this.commands.checkout.confirmPaymentSession(e,n)}catch(e){this.logger.error("Failed to confirm payment session",e),this.store.set("checkout.payment.sendSubmitSignal",![])}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const e=await this.doStripeConfig(),n=new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:e}});null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(n)}catch(e){this.logger.error("Failed to refresh payment session",e)}})}onStoreChanged(t){const e=t.some(t=>"checkout.payment.sendSubmitSignal"===t.path&&t.value===!![]);if(e&&this.stripeFormElement){const t=new CustomEvent("lce:s:submit");this.stripeFormElement.dispatchEvent(t)}return![]}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],null===(t=super.disconnected)||void 0===t||t.call(this)}template(){const t=[],e=document.createElement("div");e.classList.add("section-title-container");const n=document.createElement("h3");n.textContent="Payment",n.classList.add("section-title"),e.appendChild(n);const o=document.createElement("p");o.textContent="All transactions are secure and encrypted.",o.classList.add("section-subtitle"),e.appendChild(o),t.push(e);const s=document.createElement("slot");return s.setAttribute("name",$),t.push(s),t}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this._=null,this.O=null,this.N=null,this.M=![],this.L=![],this.R=![]}async initialize({data:t}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.B=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.B;this._=window.Stripe(t.publishableKey),this.O=this._.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.N=this.O.create("payment",t.elementOptions),this.N.mount(this),this.N.on("change",async t=>{const e=!!t.error,n=t.complete,o=e?t.error.message:null;this.L=n,await this.updateStripeFormStatus({isComplete:n,hasError:e,errorMessage:o,isProcessing:this.M})}),this.N.on("focus",async()=>{await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:this.M})}),this.R=![]}catch(t){throw await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",this.handleSubmitEvent.bind(this)),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this))}async handleSubmitEvent(){await this.handleSubmit()}async handleRefreshSession(t){const{stripeConfig:e}=t.detail;e&&(this.B=e,await this.refreshPaymentSession())}async handleSubmit(){if(!this.M){this.M=!![],await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:!![]});try{if(!this.L)throw new Error("Please complete all required payment fields");this.R&&await this.requestSessionRefresh();const t=await this.createConfirmationTokenId(),e=this.B.clientSecret,n=e.split("_secret_")[0],o=new CustomEvent("lce:s:confirmPaymentSession",{detail:{confirmationTokenId:t,setupIntentId:n}});this.dispatchEvent(o),this.R=!![],await this.updateStripeFormStatus({isComplete:!![],isProcessing:![],hasError:![],errorMessage:null})}catch(t){this.R||(this.R=!![]),await this.updateStripeFormStatus({isComplete:this.L,isProcessing:![],hasError:!![],errorMessage:(null==t?void 0:t.message)||"An unexpected error with payment occurred"})}finally{this.M=![]}}}async requestSessionRefresh(){const t=new CustomEvent("lce:s:requestSessionRefresh");return this.dispatchEvent(t),new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",g),e(new Error("Session refresh timeout"))},5e3),g=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",g),t()};this.addEventListener("lce:s:refreshSession",g,{once:!![]})})}async refreshPaymentSession(){try{this.O&&this.O.update({clientSecret:this.B.clientSecret}),this.R=![]}catch(B){await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to refresh payment session"})}}async updateStripeFormStatus(t){const e=new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t}});this.dispatchEvent(e)}async createConfirmationTokenId(){if(!this.O)throw new Error("Elements must be provided");try{const{error:t}=await this.O.submit();if(t)throw new Error(t.message);const e={elements:this.O,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:n,confirmationToken:o}=await this._.createConfirmationToken(e);if(n)throw new Error(n.message);if(!o||!o.id)throw new Error("Confirmation token not found");return o.id}catch(t){throw new Error(t.message)}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,e;try{this.N&&(this.N.unmount(),this.N=null),this.O&&(null===(e=(t=this.O).destroy)||void 0===e?void 0:e.call(t),this.O=null),this._=null,this.M=![],this.L=![],this.R=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}catch(n){console.warn("Error during Stripe form cleanup:",n)}}loadStripeJS(){return new Promise((t,e)=>{const n=document.createElement("script");n.src="https://js.stripe.com/basil/stripe.js",n.onload=()=>t(),n.onerror=()=>e(new Error("Failed to load Stripe.js")),document.head.appendChild(n)})}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,e,n;const o=this.getStoreValue("checkout"),s=Boolean(o.promoCode),a=Boolean(null===(t=o.giftCards)||void 0===t?void 0:t.length),c=this.getConfigs("global"),l=Object.keys(o.onDemandFulfillmentTipInfo||{}).length>0,h=Object.values(o.items||{}),p=[],m=document.createElement("div");m.classList.add("checkout-amount-line");const f=document.createElement("span");f.textContent="Subtotal ("+h.length+" item"+(h.length>1?"s":"")+")",m.appendChild(f);const v=document.createElement("span");v.textContent=formatCentToDollarText(o.amounts.subtotal),m.appendChild(v),p.push(m);const b=document.createElement("div");b.classList.add("checkout-amount-line");const x=document.createElement("span");x.textContent="Shipping",b.appendChild(x);const w=document.createElement("span");w.textContent=formatCentToDollarText(o.amounts.shipping),b.appendChild(w),p.push(b);const C=document.createElement("div");C.classList.add("checkout-amount-line");const k=document.createElement("span");k.textContent="Delivery",C.appendChild(k);const S=document.createElement("span");if(S.textContent=formatCentToDollarText(o.amounts.delivery),C.appendChild(S),p.push(C),(null===(e=null==o?void 0:o.amounts)||void 0===e?void 0:e.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Engraving",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(o.amounts.engraving),t.appendChild(n),p.push(t)}const E=document.createElement("div");E.classList.add("checkout-amount-line");const T=document.createElement("span");T.textContent="Taxes & Fees",E.appendChild(T);const I=document.createElement("span");if(I.textContent=formatCentToDollarText(o.amounts.tax+o.amounts.service+o.amounts.platform),E.appendChild(I),p.push(E),s){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Promo Code ("+(null===(n=o.promoCode)||void 0===n?void 0:n.code)+")",t.appendChild(e);const s=document.createElement("span");s.textContent="-"+formatCentToDollarText(o.amounts.discounts),t.appendChild(s),p.push(t)}if(a){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Gift Cards Applied",t.appendChild(e);const n=document.createElement("span");n.textContent="-"+formatCentToDollarText(o.amounts.giftCards),t.appendChild(n),p.push(t)}if(l){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Tips",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(o.amounts.tip),t.appendChild(n),p.push(t)}const P=document.createElement("div");P.classList.add("checkout-separator"),p.push(P);const F=document.createElement("div");F.classList.add("checkout-amount-total");const D=document.createElement("span");D.textContent="Total",F.appendChild(D);const _=document.createElement("span");_.textContent=formatCentToDollarText(o.amounts.total),F.appendChild(_),p.push(F);const O=this.store.get("checkout.isPresaleLocked");if(O){const t=document.createElement("div");t.classList.add("checkout-amount-due");const e=document.createElement("span");e.textContent="Amount due today",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(0),t.appendChild(n),p.push(t);const o=document.createElement("div");o.classList.add("checkout-presale-locked-message");const s=htmlStringToElement(InfoIcon({color:c.theme.defaultTextColor}));o.appendChild(s);const a=document.createElement("p");a.textContent="Pre-ordered items will be charged when shipped.",o.appendChild(a),p.push(o)}return p}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,e,n,o,a,c,l,h,p,m,f,v;const b=[],x=this.getConfigs("configurations"),w=this.getConfigs("global"),C=this.getConfigs("checkout"),k=this.config.layout.exitUrl||window.location.host,S=this.config.layout.thankYouButtonText||"Continue Shopping";if((null===(e=null===(t=this.config.theme)||void 0===t?void 0:t.checkoutCompleted)||void 0===e?void 0:e.customLogo)||(null===(o=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===o?void 0:o.customLogo)){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const e=document.createElement("img");e.src=(null===(c=null===(a=this.config.theme)||void 0===a?void 0:a.checkoutCompleted)||void 0===c?void 0:c.customLogo)||(null===(h=null===(l=this.config.layout)||void 0===l?void 0:l.checkoutCompleted)||void 0===h?void 0:h.customLogo),e.alt=x.partnerName+" Logo",t.appendChild(e),b.push(t)}const E=document.createElement("div");E.classList.add("checkout-completed-section-container");const T=document.createElement("div");T.classList.add("checkout-completed-title-container");const I=document.createElement("div");I.classList.add("checkout-completed-title-section");const P=document.createElement("h3");P.innerHTML=(null===(m=null===(p=this.config.theme)||void 0===p?void 0:p.checkoutCompleted)||void 0===m?void 0:m.customText)||(null===(v=null===(f=this.config.layout)||void 0===f?void 0:f.checkoutCompleted)||void 0===v?void 0:v.customText)||"Thank You for Your Order!",I.appendChild(P);const F=document.createElement("p");F.textContent="Your payment has been successfully processed.",I.appendChild(F),T.appendChild(I),E.appendChild(T);const D=document.createElement("div");D.classList.add("checkout-completed-sub-section");const _=document.createElement("div");_.classList.add("checkout-completed-line");const O=document.createElement("h3");O.textContent="Order Number",_.appendChild(O);const N=document.createElement("span");N.textContent=this.params.orderNumber,_.appendChild(N),D.appendChild(_);const M=document.createElement("div");M.classList.add("checkout-completed-line");const L=document.createElement("h3");L.textContent="Order Amount",M.appendChild(L);const R=document.createElement("span");R.textContent=""+formatCentToDollarText(this.params.orderTotal),M.appendChild(R),D.appendChild(M);const B=document.createElement("div");B.classList.add("checkout-completed-line");const q=document.createElement("h3");q.textContent="Payment Method",B.appendChild(q);const j=document.createElement("span");j.textContent="** "+this.params.cardLast4,B.appendChild(j),D.appendChild(B),E.appendChild(D);const G=document.createElement("div");G.classList.add("checkout-completed-sub-section");const H=document.createElement("p");H.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>.",G.appendChild(H),E.appendChild(G),b.push(E);const V=document.createElement("div");V.classList.add("checkout-completed-section-container");const Y=document.createElement("button");Y.type="button";const W=document.createElement("span");W.textContent=S,Y.setAttribute("tabindex","0"),Y.setAttribute("role","button"),Y.setAttribute("aria-label",S),Y.appendChild(W);const Q=htmlStringToElement(ArrowRightIcon({width:16,height:16}));Y.appendChild(Q),Y.addEventListener("click",()=>{window.location.href=k}),Y.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=k)}),V.appendChild(Y),b.push(V);const Z=document.createElement("div");Z.classList.add("checkout-completed-section-container");const $=document.createElement("div");$.classList.add("checkout-completed-help-section"),Z.appendChild($);const J=document.createElement("p");J.textContent="Questions about your order? Contact us at "+x.supportEmail,$.appendChild(J);const tt=document.createElement("p"),et=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(tt.textContent="Order placed on "+et,$.appendChild(tt),b.push(Z),C.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(C.layout.legalMessage.text);const n=document.createElement("div");n.classList.add("checkout-separator"),b.push(t),b.push(e),b.push(n)}if(w.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"general"});b.push(t)}return b}}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 e;const n=t.find(t=>"checkout.giftCards"===t.path),o=t.find(t=>"checkout.loading"===t.path);n&&n.value.length>((null===(e=n.oldValue)||void 0===e?void 0:e.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),o&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),o=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!e||n||Boolean(o)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.giftCardInput;n.setValue(e),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 A=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(e){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",A),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),A())}),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 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 e,n,o,s;const a=t.find(t=>"checkout.items"===t.path);a&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const c=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(c){const t=c.oldValue,a=c.value;if(a.updating)return![];const l=(null==t?void 0:t.quantity)!==(null==a?void 0:a.quantity),h=(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],p=(null===(s=null===(o=null==a?void 0:a.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||[],m=JSON.stringify(h)!==JSON.stringify(p);(l||m)&&this.updateEngravingElement(a)}return![]}updateEngravingElement(t){var e,n;const o=this.getConfigs("global"),a=this.container.querySelector(".engraving-view-container");if(a&&a.remove(),(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]&&o.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),n=this.container.querySelector(".checkout-item-card-footer");n&&n.before(e)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const e=t.fulfillmentId;if(!e)return;if(!this.container)return;const n=this.container.querySelector(".checkout-item-card-header");if(n){const o=this.getStoreValue("cart.fulfillments."+e),a=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(a&&a.remove(),shouldShowMinimumPurchaseAlert(o,t.pack)){const e=getMinimumPurchaseMessage(o,t.pack),a=ComponentFactoryService.createElement({type:s.PURCHASE_MIN_ALERT,message:e.message,messageType:e.type,currentTotal:o.subtotal,config:{showIcon:!![],alertType:"minimal"}});a.setAttribute("data-component-type","checkout-retailer-alert"),n.before(a)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),e=Object.keys(t.items).length,n=1===e;this.trashButton.disabled=n,n?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 e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.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 ',e.appendChild(n),t.appendChild(e),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(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,e,n;const o=this.getConfigs("global"),a=this.getStoreValue("checkout.items."+this.params.itemId),c=null===(t=null==a?void 0:a.attributes)||void 0===t?void 0:t.presale,l=(null==c?void 0:c.isActive)&&(null==c?void 0:c.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(c.estimatedShipBy):"";if(!a)return[];const h=document.createElement("div");h.classList.add("checkout-item-card-header");const p=document.createElement("img");p.classList.add("checkout-item-image"),p.src=a.mainImage,p.alt=a.name,p.loading="lazy",h.appendChild(p);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=a.name,m.appendChild(f);const v=document.createElement("div");v.classList.add("checkout-item-subtitle");const b=document.createElement("span");b.textContent=c.isActive?""+l:((null==a?void 0:a.expectationDetail)||"")+",",v.appendChild(b);const x=document.createElement("span");x.textContent="From "+((null==a?void 0:a.retailerName)||""),v.appendChild(x),m.appendChild(v),h.appendChild(m),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var e;if(t.preventDefault(),t.stopPropagation(),!(null===(e=this.trashButton)||void 0===e?void 0:e.disabled))try{await this.commands.checkout.removeItem(a.cartItemId)}catch(n){this.logger.error("Checkout item removal failed",n)}}),h.appendChild(this.trashButton);const w=ComponentFactoryService.createElement({type:s.CHECKOUT_ITEM_QUANTITY,itemId:a.cartItemId}),C=[];if(C.push(h),o.layout.enablePersonalization&&(null===(n=null===(e=null==a?void 0:a.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:a.cartItemId,context:"checkout"});C.push(t)}return C.push(w),C}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 e=t.find(t=>"checkout.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,e,n;const o=this.getStoreValue("checkout.items."+this.params.itemId);if(!o)return 0;const s=this.getStoreValue("products");if(!s)return 0;const a=o.partNumber,c=o.fulfillmentId,l=null===(n=null===(e=null===(t=Object.values(s).find(t=>t.sizes[o.liquidId]))||void 0===t?void 0:t.sizes)||void 0===e?void 0:e[o.liquidId])||void 0===n?void 0:n.attributes.maxQuantityPerOrder;if(!l)return 0;const h=this.getStoreValue("checkout.items")||{},p=Object.values(h).filter(t=>t.partNumber===a&&t.fulfillmentId===c),m=p.reduce((t,e)=>t+e.quantity,0);return l-m}calculateQuantityLimits(){var t;const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const n=this.getStoreValue("checkout"),o=1===(null===(t=Object.values(n.items))||void 0===t?void 0:t.length),s=e.quantity,a=this.getAvailableQuantity(),c=a>0,l=!(o&&1===s);return{currentQuantity:s,availableQuantity:a,isTheOnlyItem:o,canIncrease:c,canDecrease:l}}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 e=this.calculateQuantityLimits(),n=this.params.itemId;if((!(t<0)||e.canDecrease)&&(!(t>0)||e.canIncrease)){if(!n)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(n,t)}catch(o){this.logger.error("Checkout item quantity change operation failed",o)}}}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 e=this.calculateQuantityLimits(),n=document.createElement("div");n.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)}),n.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),n.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)}),n.appendChild(this.increaseButton),this.updateButtonStates(e);const o=document.createElement("span");if(o.classList.add("checkout-item-price-text"),o.textContent=formatCentToDollarText(t.price),t.quantity>1){const e=document.createElement("span");e.classList.add("checkout-item-price-each-text"),e.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",o.appendChild(e)}return[n,o]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(t){return ComponentFactoryService.createElement({type:s.CHECKOUT_ITEM,itemId:t})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},e=new Map;for(const n of objectValues(t))n&&n.cartItemId&&e.set(n.cartItemId,n);return e}syncItemsWithStore(){const t=this.getItemsListContainer();if(!t)return;const e=this.getCurrentItemsMap(),n=t.querySelectorAll("[data-item-id]"),o=new Set;for(const s of n){const t=s.getAttribute("data-item-id");t&&o.add(t)}for(const s of n){const t=s.getAttribute("data-item-id");t&&!e.has(t)&&s.remove()}for(const[s]of e)if(!o.has(s)){const e=this.createItemElement(s);e.setAttribute("data-item-id",s),t.appendChild(e)}this.updateItemCount()}updateItemCount(){const t=this.getTogglerLabel();if(!t)return;const e=this.getCurrentItemsMap(),n=e.size;t.textContent=n+" item"+(1!==n?"s":"")}onStoreChanged(t){let e;for(let n=0;n<t.length;n++){const o=t[n];if("checkout"===o.path||"checkout.items"===o.path||"checkout.items."===o.path.substring(0,15)){e=o;break}}return e?(this.syncItemsWithStore(),![]):![]}handleToggle(){const t=this.container.querySelector(".checkout-items-toggler-button"),e=this.container.querySelector(".checkout-items-list");if(t&&e){const n=e.classList.contains("show");e.classList.toggle("show"),t.classList.toggle("expanded"),n?(t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label","Expand checkout items")):(t.setAttribute("aria-expanded","true"),t.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const t=this.container.querySelector(".checkout-items-toggler"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");if(t&&e&&n){const o=n.classList.contains("show");e.setAttribute("tabindex","0"),e.setAttribute("aria-expanded",o?"true":"false"),e.setAttribute("aria-label",o?"Collapse checkout items":"Expand checkout items"),t.addEventListener("click",()=>this.handleToggle()),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.items"),e=objectValues(t||{}),n=document.createElement("div");n.classList.add("checkout-items-toggler");const o=document.createElement("span");o.classList.add("checkout-items-toggler-label"),o.textContent=e.length+" item"+(1!==e.length?"s":""),n.appendChild(o);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"}),n.appendChild(s);const a=document.createElement("div");a.classList.add("checkout-items-list","show");for(const c of e){const t=this.createItemElement(c.cartItemId);t.setAttribute("data-item-id",c.cartItemId),a.appendChild(t)}return[n,a]}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchStorePaths:["checkout.isFormValid","checkout.invalidFields","checkout.stripeFormStatus","checkout.stripeFormStatus.isComplete","checkout.stripeFormStatus.hasError","checkout.stripeFormStatus.isProcessing","checkout.stripeFormStatus.errorMessage","checkout.readyForSubmit","checkout.readyForSubmit.payment","checkout.readyForSubmit.prepared","checkout.loading","checkout.error","checkout.payment.sendSubmitSignal"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-payment-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreChanged(t){const e=t.some(t=>"checkout.isFormValid"===t.path||"checkout.invalidFields"===t.path||"checkout.stripeFormStatus"===t.path||"checkout.stripeFormStatus."===t.path.substring(0,26)||"checkout.readyForSubmit"===t.path||"checkout.readyForSubmit."===t.path.substring(0,23)||"checkout.loading"===t.path||"checkout.error"===t.path);e&&this.updateButtonState();const n=t.find(t=>"checkout.readyForSubmit"===t.path);return n&&this.handleCheckoutReadyForSubmit(n.value),![]}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.isFormValid")||![],e=this.store.get("checkout.invalidFields")||[],n=this.store.get("checkout.stripeFormStatus")||{},o=this.store.get("checkout.loading")||![],s=this.store.get("checkout.error")||null,a=n.isComplete||![],c=n.hasError||![],l=n.isProcessing||![],h=n.errorMessage||null;this.updateErrorDisplay(this.determineErrorMessage(s,h));const p=this.determineButtonState({isFormValid:t,invalidFieldsCount:e.length,isPaymentComplete:a,hasPaymentError:c,isStripeProcessing:l,isCheckoutLoading:o,hasCheckoutError:!!s});this.applyButtonState(p)}determineErrorMessage(t,e){return t&&e?e:e||t}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const e=this.errorContainer.querySelector(".error-text");e&&(this.clearErrorTimeout(),t?(e.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(()=>{this.errorTimeoutId=null,this.commands.checkout.removeCheckoutError();const t=this.store.get("checkout.stripeFormStatus");(null==t?void 0:t.errorMessage)&&this.commands.checkout.updateStripeFormStatus({errorMessage:null})},3e3)):(e.textContent="",this.errorContainer.style.display="none"))}determineButtonState(t){const{isFormValid:e,invalidFieldsCount:n,isPaymentComplete:o,hasPaymentError:s,isStripeProcessing:a,isCheckoutLoading:c,hasCheckoutError:l}=t,h=this.config.layout.placeOrderButtonText,p=this.config.layout.placeOrderButtonShowRequiredFields,m=e&&o&&!s&&!a&&!l,f=this.store.get("checkout.readyForSubmit.payment")||![],v=this.store.get("checkout.readyForSubmit.prepared")||![],b=this.store.get("checkout.payment.sendSubmitSignal")||![],x=this.store.get("checkout.isPresaleLocked")||![];let w=![];if(!x){const t=this.getStoreValue("cart.fulfillments")||{};w=Object.values(t).some(t=>hasUnmetMinimum(t))}const C=a||c||b;if(c&&!a&&!b)return{state:"processing",text:h,disabled:!![]};if(w)return{state:"disabled",text:h,disabled:!![]};if(C)return f&&v?{state:"processing",text:"Placing Order...",disabled:!![]}:f&&!v?{state:"processing",text:"Preparing Order...",disabled:!![]}:v&&!f&&(a||b)||b||a?{state:"processing",text:"Processing Payment...",disabled:!![]}:{state:"processing",text:"Placing Order...",disabled:!![]};if(!e){const t=n>0?" ("+n+")":"";return{state:"form-invalid",text:p?"Complete Required Fields"+t:h,disabled:![]}}return o?s?{state:"payment-error",text:h,disabled:![]}:m?{state:"ready",text:h,disabled:![]}:{state:"disabled",text:h,disabled:!![]}:{state:"payment-incomplete",text:"Complete Payment Information",disabled:![]}}applyButtonState(t){if(!this.placeOrderButton)return;const e=["processing","form-invalid","payment-incomplete","payment-error","ready","disabled"];this.placeOrderButton.classList.remove(...e),this.placeOrderButton.classList.add(t.state),this.placeOrderButton.disabled=t.disabled,this.placeOrderButton.textContent=t.text}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.isFormValid")||![],e=this.store.get("checkout.stripeFormStatus")||{},n=this.store.get("checkout.loading")||![],o=e.isComplete||![],s=e.hasError||![],a=e.isProcessing||![];if(a||n)return;if(!t)return await this.commands.checkout.focusFirstInvalidField(),void 0;if(!o||s)return this.showPaymentError(),void 0;await this.commands.checkout.startPreparingCheckoutSubmit()}catch(t){this.logger.error("Error handling place order click",t)}}showPaymentError(){const t=document.querySelector(".checkout-stripe-form");t&&safeScrollIntoView(t,{behavior:"smooth",block:"center"})}async handleCheckoutReadyForSubmit(t){if(!t)return;const{payment:e,prepared:n,customer:o,gift:s,billing:a}=t,c=e&&n&&o&&a&&s;c&&await this.commands.checkout.checkoutComplete()}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",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePlaceOrderClick())});const e=document.createElement("div");e.classList.add("checkout-payment-error-wrapper"),e.setAttribute("role","alert"),e.style.display="none";const n=document.createElement("div");n.classList.add("checkout-payment-error");const o=document.createElement("span");o.classList.add("icon-error"),o.innerHTML=ErrorInfoIcon({});const a=document.createElement("span");a.classList.add("error-text"),n.appendChild(o),n.appendChild(a),e.appendChild(n);const c=ComponentFactoryService.createElement({type:s.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,c,t]}}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"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),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=[],e=this.getConfigs("global"),n=document.createElement("div");n.classList.add("checkout-completed-section-container");const o=document.createElement("div");o.classList.add("checkout-completed-title-section");const a=document.createElement("div");a.classList.add("checkout-completed-title-section");const c=document.createElement("p");c.textContent="Session Expired",a.appendChild(c);const l=document.createElement("p");l.textContent="Your reservation time has ended. The item has been released for other customers.",a.appendChild(l),o.appendChild(a),n.appendChild(o);const h=document.createElement("div");h.classList.add("checkout-completed-help-section");const p=document.createElement("p");p.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.",h.appendChild(p),n.appendChild(h),t.push(n);const m=document.createElement("div");m.classList.add("checkout-completed-section-container");const f=document.createElement("button");f.setAttribute("aria-label","Continue shopping"),f.type="button";const v=document.createElement("span");v.textContent="Continue Shopping",f.setAttribute("tabindex","0"),f.setAttribute("role","button"),f.setAttribute("aria-label","Continue Shopping"),f.appendChild(v);const b=htmlStringToElement(ArrowRightIcon({width:16,height:16}));f.appendChild(b),f.addEventListener("click",()=>this.handleExit()),f.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),m.appendChild(f),t.push(m);const x=document.createElement("div");x.classList.add("checkout-completed-section-container");const w=document.createElement("p");w.classList.add("checkout-completed-auto-close-text"),w.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 C=document.createElement("span");if(C.classList.add("checkout-completed-auto-close-text"),C.textContent="seconds",x.appendChild(w),x.appendChild(this.autoCloseElement),x.appendChild(C),t.push(x),e.layout.showPoweredBy){const e=document.createElement("div");e.classList.add("checkout-completed-powered-by-container");const n=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"checkout"});e.appendChild(n),t.push(e)}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 e=t.find(t=>"checkout.promoCode"===t.path),n=t.find(t=>"checkout.loading"===t.path);if(e){const{value:t,oldValue:n}=e,o=Boolean(n),s=Boolean(t);if(!o&&s)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(o&&!s)return this.container.innerHTML="",this.createInputContainer(),void 0;s&&this.promoCodeText&&t.discountAmount!==(null==n?void 0:n.discountAmount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")")}n&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("checkout.loading"),o=this.getStoreValue("checkout.promoCode"),s=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!e||n||Boolean(o)||Boolean(s)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),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 A=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(e){this.logger.error("Checkout promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",A),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),A())}),this.applyButton}createAppliedContainer(t){const e=document.createElement("div");e.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.discountAmount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),this.container.appendChild(e),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 e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),e}const e=[];return e.push(this.createPromoInput()),e.push(this.createApplyButton()),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(t){const e=this.getStoreValue("checkout.updating")||![];if(!e)try{await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Checkout tips update failed",n)}}async handleFulfillmentTipInput(t,e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const o=this.getOnDemandFulfillmentTipInfo();if(!o[t])return;const s=Math.round(100*e);try{await this.commands.checkout.updateFulfillmentTip(t,s)}catch(a){this.logger.error("Checkout fulfillment tip update failed",a)}}async removeTipFromFulfillment(t){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const n=this.getOnDemandFulfillmentTipInfo();if(n[t])try{await this.commands.checkout.removeFulfillmentTip(t)}catch(o){this.logger.error("Checkout fulfillment tip removal failed",o)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const e=[10,18,20],n=this.getStoreValue("checkout.updating")||![],o=this.getTipSelection();for(const s of e){const e=document.createElement("button");e.type="button",e.textContent=s+"%",e.classList.add("checkout-tip-button"),e.disabled=n,o===s&&e.classList.add("selected"),e.addEventListener("click",()=>this.handlePercentageSelect(s)),t.appendChild(e)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".retailers-tips-list");t&&e&&n&&t.addEventListener("click",()=>{const t=n.classList.contains("show");n.classList.toggle("show"),t?(e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand tips section")):(e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse tips section")),e.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;const n=document.createElement("div");n.classList.add("checkout-tip-distribution-header");const o=document.createElement("h3");o.textContent="View Tip Distribution",o.classList.add("checkout-sub-header"),n.appendChild(o);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"}),n.appendChild(s),t.appendChild(n);const a=document.createElement("div");a.classList.add("retailers-tips-list","show");for(const c of e){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const e=document.createElement("h4");e.textContent=c.retailerName,e.classList.add("checkout-sub-header"),t.appendChild(e);const n=document.createElement("div");n.classList.add("checkout-tip-fulfillment-input-wrapper");const o=document.createElement("div");o.classList.add("dollar-input-container");const s=document.createElement("span");s.classList.add("dollar-sign"),s.textContent="$";const l=document.createElement("input");let h;l.type="number",l.id="tip-input-"+c.fulfillmentId,l.name="tip-"+c.fulfillmentId,l.min="0",l.step="0.01",l.placeholder="0.00",l.classList.add("dollar-input"),l.value=c.tip>0?(c.tip/100).toFixed(2):"",l.disabled=this.getStoreValue("checkout.updating")||![],l.addEventListener("wheel",t=>{t.preventDefault()}),l.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),l.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),l.addEventListener("paste",t=>{t.preventDefault()}),l.addEventListener("contextmenu",t=>{t.preventDefault()}),l.addEventListener("input",t=>{const e=t.target;let n=e.value;if(Number.parseFloat(n)<0&&(e.value=Math.abs(Number.parseFloat(n)).toString(),n=e.value),n.includes(".")){const t=n.split(".");t.length>1&&t[1].length>2&&(e.value=t[0]+"."+t[1].substring(0,2))}}),l.addEventListener("input",t=>{const e=t.target,n=Number.parseFloat(e.value)||0;h&&clearTimeout(h),h=setTimeout(()=>{this.handleFulfillmentTipInput(c.fulfillmentId,n)},500)}),o.appendChild(s),o.appendChild(l),n.appendChild(o);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.fulfillmentId)),n.appendChild(p),t.appendChild(n),a.appendChild(t)}return t.appendChild(a),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),e=this.getFulfillmentTipInfoArray();if(t&&e.length>0){const t=e.some(t=>t.tip>0);if(t)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(n){this.logger.error("Default tip initialization failed",n),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(o){this.logger.error("Default tip initialization failed during fallback",o),this.isInitialized=![]}}template(){const t=[],e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;e.length>0&&this.initializeDefaultTip();const n=document.createElement("section");n.classList.add("checkout-tip-container");const o=document.createElement("h3");o.classList.add("checkout-sub-header"),o.textContent="Add a tip",n.appendChild(o);const s=document.createElement("div");s.classList.add("checkout-tip-config-container");const a=this.createTipSelectionButtons();s.appendChild(a),n.appendChild(s);const c=document.createElement("p");c.classList.add("checkout-tip-disclaimer"),c.textContent="Tips will be split proportionally between retailers.",n.appendChild(c);const l=this.createTipDistribution();return t.push(n,l),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 e,n;const o=t.find(t=>"checkout.giftCardError"===t.path),s=t.find(t=>"checkout.promoCodeError"===t.path),a=t.find(t=>"checkout.giftCards"===t.path);if(a&&this.updateAppliedGiftCards(a.value),o){const t=this.container.querySelector(".input-gift-card-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 e=this.createErrorElement(o.value);t.after(e)}const s=t.querySelector(".apply-button");s&&(s.disabled=Boolean(o.value))}}if(s){const t=this.container.querySelector(".input-promo-code-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()),s.value){const e=this.createErrorElement(s.value);t.after(e)}const o=t.querySelector(".apply-button");o&&(o.disabled=Boolean(s.value))}}}updateAppliedGiftCards(t){const e=t&&t.length>0;if(!e)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 e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)})}createAppliedGiftCardElement(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),e.setAttribute("data-gift-card-code",t.code);const n=document.createElement("span");n.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",e.appendChild(n);const o=document.createElement("button");return o.type="button",o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),e.appendChild(o),e}pcInputContainer(){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return t}gcInputContainer(){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_GIFT_CARDS});return t}inputContainer(){var t;const e=this.getConfigs("checkout"),n=this.getConfigs("global"),o=e.layout.allowGiftCards,s=null===(t=null==n?void 0:n.layout)||void 0===t?void 0:t.allowPromoCodes,a=document.createElement("div");a.classList.add("checkout-pc-gc-sub-container");const c=this.pcInputContainer(),l=this.gcInputContainer();s&&a.appendChild(c);const h=this.getStoreValue("checkout.promoCodeError");if(h){const t=this.createErrorElement(h);t.classList.add("promo-code-error-wrapper"),a.appendChild(t)}o&&a.appendChild(l);const p=this.getStoreValue("checkout.giftCardError");if(p){const t=this.createErrorElement(p);a.appendChild(t)}return a}createErrorElement(t){const e=document.createElement("div");e.classList.add("error-banner-checkout");const n=document.createElement("div");n.innerHTML=ErrorInfoIcon({});const o=document.createElement("p");return o.textContent=t.toString(),e.appendChild(n),e.appendChild(o),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),e.remove()},3e3),e}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const e=[];return e.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 e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)}),e.push(this.appliedGiftCardsContainer)),e}disconnected(){this.appliedGiftCardsContainer=null}}class ProductComponent extends BaseComponent{constructor(){super({watchStorePaths:["products.{productId}.loading","products.{productId}.error"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen","products.{productId}.rerender"]}),this.titleElement=null}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen"),o=t.find(t=>t.path==="products."+e+".rerender");n&&this.titleElement&&this.titleElement.classList.toggle("hide",n.value),(null==o?void 0:o.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:s.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:s.PRODUCT_LOADING});const o=n.sizes[n.selectedSizeId],a=document.createElement("div");a.classList.add("product-content-wrapper"),a.setAttribute("role","region"),a.setAttribute("aria-label",""+n.name);const c=document.createElement("div");if(c.classList.add("product-content"),c.setAttribute("role","region"),c.setAttribute("aria-label",""+n.name),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=n.name,this.titleElement=t,c.appendChild(t)}const l=ComponentFactoryService.createElement({type:s.PRODUCT_OPTIONS,productId:e});c.appendChild(l);const h=ComponentFactoryService.createElement({type:s.PRODUCT_DRAWER,productId:e});if(c.appendChild(h),a.appendChild(c),!this.config.layout.showImages||!(null===(t=n.images)||void 0===t?void 0:t.length))return a;a.classList.add("has-images");const p=ComponentFactoryService.createElement({type:s.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:o.image,productId:e});return a.prepend(p),p.setAttribute("aria-label","Product images"),a}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["engraving-form"]}beforeConnected(){var t;if(this.engravingLines=this.params.lines,"product"===this.params.context){const e=this.store.get("products."+this.params.identifier);this.fulfillmentId=e.selectedFulfillmentId,this.partNumber=(null===(t=e.selectedFulfillment)||void 0===t?void 0:t.partNumber)||null}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,e;if("product"===this.params.context){const n=this.store.get("products."+this.params.identifier),o=n.sizes[n.selectedSizeId],s=o.shippingFulfillments[this.fulfillmentId],a=s.price,c=(null===(e=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.fee)||0;return a+c}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier),e=t.unitPrice,n=t.attributes.engraving.fee||0;return e+n}return 0}productInformationSection(){const t=[];let e="",n="";if("product"===this.params.context){const o=this.store.get("products."+this.params.identifier);o.mainImage?t.push(o.mainImage):t.push(...o.images||[]),e=o.name,n=o.sizes[o.selectedSizeId].size}if("cart"===this.params.context){const o=this.store.get("cart.items."+this.params.identifier);o.mainImage&&t.push(o.mainImage),e=o.name,n=o.size}const o=document.createElement("div");if(o.className="product-info-section",t.length>0){const n=document.createElement("div");n.className="product-image-container";const s=document.createElement("img");s.src=t[0],s.alt=e,s.loading="lazy",s.className="product-image",n.appendChild(s),o.appendChild(n)}const s=document.createElement("div");s.className="product-details-container";const a=document.createElement("div");a.className="product-header";const c=document.createElement("h4");c.className="product-title",c.textContent=e,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),a.appendChild(c),a.appendChild(this.productPriceSpan),s.appendChild(a);const l=document.createElement("p");l.className="product-size-text",l.textContent=n,s.appendChild(l);const h=document.createElement("p");return h.className="engraving-fees-disclaimer",h.textContent="Personalization fees included in total, varies by retailer.",s.appendChild(h),o.appendChild(s),o}addToCartButtonText(t){if("product"!==this.params.context)return"Save";const e=this.getConfigs("product"),n=e.layout.addToCartButtonText;return e.layout.addToCartButtonShowTotalPrice?n+" - "+formatCentToDollarText(t):n}retailersSection(){var t,e,n,o,s,a,c;const l=this.store.get("products."+this.params.identifier),h=l.sizes[l.selectedSizeId],p=objectValues(h.shippingFulfillments).filter(t=>t.isVariantEngravable&&t.canEngrave),m=document.createElement("div");m.className="fulfillment-section";const f=document.createElement("p");if(f.className="shipping-from-text",f.innerHTML="Shipping from: <b>"+(null===(t=l.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",m.appendChild(f),1===p.length)return m;const v=document.createElement("div");v.className="fulfillment-options-container",m.appendChild(v);const b=document.createElement("span");b.className="see-more-fulfillments",b.textContent="See More Delivery Options ("+p.length+")",b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.setAttribute("aria-label","See More Delivery Options ("+p.length+")"),b.setAttribute("aria-expanded","false");const z=()=>{const t=v.classList.contains("expanded");v.classList.toggle("expanded"),t?(b.textContent="See More Delivery Options ("+p.length+")",b.setAttribute("aria-label","See More Delivery Options ("+p.length+")"),b.setAttribute("aria-expanded","false")):(b.textContent="See Less Delivery Options",b.setAttribute("aria-label","See Less Delivery Options"),b.setAttribute("aria-expanded","true"))};b.addEventListener("click",z),b.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),z())}),m.appendChild(b);for(const x of p){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",x.fulfillmentId),x.fulfillmentId===(null===(e=l.selectedFulfillment)||void 0===e?void 0:e.fulfillmentId)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+x.retailerName+", "+formatCentToDollarText(x.price+((null===(o=null===(n=l.sizes[l.selectedSizeId].attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.fee)||0))+", "+x.expectation.engraving),t.setAttribute("aria-pressed",x.fulfillmentId===(null===(s=l.selectedFulfillment)||void 0===s?void 0:s.fulfillmentId)?"true":"false");const u=()=>{this.fulfillmentId=x.fulfillmentId,this.partNumber=x.partNumber;const e=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(e),this.productPriceSpan.textContent=formatCentToDollarText(e);const n=v.querySelector(".fulfillment-option.selected");n&&(n.classList.remove("selected"),n.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),f.innerHTML="Shipping from: <b>"+x.retailerName+"</b>"};t.addEventListener("click",u),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),u())});const h=x.price+((null===(c=null===(a=l.sizes[l.selectedSizeId].attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.fee)||0),p=document.createElement("div");p.className="option-row row-1",t.appendChild(p);const m=document.createElement("span");m.className="retailer-name",m.textContent=x.retailerName,p.appendChild(m);const b=document.createElement("span");b.className="fulfillment-price",b.textContent=formatCentToDollarText(h),p.appendChild(b),t.appendChild(p);const w=document.createElement("div");w.className="option-row row-2",t.appendChild(w);const C=document.createElement("span");C.className="estimated-time",C.textContent=""+x.expectation.engraving,w.appendChild(C),t.appendChild(w),v.appendChild(t)}return m}engravingLinesSection(){var t;const{lines:e,maxLines:n,location:o,maxCharsPerLine:s}=this.params,a=document.createElement("div");a.className="engraving-section";const c=document.createElement("p");if(c.className="engraving-title",c.textContent="Personalize Your Bottle",a.appendChild(c),o&&(null===(t=null==o?void 0:o.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-location-text",t.textContent="Your message will appear "+o.toLowerCase()+".",a.appendChild(t)}const l=Array.from({length:n},(t,n)=>{const o=n+1,a=document.createElement("div");a.className="engraving-input-wrapper",a.setAttribute("data-line-number",o.toString());const c=document.createElement("input");c.type="text",c.id="engraving-line-"+o,c.dataset.lineNumber=o.toString(),c.maxLength=s,c.value=e[n]||"",c.placeholder=o>1?"Line "+o+" (optional)":"Line "+o,c.className="engraving-input",c.autocomplete="off",c.setAttribute("aria-label",o>1?"Engraving line "+o+", optional, maximum "+s+" characters":"Engraving line "+o+", maximum "+s+" characters");const l=document.createElement("span");return l.className="engraving-char-count",l.textContent=c.value.length+"/"+s,l.setAttribute("aria-live","polite"),l.setAttribute("aria-atomic","true"),c.addEventListener("input",()=>{l.textContent=c.value.length+"/"+s,this.engravingLines[n]=c.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),a.appendChild(c),a.appendChild(l),a}),h=document.createElement("div");return h.className="engraving-inputs-container",h.append(...l),a.appendChild(h),a}actionButtonsSection(){const{identifier:t,context:e}=this.params,n=document.createElement("div");n.className="action-buttons-container";const o=document.createElement("button");o.type="button",o.className="cancel-action-button",o.textContent="Cancel",o.setAttribute("aria-label","Cancel personalization and close");const y=async()=>{"product"===e&&await this.commands.product.closeProductDrawer(t),"cart"===e&&this.commands.ui.openDrawer(s.CART)};o.addEventListener("click",y),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),n.appendChild(o),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===e?"Add personalized item to cart":"Update personalization and return to cart");const X=async()=>{const n=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);if("product"===e&&this.fulfillmentId&&this.partNumber){const e=this.store.get("products."+t);await this.commands.product.addToCart(t,{upc:e.sizes[e.selectedSizeId].upc,fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:n,identifier:t}),await this.commands.product.closeProductDrawer(t)}"cart"===e&&(await this.commands.cart.updateItemEngraving(t,n),this.commands.ui.openDrawer(s.CART))};return this.addToCartButton.addEventListener("click",X),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),X())}),n.appendChild(this.addToCartButton),n}template(){const t=[],e=this.productInformationSection();if(t.push(e),"product"===this.params.context){const e=this.retailersSection();t.push(e)}const n=this.engravingLinesSection();t.push(n);const o=this.actionButtonsSection();t.push(o);const s=document.createElement("p");return s.className="engraving-disclaimer",s.innerHTML="Personalized orders require up to 10 business days to be processed and then shipped. Tracking information will be provided once processed. <b>Personalized bottle orders cannot be cancelled.</b>",t.push(s),t}}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 e=this.getStoreValue("cart.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,o=(null==e?void 0:e.quantity)||1;return{quantity:o,fee:n,total:n*o}}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,o=(null==e?void 0:e.quantity)||1;return{quantity:o,fee:n,total:n*o}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,e,n,o,a,c,l,h,p,m,f,v,b,x,w,C,k,S,E,T;const I=this.params.identifier,P={identifier:I,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const s=this.getStoreValue("cart.items."+I);P.lines=(null===(e=null===(t=null==s?void 0:s.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.lines)||[],P.maxLines=(null===(o=null===(n=null==s?void 0:s.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.maxLines)||1,P.maxCharsPerLine=(null===(c=null===(a=null==s?void 0:s.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.maxCharsPerLine)||16,P.fee=(null===(h=null===(l=null==s?void 0:s.attributes)||void 0===l?void 0:l.engraving)||void 0===h?void 0:h.fee)||0,P.location=(null===(m=null===(p=null==s?void 0:s.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+I);P.lines=(null===(v=null===(f=null==t?void 0:t.attributes)||void 0===f?void 0:f.engraving)||void 0===v?void 0:v.lines)||[],P.maxLines=(null===(x=null===(b=null==t?void 0:t.attributes)||void 0===b?void 0:b.engraving)||void 0===x?void 0:x.maxLines)||1,P.maxCharsPerLine=(null===(C=null===(w=null==t?void 0:t.attributes)||void 0===w?void 0:w.engraving)||void 0===C?void 0:C.maxCharsPerLine)||16,P.fee=(null===(S=null===(k=null==t?void 0:t.attributes)||void 0===k?void 0:k.engraving)||void 0===S?void 0:S.fee)||0,P.location=(null===(T=null===(E=null==t?void 0:t.attributes)||void 0===E?void 0:E.engraving)||void 0===T?void 0:T.location)||""}this.commands.ui.openDrawer(s.ENGRAVING_FORM,P)}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(),e=this.engravingLines();if(0===e.length)return"";const n=document.createElement("div");n.className="engraving-header";const o=document.createElement("h3");o.textContent="Personalization";const s=document.createElement("span");if(s.className="engraving-fee",1===t.quantity&&(s.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){s.textContent=formatCentToDollarText(t.total,![]);const e=document.createElement("span");e.className="engraving-fee-each",e.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",s.appendChild(e)}n.appendChild(o),n.appendChild(s);const a=document.createElement("div");a.className="engraving-body";const c=document.createElement("div");c.className="engraving-lines";for(const p of e){const t=document.createElement("span");t.className="engraving-line",t.textContent=p,c.appendChild(t)}const l=document.createElement("div");l.className="engraving-actions";const h=document.createElement("button");h.type="button",h.classList.add("remove-button"),h.textContent="Remove",h.setAttribute("aria-label","Remove engraving");const U=async()=>{await this.handleRemove()};if(h.addEventListener("click",U),h.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await U())}),l.appendChild(h),"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())}),l.appendChild(t)}return a.appendChild(c),a.appendChild(l),[n,a]}}function fulfillmentAddress(t,e){if(!t)return"";if(e===a.SHIPPING){const e=[t.city,t.state].filter(Boolean);return e.join(", ")}const n=[t.one,t.two,t.city,t.state].filter(Boolean);return n.join(", ")}const yt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],bt=1440;function timeToMinutes(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new Error("Invalid time format: "+t);const n=Number.parseInt(e[1],10),o=Number.parseInt(e[2],10);if(n<0||n>47||o<0||o>59)throw new Error("Invalid time values: "+t);return 60*n+o}function getCurrentTimeInTimezone(t){var e,n,o;const s=new Date,a={timeZone:t,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const t=new Intl.DateTimeFormat("en-US",a),c=t.formatToParts(s),l=(null===(e=c.find(t=>"weekday"===t.type))||void 0===e?void 0:e.value.toLowerCase())||"",h=(null===(n=c.find(t=>"hour"===t.type))||void 0===n?void 0:n.value)||"0",p=(null===(o=c.find(t=>"minute"===t.type))||void 0===o?void 0:o.value)||"0",m=60*Number.parseInt(h,10)+Number.parseInt(p,10);return{weekday:l,timeInMinutes:m}}catch(c){throw new Error("Invalid timezone: "+t)}}function format24TimeTo12(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e||"object"==typeof e)return t;let n=Number.parseInt(e[1],10);const o=e[2];n>=24&&(n-=24);const s=n>=12?"PM":"AM",a=0===n?12:n>12?n-12:n;return a+":"+o+" "+s}function isWithinTimeSlot(t,e){try{const n=timeToMinutes(e.startsAt),o=timeToMinutes(e.endsAt);if(o>bt){if(t>=n||t<o-bt)return"during"}else if(o<n){if(t>=n||t<o)return"during"}else if(t>=n&&t<o)return"during";return t<n?"before":"after"}catch(n){return"after"}}function getNextOpeningTime(t,e,n=7){var o,s;const a=yt.indexOf(e);for(let l=1;l<=n;l++){const e=(a+l)%7,n=yt[e],h=t[n];if((null==h?void 0:h.active)&&h.times&&h.times.length>0)try{const t=1===l?"tomorrow":n;return"Opens "+t+" at "+format24TimeTo12(null!==(s=null===(o=null==h?void 0:h.times[0])||void 0===o?void 0:o.startsAt)&&void 0!==s?s:"")}catch(c){}}return null}function validateFulfillmentData(t){return t&&"object"==typeof t&&t.hours&&t.timezone?"string"!=typeof t.timezone?![]:!![]:![]}function getRetailerOffHours(t){var e;if(!(null==t?void 0:t.type)||(null==t?void 0:t.type)!==a.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(t))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:n,timeInMinutes:o}=getCurrentTimeInTimezone(t.timezone),s=t.hours[n];if(!(null==s?void 0:s.active)||!(null===(e=s.times)||void 0===e?void 0:e.length)){const e=getNextOpeningTime(t.hours,n);return{message:e,isOpen:![],isClosed:!![]}}for(const t of s.times){const e=isWithinTimeSlot(o,t);switch(e){case"before":return{message:"Opens at "+format24TimeTo12(t.startsAt),isOpen:![],isClosed:!![],openTime:t.startsAt,closeTime:t.endsAt};case"during":{let e=t.endsAt;const n=timeToMinutes(e);if(n>bt){const t=Math.floor(n/60)-24,o=n%60;e=t.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(e),isOpen:!![],isClosed:![],openTime:t.startsAt,closeTime:t.endsAt}}}}const a=getNextOpeningTime(t.hours,n);return{message:a,isOpen:![],isClosed:!![]}}catch(n){return{message:null,isOpen:![],isClosed:!![]}}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,fulfillmentStatus:o,selectedSizeAttributes:s}){var c,l,h,p,m;let f=0;const v=null==s?void 0:s.presale,b=(null==v?void 0:v.isActive)&&(null==v?void 0:v.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(v.estimatedShipBy):"",x=e===a.SHIPPING,w=e===a.ON_DEMAND;x&&(f=(null===(l=null===(c=null==t?void 0:t.fees)||void 0===c?void 0:c.individual)||void 0===l?void 0:l.fee)||0),w&&(f=(null===(h=null==t?void 0:t.fees)||void 0===h?void 0:h.fee)||0);const C=fulfillmentAddress(t.retailerAddress,e);let k=null;e===a.ON_DEMAND&&o.openTime&&(null==o?void 0:o.closeTime)&&(k=o.isOpen?"Closes at "+format24TimeTo12$1(null==o?void 0:o.closeTime):"Opens at "+format24TimeTo12$1(null==o?void 0:o.openTime));const S=e===a.ON_DEMAND&&o&&o.isClosed?"closed":"",E=document.createElement("div");E.className="popup-retailer-card "+(n?"selected":"")+" "+S,E.setAttribute("data-fulfillment-id",t.fulfillmentId),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.setAttribute("aria-pressed",n?"true":"false");const T=e===a.SHIPPING?"Shipping":"Same-day delivery";E.setAttribute("aria-label",T+" from "+t.retailerName+", "+formatCentToDollarText(null!==(p=t.price)&&void 0!==p?p:0));const I=document.createElement("div");I.className="row";const P=document.createElement("span");P.className="name",P.textContent=t.retailerName,I.appendChild(P);const F=document.createElement("span");F.className="price",F.textContent=formatCentToDollarText(null!==(m=t.price)&&void 0!==m?m:0),I.appendChild(F),E.appendChild(I);const D=document.createElement("div");D.className="row";const _=document.createElement("span");_.className="expectation",_.textContent=o.isClosed?k:(null==v?void 0:v.isActive)?b:(null==t?void 0:t.expectation.detail)||"No expectation available",D.appendChild(_);const O=document.createElement("span");if(O.className="fee",O.textContent=f>0?formatCentToDollarText(f):"Free Delivery",D.appendChild(O),E.appendChild(D),w){const t=document.createElement("div");t.className="row";const e=document.createElement("span");e.className="address",e.textContent=C,t.appendChild(e),E.appendChild(t)}return E}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:e,shippingSelected:n,onDemandSelected:o,onTabClick:s,enableShippingFulfillment:c,enableOnDemandFulfillment:l}){const h=e.length>0,p=document.createElement("div");if(p.className="fulfillment-tabs-container",p.setAttribute("role","tablist"),p.setAttribute("aria-label","Delivery method options"),c){const e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",a.SHIPPING),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",n?"true":"false"),e.setAttribute("aria-label","Shipping, "+t.length+" options"),e.addEventListener("click",s),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())});const o=document.createElement("span");o.className="fulfillment-tab-label "+(n?"selected":""),o.textContent="Shipping ("+t.length+")",e.appendChild(o),p.appendChild(e)}if(l){const t=document.createElement("div");t.className="fulfillment-tab "+(o?"selected":"")+" "+(h?"":"disabled"),t.setAttribute("data-fulfillment-type",a.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",o?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+e.length+" options"),h||t.setAttribute("aria-disabled","true"),t.addEventListener("click",s),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())});const n=document.createElement("span");n.className="fulfillment-tab-label "+(o?"selected":""),n.textContent="Same-Day Delivery ("+e.length+")",t.appendChild(n),p.appendChild(t)}return p}class ProductAddToCartSectionComponent extends BaseComponent{get hostClasses(){return["add-to-cart-container"]}get hostAttributes(){return{role:"region","aria-live":"polite","aria-atomic":"false","aria-label":"Add to cart section"}}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment||!n.selectedSizeId)return 0;const o=n.selectedFulfillment.partNumber,s=n.selectedFulfillment.fulfillmentId,a=null===(t=n.sizes[n.selectedSizeId].attributes)||void 0===t?void 0:t.maxQuantityPerOrder;if(!a)return 0;const c=this.getStoreValue("cart.items")||{},l=Object.values(c).filter(t=>t.partNumber===o&&t.fulfillmentId===s),h=l.reduce((t,e)=>t+e.quantity,0);return a-h}isFulfillmentClosed(){const t=this.getProductId(),e=this.getStoreValue("products."+t);if(!e.selectedFulfillment)return![];const n=getRetailerOffHours(e.selectedFulfillment);return e.selectedFulfillmentType===a.ON_DEMAND&&n&&n.isClosed}isButtonLoading(){const t=this.getProductId();return this.getStoreValue("products."+t+".updating")}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),e=this.getAvailableQuantity(),n=t<e;return{currentQuantity:t,availableQuantity:e,canIncrease:n,canDecrease:t>1}}async handleAddToCart(){var t,e,n;const o=this.getProductId(),s=this.getStoreValue("products."+o);if(!s.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:o,selectedSizeId:s.selectedSizeId}),void 0;const a=this.getSizeAttributes(),c=(null===(t=null==a?void 0:a.presale)||void 0===t?void 0:t.isActive)===!![],l=this.isPresaleActive(a);c&&l?await this.commands.product.addPresaleToCart(o,{upc:s.sizes[s.selectedSizeId].upc,fulfillmentId:s.selectedFulfillment.fulfillmentId,partNumber:null===(e=s.selectedFulfillment)||void 0===e?void 0:e.partNumber,quantity:s.quantity,identifier:o}):await this.commands.product.addToCart(o,{upc:s.sizes[s.selectedSizeId].upc,fulfillmentId:s.selectedFulfillment.fulfillmentId,partNumber:null===(n=s.selectedFulfillment)||void 0===n?void 0:n.partNumber,quantity:s.quantity,identifier:o})}async handleQuantityChange(t){const e=this.getProductId();await this.commands.product.updateQuantity(e,t)}calculateTotalPrice(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=e.selectedFulfillment,o=n.price*e.quantity;return{quantity:e.quantity,totalPrice:o}}createQuantityContainer(t){const e=this.calculateQuantityLimits(),n=document.createElement("div");return n.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!e.canDecrease).toString()),e.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=e.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+e.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!e.canIncrease).toString()),e.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantityText),n.appendChild(this.qtyIncreaseButton),n}getSizeAttributes(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".selectedSizeId"),n=this.getStoreValue("products."+t+".sizes."+e);return(null==n?void 0:n.attributes)||{}}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:e}=this.calculateTotalPrice(),n=this.getSizeAttributes(),o=this.calculateQuantityLimits(),s=(null===(t=null==n?void 0:n.presale)||void 0===t?void 0:t.isActive)===!![],a=this.isPresaleActive(n),c=s?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?c+" - "+formatCentToDollarText(e):c;const l=s&&!a||0===o.availableQuantity||this.isFulfillmentClosed(),h=this.isButtonLoading(),p=this.config.layout.addToCartButtonShowTotalPrice?c+" for "+formatCentToDollarText(e):c;return this.addToCartButton.setAttribute("aria-label",p),this.addToCartButton.setAttribute("aria-busy",h.toString()),this.addToCartButton.setAttribute("aria-disabled",l.toString()),l&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),h&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async t=>{if(t.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),n=this.getConfigs("configurations");if(!e||!n.isElementsEnabled)return[];const o=[],s=this.config.layout.showQuantityCounter;if(s){const t=this.config.layout.quantityCounterStyle,e=this.createQuantityContainer(t);o.push(e)}const a=this.createAddToCartButton();return o.push(a),o}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const t=this.params.productId,e=this.getStoreValue("products."+t+".description"),n=this.getStoreValue("products."+t+".htmlDescription"),o="About this product:",s="See More",a="See Less",c=document.createElement("h3");c.className="title",c.textContent=o;const l=document.createElement("div");l.className="content collapsed",l.innerHTML=""===(null==n?void 0:n.trim())?e:sanitizeHTML(n);const h=document.createElement("span");h.className="collapse-button",h.textContent=s,h.setAttribute("role","button"),h.setAttribute("tabindex","0"),h.setAttribute("aria-label","Show more product information"),h.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,l.classList.toggle("collapsed"),h.textContent=this.isCollapsed?s:a,h.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),h.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return h.addEventListener("click",toggleContent),h.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[c,l,h]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(t){var e;const n=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!n)return![];const o=n.value,s=o.isOpen,a=null===(e=o.contentConfig)||void 0===e?void 0:e.type,c=a!==this.currentContentType;return s&&!this.isOpen?(this.currentContentType=a,this.openWithContent(o),![]):s&&this.isOpen&&!c?![]:s&&this.isOpen&&c?(this.currentContentType=a,this.openWithContent(o),![]):!s&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const e=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:e}),void 0;const{type:n,data:o}=t||{},s=ComponentFactoryService.createElement({type:n,...o});this.contentContainer&&this.contentContainer.appendChild(s),this.open()}catch(n){this.logger.error("Failed to open product drawer",n),this.commands.product.closeProductDrawer(e)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay;return["product-image-carousel",t]}constructor(){super({watchOnlyStorePaths:["products.{productId}.mainImage"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){const e=this.params.productId,n=t.find(t=>t.path==="products."+e+".mainImage");if(null==n?void 0:n.value){const t=this.params.images.indexOf(null==n?void 0:n.value);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+n.value+"')")}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let e=0;e<this.thumbnails.length;e++){const t=this.thumbnails[e];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(e)})}const t=this.container.querySelectorAll(".carousel-dot");for(let e=0;e<t.length;e++){const n=t[e];n.addEventListener("click",()=>this.selectImage(e))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var e,n;if(t<0||t>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[t]+"')",this.mainImageElement.title="Product image "+(t+1)),null===(e=this.thumbnails[this.currentImageIndex])||void 0===e||e.classList.remove("selected"),null===(n=this.thumbnails[t])||void 0===n||n.classList.add("selected");const o=this.container.querySelectorAll(".carousel-dot");for(let s=0;s<o.length;s++){const e=o[s];e.classList.toggle("active",s===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const e=this.thumbnails[t],n=this.galleryViewport.offsetWidth,o=e.offsetLeft+e.offsetWidth/2,s=n/2,a=s-o,c=0,l=-(this.galleryContainer.scrollWidth-n);this.translateX=Math.max(l,Math.min(c,a)),this.updateTransform(!![])}setupMainImageSwipe(){var t,e;let n=0,o=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{n=t.touches[0].clientX,o=t.touches[0].clientY},{passive:!![]}),null===(e=this.mainImageElement)||void 0===e||e.addEventListener("touchend",t=>{const e=t.changedTouches[0].clientX-n,s=t.changedTouches[0].clientY-o;Math.abs(e)>Math.abs(s)&&Math.abs(e)>50&&(e>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const t of this.galleryContainer.querySelectorAll("img"))t.addEventListener("dragstart",t=>t.preventDefault())}}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const o=this.currentTranslateX+n,s=0,a=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(a,Math.min(s,o)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const t=[],e=this.params.images.length>1,n=document.createElement("div");if(n.className="main-image",n.title="Product main image",n.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",e){const t=document.createElement("div");t.className="carousel-dots";for(let e=0;e<this.params.images.length;e++){const n=document.createElement("button");n.type="button",n.className="carousel-dot "+(0===e?"active":""),n.setAttribute("data-index",e.toString()),t.appendChild(n)}n.appendChild(t)}this.mainImageElement=n,t.push(n);const o=document.createElement("div");o.className="gallery-viewport";const s=document.createElement("div");s.className="gallery-container";for(let a=0;a<this.params.images.length;a++){const t=this.params.images[a],e=document.createElement("div");e.className="gallery-image-wrapper "+(0===a?"selected":"");const n=document.createElement("img");n.src=t,n.className="gallery-image",n.alt="Product thumbnail "+(a+1),n.loading="lazy",e.appendChild(n),s.appendChild(e)}return o.appendChild(s),t.push(o),t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var e,n,o,s;const c=this.getProductId();if(!t.some(t=>t.path==="products."+c+".selectedFulfillmentType"))return;const l=this.getStoreValue("products."+c),h=l.sizes[l.selectedSizeId],p=this.getConfigs("global");this.addPersonalizationSpan&&(l.selectedFulfillmentType===a.SHIPPING&&p.layout.enablePersonalization&&l.productHasAvailability&&(null===(n=null===(e=null==h?void 0:h.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.status)===!![]&&(null===(o=null==l?void 0:l.selectedFulfillment)||void 0===o?void 0:o.isVariantEngravable)===!![]&&(null===(s=null==l?void 0:l.selectedFulfillment)||void 0===s?void 0:s.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),e=this.container.querySelectorAll("[select-size]");for(const n of e){const o=n.textContent||"",s=n.classList.contains("selected");n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select "+o),n.setAttribute("aria-pressed",s?"true":"false"),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),n.addEventListener("click",async()=>{var o,s,a,c;const l=n.dataset.sizeId;if(!l)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:n.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,l);for(const t of e)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");n.classList.add("selected"),n.setAttribute("aria-pressed","true");const h=this.getStoreValue("products."+t),p=h.sizes[l],m=this.getConfigs("global");this.addPersonalizationSpan&&(m.layout.enablePersonalization&&(null===(s=null===(o=null==p?void 0:p.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.status)===!![]&&h.productHasAvailability&&(null===(a=h.selectedFulfillment)||void 0===a?void 0:a.isVariantEngravable)===!![]&&(null===(c=h.selectedFulfillment)||void 0===c?void 0:c.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,e){const n=document.createElement("div");n.className="size-container";const o=document.createElement("h3");o.className="size-label",o.textContent="Size",o.id="size-label",n.appendChild(o);const s=document.createElement("div");s.className="size-buttons-container",s.setAttribute("role","group"),s.setAttribute("aria-labelledby","size-label");for(const a of Object.values(e)){const e=document.createElement("span");e.setAttribute("data-size-id",a.id),e.setAttribute("select-size",""),e.className="size-button "+(a.id===t?"selected":"");const n=a.packDesc?" ("+a.packDesc+")":"";e.textContent=""+a.size+n,s.appendChild(e)}return n.appendChild(s),n}hasIndependentAddressComponent(){var t;return(null===(t=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===t?void 0:t.length)>0}template(){var t,e,n,o;const a=this.getProductId(),c=this.getStoreValue("products."+a),l=c.sizes[c.selectedSizeId],h=this.getConfigs("global"),p=[],m=document.createElement("div");m.className="price-personalization-container";const f=ComponentFactoryService.createElement({type:s.PRODUCT_PRICE,productId:a});if(m.appendChild(f),h.layout.enablePersonalization&&c.productHasAvailability&&(null===(e=null===(t=null==l?void 0:l.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.status)===!![]&&(null===(n=null==c?void 0:c.selectedFulfillment)||void 0===n?void 0:n.canEngrave)===!![]&&(null===(o=null==c?void 0:c.selectedFulfillment)||void 0===o?void 0:o.isVariantEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var t,e,n,o,l,h,p,m;const f=c.sizes[c.selectedSizeId];await this.commands.product.openProductDrawer(a,s.ENGRAVING_FORM,{identifier:a,context:"product",lines:[],maxLines:(null===(e=null===(t=f.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.maxLines)||1,maxCharsPerLine:(null===(o=null===(n=f.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.maxCharsPerLine)||16,fee:(null===(h=null===(l=f.attributes)||void 0===l?void 0:l.engraving)||void 0===h?void 0:h.fee)||0,location:null===(m=null===(p=f.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),m.appendChild(this.addPersonalizationSpan)}p.push(m);const v=this.renderProductSizes(c.selectedSizeId,c.sizes);if(p.push(v),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:s.ADDRESS_DISPLAY,productId:a});p.push(t)}const b=ComponentFactoryService.createElement({type:s.PRODUCT_RETAILERS,productId:a});p.push(b);const x=ComponentFactoryService.createElement({type:s.PRODUCT_ADD_TO_CART_SECTION,productId:a});if(p.push(x),this.config.layout.showDescription){const t=ComponentFactoryService.createElement({type:s.PRODUCT_DESCRIPTION,productId:a});p.push(t)}return p}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen");if(n){const t=n.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),e=this.getStoreValue("address.formattedAddress");if(e)return ComponentFactoryService.createElement({type:s.PRODUCT_INTERACTIONS,productId:this.getProductId()});const n=document.createElement("button");return n.type="button",n.className="product-options-open-address-button",n.textContent=this.config.layout.buyNowButtonText,n.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,s.ADDRESS_INPUT,{productId:t})}),n}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);let o=(null===(t=n.priceInfo)||void 0===t?void 0:t.avg)||0;return n.selectedFulfillment&&(o=n.selectedFulfillment.price),formatCentToDollarText(o)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getConfigs("product"),o=[],a=this.getConfigs("configurations");if(!e.productHasAvailability||!a.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.textContent="We're sorry, this product is not at nearby vendors and unavailable to ship to your state.",o.push(t),o}const c="carousel"===n.layout.fulfillmentDisplay?s.PRODUCT_RETAILERS_CAROUSEL:s.PRODUCT_RETAILERS_POPUP,l=ComponentFactoryService.createElement({type:c,productId:t});return o.push(l),o}}const xt="This product is currently unavailable to ship to your location.",wt="Same-day delivery is currently unavailable for your location.";class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const t=this.retailerCards.findIndex(t=>t.classList.contains("selected"));-1!==t&&this.scrollToIndex(t)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".selectedFulfillmentId");(null==n?void 0:n.value)&&this.updateSelectedCard(n.value)}updateSelectedCard(t){for(const n of this.retailerCards)n.classList.remove("selected"),n.setAttribute("aria-pressed","false");const e=this.retailerCards.findIndex(e=>e.dataset.fulfillmentId===t);-1!==e&&(this.retailerCards[e].classList.add("selected"),this.retailerCards[e].setAttribute("aria-pressed","true"),this.scrollToIndex(e))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const e=this.retailerCards[t],n=this.listViewport.offsetWidth,o=e.offsetLeft+e.offsetWidth/2,s=n/2,a=s-o,c=0,l=-(this.listContainer.scrollWidth-n);this.translateX=Math.max(l,Math.min(c,a)),this.updateTransform(!![])}setupDrag(){this.listContainer&&(this.listContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.listContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this)))}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.listViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const o=this.currentTranslateX+n,s=0,a=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(a,Math.min(s,o)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.listContainer&&(this.listContainer.style.transition=t?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){if(this.hasMoved)return;const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const o=this.getStoreValue("products."+e+".selectedFulfillment");if(o&&o.fulfillmentId===n)return this.logger.debug("Product retailer selection skipped: Same fulfillment already selected",{productId:e,fulfillmentId:n}),void 0;await this.commands.product.selectFulfillment(e,n)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,fulfillmentStatus:o,selectedSizeAttributes:s}){var c,l,h,p,m;let f=0;const v=null==s?void 0:s.presale,b=(null==v?void 0:v.isActive)&&(null==v?void 0:v.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(v.estimatedShipBy):"",x=e===a.SHIPPING,w=e===a.ON_DEMAND;x&&(f=(null===(l=null===(c=null==t?void 0:t.fees)||void 0===c?void 0:c.individual)||void 0===l?void 0:l.fee)||0),w&&(f=(null===(h=null==t?void 0:t.fees)||void 0===h?void 0:h.fee)||0);const C=fulfillmentAddress(t.retailerAddress,e);let k=null;e===a.ON_DEMAND&&o.openTime&&(null==o?void 0:o.closeTime)&&(k=o.isOpen?"Closes at "+format24TimeTo12$1(null==o?void 0:o.closeTime):"Opens at "+format24TimeTo12$1(null==o?void 0:o.openTime));const S=e===a.ON_DEMAND&&o&&o.isClosed?"closed":"",E=document.createElement("div");E.className="carousel-retailer-card "+(n?"selected":"")+" "+S,E.setAttribute("data-fulfillment-id",t.fulfillmentId),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.setAttribute("aria-pressed",n?"true":"false");const T=e===a.SHIPPING?"Shipping":"Same-day delivery";E.setAttribute("aria-label",T+" from "+t.retailerName+", "+formatCentToDollarText(null!==(p=t.price)&&void 0!==p?p:0));const I=document.createElement("div");I.className="retailer-header";const P=document.createElement("h3");if(P.className="name",P.textContent=t.retailerName,I.appendChild(P),w){const t=document.createElement("h3");t.className="address",t.textContent=C,I.appendChild(t)}const F=document.createElement("div");F.className="retailer-body";const D=document.createElement("span");D.className="product-price",D.textContent=formatCentToDollarText(null!==(m=t.price)&&void 0!==m?m:0);const _=document.createElement("span");_.className="shipping-price",_.textContent=f>0?"+ "+formatCentToDollarText(f):"FREE Delivery";const O=document.createElement("span");return O.className="expectation",O.textContent=o.isClosed?k:(null==v?void 0:v.isActive)?b:(null==t?void 0:t.expectation.detail)||"No expectation available",F.append(D,_,O),E.append(I,F),E}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),o=(null==n?void 0:n.attributes)||null,s=this.config.layout.enableShippingFulfillment,c=this.config.layout.enableOnDemandFulfillment,l=[];for(const a in n.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(n.shippingFulfillments,a)){const t=n.shippingFulfillments[a],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;l.push(t)}const h=[];for(const a in n.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,a)){const t=n.onDemandFulfillments[a],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;h.push(t)}const p=e.selectedFulfillmentType===a.SHIPPING,m=e.selectedFulfillmentType===a.ON_DEMAND,f=p?l:h,v=renderFulfillmentTabsContainer({shippingFulfillments:l,onDemandFulfillments:h,shippingSelected:p,onDemandSelected:m,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:s,enableOnDemandFulfillment:c});if(!e.fulfillmentHasAvailability||0===f.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.textContent=p?xt:wt,[v,t]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const b of f){const t=getRetailerOffHours(b),n=this.generateRetailerCard({fulfillment:b,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:b.fulfillmentId===e.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:o}),s=e.selectedFulfillmentType===a.ON_DEMAND&&t&&t.isClosed;s?n.setAttribute("aria-disabled","true"):(n.addEventListener("click",this.onRetailerCardClick.bind(this)),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())})),this.listContainer.appendChild(n)}return this.listViewport.appendChild(this.listContainer),[v,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),o=(null==n?void 0:n.attributes)||null,c=this.config.layout.enableShippingFulfillment,l=this.config.layout.enableOnDemandFulfillment,h=Object.values(n.shippingFulfillments),p=Object.values(n.onDemandFulfillments),m=(c?h.length:0)+(l?p.length:0),f=document.createElement("div");f.className="header";const v=document.createElement("span");v.className="header-label",v.textContent=e.selectedFulfillmentType===a.SHIPPING?"Shipping From:":"Delivering From:";const b=document.createElement("button");if(b.className="delivery-options",b.type="button",b.textContent="See Delivery Options ("+m+")",b.setAttribute("aria-label","View all "+m+" delivery options"),b.addEventListener("click",async()=>{0!==m&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(s.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,s.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),f.appendChild(v),f.appendChild(b),!e.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.textContent=e.selectedFulfillmentType===a.SHIPPING?xt:wt,[f,t]}const x=document.createElement("div");x.className="popup-fulfillment-list-container";const w=getRetailerOffHours(e.selectedFulfillment),C=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],fulfillmentStatus:w,selectedSizeAttributes:o});return x.appendChild(C),[f,x]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const d=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(e),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},o=this.getStoreValue("products."+e+".selectedFulfillment");if(o&&o.fulfillmentId===n)return await d(),void 0;await this.commands.product.selectFulfillment(e,n),await d()}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),o=(null==n?void 0:n.attributes)||null,s=this.config.layout.enableShippingFulfillment,c=this.config.layout.enableOnDemandFulfillment,l=[];for(const a in n.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(n.shippingFulfillments,a)){const t=n.shippingFulfillments[a],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;l.push(t)}const h=[];for(const a in n.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,a)){const t=n.onDemandFulfillments[a],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;h.push(t)}const p=e.selectedFulfillmentType===a.SHIPPING,m=e.selectedFulfillmentType===a.ON_DEMAND,f=p?l:h,v=document.createElement("h5");v.className="popup-retailers-section-title",v.textContent="Delivery Options";const b=renderFulfillmentTabsContainer({shippingFulfillments:l,onDemandFulfillments:h,shippingSelected:p,onDemandSelected:m,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:s,enableOnDemandFulfillment:c});if(!e.fulfillmentHasAvailability||0===f.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.textContent=p?xt:wt,[v,b,t]}const x=document.createElement("div");x.className="popup-fulfillment-list-container";for(const a of f){const t=getRetailerOffHours(a),n=renderPopupRetailerCard({fulfillment:a,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:a.fulfillmentId===e.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:o});n.addEventListener("click",this.onRetailerCardClick.bind(this)),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),x.appendChild(n)}return[v,b,x]}}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,e;const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],o=null!==(e=this.params.showFirstEvent)&&void 0!==e?e:!![];if(n){const t=this.store.get(this.params.errorStorePath)||[],e=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return o?e.slice(0,1):e}const s=this.store.get(this.params.errorStorePath);return s?[{message:s,level:"error"}]:[]}createErrorElement(t){const e=document.createElement("div");e.classList.add("alert-container","alert-"+t.level);const n=document.createElement("span");n.classList.add("alert-icon"),n.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const o=document.createElement("span");return o.classList.add("alert-text"),o.textContent=t.message,e.appendChild(n),e.appendChild(o),e}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const e=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},e)}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 e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];e?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 ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(s.CART)});const e=document.createElement("span");if(e.className="lce-cart-button-icon",e.innerHTML=BagIcon({color:t.theme.primaryColor}),this.params.showItemsCount){const t=document.createElement("span");return t.className="lce-cart-button-badge",t.style.visibility="hidden",[e,t]}return[e]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const e=this.getStoreValue("cart.totals.quantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const e=this.getStoreValue("cart.totals.quantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var e;const n=t.find(t=>"ui.drawer"===t.path);if(!n)return![];const o=n.value,s=o.isOpen,a=null===(e=o.contentConfig)||void 0===e?void 0:e.type,c=a!==this.currentContentType;return s&&!this.isOpen?(this.currentContentType=a,this.openWithContent(o),![]):s&&this.isOpen&&!c?![]:s&&this.isOpen&&c?(this.currentContentType=a,this.openWithContent(o),![]):!s&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:e,data:n}=t||{};let o;o=this.isElementsEnabled()?ComponentFactoryService.createElement({type:e,...n}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(o,e):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(o),this.updateDrawerContentTypeClass(e),this.open()),this.addHostAttribute("data-target",e.toString().toLowerCase())}catch(e){this.logger.error("Drawer content loading failed",e),this.commands.ui.closeDrawer()}}animateContentSwap(t,e){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const n=this.contentContainer.firstElementChild;n.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{n.classList.add("fading")}),setTimeout(()=>{n.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(e),requestAnimationFrame(()=>{t.classList.add("visible"),setTimeout(()=>{t.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(t){if(!this.drawerElement)return;const e=["drawer"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.drawerElement.className=e.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",e),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class BirthdateInputComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["custom-input","birthdate",t.layout.inputFieldStyle]}constructor(){super({watchOnlyStorePaths:["checkout.focusField"]})}onStoreWatch(t){const e=t.find(t=>"checkout.focusField"===t.path);e&&e.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"}))}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const t=this.params.value.split("/");3===t.length&&(this.monthInput.value=t[0],this.dayInput.value=t[1],this.yearInput.value=t[2])}}setupEventListeners(){this.monthInput.addEventListener("input",t=>{this.formatMonth(t),this.handleNavigation(t,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",t=>{this.formatDay(t),this.handleNavigation(t,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",t=>{this.formatYear(t),this.handleChange()}),this.monthInput.addEventListener("blur",()=>this.validateInput()),this.dayInput.addEventListener("blur",()=>this.validateInput()),this.yearInput.addEventListener("blur",()=>this.validateInput());for(const t of[this.monthInput,this.dayInput,this.yearInput])t.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length&&Number.parseInt(n,10)>1)n="0"+n;else if(2===n.length){const t=Number.parseInt(n,10);t>12?n="12":t<1&&(n="01")}e.value=n}formatDay(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length&&Number.parseInt(n,10)>3)n="0"+n;else if(2===n.length){const t=Number.parseInt(n,10);t>31?n="31":t<1&&(n="01")}e.value=n}formatYear(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>4&&(n=n.substring(0,4)),e.value=n}handleNavigation(t,e){const n=t.target,o=n===this.yearInput?4:2;n.value.length===o&&e&&e.focus()}handleChange(){if(this.clearErrors(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}getFormattedValue(){const t=this.monthInput.value.padStart(2,"0"),e=this.dayInput.value.padStart(2,"0"),n=this.yearInput.value;return t&&e&&n&&4===n.length?n+"-"+t+"-"+e:""}validateDate(t,e,n){if(!t||!e||!n||4!==n.length)return![];const o=Number.parseInt(t,10),s=Number.parseInt(e,10),a=Number.parseInt(n,10);if(o<1||o>12||s<1||s>31||a<1e3)return![];const c=new Date(a,o-1,s);return c.getFullYear()===a&&c.getMonth()===o-1&&c.getDate()===s}calculateAge(t){const e=new Date;let n=e.getFullYear()-t.getFullYear();const o=e.getMonth()-t.getMonth();return(o<0||0===o&&e.getDate()<t.getDate())&&n--,n}validateInput(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value,o=[],s=this.params.validation;if(!s)return this.showErrors([]),!![];const a=t&&e&&n&&4===n.length,c=t||e||n;if(s.required&&!c||c&&!a)o.push("Please enter a complete date (MM/DD/YYYY)");else if(a)if(this.validateDate(t,e,n)){const a=Number.parseInt(t,10),c=Number.parseInt(e,10),l=Number.parseInt(n,10),h=new Date(l,a-1,c);if(void 0!==s.minYear&&l<s.minYear&&o.push("Year must be "+s.minYear+" or later"),void 0!==s.maxYear&&l>s.maxYear&&o.push("Year must be "+s.maxYear+" or earlier"),void 0!==s.minAge||void 0!==s.maxAge){const t=this.calculateAge(h);void 0!==s.minAge&&t<s.minAge&&o.push("Must be at least "+s.minAge+" years old"),void 0!==s.maxAge&&t>s.maxAge&&o.push("Must be no more than "+s.maxAge+" years old")}if(s.customValidator){const t=s.customValidator(this.getFormattedValue());t&&o.push(t)}}else o.push("Please enter a valid date");this.showErrors(o);const l=0===o.length;return this.params.onValidation&&this.params.onValidation(l,o),l}showErrors(t){this.errorContainer.innerHTML="";const e=[this.monthInput,this.dayInput,this.yearInput];if(t.length>0){this.errorContainer.classList.add("show");for(const t of e)t.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else for(const n of e)n.classList.remove("input-error")}clearErrors(){const t=[this.monthInput,this.dayInput,this.yearInput],e=t.some(t=>t.classList.contains("input-error"));if(e){for(const e of t)e.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(t){if(t){const e=t.split("/");3===e.length&&(this.monthInput.value=e[0],this.dayInput.value=e[1],this.yearInput.value=e[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name+"-month"),e.push(n)}const n=document.createElement("div");n.className="date-input-container";const o=document.createElement("input");o.type="text",o.placeholder="MM",o.name=this.params.name+"-month",o.id=this.params.name+"-month",o.maxLength=2,o.className="date-field month-field",o.setAttribute("data-field","month"),o.inputMode="numeric";const s=document.createElement("span");s.className="date-separator",s.textContent="/";const a=document.createElement("input");a.type="text",a.placeholder="DD",a.name=this.params.name+"-day",a.id=this.params.name+"-day",a.maxLength=2,a.className="date-field day-field",a.setAttribute("data-field","day"),a.inputMode="numeric";const c=document.createElement("span");c.className="date-separator",c.textContent="/";const l=document.createElement("input");l.type="text",l.placeholder="YYYY",l.name=this.params.name+"-year",l.id=this.params.name+"-year",l.maxLength=4,l.className="date-field year-field",l.setAttribute("data-field","year"),l.inputMode="numeric",this.params.disabled&&(o.disabled=!![],a.disabled=!![],l.disabled=!![]),this.params.className&&(n.className+=" "+this.params.className),n.appendChild(o),n.appendChild(s),n.appendChild(a),n.appendChild(c),n.appendChild(l);const h=document.createElement("div");return h.className="error-container",e.push(n),e.push(h),e}}class InputComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}constructor(){super({watchStorePaths:["checkout.focusField"]})}onStoreChanged(t){const e=t.find(t=>"checkout.focusField"===t.path);return e&&e.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"})),![]}handlePhoneKeydown(t){if("Backspace"===t.key){const e=t.target,n=e.selectionStart||0,o=e.value;n>0&&/\D/.test(o[n-1])&&setTimeout(()=>{const t=Math.max(0,n-2);e.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>10&&(n=n.substring(0,10)),n.length>=6?n="("+n.substring(0,3)+") "+n.substring(3,6)+"-"+n.substring(6):n.length>=3&&(n="("+n.substring(0,3)+") "+n.substring(3)),e.value=n}formatDate(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>8&&(n=n.substring(0,8)),n.length>=5?n=n.substring(0,2)+"/"+n.substring(2,4)+"/"+n.substring(4):n.length>=3&&(n=n.substring(0,2)+"/"+n.substring(2)),e.value=n}validateEmail(t){const e=/^[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 e.test(t)}validateTel(t){const e=/^\(\d{3}\) \d{3}-\d{4}$/;return e.test(t)}validateDate(t){const e=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!e.test(t))return![];const[n,o,s]=t.split("/").map(Number),a=new Date(s,n-1,o);return a.getFullYear()===s&&a.getMonth()===n-1&&a.getDate()===o}validateInput(){const t=this.inputElement.value,e=[],n=this.params.validation;if(!n)return this.showErrors([]),!![];if(n.required&&!t.trim()&&e.push("This field is required"),t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||e.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||e.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(t)||e.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const o=Number.parseFloat(t);Number.isNaN(o)?t.trim()&&e.push("Please enter a valid number"):(void 0!==n.min&&o<n.min&&e.push("Value must be at least "+n.min),void 0!==n.max&&o>n.max&&e.push("Value must be no more than "+n.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==n.min&&t.length<n.min&&e.push("Must be at least "+n.min+" characters"),void 0!==n.max&&t.length>n.max&&e.push("Must be no more than "+n.max+" characters")),n.pattern){const o=new RegExp(n.pattern);o.test(t)||e.push("Invalid format")}if(n.customValidator){const o=n.customValidator(t);o&&e.push(o)}}this.showErrors(e);const o=0===e.length;return this.params.onValidation&&this.params.onValidation(o,e),o}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,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&&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 e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name),e.push(n)}return this.inputElement=document.createElement("input"),this.inputElement.type=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&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("blur",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",e.push(this.inputElement),e.push(this.errorContainer),e}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.q=null,this.j=this.attachShadow({mode:"closed"})}initialize(t,e){if(this.A)return;if(!t||"string"!=typeof t)throw new Error("LceElementComponent: contentType must be a non-empty string");if(!(e&&e instanceof HTMLElement))throw new Error("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.j)throw new Error("LceElementComponent: Shadow DOM container is not available");e&&"function"==typeof e.rerender&&(this.q=t=>{e.rerender(t||"LceElementRerender")}),this.j.appendChild(e),this.applyBasicStyles();const n=ThemeProviderService.getInstance(),o=n.getStylesheet(t);this.applyThemeStyles(o),this.A=!![],this.j=null}rerender(t){this.q&&this.q(t)}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\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 e=new CSSStyleSheet;e.replaceSync(t),this.j.adoptedStyleSheets=[e,...this.j.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(B){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.j.adoptedStyleSheets=[...this.j.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const e=document.createElement("style");e.textContent=t,this.j&&this.j.appendChild(e)}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:e,showDescription:n,showQuantityCounter:o,fulfillmentDisplay:s,showImages:a}=this.config.layout,c=document.createElement("div");c.classList.add("product-content-wrapper");const l=document.createElement("div");if(l.classList.add("skeleton-container"),e){const t=document.createElement("div");t.classList.add("wave","sc-title"),l.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),l.appendChild(t),l}const h=document.createElement("div");h.classList.add("wave","sc-price"),l.appendChild(h);const p=document.createElement("div");p.classList.add("sc-sizes");const m=document.createElement("div");m.classList.add("wave","sc-size-button"),p.appendChild(m);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),p.appendChild(f);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),p.appendChild(v);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),p.appendChild(b);const x=document.createElement("div");x.classList.add("wave","sc-size-button"),p.appendChild(x),l.appendChild(p);const w=document.createElement("div");w.classList.add("sc-row");const C=document.createElement("div");C.classList.add("wave","sc-price"),w.appendChild(C);const k=document.createElement("div");k.classList.add("wave","sc-personalization"),w.appendChild(k),l.appendChild(w);const S=document.createElement("div");S.classList.add("wave","sc-deliver-to"),l.appendChild(S);const E=document.createElement("div");E.classList.add("wave","sc-address"),l.appendChild(E);const T=document.createElement("div");T.classList.add("wave","sc-retailers",s),l.appendChild(T);const I=document.createElement("div");if(I.classList.add("sc-row"),o){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),I.appendChild(t)}const P=document.createElement("div");if(P.classList.add("wave","sc-add-to-cart"),I.appendChild(P),l.appendChild(I),n){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),l.appendChild(t);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),l.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),l.appendChild(n);const o=document.createElement("div");o.classList.add("wave","sc-description-line"),l.appendChild(o);const s=document.createElement("div");s.classList.add("wave","sc-description-more"),l.appendChild(s)}const F=document.createElement("div");if(F.classList.add("product-content"),F.appendChild(l),c.appendChild(F),a){c.classList.add("has-images");const t=this.createImageSkeletons();c.prepend(t)}return c}createImageSkeletons(){const t=document.createElement("div");t.classList.add("product-image-carousel","skeleton");const e=document.createElement("div");e.classList.add("wave","sc-main-image"),e.title="Product main image loading";const n=document.createElement("div");n.classList.add("carousel-dots");for(let a=0;a<3;a++){const t=document.createElement("div");t.classList.add("wave","sc-carousel-dot"),n.appendChild(t)}e.appendChild(n),t.appendChild(e);const o=document.createElement("div");o.classList.add("gallery-viewport");const s=document.createElement("div");s.classList.add("gallery-container");for(let a=0;a<4;a++){const t=document.createElement("div");t.classList.add("gallery-image-wrapper");const e=document.createElement("div");e.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(e),s.appendChild(t)}return o.appendChild(s),t.appendChild(o),t}}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 e=document.createElement("span");e.className="pb-text",e.textContent="Powered by",t.appendChild(e);const n=document.createElement("span");n.className="pb-lc",n.textContent="LiquidCommerce",t.appendChild(n);const o=document.createElement("span");return o.className="pb-dot",o.textContent=".",t.appendChild(o),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const e=this.getDisclaimerConfig();return e.parts.forEach(e=>{"text"===e.type?t.appendChild(document.createTextNode(e.content)):"link"===e.type&&t.appendChild(this.createLink(e.href,e.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,e){const n=document.createElement("a");return n.href=t,n.target="_blank",n.rel="noopener noreferrer",n.className="pb-link",n.textContent=e,n.setAttribute("role","link"),n.setAttribute("aria-label","Read "+e),n}template(){const t=this.createPoweredBySection(),e=this.createDisclaimerSection();return[t,e]}}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 e=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!e||!this.applyButton||!this.currentActiveTicker)return;const n=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);n&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!n&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const e=this.store.get("cart.promoCode"),n=this.store.get("checkout.promoCode");return(null==e?void 0:e.code)===t||(null==n?void 0:n.code)===t}getActiveTickers(){var t;const e=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var n;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const e=document.createElement("div");e.classList.add("promo-ticker__text-group");const n=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const o of n){const n=o.trim();if(!n)continue;const s=document.createElement("span");s.classList.add("promo-ticker__text-item"),s.textContent=n,e.appendChild(s);const a=document.createElement("span");a.classList.add("promo-ticker__separator"),a.textContent=t.separator,e.appendChild(a)}return e}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 e=document.createElement("div");e.classList.add("promo-ticker__content");const n=document.createElement("div");n.classList.add("promo-ticker__track");for(let s=0;s<5;s++)n.appendChild(this.generateTextContent(this.currentActiveTicker));e.appendChild(n);const o=document.createElement("button");return o.type="button",o.classList.add("promo-ticker__cta"),o.textContent="APPLY",o.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(o.disabled=!![],o.textContent="APPLIED"),o.addEventListener("click",()=>this.handlePromoClick()),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=o,[e,o]}}const Ct=LoggerFactory.get("ElementsClientHelper"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,e){if(!t||!e)return t;const n={...t},o=[];for(const s in e){const a=e[s],c=n[s];if(!(s in t)){o.push('Property "'+s+'" does not exist in target schema, skipping merge.');continue}const l=getType(a),h=getType(c);l===h?isObject(a)&&isObject(c)?n[s]=deepMergeConfigs(c,a):n[s]=a:o.push('Type mismatch for key "'+s+'": source is '+l+", target is "+h+". Skipping merge.")}return o.length>0&&Ct.warn("Merging configurations with warnings:",o),n}const kt=new Map([["global.layout.enablePersonalization",[s.PRODUCT,s.CART,s.CHECKOUT,s.ENGRAVING_FORM,s.ENGRAVING_VIEW]],["global.layout.personalizationText",[s.PRODUCT,s.CART,s.CHECKOUT,s.ENGRAVING_FORM,s.ENGRAVING_VIEW]],["global.layout.personalizationCardStyle",[s.PRODUCT,s.CART,s.CHECKOUT,s.ENGRAVING_FORM,s.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[s.CART,s.CART_PROMO_CODE]],["global.layout.inputFieldStyle",[s.CART,s.CHECKOUT,s.ADDRESS,s.INPUT,s.BIRTHDATE_INPUT,s.ADDRESS_INPUT,s.CHECKOUT_DELIVERY_INFORMATION_FORM,s.CHECKOUT_BUYER_INFORMATION_FORM,s.CHECKOUT_BILLING_FORM,s.CHECKOUT_PAYMENT_FORM]],["global.layout.showPoweredBy",[s.CART,s.CHECKOUT,s.CHECKOUT_COMPLETED,s.POWERED_BY,s.CART_FOOTER,s.CHECKOUT_SUMMARY_SECTION]],["global.layout.poweredByMode",[s.CART,s.CHECKOUT,s.CHECKOUT_COMPLETED,s.POWERED_BY,s.CART_FOOTER,s.CHECKOUT_SUMMARY_SECTION]],["product.layout.showImages",[s.PRODUCT,s.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[s.PRODUCT]],["product.layout.showDescription",[s.PRODUCT,s.PRODUCT_DESCRIPTION]],["product.layout.showQuantityCounter",[s.PRODUCT,s.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[s.PRODUCT,s.PRODUCT_RETAILERS,s.PRODUCT_RETAILERS_CAROUSEL,s.PRODUCT_RETAILERS_POPUP,s.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[s.PRODUCT,s.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[s.PRODUCT,s.PRODUCT_IMAGE_CAROUSEL]],["product.layout.enableShippingFulfillment",[s.PRODUCT,s.PRODUCT_RETAILERS,s.PRODUCT_RETAILERS_CAROUSEL,s.PRODUCT_RETAILERS_POPUP,s.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[s.PRODUCT,s.PRODUCT_RETAILERS,s.PRODUCT_RETAILERS_CAROUSEL,s.PRODUCT_RETAILERS_POPUP,s.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[s.PRODUCT,s.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.addToCartButtonShowTotalPrice",[s.PRODUCT,s.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.buyNowButtonText",[s.PRODUCT,s.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[s.PRODUCT,s.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[s.CART,s.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[s.CART,s.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[s.CART,s.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[s.CART,s.CART_FOOTER]],["checkout.layout.emailOptIn",[s.CHECKOUT,s.CHECKOUT_SUMMARY_SECTION]],["checkout.layout.smsOptIn",[s.CHECKOUT,s.CHECKOUT_SUMMARY_SECTION]],["checkout.layout.allowGiftCards",[s.CHECKOUT,s.CHECKOUT_GIFT_CARDS]],["checkout.layout.legalMessage",[s.CHECKOUT,s.CHECKOUT_SUMMARY_SECTION]],["checkout.layout.exitUrl",[s.CHECKOUT,s.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[s.CHECKOUT,s.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[s.CHECKOUT,s.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[s.CHECKOUT,s.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.placeOrderButtonShowRequiredFields",[s.CHECKOUT,s.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[s.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,e){const n=new Set;for(const o of Object.keys(e)){const e=kt.get(t+"."+o);if(e)for(const t of e)n.add(t)}return Array.from(n)}class LiquidCommerceElementsClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],this.injectedComponents=new Map,this.builder={updateComponentGlobalConfigs:async t=>{if(this.ensuredIsBuilder("updateComponentGlobalConfigs"))try{if(!t)throw new Error("Global theme configuration is required");if(this.themeProvider.updateComponentGlobalConfigs(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("global.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(e){throw this.logger.error("❌ Failed to update global theme configuration",e),new Error("Global theme update failed")}},updateProductComponent:async t=>{if(this.ensuredIsBuilder("updateProductComponent"))try{if(!t)throw new Error("Product component configuration is required");if(this.themeProvider.updateProductComponent(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts();for(const e of getComponentTypesForLayoutFields("product.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(e){throw this.logger.error("❌ Failed to update product component theme",e),new Error("Product theme update failed")}},updateCartComponent:t=>{if(this.ensuredIsBuilder("updateCartComponent"))try{if(!t)throw new Error("Cart component configuration is required");if(this.themeProvider.updateCartComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.cart.rerenderCart();for(const e of getComponentTypesForLayoutFields("cart.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(e){throw this.logger.error("❌ Failed to update cart component theme",e),new Error("Cart theme update failed")}},updateCheckoutComponent:t=>{if(this.ensuredIsBuilder("updateCheckoutComponent"))try{if(!t)throw new Error("Checkout component configuration is required");if(this.themeProvider.updateCheckoutComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("checkout.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(e){throw this.logger.error("❌ Failed to update checkout component theme",e),new Error("Checkout theme update failed")}},updateAddressComponent:t=>{if(this.ensuredIsBuilder("updateAddressComponent"))try{if(!t)throw new Error("Address component configuration is required");this.themeProvider.updateAddressComponent(t),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(e){throw this.logger.error("❌ Failed to update address component theme",e),new Error("Address theme update failed")}},injectElement:async t=>this.ensuredIsBuilder("injectElement")?await this.processInjectElement(t):null,injectProductElement:async t=>this.ensuredIsBuilder("injectProductElement")?await this.processInjectProduct(t):[],injectAddressElement:async(t,e)=>this.ensuredIsBuilder("injectAddressElement")?await this.processInjectElement({type:s.ADDRESS,containerId:t,options:e}):null,injectCartElement:async t=>this.ensuredIsBuilder("injectCartElement")?await this.processInjectElement({type:s.CART,containerId:t}):null,injectCheckoutElement:async(t,e)=>{if(!this.ensuredIsBuilder("injectCheckoutElement"))return null;const n=await this.processInjectElement({type:s.CHECKOUT,containerId:t});if(null==e?void 0:e.simulatePresale){const t=e.presaleExpiresInMinutes||15,n=new Date;n.setMinutes(n.getMinutes()+t),this.store.set("checkout.isPresaleLocked",!![]),this.store.set("checkout.presaleExpiresAt",n.toISOString()),this.logger.info("✅ Builder presale simulation activated - expires in "+t+" minutes")}return n}},this.ui={cartButton:(t,e)=>{var n;this.ensureCartDrawerExists();const o=document.getElementById(null!==(n=null==t?void 0:t.replace("#",""))&&void 0!==n?n:"");if(!o)throw new Error("Container with ID '"+t+"' not found");const a=ComponentFactoryService.createElement({type:s.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});o.innerHTML="",safeReplaceChildren(o,a)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:s.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(e)},cartSubtotal:t=>{var e;const n=document.getElementById(null!==(e=null==t?void 0:t.replace("#",""))&&void 0!==e?e:"");if(!n)throw new Error("Element with ID '"+t+"' not found");n.innerHTML="";const o=this.store.get("cart.totals.subtotal")||0;n.textContent=formatCentToDollarText(o),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.subtotal")||0;n.textContent=formatCentToDollarText(t)})},cartItemsCount:t=>{var e;const n=document.getElementById(null!==(e=null==t?void 0:t.replace("#",""))&&void 0!==e?e:"");if(!n)throw new Error("Element with ID '"+t+"' not found");n.innerHTML="";const o=this.store.get("cart.totals.quantity")||0;n.textContent=o.toString(),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.quantity")||0;n.textContent=t.toString()})}},this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authService=AuthService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Failed to prepare client",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",B.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.debug("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.debug("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.debug("📊 Telemetry initialized")),this.logger.debug("🔐 Starting authentication...");const t=await this.authService.authenticate();if(!t)throw this.clientPrepared=![],new Error("Authentication failed");this.logger.debug("✅ Authentication completed"),this.logger.debug("🌐 Setting up API client..."),await this.apiClient.setClient(this.authService),this.logger.debug("✅ API client setup completed"),this.logger.debug("⚙️ Loading configurations...");let e=await this.apiClient.getAllConfigs();this.logger.debug("✅ Configurations loaded"),this.clientConfig.set("partnerCode",e.configurations.partnerCode),this.logger.debug("🔍 Setting up fingerprinting and store...");const n=await this.fingerPrintService.getId(e.configurations.partnerCode),o=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",n),this.clientConfig.set("isLocalStorageAvailable",o);const s=o?null:await this.apiClient.getPersistedStore(n);if(await this.store.initialize({userDeviceId:n,isLocalStorageAvailable:o,persistedStore:s}),this.logger.debug("✅ Store setup completed"),this.logger.debug("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),n=e.global.layout.showPoweredBy;e=deepMergeConfigs(e,t),e.global.layout.showPoweredBy=n}await this.themeProvider.initialize(e),this.logger.debug("✅ Theme provider initialized"),this.logger.debug("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.debug("✅ Essential components registered"),this.logger.debug("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(t){this.logger.error("Heavy initialization failed",t)}},0)}async initializeHeavyServices(){const t=this.themeProvider.getConfigs("configurations");if(!this.gtmInitialized)try{await this.googleTagManager.initialize({partnerName:t.partnerName,partnerGtmId:t.googleTagManagerId,partnerEnableGaTracking:t.enablePartnerGaTracking,liquidCommerceEnableGaTracking:t.enableLiquidCommerceGaTracking,liquidCommerceGtmId:t.liquidCommerceGoogleTagManagerId}),this.gtmInitialized=!![]}catch(e){this.logger.error("GTM initialization failed",e)}try{this.isElementsEnabled()&&await this.commands.common.loadCart()}catch(n){this.logger.error("Cart pre-loading failed",n)}this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}async injectProductElement(t){if(!this.isElementsEnabled()){for(const e of t)this.injectDisabledElementsError(e.containerId,s.PRODUCT);return[]}return await this.processInjectProduct(t)}async injectAddressElement(t,e){return this.isElementsEnabled()?await this.processInjectElement({type:s.ADDRESS,containerId:t,options:e}):(this.injectDisabledElementsError(t,s.ADDRESS),null)}async injectCartElement(t){return this.isElementsEnabled()?await this.processInjectElement({type:s.CART,containerId:t}):(this.injectDisabledElementsError(t,s.CART),null)}async injectCheckoutElement(t){return this.isElementsEnabled()?await this.processInjectElement({type:s.CHECKOUT,containerId:t}):(this.injectDisabledElementsError(t,s.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}get actions(){return this.clientAction.actions}async processInjectProduct(t){var e,n;if(this.ensureAllComponentsRegistered(),0===t.length)throw new Error("At least one product must be provided");t.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const o=t.slice(0,20),a=[],c=[];for(const s of o){const t=null===(n=null===(e=s.containerId)||void 0===e?void 0:e.replace("#",""))||void 0===n?void 0:n.trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+s.identifier+"'");continue}const o=document.getElementById(t);if(!o){this.logger.warn("Container with ID '"+t+"' not found for product '"+s.identifier+"'");continue}const c=a.every(e=>e.containerId!==t);if(!c){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!s.identifier){this.logger.warn("Product identifier is required for container ID '"+t+"'");continue}const l=a.every(t=>t.identifier!==s.identifier);l?a.push({containerId:t,identifier:s.identifier}):this.logger.warn("Duplicate product identifier '"+s.identifier+"' found, skipping")}for(const l of a){const t=ComponentFactoryService.createElement({type:s.PRODUCT,useShadowDom:!![],productId:l.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(l.containerId);e?(e.innerHTML="",safeReplaceChildren(e,t),c.push(this.createInjectedComponentWrapper(l.containerId,s.PRODUCT,t)),await this.commands.product.createProductInstance(l.identifier,!![])):this.logger.warn("Product ("+l.identifier+") container with ID '"+l.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(a.map(t=>t.identifier)),c}async processInjectElement(t){this.ensureAllComponentsRegistered();const{type:e,containerId:n,...o}=t;if(!n)throw new Error("Container ID is required");if(!e)throw new Error("Component type is required");const a=t.containerId.replace("#",""),c=document.getElementById(a);if(!c)return console.warn("Container with ID '"+a+"' not found"),null;c.innerHTML="";const l={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...o},h=ComponentFactoryService.createElement(l);return safeReplaceChildren(c,h),t.type===s.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(a,t.type,h)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:s.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(t,e,n){const o={getType:()=>e,getElement:()=>document.getElementById(t),rerender:()=>{try{n&&"function"==typeof n.rerender?n.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+t+"' does not support rerender")}catch(e){this.logger.warn("Failed to rerender component in container '"+t+"'")}}};return this.injectedComponents.set(t,o),o}rerenderInjectedComponentsByType(t){for(const[e,n]of this.injectedComponents)n.getType()===t&&n.rerender()}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",e),!![]}}injectDisabledElementsError(t,e){const n=document.getElementById(t.replace("#",""));if(!n)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let o;o=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),n.innerHTML="",safeReplaceChildren(n,o)}registerEssentialComponents(){ComponentFactoryService.registerComponent(s.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(s.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(s.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(s.CART,AddressInputComponent),ComponentFactoryService.registerComponent(s.ADDRESS_INPUT,AddressInputComponent)}registerComponents(){this.componentFactoryInitialized||(ComponentFactoryService.registerComponent(s.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(s.INPUT,InputComponent),ComponentFactoryService.registerComponent(s.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(s.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(s.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(s.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(s.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(s.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(s.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(s.ALERT,AlertComponent),ComponentFactoryService.registerComponent(s.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(s.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(s.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(s.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(s.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(s.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(s.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(s.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(s.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(s.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(s.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(s.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(s.CART,CartComponent),ComponentFactoryService.registerComponent(s.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(s.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(s.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(s.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(s.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(s.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(s.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(s.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(s.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(s.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_INFORMATION_SECTION,CheckoutInformationSectionComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PAYMENT_FORM,CheckoutPaymentFormComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_BILLING_FORM,CheckoutBillingFormComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_SUMMARY_SECTION,CheckoutSummarySectionComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_DELIVERY_INFORMATION_FORM,CheckoutDeliveryInformationComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_BUYER_INFORMATION_FORM,CheckoutBuyerInformationComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent))}ensuredIsBuilder(t){return this.clientConfig.isBuilder()?!![]:(this.logger.error("This method ("+t+") is only available in builder mode"),![])}}async function Elements(t,e){try{const o=ClientConfigService.getInstance();o.initialize(t,{env:e.env,isBuilder:e.isBuilder,debugMode:e.debugMode,customTheme:e.customTheme,proxy:e.proxy,promoTicker:e.promoTicker});const s=o.getConfigs();SingletonManager.setClientConstructor(LiquidCommerceElementsClient);const a=await SingletonManager.getClient(s);if(!a.clientPrepared)throw new Error("Failed to initialize properly");const c={builder:a.builder,injectProductElement:a.injectProductElement.bind(a),injectAddressElement:a.injectAddressElement.bind(a),injectCartElement:a.injectCartElement.bind(a),injectCheckoutElement:a.injectCheckoutElement.bind(a),ui:a.ui,actions:a.actions,getInjectedComponents:a.getInjectedComponents.bind(a)};window.elements=c;const l=PubSubService.getInstance();return l.publishAction(n.CLIENT_READY,{isReady:!![],message:"Client Is Ready",timestamp:Date.now(),version:o.get("version")}),c}catch(o){try{const t=LoggerFactory.get("ElementsClientInit");t.error("Elements Client Initialization failed",o)}catch(s){console.error("[LiquidCommerce Elements] Client initialization failed:",null==o?void 0:o.message)}try{const t=ClientConfigService.getInstance(),e=PubSubService.getInstance();e.publishAction(n.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==o?void 0:o.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(a){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}function pairsFromMainScript(t){const e=[];try{const o=t.getAttributeNames().filter(t=>"data-product"===t.substring(0,12));for(const s of o)try{const n=s.match(/^data-product(-(.+))?$/),o=(null==n?void 0:n[2])?"-"+n[2]:"",a="data-container"+o;t.hasAttribute(a)&&e.push({containerId:t.getAttribute(a),identifier:t.getAttribute(s)})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",n)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",o)}return e}function pairsFromProductsScript(){const t=[];try{const n=document.querySelectorAll("script[data-liquid-commerce-elements-products]");for(const o of n)try{const e=JSON.parse(o.textContent||"[]");if(!Array.isArray(e))continue;for(const n of e)n.containerId&&n.identifier&&t.push({containerId:n.containerId,identifier:n.identifier})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",n)}return t}function pairsFromAttributedElements(){const t=[];try{const n=document.querySelectorAll("div[data-lce-product]");for(const o of n)try{const e="lcep-"+(Date.now().toString(36)+Math.random().toString(36).substring(2,15));o.setAttribute("id",e);const n=o.getAttribute("data-lce-product");e&&n&&t.push({containerId:e,identifier:n})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",n)}return t}function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}async function addProductToCartViaQueryParam(t,e){const n=e.getAttribute("data-product-param"),o=e.getAttribute("data-product-fulfillment-type-param");if(!n)return;if(!startsWithLcePrefix(n))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+n+'" because it does not start with "lce_" prefix.'),void 0;const s=new URLSearchParams(window.location.search),c=s.get(n);if(!c)return;let l=a.SHIPPING;if(o)if(startsWithLcePrefix(o)){const t=s.get(o);t!==a.ON_DEMAND&&t!==a.SHIPPING||(l=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+o+'" because it does not start with "lce_" prefix.');try{await t.actions.cart.addProduct([{identifier:c,fulfillmentType:l,quantity:1}],!![])}catch(h){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",h)}}async function addPromoCodeToCartViaQueryParam(t,e){const n=e.getAttribute("data-promo-code-param");if(!n)return;if(!startsWithLcePrefix(n))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+n+'" because it does not start with "lce_" prefix.'),void 0;const o=new URLSearchParams(window.location.search),s=o.get(n);if(s)try{await t.actions.cart.applyPromoCode(s)}catch(a){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",a)}}async function ElementsAutoInitialize(){var t,n,o,s,a,l;try{const l=document.querySelector("script[data-liquid-commerce-elements]");if(!l)return;const v=l.getAttribute("data-token"),b=l.getAttribute("data-env")||e.PRODUCTION,x=l.getAttribute("data-debug-mode");if(!v)throw new Error("Missing API Key (data-token attribute).");const w=l.getAttribute("data-cart-id"),C=l.hasAttribute("data-show-cart-items"),k=l.hasAttribute("data-hide-cart-floating-button"),S=l.getAttribute("data-promo-code"),E=l.getAttribute("data-promo-text"),T=null!==(t=l.getAttribute("data-promo-separator"))&&void 0!==t?t:"•",I=null!==(n=l.getAttribute("data-promo-active-from"))&&void 0!==n?n:void 0,P=null!==(o=l.getAttribute("data-promo-active-until"))&&void 0!==o?o:void 0,F=pairsFromMainScript(l),D=pairsFromProductsScript(),_=pairsFromAttributedElements(),O=[...F,...D,..._],N=S&&E&&I&&P?{promoCode:S,text:E.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:T,activeFrom:null===(s=new Date(I))||void 0===s?void 0:s.toISOString(),activeUntil:null===(a=new Date(P))||void 0===a?void 0:a.toISOString()}:void 0;let M=c.NONE;x&&b!==e.PRODUCTION&&(M=x);const L=await Elements(v,{env:b,debugMode:M,promoTicker:N?[N]:void 0});if(!L)throw new Error("Failed to initialize client.");if(0!==O.length)try{await L.injectProductElement(O)}catch(h){console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",h)}try{const t=w&&document.getElementById(w.replace("#",""));t?L.ui.cartButton(w,C):k||(L.ui.floatingCartButton(C),w&&console.warn('[LiquidCommerce Elements Auto Initialization] Cart container with ID "'+w+'" not found. Falling back to floating cart button.'))}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",p)}try{await addProductToCartViaQueryParam(L,l)}catch(m){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",m)}try{await addPromoCodeToCartViaQueryParam(L,l)}catch(f){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",f)}}catch(v){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(l=null==v?void 0:v.message)&&void 0!==l?l:String(v))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(B){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",B)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(B){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",B)}},50)}catch(B){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",B)}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] 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 Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const t=window.onerror;window.onerror=(e,n,o,s,a)=>{var c,l;const h=(null==n?void 0:n.includes("elements"))||(null==n?void 0:n.includes("liquidcommerce"))||(null===(c=null==a?void 0:a.stack)||void 0===c?void 0:c.includes("LiquidCommerce"))||(null===(l=null==a?void 0:a.stack)||void 0===l?void 0:l.includes("elements-sdk"));return h?(console.error("[LiquidCommerce Elements] Unhandled error:",{message:e,source:n,lineno:o,colno:s,error:a}),!![]):t?t(e,n,o,s,a):![]};const e=window.onunhandledrejection;window.onunhandledrejection=t=>{var n,o,s,a,c,l;const h=(null===(o=null===(n=t.reason)||void 0===n?void 0:n.stack)||void 0===o?void 0:o.includes("LiquidCommerce"))||(null===(a=null===(s=t.reason)||void 0===s?void 0:s.stack)||void 0===a?void 0:a.includes("elements-sdk"))||(null===(l=null===(c=t.reason)||void 0===c?void 0:c.message)||void 0===l?void 0:l.includes("LiquidCommerce"));if(h)return console.error("[LiquidCommerce Elements] Unhandled promise rejection:",t.reason),t.preventDefault(),void 0;e&&e.call(window,t)};try{initializeDOMPolyfills()}catch(St){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",St)}try{triggerElementsAutoInit()}catch(Et){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Et)}}catch(Tt){console.error("[LiquidCommerce Elements] SDK initialization failed:",Tt)}initializeDOMPolyfills(),window.Elements=Elements,exports.Elements=Elements,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|