@liquidcommerce/elements-sdk 2.2.0-beta.26 → 2.2.0-beta.27

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(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):(e="undefined"!=typeof globalThis?globalThis:e||self,n(e.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...e){for(;this.firstChild;)this.removeChild(this.firstChild);for(const n of e)"string"==typeof n?this.appendChild(document.createTextNode(n)):this.appendChild(n)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...e){const n=document.createDocumentFragment();for(const i of e)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);this.insertBefore(n,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...e){const n=this.parentNode;if(!n)return;const i=document.createDocumentFragment();for(const o of e)"string"==typeof o?i.appendChild(document.createTextNode(o)):i.appendChild(o);n.replaceChild(i,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...e){const n=this.parentNode;if(!n)return;const i=document.createDocumentFragment();for(const o of e)"string"==typeof o?i.appendChild(document.createTextNode(o)):i.appendChild(o);n.insertBefore(i,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...e){const n=this.parentNode;if(!n)return;const i=document.createDocumentFragment();for(const o of e)"string"==typeof o?i.appendChild(document.createTextNode(o)):i.appendChild(o);n.insertBefore(i,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=e=>{const n={};for(const[i,o]of e)n[i]=o;return n})}function safeScrollIntoView(e,n){try{n&&"function"==typeof e.scrollIntoView?e.scrollIntoView(n):e.scrollIntoView()}catch(i){try{e.scrollIntoView()}catch(o){console.warn("scrollIntoView failed:",o)}}}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(R){console.warn("DOM polyfills initialization failed:",R)}}function safeReplaceChildren(e,...n){try{if("replaceChildren"in e&&"function"==typeof e.replaceChildren)e.replaceChildren(...n);else{for(;e.firstChild;)e.removeChild(e.firstChild);for(const i of n)"string"==typeof i?e.appendChild(document.createTextNode(i)):e.appendChild(i)}}catch(i){console.error("replaceChildren operation failed:",i),1===n.length&&"string"==typeof n[0]&&(e.innerHTML=n[0])}}class SingletonManager{static getInstances(){return SingletonManager.instances||(SingletonManager.instances=new Map),SingletonManager.instances}constructor(){}static setClientConstructor(e){SingletonManager.clientConstructor=e}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(e,n){const i=SingletonManager.getInstances();i.has(e)||i.set(e,n());const o=i.get(e);if(!o)throw new Error("ElementsSdk: Instance for class "+e+" could not be created.");return o}static async getClient(e){const n=[e.apiKey,e.env,e.isBuilder,e.debugMode].join("_"),i="LiquidCommerceElementsClient_"+n,o=SingletonManager.getInstances();if(o.has(i))return o.get(i);if(!SingletonManager.clientConstructor)throw new Error("LiquidCommerce Elements: Client constructor is not set.");const r=new SingletonManager.clientConstructor(e);return await r.prepare(),o.set(i,r),r}}SingletonManager.instances=null,SingletonManager.clientConstructor=null;class LoggerService{constructor(e){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.telemetryService=null,this.context=e}static getInstance(e){return SingletonManager.getClassInstance("LoggerService_"+e,()=>new LoggerService(e))}setEnableLogging(e){this.enableLogging=e}setTelemetryService(e){this.telemetryService=e}getPrefix(e){if(!this.enableLogging)return[];const n=(new Date).toISOString().slice(11,23);return["%c["+n+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[e],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[e],"color: "+this.colors[e]]}debug(e,n){if(this.sendToTelemetry("debug",e,void 0,n),!this.enableLogging)return;const[i,...o]=this.getPrefix("debug");void 0!==n?console.debug(i,...o,e,n):console.debug(i,...o,e)}info(e,n){if(!this.enableLogging)return;const[i,...o]=this.getPrefix("info");void 0!==n?console.info(i,...o,e,n):console.info(i,...o,e)}warn(e,n){if(this.sendToTelemetry("warn",e,void 0,n),!this.enableLogging)return;const[i,...o]=this.getPrefix("warn");void 0!==n?console.warn(i,...o,e,n):console.warn(i,...o,e)}error(e,n){const i=n instanceof Error,o=i?n:void 0,r=!i&&n?n:void 0;if(this.sendToTelemetry("error",e,o,r),!this.enableLogging)return;const[a,...c]=this.getPrefix("error");void 0!==n?console.error(a,...c,e,n):console.error(a,...c,e)}group(e,n=![]){if(!this.enableLogging)return;const[i,...o]=this.getPrefix("log");n?console.groupCollapsed(i,...o,e):console.group(i,...o,e)}groupEnd(){this.enableLogging&&console.groupEnd()}sendToTelemetry(e,n,i,o){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(e,n,{context:this.context,error:i,data:o})}catch(r){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(e){const n=this.getInstances();if(!n.has(e)){const i=LoggerService.getInstance(e);i.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&i.setTelemetryService(this.telemetryService),n.set(e,i)}return n.get(e)}static setEnableLogging(e){this.enableLoggingGlobally=e;const n=this.getInstances();for(const[,i]of n)i.setEnableLogging(e)}static setTelemetryService(e){this.telemetryService=e;const n=this.getInstances();for(const[,i]of n)i.setTelemetryService(e)}}var e;LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null,function(e){e.CLOSED="CLOSED",e.OPEN="OPEN",e.HALF_OPEN="HALF_OPEN"}(e||(e={}));class CircuitBreakerService{constructor(n){this.state=e.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:![],...n},this.logger=LoggerFactory.get("CircuitBreaker")}static getInstance(e){return SingletonManager.getClassInstance("CircuitBreakerService",()=>new CircuitBreakerService(e))}async execute(n,i,o){switch(this.totalCalls++,this.state===e.OPEN&&Date.now()>=this.nextAttemptTime&&this.halfOpenCircuit(i),this.state){case e.OPEN:if(null==o?void 0:o.critical)return this.logger.warn("Critical operation bypassing OPEN circuit breaker",{context:i,failures:this.failures}),this.executeWithTimeout(n,o.critical);if(null==o?void 0:o.fallback)return this.logger.info("Circuit breaker OPEN - using fallback",{context:i}),this.rejectedCalls++,o.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker is OPEN - failing fast",{context:i,failures:this.failures}),new Error("Service unavailable - circuit breaker is open ("+(i||"unknown")+")");case e.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:i}),this.rejectedCalls++,o.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker HALF_OPEN - max calls reached",{context:i,halfOpenCalls:this.halfOpenCallsInProgress,maxCalls:this.config.halfOpenMaxCalls}),new Error("Service unavailable - circuit breaker half-open limit reached ("+(i||"unknown")+")")}this.halfOpenCallsInProgress++}try{const e=await this.executeWithTimeout(n,null==o?void 0:o.critical);return this.onSuccess(i),e}catch(r){throw this.onFailure(r,i),r}}async executeWithFallback(e,n,i,o){return this.execute(e,i,{fallback:n,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===e.CLOSED&&0===this.failures}}reset(){this.state=e.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(e){this.openCircuit(e)}forceClose(n){this.state=e.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker manually closed",{context:n})}async executeWithTimeout(e,n){const i=n?2*this.config.timeout:this.config.timeout;return new Promise((n,o)=>{const r=setTimeout(()=>{o(new Error("Request timeout after "+i+"ms"))},i);e().then(e=>{clearTimeout(r),n(e)}).catch(e=>{clearTimeout(r),o(e)})})}onSuccess(n){this.lastSuccessTime=Date.now(),this.state===e.HALF_OPEN?(this.halfOpenCallsInProgress--,this.successes++,this.successes>=this.config.successThreshold&&this.closeCircuit(n)):this.state===e.CLOSED&&(this.successes++,this.failures=0),this.logger.debug("Circuit breaker success",{context:n,state:this.state,successes:this.successes,failures:this.failures})}onFailure(n,i){const o=(null==n?void 0:n.status)&&n.status>=400&&n.status<500;if(o&&!this.config.countClientErrorsAsFailures)return this.logger.debug("Client error (4xx) - not counting as circuit breaker failure",{context:i,status:n.status,message:n.message}),void 0;this.lastFailureTime=Date.now(),this.failures++,this.state===e.HALF_OPEN&&(this.halfOpenCallsInProgress--,this.openCircuit(i)),this.state===e.CLOSED&&this.failures>=this.config.failureThreshold&&this.openCircuit(i),this.logger.warn("Circuit breaker failure",{context:i,state:this.state,failures:this.failures,error:(null==n?void 0:n.message)||n,status:null==n?void 0:n.status,threshold:this.config.failureThreshold,isClientError:o})}openCircuit(n){this.state=e.OPEN,this.nextAttemptTime=Date.now()+this.config.recoveryTimeout,this.halfOpenCallsInProgress=0,this.logger.error("Circuit breaker OPENED",{context:n,failures:this.failures,threshold:this.config.failureThreshold,nextAttemptTime:new Date(this.nextAttemptTime).toISOString()})}halfOpenCircuit(n){this.state=e.HALF_OPEN,this.halfOpenCallsInProgress=0,this.successes=0,this.logger.info("Circuit breaker HALF_OPEN - testing service recovery",{context:n,maxCalls:this.config.halfOpenMaxCalls,successThreshold:this.config.successThreshold})}closeCircuit(n){this.state=e.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker CLOSED - service recovered",{context:n,totalRecoveryTime:this.lastFailureTime?Date.now()-this.lastFailureTime:0})}}const n={LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},i={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"},r={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={[n.LOCAL]:"http://127.0.0.1:8080",[n.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[n.STAGING]:"https://staging-elements.liquidcommerce.us",[n.PRODUCTION]:"https://elements.liquidcommerce.us"},d={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(e,n={}){this.validateInputs(e,n),this.config=Object.freeze(this.buildConfiguration(e,n))}getConfigs(){return{...this.config}}get(e){return this.config[e]}set(e,n){if(!this.config)throw new Error("ClientConfigService is not initialized. Please call initialize() first.");this.config=Object.freeze({...this.config,[e]:n})}isDevelopment(){return this.get("env")===n.DEVELOPMENT}isStaging(){return this.get("env")===n.STAGING}isProduction(){return this.get("env")===n.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const e=this.get("debugMode");return e===c.CONSOLE||e===c.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===c.PANEL}debuggingDisabled(){const e=this.get("debugMode");return e===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(e,i){if(!(null==e?void 0:e.trim()))throw new Error("API key is required");if(i.env&&!Object.values(n).includes(i.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+i.env+'". Using default environment.'),i.env=void 0),void 0!==i.isBuilder&&"boolean"!=typeof i.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),i.isBuilder=void 0),void 0===i.debugMode||Object.values(c).includes(i.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+i.debugMode+'". Must be one of: '+Object.values(c).join(", ")+". Using default value."),i.debugMode=void 0),i.promoTicker&&"object"!=typeof i.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),i.promoTicker=void 0),i.promoTicker)if(Array.isArray(i.promoTicker)){const e=i.promoTicker.filter((e,n)=>{if("string"!=typeof e.promoCode||!e.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(e.text)||0===e.text.length||!e.text.every(e=>"string"==typeof e&&e.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof e.separator||!e.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!e.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom is required. Skipping this promo."),![];const i="string"==typeof e.activeFrom?new Date(e.activeFrom):e.activeFrom;if(!(i instanceof Date)||Number.isNaN(i.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!e.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil is required. Skipping this promo."),![];const o="string"==typeof e.activeUntil?new Date(e.activeUntil):e.activeUntil;return o instanceof Date&&!Number.isNaN(o.getTime())?i>=o?(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});i.promoTicker=e.length>0?e:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),i.promoTicker=void 0;i.proxy&&("object"!=typeof i.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),i.proxy=void 0):i.proxy.baseUrl&&"string"==typeof i.proxy.baseUrl?i.proxy.headers&&"object"!=typeof i.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),i.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),i.proxy=void 0))}buildConfiguration(e,i){var o,r;const a=i.env||n.STAGING,d=l[a];return{apiKey:e.trim(),env:a,isBuilder:null!==(o=i.isBuilder)&&void 0!==o?o:![],debugMode:null!==(r=i.debugMode)&&void 0!==r?r:c.NONE,baseUrl:d,partnerCode:void 0,customTheme:i.customTheme||null,proxy:i.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:i.promoTicker||null}}detectDeviceType(){var e,n;if("undefined"==typeof navigator)return"desktop";const i=navigator.userAgent.toLowerCase(),o="ontouchstart"in window||navigator.maxTouchPoints>0,r=(null===(e=window.screen)||void 0===e?void 0:e.width)||0,a=(null===(n=window.screen)||void 0===n?void 0:n.height)||0,c=Math.max(r,a),l=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],d=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return l.some(e=>e.test(i))?"tablet":d.some(e=>e.test(i))||o&&c<768?"mobile":o&&c>=768&&c<=1200||o&&/macintosh/i.test(i)&&navigator.maxTouchPoints>1||/android/i.test(i)&&o&&c>=768||/windows nt/i.test(i)&&o&&c>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(i),"desktop")}}function fetchAdapter(e){return async(n,i)=>{var o;const r=await e(n,i);let a;if("function"==typeof(null===(o=r.headers)||void 0===o?void 0:o.entries))a=Object.fromEntries(r.headers.entries());else{a={};for(const[e,n]of r.headers)a[e]=n}return{ok:r.ok,status:r.status,statusText:r.statusText,headers:a,json:()=>r.json(),text:()=>r.text()}}}const xhrFetch=(e,n)=>new Promise((i,o)=>{const r=new XMLHttpRequest;r.open(n.method||"GET",e);for(const[e,a]of objectEntries(n.headers))r.setRequestHeader(e,a);r.onload=()=>{i({ok:r.status>=200&&r.status<300,status:r.status,statusText:r.statusText,headers:r.getAllResponseHeaders().split("\r\n").reduce((e,n)=>{const[i,o]=n.split(": ");return i&&o&&(e[i]=o),e},{}),json:()=>Promise.resolve(JSON.parse(r.responseText)),text:()=>Promise.resolve(r.responseText)})},r.onerror=()=>{o(new TypeError("Network request failed"))},r.send(n.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(e){const n=[];for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.push(e[i]);return n}function objectEntries(e){const n=[];for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&n.push([i,e[i]]);return n}class AuthService{constructor(e){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=e.apiKey,this.baseUrl=e.baseUrl,this.env=e.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(e){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(e))}async authenticate(){var e,n;if(this.isAuthenticating)return await new Promise(e=>{const s=()=>{this.isAuthenticating?setTimeout(s,100):e(void 0)};s()}),!!this.accessToken;this.isAuthenticating=!![];try{const i=await this.requestWithoutAuth("/auth",{method:"GET"},!![]);return this.accessToken=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e.token,this.tokenExpiration=Date.now()+1e3*(null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.exp),!![]}catch(i){return this.logger.error("Authentication failed",i),![]}finally{this.isAuthenticating=![]}}async requestWithoutAuth(e,n,i=![]){return this.circuitBreaker.execute(async()=>{const i=this.buildUrl(e),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(),...n.headers};this.clientConfig.isBuilder()&&(o["X-Liquid-Api-Builder"]=!![]);const r={method:n.method,headers:o,body:n.body?JSON.stringify(n.body):void 0},a=await this.httpClient(i,r);if(!a.ok)throw{message:"HTTP error status: "+a.status,status:a.status};return a.json()},n.method+" "+e+" (no-auth)",{critical:i})}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(e,n,i=![]){return this.circuitBreaker.execute(async()=>{this.accessToken&&!this.isTokenExpired()||await this.authenticate();const i=this.buildUrl(e),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(),...n.headers};this.clientConfig.isBuilder()&&(o["X-Liquid-Api-Builder"]=!![]);const r={method:n.method,headers:o,body:n.body?JSON.stringify(n.body):void 0},a=await this.httpClient(i,r);let c;try{c=await a.json()}catch(l){const e=await a.text().catch(()=>"HTTP error status: "+a.status);c={message:e||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},n.method+" "+e,{critical:i})}buildUrl(e){const n=this.clientConfig.getProxyConfig();return new URL("api"+e,n?n.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const e=this.clientConfig.getProxyConfig();return e?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...e.headers}:{}}async get(e,n){return this.request(e,{method:"GET",headers:null==n?void 0:n.headers},null==n?void 0:n.critical)}async post(e,n){return this.request(e,{method:"POST",body:null==n?void 0:n.body,headers:null==n?void 0:n.headers},null==n?void 0:n.critical)}async put(e,n){return this.request(e,{method:"PUT",body:null==n?void 0:n.body,headers:null==n?void 0:n.headers},null==n?void 0:n.critical)}async delete(e,n){return this.request(e,{method:"DELETE",headers:null==n?void 0:n.headers},null==n?void 0:n.critical)}}const u="@liquidcommerce/elements-sdk",h="LiquidCommerce Elements SDK",p="UNLICENSED",m="LiquidCommerce Team",f="2.2.0-beta.26",g="https://docs.liquidcommerce.co/elements-sdk",v={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},y={url:"https://github.com/liquidcommerce/elements-sdk/issues"},b="./dist/index.esm.js",x="./umd/elements.js",w="./dist/types/index.d.ts",C="pnpm@10.0.0",S={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},I=["dist","umd","docs","README.md","LICENSE"],P={access:"public",registry:"https://registry.npmjs.org/"},D="module",F=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],_={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"},z=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],O={"@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.0.0","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.8.0","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.52.4","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"},M={node:">=20"},L={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"]},R={name:u,description:h,license:p,author:m,version:f,homepage:g,repository:v,bugs:y,module:b,browser:x,types:w,packageManager:C,exports:S,files:I,publishConfig:P,type:D,sideEffects:F,scripts:_,keywords:z,devDependencies:O,engines:M,pnpm:L};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(e=>{if("loading"!==document.readyState)return e(),void 0;document.addEventListener("DOMContentLoaded",()=>e())})}isGTMAlreadyLoaded(){if("function"==="object".gtag)return!![];const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.length>0}isContainerLoaded(e){const n=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return n.some(n=>{const i=n.src;return i.includes("id="+e)})}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...e)=>window.dataLayer.push(e),window.dataLayer.push({"gtm.start":Date.now(),event:"gtm.js"}),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(e){return new Promise((n,i)=>{if(this.isContainerLoaded(e))return this.logger.info("GTM container "+e+" already loaded, skipping script injection"),n(),void 0;this.logger.info("Loading GTM container "+e);const o=document.createElement("script");o.src="https://www.googletagmanager.com/gtm.js?id="+e,o.async=!![];const r=setTimeout(()=>i(new Error("GTM script timeout: "+e)),5e3);o.onload=()=>{clearTimeout(r),this.logger.info("GTM container "+e+" loaded successfully"),n()},o.onerror=()=>{clearTimeout(r),i(new Error("GTM script failed: "+e))},document.head.appendChild(o)})}processEventQueue(){const e=Date.now(),n=this.eventQueue.filter(n=>e-n.timestamp<3e4);for(const o of n)try{const e={event:o.eventName,...o.eventData};window.dataLayer.push(e),"function"==="object".gtag&&window.gtag("event",o.eventName,o.eventData),this.logger.debug("Processed queued GTM event: "+o.eventName,{data:o.eventData})}catch(i){this.logger.error("Error processing queued event "+o.methodName,i)}this.eventQueue=[],n.length>0&&this.logger.info("Processed "+n.length+" queued GTM events")}getSendToTargets(){const e=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&(!this.isContainerLoaded(this.liquidCommerceGtmId)&&this.isGTMAlreadyLoaded()||e.push(this.liquidCommerceGtmId)),this.partnerEnableGaTracking&&this.partnerGtmId&&(this.isGTMAlreadyLoaded()||this.isContainerLoaded(this.partnerGtmId))&&e.push(this.partnerGtmId),0===e.length&&this.isGTMAlreadyLoaded()&&this.logger.debug("No specific targets configured, letting GTM route events naturally"),e}async initialize(e){if(this.isInitialized||this.isInitializing)return this.initializationPromise;if(!this.clientConfigService.isBuilder()){this.isInitializing=!![],this.initializationPromise=this.doInitialize(e);try{await this.initializationPromise}catch(n){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",n)}}}async doInitialize(e){if(!(null==e?void 0:e.partnerName)||!(null==e?void 0:e.liquidCommerceGtmId))throw new Error("GTM config missing required fields");if(!e.liquidCommerceEnableGaTracking&&!e.partnerEnableGaTracking)return this.logger.warn("GTM initialization skipped: No tracking enabled"),this.isInitialized=!![],this.isInitializing=![],void 0;await this.waitForDOMReady(),this.partnerName=e.partnerName,this.partnerGtmId=e.partnerGtmId,this.liquidCommerceGtmId=e.liquidCommerceGtmId,this.partnerEnableGaTracking=e.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=e.liquidCommerceEnableGaTracking;const n=this.isGTMAlreadyLoaded();n&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let i=![],o="";if(e.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(e.liquidCommerceGtmId),i=!![],o=n?"GTM integrated with existing setup (Partner GTM detected, LC container: "+e.liquidCommerceGtmId+")":"GTM initialized with container "+e.liquidCommerceGtmId}catch(r){this.logger.error("Failed to load LiquidCommerce GTM container: "+r+". Checking if partner GTM is available.",r)}if(i||(n&&window.dataLayer?(i=!![],o="GTM integrated with existing partner setup"):window.dataLayer&&Array.isArray(window.dataLayer)&&(i=!![],o="GTM initialized with dataLayer (basic functionality available)")),!i)throw this.isInitializing=![],new Error("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(o),this.processEventQueue()}executeEvent(e,n,i){try{if(this.clientConfigService.isBuilder())return;const o=this.getSendToTargets(),r={...i,...o.length>0&&{send_to:o},tenant_source:R.description+" v"+R.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:e,eventName:n,eventData:r,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+n+" (initialization pending)",{data:r}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+n+" skipped: dataLayer not available"),void 0;const a={event:n,...r};window.dataLayer.push(a),"function"==="object".gtag&&window.gtag("event",n,r),this.logger.debug("Sent GTM event: "+n,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:o.length>0?o:"no targeting",data:r})}catch(o){this.logger.error("GTM "+e+" error",o)}}calculateValue(e){const n=e.reduce((e,n)=>e+(n.price||0)*(n.quantity||1),0);return Number.parseFloat(n.toFixed(2))}viewItem(e){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}viewItemList(e,n,i){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:n,item_list_name:i,items:e})}selectItem(e,n,i){this.executeEvent("selectItem","select_item",{item_list_id:n,item_list_name:i,items:[e]})}addToCart(e){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([e]),quantity:e.quantity||1,items:[e]})}viewCart(e){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(e),items:e})}removeFromCart(e){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}beginCheckout(e,n){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(e),coupon:n,items:e})}addShippingInfo(e,n){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(e),coupon:n,items:e})}addShippingInfoWithCustomerData(e,n,i,o){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:e,coupon:n,phone:null==i?void 0:i.phone,email:null==i?void 0:i.email,birth_date:null==i?void 0:i.birth_date,customer_id:null==i?void 0:i.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(e,n,i){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(e),payment_type:n,coupon:i,items:e})}addPaymentInfoWithoutItems(e,n,i,o){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:e,payment_type:n,coupon:i,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(e){this.executeEvent("purchase","purchase",{transaction_id:e.transaction_id,value:e.value,currency:this.currency,tax:e.tax,shipping:e.shipping,coupon:e.coupon,items:e.items,subtotal:e.subtotal,total:e.total_before_discounts,discounts:e.discounts,gift_cards:e.gift_cards,net_total:e.net_total})}promoCodeAttempt(e){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:e})}promoCodeApplied(e,n){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:e,discount_amount:n})}promoCodeFailed(e,n){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:e,reason:n})}giftCardAttempt(e){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:e})}giftCardApplied(e,n){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:e,applied_amount:n})}giftCardFailed(e,n){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:e,reason:n})}increaseQuantity(e){this.executeEvent("increaseQuantity","add_to_cart",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}decreaseQuantity(e){this.executeEvent("decreaseQuantity","remove_from_cart",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}addressUpdated(e){this.executeEvent("addressUpdated","address_updated",{address_id:e.googlePlacesId,formatted_address:e.formattedAddress,address:e.address,coordinates:e.coordinates})}addressFailed(e){this.executeEvent("addressFailed","address_failed",{address_id:e.googlePlacesId,formatted_address:e.formattedAddress,address:e.address,address_error_message:e.error})}productNoAvailability(e){this.executeEvent("productNoAvailability","product_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}productSizeNoAvailability(e){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,size_id:e.sizeId,size_name:e.sizeName,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}productFulfillmentNoAvailability(e){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,size_id:e.sizeId,size_name:e.sizeName,fulfillment_type:e.fulfillmentType,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}}class PubSubService{constructor(){this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub")}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(e,n){this.publishSpecific("actions."+e,n)}publishForm(e,n){this.publishSpecific("forms."+e,n)}publishSpecific(e,n){const[i,o]=e.includes(".")?e.split(".",2):["actions",e];let r=o.split("_")[0];["product","cart","address","checkout"].includes(r)||(r="other");const a=Date.now(),c={eventId:this.generateEventId(a),namespace:i,event:o,originalEvent:e,actionNamespace:"actions"===i?r:void 0,timestamp:a},l={data:n,metadata:c};this.dispatchNativeEvents(e,l)}dispatchNativeEvents(e,n){const[i]=e.split(".",2);try{const o=new CustomEvent(this.eventPrefix+":"+e,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(o);const r=new CustomEvent(this.eventPrefix+":"+i,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(r)}catch(o){this.logger.error("Error dispatching native events for "+e,o)}}generateEventId(e){return"evt_"+e+"_"+Math.random().toString(36).slice(2,9)}}const B="liquid_elements",q={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:a.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,drawer:{isOpen:![],contentConfig:null},rerender:![],mainImage:null},j={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee:0,deliveryFee:0,discounts:0,quantity:0},promoCode:null,fulfillments:{},rerender:![],shouldReset:![],updatedAt:"",createdAt:"",events:[]},G={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:[]},U={drawer:{isOpen:![],contentConfig:null}},V={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},Y={products:{},cart:j,address:V,checkout:G,ui:U};class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(e){this.client=e}async getAllConfigs(){try{this.ensureClientInitialized();const e=await this.client.get("/configs",{critical:!![]});if(!this.validResponseData(e))throw this.logger.error("Invalid response data",e),new Error("Failed to fetch all configs: Invalid response data");return e.data}catch(e){throw this.logger.error("Error fetching configs",e),e}}async setPersistedStore(e,n){try{if(this.ensureClientInitialized(),!e)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!n||0===Object.keys(n).length)return this.logger.error("No data provided to set persisted store"),void 0;const i=await this.client.post("/configs/store/"+e,{body:n});200!==i.statusCode&&this.logger.error("Failed to set persisted store",i)}catch(i){this.logger.error("Error setting persisted store",i)}}async getPersistedStore(e){try{if(this.ensureClientInitialized(),!e)return this.logger.error("User device ID is required to get persisted store"),null;const n=await this.client.get("/configs/store/"+e);return 200!==n.statusCode?(this.logger.error("Failed to fetch persisted store",n),null):n.data}catch(n){return this.logger.error("Error fetching persisted store",n),null}}async getProductsData(e,n){try{if(this.ensureClientInitialized(),0===e.length)return this.logger.error("No product identifiers provided"),null;const i={upcs:e,ids:e,grouping:e,shouldShowOffHours:!![],isLegacy:!![],loc:n},o=await this.client.post("/cloud/catalog/availability",{body:i});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(i){return this.logger.error("Error fetching product data",i),null}}async getCartData(e){try{this.ensureClientInitialized();const n=await this.client.get("/cloud/cart"+(e?"?id="+e:""));if(200!==n.statusCode)throw this.logger.error("Failed to fetch cart data",n),new Error("Failed to fetch cart data: "+n.message);return n.cart}catch(n){throw this.logger.error("Error fetching cart data",n),n}}async updateCart(e){try{this.ensureClientInitialized();const n=await this.client.put("/cloud/cart",{body:e});if(200!==n.statusCode)throw this.logger.error("Failed to update cart",n),new Error("Failed to update cart: "+n.message);return n.cart}catch(n){throw this.logger.error("Error updating cart",n),n}}async getAddressSuggestions(e){try{if(this.ensureClientInitialized(),!e||0===e.trim().length)return this.logger.error("Query is required to fetch address suggestions"),[];const n=await this.client.get("/cloud/address/autocomplete?input="+e);return 200!==n.statusCode?(this.logger.error("Failed to fetch address suggestions",n),[]):n.data}catch(n){return this.logger.error("Error fetching address suggestions",n),[]}}async getAddressDetails(e){try{if(this.ensureClientInitialized(),!e||0===e.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 n=await this.client.get("/cloud/address/details/"+e);if(200!==n.statusCode)throw this.logger.error("Failed to fetch address details",n),new Error("Failed to fetch address details: "+n.message);return n.data}catch(n){throw this.logger.error("Error fetching address details",n),n}}async prepareCheckout(e){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/checkout/prepare",{body:e,critical:!![]});if(200!==n.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",n),new Error("Failed to fetch prepare checkout data: "+n.message);return n.checkout}catch(i){throw this.logger.error("Error fetching prepare checkout data:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),i}}async getPaymentSession(e){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/payment/session",{body:e,critical:!![]});if(201!==n.statusCode)throw this.logger.error("Failed to get payment session",n),new Error("Failed to get payment session: "+n.message);return n.data}catch(i){throw this.logger.error("Error fetching payment session:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),i}}async confirmPaymentSession(e,n){try{this.ensureClientInitialized();const i=await this.client.post("/cloud/payment/confirm",{body:{confirmationTokenId:e,setupIntentId:n},critical:!![]});if(200!==i.statusCode)throw this.logger.error("Failed to confirm payment session",i),new Error("Failed to confirm payment session: "+i.message);return i.data}catch(i){throw this.logger.error("Error confirming payment session",i),i}}async checkoutComplete(e){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/checkout/complete",{body:e,critical:!![]});if(200!==n.statusCode)throw this.logger.error("Failed to complete checkout",n),new Error("Failed to complete checkout: "+n.message);return n.order}catch(i){if(this.logger.error("Error completing checkout:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),null==i?void 0:i.error)throw new Error(i.error);throw i}}validResponseData(e){return e.data&&"object"==typeof e.data&&Object.keys(e.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:e,payload:n,next:i})=>{const o=performance.now();this.logger.group("🏪 Store "+e+" ---------------------------------"),this.logger.debug("Payload:",n);try{const e=i(),n=performance.now()-o;return this.logger.debug("Completed in "+n.toFixed(3)+"ms"),e}catch(r){throw this.logger.error('Error during store action "'+e+'"',r),r}finally{this.logger.groupEnd()}},this.performanceMiddleware=({action:e,next:n})=>{const i=performance.now(),o=n(),r=performance.now()-i;return r>16&&this.logger.warn('⚠️ Slow store operation "'+e+'": '+r.toFixed(2)+"ms"),o},this.state=Y,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:e,isLocalStorageAvailable:n,persistedStore:i}){this.localStorageKey=B+"_"+e,this.isLocalStorageAvailable=n,n?await this.loadPersistedState():i&&await this.loadFromDBPersistence(i),this.addBeforeUnloadHandler(),this.logger.info("Store service initialized successfully",{userDeviceId:e,isLocalStorageAvailable:n,hasPersistedState:null!==i,localStorageKey:this.localStorageKey})}get(e){if(!e)return{...this.state};const n=e.split(".");let i=this.state;for(const o of n){if(null==i)return;i=i[o]}return void 0!==i?Array.isArray(i)?[...i]:"object"==typeof i&&null!==i?{...i}:i:void 0}set(e,n){return this.runWithMiddleware("set",{path:e,value:n},()=>{const i=this.get(e);return this.state=this.immutableSet(this.state,e,n),this.notifyListeners(e,n,i),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(e,n){const i=this.get(e),o=n(i);return this.set(e,o)}remove(e){return this.runWithMiddleware("remove",{path:e},()=>{const n=this.get(e);if(void 0===n)return this.logger.warn('No value found at path "'+e+'" to remove.'),![];const i=e.split(".");let o=this.state;const r=i.pop();for(const a of i){if(void 0===o[a])return this.logger.warn('Path "'+e+'" does not exist in the state.'),![];o=o[a]}if(Array.isArray(o))o=o.filter((e,n)=>n!==Number.parseInt(r,10));else{if("object"!=typeof o||null===o)return this.logger.warn('Cannot remove property "'+r+'" from non-object type at path "'+e+'".'),![];{const{[r]:e,...n}=o;o=n}}return this.state=this.immutableSet(this.state,i.join("."),o),this.notifyListeners(e,void 0,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(e){return this.runWithMiddleware("batch",{updates:e},()=>{const n=[];if("function"==typeof e){const i=e(this.state);for(const[e,o]of Object.entries(i)){const i=this.get(e);n.push({path:e,oldValue:i,newValue:o,timestamp:Date.now()}),this.state=this.immutableSet(this.state,e,o)}}else for(const[i,o]of Object.entries(e)){const e=this.get(i);n.push({path:i,oldValue:e,newValue:o,timestamp:Date.now()}),this.state=this.immutableSet(this.state,i,o)}for(const{path:e,oldValue:i,newValue:o}of n)this.notifyListeners(e,o,i);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(e,n){const i=e;return this.listeners.has(i)||this.listeners.set(i,new Set),this.listeners.get(i).add(n),()=>{var e;null===(e=this.listeners.get(i))||void 0===e?void 0:e.delete(n)}}watchMany(e,n){const i=[];let o;const r=e.map(e=>this.watch(e,(r,a)=>{i.push({path:e,value:r,oldValue:a}),clearTimeout(o),o=setTimeout(()=>{i.length>0&&(n([...i]),i.length=0)},0)}));return()=>{for(const e of r)e()}}createProductInstance(e){const n="products."+e,i=this.get(n);return i?!![]:this.set(n,q)}removeProductInstance(e){const n=this.get("products"),{[e]:i,...o}=n;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(e,n,i){let o=0;const X=()=>{if(o>=this.middleware.length)return i();const r=this.middleware[o++];return r({action:e,payload:n,state:this.getState(),next:X})};return X()}immutableSet(e,n,i){const o=n.split(".");if(1===o.length){if(Array.isArray(e)){const n=[...e];return n[o[0]]=i,n}return{...e,[o[0]]:i}}const[r,...a]=o,c=e[r],l=Array.isArray(c)?[]:{};if(Array.isArray(e)){const n=[...e];return n[r]=this.immutableSet(c||l,a.join("."),i),n}return{...e,[r]:this.immutableSet(c||l,a.join("."),i)}}notifyListeners(e,n,i){const o=this.listeners.get(e);if(o)for(const l of o)try{l(n,i)}catch(a){this.logger.error('Error in store listener for path "'+e+'"',a)}const r=e.split(".");for(let l=r.length-1;l>0;l--){const e=r.slice(0,l).join("."),n=this.listeners.get(e);if(n){const o=this.get(e),a=r.slice(l).join("."),d=this.immutableSet(o,a,i);for(const i of n)try{i(o,d)}catch(c){this.logger.error('Error in store listener for parent path "'+e+'"',c)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var e;const n=this.get("address.id")||"",i=this.get("cart.id")||"";if(!n&&!i)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:n,cartId:i}),void 0;try{const o=null!==(e=this.clientConfig.get("userDeviceId"))&&void 0!==e?e:"not_defined";await this.api.setPersistedStore(o,{p:n,c:i}),this.logger.info("Session data persisted to DB",{userDeviceId:o,addressId:n,cartId:i})}catch(o){this.logger.error("Failed to persist session data to DB",o)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let e="";if(this.clientConfig.debuggingDisabled()){const n=this.get("address.id")||"",i=this.get("cart.id")||"";(n||i)&&(e=n+"_"+i)}else e=this.getState();e&&localStorage.setItem(this.localStorageKey,"string"!=typeof e?JSON.stringify(e):e)}catch(e){this.logger.error("Failed to persist store state",e)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const n=localStorage.getItem(this.localStorageKey);if(!n)return;try{const e=JSON.parse(n);for(const[n,i]of Object.entries(e))this.set(n,i);return}catch(e){if(n.includes("_")){const[e,i]=n.split("_");if(void 0!==e){const n=await this.getAddressDataFromId(e);this.set("address",n)}return void 0!==i&&this.set("cart.id",i||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:n})}}catch(n){this.logger.error("Failed to load persisted state",n),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(e){try{if(void 0!==e.p){const n=await this.getAddressDataFromId(e.p);this.set("address",n)}void 0!==e.c&&this.set("cart.id",e.c||null),this.logger.info("Session data loaded from DB persistence",{addressId:e.p,cartId:e.c})}catch(n){this.logger.error("Failed to load session data from DB persistence",n)}}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(e){if(!e||""===e.trim())return V;try{const n=await this.api.getAddressDetails(e);return n&&0!==Object.keys(n).length?{id:e,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:{lat:n.coords.lat,long:n.coords.long}}:{...V,id:e}}catch(n){return{...V,id:e}}}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance()}getLocation(){const e=this.store.get("address");if(e.address.one&&e.coordinates.long&&e.coordinates.lat)return{coords:e.coordinates,address:e.address}}}const includeCartEvents=(e,n)=>e.filter(e=>n.includes(e.type)),excludeCartEvents=(e,n)=>e.filter(e=>!n.includes(e.type)),eventsForCart=e=>excludeCartEvents(e,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=e=>{const n=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],i=includeCartEvents(e,n);return i.length>0},includeCheckoutEvents=(e,n)=>e.filter(e=>n.includes(e.type)),eventsForCheckout=e=>includeCheckoutEvents(e,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=e=>includeCheckoutEvents(e,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=e=>includeCheckoutEvents(e,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=e=>{const n=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return e.some(e=>n.includes(e.type))},K={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"},W={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=e=>e.map(e=>({type:e.type,message:e.message,level:K[e.type]||"error"})),transformCheckoutEventsRaw=e=>e.map(e=>({type:e.type,message:e.message,level:W[e.type]||"error"})),transformEventsForCart=e=>{const n=eventsForCart(e);return transformCartEventsRaw(n)},transformEventsForCheckout=e=>{const n=eventsForCheckout(e);return transformCheckoutEventsRaw(n)},transformPromoCodeCheckoutEvents=e=>{const n=promoCodeCheckoutEvents(e);return transformCheckoutEventsRaw(n)},transformGiftCardCheckoutEvents=e=>{const n=giftCardCheckoutEvents(e);return transformCheckoutEventsRaw(n)};function buildCartItemStore(e){return{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,quantity:e.quantity,maxQuantity:e.maxQuantity,unitPrice:e.unitPrice,mainImage:e.mainImage,attributes:e.attributes,loading:![],updating:![],error:null}}function buildCartTotals(e){return{subtotal:e.subtotal||0,total:e.total||0,shippingFee:e.shippingFee||0,platformFee:e.platformFee||0,engravingFee:e.engravingFee||0,deliveryFee:e.deliveryFee||0,discounts:e.discounts||0,quantity:e.quantity||0}}function buildRetailerStore(e){var n;return{id:e.id,name:e.name,platformFee:e.platformFee||0,shippingFee:e.shippingFee||0,subtotal:e.subtotal||0,address:e.address,total:e.total||0,deliveryFee:e.deliveryFee||0,engravingFee:e.engravingFee||0,fulfillments:(null===(n=e.fulfillments)||void 0===n?void 0:n.map(e=>e.id))||[]}}function buildFulfillmentStore(e,n){return{id:e.id,canEngrave:e.canEngrave||![],type:e.type,fees:e.fees,expectation:e.expectation,shippingFee:e.shippingFee||0,subtotal:e.subtotal||0,engravingFee:e.engravingFee||0,deliveryFee:e.deliveryFee||0,items:e.items||[],retailerId:n.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(e,n){var i;const o=n.formattedAddress?n:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},r={};for(const a in e.items||{}){const n=e.items[a];r[a]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,salsifyGrouping:n.salsifyGrouping,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price||0,quantity:n.quantity||0,maxQuantity:n.maxQuantity||0,unitPrice:n.unitPrice||0,mainImage:n.mainImage||"",attributes:n.attributes||{}}}return{id:e.id,promoCode:(null===(i=e.promoCode)||void 0===i?void 0:i.code)||"",items:r,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:0,platformFee:e.totals.platformFee,shippingFee:e.totals.shippingFee,subtotal:e.totals.subtotal,total:e.totals.total},updatedAt:e.updatedAt,createdAt:e.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(e,n=![]){var o,r,a,c,l,d;const u=this.store.get("cart");for(const i of Object.keys(u.items||{}))this.store.remove("cart.items."+i);for(const i of Object.keys(u.retailers||{}))this.store.remove("cart.retailers."+i);for(const i of Object.keys(u.fulfillments||{}))this.store.remove("cart.fulfillments."+i);const h={"cart.id":e.id,"cart.error":null,"cart.totals":buildCartTotals(e),"cart.updatedAt":e.updatedAt||(new Date).toISOString(),"cart.createdAt":e.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(r=null===(o=e.attributes)||void 0===o?void 0:o.promoCode)||void 0===r?void 0:r.value)?{code:e.attributes.promoCode.value.toUpperCase(),discountAmount:e.attributes.promoCode.discount||0,error:null}:null};if((null===(a=e.items)||void 0===a?void 0:a.length)>0)for(const i of e.items)h["cart.items."+i.id]=buildCartItemStore(i);if((null===(c=e.retailers)||void 0===c?void 0:c.length)>0)for(const i of e.retailers)if(h["cart.retailers."+i.id]=buildRetailerStore(i),(null===(l=i.fulfillments)||void 0===l?void 0:l.length)>0)for(const e of i.fulfillments)h["cart.fulfillments."+e.id]=buildFulfillmentStore(e,i);if((null===(d=e.events)||void 0===d?void 0:d.length)>0&&(h["cart.events"]=transformEventsForCart(e.events||[])),this.store.batch(h),n){const e=this.store.get("cart"),n=this.store.get("address");this.pubSub.publishAction(i.CART_LOADED,cartDataForEventFromStore(e,n))}}async loadCart(){try{this.store.set("cart.loading",!![]);const e=this.store.get("cart"),n=await this.api.getCartData(e.id);this.syncCartFromResponse(n,!![]),n.id!==e.id&&await this.store.persist()}catch(e){throw this.store.set("cart.error",(null==e?void 0:e.message)||"Failed to load cart"),this.logger.error("Load cart failed",e),e}finally{this.store.set("cart.loading",![])}}}const Q="lce-checkout-stripe-slot",Z={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},$={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},J={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};function centToDollar(e){return e/100}function formatCentToDollarText(e,n=!![]){const i=Math.floor(e/100),o=e%100;let r="$"+i.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(n||o>0)&&(r+=".",r+=o<10?"0"+o:o.toString()),r}function htmlStringToElement(e){const n=document.createElement("template");return n.innerHTML=e.trim(),n.content.firstElementChild}function format24TimeTo12$1(e){const n=e.match(/^(\d{1,2}):(\d{2})$/);if(!n)throw new Error("Invalid time format: "+e);const i=Number.parseInt(n[1],10),o=Number.parseInt(n[2],10);if(i<0||i>23||o<0||o>59)throw new Error("Invalid time values: "+e);const r=i>=12?"PM":"AM",a=i%12||12;return a+":"+o.toString().padStart(2,"0")+" "+r}function formatISODateToMMDDYYYY(e){if(!e)return"";try{const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const i=(n.getMonth()+1).toString().padStart(2,"0"),o=n.getDate().toString().padStart(2,"0"),r=n.getFullYear().toString();return i+"/"+o+"/"+r}catch(n){return""}}function validateMinimumAge(e,n=21,i=1930){if(!e)return{isValid:![],age:null,error:"Birth date is required"};try{const o=e instanceof Date?e:new Date(e);if(Number.isNaN(o.getTime()))return{isValid:![],age:null,error:"Invalid date format"};const r=new Date;if(o>r)return{isValid:![],age:null,error:"Birth date cannot be in the future"};const a=o.getFullYear();if(a<i)return{isValid:![],age:null,error:"Birth year cannot be before "+i+". Please check your birth date."};const c=calculateAge(o,r);return c<n?{isValid:![],age:c,error:"Must be at least "+n+" years old"}:{isValid:!![],age:c}}catch(o){return{isValid:![],age:null,error:"Error processing birth date"}}}function calculateAge(e,n){let i=n.getFullYear()-e.getFullYear();const o=n.getMonth()-e.getMonth();return(o<0||0===o&&n.getDate()<e.getDate())&&i--,Math.max(0,i)}function buildFormattedAddressString(e){const n=[],i=[];e.one&&e.one.trim()&&i.push(e.one.trim()),e.two&&e.two.trim()&&i.push(e.two.trim()),i.length>0&&n.push(i.join(" ")),e.city&&e.city.trim()&&n.push(e.city.trim());const o=[];return e.state&&e.state.trim()&&o.push(e.state.trim()),e.zip&&e.zip.trim()&&o.push(e.zip.trim()),o.length>0&&n.push(o.join(" ")),e.country&&e.country.trim()&&n.push(e.country.trim()),n.join(", ")}function capitalizeFirstLetter(e){return e?e.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.substring(1)).join(" "):e}function splitCategoryPath(e){const n=(null==e?void 0:e.split(" > ").map(e=>capitalizeFirstLetter(e.trim())))||[];return{category:n[0]||"",category2:n[1]||"",category3:n[2]||""}}function validateCustomerInfo(e){const n=[Z.firstName,Z.lastName,Z.email,Z.phone,Z.birthDate];if(!e)return{isValid:![],invalidFields:n};const i=[];for(const o of n){const n=e[o];if(!n||"string"==typeof n&&""===n.trim())i.push(o);else if("birthDate"===o){const e=validateMinimumAge(n,21,1930);e.isValid||i.push(o)}}return{isValid:0===i.length,invalidFields:i}}function validateGiftRecipientInfo(e){const n=[$.firstName,$.lastName,$.email,$.phone,$.message];if(!e)return{isValid:![],invalidFields:n};const i=[];for(const o of n){const n=e[o];(!n||"string"==typeof n&&""===n.trim())&&i.push(o)}return{isValid:0===i.length,invalidFields:i}}function validateBillingInfo(e){const n=[J.firstName,J.lastName,J.email,J.phone,J.addressOne,J.city,J.state,J.zipCode];if(!e)return{isValid:![],invalidFields:n};const i=[];for(const o of n){const n=e[o];(!n||"string"==typeof n&&""===n.trim())&&i.push(o)}return{isValid:0===i.length,invalidFields:i}}const tt=[r.PRODUCT,r.PRODUCT_IMAGE_CAROUSEL,r.PRODUCT_OPTIONS,r.PRODUCT_INTERACTIONS,r.PRODUCT_DESCRIPTION,r.PRODUCT_RETAILERS,r.PRODUCT_RETAILERS_CAROUSEL,r.PRODUCT_RETAILERS_POPUP,r.PRODUCT_RETAILERS_POPUP_LIST,r.PRODUCT_PRICE,r.PRODUCT_ADD_TO_CART_SECTION,r.PRODUCT_DRAWER,r.PRODUCT_LOADING,r.ENGRAVING_FORM,r.ENGRAVING_VIEW],et=[r.ADDRESS_INPUT,r.ADDRESS_DISPLAY],nt=[r.CART,r.CART_RETAILER,r.CART_ITEM,r.CART_FOOTER,r.CART_ITEM_QUANTITY_PRICE,r.CART_RETAILER_SUBTOTAL,r.CART_PROMO_CODE,r.CART_HEADER,r.CART_BODY,r.CART_FULFILLMENT,r.BUTTONS_CART_OPEN],it=[r.CHECKOUT,r.CHECKOUT_INFORMATION_SECTION,r.CHECKOUT_STRIPE_FORM,r.CHECKOUT_PAYMENT_FORM,r.CHECKOUT_BILLING_FORM,r.CHECKOUT_SUMMARY_SECTION,r.CHECKOUT_PROMO_CODE,r.CHECKOUT_GIFT_CARDS,r.CHECKOUT_AMOUNTS,r.CHECKOUT_ITEMS,r.CHECKOUT_COMPLETED,r.CHECKOUT_DELIVERY_INFORMATION_FORM,r.CHECKOUT_BUYER_INFORMATION_FORM,r.CHECKOUT_TIPS,r.CHECKOUT_PC_GC,r.CHECKOUT_ITEM,r.CHECKOUT_ITEM_QUANTITY,r.CHECKOUT_PLACE_ORDER_BUTTON,r.CHECKOUT_HEADER,r.CHECKOUT_PRESALE_COUNTDOWN];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}]}loadGoogleFonts(e,n="swap"){if(!e||0===e.length)return;const i=[...this.defaultFontFamilies,...e],o=i.map(e=>{const n=encodeURIComponent(e.name);return"family="+n+":wght@"+e.weights.join(";")}).join("&"),r="display="+n;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+o+"&"+r,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(e,n="swap"){const i=document.querySelector("link[data-liquid-fonts]");this.loadGoogleFonts(e,n),i&&i.remove()}injectGoogleFontsResourceHints(){const e=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),n=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!e){const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.googleapis.com",e.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(e)}if(!n){const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.gstatic.com",e.crossOrigin="",e.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(e)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const e=document.createElement("link");e.rel="stylesheet",e.href=this.googleFontsUrl,e.setAttribute("data-liquid-fonts",""),document.head.appendChild(e)}}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 }\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: "+d.ADDRESS_SUGGESTIONS+";\n list-style: none;\n overflow-y: auto;\n padding: 4px 0;\n align-self: stretch;\n border-radius: 0 0 6px 6px;\n border-right: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n border-left: 1px solid var(--accent-color, #E4E4E7);\n background: var(--drawer-background-color, #FAFAFA);\n }\n\n .address-input-container .suggestions-list.show {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n .address-input-container .suggestions-list.hide {\n display: none;\n }\n\n .address-input-container .suggestions-list.show {\n display: block;\n }\n\n .address-input-container .suggestion-item {\n display: flex;\n padding: 6px 8px;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\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: "+d.ERROR_MESSAGE+";\n }\n\n .address-input-container .error-icon {\n font-size: 16px;\n margin-right: 8px;\n }\n\n .address-input-container .error-text {\n flex: 1;\n }\n\n .address-input-container .action-buttons {\n display: flex;\n justify-content: space-between;\n position: relative;\n z-index: "+d.ADDRESS_ACTIONS+";\n }\n\n .address-input-container .action-buttons > button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n transition: all 0.2s ease;\n width: 50%;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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: "+d.CART_HEADER+";\n }\n\n .cart-header-content {\n width: 100%;\n height: 48px;\n display: flex;\n align-items: center;\n align-self: stretch;\n justify-content: space-between;\n padding: 16px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .cart-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--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: "+d.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .checkout-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n /* CSS-only accordions */\n .chevron {\n transition: transform 0.3s ease;\n }\n\n /* Product section accordions */\n .section-toggle {\n display: none;\n }\n\n .section-toggle:checked + .section-header-label .chevron {\n transform: rotate(180deg);\n color: var(--default-text-color, #18181B);\n }\n\n .retailer-section.collapsed .retailer-body-container {\n max-height: 0;\n }\n\n .retailer-section.collapsed .cart-retailer-header {\n border-bottom: none;\n }\n\n .shipping-content {\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease-out;\n padding-left: 20px;\n }\n\n /** * Loading spinner styles */\n .cart-loading-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: var(--drawer-background-color-30, #E4E4E7);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: "+d.CART_LOADING+";\n }\n\n /* Modern browsers with backdrop-filter support */\n @supports (backdrop-filter: blur(1px)) {\n .cart-loading-backdrop {\n background-color: var(--drawer-background-color-30, #E4E4E7);\n backdrop-filter: blur(1px);\n }\n }\n\n .cart-loading-spinner-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .cart-loading-spinner {\n margin-bottom: 16px;\n }\n\n .cart-spinner {\n animation: cart-spinner-rotate 2s linear infinite;\n color: var(--primary-color, #1D4ED8);\n }\n\n .cart-spinner-path {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: 0;\n stroke-linecap: round;\n animation: cart-spinner-dash 1.5s ease-in-out infinite;\n }\n\n @keyframes cart-spinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n @keyframes cart-spinner-dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n }\n\n /*PROMO CODE */\n .promo-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-self: stretch;\n flex: 1;\n }\n\n .promo-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .promo-container-wrapper {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-code-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-input-wrapper {\n flex: 1;\n }\n\n /* Style the InputComponent container */\n .promo-input-wrapper .custom-input {\n margin: 0;\n width: 100%;\n }\n\n /* Hide label in promo context since we have placeholder */\n .promo-input-wrapper .custom-input label {\n display: none;\n }\n\n /* Style the actual input inside the InputComponent */\n .promo-input-wrapper .promo-input {\n width: 100%;\n padding: 12px 16px;\n border: 1px solid #ddd;\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n box-sizing: border-box;\n }\n\n .promo-input-wrapper .promo-input:focus {\n outline: none;\n border-color: var(--primary-color, #1D4ED8);\n }\n\n .promo-input-wrapper .promo-input:disabled {\n background-color: #f8f9fa;\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n .promo-input-wrapper .promo-input.input-error {\n border-color: #dc3545; }\n\n /* Error container styling from InputComponent */\n .promo-input-wrapper .error-container {\n margin-top: 4px;\n min-height: 20px;\n }\n\n .promo-input-wrapper .error-message {\n color: #dc3545;\n font-size: 12px;\n margin: 2px 0;\n display: block;\n }\n\n /* Apply button styling */\n .apply-button {\n display: flex;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n\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: "+d.LOADING_INDICATOR+";\n width: 16px;\n height: 16px;\n border: 2px solid var(--accent-color, #E4E4E7);\n border-top: 2px solid var(--accent-color, #E4E4E7);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n\n .empty-cart-content {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getCheckoutStyles=()=>"\n .checkout-container {\n width: 100%;\n height: auto;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n align-self: stretch;\n gap: 24px;\n }\n\n .checkout-container:not(.independent) {\n padding: 24px;\n }\n\n .checkout-container.independent {\n padding: 24px;\n }\n\n .checkout-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: "+d.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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: "+d.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--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: "+d.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--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 h3 {\n overflow: hidden;\n color: var(--base-foreground, #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: 100%;\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:last-child, .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: '+d.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: "+d.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--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 .product-engraving {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-engraving > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .product-engraving .product-info-section,\n .product-engraving .fulfillment-section,\n .product-engraving .personalization-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 .product-engraving .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 .product-engraving .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 .product-engraving .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 .personalization-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 .product-engraving .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 .product-engraving .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .product-engraving .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 .personalization-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .personalization-section .personalization-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 .personalization-section .personalization-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 .personalization-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 .personalization-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 .personalization-input-wrapper .personalization-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 .personalization-input-wrapper .personalization-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 .personalization-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 .personalization-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: "+d.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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: "+d.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n }\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: "+d.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .add-to-cart-container .add-to-cart-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .add-to-cart-container .add-to-cart-button.disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n\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: "+d.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 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: "+d.DRAWER_WRAPPER+";\n pointer-events: none;\n }\n\n .drawer-wrapper.open {\n pointer-events: auto;\n }\n\n /* Backdrop overlay */\n .drawer-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: "+d.DRAWER_BACKDROP+";\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n pointer-events: none;\n }\n\n .drawer-backdrop.visible {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n /* Main drawer */\n .drawer {\n position: absolute;\n top: 0;\n right: 0;\n width: 400px;\n height: 100vh; /* Fallback for browsers that don't support dvh */\n height: 100dvh;\n z-index: "+d.DRAWER_CONTENT+";\n background-color: #ffffff;\n overflow: hidden;\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n }\n\n /* Opened drawer state */\n .drawer.open {\n transform: translateX(0);\n }\n\n .drawer.address-input .drawer-content,\n .drawer.engraving-form .drawer-content,\n .drawer.product-retailers-popup-list .drawer-content {\n padding: 16px;\n }\n\n /* Content area - fills the remaining space */\n .drawer-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n background-color: var(--drawer-background-color, #FAFAFA);\n }\n\n /* Content swap animation classes */\n .drawer-content-fade-out {\n opacity: 1;\n transition: opacity 150ms ease-out;\n }\n\n .drawer-content-fade-out.fading {\n opacity: 0;\n }\n\n .drawer-content-fade-in {\n opacity: 0;\n transition: opacity 150ms ease-in;\n }\n\n .drawer-content-fade-in.visible {\n opacity: 1;\n }\n\n /* Mobile adjustments */\n @media (max-width: 576px) {\n .drawer {\n width: 100%;\n }\n }\n\n /* Accessibility - respect user's motion preferences */\n @media (prefers-reduced-motion: reduce) {\n .drawer,\n .drawer-backdrop,\n .drawer-content-fade-out,\n .drawer-content-fade-in {\n transition: none;\n }\n }\n "}const getProductLoadingStyles=()=>"\n .skeleton-container {\n min-width: 320px;\n width: 100%;\n height: auto;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n }\n\n .skeleton-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .skeleton-container .wave {\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .skeleton-container .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+d.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n /* 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 ot={"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"},rt={backgroundColor:"--product-background-color"},st={backgroundColor:"--cart-background-color"},at={backgroundColor:"--address-background-color"},ct={backgroundColor:"--checkout-background-color"},lt={global:ot,product:rt,cart:st,address:at,checkout:ct};function getCSSVariableMapping(e){return lt[e]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(e,n){const i={},o=getCSSVariableMapping(n);for(const[r,a]of Object.entries(o)){const n=this.getValueByPath(e,r);void 0!==n&&this.isCSSValue(n)&&(i[a]=n,this.isColorVariable(a,n)&&this.generateOpacityVariants(i,a,n))}return i}extractVariablesFromPartialTheme(e,n){const i={},o=getCSSVariableMapping(n);for(const[r,a]of Object.entries(o))if(this.hasValueAtPath(e,r)){const n=this.getValueByPath(e,r);void 0!==n&&this.isCSSValue(n)&&(i[a]=n,this.isColorVariable(a,n)&&this.generateOpacityVariants(i,a,n))}return i}generateCSSVariablesString(e){return Object.entries(e).map(([e,n])=>" "+e+": "+n+";").join("\n")}updateCSSVariablesInStylesheet(e,n){if(0!==Object.keys(n).length)try{const i=this.findOrCreateRule(e);for(const[e,o]of Object.entries(n))i.style.setProperty(e,String(o))}catch(i){this.logger.warn("Failed to update CSS variables")}}getValueByPath(e,n){return n.split(".").reduce((e,n)=>e&&void 0!==e[n]?e[n]:void 0,e)}hasValueAtPath(e,n){const i=n.split(".");let o=e;for(const r of i){if(null==o||!(r in o))return![];o=o[r]}return!![]}findOrCreateRule(e){const n=":host";for(const o of Array.from(e.cssRules))if(o instanceof CSSStyleRule&&o.selectorText===n)return o;const i=e.insertRule(n+" {}");return e.cssRules[i]}isCSSValue(e){if("string"==typeof e){if(""===e.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(e.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(e))return!![];if(/^[a-z-]+$/.test(e))return!![]}return"number"==typeof e}generateOpacityVariants(e,n,i){for(const o of this.opacityLevels){const r=n+"-"+o.suffix,a=this.addOpacityToHexColor(i,o.value);a&&(e[r]=a)}}isColorVariable(e,n){if("string"!=typeof n)return![];const i=e.toLowerCase().includes("color"),o=/^#[0-9a-f]{3,8}$/i.test(n);return i&&o}addOpacityToHexColor(e,n){if(!e.startsWith("#"))return null;let i=e.slice(1);if(3===i.length&&(i=i.split("").map(e=>e+e).join("")),6!==i.length)return null;const o=Math.round(255*n),r=o.toString(16).padStart(2,"0");return"#"+i+r}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(e){return this.styleSheets.get(e)}generateSpecificStylesheet(e,n){const i=this.cssProcessor.extractVariablesFromTheme(n,e),o=this.cssProcessor.generateCSSVariablesString(i),r=this.getStylesheetStyles(e).join("\n\n"),a=0===o.length?"":":host { "+o+" }",c=("\n "+a+"\n\n "+r+"\n ").trim();this.createStylesheet(e,c)}createStylesheet(e,n){try{if(this.isCSSStyleSheetSupported()){const i=new CSSStyleSheet;i.replaceSync(n),this.styleSheets.set(e,i)}else this.styleSheets.set(e,n)}catch(R){this.styleSheets.set(e,n)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const e=new CSSStyleSheet;return e.replaceSync("/* test */"),!![]}catch(e){return![]}}updateVariablesInStylesheet(e,n,i){const o=this.styleSheets.get(e);if(o&&"string"!=typeof o){const e=this.cssProcessor.extractVariablesFromPartialTheme(n,i);this.cssProcessor.updateCSSVariablesInStylesheet(o,e)}}getStylesheetStyles(e){switch(e){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(e){this.data=e,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme)}updateComponentGlobalConfigs(e){var n,i;const o=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),e),this.data.global.layout.showPoweredBy=o,((null===(n=e.theme)||void 0===n?void 0:n.headingFont)||(null===(i=e.theme)||void 0===i?void 0:i.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",e.theme,"global")}updateProductComponent(e){this.data.product=this.deepMerge(this.getConfigs("product"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",e.theme,"product")}updateAddressComponent(e){this.data.address=this.deepMerge(this.getConfigs("address"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",e.theme,"address")}updateCartComponent(e){this.data.cart=this.deepMerge(this.getConfigs("cart"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",e.theme,"cart")}updateCheckoutComponent(e){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",e.theme,"checkout")}getConfigs(e){return"all"===e?this.data:this.data[e]}getComponentConfig(e){return-1!==tt.indexOf(e)?this.getConfigs("product"):-1!==et.indexOf(e)?this.getConfigs("address"):-1!==nt.indexOf(e)?this.getConfigs("cart"):-1!==it.indexOf(e)?this.getConfigs("checkout"):void 0}getStylesheet(e){const n=this.getBaseStylesheets();if(e===r.DRAWER){const e=[...n],i=this.stylesheetGenerator.getStylesheet("product"),o=this.stylesheetGenerator.getStylesheet("cart"),r=this.stylesheetGenerator.getStylesheet("checkout"),a=this.stylesheetGenerator.getStylesheet("address");return i&&e.push(i),o&&e.push(o),r&&e.push(r),a&&e.push(a),e}let i;if(et.includes(e)||e===r.ADDRESS)i="address";else if(tt.includes(e)||e===r.PRODUCT)i="product";else if(nt.includes(e)||e===r.CART)i="cart";else{if(!it.includes(e)&&e!==r.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+e+", returning base stylesheets only."),n;i="checkout"}const o=this.stylesheetGenerator.getStylesheet(i);return o?[...n,o]:n}getBaseStylesheets(){const e=[],n=this.stylesheetGenerator.getStylesheet("global"),i=this.stylesheetGenerator.getStylesheet("ui");return n&&e.push(n),i&&e.push(i),e}deepMerge(e,n){const i={...e};for(const o in n)null!==n[o]&&void 0!==n[o]&&("object"!=typeof n[o]||Array.isArray(n[o])||"object"!=typeof e[o]||Array.isArray(e[o])?i[o]=n[o]:i[o]=this.deepMerge(e[o],n[o]));return i}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(e,n){const o={type:e,data:n||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:o}),e===r.CART&&this.pubSub.publishAction(i.CART_OPENED,!![]),e===r.CHECKOUT&&this.pubSub.publishAction(i.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const e=this.store.get("ui.drawer.contentConfig");(null==e?void 0:e.type)===r.CART&&this.pubSub.publishAction(i.CART_CLOSED,!![]),(null==e?void 0:e.type)===r.CHECKOUT&&this.pubSub.publishAction(i.CHECKOUT_CLOSED,!![])}}function buildCheckoutItemStore(e,n,i){return{liquidId:e.liquidId,variantId:e.variantId,cartItemId:e.cartItemId,retailerId:e.retailerId,fulfillmentId:e.fulfillmentId,salsifyGrouping:e.salsifyGrouping,name:e.name,catPath:e.catPath,volume:e.volume,uom:e.uom,proof:e.proof,abv:e.abv,containerType:e.containerType,container:e.container,size:e.size,pack:e.pack,packDesc:e.packDesc,mainImage:e.mainImage,brand:e.brand,partNumber:e.partNumber,upc:e.upc,sku:e.sku,price:e.price,unitPrice:e.unitPrice,quantity:e.quantity,unitTax:e.unitTax,bottleDeposits:e.bottleDeposits,attributes:e.attributes,retailerName:n.name,expectationDetail:i.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(e){var n,o,r;try{this.store.set("checkout.loading",!![]);const c=e||this.store.get("cart.id"),l=this.store.get("cart");if(0===(null===(n=Object.values(l.items))||void 0===n?void 0:n.length)&&!e)return;const d=this.themeProvider.getConfigs("checkout"),u={canEmail:d.layout.emailOptIn.checked,canSms:d.layout.smsOptIn.checked};if(!c)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const h={"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:""}},p=await this.api.prepareCheckout({cartId:c,marketingPreferences:u});if((null===(o=p.retailers)||void 0===o?void 0:o.length)>0)for(const e of p.retailers)for(const n of e.fulfillments)n.type===a.ON_DEMAND&&(h["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:e.id,retailerName:e.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal});if((null===(r=p.items)||void 0===r?void 0:r.length)>0){this.store.remove("checkout.items");for(const e of p.items){const n=p.retailers.find(n=>n.id===e.retailerId),i=n.fulfillments.find(n=>n.id===e.fulfillmentId);h["checkout.items."+e.cartItemId]=buildCheckoutItemStore(e,n,i)}}p.isPresaleLocked&&p.presaleExpiresAt&&(h["checkout.isPresaleLocked"]=p.isPresaleLocked,h["checkout.presaleExpiresAt"]=p.presaleExpiresAt),h["checkout.token"]=p.token,h["checkout.cartId"]=p.cartId,h["checkout.customer"]=p.customer,h["checkout.acceptedAccountCreation"]=p.acceptedAccountCreation,h["checkout.billingSameAsShipping"]=p.billingSameAsShipping,h["checkout.hasAgeVerify"]=p.hasAgeVerify,h["checkout.hasSubstitutionPolicy"]=p.hasSubstitutionPolicy,h["checkout.isGift"]=p.isGift,h["checkout.marketingPreferences"]=p.marketingPreferences,h["checkout.giftCards"]=p.giftCards.map(e=>({code:e.code,discountAmount:e.applied})),h["checkout.promoCode"]=p.promoCode.value?{code:p.promoCode.value,discountAmount:p.promoCode.discount}:null,h["checkout.marketingPreferences.canEmail"]=p.marketingPreferences.canEmail,h["checkout.marketingPreferences.canSms"]=p.marketingPreferences.canSms,h["checkout.amounts"]=p.amounts,h["checkout.error"]=null,h["checkout.updating"]=![],h["checkout.events"]=p.events||[],this.store.batch(h),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_LOADED,{cartId:p.cartId})}catch(c){throw this.store.set("checkout.error",c.message),this.pubSub.publishAction(i.CHECKOUT_FAILED,{message:c.message}),c}finally{this.store.set("checkout.loading",![])}}async partialLoadCheckout(e){var n,o,r,c,l;try{let i;if(this.store.set("checkout.updating",!![]),(null==e?void 0:e.cartResponse)?this.commonCommands.syncCartFromResponse(e.cartResponse):await this.commonCommands.loadCart(),null==e?void 0:e.response)i=e.response;else{const o=null!==(n=null==e?void 0:e.cartId)&&void 0!==n?n:this.store.get("checkout.cartId");if(!o)return this.store.set("checkout.error","Cart ID is not provided"),void 0;i=await this.api.prepareCheckout({cartId:o})}const d={"checkout.token":i.token,"checkout.events":transformEventsForCheckout(i.events||[]),"checkout.amounts":i.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCards":i.giftCards.map(e=>({code:e.code,discountAmount:e.applied})),"checkout.promoCode":(null===(r=null===(o=null==i?void 0:i.promoCode)||void 0===o?void 0:o.value)||void 0===r?void 0:r.trim())?{code:i.promoCode.value,discountAmount:i.promoCode.discount}:null};if((null===(c=i.retailers)||void 0===c?void 0:c.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const e of i.retailers)for(const n of e.fulfillments)n.type===a.ON_DEMAND&&(d["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:e.id,retailerName:e.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal})}if((null===(l=i.items)||void 0===l?void 0:l.length)>0){this.store.remove("checkout.items");for(const e of i.items){const n=i.retailers.find(n=>n.id===e.retailerId),o=n.fulfillments.find(n=>n.id===e.fulfillmentId);d["checkout.items."+e.cartItemId]=buildCheckoutItemStore(e,n,o)}}this.store.batch(d),this.validateAndUpdateFormStatus()}catch(d){const e=(null==d?void 0:d.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",e),this.pubSub.publishAction(i.CHECKOUT_FAILED,{message:e}),d}finally{this.store.set("checkout.updating",![])}}async toggleIsGift(e){const n=this.store.get("checkout.isGift"),o=null!=e?e:!n;this.store.batch({"checkout.isGift":o,"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,email:"",firstName:"",lastName:"",message:null,phone:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_IS_GIFT_TOGGLED,{isActive:o})}async toggleBillingSameAsShipping(e){const n=this.store.get("checkout.billingSameAsShipping"),o=null!=e?e:!n;this.store.batch({"checkout.billingSameAsShipping":o,"checkout.billing":{firstName:"",lastName:"",email:"",phone:"",addressOne:"",addressTwo:"",city:"",state:"",zipCode:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:o})}toggleMarketingPreferences(e,n){const o=this.store.get("checkout.marketingPreferences."+e),r=null!=n?n:!o;this.store.set("checkout.marketingPreferences."+e,r),this.pubSub.publishAction(i.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:e,isActive:r})}async getPaymentSession(){try{const e=this.store.get("cart.id"),n=await this.api.getPaymentSession({cartId:e});this.store.set("checkout.payment",{key:n.key,secret:n.secret,paymentMethodId:null})}catch(e){throw this.store.batch({"checkout.error":e.message,"checkout.loading":![]}),e}}async confirmPaymentSession(e,n){try{const i=await this.api.confirmPaymentSession(e,n);this.store.batch({"checkout.payment.paymentMethodId":i.id,"checkout.readyForSubmit.payment":!![],"checkout.card":{...i.card}})}catch(i){throw new Error("Failed to confirm payment session. Please try again.")}}async applyPromoCode(e){var n;try{this.googleTagManager.promoCodeAttempt(e);const i=this.dataForCheckoutPrepare(),o=await this.api.prepareCheckout({...i,promoCode:e}),r=0!==o.amounts.discounts,a=null===(n=transformPromoCodeCheckoutEvents(o.events||[]))||void 0===n?void 0:n[0];if(!r)return this.store.set("checkout.promoCodeError",a?a.message:'Code "'+e+'" does not exist'),this.googleTagManager.promoCodeFailed(e,(null==a?void 0:a.message)||"not_applied"),void 0;this.googleTagManager.promoCodeApplied(e,o.amounts.discounts),await this.partialLoadCheckout({response:o})}catch(i){const n=(null==i?void 0:i.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",n),this.googleTagManager.promoCodeFailed(e,n),i}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(R){const n=R.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",n),R}}async removePromoCode(){var e,n;try{const i=this.dataForCheckoutPrepare(),o=(null===(n=null===(e=this.store.get("checkout"))||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.code)||"",r=await this.api.prepareCheckout({...i,promoCode:""});if(0!==r.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.googleTagManager.promoCodeApplied(o,0),await this.partialLoadCheckout({response:r})}catch(i){const e=(null==i?void 0:i.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",e);const n=this.store.get("checkout.promoCode.code")||"";throw n&&this.googleTagManager.promoCodeFailed(n,e),i}}async applyGiftCard(e){var n;const i=e.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(i);const e=this.dataForCheckoutPrepare(),o=e.giftCards||[],r=await this.api.prepareCheckout({...e,giftCards:[...o,i]}),a=null===(n=transformGiftCardCheckoutEvents(r.events||[]))||void 0===n?void 0:n[0],c=hasAnyRetailerGiftCardRestriction(r.events||[]);if(a){if(!c)return this.store.set("checkout.giftCardError",a.message),void 0;this.store.set("checkout.giftCardError",a.message)}const l=r.giftCards.find(e=>e.code===i);if(!l)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.googleTagManager.giftCardFailed(i,(null==a?void 0:a.message)||"not_applied"),void 0;this.googleTagManager.giftCardApplied(i,l.applied),await this.partialLoadCheckout({response:r})}catch(o){const e=(null==o?void 0:o.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",e),this.googleTagManager.giftCardFailed(i,e),o}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(R){throw this.store.set("checkout.error",(null==R?void 0:R.message)||"Failed to clear gift card error. Please try again."),R}}async removeGiftCard(e){var n;const i=e.trim().toUpperCase();try{const e=this.dataForCheckoutPrepare(),o=(null===(n=e.giftCards)||void 0===n?void 0:n.filter(e=>e!==i))||[],r=await this.api.prepareCheckout({...e,giftCards:o}),a=r.giftCards.find(e=>e.code===i);if(a)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+i),void 0;this.googleTagManager.giftCardApplied(i,0),await this.partialLoadCheckout({response:r})}catch(o){const e=(null==o?void 0:o.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",e),this.googleTagManager.giftCardFailed(i,e),o}}updateCustomerInfo(e,n){try{this.store.set("checkout.customer."+e,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{fieldName:e})}catch(o){throw this.store.set("checkout.error",o.message),o}}updateBillingInfo(e,n){try{this.store.set("checkout.billing."+e,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_BILLING_INFORMATION_UPDATED,{fieldName:e})}catch(o){throw this.store.set("checkout.error",o.message),o}}updateGiftInfo(e,n){try{this.store.set("checkout.giftRecipient."+e,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(i.CHECKOUT_GIFT_INFORMATION_UPDATED,{fieldName:e})}catch(o){throw this.store.set("checkout.error",o.message),o}}triggerAddShippingInfoEvent(){var e,n;const i=this.store.get("checkout");if(i.customer.email||i.customer.phone){const o=(null===(e=null==i?void 0:i.customer)||void 0===e?void 0:e.id)||(null===(n=null==i?void 0:i.customer)||void 0===n?void 0:n.email),r={subtotal:centToDollar(i.amounts.subtotal),total_before_discounts:centToDollar(i.amounts.subtotal+i.amounts.tax+i.amounts.shipping+i.amounts.delivery+i.amounts.platform+i.amounts.service),discounts:centToDollar(i.amounts.discounts),gift_cards:centToDollar(i.amounts.giftCards||0),net_total:centToDollar(i.amounts.total)};this.googleTagManager.addShippingInfoWithCustomerData(centToDollar(i.amounts.total),void 0,{phone:i.customer.phone,email:i.customer.email,birth_date:i.customer.birthDate,customer_id:o},r)}}validateAndUpdateFormStatus(){const e=this.store.get("checkout"),n=validateCustomerInfo(e.customer),i=e.isGift?validateGiftRecipientInfo(e.giftRecipient):{isValid:!![],invalidFields:[]},o=e.billingSameAsShipping?{isValid:!![],invalidFields:[]}:validateBillingInfo(e.billing),r=n.isValid&&i.isValid&&o.isValid,a=[...n.invalidFields.map(e=>"customer."+e),...i.invalidFields.map(e=>"giftRecipient."+e),...o.invalidFields.map(e=>"billing."+e)];this.store.batch({"checkout.isFormValid":r,"checkout.invalidFields":a,"checkout.readyForSubmit.customer":n.isValid,"checkout.readyForSubmit.gift":i.isValid,"checkout.readyForSubmit.billing":o.isValid})}async checkoutComplete(){var e;try{const n=this.store.get("checkout"),o=this.store.get("checkout.payment.paymentMethodId");if(!n.token||!o)return;const a=await this.api.checkoutComplete({token:n.token,payment:o}),c=a.legacyOrderNumber||a.referenceId||"N/A";n.isPresaleLocked||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(r.CHECKOUT_COMPLETED,{orderNumber:c,orderTotal:n.amounts.total,cardLast4:n.card.last4,customerEmail:n.customer.email,giftRecipientEmail:(null===(e=n.giftRecipient)||void 0===e?void 0:e.email)||null}),this.pubSub.publishAction(i.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:c,orderTotal:n.amounts.total}),this.googleTagManager.purchase({transaction_id:c,tax:centToDollar(n.amounts.tax||0),shipping:centToDollar(n.amounts.shipping||0),items:[...Object.values(n.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],value:centToDollar(n.amounts.total),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)})}catch(n){const e=(null==n?void 0:n.message)||"Checkout complete failed";throw this.store.batch({"checkout.error":e,"checkout.readyForSubmit.prepared":![],"checkout.readyForSubmit.payment":![],"checkout.payment.sendSubmitSignal":![]}),this.pubSub.publishAction(i.CHECKOUT_SUBMIT_FAILED,{message:e}),n}finally{this.store.set("checkout.loading",![])}}async startPreparingCheckoutSubmit(){var e,n,o,r;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(i.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!==(e=a.billing.company)&&void 0!==e?e: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!==(n=a.isGift?a.giftRecipient.addressTwo:a.customer.addressTwo)&&void 0!==n?n: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===(r=a.giftCards)||void 0===r?void 0:r.map(e=>e.code))||[],deliveryInstructions:Object.values(a.onDemandFulfillmentTipInfo||{}).map(e=>({fulfillmentId:e.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 d={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,d)}catch(a){const e=(null==a?void 0:a.message)||"Checkout preparation failed";throw this.store.batch({"checkout.error":e,"checkout.loading":![]}),this.pubSub.publishAction(i.CHECKOUT_SUBMIT_FAILED,{message:e}),a}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(r.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async focusFirstInvalidField(){try{const e=this.store.get("checkout.invalidFields")||[];if(0===e.length)return;const n=e[0];this.store.set("checkout.focusField",n),setTimeout(()=>{this.store.set("checkout.focusField",null)},100)}catch(e){this.logger.error("Checkout form validation focus operation failed",{error:e instanceof Error?e.message:String(e)})}}buildItemUpdate(e,n){var i,o,r;const a={id:e.cartItemId,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:n},c=(null===(r=null===(o=null===(i=e.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(e=>""!==e.trim()))||[];return c.length>0&&(a.engravingLines=c),a}async updateCheckoutItemQuantity(e,n){try{this.store.set("checkout.items."+e+".updating",!![]);const o=this.store.get("checkout.cartId"),r=this.store.get("checkout.items."+e);if(!r)throw new Error("Item not found");const a=r.quantity,c=r.quantity+n;if(c<1)return this.removeItem(e,!![]);const l=this.buildItemUpdate(r,c),d=await this.api.updateCart({id:o,items:[l],loc:this.getLocation()});this.pubSub.publishAction(n>0?i.CHECKOUT_ITEM_QUANTITY_INCREASE:i.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:r.cartItemId,quantity:c,previousQuantity:a});const u=splitCategoryPath(r.catPath),h={item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:Math.abs(n),price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId};n<0?this.googleTagManager.removeFromCart(h):n>0&&this.googleTagManager.addToCart(h),await this.partialLoadCheckout({cartResponse:d})}catch(o){throw this.store.set("checkout.items."+e+".error",o.message),o}finally{this.store.set("checkout.items."+e+".updating",![])}}async removeItemEngraving(e){var n,o,r;try{const a=this.store.get("checkout.items."+e);if(!a)throw new Error("Item not found in checkout");if(!(null===(n=a.attributes)||void 0===n?void 0:n.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:e}),void 0;const c=(null===(r=null===(o=a.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[],l={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:[]},d=this.store.get("checkout.cartId"),u=await this.api.updateCart({id:d,items:[l],loc:this.getLocation()});this.pubSub.publishAction(i.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:a.cartItemId,engravingLines:[],previousEngravingLines:c}),await this.partialLoadCheckout({cartResponse:u})}catch(a){throw this.store.set("checkout.items."+e+".error",a.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:e,error:a.message}),a}}async removeItem(e,n){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;n||this.store.set("checkout.items."+e+".updating",!![]);const o=this.store.get("checkout.cartId"),r=this.store.get("checkout.items."+e);if(!r)throw new Error("Item not found");const a=this.buildItemUpdate(r,0),c=await this.api.updateCart({id:o,items:[a],loc:this.getLocation()});this.store.remove("checkout.items."+e),this.pubSub.publishAction(i.CHECKOUT_ITEM_REMOVED,{cartItemId:r.cartItemId}),await this.partialLoadCheckout({cartResponse:c})}catch(o){throw this.store.set("checkout.items."+e+".error",o.message),o}}async updateTips(e){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",e);const n=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},o=Object.values(n).map(n=>{const i=Math.round(n.subtotal*e/100);return{fulfillmentId:n.fulfillmentId,tip:i}}),r=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:o});this.updateStoreFromCheckoutResponse(r),this.pubSub.publishAction(i.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to update tips. Please try again."),n}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(e,n){try{this.store.set("checkout.updating",!![]);const o=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},r=Object.values(o).map(i=>({fulfillmentId:i.fulfillmentId,tip:i.fulfillmentId===e?n:i.tip})),a={...this.dataForCheckoutPrepare(),deliveryTips:r},c=await this.api.prepareCheckout(a);this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(i.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}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(e){try{this.store.set("checkout.updating",!![]);const n=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},o=Object.values(n).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===e?0:n.tip})),r=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:o});this.updateStoreFromCheckoutResponse(r),this.pubSub.publishAction(i.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to remove fulfillment tip. Please try again."),n}finally{this.store.set("checkout.updating",![])}}updateStoreFromCheckoutResponse(e){var n;const i={"checkout.amounts":e.amounts,"checkout.warning":e.warning,"checkout.events":transformEventsForCheckout(e.events||[]),"checkout.error":null};if((null===(n=e.retailers)||void 0===n?void 0:n.length)>0)for(const o of e.retailers)for(const e of o.fulfillments)e.type===a.ON_DEMAND&&(i["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:o.id,retailerName:o.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});this.store.batch(i)}async updateStripeFormStatus(e){try{const n=this.store.get("checkout.stripeFormStatus")||{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},i={...n,...e};this.store.set("checkout.stripeFormStatus",i)}catch(n){throw this.logger.error("Error updating Stripe form status",{error:n instanceof Error?n.message:String(n)}),n}}async removeCheckoutError(){this.store.set("checkout.error",null)}async updateDeliveryInstructions(e){this.store.set("checkout.deliveryInstructions",e)}dataForCheckoutPrepare(){var e,n,i;const o=this.store.get("checkout"),r=(null===(e=null==o?void 0:o.customer)||void 0===e?void 0:e.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:r,billingSameAsShipping:o.billingSameAsShipping,acceptedAccountCreation:o.acceptedAccountCreation,hasAgeVerify:o.hasAgeVerify,hasSubstitutionPolicy:o.hasSubstitutionPolicy,marketingPreferences:o.marketingPreferences,promoCode:(null===(n=o.promoCode)||void 0===n?void 0:n.code)||void 0,giftCards:(null===(i=null==o?void 0:o.giftCards)||void 0===i?void 0:i.map(e=>e.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 e=>{e===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(e,n){try{this.store.set("cart.items."+e+".updating",!![]);const o=this.store.get("cart.id"),r=this.store.get("cart.items."+e);if(!r)throw this.logger.error("Cart item not found: "+e+" - cannot update quantity by "+n),new Error("Item not found");const a=r.quantity+n;if(a<1)return this.removeItem(e,!![]);const c=this.buildItemUpdate(r,a),l=await this.api.updateCart({id:o,items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(l,[e]),this.updateFulfillment(r.fulfillmentId,l),this.syncRetailersFromApiResponse(l),this.syncCartMetaFromApiResponse(l),this.pubSubService.publishAction(n<0?i.CART_ITEM_QUANTITY_DECREASE:i.CART_ITEM_QUANTITY_INCREASE,{id:r.id,quantity:a,previousQuantity:r.quantity});const d=splitCategoryPath(r.catPath),u={item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_category:d.category,item_category2:d.category2,item_category3:d.category3,quantity:Math.abs(n),price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId};n<0?this.googleTagManager.removeFromCart(u):n>0&&this.googleTagManager.addToCart(u)}catch(o){throw this.store.set("cart.items."+e+".error",o.message),this.logger.error("Failed to update item quantity",o),o}finally{this.store.set("cart.items."+e+".updating",![])}}async removeItem(e,n){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;n||this.store.set("cart.items."+e+".updating",!![]);const o=this.store.get("cart.id"),r=this.store.get("cart.items."+e);if(!r)throw new Error("Item not found");const a={itemId:r.id,fulfillmentId:r.fulfillmentId,retailerId:r.retailerId},c=this.buildItemUpdate(r,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(i.CART_ITEM_REMOVED,{id:r.id});const d=splitCategoryPath(r.catPath);this.googleTagManager.removeFromCart({item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_category:d.category,item_category2:d.category2,item_category3:d.category3,quantity:r.quantity,price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId})}catch(o){throw this.store.set("cart.items."+e+".error",o.message),this.logger.error("Failed to remove item",o),o}}async updateItemEngraving(e,n){var o,r,a;try{const c=this.store.get("cart"),l=null===(o=c.items)||void 0===o?void 0:o[e];if(!l)throw new Error("Item not found");this.store.set("cart.items."+e+".updating",!![]);const d={id:l.id,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:l.quantity,engravingLines:n},u=await this.api.updateCart({id:c.id||"",items:[d],loc:this.getLocation()});this.syncItemsFromApiResponse(u,[e]),this.syncRetailersFromApiResponse(u),this.syncCartMetaFromApiResponse(u);const h=this.store.get("cart"),p=this.store.get("address");this.pubSubService.publishAction(i.CART_UPDATED,{previous:cartDataForEventFromStore(c,p),current:cartDataForEventFromStore(h,p)}),this.pubSubService.publishAction(i.CART_ITEM_ENGRAVING_UPDATED,{id:l.id,engravingLines:n,previousEngravingLines:(null===(a=null===(r=l.attributes)||void 0===r?void 0:r.engraving)||void 0===a?void 0:a.lines)||[]})}catch(c){throw this.store.set("cart.items."+e+".error",c.message),this.logger.error("Failed to update item engraving",c),c}finally{this.store.set("cart.items."+e+".updating",![])}}async addItem(e){var n,o;try{this.store.set("cart.loading",!![]);const r=this.store.get("cart"),a={...r},c=(null===(n=e.engravingLines)||void 0===n?void 0:n.filter(e=>""!==e.trim()))||[],l=c.length>0,d=Object.values(r.items||{}).find(n=>{var i,o,r,a,d;const u=n.fulfillmentId===e.fulfillmentId&&n.partNumber===e.partNumber;if(!u)return![];if(l){const e=(null===(o=null===(i=n.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[];return c.join(",")===e.join(",")}return!(null===(d=null===(a=null===(r=n.attributes)||void 0===r?void 0:r.engraving)||void 0===a?void 0:a.lines)||void 0===d?void 0:d.length)}),u={upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:d?e.quantity+d.quantity:e.quantity};l&&(u.engravingLines=c);const h=await this.api.updateCart({id:r.id||"",items:[u],loc:this.getLocation()}),p=null===(o=h.items)||void 0===o?void 0:o.find(e=>e.fulfillmentId===u.fulfillmentId&&e.partNumber===u.partNumber&&e.upc===u.upc);if(!p)throw new Error("Added item not found in cart response");this.syncItemsFromApiResponse(h,[]);const m=this.store.get("cart.fulfillments."+e.fulfillmentId);m?this.updateFulfillment(e.fulfillmentId,h):this.addNewFulfillmentAndRetailer(e.fulfillmentId,h),this.syncRetailersFromApiResponse(h),this.syncCartMetaFromApiResponse(h);const f=this.store.get("cart"),g=this.store.get("address");this.pubSubService.publishAction(i.PRODUCT_ADD_TO_CART,{...e}),this.pubSubService.publishAction(i.CART_ITEM_ADDED,{id:p.id,upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,engravingLines:e.engravingLines}),this.pubSubService.publishAction(i.CART_UPDATED,{previous:cartDataForEventFromStore(a,g),current:cartDataForEventFromStore(f,g)});const v=splitCategoryPath(p.catPath);this.googleTagManager.addToCart({item_id:p.liquidId,item_name:p.name,item_brand:p.brand,item_category:v.category,item_category2:v.category2,item_category3:v.category3,item_type:p.type,item_subtype:p.subType,quantity:p.quantity,price:centToDollar(p.unitPrice||0),upc:p.upc,grouping_id:p.salsifyGrouping,product_id:p.liquidId})}catch(r){throw this.store.set("cart.error",r.message),this.logger.error("Failed to add item to cart",r),r}finally{this.store.set("cart.loading",![])}}async addPresaleItem(e){var n;try{const i={upc:e.upc,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity};(null==e?void 0:e.engravingLines)&&(null===(n=null==e?void 0:e.engravingLines)||void 0===n?void 0:n.length)>0&&(i.engravingLines=e.engravingLines);const o=await this.api.updateCart({id:"",items:[i],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(o.id)}catch(i){throw this.store.set("cart.error",i.message),this.logger.error("Failed to add presale item to cart",i),i}}async handleGoToCheckout(){var e;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(r.CHECKOUT);const n=this.store.get("cart"),i=(null===(e=n.promoCode)||void 0===e?void 0:e.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(n.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],i)}catch(n){throw this.store.set("cart.error",n.message),this.logger.error("Failed to proceed to checkout",n),n}finally{this.store.set("cart.loading",![])}}async applyPromoCode(e){var n,i,o;if(!(null==e?void 0:e.trim()))throw new Error("Promo code is required");const r=e.trim().toUpperCase();try{const e=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(r);const a=await this.api.updateCart({id:e,items:[],promoCode:r,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(a)),this.store.set("cart.events",transformEventsForCart(a.events||[]));const c=(null===(o=null===(i=null===(n=a.attributes)||void 0===n?void 0:n.promoCode)||void 0===i?void 0:i.value)||void 0===o?void 0:o.toLowerCase())===r.toLowerCase();c?(this.store.set("cart.promoCode",{code:r,discountAmount:a.discounts||0}),this.googleTagManager.promoCodeApplied(r,a.discounts||0)):(this.store.set("cart.promoCode",null),this.googleTagManager.promoCodeFailed(r,'Code "'+r+'" does not exist'))}catch(a){const e=(null==a?void 0:a.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",e),this.googleTagManager.promoCodeFailed(r,e),this.logger.error("Failed to apply promo code",a),a}}async removePromoCode(){try{const e=this.store.get("cart.id"),n=await this.api.updateCart({id:e,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(n),"cart.promoCode":null}),this.googleTagManager.promoCodeApplied("",0)}catch(e){const n=(null==e?void 0:e.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",n);const i=this.store.get("cart.promoCode");throw(null==i?void 0:i.code)&&this.googleTagManager.promoCodeFailed(i.code,n),this.logger.error("Failed to remove promo code",e),e}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...G,rerender:!![]}),this.store.set("cart",{...j,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSubService.publishAction(i.CART_RESET,!![])}getDetails(){var e;const n=this.store.get("cart"),i=this.store.get("address"),o=i.id?i:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},r={};for(const a in n.items||{}){const e=n.items[a];r[a]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,salsifyGrouping:e.salsifyGrouping,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,catPath:e.catPath,volume:e.volume,uom:e.uom,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,name:e.name,brand:e.brand,size:e.size,price:e.price||0,quantity:e.quantity||0,maxQuantity:e.maxQuantity||0,unitPrice:e.unitPrice||0,mainImage:e.mainImage||"",attributes:e.attributes||{}}}return{id:n.id,promoCode:(null===(e=n.promoCode)||void 0===e?void 0:e.code)||"",items:r,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:n.totals.deliveryFee,discounts:n.totals.discounts,engravingFee:n.totals.engravingFee,giftCardTotal:0,platformFee:n.totals.platformFee,shippingFee:n.totals.shippingFee,subtotal:n.totals.subtotal,total:n.totals.total},updatedAt:n.updatedAt,createdAt:n.createdAt}}buildItemUpdate(e,n){var i,o,r;const a={id:e.id,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:n},c=(null===(r=null===(o=null===(i=e.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(e=>""!==e.trim()))||[];return c.length>0&&(a.engravingLines=c),a}syncItemsFromApiResponse(e,n=[]){var i;const o=this.store.get("cart.items")||{},r=new Set((null===(i=e.items)||void 0===i?void 0:i.map(e=>e.id))||[]);for(const c of Object.keys(o))r.has(c)||this.store.remove("cart.items."+c);const a={};for(const c of e.items)0!==n.length&&!n.includes(c.id)&&o[c.id]||(a["cart.items."+c.id]=buildCartItemStore(c));Object.keys(a).length>0&&this.store.batch(a)}syncCartMetaFromApiResponse(e){var n,i;const o={"cart.totals":buildCartTotals(e),"cart.error":null,"cart.updatedAt":e.updatedAt||(new Date).toISOString(),"cart.createdAt":e.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(e.events||[])},r=null===(i=null===(n=e.attributes)||void 0===n?void 0:n.promoCode)||void 0===i?void 0:i.value;if(r)o["cart.promoCode"]={code:r.toUpperCase(),discountAmount:e.discounts||0};else{const e=this.store.get("cart.promoCode");(null==e?void 0:e.code)&&(o["cart.promoCode"]=null)}this.store.batch(o)}syncRetailersFromApiResponse(e){var n;if((null===(n=e.retailers)||void 0===n?void 0:n.length)>0){const n={};for(const i of e.retailers)n["cart.retailers."+i.id]=buildRetailerStore(i);this.store.batch(n)}}updateFulfillment(e,n){var i,o;const r=null===(i=n.retailers)||void 0===i?void 0:i.find(n=>{var i;return null===(i=n.fulfillments)||void 0===i?void 0:i.some(n=>n.id===e)}),a=null===(o=null==r?void 0:r.fulfillments)||void 0===o?void 0:o.find(n=>n.id===e);a&&r&&this.store.set("cart.fulfillments."+e,buildFulfillmentStore(a,r))}addNewFulfillmentAndRetailer(e,n){var i,o;const r=null===(i=n.retailers)||void 0===i?void 0:i.find(n=>{var i;return null===(i=n.fulfillments)||void 0===i?void 0:i.some(n=>n.id===e)}),a=null===(o=null==r?void 0:r.fulfillments)||void 0===o?void 0:o.find(n=>n.id===e);if(a&&r){const n={["cart.fulfillments."+e]:buildFulfillmentStore(a,r),["cart.retailers."+r.id]:buildRetailerStore(r)};this.store.batch(n)}}cleanupAfterItemRemoval(e,n){var i,o,r,a;const c=this.store.get("cart.fulfillments."+e.fulfillmentId),l=this.store.get("cart.retailers."+e.retailerId);if(!c||!l)return;const d=null===(i=n.retailers)||void 0===i?void 0:i.some(n=>{var i;return null===(i=n.fulfillments)||void 0===i?void 0:i.some(n=>n.id===e.fulfillmentId)}),u=null===(o=n.retailers)||void 0===o?void 0:o.some(n=>n.id===e.retailerId);if(d){this.updateFulfillment(e.fulfillmentId,n);const i=null===(a=n.retailers)||void 0===a?void 0:a.find(n=>n.id===e.retailerId);i&&this.store.set("cart.retailers."+e.retailerId,buildRetailerStore(i))}else if(this.store.remove("cart.fulfillments."+e.fulfillmentId),u){const i=null===(r=n.retailers)||void 0===r?void 0:r.find(n=>n.id===e.retailerId);i&&this.store.set("cart.retailers."+e.retailerId,buildRetailerStore(i))}else this.store.remove("cart.retailers."+e.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(e,n=![]){this.store.createProductInstance(e),n&&this.store.set("products."+e+".loading",!![])}async loadMultipleProducts(e){var n;if(!Array.isArray(e)||0===e.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(e.reduce((e,n)=>(e["products."+n+".loading"]=!![],e["products."+n+".error"]=null,e),{}));const i=await this.api.getProductsData(e,this.getLocation());if(!i||!i.products||0===i.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(e.reduce((e,n)=>(e["products."+n+".loading"]=![],e["products."+n+".error"]=!![],e),{})),void 0;const o=[];for(const a of i.products){const r=a.sizes.filter(n=>e.some(e=>e===(n.upc||n.id||a.salsifyGrouping))),c=e.find(e=>r.some(n=>e===n.upc||e===n.id)||e===a.salsifyGrouping),l=c||(null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.upc);await this.loadProduct(l,{products:[a],retailers:i.retailers}),o.push(l)}const r=e.filter(e=>-1===o.indexOf(e));this.store.batch(r.reduce((e,n)=>(e["products."+n+".loading"]=![],e["products."+n+".error"]="Product data not found",e),{}))}async loadProduct(e,n=null){var o,r;try{const a=this.store.get("products."+e);a.loading||this.store.set("products."+e+".loading",!![]);let c=null;if(n&&(c=n),n||(c=await this.api.getProductsData([e],this.getLocation())),!c||!(null===(o=null==c?void 0:c.products)||void 0===o?void 0:o[0]))return this.store.set("products."+e+".error","Product data not found"),void 0;const l=this.loadProductStoreUpdate(c);if(!l)return this.store.set("products."+e+".error","Failed to process product data"),void 0;this.store.set("products."+e,{...l,identifier:e}),this.pubSub.publishAction(i.PRODUCT_LOADED,this.productDataForEventFromStore(e));const d=c.products[0],u=l.sizes[l.selectedSizeId||""],h=Boolean(this.getLocation()),p=l.selectedFulfillment,m=h&&(null==p?void 0:p.price)?p.price:(null===(r=l.priceInfo)||void 0===r?void 0:r.avg)||0,f=splitCategoryPath(d.catPath);this.googleTagManager.viewItem({item_id:null==u?void 0:u.id,item_name:d.name,item_brand:d.brand,item_category:f.category,item_category2:f.category2,item_category3:f.category3,price:centToDollar(m),item_type:d.type,item_subtype:d.subType,upc:null==u?void 0:u.upc,grouping_id:d.salsifyGrouping,product_id:null==u?void 0:u.id})}catch(a){throw this.store.set("products."+e+".error",a.message),this.logger.error("Failed to load product data for ID "+e,a),a}finally{this.store.set("products."+e+".loading",![])}}async selectSize(e,n){var o,r,c,l,d,u,h;const p=this.store.get("products."+e);let m=p.selectedFulfillmentType;const f=null===(o=p.sizes[n])||void 0===o?void 0:o.shippingFulfillments,g=null===(r=p.sizes[n])||void 0===r?void 0:r.onDemandFulfillments;let v=null,y=null;if(m!==a.SHIPPING||objectValues(f).length)if(m!==a.ON_DEMAND||objectValues(g).length){const e=m===a.SHIPPING?f:g,n=objectValues(e);v=n[0]||null,y=(null==v?void 0:v.fulfillmentId)||null}else{m=a.SHIPPING;const e=objectValues(f);v=e[0]||null,y=(null==v?void 0:v.fulfillmentId)||null}else{m=a.ON_DEMAND;const e=objectValues(g);v=e[0]||null,y=(null==v?void 0:v.fulfillmentId)||null}const b=m===a.SHIPPING?f:g,x=p.sizes[n],w=splitCategoryPath(p.catPath),C=(null==v?void 0:v.price)||(null===(c=p.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==x?void 0:x.id,item_name:p.name,item_brand:p.brand,item_category:w.category,item_category2:w.category2,item_category3:w.category3,price:centToDollar(C),item_type:p.type,item_subtype:p.subType,upc:null==x?void 0:x.upc,grouping_id:p.salsifyGrouping,product_id:null==x?void 0:x.id});const S=Object.keys(f).length>0,I=Object.keys(g).length>0,P=S||I;if(!P){const e=this.store.get("address");this.googleTagManager.productSizeNoAvailability({productId:null==x?void 0:x.id,productName:p.name,productBrand:p.brand,productCategory:w.category,productCategory2:w.category2,productCategory3:w.category3,productType:p.type,productSubtype:p.subType,productPrice:(null===(l=p.priceInfo)||void 0===l?void 0:l.avg)||0,sizeId:n,sizeName:null==x?void 0:x.size,upc:null==x?void 0:x.upc,groupingId:p.salsifyGrouping,address:(null==e?void 0:e.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||""}:void 0,reason:"No fulfillments available for this size"})}this.pubSub.publishAction(i.PRODUCT_SIZE_CHANGED,{identifier:e,selectedSizeId:n,size:(null===(d=p.sizes[n])||void 0===d?void 0:d.size)||"",previousSizeId:p.selectedSizeId||"",previousSize:(null===(u=p.sizes[p.selectedSizeId])||void 0===u?void 0:u.size)||""}),this.store.batch({["products."+e+".selectedSizeId"]:n,["products."+e+".mainImage"]:(null===(h=p.sizes[n])||void 0===h?void 0:h.image)||null,["products."+e+".productHasAvailability"]:Object.keys(f).length+Object.keys(g).length>0,["products."+e+".fulfillmentHasAvailability"]:Boolean(Object.keys(b).length),["products."+e+".selectedFulfillmentType"]:m,["products."+e+".selectedFulfillment"]:v,["products."+e+".selectedFulfillmentId"]:y})}async selectFulfillment(e,n){var o,r,c;const l=this.store.get("products."+e),d=null===(o=l.sizes[l.selectedSizeId])||void 0===o?void 0:o.shippingFulfillments,u=null===(r=l.sizes[l.selectedSizeId])||void 0===r?void 0:r.onDemandFulfillments,h=l.selectedFulfillmentType===a.SHIPPING?d:u,p=h[n];this.pubSub.publishAction(i.PRODUCT_FULFILLMENT_CHANGED,{identifier:e,selectedFulfillmentId:n,selectedFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId||"",previousFulfillmentType:l.selectedFulfillmentType});const m=l.sizes[l.selectedSizeId||""],f=splitCategoryPath(l.catPath),g=(null==p?void 0:p.price)||(null===(c=l.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==m?void 0:m.id,item_name:l.name,item_brand:l.brand,item_category:f.category,item_category2:f.category2,item_category3:f.category3,price:centToDollar(g),item_type:l.type,item_subtype:l.subType,upc:null==m?void 0:m.upc,grouping_id:l.salsifyGrouping,product_id:null==m?void 0:m.id}),this.store.batch({["products."+e+".selectedFulfillment"]:p,["products."+e+".selectedFulfillmentId"]:n,["products."+e+".quantity"]:1})}async updateQuantity(e,n){var o;const r=this.store.get("products."+e),a=r.quantity,c=a+n,l=1,d=(null===(o=null==r?void 0:r.selectedFulfillment)||void 0===o?void 0:o.stock)||5,u=Math.max(l,Math.min(d,c));this.pubSub.publishAction(n<0?i.PRODUCT_QUANTITY_DECREASE:i.PRODUCT_QUANTITY_INCREASE,{identifier:e,quantity:u,previousQuantity:a}),this.store.set("products."+e+".quantity",u)}async changeFulfillmentType(e,n){var o,r,c;const l=this.store.get("products."+e),{shippingFulfillments:d,onDemandFulfillments:u}=l.sizes[l.selectedSizeId],h=n===a.SHIPPING?d:u,p=objectValues(h);if(0===p.length){this.logger.warn("No fulfillments available for type "+n+" on product "+e);const i=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!==(r=l.selectedSizeId)&&void 0!==r?r:void 0,sizeName:null==a?void 0:a.size,fulfillmentType:n,upc:null==a?void 0:a.upc,groupingId:l.salsifyGrouping,address:(null==i?void 0:i.address)?{one:i.address.one,two:i.address.two,city:i.address.city,state:i.address.state,zip:i.address.zip,country:i.address.country||""}:void 0,reason:"No "+n+" fulfillments available for selected size"}),void 0}const m=p[0]||null,f=(null==m?void 0:m.fulfillmentId)||null;this.pubSub.publishAction(i.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:e,selectedFulfillmentType:n,selectedFulfillmentId:f,previousFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId,fulfillmentHasAvailability:p.length>0});const g=l.sizes[l.selectedSizeId||""],v=splitCategoryPath(l.catPath),y=(null==m?void 0:m.price)||(null===(c=l.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==g?void 0:g.id,item_name:l.name,item_brand:l.brand,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar(y),item_type:l.type,item_subtype:l.subType,upc:null==g?void 0:g.upc,grouping_id:l.salsifyGrouping,product_id:null==g?void 0:g.id}),this.store.batch({["products."+e+".selectedFulfillmentType"]:n,["products."+e+".selectedFulfillment"]:m,["products."+e+".selectedFulfillmentId"]:f,["products."+e+".fulfillmentHasAvailability"]:p.length>0})}async removeProduct(e){this.store.removeProductInstance(e)}async openProductDrawer(e,n,i){const o={type:n,data:i||{}};this.store.batch({["products."+e+".drawer.isOpen"]:!![],["products."+e+".drawer.contentConfig"]:o})}async closeProductDrawer(e){this.store.set("products."+e+".drawer.isOpen",![])}async rerenderAllProducts(){const e=this.store.getProductInstances(),n=Object.keys(e);for(const i of n)this.store.set("products."+i+".rerender",!![])}async addToCart(e,n){try{this.store.set("products."+e+".updating",!![]),this.uiCommands.openDrawer(r.CART),await this.cartCommands.addItem(n),this.store.batch({["products."+e+".quantity"]:1,["products."+e+".updating"]:![]});const i=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(i.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})])}catch(i){this.logger.error("Error adding to cart",i),this.store.set("products."+e+".updating",![])}}async addPresaleToCart(e,n){try{this.store.set("products."+e+".updating",!![]),await this.cartCommands.addPresaleItem(n),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(r.CHECKOUT),this.store.batch({["products."+e+".quantity"]:1,["products."+e+".updating"]:![]})}catch(i){this.logger.error("Error adding to cart",i),this.store.set("products."+e+".updating",![])}}productDataForEventFromStore(e){const n=this.store.get("products."+e),i={},fulfillmentEventData=e=>{const n={};for(const i in e){const o=e[i];n[i]={retailerId:o.retailerId,retailerName:o.retailerName,retailerAddress:o.retailerAddress,retailerTimezone:o.timezone,price:o.price,partNumber:o.partNumber,fulfillmentId:o.fulfillmentId,fulfillmentType:o.fulfillmentType,modalities:o.modalities||[]}}return n};for(const o in n.sizes||{}){const e=n.sizes[o];i[o]={id:e.id,upc:e.upc,size:e.size,pack:e.pack,packDesc:e.packDesc||"",container:e.container,containerType:e.containerType,maxQuantityPerOrder:e.attributes.maxQuantityPerOrder||0,image:e.image,uom:e.uom,volume:e.volume,shippingFulfillments:fulfillmentEventData(e.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(e.onDemandFulfillments||{})}}return{identifier:e,id:n.id,name:n.name,brand:n.brand,category:n.category,catPath:n.catPath,classification:n.classification,priceInfo:n.priceInfo||null,sizes:i}}findFirstAvailableSize(e){const n=objectValues(e);for(const i of n){const e=i.shippingFulfillments||{},n=i.onDemandFulfillments||{},o=objectValues(e).length,r=objectValues(n).length;if(o+r>0)return i.id}return null}loadProductStoreUpdate(e){var n,i,o,r,c,l,d,u,h,p,m;try{const{products:[f,...g],retailers:v}=e,y=this.themeProvider.getConfigs("product"),b={};let x=![],w=![],C="",S=null,I=y.layout.enableShippingFulfillment?a.SHIPPING:a.ON_DEMAND,P=null,D=null;const F={};if(v&&Array.isArray(v)&&v.length>0)for(const e of v)for(const n of e.fulfillments)F[n.id]={retailerName:e.name,retailerAddress:e.address||null,type:n.type,timezone:n.timezone||"",canEngrave:n.canEngrave||![],expectation:n.expectation,fees:n.fees,hours:n.hours,retailerId:e.id,fulfillmentId:n.id,fulfillmentType:n.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]};if(f.sizes&&Array.isArray(f.sizes)&&f.sizes.length>0)for(const e of f.sizes){const c={},l={};for(const d of e.variants){if((null===(n=null==d?void 0:d.fulfillmentTypes)||void 0===n?void 0:n.onDemand)&&""!==d.fulfillmentTypes.onDemand){const e=d.fulfillmentTypes.onDemand,n=F[e];n?l[e]={...n,isVariantEngravable:d.isEngravable,stock:d.stock,price:d.price,retailerId:d.retailerId,fulfillmentId:e,fulfillmentType:a.ON_DEMAND,modalities:[...n.modalities,...null!==(i=null==d?void 0:d.modalities)&&void 0!==i?i:[]],partNumber:d.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId "+e)}if((null===(o=null==d?void 0:d.fulfillmentTypes)||void 0===o?void 0:o.shipping)&&""!==d.fulfillmentTypes.shipping){const e=d.fulfillmentTypes.shipping,n=F[e];n?c[e]={...n,isVariantEngravable:d.isEngravable,stock:d.stock,price:d.price,retailerId:d.retailerId,fulfillmentId:e,fulfillmentType:a.SHIPPING,modalities:[...n.modalities,...null!==(r=null==d?void 0:d.modalities)&&void 0!==r?r:[]],partNumber:d.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+e)}}b[e.id]={id:e.id,upc:e.upc,size:e.size,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,maxQuantityPerOrder:e.attributes.maxQuantityPerOrder||0,image:e.image,uom:e.uom,volume:e.volume,attributes:e.attributes,loading:![],error:null,shippingFulfillments:c,onDemandFulfillments:l}}const _=objectValues(b),z=this.findFirstAvailableSize(b);C=z||_[0]&&_[0].id||"",S=(null===(c=b[C])||void 0===c?void 0:c.image)||null;const O=(null===(l=b[C])||void 0===l?void 0:l.shippingFulfillments)||{},M=(null===(d=b[C])||void 0===d?void 0:d.onDemandFulfillments)||{},L=objectValues(O).length,R=objectValues(M).length;x=L+R>0;const B=I===a.SHIPPING?objectValues(O):objectValues(M);if(w=B.length>0,D=B[0]||null,P=(null==D?void 0:D.fulfillmentId)||null,!w){const e=I===a.SHIPPING?a.ON_DEMAND:a.SHIPPING,n=e===a.SHIPPING?objectValues(O):objectValues(M);n.length>0&&(I=e,D=n[0],P=(null==D?void 0:D.fulfillmentId)||null,w=!![])}if(!x){const e=this.store.get("address"),n=splitCategoryPath(f.catPath),i=b[C];this.googleTagManager.productNoAvailability({productId:null==i?void 0:i.id,productName:f.name,productBrand:f.brand,productCategory:n.category,productCategory2:n.category2,productCategory3:n.category3,productType:f.type,productSubtype:f.subType,productPrice:(null===(u=f.priceInfo)||void 0===u?void 0:u.average)||0,upc:null==i?void 0:i.upc,groupingId:f.salsifyGrouping,address:(null==e?void 0:e.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||""}:void 0,reason:"No fulfillments available for any size"})}return{identifier:"",id:f.id||"",name:f.name,description:f.description,htmlDescription:f.htmlDescription,images:f.images,priceInfo:{min:(null===(h=f.priceInfo)||void 0===h?void 0:h.minimum)||0,max:(null===(p=f.priceInfo)||void 0===p?void 0:p.maximum)||0,avg:(null===(m=f.priceInfo)||void 0===m?void 0:m.average)||0},brand:f.brand,catPath:f.catPath,category:f.category,classification:f.classification,type:f.type,subType:f.subType,salsifyGrouping:f.salsifyGrouping,sizes:b,productHasAvailability:x,fulfillmentHasAvailability:w,selectedSizeId:C,mainImage:S,selectedFulfillmentType:I,selectedFulfillmentId:P,selectedFulfillment:D,drawer:{isOpen:![],contentConfig:null},error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(f){throw this.logger.error("Product data processing error",f),f}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(e){return!e||e.length<3?[]:await this.api.getAddressSuggestions(e)}async getAddressDetails(e){return await this.api.getAddressDetails(e)}async setSelectedAddress(e){try{this.store.batch({"address.id":e.id,"address.formattedAddress":e.formattedAddress,"address.address":e.address,"address.coordinates":e.coordinates});const n=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(n)),await this.cartCommands.resetCart(),await this.store.persist()}catch(n){throw this.googleTagManager.addressFailed({googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},error:(null==n?void 0:n.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(i.ADDRESS_FAILED,{googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates,error:(null==n?void 0:n.message)||"Failed to update downstream state after address change"}),n}this.googleTagManager.addressUpdated({googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},coordinates:e.coordinates}),this.pubSub.publishAction(i.ADDRESS_UPDATED,{googlePlacesId:e.id,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},coordinates:e.coordinates,formattedAddress:e.formattedAddress})}async setAddressManually(e,n){try{const i=buildFormattedAddressString(e),o={id:"",formattedAddress:i,address:e,coordinates:n};await this.setSelectedAddress(o)}catch(o){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:buildFormattedAddressString(e),address:{one:e.one,two:e.two,city:e.city,state:e.state,zip:e.zip,country:e.country||""},error:(null==o?void 0:o.message)||"Failed to set manual address"}),this.pubSub.publishAction(i.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(e),address:e,coordinates:n,error:(null==o?void 0:o.message)||"Failed to set manual address"}),o}}async clearSelectedAddress(){this.store.set("address",V),this.pubSub.publishAction(i.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart(),await this.store.persist()}getDetails(){const e=this.store.get("address");return e.id?{id:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.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:e=>this.command.product.productDataForEventFromStore(e)},this.addressActions={setAddressByPlacesId:async e=>{try{if(!e||""===e.trim())throw new Error("Invalid placesId provided");const n=await this.command.address.getAddressDetails(e);await this.command.address.setSelectedAddress({id:e,address:n.address,coordinates:n.coords,formattedAddress:n.formattedAddress})}catch(n){throw this.logger.error("Error setting address by placesId:",n),n}},setAddressManually:async(e,n)=>{try{if(!e||!n)throw new Error("Invalid address or coordinates provided");if(!(e.one&&e.city&&e.state&&e.zip))throw new Error("Address must include street address, city, state, and zip code");if("number"!=typeof n.lat||"number"!=typeof n.long)throw new Error("Coordinates must be valid numbers");if(n.lat<-90||n.lat>90)throw new Error("Latitude must be between -90 and 90");if(n.long<-180||n.long>180)throw new Error("Longitude must be between -180 and 180");await this.command.address.setAddressManually(e,n)}catch(i){throw this.logger.error("Error setting manual address:",i),i}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(r.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CART)},addProduct:async(e,n)=>{var o,c;try{if(!e||0===e.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=e,this.pendingCartOpenFlag=null!=n?n:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(r.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;n===!![]&&this.command.ui.openDrawer(r.CART);const d=[...new Set(e.map(e=>e.identifier))],u=await this.api.getProductsData(d,l);if(!u||!u.products||0===u.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(i.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const n of e){let e=null;for(let o=0;o<u.products.length;o++){const i=u.products[o];let r=![];for(let e=0;e<i.sizes.length;e++){const o=i.sizes[e];if(o.upc===n.identifier||o.id===n.identifier||i.salsifyGrouping===n.identifier){r=!![];break}}if(r){e=i;break}}if(!e){this.logger.warn("No product found for identifier: "+n.identifier);continue}const i=e.sizes[0];if(!i){this.logger.warn("No sizes found for product: "+n.identifier);continue}if((null===(c=null===(o=null==i?void 0:i.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: "+n.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let r=null;for(let o=0;o<i.variants.length;o++){const e=i.variants[o];let c=![];if(n.fulfillmentType===a.ON_DEMAND&&(c=!(!e.fulfillmentTypes||!e.fulfillmentTypes.onDemand||""===e.fulfillmentTypes.onDemand)),n.fulfillmentType===a.SHIPPING&&(c=!(!e.fulfillmentTypes||!e.fulfillmentTypes.shipping||""===e.fulfillmentTypes.shipping)),c){r=e;break}}if(!r){this.logger.warn("No supported variant found for product: "+n.identifier+" with fulfillment type: "+n.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const l=n.fulfillmentType===a.ON_DEMAND?r.fulfillmentTypes.onDemand:r.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:i.upc,fulfillmentId:l,partNumber:r.partNumber,quantity:n.quantity,identifier:n.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(i.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:e.length,identifiers:d}),this.logger.info("Products added to cart successfully:",d)}catch(l){throw this.logger.error("Error adding products to cart:",l),this.clearPendingCartOperation(),this.pubSub.publishAction(i.CART_PRODUCT_ADD_FAILED,{identifiers:e.map(e=>e.identifier),error:l.message||"Failed to add products to cart"}),l}},applyPromoCode:async e=>{try{if(!e||""===e.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const n=e.trim().toUpperCase(),o=this.themeProvider.getConfigs("global"),r=o.layout.allowPromoCodes;if(!r)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const a=this.store.get("cart.promoCode");if(a&&a.code===n)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(n);const c=this.command.cart.getDetails();this.pubSub.publishAction(i.CART_PROMO_CODE_APPLIED,{applied:!![],discountAmount:c.amounts.discounts,newTotal:c.amounts.total}),this.logger.info("Promo code applied successfully")}catch(n){throw this.logger.error("Failed to apply promo code:",n),this.pubSub.publishAction(i.CART_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),n}},removePromoCode:async()=>{try{const e=this.themeProvider.getConfigs("global"),n=e.layout.allowPromoCodes;if(!n)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(i.CART_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Promo code removed successfully")}catch(e){throw this.logger.error("Failed to remove promo code:",e),e}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(i.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(r.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(r.CHECKOUT)},addProduct:async(e,n)=>{try{if(!e||0===e.length)return this.logger.warn("No products provided to add to checkout"),void 0;n===!![]&&this.command.ui.openDrawer(r.CHECKOUT);const o=e.map(e=>e.identifier);await this.cartActions.addProduct(e),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:e.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(i.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:e.map(e=>e.identifier),error:o.message||"Failed to add products to checkout"}),o}},applyPromoCode:async e=>{var n;try{if(!e||""===e.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const o=e.trim().toUpperCase(),r=this.themeProvider.getConfigs("global"),a=r.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(e);const l=this.store.get("checkout"),d=null==l?void 0:l.promoCode;this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_APPLIED,{applied:!![],discountAmount:(null==d?void 0:d.discountAmount)||0,newTotal:(null===(n=null==l?void 0:l.amounts)||void 0===n?void 0:n.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(i.CHECKOUT_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),o}},removePromoCode:async()=>{try{const e=this.themeProvider.getConfigs("global"),n=e.layout.allowPromoCodes;if(!n)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(i.CHECKOUT_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Checkout promo code removed successfully")}catch(e){throw this.logger.error("Failed to remove checkout promo code:",e),e}},applyGiftCard:async e=>{var n;try{const o=this.themeProvider.getConfigs("checkout"),r=o.layout.allowGiftCards;if(!r)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(e);const a=this.store.get("checkout");this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_APPLIED,{applied:!![],newTotal:(null===(n=null==a?void 0:a.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card applied successfully")}catch(o){throw this.logger.error("Failed to apply gift card:",o),this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be applied"}),o}},removeGiftCard:async e=>{try{const n=this.themeProvider.getConfigs("checkout"),o=n.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(e),this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_REMOVED,{applied:![]}),this.logger.info("Gift card removed successfully")}catch(n){throw this.logger.error("Failed to remove gift card:",n),this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be removed"}),n}},toggleIsGift:async e=>{await this.command.checkout.toggleIsGift(e)},toggleBillingSameAsShipping:async e=>{await this.command.checkout.toggleBillingSameAsShipping(e)},toggleMarketingPreferences:(e,n)=>{this.command.checkout.toggleMarketingPreferences(e,n)},updateCustomerInfo:e=>{for(const[n,i]of objectEntries(e))this.command.checkout.updateCustomerInfo(n,i)},updateBillingInfo:e=>{for(const[n,i]of objectEntries(e))this.command.checkout.updateBillingInfo(n,i)},updateGiftInfo:e=>{for(const[n,i]of objectEntries(e))this.command.checkout.updateGiftInfo(n,i)},getDetails:()=>{var e;const n=this.store.get("checkout"),i=n.items||{},o={};for(const[r,a]of Object.entries(i)){const e=a,{attributes:n,...i}=e;o[r]=i}return{cartId:n.cartId||"",amounts:n.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}}},items:o,isGift:n.isGift||![],hasAgeVerify:n.hasAgeVerify||![],hasPromoCode:!!(null===(e=n.promoCode)||void 0===e?void 0:e.code),hasGiftCards:Array.isArray(n.giftCards)&&n.giftCards.length>0,itemCount:Object.keys(i).length}}},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 T=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+i.ADDRESS_UPDATED,T)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const e=this.pendingCartParams,n=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(e,n)}catch(e){this.logger.error("Failed to retry cart operation after address update",e)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const e=this.store.get("address");if(e.address.one&&e.coordinates.long&&e.coordinates.lat)return{coords:e.coordinates,address:e.address}}}function componentError({componentType:e,message:n}){const i=document.createElement("div");i.className=e;const o=i.attachShadow({mode:"closed"}),r=document.createElement("style");r.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 </"+e+">";const l=document.createElement("p");return l.textContent=n,a.appendChild(r),a.appendChild(c),a.appendChild(l),o.appendChild(a),i}function productionComponentError({title:e,message:n,componentType:i}){const o=document.createElement("div");o.setAttribute("data-component-type",i);const r=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=e;const d=document.createElement("p");return d.textContent=n,c.appendChild(a),c.appendChild(l),c.appendChild(d),r.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(e,n){ComponentFactoryService.getComponentRegistry().set(e,n)}static createElement(e){try{const n=ComponentFactoryService.getComponentRegistry().get(e.type);if(!n)throw new Error("Component type ["+e.type+"] is not registered");const i=ComponentFactoryService.getComponentTagName(e.type);window.customElements.get(i)||window.customElements.define(i,n);const o=document.createElement(i);if(o.initialize){const{type:n,useShadowDom:r,wrapInLceElement:a,...c}=e,l={type:n,tagName:i,useShadowDom:r&&a!==!![]};o.initialize({data:c,config:l})}if(e.wrapInLceElement){const n=ComponentFactoryService.getComponentRegistry().get(r.LCE_ELEMENT),i=ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT);window.customElements.get(i)||window.customElements.define(i,n);const a=document.createElement(i);return a.initialize(e.type,o),a}return o}catch(n){return ComponentFactoryService.logger.error("Failed to create component </"+e.type+">",n),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:e.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:e.type}):componentError({componentType:e.type,message:(null==n?void 0:n.message)||n})}}static componentError({componentType:e,message:n}){return ComponentFactoryService.logger.error("Component type "+e+" failed to load: "+n),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:e.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({componentType:e,message:n})}static getComponentTagName(e){const n={[r.DRAWER]:"drawer-lc",[r.INPUT]:"input-lc",[r.BIRTHDATE_INPUT]:"birthdate-input-lc",[r.ENGRAVING_FORM]:"engraving-form-lc",[r.ENGRAVING_VIEW]:"engraving-view-lc",[r.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[r.POWERED_BY]:"powered-by-lc",[r.LCE_ELEMENT]:"lce-element",[r.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[r.ALERT]:"alert-lc",[r.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[r.ADDRESS]:"address-lc",[r.ADDRESS_INPUT]:"address-input-lc",[r.ADDRESS_DISPLAY]:"address-display-lc",[r.PRODUCT]:"product-lc",[r.PRODUCT_OPTIONS]:"product-options-lc",[r.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[r.PRODUCT_INTERACTIONS]:"product-interactions-lc",[r.PRODUCT_DESCRIPTION]:"product-description-lc",[r.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[r.PRODUCT_RETAILERS]:"product-retailers-lc",[r.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[r.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[r.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[r.PRODUCT_PRICE]:"product-price-lc",[r.PRODUCT_DRAWER]:"product-drawer-lc",[r.PRODUCT_LOADING]:"product-loading-lc",[r.CART]:"cart-lc",[r.CART_RETAILER]:"cart-retailer-lc",[r.CART_ITEM]:"cart-item-lc",[r.CART_FOOTER]:"cart-footer-lc",[r.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[r.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[r.CART_PROMO_CODE]:"cart-promo-code-lc",[r.CART_HEADER]:"cart-header-lc",[r.CART_BODY]:"cart-body-lc",[r.CART_FULFILLMENT]:"cart-fulfillment-lc",[r.CHECKOUT]:"checkout-lc",[r.CHECKOUT_INFORMATION_SECTION]:"checkout-information-section-lc",[r.CHECKOUT_PAYMENT_FORM]:"checkout-payment-form-lc",[r.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[r.CHECKOUT_BILLING_FORM]:"checkout-billing-form-lc",[r.CHECKOUT_SUMMARY_SECTION]:"checkout-summary-section-lc",[r.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[r.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[r.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[r.CHECKOUT_ITEMS]:"checkout-items-lc",[r.CHECKOUT_COMPLETED]:"checkout-completed-lc",[r.CHECKOUT_DELIVERY_INFORMATION_FORM]:"checkout-delivery-information-form-lc",[r.CHECKOUT_BUYER_INFORMATION_FORM]:"checkout-buyer-information-form-lc",[r.CHECKOUT_TIPS]:"checkout-tips-lc",[r.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[r.CHECKOUT_ITEM]:"checkout-item-lc",[r.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[r.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[r.CHECKOUT_HEADER]:"checkout-header-lc",[r.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[r.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc"};return n[e]||e.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;const dt="\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",ut="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const e=LoggerFactory,n=e.instances;if(n)for(const[o,r]of n)this.interceptLoggerInstance(r,o);const i=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=e=>{const n=i(e);return this.interceptLoggerInstance(n,e),n}}interceptLoggerInstance(e,n){if(e.o)return;const i=e.debug.bind(e),o=e.info.bind(e),r=e.warn.bind(e),a=e.error.bind(e),k=(e,i,o)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:e,message:i,data:o,context:n});e.debug=(e,n)=>{i(e,n),this.addLogEntry(k("debug",e,n))},e.info=(e,n)=>{o(e,n),this.addLogEntry(k("info",e,n))},e.warn=(e,n)=>{r(e,n),this.addLogEntry(k("warn",e,n))},e.error=(e,n)=>{a(e,n),this.addLogEntry(k("error",e,n))},e.o=!![]}interceptPubSubEvents(){const e=PubSubService.getInstance(),n=e.publishAction.bind(e);e.publishAction=(e,i)=>{n(e,i),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+e,data:i,context:"PubSub"})};const i=e.publishForm.bind(e);e.publishForm=(e,n)=>{i(e,n),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+e,data:n,context:"PubSub"})}}interceptGtmEvents(){const e=GoogleTagManagerService.getInstance(),n=e.executeEvent.bind(e);e.executeEvent=(e,i,o)=>{n(e,i,o),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+i,data:o,context:"GTM."+e})}}addLogEntry(e){this.logs.push(e),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const e=this.logs.filter(e=>{switch(e.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",e.forEach(e=>{const n=this.createLogElement(e);this.logContainer.appendChild(n)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const e=document.querySelector(ut);e&&e.remove(),this.panelElement=document.createElement(ut);const n=window.innerWidth<=768,i=window.innerWidth<=480;i?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):n?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const e=this.panelElement.attachShadow({mode:"closed"}),n=document.createElement("style");n.textContent=dt,e.appendChild(n),this.floatingButton=this.createFloatingButton(),e.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const i=this.createHeader();this.panelContainer.appendChild(i);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 r=this.createResizeHandle();this.panelContainer.appendChild(r),e.appendChild(this.panelContainer),this.setupShadowEventListeners(e)}createHeader(){const e=document.createElement("div");e.className="header",e.title="Drag to move panel";const n=document.createElement("div");n.className="icon",n.innerHTML="🔍",n.title="Elements Debug Console",n.style.cursor="help";const i=document.createElement("div");i.className="title-container";const o=document.createElement("div");o.className="title",o.textContent="Elements Debug Console";const r=document.createElement("div");r.className="subtitle",r.textContent="Live SDK logs, events & GTM tracking",i.appendChild(o),i.appendChild(r);const a=document.createElement("button");return a.className="minimize",a.innerHTML="−",a.title="Minimize debug panel",a.addEventListener("click",()=>this.toggleVisibility()),e.appendChild(n),e.appendChild(i),e.appendChild(a),e}createToggles(){const e=document.createElement("div");e.className="toggles";const n=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];n.forEach(({key:n,label:i,description:o,color:r})=>{const a=document.createElement("label");a.className="toggle",a.title=o;const c=document.createElement("input");c.type="checkbox",c.checked="showLogs"!==n,c.addEventListener("change",e=>{const i=e.target;"showEvents"===n&&(this.showEvents=i.checked),"showGtmEvents"===n&&(this.showGtmEvents=i.checked),"showLogs"===n&&(this.showLogs=i.checked),this.renderLogs()});const l=document.createElement("span");l.textContent=i,l.style.color=r,a.appendChild(c),a.appendChild(l),e.appendChild(a)});const i=document.createElement("button");return i.className="clear-btn",i.innerHTML="🗑️",i.title="Clear all logs",i.addEventListener("click",()=>this.clearLogs()),e.appendChild(i),e}createResizeHandle(){const e=document.createElement("div");e.className="resize-handle",e.title="Drag to resize panel",e.style.cursor="nw-resize";let n=![],i=0,o=0,r=0,a=0;e.addEventListener("mousedown",e=>{n=!![],i=e.clientX,o=e.clientY,r=Number.parseInt(this.panelElement.style.width,10)||500,a=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",A),document.addEventListener("mouseup",H),e.preventDefault()});const A=e=>{if(!n||!this.panelElement)return;const c=e.clientX-i,l=e.clientY-o,d=window.innerWidth<=768,u=window.innerWidth<=480;let h,p,m,f;u?(h=280,p=window.innerWidth-20,m=200,f=.4*window.innerHeight):d?(h=300,p=window.innerWidth-30,m=200,f=.4*window.innerHeight):(h=300,p=800,m=200,f=600);const g=Math.max(h,Math.min(p,r+c)),v=Math.max(m,Math.min(f,a+l));this.panelElement.style.width=g+"px",this.panelElement.style.height=v+"px"},H=()=>{n=![],document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",H)};return e}setupShadowEventListeners(e){if(!this.panelElement)return;const n=e.querySelector(".header");if(n){let e=![],i=0,o=0,r=0,a=0;n.addEventListener("mousedown",n=>{if(n.target.classList.contains("minimize"))return;e=!![],i=n.clientX,o=n.clientY;const c=this.panelElement.getBoundingClientRect();r=c.left,a=c.top,document.addEventListener("mousemove",A),document.addEventListener("mouseup",H),n.preventDefault()});const A=n=>{if(!e||!this.panelElement)return;const c=n.clientX-i,l=n.clientY-o;this.panelElement.style.left=r+c+"px",this.panelElement.style.top=a+l+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},H=()=>{e=![],document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",H)}}}createFloatingButton(){const e=document.createElement("div");return e.className="floating-btn",e.innerHTML="⚙️",e.title="Open Elements Debug Console",e.style.display="none",e.addEventListener("click",()=>{this.toggleVisibility()}),e}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(e){const n=document.createElement("div");n.className="log-entry "+e.type+" "+e.level;const i=new Date(e.timestamp).toLocaleTimeString();return n.innerHTML='\n <div class="log-meta">\n <div class="log-type '+e.type+'">'+e.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+i+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(e.message)+"\n "+(e.context?'<div class="log-context">'+this.escapeHtml(e.context)+"</div>":"")+"\n "+(e.data?'<div class="log-data"><pre>'+this.formatJsonData(e.data)+"</pre></div>":"")+"\n </div>\n ",n}formatJsonData(e){try{return"object"==typeof e&&null!==e?JSON.stringify(e,null,2):String(e)}catch(n){return String(e)}}escapeHtml(e){const n=document.createElement("div");return n.textContent=e,n.innerHTML}}class FingerPrintService{constructor(){this.keyPrefix=B,this.isLocalStorageAvailable=null,this.cachedFingerprint=null}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(e){if(this.l()){const n=this.u(e);if(n)return this.h(e,n)}this.cachedFingerprint||(this.cachedFingerprint=this.m());const n=this.h(e,this.cachedFingerprint);if(this.l())try{const e=this.keyPrefix+"_"+n;localStorage.setItem(e,Date.now().toString())}catch(i){}return n}getFingerprintData(){return{screen:this.v(),browser:this.C(),timezone:this.k()}}isLocalStorageWebApiAvailable(){return this.l()}h(e,n){return(e+"_"+n).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 n=["setItem","getItem","removeItem","clear"];for(const e of n)if("function"!=="object".localStorage[e])return this.isLocalStorageAvailable=![],![];const i="__localStorage_test_"+Date.now()+"__",o="test";window.localStorage.setItem(i,o);const r=window.localStorage.getItem(i);if(r!==o)return this.isLocalStorageAvailable=![],![];window.localStorage.removeItem(i);try{const e="__quota_test__",n="x".repeat(100);window.localStorage.setItem(e,n),window.localStorage.removeItem(e)}catch(e){this.S()&&console.warn("localStorage has quota limitations in webview environment")}return this.isLocalStorageAvailable=!![],!![]}catch(n){if(this.isLocalStorageAvailable=![],n instanceof DOMException){const e={QuotaExceededError:"Storage quota exceeded",SecurityError:"Access denied due to security policies",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage"},i=e[n.name]||"Storage error: "+n.name,o=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+o+": "+i)}return![]}}u(e){try{const n=this.keyPrefix+"_"+e.toLowerCase()+"_";for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);if(null==i?void 0:i.startsWith(n)){const e=i.substring(n.length);if(e&&/^[a-f0-9]+$/.test(e))return e}}return null}catch(n){return null}}m(){const e=this.getFingerprintData(),n=Object.keys(e).sort().map(n=>n+":"+e[n]).join("|");return this.T(n)}v(){try{const e=screen,n=e.colorDepth||24,i=e.pixelDepth||n,o=this.I(),r=Math.round(100*(window.devicePixelRatio||1));return n+"|"+i+"|"+o+"|"+r}catch(e){return"24|24|srgb|100"}}I(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(R){}return"srgb"}C(){var e;try{const n=navigator,i=[],o=((null===(e=n.languages)||void 0===e?void 0:e[0])||n.language||"en").substring(0,2);i.push(o),i.push(n.hardwareConcurrency||4);const r=(n.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);i.push(r),i.push(n.cookieEnabled?"1":"0"),i.push(n.maxTouchPoints||0),i.push(n.deviceMemory||0),i.push(this.P()),i.push(this.S()?"webview":"browser");const a=["bluetooth"in n?"1":"0","usb"in n?"1":"0","mediaDevices"in n?"1":"0","permissions"in n?"1":"0","credentials"in n?"1":"0","storage"in n?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return i.push(a.join("")),i.join("|")}catch(n){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}P(){try{const e=navigator.userAgent.toLowerCase();return e.includes("instagram")?"ig_webview":e.includes("fban")||e.includes("fbav")?"fb_webview":e.includes("tiktok")?"tiktok_webview":e.includes("linkedin")?"linkedin_webview":e.includes("snapchat")?"snapchat_webview":e.includes("twitter")?"twitter_webview":e.includes("line/")?"line_webview":e.includes("micromessenger")?"wechat_webview":e.includes("firefox")?"gecko":e.includes("edg/")?"edge":e.includes("opr/")||e.includes("opera")?"opera":e.includes("chrome")&&!e.includes("edg")?"blink":e.includes("safari")&&!e.includes("chrome")?"webkit":"unknown"}catch(e){return"unknown"}}S(){try{const e=navigator.userAgent.toLowerCase(),n=navigator,i=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return i.some(n=>e.includes(n))?!![]:void 0===n.standalone||n.standalone?window.self!==window.top?!![]:![]:!![]}catch(e){return![]}}k(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return e.replace(/\//g,"_").substring(0,30)}catch(e){return"UTC"}}T(e){const n=16777619;let i=2166136261,o=2166136261,r=2166136261,a=2166136261;for(let c=0;c<e.length;c++){const l=e.charCodeAt(c);i^=l,i=Math.imul(i,n),o^=l<<1,o=Math.imul(o,n),r^=l<<2,r=Math.imul(r,n),a^=l<<3,a=Math.imul(a,n)}return i=Math.abs(i),o=Math.abs(o),r=Math.abs(r),a=Math.abs(a),i.toString(16)+o.toString(16)+r.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 e=this.clientConfig.get("env"),i=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!![],endpoint:i,batchSize:e===n.PRODUCTION?5:10,batchInterval:e===n.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(e,n,i={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(e))return;const o=Date.now(),r="event_"+o+"_"+Math.random().toString(36).slice(2,11);try{const a={eventId:r,timestamp:o,level:e,message:n,context:i.context,error:i.error?this.buildErrorContext(i.error):void 0,component:i.component,data:i.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(a)}catch(a){this.handleInternalError(a)}}buildErrorContext(e){return{name:e.name,message:e.message,stack:this.truncateStackTrace(e.stack),code:e.code,statusCode:e.status||e.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(e){switch(e){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(e){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(e),this.stats.totalEvents++,this.stats.eventsByLevel[e.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var e;if(0===this.eventQueue.length||!(null===(e=this.config)||void 0===e?void 0:e.endpoint))return;const n=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const i=this.createBatch(n);try{this.sendBatch(i),this.stats.batchesSent++}catch(o){this.stats.failedBatches++,this.handleInternalError(o),this.eventQueue.unshift(...n),this.stats.queuedEvents=this.eventQueue.length}}createBatch(e){const n=Date.now(),i="batch_"+n+"_"+Math.random().toString(36).slice(2,9);return{batchId:i,timestamp:n,events:e}}sendBatch(e){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const n=new Blob([JSON.stringify(e)],{type:"text/plain"}),i=navigator.sendBeacon(this.config.endpoint,n);if(i)return}catch(n){return this.sendBatchViaXHR(e),void 0}this.sendBatchViaXHR(e)}sendBatchViaXHR(e){try{const n=new XMLHttpRequest;if(n.open("POST",this.config.endpoint,![]),n.setRequestHeader("Content-Type","text/plain"),n.send(JSON.stringify(e)),n.status<200||n.status>=300)throw new Error("XHR request failed with status: "+n.status)}catch(n){throw new Error("Both sendBeacon and XHR failed: "+n.message)}}truncateStackTrace(e){if(e)return e.split("\n").slice(0,10).join("\n")}handleInternalError(e){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",e)}shutdown(){var e;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(e=this.config)||void 0===e?void 0:e.endpoint))){const e=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(e),this.stats.batchesSent++}catch(n){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(e={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...e}}initialize({data:e,config:n}){var i;this.D=Object.freeze(e),this.F=Object.freeze({type:n.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(i=null==n?void 0:n.useShadowDom)&&void 0!==i?i:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(e){return e.map(e=>this.interpolatePath(e))}interpolatePath(e){if("string"!=typeof e)return e;const n=/\{([^}]+)}/g;return e.replace(n,(n,i)=>{const o=this.D[i];return null==o?(this.logger.warn('Parameter "'+i+'" not found in component params for path "'+e+'"'),n):String(o)})}connectedCallback(){var e,n;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.F.useShadowDom?this.attachShadow({mode:this.clientConfig.isDevelopment()?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(e=this.connected)||void 0===e||e.call(this)}catch(i){this.logger.error("Component connectedCallback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"connectedCallback")}}disconnectedCallback(){var e,n;try{this.cleanup(),null===(e=this.disconnected)||void 0===e||e.call(this)}catch(i){this.logger.error("Component disconnectedCallback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"disconnectedCallback")}}setup(){var e,n,i;try{this.updateHostClasses(),this.updateHostAttributes(),null===(e=this.beforeSetupStoreWatchers)||void 0===e||e.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(n=this.beforeConnected)||void 0===n||n.call(this)}catch(o){this.logger.error("Component setup error in "+((null===(i=this.F)||void 0===i?void 0:i.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 n of this.unsubscribers)try{n()}catch(e){this.logger.error("Cleanup error during component destruction",e),e instanceof Error&&this.captureComponentError(e,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var e;if(!this.reactiveOptions.autoDestroy)return;let n=this.reactiveOptions.autoDestroyPath;if(!n&&(null===(e=this.reactiveOptions.watchStorePaths)||void 0===e?void 0:e.length)&&(n=this.reactiveOptions.watchStorePaths[0]),!n)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const i=this.interpolatePath(n),o=this.store.watch(i,(e,n)=>{this.isDestroyed||void 0===e&&void 0!==n&&this.handleAutoDestroy(i)});this.unsubscribers.push(o),this.logger.debug("🔥 AutoDestroy enabled for "+this.F.tagName+" watching path: "+i)}handleAutoDestroy(e){var n;if(this.isDestroyed)return;this.logger.debug("🔥 AutoDestroy triggered for "+this.F.tagName+' - path "'+e+'" was removed'),null===(n=this.beforeAutoDestroy)||void 0===n||n.call(this,e);const i=this.reactiveOptions.autoDestroyDelay||0;i>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},i):this.destroyComponent()}destroyComponent(){var e;if(!this.isDestroyed)try{null===(e=this.onAutoDestroy)||void 0===e?void 0:e.call(this),this.remove()}catch(n){this.logger.error("Error during auto-destroy of "+this.F.tagName,n),n instanceof Error&&this.captureComponentError(n,"auto-destroy")}}setupStoreWatchers(){var e;try{let e=this.reactiveOptions.watchStorePaths;if(!(null==e?void 0:e.length)||!this.D)return;e=this.interpolateStorePaths(e);const n=this.store.watchMany(e,e=>{var n,i;try{if(this.isDestroyed)return;const i=e.map(e=>e.path).join(", "),o="store:["+i+"]",r=null===(n=this.onStoreChanged)||void 0===n?void 0:n.call(this,e);r!==![]&&this.triggerRender(o)}catch(o){this.logger.error("Store watcher callback error in "+((null===(i=this.F)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"storeWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Store watchers setup error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupStoreWatchers")}}setupNonRenderingWatchers(){var e;try{let e=this.reactiveOptions.watchOnlyStorePaths;if(!(null==e?void 0:e.length)||!this.D)return;e=this.interpolateStorePaths(e);const n=this.store.watchMany(e,e=>{var n,i;try{if(this.isDestroyed)return;null===(n=this.onStoreWatch)||void 0===n?void 0:n.call(this,e)}catch(o){this.logger.error("Non-rendering watcher callback error in "+((null===(i=this.F)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"nonRenderingWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Non-rendering watchers setup error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupNonRenderingWatchers")}}triggerRender(e){this.lastRenderTrigger=e,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var e,n;if(!this.initialized||this.isDestroyed)return;const i=performance.now();this.renderCount++;try{const n=this.template();"string"==typeof n&&(this.container.innerHTML=n),n instanceof HTMLElement&&safeReplaceChildren(this.container,n),Array.isArray(n)&&safeReplaceChildren(this.container,...n);const r=performance.now()-i;this.logRenderInfo(r);try{null===(e=this.afterRender)||void 0===e?void 0:e.call(this)}catch(o){this.logger.error("❌ afterRender hook error in "+this.F.tagName,o),o instanceof Error&&this.captureComponentError(o,"afterRender")}}catch(r){const e=performance.now()-i;this.logger.error("❌ Component render error in "+this.F.tagName,r),this.captureComponentError(r,"render",e),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.F.type,message:r instanceof Error?r.message:String(r)}));try{null===(n=this.onError)||void 0===n?void 0:n.call(this,r,"render")}catch(a){this.logger.error("❌ onError hook error in "+this.F.tagName,a)}}}logRenderInfo(e){const n=this.F.type,i=this.F.tagName,o=e>16?"🐌":e>8?"⚡":"🚀";this.logger.debug("Rendered "+o+" "+n+" </"+i+"> | #"+this.renderCount+" | "+e.toFixed(2)+"ms | "+this.lastRenderTrigger),e>16&&(this.logger.warn("⚠️ Slow render in "+n+"("+i+"): "+e.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:e,threshold:16,componentType:n,tagName:i,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+e.toFixed(2)+"ms",{context:"Component:"+i+":performance",component:{type:n,tagName:i,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:e,useShadowDom:this.F.useShadowDom}}))}rerender(e){this.triggerRender(e?"manual:rerender:"+e:"manual:rerender()")}captureComponentError(e,n,i){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",e.message,{context:"Component:"+this.F.tagName+":"+n,component:{type:this.F.type,tagName:this.F.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:i,useShadowDom:this.F.useShadowDom}})}catch(o){}}updateHostClasses(){const e=this.hostClasses;if(e.length>0){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());n.length>0&&this.classList.add(...n)}}addHostClasses(...e){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());n.length>0&&this.classList.add(...n)}removeHostClasses(...e){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());n.length>0&&this.classList.remove(...n)}toggleHostClasses(...e){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());for(const i of n)this.classList.toggle(i)}addHostAttribute(e,n){e&&"string"==typeof e&&n&&"string"==typeof n&&(this.setAttribute(e,String(n)),this.hostAttributes[e]=String(n))}removeHostAttribute(e){e&&"string"==typeof e&&(this.removeAttribute(e),delete this.hostAttributes[e])}updateHostAttributes(){const e=this.hostAttributes;for(const[n,i]of Object.entries(e))n&&"string"==typeof n&&i&&"string"==typeof i&&this.setAttribute(n,String(i))}get params(){return this.D}get config(){return this.themeProvider.getComponentConfig(this.F.type)}get elementConfig(){return this.F}getConfigs(e){return this.themeProvider.getConfigs(e)}getStoreValue(e){return this.store.get(e)}setStoreValue(e,n){return this.store.set(e,n)}watchStore(e,n){const i=this.store.watch(e,n);return this.unsubscribers.push(i),i}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var e;const n=null!==(e=this.params.options)&&void 0!==e?e:{};return ComponentFactoryService.createElement({type:r.ADDRESS_DISPLAY,isIndependentComponent:!![],options:n})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var e,n,i,o;const a=this.getStoreValue("address"),c=null!==(e=this.params.isIndependentComponent)&&void 0!==e?e:![],l=null!==(n=this.params.productId)&&void 0!==n?n:"",d=null!==(i=this.params.options)&&void 0!==i?i:{},u=null!==(o=d.showLabel)&&void 0!==o?o:!![],h=[];if(u){const e=document.createElement("span");e.textContent="Delivers to:",h.push(e)}const p=document.createElement("button");p.type="button",p.textContent=a.formattedAddress||"Select an address";const m=a.formattedAddress?"Change delivery address, currently set to "+a.formattedAddress:"Select delivery address";return p.setAttribute("aria-label",m),p.addEventListener("click",async()=>{if(c)return this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:l,isIndependentComponent:!![]}),void 0;!c&&l&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:l}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(l,r.ADDRESS_INPUT,{productId:l}))}),h.push(p),h}}const ArrowRightIcon=({width:e=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="arrow-right-icon '+i+'" style="'+r+'" 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:e=24,height:n=24,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 489 489" class="bag-icon '+i+'" style="'+r+'" 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:e=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="checkbox-icon '+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:e=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="'+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:e=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="chevron-left-icon '+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},CloseIcon=({width:e=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="close-icon '+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:e=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="error-info-icon '+i+'" style="'+r+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:e=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="info-icon '+i+'" style="'+r+'" 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:e=16,height:n=16,className:i="",color:o=null})=>{const r=o||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="search-icon '+i+'">\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="'+r+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:e=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="success-icon '+i+'" style="'+r+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:e=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="trash-icon '+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:e=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="warning-icon '+i+'" style="'+r+'" 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 e;return null!==(e=this.params.isIndependentComponent)&&void 0!==e?e:![]},this.handleInputChange=e=>{const n=e.target,i=n.value.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const o=/^\d/.test(i);if(i.length<this.minSearchLength||!o)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(i)},300)},this.closeDrawer=async()=>{const e=this.params.productId,n=this.clientConfig.isMobile(),i=this.isIndependentComponent();(n||i)&&this.commands.ui.closeDrawer(),!n&&e&&await this.commands.product.closeProductDrawer(e)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(R){this.logger.error("Address edit cancellation failed",R)}},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 e=this.getStoreValue("address"),n=(null==e?void 0:e.coordinates.lat)!==this.selectedAddress.coordinates.lat||(null==e?void 0:e.coordinates.long)!==this.selectedAddress.coordinates.long;n&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(e){this.logger.error("Address selection and availability check failed",e),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async e=>{const n=e.currentTarget.dataset.suggestionId;if(n)try{this.error=null,this.updateErrorDisplay();const e=await this.commands.address.getAddressDetails(n);if(0===Object.keys(e).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:n,address:e.address,coordinates:e.coords,formattedAddress:e.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(i){this.logger.error("Address details retrieval failed",i),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=e=>{this.container.contains(e.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const e=this.getStoreValue("address");(null==e?void 0:e.formattedAddress)&&(this.selectedAddress=e)}async searchAddresses(e){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const n=await this.commands.address.searchAddresses(e);this.suggestions=n.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(n){this.logger.error("Address search operation failed",n),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 e=this.errorContainer.querySelector(".error-text");e&&(e.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const e=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(e),void 0}for(const e of this.suggestions){const n=this.createElement("li",{className:"suggestion-item"}),i=this.createElement("span",{textContent:e.description});n.appendChild(i),n.setAttribute("data-suggestion-id",e.id),n.setAttribute("role","option"),n.setAttribute("aria-label","Select address: "+e.description),n.setAttribute("tabindex","0"),n.addEventListener("click",this.handleSuggestionClick),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.click())}),this.suggestionsContainer.appendChild(n)}}}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(e,n){const i=document.createElement(e);return n&&Object.assign(i,n),i}createErrorContainer(){const e=this.createElement("div",{className:"error-message"});e.style.display="none",e.setAttribute("role","alert"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true");const n=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),i=this.createElement("span",{className:"error-text"});return e.appendChild(n),e.appendChild(i),e}createCheckButton(){const e=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return e.setAttribute("aria-label","Save and check address availability"),e.addEventListener("click",this.handleCheckAvailability),e}createCancelButton(){const e=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return e.setAttribute("aria-label","Cancel address selection"),e.addEventListener("click",this.handleCancel),e}template(){var e,n,i;const o=this.getConfigs("global"),r=null!==(e=this.params.options)&&void 0!==e?e:{},a=null!==(n=r.showLabel)&&void 0!==n?n:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),a){const e=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(e)}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===(i=this.selectedAddress)||void 0===i?void 0:i.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 d=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),u=[this.inputContainer,d,this.errorContainer],h=this.createElement("div",{className:"action-buttons"}),p=this.createCancelButton();h.appendChild(p);const m=this.createCheckButton();return h.appendChild(m),u.push(h),document.addEventListener("click",this.handleDocumentClick),u}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const e=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&e.push("cart-no-header"),this.params.isIndependentComponent&&e.push("independent"),e}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const e=[],n=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!n){const n=ComponentFactoryService.createElement({type:r.CART_HEADER});e.push(n)}const i=ComponentFactoryService.createElement({type:r.CART_BODY});e.push(i);const o=ComponentFactoryService.createElement({type:r.CART_FOOTER});return e.push(o),e}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const e=document.createElement("div");e.className="empty-cart-container";const n=document.createElement("h3");return n.className="empty-cart-content",n.textContent="Your cart is empty",e.appendChild(n),e}createLoadingElement(){const e=document.createElement("div");return e.setAttribute("data-component-type","cart-body-loading"),e.innerHTML=this.loadingTemplate(),e}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(e){try{return ComponentFactoryService.createElement({type:r.CART_RETAILER,retailerId:e.id})}catch(n){return this.logger.error("Cart retailer component creation failed",n),document.createElement("div")}}getRetailerElementById(e){return this.container.querySelector('[data-retailer-id="'+e+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const e=this.createEmptyCartElement();this.container.appendChild(e),this.setupEmptyCartListeners()}addLoadingOverlay(){const e=this.getLoadingElement();if(!e){const e=this.createLoadingElement();this.container.appendChild(e)}}removeLoadingOverlay(){const e=this.getLoadingElement();e&&e.remove()}setupEmptyCartListeners(){const e=this.container.querySelector('[data-action="continue-shopping"]');e&&e.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(e,n){const i=this.createRetailerElement(n);i.setAttribute("data-retailer-id",e),this.container.appendChild(i)}removeRetailerElement(e){const n=this.getRetailerElementById(e);n&&n.remove()}updateRetailerElement(e,n){const i=this.getRetailerElementById(e);if(i){const o=this.createRetailerElement(n);o.setAttribute("data-retailer-id",e),i.replaceWith(o)}}hasRetailerDataChanged(e,n){return e?![]:!![]}getValidRetailers(e){if(!e)return{};const n={};for(const[i,o]of Object.entries(e))o&&"object"==typeof o&&o.id&&(n[i]=o);return n}getValidRetailerIds(e){const n=this.getValidRetailers(e);return new Set(Object.keys(n))}onStoreChanged(e){const n=e.find(e=>"cart.retailers"===e.path),i=e.find(e=>"cart.loading"===e.path);if(n){const e=this.getValidRetailers(n.oldValue),i=this.getValidRetailers(n.value),o=this.getValidRetailerIds(n.oldValue),r=this.getValidRetailerIds(n.value),a=o.size,c=r.size,l=this.getValidRetailers(this.getStoreValue("cart.retailers")),d=Object.keys(l).length;if(c>0&&0===d)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===a&&c>0){this.container.innerHTML="";for(const[e,n]of Object.entries(i))this.addRetailerElement(e,n)}else if(a>0&&0===c)this.showEmptyCartState();else if(c>0){for(const e of o)r.has(e)||this.removeRetailerElement(e);for(const n of r){const r=i[n],a=e[n];o.has(n)?this.hasRetailerDataChanged(a,r)&&this.updateRetailerElement(n,r):this.addRetailerElement(n,r)}}else 0===a&&0===c&&this.showEmptyCartState()}if(i){const e=i.value,n=i.oldValue;e!==n&&(e?this.addLoadingOverlay():this.removeLoadingOverlay())}return i||n,![]}afterRender(){this.setupEmptyCartListeners();const e=this.getStoreValue("cart.loading");e&&this.addLoadingOverlay()}template(){const e=this.getStoreValue("cart.retailers")||{},n=Object.values(e);if(0===n.length)return this.createEmptyCartElement();const i=[];for(const o of n){const e=this.createRetailerElement(o);e.setAttribute("data-retailer-id",o.id),i.push(e)}return i}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(e){const n=e.some(e=>e.path.includes("cart.items")),i=e.some(e=>e.path.includes("cart.totals")),o=e.some(e=>e.path.includes("cart.fulfillments")),r=e.some(e=>"cart.loading"===e.path),a=e.some(e=>e.path.includes("cart.retailers"));if(n&&this.updateSubtotalItemsCount(),i&&this.subtotalPrice){const e=this.getStoreValue("cart.totals.subtotal")||0,n=this.getStoreValue("cart.totals.engravingFee")||0;this.subtotalPrice.textContent=""+formatCentToDollarText(e+n)}(o||i||r||n||a)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const e=this.getStoreValue("cart.loading");if(e)return!![];const n=this.getStoreValue("cart.items")||{},i=Object.values(n).some(e=>e.updating);if(i)return!![];const o=this.getStoreValue("cart.fulfillments")||{},r=Object.values(o).some(e=>e.updating);if(r)return!![];const a=this.getStoreValue("cart.retailers")||{},c=Object.values(a).some(e=>e.updating);return c?!![]:![]}hasUnmetMinimum(e){var n;const i=e.subtotal;if(e.type===a.SHIPPING){const o=e.fees;if((null===(n=o.individual)||void 0===n?void 0:n.active)&&o.individual.min>0&&i<o.individual.min)return!![]}if(e.type===a.ON_DEMAND){const n=e.fees;if(n.min>0&&i<n.min)return!![]}return![]}shouldDisableCheckout(){const e=this.getStoreValue("cart.fulfillments")||{};return Object.values(e).some(e=>this.hasUnmetMinimum(e))}updateCheckoutButtonState(){const e=this.getStoreValue("cart.items")||{},n=Object.keys(e).length>0;if(this.checkoutButton){const e=this.isAnythingLoading(),i=this.shouldDisableCheckout(),o=e||i||!n;this.checkoutButton.disabled=o,this.checkoutButton.classList.toggle("checkout-btn-disabled",o),this.checkoutButton.classList.toggle("loading",e)}}updateSubtotalItemsCount(){const e=this.getStoreValue("cart.items"),n=Object.values(e).reduce((e,n)=>e+n.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+n+" item"+(1!==n?"s":"")+"):")}handleCheckout(e){return this.clientConfig.isBuilder()?(e.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(e.preventDefault(),void 0):(this.commands.cart.handleGoToCheckout(),void 0)}template(){const e=this.getConfigs("global"),n=this.getStoreValue("cart.totals.subtotal")||0,i=this.getStoreValue("cart.totals.engravingFee")||0,o=[],a=document.createElement("div");a.className="cart-footer-header";const c=document.createElement("div");c.className="cart-footer-items-price";const l=document.createElement("span");l.className="subtotal-text",l.textContent="Subtotal (0 items):",this.subtotalText=l,c.appendChild(l);const d=document.createElement("span");d.className="subtotal-price",d.textContent=formatCentToDollarText(n+i),this.subtotalPrice=d,c.appendChild(d);const u=document.createElement("p");if(u.textContent="Taxes & fees will be calculated at checkout",u.className="taxes-fees-info",a.appendChild(c),a.appendChild(u),o.push(a),e.layout.allowPromoCodes){const e=ComponentFactoryService.createElement({type:r.CART_PROMO_CODE});o.push(e)}const h=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});o.push(h);const p=document.createElement("button");if(p.type="button",p.className="checkout-button",p.setAttribute("aria-label","Go to checkout"),p.addEventListener("click",this.handleCheckout),p.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleCheckout(e))}),p.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton=p,o.push(p),e.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});o.push(e)}return o}}const ht={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"},pt="America/New_York";function detectUserTimezone(e){try{if(e){const n=e.toUpperCase(),i=ht[n];return i||pt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){return pt}}function getCurrentTimeInTimezone$1(e){try{const n=new Date,i=n.getTime(),o=6e4*n.getTimezoneOffset(),r=new Date(i+o),a=new Date(r.toLocaleString("en-US",{timeZone:e})),c=r.getTime()-a.getTime();return new Date(i+c)}catch(n){return new Date}}function getCurrentTimeInUserTimezone(e){const n=detectUserTimezone(e);return getCurrentTimeInTimezone$1(n)}function isDateTimeInRange(e){const{startDate:n,endDate:i,addressState:o}=e;try{const e=getCurrentTimeInUserTimezone(o),r=!n||e>=new Date(n),a=!i||e<=new Date(i);return r&&a}catch(r){return![]}}function filterActiveItems(e,n){return e.filter(e=>isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:n}))}function hasActiveItems(e,n){return filterActiveItems(e,n).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var e,n,i;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 d=document.createElement("button");d.type="button",d.className="cart-header-close-btn",d.innerHTML=CloseIcon({width:16,height:16}),d.setAttribute("aria-label","Close cart drawer"),d.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),c.appendChild(d);const u=this.clientConfig.get("promoTicker"),h=null!==(n=null===(e=null==a?void 0:a.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==n?n:[],p=null!=u?u:h,m=this.store.get("address"),f=hasActiveItems(p,null===(i=null==m?void 0:m.address)||void 0===i?void 0:i.state);if(!p.length||!f)return[c];const g=ComponentFactoryService.createElement({context:"cart",type:r.PROMO_CODE_TICKER,tickers:p});return[c,g]}}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(e,n){var i,o,a,c,l,d,u,h,p,m;this.commands.ui.openDrawer(r.ENGRAVING_FORM,{identifier:e,context:"cart",lines:(null===(o=null===(i=n.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],maxLines:(null===(c=null===(a=n.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.maxLines)||1,maxCharsPerLine:(null===(d=null===(l=n.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.maxCharsPerLine)||16,fee:(null===(h=null===(u=n.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.fee)||0,location:null===(m=null===(p=n.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.location})}template(){var e,n,i,o,a,c,l,d,u;const h=this.params.itemId,p=this.getStoreValue("cart.items."+h),m=this.getConfigs("global"),f=this.getStoreValue("cart.fulfillments."+p.fulfillmentId),g=p.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(e=null==f?void 0:f.expectation)||void 0===e?void 0:e.detail)||"",v=document.createElement("article");v.className="cart-item";const y=document.createElement("div");y.className="item-image";const b=document.createElement("img");b.src=p.mainImage,b.alt=p.name,y.appendChild(b);const x=document.createElement("div");x.className="item-details";const w=document.createElement("div");w.className="item-header";const C=document.createElement("h3");C.className="item-title",C.textContent=p.name;const S=document.createElement("button");S.className="item-delete",S.innerHTML=TrashIcon({}),S.setAttribute("role","button"),S.setAttribute("tabindex","0"),S.setAttribute("aria-label","Remove "+p.name+" from cart"),S.setAttribute("aria-expanded","true"),S.addEventListener("click",async()=>{await this.commands.cart.removeItem(h)}),S.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.commands.cart.removeItem(h))}),w.appendChild(C),w.appendChild(S);const I=document.createElement("div");I.className="item-specs",I.textContent=p.size+", "+p.container;const P=document.createElement("div");P.className="item-shipping-container";const D=document.createElement("div");if(D.className="item-shipping",D.textContent=g,P.appendChild(D),m.layout.enablePersonalization&&(null===(i=null===(n=null==p?void 0:p.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.isEngravable)&&(null===(a=null===(o=null==p?void 0:p.attributes)||void 0===o?void 0:o.engraving)||void 0===a?void 0:a.hasEngraving)===![]&&f.canEngrave){const e=document.createElement("span");e.className="cart-add-personalization-span",e.textContent=m.layout.personalizationText+" +"+formatCentToDollarText((null===(l=null===(c=p.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.fee)||0,![]),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Add personalization to "+p.name),e.addEventListener("click",()=>this.handleOpenEngravingForm(h,p)),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleOpenEngravingForm(h,p))}),P.appendChild(e)}x.appendChild(w),x.appendChild(I),x.appendChild(P),v.appendChild(y),v.appendChild(x);const F=[v],_=ComponentFactoryService.createElement({type:r.CART_ITEM_QUANTITY_PRICE,itemId:h});if((null===(u=null===(d=null==p?void 0:p.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.hasEngraving)===!![]){const e=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:h,context:"cart"});F.push(e)}return F.push(_),F}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(e){const n=e.find(e=>"cart.items"===e.path);if(n){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getItemStore(){const e=this.params.itemId,n=this.getStoreValue("cart.items."+e);return n||null}calculateQuantityLimits(){const e=this.getItemStore();if(!e)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const n=e.quantity,i=this.getAvailableQuantity(),o=i>0;return{currentQuantity:n,availableQuantity:i,canIncrease:o,canDecrease:!![]}}getAvailableQuantity(){var e,n,i,o;const r=this.getItemStore();if(!r)return 0;const a=r.partNumber,c=r.fulfillmentId,l=this.getStoreValue("cart.items")||{},d=Object.values(l).filter(e=>e.partNumber===a&&e.fulfillmentId===c),u=d.reduce((e,n)=>e+n.quantity,0),h=this.getStoreValue("products."+r.upc)||this.getStoreValue("products."+r.salsifyGrouping);if(!h)return r.maxQuantity-u;const p=null!==(o=null===(i=null===(n=null===(e=null==h?void 0:h.sizes)||void 0===e?void 0:e[r.liquidId])||void 0===n?void 0:n.attributes)||void 0===i?void 0:i.maxQuantityPerOrder)&&void 0!==o?o:0;return!p||p<=0?r.maxQuantity-u:p-u}updateButtonStates(e){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!e.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!e.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=e.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+e.currentQuantity))}async handleQuantityChange(e){const n=this.calculateQuantityLimits();e>0&&!n.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,e)}createQuantityContainer(){const e=this.calculateQuantityLimits(),n=this.getItemStore();if(!n)return document.createElement("div");const i=document.createElement("div");return i.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 e=>{e.preventDefault(),e.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 e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(e),i.appendChild(this.qtyDecreaseButton),i.appendChild(this.quantitySpan),i.appendChild(this.qtyIncreaseButton),i}createPriceContainer(){const e=this.getItemStore();if(!e)return document.createElement("div");const n=document.createElement("div");n.className="item-price-container";const i=document.createElement("span");if(i.className="item-price",i.textContent=formatCentToDollarText(e.price),n.appendChild(i),e.quantity>1){const i=document.createElement("span");i.className="item-price-per-unit",i.textContent="("+formatCentToDollarText(e.unitPrice)+" ea)",n.appendChild(i)}return n}template(){const e=[];if(this.config.layout.showQuantityCounter){const n=this.createQuantityContainer();e.push(n)}const n=this.createPriceContainer();return e.push(n),e}}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(e){const n=e.find(e=>"cart.promoCode"===e.path);if(n){const{value:e,oldValue:i}=n,o=Boolean(null==i?void 0:i.code),r=Boolean(null==e?void 0:e.code);if(!o&&r)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(o&&!r)return this.container.innerHTML="",this.createInputContainer(),void 0;if(r&&this.promoCodePill&&e.discountAmount!==(null==i?void 0:i.discountAmount))return this.promoCodePill.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")",void 0}}createAppliedContainer(e){const n=document.createElement("div");n.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==e?void 0:e.code)+" (- "+formatCentToDollarText((null==e?void 0:e.discountAmount)||0)+")";const i=document.createElement("button");i.type="button",i.classList.add("promo-remove-btn"),i.textContent="Remove",i.setAttribute("role","button"),i.setAttribute("aria-label","Remove promo code "+(null==e?void 0:e.code)),i.setAttribute("tabindex","0"),i.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||this.commands.cart.removePromoCode()}),n.appendChild(this.promoCodePill),n.appendChild(i),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),this.container.appendChild(e),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const e=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),n=e.length>=3&&e.length<=255,i=this.getStoreValue("cart.loading"),o=this.getStoreValue("cart.promoCode"),r=this.getStoreValue("cart.events")||[],a=hasCartAnyPromoCodeEvents(r);this.applyButton.disabled=!n||i||Boolean(null==o?void 0:o.discountAmount)||this.isApplying||a}createPromoInput(){const e=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+e.layout.inputFieldStyle,validation:{min:3,max:255},onChange:e=>{const n=e.toUpperCase(),i=this.promoInput;i.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("aria-label","Apply promo code");const T=async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(e),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(n){this.logger.error("Cart promo code application failed",{promoCode:e,error:n instanceof Error?n.message:String(n)})}};return this.applyButton.addEventListener("click",T),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),T())}),this.applyButton}template(){const e=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==e?void 0:e.code){const n=document.createElement("div");n.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")";const i=document.createElement("button");return i.type="button",i.classList.add("promo-remove-btn"),i.textContent="Remove",i.setAttribute("role","button"),i.setAttribute("aria-label","Remove promo code "+e.code),i.setAttribute("tabindex","0"),i.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||this.commands.cart.removePromoCode()}),n.appendChild(this.promoCodePill),n.appendChild(i),n}const n=document.createElement("div");n.classList.add("promo-code-container");const i=document.createElement("div");return i.classList.add("promo-container"),i.appendChild(this.createPromoInput()),i.appendChild(this.createApplyButton()),n.appendChild(i),n}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(e){return ComponentFactoryService.createElement({type:r.CART_FULFILLMENT,fulfillmentId:e})}getFulfillmentElementById(e){return this.container.querySelector('[data-fulfillment-id="'+e+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const e=this.getFulfillmentContainer();if(e)return{parent:e.parentElement,nextSibling:e.nextElementSibling};const n=this.container.querySelectorAll("[data-fulfillment-id]");if(n.length>0){const e=n[n.length-1];return{parent:e.parentElement,nextSibling:e.nextElementSibling}}return null}addFulfillmentElement(e){const n=this.getFulfillmentInsertionPoint();if(n){const i=this.createFulfillmentElement(e);i.setAttribute("data-fulfillment-id",e);const o=this.getFulfillmentContainer();o&&o.remove(),n.nextSibling?n.parent.insertBefore(i,n.nextSibling):n.parent.appendChild(i)}}removeFulfillmentElement(e){const n=this.getFulfillmentElementById(e);if(n){const e=n.parentElement,i=n.nextElementSibling;n.remove();const o=this.container.querySelectorAll("[data-fulfillment-id]");if(0===o.length){const n=document.createElement("div");n.id="retailer-fulfillment-container",i?e.insertBefore(n,i):e.appendChild(n)}}}handleFulfillmentsUpdate(e,n){const i=new Set(e||[]),o=new Set(n||[]);for(const r of i)o.has(r)||this.removeFulfillmentElement(r);for(const r of o)i.has(r)||this.addFulfillmentElement(r)}setupFulfillmentElements(){const e=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+e+".fulfillments")||[],i=this.container.querySelectorAll("[data-fulfillment-id]");for(const r of i)r.remove();let o=this.getFulfillmentContainer();if(!o){const e=this.container.querySelector(".retailer-body-container"),n=this.container.querySelector("#retailer-subtotal-container");o=document.createElement("div"),o.id="retailer-fulfillment-container",e&&n&&e.insertBefore(o,n)}for(const r of n)this.addFulfillmentElement(r)}setupSubtotalElement(){const e=this.getRetailerId(),n=this.container.querySelector("#retailer-subtotal-container");if(n){const i=ComponentFactoryService.createElement({type:r.CART_RETAILER_SUBTOTAL,retailerId:e});n.replaceWith(i)}}onStoreChanged(e){const n=this.getRetailerId(),i="cart.retailers."+n,o=e.find(e=>e.path===i);if(o){const e=o.oldValue,n=o.value,i=(null==e?void 0:e.fulfillments)||[],r=(null==n?void 0:n.fulfillments)||[];JSON.stringify(i)!==JSON.stringify(r)&&this.handleFulfillmentsUpdate(i,r)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const e=this.container.querySelector(".section-toggle"),n=this.container.querySelector(".retailer-section"),i=this.container.querySelector(".section-header-label");if(e&&n&&i){const E=()=>{const n=e.checked;i.setAttribute("aria-label",n?"Expand retailer section":"Collapse retailer section"),i.setAttribute("aria-expanded",n?"false":"true")};e.addEventListener("change",()=>{e.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),E()}),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.click())}),e.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),E()}}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 e=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+e),i=document.createElement("section");i.className="retailer-section";const o=document.createElement("div");o.className="cart-retailer-header";const r=document.createElement("div");r.className="retailer-info";const a=document.createElement("h2");a.className="section-title",a.textContent=n.name,r.appendChild(a);const c=document.createElement("input");c.type="checkbox",c.id=n.id,c.className="section-toggle",r.appendChild(c);const l=document.createElement("label");l.htmlFor=n.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 d=document.createElement("span");d.className="chevron",d.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),l.appendChild(d),r.appendChild(l),o.appendChild(r),i.appendChild(o);const u=document.createElement("div");u.className="retailer-body-container";const h=document.createElement("div");h.id="retailer-fulfillment-container",u.appendChild(h);const p=document.createElement("div");return p.id="retailer-subtotal-container",u.appendChild(p),i.appendChild(u),i}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(e,n){const i=Object.values(e||{}).filter(e=>e.retailerId===n);let o=0;for(const r of i)o+=r.quantity;return o}template(){const e=this.params.retailerId,n=this.getStoreValue("cart.retailers."+e+".subtotal")||0,i=this.getStoreValue("cart.retailers."+e+".engravingFee")||0,o=this.getStoreValue("cart.items"),r=this.getRetailerItemCount(o,e),a=1===r?"item":"items",c=document.createElement("h3");c.className="retailer-subtotal-header",c.textContent="Subtotal ("+r+" "+a+"):";const l=document.createElement("span");return l.className="retailer-subtotal-amount",l.textContent=formatCentToDollarText(n+i),[c,l]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.isPresaleLocked","checkout.presaleExpiresAt"]})}template(){var e,n,i;const o=this.store.get("checkout.isPresaleLocked"),a=this.store.get("checkout.presaleExpiresAt"),c=this.getConfigs("global"),l=this.clientConfig.get("promoTicker"),d=null!==(n=null===(e=null==c?void 0:c.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==n?n:[],u=null!=l?l:d,h=this.store.get("address"),p=hasActiveItems(u,null===(i=null==h?void 0:h.address)||void 0===i?void 0:i.state),m=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),f=o&&a,g=document.createElement("div");g.classList.add("checkout-container"),m&&g.classList.add("no-header"),this.params.isIndependentComponent&&g.classList.add("independent");const v=ComponentFactoryService.createElement({type:r.CHECKOUT_INFORMATION_SECTION});g.appendChild(v);const y=ComponentFactoryService.createElement({type:r.CHECKOUT_SUMMARY_SECTION});if(g.appendChild(y),!f&&(!u.length||!p)&&m)return[g];const b=document.createElement("div");if(b.classList.add("checkout-header-wrapper"),!m){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_HEADER});b.appendChild(e)}if(u.length&&p&&!f){const e=ComponentFactoryService.createElement({context:"checkout",type:r.PROMO_CODE_TICKER,tickers:u});b.appendChild(e)}if(f){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_PRESALE_COUNTDOWN});b.appendChild(e)}return[b,g]}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const e=this.store.get("checkout.isPresaleLocked"),n=this.getConfigs("checkout");let i=null;if(!e){i=document.createElement("button"),i.classList.add("checkout-header-button"),i.setAttribute("aria-label","Back to Cart"),i.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(r.CART)});const e=document.createElement("span");e.innerHTML=ChevronLeftIcon({}),i.appendChild(e)}const o=document.createElement("h1");o.textContent=(null==n?void 0:n.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()}),i?[i,o,a]:[o,a]}}class CheckoutInformationSectionComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift"]})}onStoreWatch(e){const n=e.find(e=>"checkout.isGift"===e.path);n&&this.handleBuyerInformationVisibility(n.value)}handleBuyerInformationVisibility(e){const n=this.container.querySelector("#buyer-information-container");if(e&&!n){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_BUYER_INFORMATION_FORM});e.id="buyer-information-container";const n=this.container.querySelector(".checkout-delivery-information");n&&n.insertAdjacentElement("afterend",e)}else!e&&n&&setTimeout(()=>{n.remove()},300)}template(){const e=[],n=ComponentFactoryService.createElement({type:r.CHECKOUT_DELIVERY_INFORMATION_FORM});e.push(n);const i=ComponentFactoryService.createElement({type:r.CHECKOUT_PAYMENT_FORM});e.push(i);const o=ComponentFactoryService.createElement({type:r.CHECKOUT_BILLING_FORM});return e.push(o),e}}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(e){var n;const i=e.find(e=>"checkout.presaleExpiresAt"===e.path);if(null==i?void 0:i.value)return this.updateExpiresAt(i.value),!![];const o=e.find(e=>"ui.drawer"===e.path);return(null===(n=null==o?void 0:o.value)||void 0===n?void 0:n.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const e=this.store.get("checkout.presaleExpiresAt");e&&this.updateExpiresAt(e),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var e,n;const i=[".drawer-content"];for(const r of i){const n=null===(e=this.rootElement)||void 0===e?void 0:e.closest(r);if(n&&this.isScrollable(n))return n}let o=null===(n=this.rootElement)||void 0===n?void 0:n.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 e,n;if(!this.scrollContainer)return;const i=this.scrollContainer.scrollTop,o=70,r=10;!this.isCurrentlyScrolled&&i>o?(this.isCurrentlyScrolled=!![],null===(e=this.rootElement)||void 0===e||e.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&i<r&&(this.isCurrentlyScrolled=![],null===(n=this.rootElement)||void 0===n||n.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(e){const n=window.getComputedStyle(e),i=n.overflowY;return e.scrollHeight>=e.clientHeight&&("auto"===i||"scroll"===i||"overlay"===i)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(e){this.stopCountdown();try{if(this.expiresAt=new Date(e),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:e}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const n=new Date,i=Math.floor((this.expiresAt.getTime()-n.getTime())/1e3);i<this.totalDuration&&(this.totalDuration=Math.max(i,240)),this.startCountdown()}catch(n){this.logger.error("Failed to parse presale expiration date",n),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const e=new Date,n=Math.max(0,this.expiresAt.getTime()-e.getTime()),i=n/1e3,o=this.totalDuration-i,r=Math.max(0,Math.min(100,o/this.totalDuration*100)),a=i<60;if(a!==this.isUnderOneMinute){this.isUnderOneMinute=a;const e=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==e||e.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==e||e.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}const c=this.rootElement.querySelector("[data-timer]");c&&(c.textContent=this.formatTime(n));const l=this.rootElement.querySelector("[data-progress-fill]");l&&(l.style.width=r+"%"),0===n&&this.handleExpire()}formatTime(e){const n=Math.floor(e/1e3),i=Math.floor(n/60),o=n%60,r=Math.floor(e%1e3/10);return i.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")}handleExpire(){this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer()}template(){const e=document.createElement("div");e.classList.add("checkout-presale-countdown"),this.rootElement=e;const n=document.createElement("div");n.classList.add("checkout-presale-text-container");const i=document.createElement("div");i.classList.add("checkout-presale-heading");const o=document.createElement("h2");o.textContent="LIMITED PRE-ORDER:";const r=document.createElement("div");r.classList.add("checkout-presale-timer"),r.setAttribute("data-timer",""),r.textContent="00:00:00",i.appendChild(o),i.appendChild(r);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"),n.appendChild(i),n.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),e.appendChild(n),e.appendChild(c),e}}const mt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],ft={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(e,n){return"href"===e?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(n)?n:null:"src"===e?/^https?:\/\/[^\s<>"']+$/i.test(n)?n:null:"class"===e?n.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():n.replace(/[<>"']/g,"").trim()}function cleanNode(e){if(e.nodeType===Node.TEXT_NODE){const n=e.textContent||"",i=n.replace(/<[^>]*>/g,"");if(i.trim()){const e=document.createTextNode(i);return e}return null}if(e.nodeType===Node.ELEMENT_NODE){const n=e,i=n.tagName.toLowerCase();if(mt.includes(i)){const e=document.createElement(i),o=ft[i]||[];for(const i of Array.from(n.attributes)){const n=i.name.toLowerCase();if(o.includes(n)){const o=sanitizeAttributeValue(n,i.value);null!==o&&e.setAttribute(n,o)}}"a"===i&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"));for(const i of Array.from(n.childNodes)){const n=cleanNode(i);n&&e.appendChild(n)}return e}const o=document.createDocumentFragment();for(const e of Array.from(n.childNodes)){const n=cleanNode(e);n&&o.appendChild(n)}return o.childNodes.length>0?o:null}return null}function sanitizeHTML(e){if(!e||"string"!=typeof e)return"";try{const n=new DOMParser,i=n.parseFromString(e,"text/html"),o=i.querySelector("parsererror");if(o)return console.warn("HTML parsing error detected"),"";const r=document.createDocumentFragment();for(const e of Array.from(i.body.childNodes)){const n=cleanNode(e);n&&r.appendChild(n)}const a=document.createElement("div");return a.appendChild(r),a.innerHTML}catch(n){return console.error("HTML sanitization error:",n),""}}class CheckoutSummarySectionComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(e){const n=e.find(e=>"checkout.amounts"===e.path);if(n){const e=this.getStoreValue("checkout"),n=Object.values(e.items||{}).length;this.updateZeroAmountElement(0===e.amounts.total&&n>0)}}updateZeroAmountElement(e){const n=this.container.querySelector(".checkout-zero-amount-container");if(e&&!n){const e=document.createElement("div");e.classList.add("checkout-zero-amount-container"),e.textContent="Credit card required to complete order (even when fully covered by gift card)";const n=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");n&&n.after(e)}else!e&&n&&n.remove()}afterRender(){const e=this.getStoreValue("checkout.amounts");e&&this.updateZeroAmountElement(0===e.total)}marketingOptInsContainer(){const e=this.config.layout.emailOptIn,n=this.config.layout.smsOptIn;if(!e.show&&!n.show)return null;const i=document.createElement("div");if(i.classList.add("checkout-marketing-opt-ins-container"),e.show){const n=document.createElement("div");let o;n.classList.add("checkout-checkbox-container"),o=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canEmail");const r=document.createElement("span");r.id="emailOptIn",r.classList.add("checkout-checkbox-visual"),o&&r.classList.add("checked"),r.innerHTML=CheckboxIcon({width:16,height:16}),r.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canEmail"),r.classList.toggle("checked")});const a=document.createElement("label");a.setAttribute("for","emailOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(e.text),a.addEventListener("click",e=>{const n=e.target,i="A"===n.tagName||n.closest("a");i||(this.commands.checkout.toggleMarketingPreferences("canEmail"),r.classList.toggle("checked"))}),n.appendChild(r),n.appendChild(a),i.appendChild(n)}if(n.show){const e=document.createElement("div");let o;e.classList.add("checkout-checkbox-container"),o=this.clientConfig.isBuilder()?n.checked:this.store.get("checkout.marketingPreferences.canSms");const r=document.createElement("span");r.classList.add("checkout-checkbox-visual"),r.id="smsOptIn",o&&r.classList.add("checked"),r.innerHTML=CheckboxIcon({width:16,height:16}),r.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canSms"),r.classList.toggle("checked")});const a=document.createElement("label");a.setAttribute("for","smsOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(n.text),a.addEventListener("click",e=>{const n=e.target,i="A"===n.tagName||n.closest("a");i||(this.commands.checkout.toggleMarketingPreferences("canSms"),r.classList.toggle("checked"))}),e.appendChild(r),e.appendChild(a),i.appendChild(e)}return i}hasOnDemandOrder(){const e=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(e).length>0}template(){var e;const n=[],i=this.getConfigs("global"),o=this.getConfigs("checkout"),a=this.getConfigs("global"),c=o.layout.allowGiftCards,l=null===(e=null==a?void 0:a.layout)||void 0===e?void 0:e.allowPromoCodes,d=document.createElement("div");d.classList.add("section-title-container");const u=document.createElement("h3");u.textContent="Order Summary",u.classList.add("section-title"),d.appendChild(u),n.push(d);const h=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEMS});n.push(h);const p=document.createElement("div");p.classList.add("checkout-separator");const m=document.createElement("div");if(m.classList.add("checkout-separator"),n.push(p),c||l){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_PC_GC});n.push(e)}if(this.hasOnDemandOrder()){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_TIPS});n.push(e),n.push(m)}const f=document.createElement("div");f.classList.add("section-title-container");const g=document.createElement("h3");g.textContent="100% Secure Payments",g.classList.add("disclaimer-header"),f.appendChild(g);const v=document.createElement("p");v.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.",v.classList.add("disclaimer-description"),f.appendChild(v),n.push(f);const y=ComponentFactoryService.createElement({type:r.CHECKOUT_AMOUNTS});n.push(y);const b=ComponentFactoryService.createElement({type:r.CHECKOUT_PLACE_ORDER_BUTTON});n.push(b);const x=this.marketingOptInsContainer();if(x&&n.push(x),o.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const i=document.createElement("div");i.classList.add("checkout-legal-message"),i.innerHTML=sanitizeHTML(o.layout.legalMessage.text);const r=document.createElement("div");r.classList.add("checkout-separator"),n.push(e),n.push(i),n.push(r)}if(i.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});n.push(e)}return n}}class CheckoutBillingFormComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.billingSameAsShipping"]})}async handleFirstNameChange(e){this.commands.checkout.updateBillingInfo(J.firstName,e),this.pubSub.publishForm(o.BILLING,{fieldName:J.firstName})}async handleLastNameChange(e){this.commands.checkout.updateBillingInfo(J.lastName,e),this.pubSub.publishForm(o.BILLING,{fieldName:J.lastName})}async handleEmailChange(e){this.commands.checkout.updateBillingInfo(J.email,e),this.pubSub.publishForm(o.BILLING,{fieldName:J.email})}async handlePhoneChange(e){this.commands.checkout.updateBillingInfo(J.phone,e),this.pubSub.publishForm(o.BILLING,{fieldName:J.phone})}async handleCompanyChange(e){this.commands.checkout.updateBillingInfo(J.company,e),this.pubSub.publishForm(o.BILLING,{fieldName:J.company})}async handleAddressOneChange(e){this.commands.checkout.updateBillingInfo(J.addressOne,e),this.pubSub.publishForm(o.BILLING,{fieldName:J.addressOne})}async handleAddressTwoChange(e){this.commands.checkout.updateBillingInfo(J.addressTwo,e),this.pubSub.publishForm(o.BILLING,{fieldName:J.addressTwo})}async handleCityChange(e){this.commands.checkout.updateBillingInfo(J.city,e),this.pubSub.publishForm(o.BILLING,{fieldName:J.city})}async handleStateChange(e){this.commands.checkout.updateBillingInfo(J.state,e),this.pubSub.publishForm(o.BILLING,{fieldName:J.state})}async handleZipCodeChange(e){this.commands.checkout.updateBillingInfo(J.zipCode,e),this.pubSub.publishForm(o.BILLING,{fieldName:J.zipCode})}billingSameAsShippingToggle(){const e=this.getStoreValue("checkout.billingSameAsShipping"),n=document.createElement("div");n.classList.add("checkout-billing-same-as-shipping-toggle-container");const i=document.createElement("div");i.classList.add("checkout-checkbox-container");const o=document.createElement("span");o.id="billingSameAsShipping",o.classList.add("checkout-checkbox-visual"),e&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),n.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()});const r=document.createElement("label");return r.textContent="Billing address same as shipping address",r.setAttribute("for","billingSameAsShipping"),r.classList.add("billing-checkbox-label"),i.appendChild(o),i.appendChild(r),n.appendChild(i),n}template(){const e=this.getStoreValue("checkout.billingSameAsShipping"),n=[],i=this.billingSameAsShippingToggle();if(n.push(i),e)return n;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),n.push(o);const l=document.createElement("div");l.classList.add("section-form-container");const d=document.createElement("div");d.classList.add("checkout-two-col-container");const u=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:J.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleFirstNameChange.bind(this),storePath:"billing.firstName"});d.appendChild(u);const h=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:J.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleLastNameChange.bind(this),storePath:"billing.lastName"});d.appendChild(h),l.appendChild(d);const p=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:J.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:this.handleEmailChange.bind(this),storePath:"billing.email"});l.appendChild(p);const m=document.createElement("div");m.classList.add("checkout-two-col-container");const f=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:J.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:this.handlePhoneChange.bind(this),storePath:"billing.phone"});m.appendChild(f);const g=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:J.company,label:"Company (optional)",autocomplete:!![],onChange:this.handleCompanyChange.bind(this)});m.appendChild(g),l.appendChild(m);const v=document.createElement("div");v.classList.add("checkout-two-col-container");const y=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:J.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:this.handleAddressOneChange.bind(this),storePath:"billing.addressOne"});v.appendChild(y);const b=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:J.addressTwo,label:"Apt, suite, etc. (optional)",onChange:this.handleAddressTwoChange.bind(this)});v.appendChild(b),l.appendChild(v);const x=document.createElement("div");x.classList.add("checkout-three-col-container");const w=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:J.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:this.handleCityChange.bind(this),storePath:"billing.city"});x.appendChild(w);const C=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:J.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:e=>e&&2===e.length&&/^[A-Z]{2}$/.test(e)?null:"State must be 2 uppercase characters"},onChange:this.handleStateChange.bind(this),storePath:"billing.state"});x.appendChild(C);const S=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:J.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:this.handleZipCodeChange.bind(this),storePath:"billing.zipCode"});return x.appendChild(S),l.appendChild(x),n.push(l),n}}class CheckoutBuyerInformationComponent extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}async handleFirstNameChange(e){this.commands.checkout.updateCustomerInfo(Z.firstName,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.firstName})}async handleLastNameChange(e){this.commands.checkout.updateCustomerInfo(Z.lastName,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.lastName})}async handleEmailChange(e){this.commands.checkout.updateCustomerInfo(Z.email,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.email})}async handlePhoneChange(e){this.commands.checkout.updateCustomerInfo(Z.phone,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.phone})}async handleCompanyChange(e){this.commands.checkout.updateCustomerInfo(Z.company,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.company})}async handleDobChange(e){this.commands.checkout.updateCustomerInfo(Z.birthDate,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.birthDate})}template(){const e=this.store.get("checkout.customer"),n=[],i=document.createElement("div");i.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Buyer Information",o.classList.add("section-title"),i.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"),i.appendChild(a),n.push(i);const c=document.createElement("div");c.classList.add("section-form-container");const l=document.createElement("div");l.classList.add("checkout-two-col-container");const d=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:Z.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:e.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:"customer.firstName"});l.appendChild(d);const u=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:Z.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:e.lastName,onChange:this.handleLastNameChange.bind(this),storePath:"customer.lastName"});l.appendChild(u),c.appendChild(l);const h=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:Z.company,label:"Company (optional)",autocomplete:!![],value:e.company,onChange:this.handleCompanyChange.bind(this)});c.appendChild(h);const p=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:Z.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:e.email,onChange:this.handleEmailChange.bind(this),storePath:"customer.email"});c.appendChild(p);const m=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:Z.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:e.phone,onChange:this.handlePhoneChange.bind(this),storePath:"customer.phone"});c.appendChild(m);const f=ComponentFactoryService.createElement({type:r.BIRTHDATE_INPUT,inputType:"date",name:Z.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:e.birthDate,onChange:this.handleDobChange.bind(this),storePath:"customer.birthDate"});return c.appendChild(f),n.push(c),n}}class CheckoutDeliveryInformationComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift","address.formattedAddress","checkout.onDemandFulfillmentTipInfo"]})}hasOnDemandFulfillments(){const e=this.store.get("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(e).length>0}async handleDeliveryInstructionsChange(e){await this.commands.checkout.updateDeliveryInstructions(e)}async handleFirstNameChange(e){const n=this.getStoreValue("checkout.isGift");n?(this.commands.checkout.updateGiftInfo($.firstName,e),this.pubSub.publishForm(o.GIFT,{fieldName:$.firstName})):(this.commands.checkout.updateCustomerInfo(Z.firstName,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.firstName}))}async handleLastNameChange(e){const n=this.getStoreValue("checkout.isGift")||![];n?(this.commands.checkout.updateGiftInfo($.lastName,e),this.pubSub.publishForm(o.GIFT,{fieldName:$.lastName})):(this.commands.checkout.updateCustomerInfo(Z.lastName,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.lastName}))}async handleEmailChange(e){const n=this.getStoreValue("checkout.isGift")||![];n?(this.commands.checkout.updateGiftInfo($.email,e),this.pubSub.publishForm(o.GIFT,{fieldName:$.email})):(this.commands.checkout.updateCustomerInfo(Z.email,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.email}))}async handlePhoneChange(e){const n=this.getStoreValue("checkout.isGift")||![];n?(this.commands.checkout.updateGiftInfo($.phone,e),this.pubSub.publishForm(o.GIFT,{fieldName:$.phone})):(this.commands.checkout.updateCustomerInfo(Z.phone,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.phone}))}async handleAddressTwoChange(e){const n=this.getStoreValue("checkout.isGift")||![];n?(this.commands.checkout.updateGiftInfo($.addressTwo,e),this.pubSub.publishForm(o.GIFT,{fieldName:$.addressTwo})):(this.commands.checkout.updateCustomerInfo(Z.addressTwo,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.addressTwo}))}async handleCompanyChange(e){this.commands.checkout.updateCustomerInfo(Z.company,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.company})}async handleBirthdateChange(e){this.commands.checkout.updateCustomerInfo(Z.birthDate,e),this.pubSub.publishForm(o.CUSTOMER,{fieldName:Z.birthDate})}async handleGiftMessageChange(e){this.commands.checkout.updateGiftInfo($.message,e),this.pubSub.publishForm(o.GIFT,{fieldName:$.message})}template(){const e=this.getConfigs("global"),n=this.getStoreValue("checkout.isGift")||![],i=this.store.get("checkout.giftRecipient"),o=this.store.get("checkout.customer"),a=this.store.get("address.formattedAddress"),c=n?i:o,l=[],d=document.createElement("div");d.classList.add("delivery-header-container");const u=document.createElement("div");u.classList.add("delivery-header-content");const h=document.createElement("div");h.classList.add("delivery-title-container");const p=document.createElement("h3");p.textContent="Deliver to",p.classList.add("delivery-title");const m=document.createElement("p");m.textContent="Package recipient must be 21+",m.classList.add("delivery-subtitle"),h.appendChild(p),h.appendChild(m);const f=document.createElement("div");f.classList.add("gift-toggle-container");const g=document.createElement("div");g.classList.add("gift-label-wrapper");const v=document.createElement("span");v.textContent="Send as Gift? (Free)",v.classList.add("gift-toggle-label"),g.appendChild(v);const y=document.createElement("span");y.textContent="With personalized note & gift receipt.",y.classList.add("gift-toggle-description"),g.appendChild(y);const b=document.createElement("div");b.classList.add("toggle-switch"),b.classList.toggle("active",n);const x=document.createElement("div");x.classList.add("toggle-slider"),b.appendChild(x),f.appendChild(g),f.appendChild(b),b.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),d.appendChild(f),d.appendChild(h),l.push(d);const w=document.createElement("div");w.classList.add("section-form-container");const C=document.createElement("div");C.classList.add("checkout-two-col-container");const S=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:n?$.firstName:Z.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:c.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:n?"giftRecipient.firstName":"customer.firstName"});C.appendChild(S);const I=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:n?$.lastName:Z.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:c.lastName,onChange:this.handleLastNameChange.bind(this),storePath:n?"giftRecipient.lastName":"customer.lastName"});if(C.appendChild(I),w.appendChild(C),!n){const e=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:Z.company,label:"Company (optional)",autocomplete:!![],value:c.company,onChange:this.handleCompanyChange.bind(this),storePath:"customer.company"});w.appendChild(e)}const P=ComponentFactoryService.createElement({type:r.INPUT,inputType:"email",name:n?$.email:Z.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:c.email,onChange:this.handleEmailChange.bind(this),storePath:n?"giftRecipient.email":"customer.email"});w.appendChild(P);const D=ComponentFactoryService.createElement({type:r.INPUT,inputType:"tel",name:n?$.phone:Z.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:c.phone,onChange:this.handlePhoneChange.bind(this),storePath:n?"giftRecipient.phone":"customer.phone"});if(w.appendChild(D),!n){const e=ComponentFactoryService.createElement({type:r.BIRTHDATE_INPUT,inputType:"date",name:Z.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:formatISODateToMMDDYYYY(c.birthDate),onChange:this.handleBirthdateChange.bind(this),storePath:"customer.birthDate"});w.appendChild(e)}const F=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:a,disabled:!![],className:"disabled-input",validation:{required:!![]}});w.appendChild(F);const _=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:n?$.addressTwo:Z.addressTwo,label:"Apt, suite, etc. (optional)",value:c.addressTwo,onChange:this.handleAddressTwoChange.bind(this),storePath:n?"giftRecipient.addressTwo":"customer.addressTwo"});if(w.appendChild(_),this.hasOnDemandFulfillments()){const n=document.createElement("div");n.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Delivery Instructions",i.setAttribute("for","delivery_instructions");const o=document.createElement("textarea");o.id="delivery_instructions",o.name="delivery_instructions",o.rows=4,o.value=this.store.get("checkout.deliveryInstructions")||"",o.addEventListener("blur",async e=>{await this.handleDeliveryInstructionsChange(e.target.value)});const r=document.createElement("p");r.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",r.classList.add("textarea-message-disclaimer"),n.appendChild(i),n.appendChild(o),n.appendChild(r),w.appendChild(n)}if(n){const n=document.createElement("div");n.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const o=document.createElement("label");o.textContent="Gift Message*",o.setAttribute("for",$.message);const r=document.createElement("textarea");r.name=$.message,r.id=$.message,r.rows=4,r.value=i.message||"",r.addEventListener("input",async e=>{await this.handleGiftMessageChange(e.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"),n.appendChild(o),n.appendChild(r),n.appendChild(a),w.appendChild(n)}return l.push(w),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 e=this,n=null;for(;e&&e!==document.body;){const i=e.hasAttribute("checkout"),o=e.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(r.LCE_ELEMENT),a=e.hasAttribute("drawer"),c=(null==n?void 0:n.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(r.DRAWER),l="checkout"===(null==n?void 0:n.getAttribute("data-target"));if(i||o&&a&&c&&l)return this.rootComponent=e,e;n=e,e=e.parentElement||e.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){await this.commands.checkout.getPaymentSession();const e=this.store.get("checkout.payment"),n=this.getConfigs("global");return{publishableKey:e.key,clientSecret:e.secret,appearance:{theme:"stripe",variables:{fontFamily:n.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:n.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===n.layout.inputFieldStyle?"none":"1px solid "+n.theme.accentColor,backgroundColor:"filled"===n.layout.inputFieldStyle?n.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var e;if(this.isCreatingStripeForm)return this.logger.debug("Stripe form creation already in progress, skipping"),void 0;const n=this.findRootComponent();if(!n)return;if(null===(e=this.stripeFormElement)||void 0===e?void 0:e.isConnected)return this.logger.debug("Stripe form already exists and is connected, skipping creation"),void 0;const i=n.querySelectorAll('[slot="'+Q+'"]');if(i.length>0)for(const r of i)r.remove();this.isCreatingStripeForm=!![];try{const e=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:r.CHECKOUT_STRIPE_FORM,stripeConfig:e}),this.stripeFormElement.setAttribute("slot",Q),n.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 e=>{await this.commands.checkout.updateStripeFormStatus(e.detail.status),e.detail.status.hasError&&this.logger.error("Stripe form status update failed",e.detail)}),this.stripeFormElement.addEventListener("lce:s:confirmPaymentSession",async e=>{try{const{confirmationTokenId:n,setupIntentId:i}=e.detail;await this.commands.checkout.confirmPaymentSession(n,i)}catch(n){this.logger.error("Failed to confirm payment session",n),this.store.set("checkout.payment.sendSubmitSignal",![])}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var e;try{const n=await this.doStripeConfig(),i=new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:n}});null===(e=this.stripeFormElement)||void 0===e?void 0:e.dispatchEvent(i)}catch(n){this.logger.error("Failed to refresh payment session",n)}})}onStoreChanged(e){const n=e.some(e=>"checkout.payment.sendSubmitSignal"===e.path&&e.value===!![]);if(n&&this.stripeFormElement){const e=new CustomEvent("lce:s:submit");this.stripeFormElement.dispatchEvent(e)}return![]}disconnected(){var e;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],null===(e=super.disconnected)||void 0===e||e.call(this)}template(){const e=[],n=document.createElement("div");n.classList.add("section-title-container");const i=document.createElement("h3");i.textContent="Payment",i.classList.add("section-title"),n.appendChild(i);const o=document.createElement("p");o.textContent="All transactions are secure and encrypted.",o.classList.add("section-subtitle"),n.appendChild(o),e.push(n);const r=document.createElement("slot");return r.setAttribute("name",Q),e.push(r),e}}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:e}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.B=e.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 e=this.B;this._=window.Stripe(e.publishableKey),this.O=this._.elements({clientSecret:e.clientSecret,appearance:e.appearance}),this.N=this.O.create("payment",e.elementOptions),this.N.mount(this),this.N.on("change",async e=>{const n=!!e.error,i=e.complete,o=n?e.error.message:null;this.L=i,await this.updateStripeFormStatus({isComplete:i,hasError:n,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(e){throw await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to initialize payment form"}),e}}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(e){const{stripeConfig:n}=e.detail;n&&(this.B=n,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 e=await this.createConfirmationTokenId(),n=this.B.clientSecret,i=n.split("_secret_")[0],o=new CustomEvent("lce:s:confirmPaymentSession",{detail:{confirmationTokenId:e,setupIntentId:i}});this.dispatchEvent(o),this.R=!![],await this.updateStripeFormStatus({isComplete:!![],isProcessing:![],hasError:![],errorMessage:null})}catch(e){this.R||(this.R=!![]),await this.updateStripeFormStatus({isComplete:this.L,isProcessing:![],hasError:!![],errorMessage:(null==e?void 0:e.message)||"An unexpected error with payment occurred"})}finally{this.M=![]}}}async requestSessionRefresh(){const e=new CustomEvent("lce:s:requestSessionRefresh");return this.dispatchEvent(e),new Promise((e,n)=>{const i=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",t),n(new Error("Session refresh timeout"))},5e3),t=()=>{clearTimeout(i),this.removeEventListener("lce:s:refreshSession",t),e()};this.addEventListener("lce:s:refreshSession",t,{once:!![]})})}async refreshPaymentSession(){try{this.O&&this.O.update({clientSecret:this.B.clientSecret}),this.R=![]}catch(R){await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to refresh payment session"})}}async updateStripeFormStatus(e){const n=new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:e}});this.dispatchEvent(n)}async createConfirmationTokenId(){if(!this.O)throw new Error("Elements must be provided");try{const{error:e}=await this.O.submit();if(e)throw new Error(e.message);const n={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:i,confirmationToken:o}=await this._.createConfirmationToken(n);if(i)throw new Error(i.message);if(!o||!o.id)throw new Error("Confirmation token not found");return o.id}catch(e){throw new Error(e.message)}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(e=>{console.error("Error during Stripe form disconnection cleanup:",e)})}async cleanupForm(){var e,n;try{this.N&&(this.N.unmount(),this.N=null),this.O&&(null===(n=(e=this.O).destroy)||void 0===n?void 0:n.call(e),this.O=null),this._=null,this.M=![],this.L=![],this.R=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}catch(i){console.warn("Error during Stripe form cleanup:",i)}}loadStripeJS(){return new Promise((e,n)=>{const i=document.createElement("script");i.src="https://js.stripe.com/basil/stripe.js",i.onload=()=>e(),i.onerror=()=>n(new Error("Failed to load Stripe.js")),document.head.appendChild(i)})}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var e,n,i;const o=this.getStoreValue("checkout"),r=Boolean(o.promoCode),a=Boolean(null===(e=o.giftCards)||void 0===e?void 0:e.length),c=this.getConfigs("global"),l=Object.keys(o.onDemandFulfillmentTipInfo||{}).length>0,d=Object.values(o.items||{}),u=[],h=document.createElement("div");h.classList.add("checkout-amount-line");const p=document.createElement("span");p.textContent="Subtotal ("+d.length+" item"+(d.length>1?"s":"")+")",h.appendChild(p);const m=document.createElement("span");m.textContent=formatCentToDollarText(o.amounts.subtotal),h.appendChild(m),u.push(h);const f=document.createElement("div");f.classList.add("checkout-amount-line");const g=document.createElement("span");g.textContent="Shipping",f.appendChild(g);const v=document.createElement("span");v.textContent=formatCentToDollarText(o.amounts.shipping),f.appendChild(v),u.push(f);const y=document.createElement("div");y.classList.add("checkout-amount-line");const b=document.createElement("span");b.textContent="Delivery",y.appendChild(b);const x=document.createElement("span");if(x.textContent=formatCentToDollarText(o.amounts.delivery),y.appendChild(x),u.push(y),(null===(n=null==o?void 0:o.amounts)||void 0===n?void 0:n.engraving)>0){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Engraving",e.appendChild(n);const i=document.createElement("span");i.textContent=formatCentToDollarText(o.amounts.engraving),e.appendChild(i),u.push(e)}const w=document.createElement("div");w.classList.add("checkout-amount-line");const C=document.createElement("span");C.textContent="Taxes & Fees",w.appendChild(C);const S=document.createElement("span");if(S.textContent=formatCentToDollarText(o.amounts.tax+o.amounts.service+o.amounts.platform),w.appendChild(S),u.push(w),r){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Promo Code ("+(null===(i=o.promoCode)||void 0===i?void 0:i.code)+")",e.appendChild(n);const r=document.createElement("span");r.textContent="-"+formatCentToDollarText(o.amounts.discounts),e.appendChild(r),u.push(e)}if(a){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Gift Cards Applied",e.appendChild(n);const i=document.createElement("span");i.textContent="-"+formatCentToDollarText(o.amounts.giftCards),e.appendChild(i),u.push(e)}if(l){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Tips",e.appendChild(n);const i=document.createElement("span");i.textContent=formatCentToDollarText(o.amounts.tip),e.appendChild(i),u.push(e)}const I=document.createElement("div");I.classList.add("checkout-separator"),u.push(I);const P=document.createElement("div");P.classList.add("checkout-amount-total");const D=document.createElement("span");D.textContent="Total",P.appendChild(D);const F=document.createElement("span");F.textContent=formatCentToDollarText(o.amounts.total),P.appendChild(F),u.push(P);const _=this.store.get("checkout.isPresaleLocked");if(_){const e=document.createElement("div");e.classList.add("checkout-amount-due");const n=document.createElement("span");n.textContent="Amount due today",e.appendChild(n);const i=document.createElement("span");i.textContent=formatCentToDollarText(0),e.appendChild(i),u.push(e);const o=document.createElement("div");o.classList.add("checkout-presale-locked-message");const r=htmlStringToElement(InfoIcon({color:c.theme.defaultTextColor}));o.appendChild(r);const a=document.createElement("p");a.textContent="Pre-ordered items will be charged when shipped.",o.appendChild(a),u.push(o)}return u}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){const e=[],n=this.getConfigs("configurations"),i=this.getConfigs("global"),o=this.getConfigs("checkout"),a=this.config.layout.exitUrl||window.location.host,c=this.config.layout.thankYouButtonText||"Continue Shopping";if(this.config.theme.checkoutCompleted.customLogo){const i=document.createElement("div");i.classList.add("checkout-completed-header-container");const o=document.createElement("img");o.src=this.config.theme.checkoutCompleted.customLogo,o.alt=n.partnerName+" Logo",i.appendChild(o),e.push(i)}const l=document.createElement("div");l.classList.add("checkout-completed-section-container");const d=document.createElement("div");d.classList.add("checkout-completed-title-container");const u=document.createElement("div");u.classList.add("checkout-completed-title-section");const h=document.createElement("h3");h.innerHTML=this.config.theme.checkoutCompleted.customText||"Thank You for Your Order!",u.appendChild(h);const p=document.createElement("p");p.textContent="Your payment has been successfully processed.",u.appendChild(p),d.appendChild(u),l.appendChild(d);const m=document.createElement("div");m.classList.add("checkout-completed-sub-section");const f=document.createElement("div");f.classList.add("checkout-completed-line");const g=document.createElement("h3");g.textContent="Order Number",f.appendChild(g);const v=document.createElement("span");v.textContent=this.params.orderNumber,f.appendChild(v),m.appendChild(f);const y=document.createElement("div");y.classList.add("checkout-completed-line");const b=document.createElement("h3");b.textContent="Order Amount",y.appendChild(b);const x=document.createElement("span");x.textContent=""+formatCentToDollarText(this.params.orderTotal),y.appendChild(x),m.appendChild(y);const w=document.createElement("div");w.classList.add("checkout-completed-line");const C=document.createElement("h3");C.textContent="Payment Method",w.appendChild(C);const S=document.createElement("span");S.textContent="** "+this.params.cardLast4,w.appendChild(S),m.appendChild(w),l.appendChild(m);const I=document.createElement("div");I.classList.add("checkout-completed-sub-section");const P=document.createElement("h3");P.textContent="Confirmation email sent",I.appendChild(P);const D=document.createElement("p");D.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>.",I.appendChild(D),l.appendChild(I),e.push(l);const F=document.createElement("div");F.classList.add("checkout-completed-section-container");const _=document.createElement("button");_.type="button";const z=document.createElement("span");z.textContent=c,_.appendChild(z);const O=htmlStringToElement(ArrowRightIcon({width:16,height:16}));_.appendChild(O),_.addEventListener("click",()=>{window.location.href=a}),F.appendChild(_),e.push(F);const M=document.createElement("div");M.classList.add("checkout-completed-section-container");const L=document.createElement("div");L.classList.add("checkout-completed-help-section"),M.appendChild(L);const R=document.createElement("p");R.textContent="Questions about your order? Contact us at "+n.supportEmail,L.appendChild(R);const B=document.createElement("p"),q=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(B.textContent="Order placed on "+q,L.appendChild(B),e.push(M),o.layout.legalMessage.show){const n=document.createElement("div");n.classList.add("checkout-separator");const i=document.createElement("div");i.classList.add("checkout-legal-message"),i.innerHTML=sanitizeHTML(o.layout.legalMessage.text);const r=document.createElement("div");r.classList.add("checkout-separator"),e.push(n),e.push(i),e.push(r)}if(i.layout.showPoweredBy){const n=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"general"});e.push(n)}return e}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(e){var n;const i=e.find(e=>"checkout.giftCards"===e.path),o=e.find(e=>"checkout.loading"===e.path);i&&i.value.length>((null===(n=i.oldValue)||void 0===n?void 0:n.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),o&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const e=this.giftCardInput.getValue().trim(),n=e.length>=3&&e.length<=255,i=this.getStoreValue("checkout.loading"),o=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!n||i||Boolean(o)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:e=>{const n=e.toUpperCase(),i=this.giftCardInput;i.setValue(n),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){return this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.addEventListener("click",async()=>{const e=this.giftCardInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(e)}catch(n){this.logger.error("Checkout gift card application failed",{giftCardCode:e,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const e=[];return e.push(this.createGiftCardInput()),e.push(this.createApplyButton()),e}disconnected(){this.giftCardInput=null,this.applyButton=null}}const shouldShowMinimumPurchaseAlert=(e,n=![])=>{var i,o;const r=e.subtotal;if(e.type===a.SHIPPING){const a=e.fees;if(n&&(null===(i=a.pack)||void 0===i?void 0:i.active)&&a.pack.min>0&&r<a.pack.min)return!![];if(!n&&(null===(o=a.individual)||void 0===o?void 0:o.active)&&a.individual.min>0&&r<a.individual.min)return!![]}else if(e.type===a.ON_DEMAND){const n=e.fees;if(n.min>0&&r<n.min)return!![]}return![]},getMinimumPurchaseMessage=(e,n=![])=>{var i,o;const r=e.subtotal;if(e.type===a.SHIPPING){const a=e.fees;let c=0;if(n&&(null===(i=a.pack)||void 0===i?void 0:i.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&&r<c)return{message:"+"+formatCentToDollarText(c-r)+" needed for order minimum",type:"warning"}}if(e.type===a.ON_DEMAND){const n=e.fees,i=n.min>0?n.min:0;if(i>0&&r<i)return{message:"+"+formatCentToDollarText(i-r)+" needed for order minimum",type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(e,n=![])=>{var i,o;const r=e.subtotal;if(e.type===a.SHIPPING){const a=e.fees;if(n&&(null===(i=a.pack)||void 0===i?void 0:i.active)&&a.pack.min>0&&r<a.pack.min)return!![];if(!n&&(null===(o=a.individual)||void 0===o?void 0:o.active)&&a.individual.min>0&&r<a.individual.min)return!![]}if(e.type===a.ON_DEMAND){const n=e.fees;if(n.min>0&&r<n.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const e=this.config||{};if(e.showIcon===![])return null;const n={warning:"warning",success:"success",info:"info"},i={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},o=n[this.params.messageType]||"warning",r=document.createElement("div");return r.className="alert-icon alert-icon-"+this.params.messageType,r.appendChild(htmlStringToElement(i[o]({width:16,height:16,className:"alert-icon-svg"}))),r}template(){var e;const n=[],i=this.getIconElement();i&&n.push(i);const o=document.createElement("span");if(o.className="alert-message",o.textContent=this.params.message,n.push(o),"detailed"===(null===(e=this.config)||void 0===e?void 0:e.alertType)&&this.params.currentTotal){const e=document.createElement("div");e.className="alert-details";const i=document.createElement("small");i.className="alert-details-text",i.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),e.appendChild(i),n.push(e)}return n}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(e){var n,i,o,r;const a=e.find(e=>"checkout.items"===e.path);a&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const c=e.find(e=>e.path==="checkout.items."+this.params.itemId);if(c){const e=c.oldValue,a=c.value;if(a.updating)return![];const l=(null==e?void 0:e.quantity)!==(null==a?void 0:a.quantity),d=(null===(i=null===(n=null==e?void 0:e.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[],u=(null===(r=null===(o=null==a?void 0:a.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[],h=JSON.stringify(d)!==JSON.stringify(u);(l||h)&&this.updateEngravingElement(a)}return![]}updateEngravingElement(e){var n,i;const o=this.getConfigs("global"),a=this.container.querySelector(".engraving-view-container");if(a&&a.remove(),(null===(i=null===(n=null==e?void 0:e.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.hasEngraving)===!![]&&o.layout.enablePersonalization){const n=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:e.cartItemId,context:"checkout"}),i=this.container.querySelector(".checkout-item-card-footer");i&&i.before(n)}}setupMinimumPurchaseAlert(){const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return;const n=e.fulfillmentId;if(!n)return;if(!this.container)return;const i=this.container.querySelector(".checkout-item-card-header");if(i){const o=this.getStoreValue("cart.fulfillments."+n),a=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(a&&a.remove(),shouldShowMinimumPurchaseAlert(o,e.pack)){const n=getMinimumPurchaseMessage(o,e.pack),a=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:n.message,messageType:n.type,currentTotal:o.subtotal,config:{showIcon:!![],alertType:"minimal"}});a.setAttribute("data-component-type","checkout-retailer-alert"),i.before(a)}}}updateTrashButtonState(){if(!this.trashButton)return;const e=this.getStoreValue("checkout"),n=Object.keys(e.items).length,i=1===n;this.trashButton.disabled=i,i?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const e=document.createElement("div");e.className="cart-loading-backdrop",e.setAttribute("data-loading-id","item-loading-overlay");const n=document.createElement("div");n.className="cart-loading-spinner-container";const i=document.createElement("div");return i.className="cart-loading-spinner",i.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(i),e.appendChild(n),e}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const e=this.createLoadingOverlay();this.container.appendChild(e),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const e=this.container.querySelector('[data-loading-id="item-loading-overlay"]');e&&(e.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const e=this.getStoreValue("checkout.items."+this.params.itemId);return e?e.updating===!![]:![]}checkAndUpdateLoadingState(){const e=this.isItemUpdating(),n=this.hasLoadingOverlay();e&&!n?this.showLoadingOverlay():!e&&n&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var e,n,i;const o=this.getConfigs("global"),a=this.getStoreValue("checkout.items."+this.params.itemId),c=null===(e=null==a?void 0:a.attributes)||void 0===e?void 0:e.presale,l=(null==c?void 0:c.isActive)&&(null==c?void 0:c.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(c.estimatedShipBy):"";if(!a)return[];const d=document.createElement("div");d.classList.add("checkout-item-card-header");const u=document.createElement("img");u.classList.add("checkout-item-image"),u.src=a.mainImage,u.alt=a.name,u.loading="lazy",d.appendChild(u);const h=document.createElement("div");h.classList.add("checkout-item-details-container");const p=document.createElement("h4");p.classList.add("checkout-item-title"),p.textContent=a.name,h.appendChild(p);const m=document.createElement("div");m.classList.add("checkout-item-subtitle");const f=document.createElement("span");f.textContent=c.isActive?""+l:((null==a?void 0:a.expectationDetail)||"")+",",m.appendChild(f);const g=document.createElement("span");g.textContent="From "+((null==a?void 0:a.retailerName)||""),m.appendChild(g),h.appendChild(m),d.appendChild(h),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async e=>{var n;if(e.preventDefault(),e.stopPropagation(),!(null===(n=this.trashButton)||void 0===n?void 0:n.disabled))try{await this.commands.checkout.removeItem(a.cartItemId)}catch(i){this.logger.error("Checkout item removal failed",i)}}),d.appendChild(this.trashButton);const v=ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM_QUANTITY,itemId:a.cartItemId}),y=[];if(y.push(d),o.layout.enablePersonalization&&(null===(i=null===(n=null==a?void 0:a.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.hasEngraving)===!![]){const e=ComponentFactoryService.createElement({type:r.ENGRAVING_VIEW,identifier:a.cartItemId,context:"checkout"});y.push(e)}return y.push(v),y}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(e){const n=e.find(e=>"checkout.items"===e.path);if(n){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getAvailableQuantity(){var e,n,i;const o=this.getStoreValue("checkout.items."+this.params.itemId);if(!o)return 0;const r=this.getStoreValue("products");if(!r)return 0;const a=o.partNumber,c=o.fulfillmentId,l=null===(i=null===(n=null===(e=Object.values(r).find(e=>e.sizes[o.liquidId]))||void 0===e?void 0:e.sizes)||void 0===n?void 0:n[o.liquidId])||void 0===i?void 0:i.attributes.maxQuantityPerOrder;if(!l)return 0;const d=this.getStoreValue("checkout.items")||{},u=Object.values(d).filter(e=>e.partNumber===a&&e.fulfillmentId===c),h=u.reduce((e,n)=>e+n.quantity,0);return l-h}calculateQuantityLimits(){var e;const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const i=this.getStoreValue("checkout"),o=1===(null===(e=Object.values(i.items))||void 0===e?void 0:e.length),r=n.quantity,a=this.getAvailableQuantity(),c=a>0,l=!(o&&1===r);return{currentQuantity:r,availableQuantity:a,isTheOnlyItem:o,canIncrease:c,canDecrease:l}}updateButtonStates(e){this.decreaseButton&&(this.decreaseButton.disabled=!e.canDecrease,this.decreaseButton.classList.toggle("disabled",!e.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!e.canIncrease,this.increaseButton.classList.toggle("disabled",!e.canIncrease),e.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=e.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+e.currentQuantity))}async handleQuantityChange(e){const n=this.calculateQuantityLimits(),i=this.params.itemId;if((!(e<0)||n.canDecrease)&&(!(e>0)||n.canIncrease)){if(!i)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:e}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(i,e)}catch(o){this.logger.error("Checkout item quantity change operation failed",o)}}}template(){const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const n=this.calculateQuantityLimits(),i=document.createElement("div");i.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(-1)}),i.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),i.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(1)}),i.appendChild(this.increaseButton),this.updateButtonStates(n);const o=document.createElement("span");if(o.classList.add("checkout-item-price-text"),o.textContent=formatCentToDollarText(e.price),e.quantity>1){const n=document.createElement("span");n.classList.add("checkout-item-price-each-text"),n.textContent=" ("+formatCentToDollarText(e.unitPrice)+" ea)",o.appendChild(n)}return[i,o]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(e){return ComponentFactoryService.createElement({type:r.CHECKOUT_ITEM,itemId:e})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const e=this.getStoreValue("checkout.items")||{},n=new Map;for(const i of objectValues(e))i&&i.cartItemId&&n.set(i.cartItemId,i);return n}syncItemsWithStore(){const e=this.getItemsListContainer();if(!e)return;const n=this.getCurrentItemsMap(),i=e.querySelectorAll("[data-item-id]"),o=new Set;for(const r of i){const e=r.getAttribute("data-item-id");e&&o.add(e)}for(const r of i){const e=r.getAttribute("data-item-id");e&&!n.has(e)&&r.remove()}for(const[r]of n)if(!o.has(r)){const n=this.createItemElement(r);n.setAttribute("data-item-id",r),e.appendChild(n)}this.updateItemCount()}updateItemCount(){const e=this.getTogglerLabel();if(!e)return;const n=this.getCurrentItemsMap(),i=n.size;e.textContent=i+" item"+(1!==i?"s":"")}onStoreChanged(e){let n;for(let i=0;i<e.length;i++){const o=e[i];if("checkout"===o.path||"checkout.items"===o.path||"checkout.items."===o.path.substring(0,15)){n=o;break}}return n?(this.syncItemsWithStore(),![]):![]}setupToggler(){const e=this.container.querySelector(".checkout-items-toggler"),n=this.container.querySelector(".checkout-items-toggler-button"),i=this.container.querySelector(".checkout-items-list");e&&n&&i&&e.addEventListener("click",()=>{const e=i.classList.contains("show");i.classList.toggle("show"),e?(n.classList.toggle("expanded"),n.setAttribute("aria-expanded","false"),n.setAttribute("aria-label","Expand checkout items")):(n.classList.toggle("expanded"),n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse checkout items"))})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const e=this.getStoreValue("checkout.items"),n=objectValues(e||{}),i=document.createElement("div");i.classList.add("checkout-items-toggler");const o=document.createElement("span");o.classList.add("checkout-items-toggler-label"),o.textContent=n.length+" item"+(1!==n.length?"s":""),i.appendChild(o);const r=document.createElement("button");r.type="button",r.classList.add("checkout-items-toggler-button"),r.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),i.appendChild(r);const a=document.createElement("div");a.classList.add("checkout-items-list","show");for(const c of n){const e=this.createItemElement(c.cartItemId);e.setAttribute("data-item-id",c.cartItemId),a.appendChild(e)}return[i,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(e){const n=e.some(e=>"checkout.isFormValid"===e.path||"checkout.invalidFields"===e.path||"checkout.stripeFormStatus"===e.path||"checkout.stripeFormStatus."===e.path.substring(0,26)||"checkout.readyForSubmit"===e.path||"checkout.readyForSubmit."===e.path.substring(0,23)||"checkout.loading"===e.path||"checkout.error"===e.path);n&&this.updateButtonState();const i=e.find(e=>"checkout.readyForSubmit"===e.path);return i&&this.handleCheckoutReadyForSubmit(i.value),![]}updateButtonState(){if(!this.placeOrderButton)return;const e=this.store.get("checkout.isFormValid")||![],n=this.store.get("checkout.invalidFields")||[],i=this.store.get("checkout.stripeFormStatus")||{},o=this.store.get("checkout.loading")||![],r=this.store.get("checkout.error")||null,a=i.isComplete||![],c=i.hasError||![],l=i.isProcessing||![],d=i.errorMessage||null;this.updateErrorDisplay(this.determineErrorMessage(r,d));const u=this.determineButtonState({isFormValid:e,invalidFieldsCount:n.length,isPaymentComplete:a,hasPaymentError:c,isStripeProcessing:l,isCheckoutLoading:o,hasCheckoutError:!!r});this.applyButtonState(u)}determineErrorMessage(e,n){return e&&n?n:n||e}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(e){if(!this.errorContainer)return;const n=this.errorContainer.querySelector(".error-text");n&&(this.clearErrorTimeout(),e?(n.textContent=e,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(()=>{this.errorTimeoutId=null,this.commands.checkout.removeCheckoutError();const e=this.store.get("checkout.stripeFormStatus");(null==e?void 0:e.errorMessage)&&this.commands.checkout.updateStripeFormStatus({errorMessage:null})},3e3)):(n.textContent="",this.errorContainer.style.display="none"))}determineButtonState(e){const{isFormValid:n,invalidFieldsCount:i,isPaymentComplete:o,hasPaymentError:r,isStripeProcessing:a,isCheckoutLoading:c,hasCheckoutError:l}=e,d=this.config.layout.placeOrderButtonText,u=this.config.layout.placeOrderButtonShowRequiredFields,h=n&&o&&!r&&!a&&!l,p=this.store.get("checkout.readyForSubmit.payment")||![],m=this.store.get("checkout.readyForSubmit.prepared")||![],f=this.store.get("checkout.payment.sendSubmitSignal")||![],g=this.store.get("checkout.isPresaleLocked")||![];let v=![];if(!g){const e=this.getStoreValue("cart.fulfillments")||{};v=Object.values(e).some(e=>hasUnmetMinimum(e))}const y=a||c||f;if(c&&!a&&!f)return{state:"processing",text:d,disabled:!![]};if(v)return{state:"disabled",text:d,disabled:!![]};if(y)return p&&m?{state:"processing",text:"Placing Order...",disabled:!![]}:p&&!m?{state:"processing",text:"Preparing Order...",disabled:!![]}:m&&!p&&(a||f)||f||a?{state:"processing",text:"Processing Payment...",disabled:!![]}:{state:"processing",text:"Placing Order...",disabled:!![]};if(!n){const e=i>0?" ("+i+")":"";return{state:"form-invalid",text:u?"Complete Required Fields"+e:d,disabled:![]}}return o?r?{state:"payment-error",text:d,disabled:![]}:h?{state:"ready",text:d,disabled:![]}:{state:"disabled",text:d,disabled:!![]}:{state:"payment-incomplete",text:"Complete Payment Information",disabled:![]}}applyButtonState(e){if(!this.placeOrderButton)return;const n=["processing","form-invalid","payment-incomplete","payment-error","ready","disabled"];this.placeOrderButton.classList.remove(...n),this.placeOrderButton.classList.add(e.state),this.placeOrderButton.disabled=e.disabled,this.placeOrderButton.textContent=e.text}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const e=this.store.get("checkout.isFormValid")||![],n=this.store.get("checkout.stripeFormStatus")||{},i=this.store.get("checkout.loading")||![],o=n.isComplete||![],r=n.hasError||![],a=n.isProcessing||![];if(a||i)return;if(!e)return await this.commands.checkout.focusFirstInvalidField(),void 0;if(!o||r)return this.showPaymentError(),void 0;await this.commands.checkout.startPreparingCheckoutSubmit()}catch(e){this.logger.error("Error handling place order click",e)}}showPaymentError(){const e=document.querySelector(".checkout-stripe-form");e&&safeScrollIntoView(e,{behavior:"smooth",block:"center"})}async handleCheckoutReadyForSubmit(e){if(!e)return;const{payment:n,prepared:i,customer:o,gift:r,billing:a}=e,c=n&&i&&o&&a&&r;c&&await this.commands.checkout.checkoutComplete()}template(){const e=document.createElement("button");e.type="button",e.textContent=this.config.layout.placeOrderButtonText,e.classList.add("checkout-place-order-button"),e.disabled=!![],e.addEventListener("click",this.handlePlaceOrderClick.bind(this));const n=document.createElement("div");n.classList.add("checkout-payment-error-wrapper"),n.setAttribute("role","alert"),n.style.display="none";const i=document.createElement("div");i.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"),i.appendChild(o),i.appendChild(a),n.appendChild(i);const c=ComponentFactoryService.createElement({type:r.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[n,c,e]}}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 e=[],n=this.getConfigs("global"),i=document.createElement("div");i.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),i.appendChild(o);const d=document.createElement("div");d.classList.add("checkout-completed-help-section");const u=document.createElement("p");u.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.",d.appendChild(u),i.appendChild(d),e.push(i);const h=document.createElement("div");h.classList.add("checkout-completed-section-container");const p=document.createElement("button");p.setAttribute("aria-label","Continue shopping"),p.type="button";const m=document.createElement("span");m.textContent="Continue Shopping",p.appendChild(m);const f=htmlStringToElement(ArrowRightIcon({width:16,height:16}));p.appendChild(f),p.addEventListener("click",()=>this.handleExit()),h.appendChild(p),e.push(h);const g=document.createElement("div");g.classList.add("checkout-completed-section-container");const v=document.createElement("p");v.classList.add("checkout-completed-auto-close-text"),v.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 y=document.createElement("span");if(y.classList.add("checkout-completed-auto-close-text"),y.textContent="seconds",g.appendChild(v),g.appendChild(this.autoCloseElement),g.appendChild(y),e.push(g),n.layout.showPoweredBy){const n=document.createElement("div");n.classList.add("checkout-completed-powered-by-container");const i=ComponentFactoryService.createElement({type:r.POWERED_BY,context:"checkout"});n.appendChild(i),e.push(n)}return e}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(e){const n=e.find(e=>"checkout.promoCode"===e.path),i=e.find(e=>"checkout.loading"===e.path);if(n){const{value:e,oldValue:i}=n,o=Boolean(i),r=Boolean(e);if(!o&&r)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(o&&!r)return this.container.innerHTML="",this.createInputContainer(),void 0;r&&this.promoCodeText&&e.discountAmount!==(null==i?void 0:i.discountAmount)&&(this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")")}i&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const e=this.promoInput.getValue().trim(),n=e.length>=3&&e.length<=255,i=this.getStoreValue("checkout.loading"),o=this.getStoreValue("checkout.promoCode"),r=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!n||i||Boolean(o)||Boolean(r)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:r.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:e=>{const n=e.toUpperCase(),i=this.promoInput;i.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){return this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.addEventListener("click",async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(e)}catch(n){this.logger.error("Checkout promo code application failed",{promoCode:e,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}createAppliedContainer(e){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==e?void 0:e.code)+" (- "+formatCentToDollarText((null==e?void 0:e.discountAmount)||0)+")";const i=document.createElement("button");i.type="button",i.classList.add("remove-button"),i.textContent="Remove",i.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(i),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const e=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,e){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")";const i=document.createElement("button");return i.type="button",i.classList.add("remove-button"),i.textContent="Remove",i.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(i),n}const n=[];return n.push(this.createPromoInput()),n.push(this.createApplyButton()),n}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 e=this.getStoreValue("checkout.tipSelection");return null!=e?e:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(e){const n=this.getStoreValue("checkout.updating")||![];if(!n)try{await this.commands.checkout.updateTips(e)}catch(i){this.logger.error("Checkout tips update failed",i)}}async handleFulfillmentTipInput(e,n){const i=this.getStoreValue("checkout.updating")||![];if(i)return;const o=this.getOnDemandFulfillmentTipInfo();if(!o[e])return;const r=Math.round(100*n);try{await this.commands.checkout.updateFulfillmentTip(e,r)}catch(a){this.logger.error("Checkout fulfillment tip update failed",a)}}async removeTipFromFulfillment(e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const i=this.getOnDemandFulfillmentTipInfo();if(i[e])try{await this.commands.checkout.removeFulfillmentTip(e)}catch(o){this.logger.error("Checkout fulfillment tip removal failed",o)}}createTipSelectionButtons(){const e=document.createElement("div");e.classList.add("checkout-tip-selection-container");const n=[10,18,20],i=this.getStoreValue("checkout.updating")||![],o=this.getTipSelection();for(const r of n){const n=document.createElement("button");n.type="button",n.textContent=r+"%",n.classList.add("checkout-tip-button"),n.disabled=i,o===r&&n.classList.add("selected"),n.addEventListener("click",()=>this.handlePercentageSelect(r)),e.appendChild(n)}return e}setupToggler(){const e=this.container.querySelector(".checkout-tip-distribution-header"),n=this.container.querySelector(".checkout-items-toggler-button"),i=this.container.querySelector(".retailers-tips-list");e&&n&&i&&e.addEventListener("click",()=>{const e=i.classList.contains("show");i.classList.toggle("show"),e?(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-label","Expand tips section")):(n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse tips section")),n.classList.toggle("expanded")})}createTipDistribution(){const e=document.createElement("section");e.classList.add("checkout-tip-distribution-container");const n=this.getFulfillmentTipInfoArray();if(0===n.length)return e;const i=document.createElement("div");i.classList.add("checkout-tip-distribution-header");const o=document.createElement("h3");o.textContent="View Tip Distribution",o.classList.add("checkout-sub-header"),i.appendChild(o);const r=document.createElement("button");r.type="button",r.classList.add("checkout-items-toggler-button"),r.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),i.appendChild(r),e.appendChild(i);const a=document.createElement("div");a.classList.add("retailers-tips-list","show");for(const c of n){const e=document.createElement("div");e.classList.add("checkout-tip-distribution-item");const n=document.createElement("h4");n.textContent=c.retailerName,n.classList.add("checkout-sub-header"),e.appendChild(n);const i=document.createElement("div");i.classList.add("checkout-tip-fulfillment-input-wrapper");const o=document.createElement("div");o.classList.add("dollar-input-container");const r=document.createElement("span");r.classList.add("dollar-sign"),r.textContent="$";const l=document.createElement("input");let d;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",e=>{e.preventDefault()}),l.addEventListener("keydown",e=>{"-"!==e.key&&"+"!==e.key||e.preventDefault()}),l.addEventListener("keydown",e=>{"ArrowUp"!==e.key&&"ArrowDown"!==e.key||e.preventDefault()}),l.addEventListener("paste",e=>{e.preventDefault()}),l.addEventListener("contextmenu",e=>{e.preventDefault()}),l.addEventListener("input",e=>{const n=e.target;let i=n.value;if(Number.parseFloat(i)<0&&(n.value=Math.abs(Number.parseFloat(i)).toString(),i=n.value),i.includes(".")){const e=i.split(".");e.length>1&&e[1].length>2&&(n.value=e[0]+"."+e[1].substring(0,2))}}),l.addEventListener("input",e=>{const n=e.target,i=Number.parseFloat(n.value)||0;d&&clearTimeout(d),d=setTimeout(()=>{this.handleFulfillmentTipInput(c.fulfillmentId,i)},500)}),o.appendChild(r),o.appendChild(l),i.appendChild(o);const u=document.createElement("button");u.type="button",u.textContent="Remove",u.classList.add("checkout-tip-remove-button"),u.disabled=this.getStoreValue("checkout.updating")||![],u.addEventListener("click",()=>this.removeTipFromFulfillment(c.fulfillmentId)),i.appendChild(u),e.appendChild(i),a.appendChild(e)}return e.appendChild(a),e}async initializeDefaultTip(){if(this.isInitialized)return;const e=this.getStoreValue("checkout.tipSelection"),n=this.getFulfillmentTipInfoArray();if(e&&n.length>0){const e=n.some(e=>e.tip>0);if(e)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(i){this.logger.error("Default tip initialization failed",i),this.isInitialized=![]}}if(null==e)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 e=[],n=this.getFulfillmentTipInfoArray();if(0===n.length)return e;n.length>0&&this.initializeDefaultTip();const i=document.createElement("section");i.classList.add("checkout-tip-container");const o=document.createElement("h3");o.classList.add("checkout-sub-header"),o.textContent="Add a tip",i.appendChild(o);const r=document.createElement("div");r.classList.add("checkout-tip-config-container");const a=this.createTipSelectionButtons();r.appendChild(a),i.appendChild(r);const c=document.createElement("p");c.classList.add("checkout-tip-disclaimer"),c.textContent="Tips will be split proportionally between retailers.",i.appendChild(c);const l=this.createTipDistribution();return e.push(i,l),e}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(e){var n,i;const o=e.find(e=>"checkout.giftCardError"===e.path),r=e.find(e=>"checkout.promoCodeError"===e.path),a=e.find(e=>"checkout.giftCards"===e.path);if(a&&this.updateAppliedGiftCards(a.value),o){const e=this.container.querySelector(".input-gift-card-container");if(e){const i=e.nextElementSibling;if((null===(n=null==i?void 0:i.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==i?void 0:i.remove()),o.value){const n=this.createErrorElement(o.value);e.after(n)}const r=e.querySelector(".apply-button");r&&(r.disabled=Boolean(o.value))}}if(r){const e=this.container.querySelector(".input-promo-code-container");if(e){const n=e.nextElementSibling;if((null===(i=null==n?void 0:n.classList)||void 0===i?void 0:i.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),r.value){const n=this.createErrorElement(r.value);e.after(n)}const o=e.querySelector(".apply-button");o&&(o.disabled=Boolean(r.value))}}}updateAppliedGiftCards(e){const n=e&&e.length>0;if(!n)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",e.forEach(e=>{const n=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(n)})}createAppliedGiftCardElement(e){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),n.setAttribute("data-gift-card-code",e.code);const i=document.createElement("span");i.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")",n.appendChild(i);const o=document.createElement("button");return o.type="button",o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(e.code)}),n.appendChild(o),n}pcInputContainer(){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return e}gcInputContainer(){const e=ComponentFactoryService.createElement({type:r.CHECKOUT_GIFT_CARDS});return e}inputContainer(){var e;const n=this.getConfigs("checkout"),i=this.getConfigs("global"),o=n.layout.allowGiftCards,r=null===(e=null==i?void 0:i.layout)||void 0===e?void 0:e.allowPromoCodes,a=document.createElement("div");a.classList.add("checkout-pc-gc-sub-container");const c=this.pcInputContainer(),l=this.gcInputContainer();r&&a.appendChild(c);const d=this.getStoreValue("checkout.promoCodeError");if(d){const e=this.createErrorElement(d);e.classList.add("promo-code-error-wrapper"),a.appendChild(e)}o&&a.appendChild(l);const u=this.getStoreValue("checkout.giftCardError");if(u){const e=this.createErrorElement(u);a.appendChild(e)}return a}createErrorElement(e){const n=document.createElement("div");n.classList.add("error-banner-checkout");const i=document.createElement("div");i.innerHTML=ErrorInfoIcon({});const o=document.createElement("p");return o.textContent=e.toString(),n.appendChild(i),n.appendChild(o),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),n.remove()},3e3),n}template(){const e=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const n=[];return n.push(this.inputContainer()),e&&e.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),e.forEach(e=>{const n=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(n)}),n.push(this.appliedGiftCardsContainer)),n}disconnected(){this.appliedGiftCardsContainer=null}}class 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(e){const n=this.getProductId(),i=e.find(e=>e.path==="products."+n+".drawer.isOpen"),o=e.find(e=>e.path==="products."+n+".rerender");i&&this.titleElement&&this.titleElement.classList.toggle("hide",i.value),(null==o?void 0:o.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var e;const n=this.getProductId(),i=this.getStoreValue("products."+n);if(i.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:r.PRODUCT});if(i.loading)return ComponentFactoryService.createElement({type:r.PRODUCT_LOADING});const o=i.sizes[i.selectedSizeId],a=document.createElement("div");a.classList.add("product-content-wrapper"),a.setAttribute("role","region"),a.setAttribute("aria-label",""+i.name);const c=document.createElement("div");if(c.classList.add("product-content"),c.setAttribute("role","region"),c.setAttribute("aria-label",""+i.name),this.config.layout.showTitle){const e=document.createElement("h1");e.classList.add("product-title"),e.textContent=i.name,this.titleElement=e,c.appendChild(e)}const l=ComponentFactoryService.createElement({type:r.PRODUCT_OPTIONS,productId:n});c.appendChild(l);const d=ComponentFactoryService.createElement({type:r.PRODUCT_DRAWER,productId:n});if(c.appendChild(d),a.appendChild(c),!this.config.layout.showImages||!(null===(e=i.images)||void 0===e?void 0:e.length))return a;a.classList.add("has-images");const u=ComponentFactoryService.createElement({type:r.PRODUCT_IMAGE_CAROUSEL,images:i.images,mainImage:o.image,productId:n});return a.prepend(u),u.setAttribute("aria-label","Product images"),a}async disconnected(){const e=this.getProductId();e&&await this.commands.product.removeProduct(e)}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["product-engraving"]}beforeConnected(){var e;if(this.engravingLines=this.params.lines,"product"===this.params.context){const n=this.store.get("products."+this.params.identifier);this.fulfillmentId=n.selectedFulfillmentId,this.partNumber=(null===(e=n.selectedFulfillment)||void 0===e?void 0:e.partNumber)||null}if("cart"===this.params.context){const e=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=e.fulfillmentId,this.partNumber=e.partNumber}}calculateTotalPrice(){var e,n;if("product"===this.params.context){const i=this.store.get("products."+this.params.identifier),o=i.sizes[i.selectedSizeId],r=o.shippingFulfillments[this.fulfillmentId],a=r.price,c=(null===(n=null===(e=null==o?void 0:o.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.fee)||0;return a+c}if("cart"===this.params.context){const e=this.store.get("cart.items."+this.params.identifier),n=e.unitPrice,i=e.attributes.engraving.fee||0;return n+i}return 0}productInformationSection(){const e=[];let n="",i="";if("product"===this.params.context){const o=this.store.get("products."+this.params.identifier);o.mainImage?e.push(o.mainImage):e.push(...o.images||[]),n=o.name,i=o.sizes[o.selectedSizeId].size}if("cart"===this.params.context){const o=this.store.get("cart.items."+this.params.identifier);o.mainImage&&e.push(o.mainImage),n=o.name,i=o.size}const o=document.createElement("div");if(o.className="product-info-section",e.length>0){const i=document.createElement("div");i.className="product-image-container";const r=document.createElement("img");r.src=e[0],r.alt=n,r.loading="lazy",r.className="product-image",i.appendChild(r),o.appendChild(i)}const r=document.createElement("div");r.className="product-details-container";const a=document.createElement("div");a.className="product-header";const c=document.createElement("h4");c.className="product-title",c.textContent=n,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),a.appendChild(c),a.appendChild(this.productPriceSpan),r.appendChild(a);const l=document.createElement("p");l.className="product-size-text",l.textContent=i,r.appendChild(l);const d=document.createElement("p");return d.className="personalization-fees-disclaimer",d.textContent="Personalization fees included in total, varies by retailer.",r.appendChild(d),o.appendChild(r),o}addToCartButtonText(e){if("product"!==this.params.context)return"Save";const n=this.getConfigs("product"),i=n.layout.addToCartButtonText;return n.layout.addToCartButtonShowTotalPrice?i+" - "+formatCentToDollarText(e):i}retailersSection(){var e,n,i,o;const r=this.store.get("products."+this.params.identifier),a=r.sizes[r.selectedSizeId],c=objectValues(a.shippingFulfillments).filter(e=>e.isVariantEngravable&&e.canEngrave),l=document.createElement("div");l.className="fulfillment-section";const d=document.createElement("p");if(d.className="shipping-from-text",d.innerHTML="Shipping from: <b>"+(null===(e=r.selectedFulfillment)||void 0===e?void 0:e.retailerName)+"</b>",l.appendChild(d),1===c.length)return l;const u=document.createElement("div");u.className="fulfillment-options-container",l.appendChild(u);const h=document.createElement("span");h.className="see-more-fulfillments",h.textContent="See More Delivery Options ("+c.length+")",h.addEventListener("click",()=>{u.classList.toggle("expanded"),h.textContent=u.classList.contains("expanded")?"See Less Delivery Options":"See More Delivery Options ("+c.length+")"}),l.appendChild(h);for(const p of c){const e=document.createElement("div");e.className="fulfillment-option",e.setAttribute("data-fulfillment-id",p.fulfillmentId),p.fulfillmentId===(null===(n=r.selectedFulfillment)||void 0===n?void 0:n.fulfillmentId)&&e.classList.add("selected"),e.addEventListener("click",()=>{this.fulfillmentId=p.fulfillmentId,this.partNumber=p.partNumber;const n=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(n),this.productPriceSpan.textContent=formatCentToDollarText(n);const i=u.querySelector(".fulfillment-option.selected");i&&i.classList.remove("selected"),e.classList.add("selected"),d.innerHTML="Shipping from: <b>"+p.retailerName+"</b>"});const a=p.price+((null===(o=null===(i=r.sizes[r.selectedSizeId].attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.fee)||0),c=document.createElement("div");c.className="option-row row-1",e.appendChild(c);const l=document.createElement("span");l.className="retailer-name",l.textContent=p.retailerName,c.appendChild(l);const h=document.createElement("span");h.className="fulfillment-price",h.textContent=formatCentToDollarText(a),c.appendChild(h),e.appendChild(c);const m=document.createElement("div");m.className="option-row row-2",e.appendChild(m);const f=document.createElement("span");f.className="estimated-time",f.textContent=""+p.expectation.engraving,m.appendChild(f),e.appendChild(m),u.appendChild(e)}return l}engravingLinesSection(){var e;const{lines:n,maxLines:i,location:o,maxCharsPerLine:r}=this.params,a=document.createElement("div");a.className="personalization-section";const c=document.createElement("p");if(c.className="personalization-title",c.textContent="Personalize Your Bottle",a.appendChild(c),o&&(null===(e=null==o?void 0:o.trim())||void 0===e?void 0:e.length)>0){const e=document.createElement("p");e.className="personalization-location-text",e.textContent="Your message will appear "+o.toLowerCase()+".",a.appendChild(e)}const l=Array.from({length:i},(e,i)=>{const o=i+1,a=document.createElement("div");a.className="personalization-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=r,c.value=n[i]||"",c.placeholder=o>1?"Line "+o+" (optional)":"Line "+o,c.className="personalization-input",c.autocomplete="off",c.setAttribute("aria-label",o>1?"Engraving line "+o+", optional, maximum "+r+" characters":"Engraving line "+o+", maximum "+r+" characters");const l=document.createElement("span");return l.className="personalization-char-count",l.textContent=c.value.length+"/"+r,l.setAttribute("aria-live","polite"),l.setAttribute("aria-atomic","true"),c.addEventListener("input",()=>{l.textContent=c.value.length+"/"+r,this.engravingLines[i]=c.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),a.appendChild(c),a.appendChild(l),a}),d=document.createElement("div");return d.className="personalization-inputs-container",d.append(...l),a.appendChild(d),a}actionButtonsSection(){const{identifier:e,context:n}=this.params,i=document.createElement("div");i.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 X=async()=>{"product"===n&&await this.commands.product.closeProductDrawer(e),"cart"===n&&this.commands.ui.openDrawer(r.CART)};o.addEventListener("click",X),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),X())}),i.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"===n?"Add personalized item to cart":"Update personalization and return to cart");const k=async()=>{const i=this.engravingLines.map(e=>e.trim().toUpperCase()).filter(e=>e&&e.length>0);if("product"===n&&this.fulfillmentId&&this.partNumber){const n=this.store.get("products."+e);await this.commands.product.addToCart(e,{upc:n.sizes[n.selectedSizeId].upc,fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:i,identifier:e}),await this.commands.product.closeProductDrawer(e)}"cart"===n&&(await this.commands.cart.updateItemEngraving(e,i),this.commands.ui.openDrawer(r.CART))};return this.addToCartButton.addEventListener("click",k),this.addToCartButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),k())}),i.appendChild(this.addToCartButton),i}template(){const e=[],n=this.productInformationSection();if(e.push(n),"product"===this.params.context){const n=this.retailersSection();e.push(n)}const i=this.engravingLinesSection();e.push(i);const o=this.actionButtonsSection();e.push(o);const r=document.createElement("p");return r.className="personalization-disclaimer",r.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>",e.push(r),e}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const e=this.getConfigs("global");return["engraving-view-container",e.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const e=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+e),i=(null==n?void 0:n.attributes.engraving.fee)||0,o=(null==n?void 0:n.quantity)||1;return{quantity:o,fee:i,total:i*o}}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+e),i=(null==n?void 0:n.attributes.engraving.fee)||0,o=(null==n?void 0:n.quantity)||1;return{quantity:o,fee:i,total:i*o}}return{quantity:0,fee:0,total:0}}engravingLines(){const e=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+e);return(null==n?void 0:n.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+e);return(null==n?void 0:n.attributes.engraving.lines)||[]}return[]}handleEdit(){var e,n,i,o,a,c,l,d,u,h,p,m,f,g,v,y,b,x,w,C;const S=this.params.identifier,I={identifier:S,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const r=this.getStoreValue("cart.items."+S);I.lines=(null===(n=null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],I.maxLines=(null===(o=null===(i=null==r?void 0:r.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.maxLines)||1,I.maxCharsPerLine=(null===(c=null===(a=null==r?void 0:r.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.maxCharsPerLine)||16,I.fee=(null===(d=null===(l=null==r?void 0:r.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.fee)||0,I.location=(null===(h=null===(u=null==r?void 0:r.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.location)||""}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+S);I.lines=(null===(m=null===(p=null==e?void 0:e.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.lines)||[],I.maxLines=(null===(g=null===(f=null==e?void 0:e.attributes)||void 0===f?void 0:f.engraving)||void 0===g?void 0:g.maxLines)||1,I.maxCharsPerLine=(null===(y=null===(v=null==e?void 0:e.attributes)||void 0===v?void 0:v.engraving)||void 0===y?void 0:y.maxCharsPerLine)||16,I.fee=(null===(x=null===(b=null==e?void 0:e.attributes)||void 0===b?void 0:b.engraving)||void 0===x?void 0:x.fee)||0,I.location=(null===(C=null===(w=null==e?void 0:e.attributes)||void 0===w?void 0:w.engraving)||void 0===C?void 0:C.location)||""}this.commands.ui.openDrawer(r.ENGRAVING_FORM,I)}async handleRemove(){const e=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(e,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(e)}template(){const e=this.engravingQuantityFee(),n=this.engravingLines();if(0===n.length)return"";const i=document.createElement("div");i.className="engraving-header";const o=document.createElement("h3");o.textContent="Personalization";const r=document.createElement("span");if(r.className="engraving-fee",1===e.quantity&&(r.textContent=formatCentToDollarText(e.total,![])),e.quantity>1){r.textContent=formatCentToDollarText(e.total,![]);const n=document.createElement("span");n.className="engraving-fee-each",n.textContent=" ("+formatCentToDollarText(e.fee,![])+" ea)",r.appendChild(n)}i.appendChild(o),i.appendChild(r);const a=document.createElement("div");a.className="engraving-body";const c=document.createElement("div");c.className="engraving-lines";for(const u of n){const e=document.createElement("span");e.className="engraving-line",e.textContent=u,c.appendChild(e)}const l=document.createElement("div");l.className="engraving-actions";const d=document.createElement("button");d.type="button",d.classList.add("remove-button"),d.textContent="Remove",d.setAttribute("aria-label","Remove engraving");const N=async()=>{await this.handleRemove()};if(d.addEventListener("click",N),d.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await N())}),l.appendChild(d),"checkout"!==this.params.context){const e=document.createElement("button");e.type="button",e.classList.add("edit-button"),e.textContent="Edit",e.setAttribute("aria-label","Edit engraving"),e.addEventListener("click",this.handleEdit.bind(this)),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleEdit())}),l.appendChild(e)}return a.appendChild(c),a.appendChild(l),[i,a]}}function fulfillmentAddress(e,n){if(!e)return"";if(n===a.SHIPPING){const n=[e.city,e.state].filter(Boolean);return n.join(", ")}const i=[e.one,e.two,e.city,e.state].filter(Boolean);return i.join(", ")}const gt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],vt=1440;function timeToMinutes(e){const n=e.match(/^(\d{1,2}):(\d{2})$/);if(!n)throw new Error("Invalid time format: "+e);const i=Number.parseInt(n[1],10),o=Number.parseInt(n[2],10);if(i<0||i>47||o<0||o>59)throw new Error("Invalid time values: "+e);return 60*i+o}function getCurrentTimeInTimezone(e){var n,i,o;const r=new Date,a={timeZone:e,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const e=new Intl.DateTimeFormat("en-US",a),c=e.formatToParts(r),l=(null===(n=c.find(e=>"weekday"===e.type))||void 0===n?void 0:n.value.toLowerCase())||"",d=(null===(i=c.find(e=>"hour"===e.type))||void 0===i?void 0:i.value)||"0",u=(null===(o=c.find(e=>"minute"===e.type))||void 0===o?void 0:o.value)||"0",h=60*Number.parseInt(d,10)+Number.parseInt(u,10);return{weekday:l,timeInMinutes:h}}catch(c){throw new Error("Invalid timezone: "+e)}}function format24TimeTo12(e){const n=e.match(/^(\d{1,2}):(\d{2})$/);if(!n||"object"==typeof n)return e;let i=Number.parseInt(n[1],10);const o=n[2];i>=24&&(i-=24);const r=i>=12?"PM":"AM",a=0===i?12:i>12?i-12:i;return a+":"+o+" "+r}function isWithinTimeSlot(e,n){try{const i=timeToMinutes(n.startsAt),o=timeToMinutes(n.endsAt);if(o>vt){if(e>=i||e<o-vt)return"during"}else if(o<i){if(e>=i||e<o)return"during"}else if(e>=i&&e<o)return"during";return e<i?"before":"after"}catch(i){return"after"}}function getNextOpeningTime(e,n,i=7){var o,r;const a=gt.indexOf(n);for(let l=1;l<=i;l++){const n=(a+l)%7,i=gt[n],d=e[i];if((null==d?void 0:d.active)&&d.times&&d.times.length>0)try{const e=1===l?"tomorrow":i;return"Opens "+e+" at "+format24TimeTo12(null!==(r=null===(o=null==d?void 0:d.times[0])||void 0===o?void 0:o.startsAt)&&void 0!==r?r:"")}catch(c){}}return null}function validateFulfillmentData(e){return e&&"object"==typeof e&&e.hours&&e.timezone?"string"!=typeof e.timezone?![]:!![]:![]}function getRetailerOffHours(e){var n;if(!(null==e?void 0:e.type)||(null==e?void 0:e.type)!==a.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(e))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:i,timeInMinutes:o}=getCurrentTimeInTimezone(e.timezone),r=e.hours[i];if(!(null==r?void 0:r.active)||!(null===(n=r.times)||void 0===n?void 0:n.length)){const n=getNextOpeningTime(e.hours,i);return{message:n,isOpen:![],isClosed:!![]}}for(const e of r.times){const n=isWithinTimeSlot(o,e);switch(n){case"before":return{message:"Opens at "+format24TimeTo12(e.startsAt),isOpen:![],isClosed:!![],openTime:e.startsAt,closeTime:e.endsAt};case"during":{let n=e.endsAt;const i=timeToMinutes(n);if(i>vt){const e=Math.floor(i/60)-24,o=i%60;n=e.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(n),isOpen:!![],isClosed:![],openTime:e.startsAt,closeTime:e.endsAt}}}}const a=getNextOpeningTime(e.hours,i);return{message:a,isOpen:![],isClosed:!![]}}catch(i){return{message:null,isOpen:![],isClosed:!![]}}}function renderPopupRetailerCard({fulfillment:e,selectedFulfillmentType:n,isSelected:i,fulfillmentStatus:o,selectedSizeAttributes:r}){var c,l,d,u,h;let p=0;const m=null==r?void 0:r.presale,f=(null==m?void 0:m.isActive)&&(null==m?void 0:m.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(m.estimatedShipBy):"",g=n===a.SHIPPING,v=n===a.ON_DEMAND;g&&(p=(null===(l=null===(c=null==e?void 0:e.fees)||void 0===c?void 0:c.individual)||void 0===l?void 0:l.fee)||0),v&&(p=(null===(d=null==e?void 0:e.fees)||void 0===d?void 0:d.fee)||0);const y=fulfillmentAddress(e.retailerAddress,n);let b=null;n===a.ON_DEMAND&&o.openTime&&(null==o?void 0:o.closeTime)&&(b=o.isOpen?"Closes at "+format24TimeTo12$1(null==o?void 0:o.closeTime):"Opens at "+format24TimeTo12$1(null==o?void 0:o.openTime));const x=n===a.ON_DEMAND&&o&&o.isClosed?"closed":"",w=document.createElement("div");w.className="popup-retailer-card "+(i?"selected":"")+" "+x,w.setAttribute("data-fulfillment-id",e.fulfillmentId),w.setAttribute("role","button"),w.setAttribute("tabindex","0"),w.setAttribute("aria-pressed",i?"true":"false");const C=n===a.SHIPPING?"Shipping":"Same-day delivery";w.setAttribute("aria-label",C+" from "+e.retailerName+", "+formatCentToDollarText(null!==(u=e.price)&&void 0!==u?u:0));const S=document.createElement("div");S.className="row";const I=document.createElement("span");I.className="name",I.textContent=e.retailerName,S.appendChild(I);const P=document.createElement("span");P.className="price",P.textContent=formatCentToDollarText(null!==(h=e.price)&&void 0!==h?h:0),S.appendChild(P),w.appendChild(S);const D=document.createElement("div");D.className="row";const F=document.createElement("span");F.className="expectation",F.textContent=o.isClosed?b:(null==m?void 0:m.isActive)?f:(null==e?void 0:e.expectation.detail)||"No expectation available",D.appendChild(F);const _=document.createElement("span");if(_.className="fee",_.textContent=p>0?formatCentToDollarText(p):"Free Delivery",D.appendChild(_),w.appendChild(D),v){const e=document.createElement("div");e.className="row";const n=document.createElement("span");n.className="address",n.textContent=y,e.appendChild(n),w.appendChild(e)}return w}function renderFulfillmentTabsContainer({shippingFulfillments:e,onDemandFulfillments:n,shippingSelected:i,onDemandSelected:o,onTabClick:r,enableShippingFulfillment:c,enableOnDemandFulfillment:l}){const d=n.length>0,u=document.createElement("div");if(u.className="fulfillment-tabs-container",u.setAttribute("role","tablist"),u.setAttribute("aria-label","Delivery method options"),c){const n=document.createElement("div");n.className="fulfillment-tab "+(i?"selected":""),n.setAttribute("data-fulfillment-type",a.SHIPPING),n.setAttribute("role","tab"),n.setAttribute("tabindex","0"),n.setAttribute("aria-selected",i?"true":"false"),n.setAttribute("aria-label","Shipping, "+e.length+" options"),n.addEventListener("click",r),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.click())});const o=document.createElement("span");o.className="fulfillment-tab-label "+(i?"selected":""),o.textContent="Shipping ("+e.length+")",n.appendChild(o),u.appendChild(n)}if(l){const e=document.createElement("div");e.className="fulfillment-tab "+(o?"selected":"")+" "+(d?"":"disabled"),e.setAttribute("data-fulfillment-type",a.ON_DEMAND),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",o?"true":"false"),e.setAttribute("aria-label","Same-day delivery, "+n.length+" options"),d||e.setAttribute("aria-disabled","true"),e.addEventListener("click",r),e.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.click())});const i=document.createElement("span");i.className="fulfillment-tab-label "+(o?"selected":""),i.textContent="Same-Day Delivery ("+n.length+")",e.appendChild(i),u.appendChild(e)}return u}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 e;const n=this.getProductId(),i=this.getStoreValue("products."+n);if(!i.selectedFulfillment||!i.selectedSizeId)return 0;const o=i.selectedFulfillment.partNumber,r=i.selectedFulfillment.fulfillmentId,a=null===(e=i.sizes[i.selectedSizeId].attributes)||void 0===e?void 0:e.maxQuantityPerOrder;if(!a)return 0;const c=this.getStoreValue("cart.items")||{},l=Object.values(c).filter(e=>e.partNumber===o&&e.fulfillmentId===r),d=l.reduce((e,n)=>e+n.quantity,0);return a-d}isFulfillmentClosed(){const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment)return![];const i=getRetailerOffHours(n.selectedFulfillment);return n.selectedFulfillmentType===a.ON_DEMAND&&i&&i.isClosed}isButtonLoading(){const e=this.getProductId();return this.getStoreValue("products."+e+".updating")}calculateQuantityLimits(){const{quantity:e}=this.calculateTotalPrice(),n=this.getAvailableQuantity(),i=e<n;return{currentQuantity:e,availableQuantity:n,canIncrease:i,canDecrease:e>1}}async handleAddToCart(){var e,n,i;const o=this.getProductId(),r=this.getStoreValue("products."+o);if(!r.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:o,selectedSizeId:r.selectedSizeId}),void 0;const a=this.getSizeAttributes(),c=(null===(e=null==a?void 0:a.presale)||void 0===e?void 0:e.isActive)===!![],l=this.isPresaleActive(a);c&&l?await this.commands.product.addPresaleToCart(o,{upc:r.sizes[r.selectedSizeId].upc,fulfillmentId:r.selectedFulfillment.fulfillmentId,partNumber:null===(n=r.selectedFulfillment)||void 0===n?void 0:n.partNumber,quantity:r.quantity,identifier:o}):await this.commands.product.addToCart(o,{upc:r.sizes[r.selectedSizeId].upc,fulfillmentId:r.selectedFulfillment.fulfillmentId,partNumber:null===(i=r.selectedFulfillment)||void 0===i?void 0:i.partNumber,quantity:r.quantity,identifier:o})}async handleQuantityChange(e){const n=this.getProductId();await this.commands.product.updateQuantity(n,e)}calculateTotalPrice(){const e=this.getProductId(),n=this.getStoreValue("products."+e),i=n.selectedFulfillment,o=i.price*n.quantity;return{quantity:n.quantity,totalPrice:o}}createQuantityContainer(e){const n=this.calculateQuantityLimits(),i=document.createElement("div");return i.className="quantity-container "+e,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!n.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!n.canDecrease).toString()),n.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=n.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+n.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!n.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!n.canIncrease).toString()),n.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleQuantityChange(1)}),i.appendChild(this.qtyDecreaseButton),i.appendChild(this.quantityText),i.appendChild(this.qtyIncreaseButton),i}getSizeAttributes(){const e=this.getProductId(),n=this.getStoreValue("products."+e+".selectedSizeId"),i=this.getStoreValue("products."+e+".sizes."+n);return(null==i?void 0:i.attributes)||{}}isPresaleActive(e){const n=null==e?void 0:e.presale;if(!n)return![];if(!n.isActive)return![];if(n.canPurchaseOn){const e=new Date(n.canPurchaseOn),i=new Date;if(i.getTime()<e.getTime())return![]}return!![]}createAddToCartButton(){var e;const{totalPrice:n}=this.calculateTotalPrice(),i=this.getSizeAttributes(),o=this.calculateQuantityLimits(),r=(null===(e=null==i?void 0:i.presale)||void 0===e?void 0:e.isActive)===!![],a=this.isPresaleActive(i),c=r?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(n):c;const l=r&&!a||0===o.availableQuantity||this.isFulfillmentClosed(),d=this.isButtonLoading(),u=this.config.layout.addToCartButtonShowTotalPrice?c+" for "+formatCentToDollarText(n):c;return this.addToCartButton.setAttribute("aria-label",u),this.addToCartButton.setAttribute("aria-busy",d.toString()),this.addToCartButton.setAttribute("aria-disabled",l.toString()),l&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),d&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async e=>{if(e.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 e=this.getProductId(),n=this.getStoreValue("products."+e+".fulfillmentHasAvailability"),i=this.getConfigs("configurations");if(!n||!i.isElementsEnabled)return[];const o=[],r=this.config.layout.showQuantityCounter;if(r){const e=this.config.layout.quantityCounterStyle,n=this.createQuantityContainer(e);o.push(n)}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 e=this.params.productId,n=this.getStoreValue("products."+e+".description"),i=this.getStoreValue("products."+e+".htmlDescription"),o="About this product:",r="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==i?void 0:i.trim())?n:sanitizeHTML(i);const d=document.createElement("span");d.className="collapse-button",d.textContent=r,d.setAttribute("role","button"),d.setAttribute("tabindex","0"),d.setAttribute("aria-label","Show more product information"),d.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,l.classList.toggle("collapsed"),d.textContent=this.isCollapsed?r:a,d.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),d.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return d.addEventListener("click",toggleContent),d.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),toggleContent())}),[c,l,d]}}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(e){var n;const i=e.find(e=>e.path==="products."+this.getProductId()+".drawer");if(!i)return![];const o=i.value,r=o.isOpen,a=null===(n=o.contentConfig)||void 0===n?void 0:n.type,c=a!==this.currentContentType;return r&&!this.isOpen?(this.currentContentType=a,this.openWithContent(o),![]):r&&this.isOpen&&!c?![]:r&&this.isOpen&&c?(this.currentContentType=a,this.openWithContent(o),![]):!r&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:e}){const n=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!e)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:n}),void 0;const{type:i,data:o}=e||{},r=ComponentFactoryService.createElement({type:i,...o});this.contentContainer&&this.contentContainer.appendChild(r),this.open()}catch(i){this.logger.error("Failed to open product drawer",i),this.commands.product.closeProductDrawer(n)}}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 e=document.createElement("div");return e.classList.add("product-drawer-content"),this.contentContainer=e,e}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const e=this.config.layout.fulfillmentDisplay;return["product-image-carousel",e]}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(e){const n=this.params.productId,i=e.find(e=>e.path==="products."+n+".mainImage");if(null==i?void 0:i.value){const e=this.params.images.indexOf(null==i?void 0:i.value);-1!==e?this.selectImage(e):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+i.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 n=0;n<this.thumbnails.length;n++){const e=this.thumbnails[n];e.addEventListener("click",()=>{this.hasMoved||this.selectImage(n)})}const e=this.container.querySelectorAll(".carousel-dot");for(let n=0;n<e.length;n++){const i=e[n];i.addEventListener("click",()=>this.selectImage(n))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(e){var n,i;if(e<0||e>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[e]+"')",this.mainImageElement.title="Product image "+(e+1)),null===(n=this.thumbnails[this.currentImageIndex])||void 0===n||n.classList.remove("selected"),null===(i=this.thumbnails[e])||void 0===i||i.classList.add("selected");const o=this.container.querySelectorAll(".carousel-dot");for(let r=0;r<o.length;r++){const n=o[r];n.classList.toggle("active",r===e)}this.currentImageIndex=e,this.galleryViewport&&this.scrollToIndex(e)}scrollToIndex(e){if(!this.galleryViewport||!this.thumbnails[e])return;const n=this.thumbnails[e],i=this.galleryViewport.offsetWidth,o=n.offsetLeft+n.offsetWidth/2,r=i/2,a=r-o,c=0,l=-(this.galleryContainer.scrollWidth-i);this.translateX=Math.max(l,Math.min(c,a)),this.updateTransform(!![])}setupMainImageSwipe(){var e,n;let i=0,o=0;null===(e=this.mainImageElement)||void 0===e?void 0:e.addEventListener("touchstart",e=>{i=e.touches[0].clientX,o=e.touches[0].clientY},{passive:!![]}),null===(n=this.mainImageElement)||void 0===n||n.addEventListener("touchend",e=>{const n=e.changedTouches[0].clientX-i,r=e.changedTouches[0].clientY-o;Math.abs(n)>Math.abs(r)&&Math.abs(n)>50&&(n>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 e of this.galleryContainer.querySelectorAll("img"))e.addEventListener("dragstart",e=>e.preventDefault())}}handleDragStart(e){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in e?e.touches[0].clientX:e.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(e){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===e.type&&e.preventDefault();const n="touches"in e?e.touches[0].clientX:e.clientX,i=n-this.startX;Math.abs(i)>5&&(this.hasMoved=!![]);const o=this.currentTranslateX+i,r=0,a=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(a,Math.min(r,o)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(e){this.galleryContainer&&(this.galleryContainer.style.transition=e?"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 e=[],n=this.params.images.length>1,i=document.createElement("div");if(i.className="main-image",i.title="Product main image",i.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",n){const e=document.createElement("div");e.className="carousel-dots";for(let n=0;n<this.params.images.length;n++){const i=document.createElement("button");i.type="button",i.className="carousel-dot "+(0===n?"active":""),i.setAttribute("data-index",n.toString()),e.appendChild(i)}i.appendChild(e)}this.mainImageElement=i,e.push(i);const o=document.createElement("div");o.className="gallery-viewport";const r=document.createElement("div");r.className="gallery-container";for(let a=0;a<this.params.images.length;a++){const e=this.params.images[a],n=document.createElement("div");n.className="gallery-image-wrapper "+(0===a?"selected":"");const i=document.createElement("img");i.src=e,i.className="gallery-image",i.alt="Product thumbnail "+(a+1),i.loading="lazy",n.appendChild(i),r.appendChild(n)}return o.appendChild(r),e.push(o),e}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(e){var n,i,o,r;const c=this.getProductId();if(!e.some(e=>e.path==="products."+c+".selectedFulfillmentType"))return;const l=this.getStoreValue("products."+c),d=l.sizes[l.selectedSizeId],u=this.getConfigs("global");this.addPersonalizationSpan&&(l.selectedFulfillmentType===a.SHIPPING&&u.layout.enablePersonalization&&l.productHasAvailability&&(null===(i=null===(n=null==d?void 0:d.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.status)===!![]&&(null===(o=null==l?void 0:l.selectedFulfillment)||void 0===o?void 0:o.isVariantEngravable)===!![]&&(null===(r=null==l?void 0:l.selectedFulfillment)||void 0===r?void 0:r.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const e=this.getProductId(),n=this.container.querySelectorAll("[select-size]");for(const i of n){const o=i.textContent||"",r=i.classList.contains("selected");i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label","Select "+o),i.setAttribute("aria-pressed",r?"true":"false"),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i.click())}),i.addEventListener("click",async()=>{var o,r,a,c;const l=i.dataset.sizeId;if(!l)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:e,buttonElement:i.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(e,l);for(const e of n)e.classList.remove("selected"),e.setAttribute("aria-pressed","false");i.classList.add("selected"),i.setAttribute("aria-pressed","true");const d=this.getStoreValue("products."+e),u=d.sizes[l],h=this.getConfigs("global");this.addPersonalizationSpan&&(h.layout.enablePersonalization&&(null===(r=null===(o=null==u?void 0:u.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.status)===!![]&&d.productHasAvailability&&(null===(a=d.selectedFulfillment)||void 0===a?void 0:a.isVariantEngravable)===!![]&&(null===(c=d.selectedFulfillment)||void 0===c?void 0:c.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(e,n){const i=document.createElement("div");i.className="size-container";const o=document.createElement("h3");o.className="size-label",o.textContent="Size",o.id="size-label",i.appendChild(o);const r=document.createElement("div");r.className="size-buttons-container",r.setAttribute("role","group"),r.setAttribute("aria-labelledby","size-label");for(const a of Object.values(n)){const n=document.createElement("span");n.setAttribute("data-size-id",a.id),n.setAttribute("select-size",""),n.className="size-button "+(a.id===e?"selected":"");const i=a.packDesc?" ("+a.packDesc+")":"";n.textContent=""+a.size+i,r.appendChild(n)}return i.appendChild(r),i}hasIndependentAddressComponent(){var e;return(null===(e=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===e?void 0:e.length)>0}template(){var e,n,i,o;const a=this.getProductId(),c=this.getStoreValue("products."+a),l=c.sizes[c.selectedSizeId],d=this.getConfigs("global"),u=[],h=document.createElement("div");h.className="price-personalization-container";const p=ComponentFactoryService.createElement({type:r.PRODUCT_PRICE,productId:a});h.appendChild(p),d.layout.enablePersonalization&&c.productHasAvailability&&(null===(n=null===(e=null==l?void 0:l.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.status)===!![]&&(null===(i=null==c?void 0:c.selectedFulfillment)||void 0===i?void 0:i.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.addEventListener("click",async()=>{var e,n,i,o,l,d,u,h;const p=c.sizes[c.selectedSizeId];await this.commands.product.openProductDrawer(a,r.ENGRAVING_FORM,{identifier:a,context:"product",lines:[],maxLines:(null===(n=null===(e=p.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.maxLines)||1,maxCharsPerLine:(null===(o=null===(i=p.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.maxCharsPerLine)||16,fee:(null===(d=null===(l=p.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.fee)||0,location:null===(h=null===(u=p.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.location})}),h.appendChild(this.addPersonalizationSpan)),u.push(h);const m=this.renderProductSizes(c.selectedSizeId,c.sizes);if(u.push(m),!this.hasIndependentAddressComponent()){const e=ComponentFactoryService.createElement({type:r.ADDRESS_DISPLAY,productId:a});u.push(e)}const f=ComponentFactoryService.createElement({type:r.PRODUCT_RETAILERS,productId:a});u.push(f);const g=ComponentFactoryService.createElement({type:r.PRODUCT_ADD_TO_CART_SECTION,productId:a});if(u.push(g),this.config.layout.showDescription){const e=ComponentFactoryService.createElement({type:r.PRODUCT_DESCRIPTION,productId:a});u.push(e)}return u}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(e){const n=this.getProductId(),i=e.find(e=>e.path==="products."+n+".drawer.isOpen");if(i){const e=i.value===!![];e&&this.addHostClasses("hide-content"),e||this.removeHostClasses("hide-content")}}template(){const e=this.getProductId(),n=this.getStoreValue("address.formattedAddress");if(n)return ComponentFactoryService.createElement({type:r.PRODUCT_INTERACTIONS,productId:this.getProductId()});const i=document.createElement("button");return i.type="button",i.className="product-options-open-address-button",i.textContent=this.config.layout.buyNowButtonText,i.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.ADDRESS_INPUT,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,r.ADDRESS_INPUT,{productId:e})}),i}}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 e;const n=this.getProductId(),i=this.getStoreValue("products."+n);let o=(null===(e=i.priceInfo)||void 0===e?void 0:e.avg)||0;return i.selectedFulfillment&&(o=i.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 e=this.getProductId(),n=this.getStoreValue("products."+e),i=this.getConfigs("product"),o=[],a=this.getConfigs("configurations");if(!n.productHasAvailability||!a.isElementsEnabled){const e=document.createElement("p");return e.className="product-no-availability-message",e.textContent="We're sorry, this product is not at nearby vendors and unavailable to ship to your state.",o.push(e),o}const c="carousel"===i.layout.fulfillmentDisplay?r.PRODUCT_RETAILERS_CAROUSEL:r.PRODUCT_RETAILERS_POPUP,l=ComponentFactoryService.createElement({type:c,productId:e});return o.push(l),o}}const yt="This product is currently unavailable to ship to your location.",bt="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 e=this.retailerCards.findIndex(e=>e.classList.contains("selected"));-1!==e&&this.scrollToIndex(e)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(e){const n=this.getProductId(),i=e.find(e=>e.path==="products."+n+".selectedFulfillmentId");(null==i?void 0:i.value)&&this.updateSelectedCard(i.value)}updateSelectedCard(e){for(const i of this.retailerCards)i.classList.remove("selected"),i.setAttribute("aria-pressed","false");const n=this.retailerCards.findIndex(n=>n.dataset.fulfillmentId===e);-1!==n&&(this.retailerCards[n].classList.add("selected"),this.retailerCards[n].setAttribute("aria-pressed","true"),this.scrollToIndex(n))}scrollToIndex(e){if(!this.listViewport||!this.retailerCards[e])return;const n=this.retailerCards[e],i=this.listViewport.offsetWidth,o=n.offsetLeft+n.offsetWidth/2,r=i/2,a=r-o,c=0,l=-(this.listContainer.scrollWidth-i);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(e){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in e?e.touches[0].clientX:e.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(e){if(!this.isDragging||!this.listViewport)return;"touchmove"===e.type&&e.preventDefault();const n="touches"in e?e.touches[0].clientX:e.clientX,i=n-this.startX;Math.abs(i)>5&&(this.hasMoved=!![]);const o=this.currentTranslateX+i,r=0,a=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(a,Math.min(r,o)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(e){this.listContainer&&(this.listContainer.style.transition=e?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(e){const n=this.getProductId(),i=e.currentTarget.dataset.fulfillmentType;if(!i)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:n,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(n,i)}async onRetailerCardClick(e){if(this.hasMoved)return;const n=this.getProductId(),i=e.currentTarget.dataset.fulfillmentId;if(!i)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:n,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;const o=this.getStoreValue("products."+n+".selectedFulfillment");if(o&&o.fulfillmentId===i)return this.logger.debug("Product retailer selection skipped: Same fulfillment already selected",{productId:n,fulfillmentId:i}),void 0;await this.commands.product.selectFulfillment(n,i)}generateRetailerCard({fulfillment:e,selectedFulfillmentType:n,isSelected:i,fulfillmentStatus:o,selectedSizeAttributes:r}){var c,l,d,u,h;let p=0;const m=null==r?void 0:r.presale,f=(null==m?void 0:m.isActive)&&(null==m?void 0:m.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(m.estimatedShipBy):"",g=n===a.SHIPPING,v=n===a.ON_DEMAND;g&&(p=(null===(l=null===(c=null==e?void 0:e.fees)||void 0===c?void 0:c.individual)||void 0===l?void 0:l.fee)||0),v&&(p=(null===(d=null==e?void 0:e.fees)||void 0===d?void 0:d.fee)||0);const y=fulfillmentAddress(e.retailerAddress,n);let b=null;n===a.ON_DEMAND&&o.openTime&&(null==o?void 0:o.closeTime)&&(b=o.isOpen?"Closes at "+format24TimeTo12$1(null==o?void 0:o.closeTime):"Opens at "+format24TimeTo12$1(null==o?void 0:o.openTime));const x=n===a.ON_DEMAND&&o&&o.isClosed?"closed":"",w=document.createElement("div");w.className="carousel-retailer-card "+(i?"selected":"")+" "+x,w.setAttribute("data-fulfillment-id",e.fulfillmentId),w.setAttribute("role","button"),w.setAttribute("tabindex","0"),w.setAttribute("aria-pressed",i?"true":"false");const C=n===a.SHIPPING?"Shipping":"Same-day delivery";w.setAttribute("aria-label",C+" from "+e.retailerName+", "+formatCentToDollarText(null!==(u=e.price)&&void 0!==u?u:0));const S=document.createElement("div");S.className="retailer-header";const I=document.createElement("h3");if(I.className="name",I.textContent=e.retailerName,S.appendChild(I),v){const e=document.createElement("h3");e.className="address",e.textContent=y,S.appendChild(e)}const P=document.createElement("div");P.className="retailer-body";const D=document.createElement("span");D.className="product-price",D.textContent=formatCentToDollarText(null!==(h=e.price)&&void 0!==h?h:0);const F=document.createElement("span");F.className="shipping-price",F.textContent=p>0?"+ "+formatCentToDollarText(p):"FREE Delivery";const _=document.createElement("span");return _.className="expectation",_.textContent=o.isClosed?b:(null==m?void 0:m.isActive)?f:(null==e?void 0:e.expectation.detail)||"No expectation available",P.append(D,F,_),w.append(S,P),w}template(){const e=this.getProductId(),n=this.getStoreValue("products."+e),i=this.getStoreValue("products."+e+".sizes."+n.selectedSizeId),o=(null==i?void 0:i.attributes)||null,r=this.config.layout.enableShippingFulfillment,c=this.config.layout.enableOnDemandFulfillment,l=[];for(const a in i.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(i.shippingFulfillments,a)){const e=i.shippingFulfillments[a],n=getRetailerOffHours(e);if(n.isClosed&&!this.config.layout.showOffHours)continue;l.push(e)}const d=[];for(const a in i.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(i.onDemandFulfillments,a)){const e=i.onDemandFulfillments[a],n=getRetailerOffHours(e);if(n.isClosed&&!this.config.layout.showOffHours)continue;d.push(e)}const u=n.selectedFulfillmentType===a.SHIPPING,h=n.selectedFulfillmentType===a.ON_DEMAND,p=u?l:d,m=renderFulfillmentTabsContainer({shippingFulfillments:l,onDemandFulfillments:d,shippingSelected:u,onDemandSelected:h,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:r,enableOnDemandFulfillment:c});if(!n.fulfillmentHasAvailability||0===p.length){const e=document.createElement("p");return e.className="product-no-availability-message",e.textContent=u?yt:bt,[m,e]}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 f of p){const e=getRetailerOffHours(f),i=this.generateRetailerCard({fulfillment:f,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:f.fulfillmentId===n.selectedFulfillmentId,fulfillmentStatus:e,selectedSizeAttributes:o}),r=n.selectedFulfillmentType===a.ON_DEMAND&&e&&e.isClosed;r?i.setAttribute("aria-disabled","true"):(i.addEventListener("click",this.onRetailerCardClick.bind(this)),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i.click())})),this.listContainer.appendChild(i)}return this.listViewport.appendChild(this.listContainer),[m,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 e=this.getProductId(),n=this.getStoreValue("products."+e),i=this.getStoreValue("products."+e+".sizes."+n.selectedSizeId),o=(null==i?void 0:i.attributes)||null,c=this.config.layout.enableShippingFulfillment,l=this.config.layout.enableOnDemandFulfillment,d=Object.values(i.shippingFulfillments),u=Object.values(i.onDemandFulfillments),h=(c?d.length:0)+(l?u.length:0),p=document.createElement("div");p.className="header";const m=document.createElement("span");m.className="header-label",m.textContent=n.selectedFulfillmentType===a.SHIPPING?"Shipping From:":"Delivering From:";const f=document.createElement("button");if(f.className="delivery-options",f.type="button",f.textContent="See Delivery Options ("+h+")",f.setAttribute("aria-label","View all "+h+" delivery options"),f.addEventListener("click",async()=>{0!==h&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(r.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,r.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}))}),p.appendChild(m),p.appendChild(f),!n.fulfillmentHasAvailability){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.textContent=n.selectedFulfillmentType===a.SHIPPING?yt:bt,[p,e]}const g=document.createElement("div");g.className="popup-fulfillment-list-container";const v=getRetailerOffHours(n.selectedFulfillment),y=renderPopupRetailerCard({fulfillment:n.selectedFulfillment,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:![],fulfillmentStatus:v,selectedSizeAttributes:o});return g.appendChild(y),[p,g]}}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(e){const n=this.getProductId(),i=e.currentTarget.dataset.fulfillmentType;if(!i)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:n,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(n,i)}async onRetailerCardClick(e){const n=this.getProductId(),i=e.currentTarget.dataset.fulfillmentId;if(!i)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:n,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;const E=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(n),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},o=this.getStoreValue("products."+n+".selectedFulfillment");if(o&&o.fulfillmentId===i)return await E(),void 0;await this.commands.product.selectFulfillment(n,i),await E()}template(){const e=this.getProductId(),n=this.getStoreValue("products."+e),i=this.getStoreValue("products."+e+".sizes."+n.selectedSizeId),o=(null==i?void 0:i.attributes)||null,r=this.config.layout.enableShippingFulfillment,c=this.config.layout.enableOnDemandFulfillment,l=[];for(const a in i.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(i.shippingFulfillments,a)){const e=i.shippingFulfillments[a],n=getRetailerOffHours(e);if(n.isClosed&&!this.config.layout.showOffHours)continue;l.push(e)}const d=[];for(const a in i.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(i.onDemandFulfillments,a)){const e=i.onDemandFulfillments[a],n=getRetailerOffHours(e);if(n.isClosed&&!this.config.layout.showOffHours)continue;d.push(e)}const u=n.selectedFulfillmentType===a.SHIPPING,h=n.selectedFulfillmentType===a.ON_DEMAND,p=u?l:d,m=document.createElement("h5");m.className="popup-retailers-section-title",m.textContent="Delivery Options";const f=renderFulfillmentTabsContainer({shippingFulfillments:l,onDemandFulfillments:d,shippingSelected:u,onDemandSelected:h,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:r,enableOnDemandFulfillment:c});if(!n.fulfillmentHasAvailability||0===p.length){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.textContent=u?yt:bt,[m,f,e]}const g=document.createElement("div");g.className="popup-fulfillment-list-container";for(const a of p){const e=getRetailerOffHours(a),i=renderPopupRetailerCard({fulfillment:a,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:a.fulfillmentId===n.selectedFulfillmentId,fulfillmentStatus:e,selectedSizeAttributes:o});i.addEventListener("click",this.onRetailerCardClick.bind(this)),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i.click())}),g.appendChild(i)}return[m,f,g]}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(e){e.length>0&&this.updateAlert()}getErrorMessages(){var e,n;const i=null!==(e=this.params.fromEvents)&&void 0!==e?e:![],o=null!==(n=this.params.showFirstEvent)&&void 0!==n?n:!![];if(i){const e=this.store.get(this.params.errorStorePath)||[],n=e.filter(e=>null==e?void 0:e.message).map(e=>({message:e.message,level:e.level||"error",type:e.type}));return o?n.slice(0,1):n}const r=this.store.get(this.params.errorStorePath);return r?[{message:r,level:"error"}]:[]}createErrorElement(e){const n=document.createElement("div");n.classList.add("alert-container","alert-"+e.level);const i=document.createElement("span");i.classList.add("alert-icon"),i.innerHTML=ErrorInfoIcon({className:e.level+"-icon"});const o=document.createElement("span");return o.classList.add("alert-text"),o.textContent=e.message,n.appendChild(i),n.appendChild(o),n}scheduleHide(){var e;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const n=null!==(e=this.params.autoHideDelay)&&void 0!==e?e:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},n)}hideAllErrors(){var e;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.elements=[];const n=null!==(e=this.params.fromEvents)&&void 0!==e?e:![];n?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const e=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.elements=[],0===e.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=e.map(e=>this.createErrorElement(e)),this.elements.forEach(e=>{this.container.appendChild(e)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const e=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(r.CART)});const n=document.createElement("span");if(n.className="lce-cart-button-icon",n.innerHTML=BagIcon({color:e.theme.primaryColor}),this.params.showItemsCount){const e=document.createElement("span");return e.className="lce-cart-button-badge",e.style.visibility="hidden",[n,e]}return[n]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const e=this.container.querySelector(".lce-cart-button-badge");if(!e)return;const n=this.getStoreValue("cart.totals.quantity")||0;e.textContent=n.toString(),e.style.visibility=n>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const n=this.getStoreValue("cart.totals.quantity")||0;e.textContent=n.toString(),e.style.visibility=n>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(e){var n;const i=e.find(e=>"ui.drawer"===e.path);if(!i)return![];const o=i.value,r=o.isOpen,a=null===(n=o.contentConfig)||void 0===n?void 0:n.type,c=a!==this.currentContentType;return r&&!this.isOpen?(this.currentContentType=a,this.openWithContent(o),![]):r&&this.isOpen&&!c?![]:r&&this.isOpen&&c?(this.currentContentType=a,this.openWithContent(o),![]):!r&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:e}){try{if(!e)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:n,data:i}=e||{};let o;o=this.isElementsEnabled()?ComponentFactoryService.createElement({type:n,...i}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({message:"Elements is not enabled.",componentType:n}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(o,n):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(o),this.updateDrawerContentTypeClass(n),this.open()),this.addHostAttribute("data-target",n.toString().toLowerCase())}catch(n){this.logger.error("Drawer content loading failed",n),this.commands.ui.closeDrawer()}}animateContentSwap(e,n){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const i=this.contentContainer.firstElementChild;i.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{i.classList.add("fading")}),setTimeout(()=>{i.remove(),e.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(e),this.updateDrawerContentTypeClass(n),requestAnimationFrame(()=>{e.classList.add("visible"),setTimeout(()=>{e.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(e){this.isOpen&&"Escape"===e.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(e){if(!this.drawerElement)return;const n=["drawer"];this.isOpen&&n.push("open"),n.push(e.toString().toLowerCase()),this.drawerElement.className=n.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 e;try{const n=this.themeProvider.getConfigs("configurations");return null!==(e=null==n?void 0:n.isElementsEnabled)&&void 0!==e?e:![]}catch(n){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",n),!![]}}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 e=this.getConfigs("global");return["custom-input","birthdate",e.layout.inputFieldStyle]}constructor(){super({watchOnlyStorePaths:["checkout.focusField"]})}onStoreWatch(e){const n=e.find(e=>"checkout.focusField"===e.path);n&&n.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 e=this.params.value.split("/");3===e.length&&(this.monthInput.value=e[0],this.dayInput.value=e[1],this.yearInput.value=e[2])}}setupEventListeners(){this.monthInput.addEventListener("input",e=>{this.formatMonth(e),this.handleNavigation(e,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",e=>{this.formatDay(e),this.handleNavigation(e,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",e=>{this.formatYear(e),this.handleChange()}),this.monthInput.addEventListener("blur",()=>this.validateInput()),this.dayInput.addEventListener("blur",()=>this.validateInput()),this.yearInput.addEventListener("blur",()=>this.validateInput());for(const e of[this.monthInput,this.dayInput,this.yearInput])e.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",e=>{"Backspace"===e.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",e=>{"Backspace"===e.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(e){const n=e.target;let i=n.value.replace(/\D/g,"");if(i.length>2&&(i=i.substring(0,2)),1===i.length&&Number.parseInt(i,10)>1)i="0"+i;else if(2===i.length){const e=Number.parseInt(i,10);e>12?i="12":e<1&&(i="01")}n.value=i}formatDay(e){const n=e.target;let i=n.value.replace(/\D/g,"");if(i.length>2&&(i=i.substring(0,2)),1===i.length&&Number.parseInt(i,10)>3)i="0"+i;else if(2===i.length){const e=Number.parseInt(i,10);e>31?i="31":e<1&&(i="01")}n.value=i}formatYear(e){const n=e.target;let i=n.value.replace(/\D/g,"");i.length>4&&(i=i.substring(0,4)),n.value=i}handleNavigation(e,n){const i=e.target,o=i===this.yearInput?4:2;i.value.length===o&&n&&n.focus()}handleChange(){if(this.clearErrors(),this.params.onChange){const e=this.getFormattedValue();this.params.onChange(e)}}getFormattedValue(){const e=this.monthInput.value.padStart(2,"0"),n=this.dayInput.value.padStart(2,"0"),i=this.yearInput.value;return e&&n&&i&&4===i.length?i+"-"+e+"-"+n:""}validateDate(e,n,i){if(!e||!n||!i||4!==i.length)return![];const o=Number.parseInt(e,10),r=Number.parseInt(n,10),a=Number.parseInt(i,10);if(o<1||o>12||r<1||r>31||a<1e3)return![];const c=new Date(a,o-1,r);return c.getFullYear()===a&&c.getMonth()===o-1&&c.getDate()===r}calculateAge(e){const n=new Date;let i=n.getFullYear()-e.getFullYear();const o=n.getMonth()-e.getMonth();return(o<0||0===o&&n.getDate()<e.getDate())&&i--,i}validateInput(){const e=this.monthInput.value,n=this.dayInput.value,i=this.yearInput.value,o=[],r=this.params.validation;if(!r)return this.showErrors([]),!![];if(r.required&&(e&&n&&i||o.push("Please enter a complete date")),e||n||i)if(e&&n&&i&&4===i.length)if(this.validateDate(e,n,i)){const a=Number.parseInt(e,10),c=Number.parseInt(n,10),l=Number.parseInt(i,10),d=new Date(l,a-1,c);if(void 0!==r.minYear&&l<r.minYear&&o.push("Year must be "+r.minYear+" or later"),void 0!==r.maxYear&&l>r.maxYear&&o.push("Year must be "+r.maxYear+" or earlier"),void 0!==r.minAge||void 0!==r.maxAge){const e=this.calculateAge(d);void 0!==r.minAge&&e<r.minAge&&o.push("Must be at least "+r.minAge+" years old"),void 0!==r.maxAge&&e>r.maxAge&&o.push("Must be no more than "+r.maxAge+" years old")}if(r.customValidator){const e=r.customValidator(this.getFormattedValue());e&&o.push(e)}}else o.push("Please enter a valid date");else o.push("Please enter a complete date (MM/DD/YYYY)");this.showErrors(o);const a=0===o.length;return this.params.onValidation&&this.params.onValidation(a,o),a}showErrors(e){this.errorContainer.innerHTML="";const n=[this.monthInput,this.dayInput,this.yearInput];if(e.length>0){this.errorContainer.classList.add("show");for(const e of n)e.classList.add("input-error");for(const n of e){const e=document.createElement("div");e.className="error-message",e.textContent=n,this.errorContainer.appendChild(e)}}else for(const i of n)i.classList.remove("input-error")}clearErrors(){const e=[this.monthInput,this.dayInput,this.yearInput],n=e.some(e=>e.classList.contains("input-error"));if(n){for(const n of e)n.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(e){if(e){const n=e.split("/");3===n.length&&(this.monthInput.value=n[0],this.dayInput.value=n[1],this.yearInput.value=n[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 e;const n=[];if(this.params.label){const i=document.createElement("label");i.textContent=this.params.label,(null===(e=this.params.validation)||void 0===e?void 0:e.required)&&(i.textContent+="*"),i.setAttribute("for",this.params.name+"-month"),n.push(i)}const i=document.createElement("div");i.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 r=document.createElement("span");r.className="date-separator",r.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&&(i.className+=" "+this.params.className),i.appendChild(o),i.appendChild(r),i.appendChild(a),i.appendChild(c),i.appendChild(l);const d=document.createElement("div");return d.className="error-container",n.push(i),n.push(d),n}}class InputComponent extends BaseComponent{get hostClasses(){const e=this.getConfigs("global");return["custom-input",e.layout.inputFieldStyle]}constructor(){super({watchStorePaths:["checkout.focusField"]})}onStoreChanged(e){const n=e.find(e=>"checkout.focusField"===e.path);return n&&n.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"})),![]}handlePhoneKeydown(e){if("Backspace"===e.key){const n=e.target,i=n.selectionStart||0,o=n.value;i>0&&/\D/.test(o[i-1])&&setTimeout(()=>{const e=Math.max(0,i-2);n.setSelectionRange(e,e)},0)}}formatPhoneNumber(e){const n=e.target;let i=n.value.replace(/\D/g,"");i.length>10&&(i=i.substring(0,10)),i.length>=6?i="("+i.substring(0,3)+") "+i.substring(3,6)+"-"+i.substring(6):i.length>=3&&(i="("+i.substring(0,3)+") "+i.substring(3)),n.value=i}formatDate(e){const n=e.target;let i=n.value.replace(/\D/g,"");i.length>8&&(i=i.substring(0,8)),i.length>=5?i=i.substring(0,2)+"/"+i.substring(2,4)+"/"+i.substring(4):i.length>=3&&(i=i.substring(0,2)+"/"+i.substring(2)),n.value=i}validateEmail(e){const n=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return n.test(e)}validateTel(e){const n=/^\(\d{3}\) \d{3}-\d{4}$/;return n.test(e)}validateDate(e){const n=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!n.test(e))return![];const[i,o,r]=e.split("/").map(Number),a=new Date(r,i-1,o);return a.getFullYear()===r&&a.getMonth()===i-1&&a.getDate()===o}validateInput(){const e=this.inputElement.value,n=[],i=this.params.validation;if(!i)return this.showErrors([]),!![];if(i.required&&!e.trim()&&n.push("This field is required"),e.trim()){if("email"!==this.params.inputType||this.validateEmail(e)||n.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(e)||n.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(e)||n.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const o=Number.parseFloat(e);Number.isNaN(o)?e.trim()&&n.push("Please enter a valid number"):(void 0!==i.min&&o<i.min&&n.push("Value must be at least "+i.min),void 0!==i.max&&o>i.max&&n.push("Value must be no more than "+i.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==i.min&&e.length<i.min&&n.push("Must be at least "+i.min+" characters"),void 0!==i.max&&e.length>i.max&&n.push("Must be no more than "+i.max+" characters")),i.pattern){const o=new RegExp(i.pattern);o.test(e)||n.push("Invalid format")}if(i.customValidator){const o=i.customValidator(e);o&&n.push(o)}}this.showErrors(n);const o=0===n.length;return this.params.onValidation&&this.params.onValidation(o,n),o}showErrors(e){if(this.errorContainer.innerHTML="",e.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const n of e){const e=document.createElement("div");e.className="error-message",e.textContent=n,this.errorContainer.appendChild(e)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(e){this.inputElement.value=e,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===this.params.inputType&&this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var e;const n=[];if(this.params.label){const i=document.createElement("label");i.textContent=this.params.label,(null===(e=this.params.validation)||void 0===e?void 0:e.required)&&(i.textContent+="*"),i.setAttribute("for",this.params.name),n.push(i)}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",e=>{this.clearErrors(),this.params.onChange&&this.params.onChange(e.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",n.push(this.inputElement),n.push(this.errorContainer),n}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.q=this.attachShadow({mode:"closed"})}initialize(e,n){if(this.A)return;if(!e||"string"!=typeof e)throw new Error("LceElementComponent: contentType must be a non-empty string");if(!(n&&n instanceof HTMLElement))throw new Error("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(e.toLowerCase(),""),!this.q)throw new Error("LceElementComponent: Shadow DOM container is not available");this.q.appendChild(n),this.applyBasicStyles();const i=ThemeProviderService.getInstance(),o=i.getStylesheet(e);this.applyThemeStyles(o),this.A=!![],this.q=null}applyBasicStyles(){const e="\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 n=new CSSStyleSheet;n.replaceSync(e),this.q.adoptedStyleSheets=[n,...this.q.adoptedStyleSheets]}else this.createFallbackStylesheet(e)}catch(R){this.createFallbackStylesheet(e)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const e=new CSSStyleSheet;return e.replaceSync("/* test */"),!![]}catch(e){return![]}}applyThemeStyles(e){e.forEach(e=>{"string"==typeof e?this.createFallbackStylesheet(e):this.q.adoptedStyleSheets=[...this.q.adoptedStyleSheets,e]})}createFallbackStylesheet(e){const n=document.createElement("style");n.textContent=e,this.q&&this.q.appendChild(n)}}class ProductLoadingComponent extends BaseComponent{template(){const e=Boolean(this.getStoreValue("address")),{showTitle:n,showDescription:i,showQuantityCounter:o,fulfillmentDisplay:r,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"),n){const e=document.createElement("div");e.classList.add("wave","sc-title"),l.appendChild(e)}if(!e){const e=document.createElement("div");return e.classList.add("wave","sc-add-to-cart"),l.appendChild(e),l}const d=document.createElement("div");d.classList.add("wave","sc-price"),l.appendChild(d);const u=document.createElement("div");u.classList.add("sc-sizes");const h=document.createElement("div");h.classList.add("wave","sc-size-button"),u.appendChild(h);const p=document.createElement("div");p.classList.add("wave","sc-size-button"),u.appendChild(p);const m=document.createElement("div");m.classList.add("wave","sc-size-button"),u.appendChild(m);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),u.appendChild(f);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),u.appendChild(g),l.appendChild(u);const v=document.createElement("div");v.classList.add("sc-row");const y=document.createElement("div");y.classList.add("wave","sc-price"),v.appendChild(y);const b=document.createElement("div");b.classList.add("wave","sc-personalization"),v.appendChild(b),l.appendChild(v);const x=document.createElement("div");x.classList.add("wave","sc-deliver-to"),l.appendChild(x);const w=document.createElement("div");w.classList.add("wave","sc-address"),l.appendChild(w);const C=document.createElement("div");C.classList.add("wave","sc-retailers",r),l.appendChild(C);const S=document.createElement("div");if(S.classList.add("sc-row"),o){const e=document.createElement("div");e.classList.add("wave","sc-quantity"),S.appendChild(e)}const I=document.createElement("div");if(I.classList.add("wave","sc-add-to-cart"),S.appendChild(I),l.appendChild(S),i){const e=document.createElement("div");e.classList.add("wave","sc-description-title"),l.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),l.appendChild(n);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),l.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-line"),l.appendChild(o);const r=document.createElement("div");r.classList.add("wave","sc-description-more"),l.appendChild(r)}const P=document.createElement("div");if(P.classList.add("product-content"),P.appendChild(l),c.appendChild(P),a){c.classList.add("has-images");const e=this.createImageSkeletons();c.prepend(e)}return c}createImageSkeletons(){const e=document.createElement("div");e.classList.add("product-image-carousel","skeleton");const n=document.createElement("div");n.classList.add("wave","sc-main-image"),n.title="Product main image loading";const i=document.createElement("div");i.classList.add("carousel-dots");for(let a=0;a<3;a++){const e=document.createElement("div");e.classList.add("wave","sc-carousel-dot"),i.appendChild(e)}n.appendChild(i),e.appendChild(n);const o=document.createElement("div");o.classList.add("gallery-viewport");const r=document.createElement("div");r.classList.add("gallery-container");for(let a=0;a<4;a++){const e=document.createElement("div");e.classList.add("gallery-image-wrapper");const n=document.createElement("div");n.classList.add("wave","sc-gallery-thumbnail"),e.appendChild(n),r.appendChild(e)}return o.appendChild(r),e.appendChild(o),e}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const e=document.createElement("div");e.className="pb-title-container";const n=document.createElement("span");n.className="pb-text",n.textContent="Powered by",e.appendChild(n);const i=document.createElement("span");i.className="pb-lc",i.textContent="LiquidCommerce",e.appendChild(i);const o=document.createElement("span");return o.className="pb-dot",o.textContent=".",e.appendChild(o),e}createDisclaimerSection(){const e=document.createElement("div");e.className="pb-disclaimer-container";const n=this.getDisclaimerConfig();return n.parts.forEach(n=>{"text"===n.type?e.appendChild(document.createTextNode(n.content)):"link"===n.type&&e.appendChild(this.createLink(n.href,n.text))}),e}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(e,n){const i=document.createElement("a");return i.href=e,i.target="_blank",i.rel="noopener noreferrer",i.className="pb-link",i.textContent=n,i.setAttribute("role","link"),i.setAttribute("aria-label","Read "+n),i}template(){const e=this.createPoweredBySection(),n=this.createDisclaimerSection();return[e,n]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(e){const n=e.find(e=>"cart.promoCode"===e.path||"checkout.promoCode"===e.path);if(!n||!this.applyButton||!this.currentActiveTicker)return;const i=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);i&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!i&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(e){const n=this.store.get("cart.promoCode"),i=this.store.get("checkout.promoCode");return(null==n?void 0:n.code)===e||(null==i?void 0:i.code)===e}getActiveTickers(){var e;const n=this.store.get("address");return null===(e=this.params.tickers)||void 0===e?void 0:e.filter(e=>{var i;return isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:null===(i=null==n?void 0:n.address)||void 0===i?void 0:i.state})})}selectCurrentTicker(e){return 0===e.length?null:e[0]}generateTextContent(e){const n=document.createElement("div");n.classList.add("promo-ticker__text-group");const i=e.text.map(e=>e.trim()).map(e=>e.substring(0,50)).filter(e=>""!==e.trim()).slice(0,5);for(const o of i){const i=o.trim();if(!i)continue;const r=document.createElement("span");r.classList.add("promo-ticker__text-item"),r.textContent=i,n.appendChild(r);const a=document.createElement("span");a.classList.add("promo-ticker__separator"),a.textContent=e.separator,n.appendChild(a)}return n}async handlePromoClick(){var e;(null===(e=this.currentActiveTicker)||void 0===e?void 0:e.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const e=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(e),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const n=document.createElement("div");n.classList.add("promo-ticker__content");const i=document.createElement("div");i.classList.add("promo-ticker__track");for(let r=0;r<5;r++)i.appendChild(this.generateTextContent(this.currentActiveTicker));n.appendChild(i);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",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handlePromoClick())}),this.applyButton=o,[n,o]}}const xt=LoggerFactory.get("ElementsClientHelper"),isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),getType=e=>null===e?"null":Array.isArray(e)?"array":typeof e;function deepMergeConfigs(e,n){if(!e||!n)return e;const i={...e},o=[];for(const r in n){const a=n[r],c=i[r];if(!(r in e)){o.push('Property "'+r+'" does not exist in target schema, skipping merge.');continue}const l=getType(a),d=getType(c);l===d?isObject(a)&&isObject(c)?i[r]=deepMergeConfigs(c,a):i[r]=a:o.push('Type mismatch for key "'+r+'": source is '+l+", target is "+d+". Skipping merge.")}return o.length>0&&xt.warn("Merging configurations with warnings:",o),i}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 e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e+".items")||{};return Object.values(n).find(n=>n.fulfillmentId===e)}handleItemsUpdate(e,n){const i=new Set(e||[]),o=new Set(n||[]);for(const r of i)if(!o.has(r)){const e=this.container.querySelector('[data-item-id="'+r+'"]');e&&e.remove()}for(const a of o)if(!i.has(a)){const e=ComponentFactoryService.createElement({type:r.CART_ITEM,itemId:a});e.setAttribute("data-item-id",a),this.container.appendChild(e)}}setupItemElements(){const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e+".items")||[],i=this.container.querySelectorAll("[data-item-id]");for(const o of i)o.remove();for(const o of n){const e=ComponentFactoryService.createElement({type:r.CART_ITEM,itemId:o});e.setAttribute("data-item-id",o),this.container.appendChild(e)}}setupMinimumPurchaseAlert(){var e;const n=this.getFulfillmentId(),i=(null===(e=this.getProductStore())||void 0===e?void 0:e.pack)||![],o=this.getStoreValue("cart.fulfillments."+n),a=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(a&&a.remove(),shouldShowMinimumPurchaseAlert(o,i)){const e=getMinimumPurchaseMessage(o,i),n=ComponentFactoryService.createElement({type:r.PURCHASE_MIN_ALERT,message:e.message,messageType:e.type,currentTotal:o.subtotal,config:{showIcon:!![],alertType:"minimal"}});n.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(n)}}createLoadingOverlay(){const e=document.createElement("div");e.className="cart-loading-backdrop",e.setAttribute("data-loading-id","fulfillment-loading-overlay");const n=document.createElement("div");n.className="cart-loading-spinner-container";const i=document.createElement("div");return i.className="cart-loading-spinner",i.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(i),e.appendChild(n),e}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const e=this.createLoadingOverlay();this.container.appendChild(e),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const e=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');e&&(e.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var e;const n=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+n);return(null===(e=null==i?void 0:i.items)||void 0===e?void 0:e.length)?i.items.some(e=>{const n=this.getStoreValue("cart.items."+e);return(null==n?void 0:n.updating)===!![]}):![]}checkAndUpdateLoadingState(){const e=this.isAnyItemUpdating(),n=this.hasLoadingOverlay();e&&!n?this.showLoadingOverlay():!e&&n&&this.hideLoadingOverlay()}onStoreChanged(e){const n=this.getFulfillmentId(),i="cart.fulfillments."+n,o=e.find(e=>e.path===i),r=e.filter(e=>"cart.items"===e.path||e.path.startsWith("cart.items."));if(r.length>0&&this.checkAndUpdateLoadingState(),o){const e=o.oldValue,n=o.value,i=(null==e?void 0:e.items)||[],r=(null==n?void 0:n.items)||[],a=JSON.stringify(i)!==JSON.stringify(r);a&&(this.handleItemsUpdate(i,r),this.checkAndUpdateLoadingState());const c=this.hasFulfillmentFeesChanged(e,n),l=this.hasFulfillmentDataChanged(e,n,["items","updating"]);if(c&&!l&&this.setupMinimumPurchaseAlert(),!l)return![]}return![]}hasFulfillmentFeesChanged(e,n){return e?e.subtotal!==n.subtotal||e.shippingFee!==n.shippingFee||e.deliveryFee!==n.deliveryFee||JSON.stringify(e.fees)!==JSON.stringify(n.fees):!![]}hasFulfillmentDataChanged(e,n,i=[]){if(!e)return!![];const o=["type","canEngrave","retailerId"];for(const r of o)if(!i.includes(r)&&e[r]!==n[r])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}class LiquidCommerceElementsClient{constructor(e){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],this.builder={updateComponentGlobalConfigs:async e=>{if(this.ensuredIsBuilder("updateComponentGlobalConfigs"))try{if(!e)throw new Error("Global theme configuration is required");this.themeProvider.updateComponentGlobalConfigs(e),e.layout&&Object.keys(e.layout).length>0&&(await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout()),this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(n){throw this.logger.error("❌ Failed to update global theme configuration",n),new Error("Global theme update failed")}},updateProductComponent:async e=>{if(this.ensuredIsBuilder("updateProductComponent"))try{if(!e)throw new Error("Product component configuration is required");this.themeProvider.updateProductComponent(e),e.layout&&Object.keys(e.layout).length>0&&await this.commands.product.rerenderAllProducts(),this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(n){throw this.logger.error("❌ Failed to update product component theme",n),new Error("Product theme update failed")}},updateCartComponent:e=>{if(this.ensuredIsBuilder("updateCartComponent"))try{if(!e)throw new Error("Cart component configuration is required");this.themeProvider.updateCartComponent(e),e.layout&&Object.keys(e.layout).length>0&&this.commands.cart.rerenderCart(),this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(n){throw this.logger.error("❌ Failed to update cart component theme",n),new Error("Cart theme update failed")}},updateCheckoutComponent:e=>{if(this.ensuredIsBuilder("updateCheckoutComponent"))try{if(!e)throw new Error("Checkout component configuration is required");this.themeProvider.updateCheckoutComponent(e),e.layout&&Object.keys(e.layout).length>0&&this.commands.checkout.rerenderCheckout(),this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(n){throw this.logger.error("❌ Failed to update checkout component theme",n),new Error("Checkout theme update failed")}},updateAddressComponent:e=>{if(this.ensuredIsBuilder("updateAddressComponent"))try{if(!e)throw new Error("Address component configuration is required");this.themeProvider.updateAddressComponent(e),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(n){throw this.logger.error("❌ Failed to update address component theme",n),new Error("Address theme update failed")}},injectElement:async e=>{this.ensuredIsBuilder("injectElement")&&await this.processInjectElement(e)},injectProductElement:async e=>{this.ensuredIsBuilder("injectProductElement")&&await this.processInjectProduct(e)},injectAddressElement:async(e,n)=>{this.ensuredIsBuilder("injectAddressElement")&&await this.processInjectElement({type:r.ADDRESS,containerId:e,options:n})},injectCartElement:async e=>{this.ensuredIsBuilder("injectCartElement")&&await this.processInjectElement({type:r.CART,containerId:e})},injectCheckoutElement:async e=>{this.ensuredIsBuilder("injectCheckoutElement")&&await this.processInjectElement({type:r.CHECKOUT,containerId:e})}},this.ui={cartButton:(e,n)=>{var i;this.ensureCartDrawerExists();const o=document.getElementById(null!==(i=null==e?void 0:e.replace("#",""))&&void 0!==i?i:"");if(!o)throw new Error("Container with ID '"+e+"' not found");const a=ComponentFactoryService.createElement({type:r.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:n});o.innerHTML="",safeReplaceChildren(o,a)},floatingCartButton:e=>{this.ensureCartDrawerExists();const n=ComponentFactoryService.createElement({type:r.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:e});document.body.appendChild(n)},cartSubtotal:e=>{var n;const i=document.getElementById(null!==(n=null==e?void 0:e.replace("#",""))&&void 0!==n?n:"");if(!i)throw new Error("Element with ID '"+e+"' not found");i.innerHTML="";const o=this.store.get("cart.totals.subtotal")||0;i.textContent=formatCentToDollarText(o),this.store.watch("cart.totals",()=>{const e=this.store.get("cart.totals.subtotal")||0;i.textContent=formatCentToDollarText(e)})},cartItemsCount:e=>{var n;const i=document.getElementById(null!==(n=null==e?void 0:e.replace("#",""))&&void 0!==n?n:"");if(!i)throw new Error("Element with ID '"+e+"' not found");i.innerHTML="";const o=this.store.get("cart.totals.quantity")||0;i.textContent=o.toString(),this.store.watch("cart.totals",()=>{const e=this.store.get("cart.totals.quantity")||0;i.textContent=e.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:e.apiKey,env:e.env,baseUrl:e.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(e){throw this.logger.error("Failed to prepare client",e),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),e}}async prepareEssentialServices(){this.clientConfig.set("version",R.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 e=await this.authService.authenticate();if(!e)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 n=await this.apiClient.getAllConfigs();this.logger.debug("✅ Configurations loaded"),this.clientConfig.set("partnerCode",n.configurations.partnerCode),this.logger.debug("🔍 Setting up fingerprinting and store...");const i=await this.fingerPrintService.getId(n.configurations.partnerCode),o=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",i),this.clientConfig.set("isLocalStorageAvailable",o);const r=o?null:await this.apiClient.getPersistedStore(i);if(await this.store.initialize({userDeviceId:i,isLocalStorageAvailable:o,persistedStore:r}),this.logger.debug("✅ Store setup completed"),this.logger.debug("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const e=this.clientConfig.get("customTheme"),i=n.global.layout.showPoweredBy;n=deepMergeConfigs(n,e),n.global.layout.showPoweredBy=i}await this.themeProvider.initialize(n),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(e){this.logger.error("Heavy initialization failed",e)}},0)}async initializeHeavyServices(){const e=this.themeProvider.getConfigs("configurations");if(!this.gtmInitialized)try{await this.googleTagManager.initialize({partnerName:e.partnerName,partnerGtmId:e.googleTagManagerId,partnerEnableGaTracking:e.enablePartnerGaTracking,liquidCommerceEnableGaTracking:e.enableLiquidCommerceGaTracking,liquidCommerceGtmId:e.liquidCommerceGoogleTagManagerId}),this.gtmInitialized=!![]}catch(n){this.logger.error("GTM initialization failed",n)}try{this.isElementsEnabled()&&await this.commands.common.loadCart()}catch(i){this.logger.error("Cart pre-loading failed",i)}this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}async injectProductElement(e){if(this.isElementsEnabled())await this.processInjectProduct(e);else for(const n of e)this.injectDisabledElementsError(n.containerId,r.PRODUCT)}async injectAddressElement(e,n){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e,r.ADDRESS),void 0;await this.processInjectElement({type:r.ADDRESS,containerId:e,options:n})}async injectCartElement(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e,r.CART),void 0;await this.processInjectElement({type:r.CART,containerId:e})}async injectCheckoutElement(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e,r.CHECKOUT),void 0;await this.processInjectElement({type:r.CHECKOUT,containerId:e})}get actions(){return this.clientAction.actions}async processInjectProduct(e){var n,i;if(this.ensureAllComponentsRegistered(),0===e.length)throw new Error("At least one product must be provided");e.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const o=e.slice(0,20),a=[];for(const r of o){const e=null===(i=null===(n=r.containerId)||void 0===n?void 0:n.replace("#",""))||void 0===i?void 0:i.trim();if(!e){this.logger.warn("Container ID is required for product with ID '"+r.identifier+"'");continue}const o=document.getElementById(e);if(!o){this.logger.warn("Container with ID '"+e+"' not found for product '"+r.identifier+"'");continue}const c=a.every(n=>n.containerId!==e);if(!c){this.logger.warn("Duplicate container ID '"+e+"' found, skipping");continue}if(!r.identifier){this.logger.warn("Product identifier is required for container ID '"+e+"'");continue}const l=a.every(e=>e.identifier!==r.identifier);l?a.push({containerId:e,identifier:r.identifier}):this.logger.warn("Duplicate product identifier '"+r.identifier+"' found, skipping")}for(const c of a){const e=ComponentFactoryService.createElement({type:r.PRODUCT,useShadowDom:!![],productId:c.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),n=document.getElementById(c.containerId);n?(n.innerHTML="",safeReplaceChildren(n,e),await this.commands.product.createProductInstance(c.identifier,!![])):this.logger.warn("Product ("+c.identifier+") container with ID '"+c.containerId+"' not found")}await this.commands.product.loadMultipleProducts(a.map(e=>e.identifier))}async processInjectElement(e){this.ensureAllComponentsRegistered();const{type:n,containerId:i,...o}=e;if(!i)throw new Error("Container ID is required");if(!n)throw new Error("Component type is required");const a=e.containerId.replace("#",""),c=document.getElementById(a);if(!c)return console.warn("Container with ID '"+a+"' not found"),void 0;c.innerHTML="";const l={type:e.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...o},d=ComponentFactoryService.createElement(l);safeReplaceChildren(c,d),e.type===r.CHECKOUT&&await this.commands.checkout.loadCheckout()}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const e=ComponentFactoryService.createElement({type:r.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(e),this.cartDrawerCreated=!![]}catch(e){this.logger.warn("Failed to create cart drawer:",e)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}isElementsEnabled(){var e;try{const n=this.themeProvider.getConfigs("configurations");return null!==(e=null==n?void 0:n.isElementsEnabled)&&void 0!==e?e:![]}catch(n){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",n),!![]}}injectDisabledElementsError(e,n){const i=document.getElementById(e.replace("#",""));if(!i)return this.logger.warn("Container with ID '"+e+"' 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:n}):componentError({message:"Elements is not enabled.",componentType:n}),i.innerHTML="",safeReplaceChildren(i,o)}registerEssentialComponents(){ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(r.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(r.CART,AddressInputComponent),ComponentFactoryService.registerComponent(r.ADDRESS_INPUT,AddressInputComponent)}registerComponents(){this.componentFactoryInitialized||(ComponentFactoryService.registerComponent(r.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(r.INPUT,InputComponent),ComponentFactoryService.registerComponent(r.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(r.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(r.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(r.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(r.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(r.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(r.ALERT,AlertComponent),ComponentFactoryService.registerComponent(r.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(r.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(r.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(r.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(r.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(r.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(r.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(r.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(r.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(r.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(r.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(r.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(r.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(r.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(r.CART,CartComponent),ComponentFactoryService.registerComponent(r.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(r.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(r.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(r.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(r.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(r.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(r.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(r.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(r.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(r.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_INFORMATION_SECTION,CheckoutInformationSectionComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PAYMENT_FORM,CheckoutPaymentFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BILLING_FORM,CheckoutBillingFormComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_SUMMARY_SECTION,CheckoutSummarySectionComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_DELIVERY_INFORMATION_FORM,CheckoutDeliveryInformationComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_BUYER_INFORMATION_FORM,CheckoutBuyerInformationComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(r.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent))}ensuredIsBuilder(e){return this.clientConfig.isBuilder()?!![]:(this.logger.error("This method ("+e+") is only available in builder mode"),![])}}async function Elements(e,n){try{const o=ClientConfigService.getInstance();o.initialize(e,{env:n.env,isBuilder:n.isBuilder,debugMode:n.debugMode,customTheme:n.customTheme,proxy:n.proxy,promoTicker:n.promoTicker});const r=o.getConfigs();SingletonManager.setClientConstructor(LiquidCommerceElementsClient);const a=await SingletonManager.getClient(r);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};window.elements=c;const l=PubSubService.getInstance();return l.publishAction(i.CLIENT_READY,{isReady:!![],message:"Client Is Ready",timestamp:Date.now(),version:o.get("version")}),c}catch(o){try{const e=LoggerFactory.get("ElementsClientInit");e.error("Elements Client Initialization failed",o)}catch(r){console.error("[LiquidCommerce Elements] Client initialization failed:",null==o?void 0:o.message)}try{const e=ClientConfigService.getInstance(),n=PubSubService.getInstance();n.publishAction(i.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==o?void 0:o.message),timestamp:Date.now(),version:e.get("version")||"unknown"})}catch(a){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}function pairsFromMainScript(e){const n=[];try{const o=e.getAttributeNames().filter(e=>"data-product"===e.substring(0,12));for(const r of o)try{const i=r.match(/^data-product(-(.+))?$/),o=(null==i?void 0:i[2])?"-"+i[2]:"",a="data-container"+o;e.hasAttribute(a)&&n.push({containerId:e.getAttribute(a),identifier:e.getAttribute(r)})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",i)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",o)}return n}function pairsFromProductsScript(){const e=[];try{const i=document.querySelectorAll("script[data-liquid-commerce-elements-products]");for(const o of i)try{const n=JSON.parse(o.textContent||"[]");if(!Array.isArray(n))continue;for(const i of n)i.containerId&&i.identifier&&e.push({containerId:i.containerId,identifier:i.identifier})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",i)}return e}function pairsFromAttributedElements(){const e=[];try{const i=document.querySelectorAll("div[data-lce-product]");for(const o of i)try{const n="lcep-"+(Date.now().toString(36)+Math.random().toString(36).substring(2,15));o.setAttribute("id",n);const i=o.getAttribute("data-lce-product");n&&i&&e.push({containerId:n,identifier:i})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",i)}return e}function startsWithLcePrefix(e){return null!==e&&"lce_"===e.substring(0,4)}async function addProductToCartViaQueryParam(e,n){const i=n.getAttribute("data-product-param"),o=n.getAttribute("data-product-fulfillment-type-param");if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const r=new URLSearchParams(window.location.search),c=r.get(i);if(!c)return;let l=a.SHIPPING;if(o)if(startsWithLcePrefix(o)){const e=r.get(o);e!==a.ON_DEMAND&&e!==a.SHIPPING||(l=e)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+o+'" because it does not start with "lce_" prefix.');try{await e.actions.cart.addProduct([{identifier:c,fulfillmentType:l,quantity:1}],!![])}catch(d){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",d)}}async function addPromoCodeToCartViaQueryParam(e,n){const i=n.getAttribute("data-promo-code-param");if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const o=new URLSearchParams(window.location.search),r=o.get(i);if(r)try{await e.actions.cart.applyPromoCode(r)}catch(a){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",a)}}async function ElementsAutoInitialize(){var e,i,o,r,a,l;try{const l=document.querySelector("script[data-liquid-commerce-elements]");if(!l)return;const m=l.getAttribute("data-token"),f=l.getAttribute("data-env")||n.PRODUCTION,g=l.getAttribute("data-debug-mode");if(!m)throw new Error("Missing API Key (data-token attribute).");const v=l.getAttribute("data-cart-id"),y=l.hasAttribute("data-show-cart-items"),b=l.hasAttribute("data-hide-cart-floating-button"),x=l.getAttribute("data-promo-code"),w=l.getAttribute("data-promo-text"),C=null!==(e=l.getAttribute("data-promo-separator"))&&void 0!==e?e:"•",S=null!==(i=l.getAttribute("data-promo-active-from"))&&void 0!==i?i:void 0,I=null!==(o=l.getAttribute("data-promo-active-until"))&&void 0!==o?o:void 0,P=pairsFromMainScript(l),D=pairsFromProductsScript(),F=pairsFromAttributedElements(),_=[...P,...D,...F],z=x&&w&&S&&I?{promoCode:x,text:w.split("|").map(e=>e.trim()).filter(e=>e.length>0),separator:C,activeFrom:null===(r=new Date(S))||void 0===r?void 0:r.toISOString(),activeUntil:null===(a=new Date(I))||void 0===a?void 0:a.toISOString()}:void 0;let O=c.NONE;g&&f!==n.PRODUCTION&&(O=g);const M=await Elements(m,{env:f,debugMode:O,promoTicker:z?[z]:void 0});if(!M)throw new Error("Failed to initialize client.");if(0!==_.length)try{await M.injectProductElement(_)}catch(d){console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",d)}try{const e=v&&document.getElementById(v.replace("#",""));e?M.ui.cartButton(v,y):b||(M.ui.floatingCartButton(y),v&&console.warn('[LiquidCommerce Elements Auto Initialization] Cart container with ID "'+v+'" not found. Falling back to floating cart button.'))}catch(u){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",u)}try{await addProductToCartViaQueryParam(M,l)}catch(h){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",h)}try{await addPromoCodeToCartViaQueryParam(M,l)}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",p)}}catch(m){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(l=null==m?void 0:m.message)&&void 0!==l?l:String(m))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(R){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",R)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(R){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",R)}},50)}catch(R){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",R)}}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 e=window.onerror;window.onerror=(n,i,o,r,a)=>{var c,l;const d=(null==i?void 0:i.includes("elements"))||(null==i?void 0:i.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 d?(console.error("[LiquidCommerce Elements] Unhandled error:",{message:n,source:i,lineno:o,colno:r,error:a}),!![]):e?e(n,i,o,r,a):![]};const n=window.onunhandledrejection;window.onunhandledrejection=e=>{var i,o,r,a,c,l;const d=(null===(o=null===(i=e.reason)||void 0===i?void 0:i.stack)||void 0===o?void 0:o.includes("LiquidCommerce"))||(null===(a=null===(r=e.reason)||void 0===r?void 0:r.stack)||void 0===a?void 0:a.includes("elements-sdk"))||(null===(l=null===(c=e.reason)||void 0===c?void 0:c.message)||void 0===l?void 0:l.includes("LiquidCommerce"));if(d)return console.error("[LiquidCommerce Elements] Unhandled promise rejection:",e.reason),e.preventDefault(),void 0;n&&n.call(window,e)};try{initializeDOMPolyfills()}catch(wt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",wt)}try{triggerElementsAutoInit()}catch(Ct){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Ct)}}catch(kt){console.error("[LiquidCommerce Elements] SDK initialization failed:",kt)}initializeDOMPolyfills(),window.Elements=Elements,exports.Elements=Elements,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):(n="undefined"!=typeof globalThis?globalThis:n||self,i(n.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...n){for(;this.firstChild;)this.removeChild(this.firstChild);for(const i of n)"string"==typeof i?this.appendChild(document.createTextNode(i)):this.appendChild(i)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...n){const i=document.createDocumentFragment();for(const o of n)"string"==typeof o?i.appendChild(document.createTextNode(o)):i.appendChild(o);this.insertBefore(i,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(...n){const i=this.parentNode;if(!i)return;const o=document.createDocumentFragment();for(const r of n)"string"==typeof r?o.appendChild(document.createTextNode(r)):o.appendChild(r);i.replaceChild(o,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...n){const i=this.parentNode;if(!i)return;const o=document.createDocumentFragment();for(const r of n)"string"==typeof r?o.appendChild(document.createTextNode(r)):o.appendChild(r);i.insertBefore(o,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...n){const i=this.parentNode;if(!i)return;const o=document.createDocumentFragment();for(const r of n)"string"==typeof r?o.appendChild(document.createTextNode(r)):o.appendChild(r);i.insertBefore(o,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=n=>{const i={};for(const[o,r]of n)i[o]=r;return i})}function safeScrollIntoView(n,i){try{i&&"function"==typeof n.scrollIntoView?n.scrollIntoView(i):n.scrollIntoView()}catch(o){try{n.scrollIntoView()}catch(r){console.warn("scrollIntoView failed:",r)}}}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(L){console.warn("DOM polyfills initialization failed:",L)}}function safeReplaceChildren(n,...i){try{if("replaceChildren"in n&&"function"==typeof n.replaceChildren)n.replaceChildren(...i);else{for(;n.firstChild;)n.removeChild(n.firstChild);for(const o of i)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o)}}catch(o){console.error("replaceChildren operation failed:",o),1===i.length&&"string"==typeof i[0]&&(n.innerHTML=i[0])}}class SingletonManager{static getInstances(){return SingletonManager.instances||(SingletonManager.instances=new Map),SingletonManager.instances}constructor(){}static setClientConstructor(n){SingletonManager.clientConstructor=n}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(n,i){const o=SingletonManager.getInstances();o.has(n)||o.set(n,i());const r=o.get(n);if(!r)throw new Error("ElementsSdk: Instance for class "+n+" could not be created.");return r}static async getClient(n){const i=[n.apiKey,n.env,n.isBuilder,n.debugMode].join("_"),o="LiquidCommerceElementsClient_"+i,r=SingletonManager.getInstances();if(r.has(o))return r.get(o);if(!SingletonManager.clientConstructor)throw new Error("LiquidCommerce Elements: Client constructor is not set.");const s=new SingletonManager.clientConstructor(n);return await s.prepare(),r.set(o,s),s}}SingletonManager.instances=null,SingletonManager.clientConstructor=null;class LoggerService{constructor(n){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=n}static getInstance(n){return SingletonManager.getClassInstance("LoggerService_"+n,()=>new LoggerService(n))}setEnableLogging(n){this.enableLogging=n}setTelemetryService(n){this.telemetryService=n}getPrefix(n){if(!this.enableLogging)return[];const i=(new Date).toISOString().slice(11,23);return["%c["+i+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[n],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[n],"color: "+this.colors[n]]}debug(n,i){if(this.sendToTelemetry("debug",n,void 0,i),!this.enableLogging)return;const[o,...r]=this.getPrefix("debug");void 0!==i?console.debug(o,...r,n,i):console.debug(o,...r,n)}info(n,i){if(!this.enableLogging)return;const[o,...r]=this.getPrefix("info");void 0!==i?console.info(o,...r,n,i):console.info(o,...r,n)}warn(n,i){if(this.sendToTelemetry("warn",n,void 0,i),!this.enableLogging)return;const[o,...r]=this.getPrefix("warn");void 0!==i?console.warn(o,...r,n,i):console.warn(o,...r,n)}error(n,i){const o=i instanceof Error,r=o?i:void 0,s=!o&&i?i:void 0;if(this.sendToTelemetry("error",n,r,s),!this.enableLogging)return;const[a,...c]=this.getPrefix("error");void 0!==i?console.error(a,...c,n,i):console.error(a,...c,n)}group(n,i=![]){if(!this.enableLogging)return;const[o,...r]=this.getPrefix("log");i?console.groupCollapsed(o,...r,n):console.group(o,...r,n)}groupEnd(){this.enableLogging&&console.groupEnd()}sendToTelemetry(n,i,o,r){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(n,i,{context:this.context,error:o,data:r})}catch(s){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(n){const i=this.getInstances();if(!i.has(n)){const o=LoggerService.getInstance(n);o.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&o.setTelemetryService(this.telemetryService),i.set(n,o)}return i.get(n)}static setEnableLogging(n){this.enableLoggingGlobally=n;const i=this.getInstances();for(const[,o]of i)o.setEnableLogging(n)}static setTelemetryService(n){this.telemetryService=n;const i=this.getInstances();for(const[,o]of i)o.setTelemetryService(n)}}var n;LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null,function(n){n.CLOSED="CLOSED",n.OPEN="OPEN",n.HALF_OPEN="HALF_OPEN"}(n||(n={}));class CircuitBreakerService{constructor(i){this.state=n.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:![],...i},this.logger=LoggerFactory.get("CircuitBreaker")}static getInstance(n){return SingletonManager.getClassInstance("CircuitBreakerService",()=>new CircuitBreakerService(n))}async execute(i,o,r){switch(this.totalCalls++,this.state===n.OPEN&&Date.now()>=this.nextAttemptTime&&this.halfOpenCircuit(o),this.state){case n.OPEN:if(null==r?void 0:r.critical)return this.logger.warn("Critical operation bypassing OPEN circuit breaker",{context:o,failures:this.failures}),this.executeWithTimeout(i,r.critical);if(null==r?void 0:r.fallback)return this.logger.info("Circuit breaker OPEN - using fallback",{context:o}),this.rejectedCalls++,r.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker is OPEN - failing fast",{context:o,failures:this.failures}),new Error("Service unavailable - circuit breaker is open ("+(o||"unknown")+")");case n.HALF_OPEN:if(this.halfOpenCallsInProgress>=this.config.halfOpenMaxCalls){if(null==r?void 0:r.fallback)return this.logger.info("Circuit breaker HALF_OPEN limit reached - using fallback",{context:o}),this.rejectedCalls++,r.fallback();throw this.rejectedCalls++,this.logger.warn("Circuit breaker HALF_OPEN - max calls reached",{context:o,halfOpenCalls:this.halfOpenCallsInProgress,maxCalls:this.config.halfOpenMaxCalls}),new Error("Service unavailable - circuit breaker half-open limit reached ("+(o||"unknown")+")")}this.halfOpenCallsInProgress++}try{const n=await this.executeWithTimeout(i,null==r?void 0:r.critical);return this.onSuccess(o),n}catch(s){throw this.onFailure(s,o),s}}async executeWithFallback(n,i,o,r){return this.execute(n,o,{fallback:i,critical:r})}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===n.CLOSED&&0===this.failures}}reset(){this.state=n.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(n){this.openCircuit(n)}forceClose(i){this.state=n.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker manually closed",{context:i})}async executeWithTimeout(n,i){const o=i?2*this.config.timeout:this.config.timeout;return new Promise((i,r)=>{const s=setTimeout(()=>{r(new Error("Request timeout after "+o+"ms"))},o);n().then(n=>{clearTimeout(s),i(n)}).catch(n=>{clearTimeout(s),r(n)})})}onSuccess(i){this.lastSuccessTime=Date.now(),this.state===n.HALF_OPEN?(this.halfOpenCallsInProgress--,this.successes++,this.successes>=this.config.successThreshold&&this.closeCircuit(i)):this.state===n.CLOSED&&(this.successes++,this.failures=0),this.logger.debug("Circuit breaker success",{context:i,state:this.state,successes:this.successes,failures:this.failures})}onFailure(i,o){const r=(null==i?void 0:i.status)&&i.status>=400&&i.status<500;if(r&&!this.config.countClientErrorsAsFailures)return this.logger.debug("Client error (4xx) - not counting as circuit breaker failure",{context:o,status:i.status,message:i.message}),void 0;this.lastFailureTime=Date.now(),this.failures++,this.state===n.HALF_OPEN&&(this.halfOpenCallsInProgress--,this.openCircuit(o)),this.state===n.CLOSED&&this.failures>=this.config.failureThreshold&&this.openCircuit(o),this.logger.warn("Circuit breaker failure",{context:o,state:this.state,failures:this.failures,error:(null==i?void 0:i.message)||i,status:null==i?void 0:i.status,threshold:this.config.failureThreshold,isClientError:r})}openCircuit(i){this.state=n.OPEN,this.nextAttemptTime=Date.now()+this.config.recoveryTimeout,this.halfOpenCallsInProgress=0,this.logger.error("Circuit breaker OPENED",{context:i,failures:this.failures,threshold:this.config.failureThreshold,nextAttemptTime:new Date(this.nextAttemptTime).toISOString()})}halfOpenCircuit(i){this.state=n.HALF_OPEN,this.halfOpenCallsInProgress=0,this.successes=0,this.logger.info("Circuit breaker HALF_OPEN - testing service recovery",{context:i,maxCalls:this.config.halfOpenMaxCalls,successThreshold:this.config.successThreshold})}closeCircuit(i){this.state=n.CLOSED,this.failures=0,this.halfOpenCallsInProgress=0,this.nextAttemptTime=0,this.logger.info("Circuit breaker CLOSED - service recovered",{context:i,totalRecoveryTime:this.lastFailureTime?Date.now()-this.lastFailureTime:0})}}const i={LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},o={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"},r={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={[i.LOCAL]:"http://127.0.0.1:8080",[i.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[i.STAGING]:"https://staging-elements.liquidcommerce.us",[i.PRODUCTION]:"https://elements.liquidcommerce.us"},u={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(n,i={}){this.validateInputs(n,i),this.config=Object.freeze(this.buildConfiguration(n,i))}getConfigs(){return{...this.config}}get(n){return this.config[n]}set(n,i){if(!this.config)throw new Error("ClientConfigService is not initialized. Please call initialize() first.");this.config=Object.freeze({...this.config,[n]:i})}isDevelopment(){return this.get("env")===i.DEVELOPMENT}isStaging(){return this.get("env")===i.STAGING}isProduction(){return this.get("env")===i.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const n=this.get("debugMode");return n===c.CONSOLE||n===c.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===c.PANEL}debuggingDisabled(){const n=this.get("debugMode");return n===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(n,o){if(!(null==n?void 0:n.trim()))throw new Error("API key is required");if(o.env&&!Object.values(i).includes(o.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+o.env+'". Using default environment.'),o.env=void 0),void 0!==o.isBuilder&&"boolean"!=typeof o.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),o.isBuilder=void 0),void 0===o.debugMode||Object.values(c).includes(o.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+o.debugMode+'". Must be one of: '+Object.values(c).join(", ")+". Using default value."),o.debugMode=void 0),o.promoTicker&&"object"!=typeof o.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),o.promoTicker=void 0),o.promoTicker)if(Array.isArray(o.promoTicker)){const n=o.promoTicker.filter((n,i)=>{if("string"!=typeof n.promoCode||!n.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(n.text)||0===n.text.length||!n.text.every(n=>"string"==typeof n&&n.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof n.separator||!n.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!n.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom is required. Skipping this promo."),![];const o="string"==typeof n.activeFrom?new Date(n.activeFrom):n.activeFrom;if(!(o instanceof Date)||Number.isNaN(o.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!n.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeUntil is required. Skipping this promo."),![];const r="string"==typeof n.activeUntil?new Date(n.activeUntil):n.activeUntil;return r instanceof Date&&!Number.isNaN(r.getTime())?o>=r?(console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});o.promoTicker=n.length>0?n:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),o.promoTicker=void 0;o.proxy&&("object"!=typeof o.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),o.proxy=void 0):o.proxy.baseUrl&&"string"==typeof o.proxy.baseUrl?o.proxy.headers&&"object"!=typeof o.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),o.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),o.proxy=void 0))}buildConfiguration(n,o){var r,s;const a=o.env||i.STAGING,u=l[a];return{apiKey:n.trim(),env:a,isBuilder:null!==(r=o.isBuilder)&&void 0!==r?r:![],debugMode:null!==(s=o.debugMode)&&void 0!==s?s:c.NONE,baseUrl:u,partnerCode:void 0,customTheme:o.customTheme||null,proxy:o.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:o.promoTicker||null}}detectDeviceType(){var n,i;if("undefined"==typeof navigator)return"desktop";const o=navigator.userAgent.toLowerCase(),r="ontouchstart"in window||navigator.maxTouchPoints>0,s=(null===(n=window.screen)||void 0===n?void 0:n.width)||0,a=(null===(i=window.screen)||void 0===i?void 0:i.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/],u=[/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(n=>n.test(o))?"tablet":u.some(n=>n.test(o))||r&&c<768?"mobile":r&&c>=768&&c<=1200||r&&/macintosh/i.test(o)&&navigator.maxTouchPoints>1||/android/i.test(o)&&r&&c>=768||/windows nt/i.test(o)&&r&&c>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(o),"desktop")}}function fetchAdapter(n){return async(i,o)=>{var r;const s=await n(i,o);let a;if("function"==typeof(null===(r=s.headers)||void 0===r?void 0:r.entries))a=Object.fromEntries(s.headers.entries());else{a={};for(const[n,i]of s.headers)a[n]=i}return{ok:s.ok,status:s.status,statusText:s.statusText,headers:a,json:()=>s.json(),text:()=>s.text()}}}const xhrFetch=(n,i)=>new Promise((o,r)=>{const s=new XMLHttpRequest;s.open(i.method||"GET",n);for(const[n,a]of objectEntries(i.headers))s.setRequestHeader(n,a);s.onload=()=>{o({ok:s.status>=200&&s.status<300,status:s.status,statusText:s.statusText,headers:s.getAllResponseHeaders().split("\r\n").reduce((n,i)=>{const[o,r]=i.split(": ");return o&&r&&(n[o]=r),n},{}),json:()=>Promise.resolve(JSON.parse(s.responseText)),text:()=>Promise.resolve(s.responseText)})},s.onerror=()=>{r(new TypeError("Network request failed"))},s.send(i.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(n){const i=[];for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.push(n[o]);return i}function objectEntries(n){const i=[];for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.push([o,n[o]]);return i}class AuthService{constructor(n){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=n.apiKey,this.baseUrl=n.baseUrl,this.env=n.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(n){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(n))}async authenticate(){var n,i;if(this.isAuthenticating)return await new Promise(n=>{const q=()=>{this.isAuthenticating?setTimeout(q,100):n(void 0)};q()}),!!this.accessToken;this.isAuthenticating=!![];try{const o=await this.requestWithoutAuth("/auth",{method:"GET"},!![]);return this.accessToken=null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.token,this.tokenExpiration=Date.now()+1e3*(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.exp),!![]}catch(o){return this.logger.error("Authentication failed",o),![]}finally{this.isAuthenticating=![]}}async requestWithoutAuth(n,i,o=![]){return this.circuitBreaker.execute(async()=>{const o=this.buildUrl(n),r={"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(),...i.headers};this.clientConfig.isBuilder()&&(r["X-Liquid-Api-Builder"]=!![]);const s={method:i.method,headers:r,body:i.body?JSON.stringify(i.body):void 0},a=await this.httpClient(o,s);if(!a.ok)throw{message:"HTTP error status: "+a.status,status:a.status};return a.json()},i.method+" "+n+" (no-auth)",{critical:o})}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(n,i,o=![]){return this.circuitBreaker.execute(async()=>{this.accessToken&&!this.isTokenExpired()||await this.authenticate();const o=this.buildUrl(n),r={"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(),...i.headers};this.clientConfig.isBuilder()&&(r["X-Liquid-Api-Builder"]=!![]);const s={method:i.method,headers:r,body:i.body?JSON.stringify(i.body):void 0},a=await this.httpClient(o,s);let c;try{c=await a.json()}catch(l){const n=await a.text().catch(()=>"HTTP error status: "+a.status);c={message:n||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},i.method+" "+n,{critical:o})}buildUrl(n){const i=this.clientConfig.getProxyConfig();return new URL("api"+n,i?i.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const n=this.clientConfig.getProxyConfig();return n?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...n.headers}:{}}async get(n,i){return this.request(n,{method:"GET",headers:null==i?void 0:i.headers},null==i?void 0:i.critical)}async post(n,i){return this.request(n,{method:"POST",body:null==i?void 0:i.body,headers:null==i?void 0:i.headers},null==i?void 0:i.critical)}async put(n,i){return this.request(n,{method:"PUT",body:null==i?void 0:i.body,headers:null==i?void 0:i.headers},null==i?void 0:i.critical)}async delete(n,i){return this.request(n,{method:"DELETE",headers:null==i?void 0:i.headers},null==i?void 0:i.critical)}}const h="@liquidcommerce/elements-sdk",p="LiquidCommerce Elements SDK",m="UNLICENSED",f="LiquidCommerce Team",g="2.2.0-beta.27",v="https://docs.liquidcommerce.co/elements-sdk",y={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},b={url:"https://github.com/liquidcommerce/elements-sdk/issues"},x="./dist/index.esm.js",w="./umd/elements.js",C="./dist/types/index.d.ts",k="pnpm@10.0.0",S={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},E=["dist","umd","docs","README.md","LICENSE"],T={access:"public",registry:"https://registry.npmjs.org/"},P="module",D=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],_={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"},z=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],O={"@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.0.0","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.8.0","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.52.4","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"},N={node:">=20"},M={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"]},L={name:h,description:p,license:m,author:f,version:g,homepage:v,repository:y,bugs:b,module:x,browser:w,types:C,packageManager:k,exports:S,files:E,publishConfig:T,type:P,sideEffects:D,scripts:_,keywords:z,devDependencies:O,engines:N,pnpm:M};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(n=>{if("loading"!==document.readyState)return n(),void 0;document.addEventListener("DOMContentLoaded",()=>n())})}isGTMAlreadyLoaded(){if("function"==="object".gtag)return!![];const n=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return n.length>0}isContainerLoaded(n){const i=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return i.some(i=>{const o=i.src;return o.includes("id="+n)})}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...n)=>window.dataLayer.push(n),window.dataLayer.push({"gtm.start":Date.now(),event:"gtm.js"}),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(n){return new Promise((i,o)=>{if(this.isContainerLoaded(n))return this.logger.info("GTM container "+n+" already loaded, skipping script injection"),i(),void 0;this.logger.info("Loading GTM container "+n);const r=document.createElement("script");r.src="https://www.googletagmanager.com/gtm.js?id="+n,r.async=!![];const s=setTimeout(()=>o(new Error("GTM script timeout: "+n)),5e3);r.onload=()=>{clearTimeout(s),this.logger.info("GTM container "+n+" loaded successfully"),i()},r.onerror=()=>{clearTimeout(s),o(new Error("GTM script failed: "+n))},document.head.appendChild(r)})}processEventQueue(){const n=Date.now(),i=this.eventQueue.filter(i=>n-i.timestamp<3e4);for(const r of i)try{const n={event:r.eventName,...r.eventData};window.dataLayer.push(n),"function"==="object".gtag&&window.gtag("event",r.eventName,r.eventData),this.logger.debug("Processed queued GTM event: "+r.eventName,{data:r.eventData})}catch(o){this.logger.error("Error processing queued event "+r.methodName,o)}this.eventQueue=[],i.length>0&&this.logger.info("Processed "+i.length+" queued GTM events")}getSendToTargets(){const n=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&(!this.isContainerLoaded(this.liquidCommerceGtmId)&&this.isGTMAlreadyLoaded()||n.push(this.liquidCommerceGtmId)),this.partnerEnableGaTracking&&this.partnerGtmId&&(this.isGTMAlreadyLoaded()||this.isContainerLoaded(this.partnerGtmId))&&n.push(this.partnerGtmId),0===n.length&&this.isGTMAlreadyLoaded()&&this.logger.debug("No specific targets configured, letting GTM route events naturally"),n}async initialize(n){if(this.isInitialized||this.isInitializing)return this.initializationPromise;if(!this.clientConfigService.isBuilder()){this.isInitializing=!![],this.initializationPromise=this.doInitialize(n);try{await this.initializationPromise}catch(i){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",i)}}}async doInitialize(n){if(!(null==n?void 0:n.partnerName)||!(null==n?void 0:n.liquidCommerceGtmId))throw new Error("GTM config missing required fields");if(!n.liquidCommerceEnableGaTracking&&!n.partnerEnableGaTracking)return this.logger.warn("GTM initialization skipped: No tracking enabled"),this.isInitialized=!![],this.isInitializing=![],void 0;await this.waitForDOMReady(),this.partnerName=n.partnerName,this.partnerGtmId=n.partnerGtmId,this.liquidCommerceGtmId=n.liquidCommerceGtmId,this.partnerEnableGaTracking=n.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=n.liquidCommerceEnableGaTracking;const i=this.isGTMAlreadyLoaded();i&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let o=![],r="";if(n.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(n.liquidCommerceGtmId),o=!![],r=i?"GTM integrated with existing setup (Partner GTM detected, LC container: "+n.liquidCommerceGtmId+")":"GTM initialized with container "+n.liquidCommerceGtmId}catch(s){this.logger.error("Failed to load LiquidCommerce GTM container: "+s+". Checking if partner GTM is available.",s)}if(o||(i&&window.dataLayer?(o=!![],r="GTM integrated with existing partner setup"):window.dataLayer&&Array.isArray(window.dataLayer)&&(o=!![],r="GTM initialized with dataLayer (basic functionality available)")),!o)throw this.isInitializing=![],new Error("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(r),this.processEventQueue()}executeEvent(n,i,o){try{if(this.clientConfigService.isBuilder())return;const r=this.getSendToTargets(),s={...o,...r.length>0&&{send_to:r},tenant_source:L.description+" v"+L.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:n,eventName:i,eventData:s,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+i+" (initialization pending)",{data:s}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+i+" skipped: dataLayer not available"),void 0;const a={event:i,...s};window.dataLayer.push(a),"function"==="object".gtag&&window.gtag("event",i,s),this.logger.debug("Sent GTM event: "+i,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:r.length>0?r:"no targeting",data:s})}catch(r){this.logger.error("GTM "+n+" error",r)}}calculateValue(n){const i=n.reduce((n,i)=>n+(i.price||0)*(i.quantity||1),0);return Number.parseFloat(i.toFixed(2))}viewItem(n){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([n]),items:[n]})}viewItemList(n,i,o){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:i,item_list_name:o,items:n})}selectItem(n,i,o){this.executeEvent("selectItem","select_item",{item_list_id:i,item_list_name:o,items:[n]})}addToCart(n){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([n]),quantity:n.quantity||1,items:[n]})}viewCart(n){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(n),items:n})}removeFromCart(n){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([n]),items:[n]})}beginCheckout(n,i){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(n),coupon:i,items:n})}addShippingInfo(n,i){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(n),coupon:i,items:n})}addShippingInfoWithCustomerData(n,i,o,r){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:n,coupon:i,phone:null==o?void 0:o.phone,email:null==o?void 0:o.email,birth_date:null==o?void 0:o.birth_date,customer_id:null==o?void 0:o.customer_id,subtotal:null==r?void 0:r.subtotal,total:null==r?void 0:r.total_before_discounts,discounts:null==r?void 0:r.discounts,gift_cards:null==r?void 0:r.gift_cards,net_total:null==r?void 0:r.net_total})}addPaymentInfo(n,i,o){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(n),payment_type:i,coupon:o,items:n})}addPaymentInfoWithoutItems(n,i,o,r){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:n,payment_type:i,coupon:o,subtotal:null==r?void 0:r.subtotal,total:null==r?void 0:r.total_before_discounts,discounts:null==r?void 0:r.discounts,gift_cards:null==r?void 0:r.gift_cards,net_total:null==r?void 0:r.net_total})}purchase(n){this.executeEvent("purchase","purchase",{transaction_id:n.transaction_id,value:n.value,currency:this.currency,tax:n.tax,shipping:n.shipping,coupon:n.coupon,items:n.items,subtotal:n.subtotal,total:n.total_before_discounts,discounts:n.discounts,gift_cards:n.gift_cards,net_total:n.net_total})}promoCodeAttempt(n){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:n})}promoCodeApplied(n,i){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:n,discount_amount:i})}promoCodeFailed(n,i){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:n,reason:i})}giftCardAttempt(n){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:n})}giftCardApplied(n,i){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:n,applied_amount:i})}giftCardFailed(n,i){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:n,reason:i})}increaseQuantity(n){this.executeEvent("increaseQuantity","add_to_cart",{currency:this.currency,value:this.calculateValue([n]),items:[n]})}decreaseQuantity(n){this.executeEvent("decreaseQuantity","remove_from_cart",{currency:this.currency,value:this.calculateValue([n]),items:[n]})}addressUpdated(n){this.executeEvent("addressUpdated","address_updated",{address_id:n.googlePlacesId,formatted_address:n.formattedAddress,address:n.address,coordinates:n.coordinates})}addressFailed(n){this.executeEvent("addressFailed","address_failed",{address_id:n.googlePlacesId,formatted_address:n.formattedAddress,address:n.address,address_error_message:n.error})}productNoAvailability(n){this.executeEvent("productNoAvailability","product_no_availability",{product_id:n.productId,product_name:n.productName,product_brand:n.productBrand,product_category:n.productCategory,product_category2:n.productCategory2,product_category3:n.productCategory3,product_type:n.productType,product_subtype:n.productSubtype,product_price:n.productPrice,upc:n.upc,grouping_id:n.groupingId,address:n.address,availability_reason:n.reason})}productSizeNoAvailability(n){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:n.productId,product_name:n.productName,product_brand:n.productBrand,product_category:n.productCategory,product_category2:n.productCategory2,product_category3:n.productCategory3,product_type:n.productType,product_subtype:n.productSubtype,product_price:n.productPrice,size_id:n.sizeId,size_name:n.sizeName,upc:n.upc,grouping_id:n.groupingId,address:n.address,availability_reason:n.reason})}productFulfillmentNoAvailability(n){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:n.productId,product_name:n.productName,product_brand:n.productBrand,product_category:n.productCategory,product_category2:n.productCategory2,product_category3:n.productCategory3,product_type:n.productType,product_subtype:n.productSubtype,product_price:n.productPrice,size_id:n.sizeId,size_name:n.sizeName,fulfillment_type:n.fulfillmentType,upc:n.upc,grouping_id:n.groupingId,address:n.address,availability_reason:n.reason})}}class PubSubService{constructor(){this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub")}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(n,i){this.publishSpecific("actions."+n,i)}publishForm(n,i){this.publishSpecific("forms."+n,i)}publishSpecific(n,i){const[o,r]=n.includes(".")?n.split(".",2):["actions",n];let s=r.split("_")[0];["product","cart","address","checkout"].includes(s)||(s="other");const a=Date.now(),c={eventId:this.generateEventId(a),namespace:o,event:r,originalEvent:n,actionNamespace:"actions"===o?s:void 0,timestamp:a},l={data:i,metadata:c};this.dispatchNativeEvents(n,l)}dispatchNativeEvents(n,i){const[o]=n.split(".",2);try{const r=new CustomEvent(this.eventPrefix+":"+n,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(r);const s=new CustomEvent(this.eventPrefix+":"+o,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(s)}catch(r){this.logger.error("Error dispatching native events for "+n,r)}}generateEventId(n){return"evt_"+n+"_"+Math.random().toString(36).slice(2,9)}}const R="liquid_elements",j={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:a.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,drawer:{isOpen:![],contentConfig:null},rerender:![],mainImage:null},G={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee:0,deliveryFee:0,discounts:0,quantity:0},promoCode:null,fulfillments:{},rerender:![],shouldReset:![],updatedAt:"",createdAt:"",events:[]},U={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:[]},H={drawer:{isOpen:![],contentConfig:null}},V={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},Y={products:{},cart:G,address:V,checkout:U,ui:H};class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(n){this.client=n}async getAllConfigs(){try{this.ensureClientInitialized();const n=await this.client.get("/configs",{critical:!![]});if(!this.validResponseData(n))throw this.logger.error("Invalid response data",n),new Error("Failed to fetch all configs: Invalid response data");return n.data}catch(n){throw this.logger.error("Error fetching configs",n),n}}async setPersistedStore(n,i){try{if(this.ensureClientInitialized(),!n)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!i||0===Object.keys(i).length)return this.logger.error("No data provided to set persisted store"),void 0;const o=await this.client.post("/configs/store/"+n,{body:i});200!==o.statusCode&&this.logger.error("Failed to set persisted store",o)}catch(o){this.logger.error("Error setting persisted store",o)}}async getPersistedStore(n){try{if(this.ensureClientInitialized(),!n)return this.logger.error("User device ID is required to get persisted store"),null;const i=await this.client.get("/configs/store/"+n);return 200!==i.statusCode?(this.logger.error("Failed to fetch persisted store",i),null):i.data}catch(i){return this.logger.error("Error fetching persisted store",i),null}}async getProductsData(n,i){try{if(this.ensureClientInitialized(),0===n.length)return this.logger.error("No product identifiers provided"),null;const o={upcs:n,ids:n,grouping:n,shouldShowOffHours:!![],isLegacy:!![],loc:i},r=await this.client.post("/cloud/catalog/availability",{body:o});return 200===r.statusCode&&r.products&&0!==r.products.length?{products:r.products,retailers:r.retailers}:(this.logger.error("Failed to fetch product data",r),null)}catch(o){return this.logger.error("Error fetching product data",o),null}}async getCartData(n){try{this.ensureClientInitialized();const i=await this.client.get("/cloud/cart"+(n?"?id="+n:""));if(200!==i.statusCode)throw this.logger.error("Failed to fetch cart data",i),new Error("Failed to fetch cart data: "+i.message);return i.cart}catch(i){throw this.logger.error("Error fetching cart data",i),i}}async updateCart(n){try{this.ensureClientInitialized();const i=await this.client.put("/cloud/cart",{body:n});if(200!==i.statusCode)throw this.logger.error("Failed to update cart",i),new Error("Failed to update cart: "+i.message);return i.cart}catch(i){throw this.logger.error("Error updating cart",i),i}}async getAddressSuggestions(n){try{if(this.ensureClientInitialized(),!n||0===n.trim().length)return this.logger.error("Query is required to fetch address suggestions"),[];const i=await this.client.get("/cloud/address/autocomplete?input="+n);return 200!==i.statusCode?(this.logger.error("Failed to fetch address suggestions",i),[]):i.data}catch(i){return this.logger.error("Error fetching address suggestions",i),[]}}async getAddressDetails(n){try{if(this.ensureClientInitialized(),!n||0===n.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 i=await this.client.get("/cloud/address/details/"+n);if(200!==i.statusCode)throw this.logger.error("Failed to fetch address details",i),new Error("Failed to fetch address details: "+i.message);return i.data}catch(i){throw this.logger.error("Error fetching address details",i),i}}async prepareCheckout(n){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/checkout/prepare",{body:n,critical:!![]});if(200!==i.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",i),new Error("Failed to fetch prepare checkout data: "+i.message);return i.checkout}catch(o){throw this.logger.error("Error fetching prepare checkout data:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),o}}async getPaymentSession(n){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/payment/session",{body:n,critical:!![]});if(201!==i.statusCode)throw this.logger.error("Failed to get payment session",i),new Error("Failed to get payment session: "+i.message);return i.data}catch(o){throw this.logger.error("Error fetching payment session:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),o}}async confirmPaymentSession(n,i){try{this.ensureClientInitialized();const o=await this.client.post("/cloud/payment/confirm",{body:{confirmationTokenId:n,setupIntentId:i},critical:!![]});if(200!==o.statusCode)throw this.logger.error("Failed to confirm payment session",o),new Error("Failed to confirm payment session: "+o.message);return o.data}catch(o){throw this.logger.error("Error confirming payment session",o),o}}async checkoutComplete(n){var i;try{this.ensureClientInitialized();const i=await this.client.post("/cloud/checkout/complete",{body:n,critical:!![]});if(200!==i.statusCode)throw this.logger.error("Failed to complete checkout",i),new Error("Failed to complete checkout: "+i.message);return i.order}catch(o){if(this.logger.error("Error completing checkout:",null!==(i=null==o?void 0:o.message)&&void 0!==i?i:o),null==o?void 0:o.error)throw new Error(o.error);throw o}}validResponseData(n){return n.data&&"object"==typeof n.data&&Object.keys(n.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:n,payload:i,next:o})=>{const r=performance.now();this.logger.group("🏪 Store "+n+" ---------------------------------"),this.logger.debug("Payload:",i);try{const n=o(),i=performance.now()-r;return this.logger.debug("Completed in "+i.toFixed(3)+"ms"),n}catch(s){throw this.logger.error('Error during store action "'+n+'"',s),s}finally{this.logger.groupEnd()}},this.performanceMiddleware=({action:n,next:i})=>{const o=performance.now(),r=i(),s=performance.now()-o;return s>16&&this.logger.warn('⚠️ Slow store operation "'+n+'": '+s.toFixed(2)+"ms"),r},this.state=Y,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:n,isLocalStorageAvailable:i,persistedStore:o}){this.localStorageKey=R+"_"+n,this.isLocalStorageAvailable=i,i?await this.loadPersistedState():o&&await this.loadFromDBPersistence(o),this.addBeforeUnloadHandler(),this.logger.info("Store service initialized successfully",{userDeviceId:n,isLocalStorageAvailable:i,hasPersistedState:null!==o,localStorageKey:this.localStorageKey})}get(n){if(!n)return{...this.state};const i=n.split(".");let o=this.state;for(const r of i){if(null==o)return;o=o[r]}return void 0!==o?Array.isArray(o)?[...o]:"object"==typeof o&&null!==o?{...o}:o:void 0}set(n,i){return this.runWithMiddleware("set",{path:n,value:i},()=>{const o=this.get(n);return this.state=this.immutableSet(this.state,n,i),this.notifyListeners(n,i,o),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(n,i){const o=this.get(n),r=i(o);return this.set(n,r)}remove(n){return this.runWithMiddleware("remove",{path:n},()=>{const i=this.get(n);if(void 0===i)return this.logger.warn('No value found at path "'+n+'" to remove.'),![];const o=n.split(".");let r=this.state;const s=o.pop();for(const a of o){if(void 0===r[a])return this.logger.warn('Path "'+n+'" does not exist in the state.'),![];r=r[a]}if(Array.isArray(r))r=r.filter((n,i)=>i!==Number.parseInt(s,10));else{if("object"!=typeof r||null===r)return this.logger.warn('Cannot remove property "'+s+'" from non-object type at path "'+n+'".'),![];{const{[s]:n,...i}=r;r=i}}return this.state=this.immutableSet(this.state,o.join("."),r),this.notifyListeners(n,void 0,i),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(n){return this.runWithMiddleware("batch",{updates:n},()=>{const i=[];if("function"==typeof n){const o=n(this.state);for(const[n,r]of Object.entries(o)){const o=this.get(n);i.push({path:n,oldValue:o,newValue:r,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,r)}}else for(const[o,r]of Object.entries(n)){const n=this.get(o);i.push({path:o,oldValue:n,newValue:r,timestamp:Date.now()}),this.state=this.immutableSet(this.state,o,r)}for(const{path:n,oldValue:o,newValue:r}of i)this.notifyListeners(n,r,o);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(n,i){const o=n;return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(i),()=>{var n;null===(n=this.listeners.get(o))||void 0===n?void 0:n.delete(i)}}watchMany(n,i){const o=[];let r;const s=n.map(n=>this.watch(n,(s,a)=>{o.push({path:n,value:s,oldValue:a}),clearTimeout(r),r=setTimeout(()=>{o.length>0&&(i([...o]),o.length=0)},0)}));return()=>{for(const n of s)n()}}createProductInstance(n){const i="products."+n,o=this.get(i);return o?!![]:this.set(i,j)}removeProductInstance(n){const i=this.get("products"),{[n]:o,...r}=i;return this.set("products",r)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(n,i,o){let r=0;const e=()=>{if(r>=this.middleware.length)return o();const s=this.middleware[r++];return s({action:n,payload:i,state:this.getState(),next:e})};return e()}immutableSet(n,i,o){const r=i.split(".");if(1===r.length){if(Array.isArray(n)){const i=[...n];return i[r[0]]=o,i}return{...n,[r[0]]:o}}const[s,...a]=r,c=n[s],l=Array.isArray(c)?[]:{};if(Array.isArray(n)){const i=[...n];return i[s]=this.immutableSet(c||l,a.join("."),o),i}return{...n,[s]:this.immutableSet(c||l,a.join("."),o)}}notifyListeners(n,i,o){const r=this.listeners.get(n);if(r)for(const l of r)try{l(i,o)}catch(a){this.logger.error('Error in store listener for path "'+n+'"',a)}const s=n.split(".");for(let l=s.length-1;l>0;l--){const n=s.slice(0,l).join("."),i=this.listeners.get(n);if(i){const r=this.get(n),a=s.slice(l).join("."),u=this.immutableSet(r,a,o);for(const o of i)try{o(r,u)}catch(c){this.logger.error('Error in store listener for parent path "'+n+'"',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 n;const i=this.get("address.id")||"",o=this.get("cart.id")||"";if(!i&&!o)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:i,cartId:o}),void 0;try{const r=null!==(n=this.clientConfig.get("userDeviceId"))&&void 0!==n?n:"not_defined";await this.api.setPersistedStore(r,{p:i,c:o}),this.logger.info("Session data persisted to DB",{userDeviceId:r,addressId:i,cartId:o})}catch(r){this.logger.error("Failed to persist session data to DB",r)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let n="";if(this.clientConfig.debuggingDisabled()){const i=this.get("address.id")||"",o=this.get("cart.id")||"";(i||o)&&(n=i+"_"+o)}else n=this.getState();n&&localStorage.setItem(this.localStorageKey,"string"!=typeof n?JSON.stringify(n):n)}catch(n){this.logger.error("Failed to persist store state",n)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const i=localStorage.getItem(this.localStorageKey);if(!i)return;try{const n=JSON.parse(i);for(const[i,o]of Object.entries(n))this.set(i,o);return}catch(n){if(i.includes("_")){const[n,o]=i.split("_");if(void 0!==n){const i=await this.getAddressDataFromId(n);this.set("address",i)}return void 0!==o&&this.set("cart.id",o||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:i})}}catch(i){this.logger.error("Failed to load persisted state",i),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(n){try{if(void 0!==n.p){const i=await this.getAddressDataFromId(n.p);this.set("address",i)}void 0!==n.c&&this.set("cart.id",n.c||null),this.logger.info("Session data loaded from DB persistence",{addressId:n.p,cartId:n.c})}catch(i){this.logger.error("Failed to load session data from DB persistence",i)}}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(n){if(!n||""===n.trim())return V;try{const i=await this.api.getAddressDetails(n);return i&&0!==Object.keys(i).length?{id:n,formattedAddress:i.formattedAddress,address:{one:i.address.one,two:i.address.two,city:i.address.city,state:i.address.state,zip:i.address.zip,country:i.address.country||""},coordinates:{lat:i.coords.lat,long:i.coords.long}}:{...V,id:n}}catch(i){return{...V,id:n}}}}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 n=this.store.get("address");if(n.address.one&&n.coordinates.long&&n.coordinates.lat)return{coords:n.coordinates,address:n.address}}}const includeCartEvents=(n,i)=>n.filter(n=>i.includes(n.type)),excludeCartEvents=(n,i)=>n.filter(n=>!i.includes(n.type)),eventsForCart=n=>excludeCartEvents(n,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=n=>{const i=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],o=includeCartEvents(n,i);return o.length>0},includeCheckoutEvents=(n,i)=>n.filter(n=>i.includes(n.type)),eventsForCheckout=n=>includeCheckoutEvents(n,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=n=>includeCheckoutEvents(n,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=n=>includeCheckoutEvents(n,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=n=>{const i=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return n.some(n=>i.includes(n.type))},W={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"},Q={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=n=>n.map(n=>({type:n.type,message:n.message,level:W[n.type]||"error"})),transformCheckoutEventsRaw=n=>n.map(n=>({type:n.type,message:n.message,level:Q[n.type]||"error"})),transformEventsForCart=n=>{const i=eventsForCart(n);return transformCartEventsRaw(i)},transformEventsForCheckout=n=>{const i=eventsForCheckout(n);return transformCheckoutEventsRaw(i)},transformPromoCodeCheckoutEvents=n=>{const i=promoCodeCheckoutEvents(n);return transformCheckoutEventsRaw(i)},transformGiftCardCheckoutEvents=n=>{const i=giftCardCheckoutEvents(n);return transformCheckoutEventsRaw(i)};function buildCartItemStore(n){return{id:n.id,variantId:n.variantId,liquidId:n.liquidId,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,salsifyGrouping:n.salsifyGrouping,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price,quantity:n.quantity,maxQuantity:n.maxQuantity,unitPrice:n.unitPrice,mainImage:n.mainImage,attributes:n.attributes,loading:![],updating:![],error:null}}function buildCartTotals(n){return{subtotal:n.subtotal||0,total:n.total||0,shippingFee:n.shippingFee||0,platformFee:n.platformFee||0,engravingFee:n.engravingFee||0,deliveryFee:n.deliveryFee||0,discounts:n.discounts||0,quantity:n.quantity||0}}function buildRetailerStore(n){var i;return{id:n.id,name:n.name,platformFee:n.platformFee||0,shippingFee:n.shippingFee||0,subtotal:n.subtotal||0,address:n.address,total:n.total||0,deliveryFee:n.deliveryFee||0,engravingFee:n.engravingFee||0,fulfillments:(null===(i=n.fulfillments)||void 0===i?void 0:i.map(n=>n.id))||[]}}function buildFulfillmentStore(n,i){return{id:n.id,canEngrave:n.canEngrave||![],type:n.type,fees:n.fees,expectation:n.expectation,shippingFee:n.shippingFee||0,subtotal:n.subtotal||0,engravingFee:n.engravingFee||0,deliveryFee:n.deliveryFee||0,items:n.items||[],retailerId:i.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(n,i){var o;const r=i.formattedAddress?i:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},s={};for(const a in n.items||{}){const i=n.items[a];s[a]={id:i.id,variantId:i.variantId,liquidId:i.liquidId,retailerId:i.retailerId,partNumber:i.partNumber,fulfillmentId:i.fulfillmentId,upc:i.upc,sku:i.sku,salsifyGrouping:i.salsifyGrouping,catPath:i.catPath,volume:i.volume,uom:i.uom,pack:i.pack,packDesc:i.packDesc,container:i.container,containerType:i.containerType,name:i.name,brand:i.brand,size:i.size,price:i.price||0,quantity:i.quantity||0,maxQuantity:i.maxQuantity||0,unitPrice:i.unitPrice||0,mainImage:i.mainImage||"",attributes:i.attributes||{}}}return{id:n.id,promoCode:(null===(o=n.promoCode)||void 0===o?void 0:o.code)||"",items:s,location:{placesId:r.id,address:{one:r.address.one,two:r.address.two,city:r.address.city,state:r.address.state,zip:r.address.zip,country:r.address.country},coordinates:{latitude:r.coordinates.lat,longitude:r.coordinates.long}},amounts:{deliveryFee:n.totals.deliveryFee,discounts:n.totals.discounts,engravingFee:n.totals.engravingFee,giftCardTotal:0,platformFee:n.totals.platformFee,shippingFee:n.totals.shippingFee,subtotal:n.totals.subtotal,total:n.totals.total},updatedAt:n.updatedAt,createdAt:n.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(n,i=![]){var r,s,a,c,l,u;const h=this.store.get("cart");for(const o of Object.keys(h.items||{}))this.store.remove("cart.items."+o);for(const o of Object.keys(h.retailers||{}))this.store.remove("cart.retailers."+o);for(const o of Object.keys(h.fulfillments||{}))this.store.remove("cart.fulfillments."+o);const p={"cart.id":n.id,"cart.error":null,"cart.totals":buildCartTotals(n),"cart.updatedAt":n.updatedAt||(new Date).toISOString(),"cart.createdAt":n.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(s=null===(r=n.attributes)||void 0===r?void 0:r.promoCode)||void 0===s?void 0:s.value)?{code:n.attributes.promoCode.value.toUpperCase(),discountAmount:n.attributes.promoCode.discount||0,error:null}:null};if((null===(a=n.items)||void 0===a?void 0:a.length)>0)for(const o of n.items)p["cart.items."+o.id]=buildCartItemStore(o);if((null===(c=n.retailers)||void 0===c?void 0:c.length)>0)for(const o of n.retailers)if(p["cart.retailers."+o.id]=buildRetailerStore(o),(null===(l=o.fulfillments)||void 0===l?void 0:l.length)>0)for(const n of o.fulfillments)p["cart.fulfillments."+n.id]=buildFulfillmentStore(n,o);if((null===(u=n.events)||void 0===u?void 0:u.length)>0&&(p["cart.events"]=transformEventsForCart(n.events||[])),this.store.batch(p),i){const n=this.store.get("cart"),i=this.store.get("address");this.pubSub.publishAction(o.CART_LOADED,cartDataForEventFromStore(n,i))}}async loadCart(){try{this.store.set("cart.loading",!![]);const n=this.store.get("cart"),i=await this.api.getCartData(n.id);this.syncCartFromResponse(i,!![]),i.id!==n.id&&await this.store.persist()}catch(n){throw this.store.set("cart.error",(null==n?void 0:n.message)||"Failed to load cart"),this.logger.error("Load cart failed",n),n}finally{this.store.set("cart.loading",![])}}}const X="lce-checkout-stripe-slot",Z={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},$={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},J={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};function centToDollar(n){return n/100}function formatCentToDollarText(n,i=!![]){const o=Math.floor(n/100),r=n%100;let s="$"+o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(i||r>0)&&(s+=".",s+=r<10?"0"+r:r.toString()),s}function htmlStringToElement(n){const i=document.createElement("template");return i.innerHTML=n.trim(),i.content.firstElementChild}function format24TimeTo12$1(n){const i=n.match(/^(\d{1,2}):(\d{2})$/);if(!i)throw new Error("Invalid time format: "+n);const o=Number.parseInt(i[1],10),r=Number.parseInt(i[2],10);if(o<0||o>23||r<0||r>59)throw new Error("Invalid time values: "+n);const s=o>=12?"PM":"AM",a=o%12||12;return a+":"+r.toString().padStart(2,"0")+" "+s}function formatISODateToMMDDYYYY(n){if(!n)return"";try{const i=new Date(n);if(Number.isNaN(i.getTime()))return"";const o=(i.getMonth()+1).toString().padStart(2,"0"),r=i.getDate().toString().padStart(2,"0"),s=i.getFullYear().toString();return o+"/"+r+"/"+s}catch(i){return""}}function validateMinimumAge(n,i=21,o=1930){if(!n)return{isValid:![],age:null,error:"Birth date is required"};try{const r=n instanceof Date?n:new Date(n);if(Number.isNaN(r.getTime()))return{isValid:![],age:null,error:"Invalid date format"};const s=new Date;if(r>s)return{isValid:![],age:null,error:"Birth date cannot be in the future"};const a=r.getFullYear();if(a<o)return{isValid:![],age:null,error:"Birth year cannot be before "+o+". Please check your birth date."};const c=calculateAge(r,s);return c<i?{isValid:![],age:c,error:"Must be at least "+i+" years old"}:{isValid:!![],age:c}}catch(r){return{isValid:![],age:null,error:"Error processing birth date"}}}function calculateAge(n,i){let o=i.getFullYear()-n.getFullYear();const r=i.getMonth()-n.getMonth();return(r<0||0===r&&i.getDate()<n.getDate())&&o--,Math.max(0,o)}function buildFormattedAddressString(n){const i=[],o=[];n.one&&n.one.trim()&&o.push(n.one.trim()),n.two&&n.two.trim()&&o.push(n.two.trim()),o.length>0&&i.push(o.join(" ")),n.city&&n.city.trim()&&i.push(n.city.trim());const r=[];return n.state&&n.state.trim()&&r.push(n.state.trim()),n.zip&&n.zip.trim()&&r.push(n.zip.trim()),r.length>0&&i.push(r.join(" ")),n.country&&n.country.trim()&&i.push(n.country.trim()),i.join(", ")}function capitalizeFirstLetter(n){return n?n.toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.substring(1)).join(" "):n}function splitCategoryPath(n){const i=(null==n?void 0:n.split(" > ").map(n=>capitalizeFirstLetter(n.trim())))||[];return{category:i[0]||"",category2:i[1]||"",category3:i[2]||""}}function validateCustomerInfo(n){const i=[Z.firstName,Z.lastName,Z.email,Z.phone,Z.birthDate];if(!n)return{isValid:![],invalidFields:i};const o=[];for(const r of i){const i=n[r];if(!i||"string"==typeof i&&""===i.trim())o.push(r);else if("birthDate"===r){const n=validateMinimumAge(i,21,1930);n.isValid||o.push(r)}}return{isValid:0===o.length,invalidFields:o}}function validateGiftRecipientInfo(n){const i=[$.firstName,$.lastName,$.email,$.phone,$.message];if(!n)return{isValid:![],invalidFields:i};const o=[];for(const r of i){const i=n[r];(!i||"string"==typeof i&&""===i.trim())&&o.push(r)}return{isValid:0===o.length,invalidFields:o}}function validateBillingInfo(n){const i=[J.firstName,J.lastName,J.email,J.phone,J.addressOne,J.city,J.state,J.zipCode];if(!n)return{isValid:![],invalidFields:i};const o=[];for(const r of i){const i=n[r];(!i||"string"==typeof i&&""===i.trim())&&o.push(r)}return{isValid:0===o.length,invalidFields:o}}const tt=[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],et=[s.ADDRESS_INPUT,s.ADDRESS_DISPLAY],nt=[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],it=[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];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}]}loadGoogleFonts(n,i="swap"){if(!n||0===n.length)return;const o=[...this.defaultFontFamilies,...n],r=o.map(n=>{const i=encodeURIComponent(n.name);return"family="+i+":wght@"+n.weights.join(";")}).join("&"),s="display="+i;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+r+"&"+s,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(n,i="swap"){const o=document.querySelector("link[data-liquid-fonts]");this.loadGoogleFonts(n,i),o&&o.remove()}injectGoogleFontsResourceHints(){const n=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),i=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!n){const n=document.createElement("link");n.rel="preconnect",n.href="https://fonts.googleapis.com",n.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(n)}if(!i){const n=document.createElement("link");n.rel="preconnect",n.href="https://fonts.gstatic.com",n.crossOrigin="",n.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(n)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const n=document.createElement("link");n.rel="stylesheet",n.href=this.googleFontsUrl,n.setAttribute("data-liquid-fonts",""),document.head.appendChild(n)}}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 }\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: "+u.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 }\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: "+u.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: "+u.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: "+u.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: "+u.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: "+u.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: "+u.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: "+u.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: "+u.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: "+u.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 h3 {\n overflow: hidden;\n color: var(--base-foreground, #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: 100%;\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:last-child, .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: '+u.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: "+u.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 .product-engraving {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-engraving > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .product-engraving .product-info-section,\n .product-engraving .fulfillment-section,\n .product-engraving .personalization-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 .product-engraving .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 .product-engraving .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 .product-engraving .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 .personalization-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 .product-engraving .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 .product-engraving .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .product-engraving .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 .personalization-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .personalization-section .personalization-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 .personalization-section .personalization-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 .personalization-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 .personalization-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 .personalization-input-wrapper .personalization-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 .personalization-input-wrapper .personalization-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 .personalization-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 .personalization-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: "+u.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: "+u.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: "+u.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: "+u.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: "+u.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: "+u.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: "+u.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: "+u.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 ot={"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"},rt={backgroundColor:"--product-background-color"},st={backgroundColor:"--cart-background-color"},at={backgroundColor:"--address-background-color"},ct={backgroundColor:"--checkout-background-color"},lt={global:ot,product:rt,cart:st,address:at,checkout:ct};function getCSSVariableMapping(n){return lt[n]||{}}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(n,i){const o={},r=getCSSVariableMapping(i);for(const[s,a]of Object.entries(r)){const i=this.getValueByPath(n,s);void 0!==i&&this.isCSSValue(i)&&(o[a]=i,this.isColorVariable(a,i)&&this.generateOpacityVariants(o,a,i))}return o}extractVariablesFromPartialTheme(n,i){const o={},r=getCSSVariableMapping(i);for(const[s,a]of Object.entries(r))if(this.hasValueAtPath(n,s)){const i=this.getValueByPath(n,s);void 0!==i&&this.isCSSValue(i)&&(o[a]=i,this.isColorVariable(a,i)&&this.generateOpacityVariants(o,a,i))}return o}generateCSSVariablesString(n){return Object.entries(n).map(([n,i])=>" "+n+": "+i+";").join("\n")}updateCSSVariablesInStylesheet(n,i){if(0!==Object.keys(i).length)try{const o=this.findOrCreateRule(n);for(const[n,r]of Object.entries(i))o.style.setProperty(n,String(r))}catch(o){this.logger.warn("Failed to update CSS variables")}}getValueByPath(n,i){return i.split(".").reduce((n,i)=>n&&void 0!==n[i]?n[i]:void 0,n)}hasValueAtPath(n,i){const o=i.split(".");let r=n;for(const s of o){if(null==r||!(s in r))return![];r=r[s]}return!![]}findOrCreateRule(n){const i=":host";for(const r of Array.from(n.cssRules))if(r instanceof CSSStyleRule&&r.selectorText===i)return r;const o=n.insertRule(i+" {}");return n.cssRules[o]}isCSSValue(n){if("string"==typeof n){if(""===n.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(n.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(n))return!![];if(/^[a-z-]+$/.test(n))return!![]}return"number"==typeof n}generateOpacityVariants(n,i,o){for(const r of this.opacityLevels){const s=i+"-"+r.suffix,a=this.addOpacityToHexColor(o,r.value);a&&(n[s]=a)}}isColorVariable(n,i){if("string"!=typeof i)return![];const o=n.toLowerCase().includes("color"),r=/^#[0-9a-f]{3,8}$/i.test(i);return o&&r}addOpacityToHexColor(n,i){if(!n.startsWith("#"))return null;let o=n.slice(1);if(3===o.length&&(o=o.split("").map(n=>n+n).join("")),6!==o.length)return null;const r=Math.round(255*i),s=r.toString(16).padStart(2,"0");return"#"+o+s}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(n){return this.styleSheets.get(n)}generateSpecificStylesheet(n,i){const o=this.cssProcessor.extractVariablesFromTheme(i,n),r=this.cssProcessor.generateCSSVariablesString(o),s=this.getStylesheetStyles(n).join("\n\n"),a=0===r.length?"":":host { "+r+" }",c=("\n "+a+"\n\n "+s+"\n ").trim();this.createStylesheet(n,c)}createStylesheet(n,i){try{if(this.isCSSStyleSheetSupported()){const o=new CSSStyleSheet;o.replaceSync(i),this.styleSheets.set(n,o)}else this.styleSheets.set(n,i)}catch(L){this.styleSheets.set(n,i)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const n=new CSSStyleSheet;return n.replaceSync("/* test */"),!![]}catch(n){return![]}}updateVariablesInStylesheet(n,i,o){const r=this.styleSheets.get(n);if(r&&"string"!=typeof r){const n=this.cssProcessor.extractVariablesFromPartialTheme(i,o);this.cssProcessor.updateCSSVariablesInStylesheet(r,n)}}getStylesheetStyles(n){switch(n){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(n){this.data=n,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(n){var i,o;const r=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),n),this.data.global.layout.showPoweredBy=r,((null===(i=n.theme)||void 0===i?void 0:i.headingFont)||(null===(o=n.theme)||void 0===o?void 0:o.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",n.theme,"global")}updateProductComponent(n){this.data.product=this.deepMerge(this.getConfigs("product"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",n.theme,"product")}updateAddressComponent(n){this.data.address=this.deepMerge(this.getConfigs("address"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",n.theme,"address")}updateCartComponent(n){this.data.cart=this.deepMerge(this.getConfigs("cart"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",n.theme,"cart")}updateCheckoutComponent(n){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),n),n.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",n.theme,"checkout")}getConfigs(n){return"all"===n?this.data:this.data[n]}getComponentConfig(n){return-1!==tt.indexOf(n)?this.getConfigs("product"):-1!==et.indexOf(n)?this.getConfigs("address"):-1!==nt.indexOf(n)?this.getConfigs("cart"):-1!==it.indexOf(n)?this.getConfigs("checkout"):void 0}getStylesheet(n){const i=this.getBaseStylesheets();if(n===s.DRAWER){const n=[...i],o=this.stylesheetGenerator.getStylesheet("product"),r=this.stylesheetGenerator.getStylesheet("cart"),s=this.stylesheetGenerator.getStylesheet("checkout"),a=this.stylesheetGenerator.getStylesheet("address");return o&&n.push(o),r&&n.push(r),s&&n.push(s),a&&n.push(a),n}let o;if(et.includes(n)||n===s.ADDRESS)o="address";else if(tt.includes(n)||n===s.PRODUCT)o="product";else if(nt.includes(n)||n===s.CART)o="cart";else{if(!it.includes(n)&&n!==s.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+n+", returning base stylesheets only."),i;o="checkout"}const r=this.stylesheetGenerator.getStylesheet(o);return r?[...i,r]:i}getBaseStylesheets(){const n=[],i=this.stylesheetGenerator.getStylesheet("global"),o=this.stylesheetGenerator.getStylesheet("ui");return i&&n.push(i),o&&n.push(o),n}deepMerge(n,i){const o={...n};for(const r in i)null!==i[r]&&void 0!==i[r]&&("object"!=typeof i[r]||Array.isArray(i[r])||"object"!=typeof n[r]||Array.isArray(n[r])?o[r]=i[r]:o[r]=this.deepMerge(n[r],i[r]));return o}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(n,i){const r={type:n,data:i||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:r}),n===s.CART&&this.pubSub.publishAction(o.CART_OPENED,!![]),n===s.CHECKOUT&&this.pubSub.publishAction(o.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const n=this.store.get("ui.drawer.contentConfig");(null==n?void 0:n.type)===s.CART&&this.pubSub.publishAction(o.CART_CLOSED,!![]),(null==n?void 0:n.type)===s.CHECKOUT&&this.pubSub.publishAction(o.CHECKOUT_CLOSED,!![])}}function buildCheckoutItemStore(n,i,o){return{liquidId:n.liquidId,variantId:n.variantId,cartItemId:n.cartItemId,retailerId:n.retailerId,fulfillmentId:n.fulfillmentId,salsifyGrouping:n.salsifyGrouping,name:n.name,catPath:n.catPath,volume:n.volume,uom:n.uom,proof:n.proof,abv:n.abv,containerType:n.containerType,container:n.container,size:n.size,pack:n.pack,packDesc:n.packDesc,mainImage:n.mainImage,brand:n.brand,partNumber:n.partNumber,upc:n.upc,sku:n.sku,price:n.price,unitPrice:n.unitPrice,quantity:n.quantity,unitTax:n.unitTax,bottleDeposits:n.bottleDeposits,attributes:n.attributes,retailerName:i.name,expectationDetail:o.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(n){var i,r,s;try{this.store.set("checkout.loading",!![]);const c=n||this.store.get("cart.id"),l=this.store.get("cart");if(0===(null===(i=Object.values(l.items))||void 0===i?void 0:i.length)&&!n)return;const u=this.themeProvider.getConfigs("checkout"),h={canEmail:u.layout.emailOptIn.checked,canSms:u.layout.smsOptIn.checked};if(!c)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const p={"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:""}},m=await this.api.prepareCheckout({cartId:c,marketingPreferences:h});if((null===(r=m.retailers)||void 0===r?void 0:r.length)>0)for(const n of m.retailers)for(const i of n.fulfillments)i.type===a.ON_DEMAND&&(p["checkout.onDemandFulfillmentTipInfo."+i.id]={retailerId:n.id,retailerName:n.name,fulfillmentId:i.id,tip:i.tip,subtotal:i.subtotal});if((null===(s=m.items)||void 0===s?void 0:s.length)>0){this.store.remove("checkout.items");for(const n of m.items){const i=m.retailers.find(i=>i.id===n.retailerId),o=i.fulfillments.find(i=>i.id===n.fulfillmentId);p["checkout.items."+n.cartItemId]=buildCheckoutItemStore(n,i,o)}}m.isPresaleLocked&&m.presaleExpiresAt&&(p["checkout.isPresaleLocked"]=m.isPresaleLocked,p["checkout.presaleExpiresAt"]=m.presaleExpiresAt),p["checkout.token"]=m.token,p["checkout.cartId"]=m.cartId,p["checkout.customer"]=m.customer,p["checkout.acceptedAccountCreation"]=m.acceptedAccountCreation,p["checkout.billingSameAsShipping"]=m.billingSameAsShipping,p["checkout.hasAgeVerify"]=m.hasAgeVerify,p["checkout.hasSubstitutionPolicy"]=m.hasSubstitutionPolicy,p["checkout.isGift"]=m.isGift,p["checkout.marketingPreferences"]=m.marketingPreferences,p["checkout.giftCards"]=m.giftCards.map(n=>({code:n.code,discountAmount:n.applied})),p["checkout.promoCode"]=m.promoCode.value?{code:m.promoCode.value,discountAmount:m.promoCode.discount}:null,p["checkout.marketingPreferences.canEmail"]=m.marketingPreferences.canEmail,p["checkout.marketingPreferences.canSms"]=m.marketingPreferences.canSms,p["checkout.amounts"]=m.amounts,p["checkout.error"]=null,p["checkout.updating"]=![],p["checkout.events"]=m.events||[],this.store.batch(p),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.CHECKOUT_LOADED,{cartId:m.cartId})}catch(c){throw this.store.set("checkout.error",c.message),this.pubSub.publishAction(o.CHECKOUT_FAILED,{message:c.message}),c}finally{this.store.set("checkout.loading",![])}}async partialLoadCheckout(n){var i,r,s,c,l;try{let o;if(this.store.set("checkout.updating",!![]),(null==n?void 0:n.cartResponse)?this.commonCommands.syncCartFromResponse(n.cartResponse):await this.commonCommands.loadCart(),null==n?void 0:n.response)o=n.response;else{const r=null!==(i=null==n?void 0:n.cartId)&&void 0!==i?i:this.store.get("checkout.cartId");if(!r)return this.store.set("checkout.error","Cart ID is not provided"),void 0;o=await this.api.prepareCheckout({cartId:r})}const u={"checkout.token":o.token,"checkout.events":transformEventsForCheckout(o.events||[]),"checkout.amounts":o.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCards":o.giftCards.map(n=>({code:n.code,discountAmount:n.applied})),"checkout.promoCode":(null===(s=null===(r=null==o?void 0:o.promoCode)||void 0===r?void 0:r.value)||void 0===s?void 0:s.trim())?{code:o.promoCode.value,discountAmount:o.promoCode.discount}:null};if((null===(c=o.retailers)||void 0===c?void 0:c.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const n of o.retailers)for(const i of n.fulfillments)i.type===a.ON_DEMAND&&(u["checkout.onDemandFulfillmentTipInfo."+i.id]={retailerId:n.id,retailerName:n.name,fulfillmentId:i.id,tip:i.tip,subtotal:i.subtotal})}if((null===(l=o.items)||void 0===l?void 0:l.length)>0){this.store.remove("checkout.items");for(const n of o.items){const i=o.retailers.find(i=>i.id===n.retailerId),r=i.fulfillments.find(i=>i.id===n.fulfillmentId);u["checkout.items."+n.cartItemId]=buildCheckoutItemStore(n,i,r)}}this.store.batch(u),this.validateAndUpdateFormStatus()}catch(u){const n=(null==u?void 0:u.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",n),this.pubSub.publishAction(o.CHECKOUT_FAILED,{message:n}),u}finally{this.store.set("checkout.updating",![])}}async toggleIsGift(n){const i=this.store.get("checkout.isGift"),r=null!=n?n:!i;this.store.batch({"checkout.isGift":r,"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,email:"",firstName:"",lastName:"",message:null,phone:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.CHECKOUT_IS_GIFT_TOGGLED,{isActive:r})}async toggleBillingSameAsShipping(n){const i=this.store.get("checkout.billingSameAsShipping"),r=null!=n?n:!i;this.store.batch({"checkout.billingSameAsShipping":r,"checkout.billing":{firstName:"",lastName:"",email:"",phone:"",addressOne:"",addressTwo:"",city:"",state:"",zipCode:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:r})}toggleMarketingPreferences(n,i){const r=this.store.get("checkout.marketingPreferences."+n),s=null!=i?i:!r;this.store.set("checkout.marketingPreferences."+n,s),this.pubSub.publishAction(o.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:n,isActive:s})}async getPaymentSession(){try{const n=this.store.get("cart.id"),i=await this.api.getPaymentSession({cartId:n});this.store.set("checkout.payment",{key:i.key,secret:i.secret,paymentMethodId:null})}catch(n){throw this.store.batch({"checkout.error":n.message,"checkout.loading":![]}),n}}async confirmPaymentSession(n,i){try{const o=await this.api.confirmPaymentSession(n,i);this.store.batch({"checkout.payment.paymentMethodId":o.id,"checkout.readyForSubmit.payment":!![],"checkout.card":{...o.card}})}catch(o){throw new Error("Failed to confirm payment session. Please try again.")}}async applyPromoCode(n){var i;try{this.googleTagManager.promoCodeAttempt(n);const o=this.dataForCheckoutPrepare(),r=await this.api.prepareCheckout({...o,promoCode:n}),s=0!==r.amounts.discounts,a=null===(i=transformPromoCodeCheckoutEvents(r.events||[]))||void 0===i?void 0:i[0];if(!s)return this.store.set("checkout.promoCodeError",a?a.message:'Code "'+n+'" does not exist'),this.googleTagManager.promoCodeFailed(n,(null==a?void 0:a.message)||"not_applied"),void 0;this.googleTagManager.promoCodeApplied(n,r.amounts.discounts),await this.partialLoadCheckout({response:r})}catch(o){const i=(null==o?void 0:o.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",i),this.googleTagManager.promoCodeFailed(n,i),o}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(L){const i=L.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",i),L}}async removePromoCode(){var n,i;try{const o=this.dataForCheckoutPrepare(),r=(null===(i=null===(n=this.store.get("checkout"))||void 0===n?void 0:n.promoCode)||void 0===i?void 0:i.code)||"",s=await this.api.prepareCheckout({...o,promoCode:""});if(0!==s.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.googleTagManager.promoCodeApplied(r,0),await this.partialLoadCheckout({response:s})}catch(o){const n=(null==o?void 0:o.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",n);const i=this.store.get("checkout.promoCode.code")||"";throw i&&this.googleTagManager.promoCodeFailed(i,n),o}}async applyGiftCard(n){var i;const o=n.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(o);const n=this.dataForCheckoutPrepare(),r=n.giftCards||[],s=await this.api.prepareCheckout({...n,giftCards:[...r,o]}),a=null===(i=transformGiftCardCheckoutEvents(s.events||[]))||void 0===i?void 0:i[0],c=hasAnyRetailerGiftCardRestriction(s.events||[]);if(a){if(!c)return this.store.set("checkout.giftCardError",a.message),void 0;this.store.set("checkout.giftCardError",a.message)}const l=s.giftCards.find(n=>n.code===o);if(!l)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.googleTagManager.giftCardFailed(o,(null==a?void 0:a.message)||"not_applied"),void 0;this.googleTagManager.giftCardApplied(o,l.applied),await this.partialLoadCheckout({response:s})}catch(r){const n=(null==r?void 0:r.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",n),this.googleTagManager.giftCardFailed(o,n),r}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(L){throw this.store.set("checkout.error",(null==L?void 0:L.message)||"Failed to clear gift card error. Please try again."),L}}async removeGiftCard(n){var i;const o=n.trim().toUpperCase();try{const n=this.dataForCheckoutPrepare(),r=(null===(i=n.giftCards)||void 0===i?void 0:i.filter(n=>n!==o))||[],s=await this.api.prepareCheckout({...n,giftCards:r}),a=s.giftCards.find(n=>n.code===o);if(a)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+o),void 0;this.googleTagManager.giftCardApplied(o,0),await this.partialLoadCheckout({response:s})}catch(r){const n=(null==r?void 0:r.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",n),this.googleTagManager.giftCardFailed(o,n),r}}updateCustomerInfo(n,i){try{this.store.set("checkout.customer."+n,i),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{fieldName:n})}catch(r){throw this.store.set("checkout.error",r.message),r}}updateBillingInfo(n,i){try{this.store.set("checkout.billing."+n,i),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.CHECKOUT_BILLING_INFORMATION_UPDATED,{fieldName:n})}catch(r){throw this.store.set("checkout.error",r.message),r}}updateGiftInfo(n,i){try{this.store.set("checkout.giftRecipient."+n,i),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(o.CHECKOUT_GIFT_INFORMATION_UPDATED,{fieldName:n})}catch(r){throw this.store.set("checkout.error",r.message),r}}triggerAddShippingInfoEvent(){var n,i;const o=this.store.get("checkout");if(o.customer.email||o.customer.phone){const r=(null===(n=null==o?void 0:o.customer)||void 0===n?void 0:n.id)||(null===(i=null==o?void 0:o.customer)||void 0===i?void 0:i.email),s={subtotal:centToDollar(o.amounts.subtotal),total_before_discounts:centToDollar(o.amounts.subtotal+o.amounts.tax+o.amounts.shipping+o.amounts.delivery+o.amounts.platform+o.amounts.service),discounts:centToDollar(o.amounts.discounts),gift_cards:centToDollar(o.amounts.giftCards||0),net_total:centToDollar(o.amounts.total)};this.googleTagManager.addShippingInfoWithCustomerData(centToDollar(o.amounts.total),void 0,{phone:o.customer.phone,email:o.customer.email,birth_date:o.customer.birthDate,customer_id:r},s)}}validateAndUpdateFormStatus(){const n=this.store.get("checkout"),i=validateCustomerInfo(n.customer),o=n.isGift?validateGiftRecipientInfo(n.giftRecipient):{isValid:!![],invalidFields:[]},r=n.billingSameAsShipping?{isValid:!![],invalidFields:[]}:validateBillingInfo(n.billing),s=i.isValid&&o.isValid&&r.isValid,a=[...i.invalidFields.map(n=>"customer."+n),...o.invalidFields.map(n=>"giftRecipient."+n),...r.invalidFields.map(n=>"billing."+n)];this.store.batch({"checkout.isFormValid":s,"checkout.invalidFields":a,"checkout.readyForSubmit.customer":i.isValid,"checkout.readyForSubmit.gift":o.isValid,"checkout.readyForSubmit.billing":r.isValid})}async checkoutComplete(){var n;try{const i=this.store.get("checkout"),r=this.store.get("checkout.payment.paymentMethodId");if(!i.token||!r)return;const a=await this.api.checkoutComplete({token:i.token,payment:r}),c=a.legacyOrderNumber||a.referenceId||"N/A";i.isPresaleLocked||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(s.CHECKOUT_COMPLETED,{orderNumber:c,orderTotal:i.amounts.total,cardLast4:i.card.last4,customerEmail:i.customer.email,giftRecipientEmail:(null===(n=i.giftRecipient)||void 0===n?void 0:n.email)||null}),this.pubSub.publishAction(o.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:c,orderTotal:i.amounts.total}),this.googleTagManager.purchase({transaction_id:c,tax:centToDollar(i.amounts.tax||0),shipping:centToDollar(i.amounts.shipping||0),items:[...Object.values(i.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})],value:centToDollar(i.amounts.total),subtotal:centToDollar(i.amounts.subtotal),total_before_discounts:centToDollar(i.amounts.subtotal+i.amounts.tax+i.amounts.shipping+i.amounts.delivery+i.amounts.platform+i.amounts.service),discounts:centToDollar(i.amounts.discounts),gift_cards:centToDollar(i.amounts.giftCards||0),net_total:centToDollar(i.amounts.total)})}catch(i){const n=(null==i?void 0:i.message)||"Checkout complete failed";throw this.store.batch({"checkout.error":n,"checkout.readyForSubmit.prepared":![],"checkout.readyForSubmit.payment":![],"checkout.payment.sendSubmitSignal":![]}),this.pubSub.publishAction(o.CHECKOUT_SUBMIT_FAILED,{message:n}),i}finally{this.store.set("checkout.loading",![])}}async startPreparingCheckoutSubmit(){var n,i,r,s;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(o.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!==(n=a.billing.company)&&void 0!==n?n: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!==(i=a.isGift?a.giftRecipient.addressTwo:a.customer.addressTwo)&&void 0!==i?i:void 0,hasSubstitutionPolicy:a.hasSubstitutionPolicy,isGift:a.isGift,marketingPreferences:a.marketingPreferences,promoCode:(null===(r=a.promoCode)||void 0===r?void 0:r.code)||void 0,giftCards:(null===(s=a.giftCards)||void 0===s?void 0:s.map(n=>n.code))||[],deliveryInstructions:Object.values(a.onDemandFulfillmentTipInfo||{}).map(n=>({fulfillmentId:n.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 u={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,u)}catch(a){const n=(null==a?void 0:a.message)||"Checkout preparation failed";throw this.store.batch({"checkout.error":n,"checkout.loading":![]}),this.pubSub.publishAction(o.CHECKOUT_SUBMIT_FAILED,{message:n}),a}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(s.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async focusFirstInvalidField(){try{const n=this.store.get("checkout.invalidFields")||[];if(0===n.length)return;const i=n[0];this.store.set("checkout.focusField",i),setTimeout(()=>{this.store.set("checkout.focusField",null)},100)}catch(n){this.logger.error("Checkout form validation focus operation failed",{error:n instanceof Error?n.message:String(n)})}}buildItemUpdate(n,i){var o,r,s;const a={id:n.cartItemId,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:i},c=(null===(s=null===(r=null===(o=n.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.filter(n=>""!==n.trim()))||[];return c.length>0&&(a.engravingLines=c),a}async updateCheckoutItemQuantity(n,i){try{this.store.set("checkout.items."+n+".updating",!![]);const r=this.store.get("checkout.cartId"),s=this.store.get("checkout.items."+n);if(!s)throw new Error("Item not found");const a=s.quantity,c=s.quantity+i;if(c<1)return this.removeItem(n,!![]);const l=this.buildItemUpdate(s,c),u=await this.api.updateCart({id:r,items:[l],loc:this.getLocation()});this.pubSub.publishAction(i>0?o.CHECKOUT_ITEM_QUANTITY_INCREASE:o.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:s.cartItemId,quantity:c,previousQuantity:a});const h=splitCategoryPath(s.catPath),p={item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:Math.abs(i),price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId};i<0?this.googleTagManager.removeFromCart(p):i>0&&this.googleTagManager.addToCart(p),await this.partialLoadCheckout({cartResponse:u})}catch(r){throw this.store.set("checkout.items."+n+".error",r.message),r}finally{this.store.set("checkout.items."+n+".updating",![])}}async removeItemEngraving(n){var i,r,s;try{const a=this.store.get("checkout.items."+n);if(!a)throw new Error("Item not found in checkout");if(!(null===(i=a.attributes)||void 0===i?void 0:i.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:n}),void 0;const c=(null===(s=null===(r=a.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[],l={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:[]},u=this.store.get("checkout.cartId"),h=await this.api.updateCart({id:u,items:[l],loc:this.getLocation()});this.pubSub.publishAction(o.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:a.cartItemId,engravingLines:[],previousEngravingLines:c}),await this.partialLoadCheckout({cartResponse:h})}catch(a){throw this.store.set("checkout.items."+n+".error",a.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:n,error:a.message}),a}}async removeItem(n,i){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;i||this.store.set("checkout.items."+n+".updating",!![]);const r=this.store.get("checkout.cartId"),s=this.store.get("checkout.items."+n);if(!s)throw new Error("Item not found");const a=this.buildItemUpdate(s,0),c=await this.api.updateCart({id:r,items:[a],loc:this.getLocation()});this.store.remove("checkout.items."+n),this.pubSub.publishAction(o.CHECKOUT_ITEM_REMOVED,{cartItemId:s.cartItemId}),await this.partialLoadCheckout({cartResponse:c})}catch(r){throw this.store.set("checkout.items."+n+".error",r.message),r}}async updateTips(n){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",n);const i=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},r=Object.values(i).map(i=>{const o=Math.round(i.subtotal*n/100);return{fulfillmentId:i.fulfillmentId,tip:o}}),s=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:r});this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(o.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update tips. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(n,i){try{this.store.set("checkout.updating",!![]);const r=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},s=Object.values(r).map(o=>({fulfillmentId:o.fulfillmentId,tip:o.fulfillmentId===n?i:o.tip})),a={...this.dataForCheckoutPrepare(),deliveryTips:s},c=await this.api.prepareCheckout(a);this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(o.CHECKOUT_TIP_UPDATED,{deliveryTips:s})}catch(r){throw this.store.set("checkout.error",(null==r?void 0:r.message)||"Failed to update fulfillment tip. Please try again."),r}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(n){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},r=Object.values(i).map(i=>({fulfillmentId:i.fulfillmentId,tip:i.fulfillmentId===n?0:i.tip})),s=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:r});this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(o.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to remove fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}updateStoreFromCheckoutResponse(n){var i;const o={"checkout.amounts":n.amounts,"checkout.warning":n.warning,"checkout.events":transformEventsForCheckout(n.events||[]),"checkout.error":null};if((null===(i=n.retailers)||void 0===i?void 0:i.length)>0)for(const r of n.retailers)for(const n of r.fulfillments)n.type===a.ON_DEMAND&&(o["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:r.id,retailerName:r.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal});this.store.batch(o)}async updateStripeFormStatus(n){try{const i=this.store.get("checkout.stripeFormStatus")||{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},o={...i,...n};this.store.set("checkout.stripeFormStatus",o)}catch(i){throw this.logger.error("Error updating Stripe form status",{error:i instanceof Error?i.message:String(i)}),i}}async removeCheckoutError(){this.store.set("checkout.error",null)}async updateDeliveryInstructions(n){this.store.set("checkout.deliveryInstructions",n)}dataForCheckoutPrepare(){var n,i,o;const r=this.store.get("checkout"),s=(null===(n=null==r?void 0:r.customer)||void 0===n?void 0:n.email)?{firstName:r.customer.firstName,lastName:r.customer.lastName,email:r.customer.email,phone:r.customer.phone,birthDate:r.customer.birthDate,company:r.customer.company}:void 0;return{cartId:r.cartId,customer:s,billingSameAsShipping:r.billingSameAsShipping,acceptedAccountCreation:r.acceptedAccountCreation,hasAgeVerify:r.hasAgeVerify,hasSubstitutionPolicy:r.hasSubstitutionPolicy,marketingPreferences:r.marketingPreferences,promoCode:(null===(i=r.promoCode)||void 0===i?void 0:i.code)||void 0,giftCards:(null===(o=null==r?void 0:r.giftCards)||void 0===o?void 0:o.map(n=>n.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 n=>{n===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(n,i){try{this.store.set("cart.items."+n+".updating",!![]);const r=this.store.get("cart.id"),s=this.store.get("cart.items."+n);if(!s)throw this.logger.error("Cart item not found: "+n+" - cannot update quantity by "+i),new Error("Item not found");const a=s.quantity+i;if(a<1)return this.removeItem(n,!![]);const c=this.buildItemUpdate(s,a),l=await this.api.updateCart({id:r,items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(l,[n]),this.updateFulfillment(s.fulfillmentId,l),this.syncRetailersFromApiResponse(l),this.syncCartMetaFromApiResponse(l),this.pubSubService.publishAction(i<0?o.CART_ITEM_QUANTITY_DECREASE:o.CART_ITEM_QUANTITY_INCREASE,{id:s.id,quantity:a,previousQuantity:s.quantity});const u=splitCategoryPath(s.catPath),h={item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:Math.abs(i),price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId};i<0?this.googleTagManager.removeFromCart(h):i>0&&this.googleTagManager.addToCart(h)}catch(r){throw this.store.set("cart.items."+n+".error",r.message),this.logger.error("Failed to update item quantity",r),r}finally{this.store.set("cart.items."+n+".updating",![])}}async removeItem(n,i){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;i||this.store.set("cart.items."+n+".updating",!![]);const r=this.store.get("cart.id"),s=this.store.get("cart.items."+n);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:r,items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(l,[]),this.cleanupAfterItemRemoval(a,l),this.syncCartMetaFromApiResponse(l),this.pubSubService.publishAction(o.CART_ITEM_REMOVED,{id:s.id});const u=splitCategoryPath(s.catPath);this.googleTagManager.removeFromCart({item_id:s.liquidId,item_name:s.name,item_brand:s.brand,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:s.quantity,price:centToDollar(s.unitPrice||0),upc:s.upc,grouping_id:s.salsifyGrouping,product_id:s.liquidId})}catch(r){throw this.store.set("cart.items."+n+".error",r.message),this.logger.error("Failed to remove item",r),r}}async updateItemEngraving(n,i){var r,s,a;try{const c=this.store.get("cart"),l=null===(r=c.items)||void 0===r?void 0:r[n];if(!l)throw new Error("Item not found");this.store.set("cart.items."+n+".updating",!![]);const u={id:l.id,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:l.quantity,engravingLines:i},h=await this.api.updateCart({id:c.id||"",items:[u],loc:this.getLocation()});this.syncItemsFromApiResponse(h,[n]),this.syncRetailersFromApiResponse(h),this.syncCartMetaFromApiResponse(h);const p=this.store.get("cart"),m=this.store.get("address");this.pubSubService.publishAction(o.CART_UPDATED,{previous:cartDataForEventFromStore(c,m),current:cartDataForEventFromStore(p,m)}),this.pubSubService.publishAction(o.CART_ITEM_ENGRAVING_UPDATED,{id:l.id,engravingLines:i,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."+n+".error",c.message),this.logger.error("Failed to update item engraving",c),c}finally{this.store.set("cart.items."+n+".updating",![])}}async addItem(n){var i,r;try{this.store.set("cart.loading",!![]);const s=this.store.get("cart"),a={...s},c=(null===(i=n.engravingLines)||void 0===i?void 0:i.filter(n=>""!==n.trim()))||[],l=c.length>0,u=Object.values(s.items||{}).find(i=>{var o,r,s,a,u;const h=i.fulfillmentId===n.fulfillmentId&&i.partNumber===n.partNumber;if(!h)return![];if(l){const n=(null===(r=null===(o=i.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[];return c.join(",")===n.join(",")}return!(null===(u=null===(a=null===(s=i.attributes)||void 0===s?void 0:s.engraving)||void 0===a?void 0:a.lines)||void 0===u?void 0:u.length)}),h={upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:u?n.quantity+u.quantity:n.quantity};l&&(h.engravingLines=c);const p=await this.api.updateCart({id:s.id||"",items:[h],loc:this.getLocation()}),m=null===(r=p.items)||void 0===r?void 0:r.find(n=>n.fulfillmentId===h.fulfillmentId&&n.partNumber===h.partNumber&&n.upc===h.upc);if(!m)throw new Error("Added item not found in cart response");this.syncItemsFromApiResponse(p,[]);const f=this.store.get("cart.fulfillments."+n.fulfillmentId);f?this.updateFulfillment(n.fulfillmentId,p):this.addNewFulfillmentAndRetailer(n.fulfillmentId,p),this.syncRetailersFromApiResponse(p),this.syncCartMetaFromApiResponse(p);const g=this.store.get("cart"),v=this.store.get("address");this.pubSubService.publishAction(o.PRODUCT_ADD_TO_CART,{...n}),this.pubSubService.publishAction(o.CART_ITEM_ADDED,{id:m.id,upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:n.quantity,engravingLines:n.engravingLines}),this.pubSubService.publishAction(o.CART_UPDATED,{previous:cartDataForEventFromStore(a,v),current:cartDataForEventFromStore(g,v)});const y=splitCategoryPath(m.catPath);this.googleTagManager.addToCart({item_id:m.liquidId,item_name:m.name,item_brand:m.brand,item_category:y.category,item_category2:y.category2,item_category3:y.category3,item_type:m.type,item_subtype:m.subType,quantity:m.quantity,price:centToDollar(m.unitPrice||0),upc:m.upc,grouping_id:m.salsifyGrouping,product_id:m.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(n){var i;try{const o={upc:n.upc,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:n.quantity};(null==n?void 0:n.engravingLines)&&(null===(i=null==n?void 0:n.engravingLines)||void 0===i?void 0:i.length)>0&&(o.engravingLines=n.engravingLines);const r=await this.api.updateCart({id:"",items:[o],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(r.id)}catch(o){throw this.store.set("cart.error",o.message),this.logger.error("Failed to add presale item to cart",o),o}}async handleGoToCheckout(){var n;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(s.CHECKOUT);const i=this.store.get("cart"),o=(null===(n=i.promoCode)||void 0===n?void 0:n.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(i.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})],o)}catch(i){throw this.store.set("cart.error",i.message),this.logger.error("Failed to proceed to checkout",i),i}finally{this.store.set("cart.loading",![])}}async applyPromoCode(n){var i,o,r;if(!(null==n?void 0:n.trim()))throw new Error("Promo code is required");const s=n.trim().toUpperCase();try{const n=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(s);const a=await this.api.updateCart({id:n,items:[],promoCode:s,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(a)),this.store.set("cart.events",transformEventsForCart(a.events||[]));const c=(null===(r=null===(o=null===(i=a.attributes)||void 0===i?void 0:i.promoCode)||void 0===o?void 0:o.value)||void 0===r?void 0:r.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 n=(null==a?void 0:a.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",n),this.googleTagManager.promoCodeFailed(s,n),this.logger.error("Failed to apply promo code",a),a}}async removePromoCode(){try{const n=this.store.get("cart.id"),i=await this.api.updateCart({id:n,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(i),"cart.promoCode":null}),this.googleTagManager.promoCodeApplied("",0)}catch(n){const i=(null==n?void 0:n.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",i);const o=this.store.get("cart.promoCode");throw(null==o?void 0:o.code)&&this.googleTagManager.promoCodeFailed(o.code,i),this.logger.error("Failed to remove promo code",n),n}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...U,rerender:!![]}),this.store.set("cart",{...G,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSubService.publishAction(o.CART_RESET,!![])}getDetails(){var n;const i=this.store.get("cart"),o=this.store.get("address"),r=o.id?o:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},s={};for(const a in i.items||{}){const n=i.items[a];s[a]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,salsifyGrouping:n.salsifyGrouping,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price||0,quantity:n.quantity||0,maxQuantity:n.maxQuantity||0,unitPrice:n.unitPrice||0,mainImage:n.mainImage||"",attributes:n.attributes||{}}}return{id:i.id,promoCode:(null===(n=i.promoCode)||void 0===n?void 0:n.code)||"",items:s,location:{placesId:r.id,address:{one:r.address.one,two:r.address.two,city:r.address.city,state:r.address.state,zip:r.address.zip,country:r.address.country},coordinates:{latitude:r.coordinates.lat,longitude:r.coordinates.long}},amounts:{deliveryFee:i.totals.deliveryFee,discounts:i.totals.discounts,engravingFee:i.totals.engravingFee,giftCardTotal:0,platformFee:i.totals.platformFee,shippingFee:i.totals.shippingFee,subtotal:i.totals.subtotal,total:i.totals.total},updatedAt:i.updatedAt,createdAt:i.createdAt}}buildItemUpdate(n,i){var o,r,s;const a={id:n.id,fulfillmentId:n.fulfillmentId,partNumber:n.partNumber,quantity:i},c=(null===(s=null===(r=null===(o=n.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.filter(n=>""!==n.trim()))||[];return c.length>0&&(a.engravingLines=c),a}syncItemsFromApiResponse(n,i=[]){var o;const r=this.store.get("cart.items")||{},s=new Set((null===(o=n.items)||void 0===o?void 0:o.map(n=>n.id))||[]);for(const c of Object.keys(r))s.has(c)||this.store.remove("cart.items."+c);const a={};for(const c of n.items)0!==i.length&&!i.includes(c.id)&&r[c.id]||(a["cart.items."+c.id]=buildCartItemStore(c));Object.keys(a).length>0&&this.store.batch(a)}syncCartMetaFromApiResponse(n){var i,o;const r={"cart.totals":buildCartTotals(n),"cart.error":null,"cart.updatedAt":n.updatedAt||(new Date).toISOString(),"cart.createdAt":n.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(n.events||[])},s=null===(o=null===(i=n.attributes)||void 0===i?void 0:i.promoCode)||void 0===o?void 0:o.value;if(s)r["cart.promoCode"]={code:s.toUpperCase(),discountAmount:n.discounts||0};else{const n=this.store.get("cart.promoCode");(null==n?void 0:n.code)&&(r["cart.promoCode"]=null)}this.store.batch(r)}syncRetailersFromApiResponse(n){var i;if((null===(i=n.retailers)||void 0===i?void 0:i.length)>0){const i={};for(const o of n.retailers)i["cart.retailers."+o.id]=buildRetailerStore(o);this.store.batch(i)}}updateFulfillment(n,i){var o,r;const s=null===(o=i.retailers)||void 0===o?void 0:o.find(i=>{var o;return null===(o=i.fulfillments)||void 0===o?void 0:o.some(i=>i.id===n)}),a=null===(r=null==s?void 0:s.fulfillments)||void 0===r?void 0:r.find(i=>i.id===n);a&&s&&this.store.set("cart.fulfillments."+n,buildFulfillmentStore(a,s))}addNewFulfillmentAndRetailer(n,i){var o,r;const s=null===(o=i.retailers)||void 0===o?void 0:o.find(i=>{var o;return null===(o=i.fulfillments)||void 0===o?void 0:o.some(i=>i.id===n)}),a=null===(r=null==s?void 0:s.fulfillments)||void 0===r?void 0:r.find(i=>i.id===n);if(a&&s){const i={["cart.fulfillments."+n]:buildFulfillmentStore(a,s),["cart.retailers."+s.id]:buildRetailerStore(s)};this.store.batch(i)}}cleanupAfterItemRemoval(n,i){var o,r,s,a;const c=this.store.get("cart.fulfillments."+n.fulfillmentId),l=this.store.get("cart.retailers."+n.retailerId);if(!c||!l)return;const u=null===(o=i.retailers)||void 0===o?void 0:o.some(i=>{var o;return null===(o=i.fulfillments)||void 0===o?void 0:o.some(i=>i.id===n.fulfillmentId)}),h=null===(r=i.retailers)||void 0===r?void 0:r.some(i=>i.id===n.retailerId);if(u){this.updateFulfillment(n.fulfillmentId,i);const o=null===(a=i.retailers)||void 0===a?void 0:a.find(i=>i.id===n.retailerId);o&&this.store.set("cart.retailers."+n.retailerId,buildRetailerStore(o))}else if(this.store.remove("cart.fulfillments."+n.fulfillmentId),h){const o=null===(s=i.retailers)||void 0===s?void 0:s.find(i=>i.id===n.retailerId);o&&this.store.set("cart.retailers."+n.retailerId,buildRetailerStore(o))}else this.store.remove("cart.retailers."+n.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(n,i=![]){this.store.createProductInstance(n),i&&this.store.set("products."+n+".loading",!![])}async loadMultipleProducts(n){var i;if(!Array.isArray(n)||0===n.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(n.reduce((n,i)=>(n["products."+i+".loading"]=!![],n["products."+i+".error"]=null,n),{}));const o=await this.api.getProductsData(n,this.getLocation());if(!o||!o.products||0===o.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(n.reduce((n,i)=>(n["products."+i+".loading"]=![],n["products."+i+".error"]=!![],n),{})),void 0;const r=[];for(const a of o.products){const s=a.sizes.filter(i=>n.some(n=>n===(i.upc||i.id||a.salsifyGrouping))),c=n.find(n=>s.some(i=>n===i.upc||n===i.id)||n===a.salsifyGrouping),l=c||(null===(i=null==s?void 0:s[0])||void 0===i?void 0:i.upc);await this.loadProduct(l,{products:[a],retailers:o.retailers}),r.push(l)}const s=n.filter(n=>-1===r.indexOf(n));this.store.batch(s.reduce((n,i)=>(n["products."+i+".loading"]=![],n["products."+i+".error"]="Product data not found",n),{}))}async loadProduct(n,i=null){var r,s;try{const a=this.store.get("products."+n);a.loading||this.store.set("products."+n+".loading",!![]);let c=null;if(i&&(c=i),i||(c=await this.api.getProductsData([n],this.getLocation())),!c||!(null===(r=null==c?void 0:c.products)||void 0===r?void 0:r[0]))return this.store.set("products."+n+".error","Product data not found"),void 0;const l=this.loadProductStoreUpdate(c);if(!l)return this.store.set("products."+n+".error","Failed to process product data"),void 0;this.store.set("products."+n,{...l,identifier:n}),this.pubSub.publishAction(o.PRODUCT_LOADED,this.productDataForEventFromStore(n));const u=c.products[0],h=l.sizes[l.selectedSizeId||""],p=Boolean(this.getLocation()),m=l.selectedFulfillment,f=p&&(null==m?void 0:m.price)?m.price:(null===(s=l.priceInfo)||void 0===s?void 0:s.avg)||0,g=splitCategoryPath(u.catPath);this.googleTagManager.viewItem({item_id:null==h?void 0:h.id,item_name:u.name,item_brand:u.brand,item_category:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar(f),item_type:u.type,item_subtype:u.subType,upc:null==h?void 0:h.upc,grouping_id:u.salsifyGrouping,product_id:null==h?void 0:h.id})}catch(a){throw this.store.set("products."+n+".error",a.message),this.logger.error("Failed to load product data for ID "+n,a),a}finally{this.store.set("products."+n+".loading",![])}}async selectSize(n,i){var r,s,c,l,u,h,p;const m=this.store.get("products."+n);let f=m.selectedFulfillmentType;const g=null===(r=m.sizes[i])||void 0===r?void 0:r.shippingFulfillments,v=null===(s=m.sizes[i])||void 0===s?void 0:s.onDemandFulfillments;let y=null,b=null;if(f!==a.SHIPPING||objectValues(g).length)if(f!==a.ON_DEMAND||objectValues(v).length){const n=f===a.SHIPPING?g:v,i=objectValues(n);y=i[0]||null,b=(null==y?void 0:y.fulfillmentId)||null}else{f=a.SHIPPING;const n=objectValues(g);y=n[0]||null,b=(null==y?void 0:y.fulfillmentId)||null}else{f=a.ON_DEMAND;const n=objectValues(v);y=n[0]||null,b=(null==y?void 0:y.fulfillmentId)||null}const x=f===a.SHIPPING?g:v,w=m.sizes[i],C=splitCategoryPath(m.catPath),k=(null==y?void 0:y.price)||(null===(c=m.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==w?void 0:w.id,item_name:m.name,item_brand:m.brand,item_category:C.category,item_category2:C.category2,item_category3:C.category3,price:centToDollar(k),item_type:m.type,item_subtype:m.subType,upc:null==w?void 0:w.upc,grouping_id:m.salsifyGrouping,product_id:null==w?void 0:w.id});const S=Object.keys(g).length>0,E=Object.keys(v).length>0,T=S||E;if(!T){const n=this.store.get("address");this.googleTagManager.productSizeNoAvailability({productId:null==w?void 0:w.id,productName:m.name,productBrand:m.brand,productCategory:C.category,productCategory2:C.category2,productCategory3:C.category3,productType:m.type,productSubtype:m.subType,productPrice:(null===(l=m.priceInfo)||void 0===l?void 0:l.avg)||0,sizeId:i,sizeName:null==w?void 0:w.size,upc:null==w?void 0:w.upc,groupingId:m.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 fulfillments available for this size"})}this.pubSub.publishAction(o.PRODUCT_SIZE_CHANGED,{identifier:n,selectedSizeId:i,size:(null===(u=m.sizes[i])||void 0===u?void 0:u.size)||"",previousSizeId:m.selectedSizeId||"",previousSize:(null===(h=m.sizes[m.selectedSizeId])||void 0===h?void 0:h.size)||""}),this.store.batch({["products."+n+".selectedSizeId"]:i,["products."+n+".mainImage"]:(null===(p=m.sizes[i])||void 0===p?void 0:p.image)||null,["products."+n+".productHasAvailability"]:Object.keys(g).length+Object.keys(v).length>0,["products."+n+".fulfillmentHasAvailability"]:Boolean(Object.keys(x).length),["products."+n+".selectedFulfillmentType"]:f,["products."+n+".selectedFulfillment"]:y,["products."+n+".selectedFulfillmentId"]:b})}async selectFulfillment(n,i){var r,s,c;const l=this.store.get("products."+n),u=null===(r=l.sizes[l.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments,h=null===(s=l.sizes[l.selectedSizeId])||void 0===s?void 0:s.onDemandFulfillments,p=l.selectedFulfillmentType===a.SHIPPING?u:h,m=p[i];this.pubSub.publishAction(o.PRODUCT_FULFILLMENT_CHANGED,{identifier:n,selectedFulfillmentId:i,selectedFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId||"",previousFulfillmentType:l.selectedFulfillmentType});const f=l.sizes[l.selectedSizeId||""],g=splitCategoryPath(l.catPath),v=(null==m?void 0:m.price)||(null===(c=l.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==f?void 0:f.id,item_name:l.name,item_brand:l.brand,item_category:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar(v),item_type:l.type,item_subtype:l.subType,upc:null==f?void 0:f.upc,grouping_id:l.salsifyGrouping,product_id:null==f?void 0:f.id}),this.store.batch({["products."+n+".selectedFulfillment"]:m,["products."+n+".selectedFulfillmentId"]:i,["products."+n+".quantity"]:1})}async updateQuantity(n,i){var r;const s=this.store.get("products."+n),a=s.quantity,c=a+i,l=1,u=(null===(r=null==s?void 0:s.selectedFulfillment)||void 0===r?void 0:r.stock)||5,h=Math.max(l,Math.min(u,c));this.pubSub.publishAction(i<0?o.PRODUCT_QUANTITY_DECREASE:o.PRODUCT_QUANTITY_INCREASE,{identifier:n,quantity:h,previousQuantity:a}),this.store.set("products."+n+".quantity",h)}async changeFulfillmentType(n,i){var r,s,c;const l=this.store.get("products."+n),{shippingFulfillments:u,onDemandFulfillments:h}=l.sizes[l.selectedSizeId],p=i===a.SHIPPING?u:h,m=objectValues(p);if(0===m.length){this.logger.warn("No fulfillments available for type "+i+" on product "+n);const o=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===(r=l.priceInfo)||void 0===r?void 0:r.avg)||0,sizeId:null!==(s=l.selectedSizeId)&&void 0!==s?s:void 0,sizeName:null==a?void 0:a.size,fulfillmentType:i,upc:null==a?void 0:a.upc,groupingId:l.salsifyGrouping,address:(null==o?void 0:o.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||""}:void 0,reason:"No "+i+" fulfillments available for selected size"}),void 0}const f=m[0]||null,g=(null==f?void 0:f.fulfillmentId)||null;this.pubSub.publishAction(o.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:n,selectedFulfillmentType:i,selectedFulfillmentId:g,previousFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId,fulfillmentHasAvailability:m.length>0});const v=l.sizes[l.selectedSizeId||""],y=splitCategoryPath(l.catPath),b=(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_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar(b),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."+n+".selectedFulfillmentType"]:i,["products."+n+".selectedFulfillment"]:f,["products."+n+".selectedFulfillmentId"]:g,["products."+n+".fulfillmentHasAvailability"]:m.length>0})}async removeProduct(n){this.store.removeProductInstance(n)}async openProductDrawer(n,i,o){const r={type:i,data:o||{}};this.store.batch({["products."+n+".drawer.isOpen"]:!![],["products."+n+".drawer.contentConfig"]:r})}async closeProductDrawer(n){this.store.set("products."+n+".drawer.isOpen",![])}async rerenderAllProducts(){const n=this.store.getProductInstances(),i=Object.keys(n);for(const o of i)this.store.set("products."+o+".rerender",!![])}async addToCart(n,i){try{this.store.set("products."+n+".updating",!![]),this.uiCommands.openDrawer(s.CART),await this.cartCommands.addItem(i),this.store.batch({["products."+n+".quantity"]:1,["products."+n+".updating"]:![]});const o=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(o.items||{}).map(n=>{const i=splitCategoryPath(n.catPath);return{item_id:n.liquidId,item_name:n.name,item_brand:n.brand,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:n.quantity,price:centToDollar(n.unitPrice||0),upc:n.upc,grouping_id:n.salsifyGrouping,product_id:n.liquidId}})])}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+n+".updating",![])}}async addPresaleToCart(n,i){try{this.store.set("products."+n+".updating",!![]),await this.cartCommands.addPresaleItem(i),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(s.CHECKOUT),this.store.batch({["products."+n+".quantity"]:1,["products."+n+".updating"]:![]})}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+n+".updating",![])}}productDataForEventFromStore(n){const i=this.store.get("products."+n),o={},fulfillmentEventData=n=>{const i={};for(const o in n){const r=n[o];i[o]={retailerId:r.retailerId,retailerName:r.retailerName,retailerAddress:r.retailerAddress,retailerTimezone:r.timezone,price:r.price,partNumber:r.partNumber,fulfillmentId:r.fulfillmentId,fulfillmentType:r.fulfillmentType,modalities:r.modalities||[]}}return i};for(const r in i.sizes||{}){const n=i.sizes[r];o[r]={id:n.id,upc:n.upc,size:n.size,pack:n.pack,packDesc:n.packDesc||"",container:n.container,containerType:n.containerType,maxQuantityPerOrder:n.attributes.maxQuantityPerOrder||0,image:n.image,uom:n.uom,volume:n.volume,shippingFulfillments:fulfillmentEventData(n.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(n.onDemandFulfillments||{})}}return{identifier:n,id:i.id,name:i.name,brand:i.brand,category:i.category,catPath:i.catPath,classification:i.classification,priceInfo:i.priceInfo||null,sizes:o}}findFirstAvailableSize(n){const i=objectValues(n);for(const o of i){const n=o.shippingFulfillments||{},i=o.onDemandFulfillments||{},r=objectValues(n).length,s=objectValues(i).length;if(r+s>0)return o.id}return null}loadProductStoreUpdate(n){var i,o,r,s,c,l,u,h,p,m,f;try{const{products:[g,...v],retailers:y}=n,b=this.themeProvider.getConfigs("product"),x={};let w=![],C=![],k="",S=null,E=b.layout.enableShippingFulfillment?a.SHIPPING:a.ON_DEMAND,T=null,P=null;const D={};if(y&&Array.isArray(y)&&y.length>0)for(const n of y)for(const i of n.fulfillments)D[i.id]={retailerName:n.name,retailerAddress:n.address||null,type:i.type,timezone:i.timezone||"",canEngrave:i.canEngrave||![],expectation:i.expectation,fees:i.fees,hours:i.hours,retailerId:n.id,fulfillmentId:i.id,fulfillmentType:i.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]};if(g.sizes&&Array.isArray(g.sizes)&&g.sizes.length>0)for(const n of g.sizes){const c={},l={};for(const u of n.variants){if((null===(i=null==u?void 0:u.fulfillmentTypes)||void 0===i?void 0:i.onDemand)&&""!==u.fulfillmentTypes.onDemand){const n=u.fulfillmentTypes.onDemand,i=D[n];i?l[n]={...i,isVariantEngravable:u.isEngravable,stock:u.stock,price:u.price,retailerId:u.retailerId,fulfillmentId:n,fulfillmentType:a.ON_DEMAND,modalities:[...i.modalities,...null!==(o=null==u?void 0:u.modalities)&&void 0!==o?o:[]],partNumber:u.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId "+n)}if((null===(r=null==u?void 0:u.fulfillmentTypes)||void 0===r?void 0:r.shipping)&&""!==u.fulfillmentTypes.shipping){const n=u.fulfillmentTypes.shipping,i=D[n];i?c[n]={...i,isVariantEngravable:u.isEngravable,stock:u.stock,price:u.price,retailerId:u.retailerId,fulfillmentId:n,fulfillmentType:a.SHIPPING,modalities:[...i.modalities,...null!==(s=null==u?void 0:u.modalities)&&void 0!==s?s:[]],partNumber:u.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+n)}}x[n.id]={id:n.id,upc:n.upc,size:n.size,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,maxQuantityPerOrder:n.attributes.maxQuantityPerOrder||0,image:n.image,uom:n.uom,volume:n.volume,attributes:n.attributes,loading:![],error:null,shippingFulfillments:c,onDemandFulfillments:l}}const _=objectValues(x),z=this.findFirstAvailableSize(x);k=z||_[0]&&_[0].id||"",S=(null===(c=x[k])||void 0===c?void 0:c.image)||null;const O=(null===(l=x[k])||void 0===l?void 0:l.shippingFulfillments)||{},N=(null===(u=x[k])||void 0===u?void 0:u.onDemandFulfillments)||{},M=objectValues(O).length,L=objectValues(N).length;w=M+L>0;const R=E===a.SHIPPING?objectValues(O):objectValues(N);if(C=R.length>0,P=R[0]||null,T=(null==P?void 0:P.fulfillmentId)||null,!C){const n=E===a.SHIPPING?a.ON_DEMAND:a.SHIPPING,i=n===a.SHIPPING?objectValues(O):objectValues(N);i.length>0&&(E=n,P=i[0],T=(null==P?void 0:P.fulfillmentId)||null,C=!![])}if(!w){const n=this.store.get("address"),i=splitCategoryPath(g.catPath),o=x[k];this.googleTagManager.productNoAvailability({productId:null==o?void 0:o.id,productName:g.name,productBrand:g.brand,productCategory:i.category,productCategory2:i.category2,productCategory3:i.category3,productType:g.type,productSubtype:g.subType,productPrice:(null===(h=g.priceInfo)||void 0===h?void 0:h.average)||0,upc:null==o?void 0:o.upc,groupingId:g.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 fulfillments available for any size"})}return{identifier:"",id:g.id||"",name:g.name,description:g.description,htmlDescription:g.htmlDescription,images:g.images,priceInfo:{min:(null===(p=g.priceInfo)||void 0===p?void 0:p.minimum)||0,max:(null===(m=g.priceInfo)||void 0===m?void 0:m.maximum)||0,avg:(null===(f=g.priceInfo)||void 0===f?void 0:f.average)||0},brand:g.brand,catPath:g.catPath,category:g.category,classification:g.classification,type:g.type,subType:g.subType,salsifyGrouping:g.salsifyGrouping,sizes:x,productHasAvailability:w,fulfillmentHasAvailability:C,selectedSizeId:k,mainImage:S,selectedFulfillmentType:E,selectedFulfillmentId:T,selectedFulfillment:P,drawer:{isOpen:![],contentConfig:null},error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(g){throw this.logger.error("Product data processing error",g),g}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(n){return!n||n.length<3?[]:await this.api.getAddressSuggestions(n)}async getAddressDetails(n){return await this.api.getAddressDetails(n)}async setSelectedAddress(n){try{this.store.batch({"address.id":n.id,"address.formattedAddress":n.formattedAddress,"address.address":n.address,"address.coordinates":n.coordinates});const i=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(i)),await this.cartCommands.resetCart(),await this.store.persist()}catch(i){throw this.googleTagManager.addressFailed({googlePlacesId:n.id,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},error:(null==i?void 0:i.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(o.ADDRESS_FAILED,{googlePlacesId:n.id,formattedAddress:n.formattedAddress,address:n.address,coordinates:n.coordinates,error:(null==i?void 0:i.message)||"Failed to update downstream state after address change"}),i}this.googleTagManager.addressUpdated({googlePlacesId:n.id,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:n.coordinates}),this.pubSub.publishAction(o.ADDRESS_UPDATED,{googlePlacesId:n.id,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:n.coordinates,formattedAddress:n.formattedAddress})}async setAddressManually(n,i){try{const o=buildFormattedAddressString(n),r={id:"",formattedAddress:o,address:n,coordinates:i};await this.setSelectedAddress(r)}catch(r){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:buildFormattedAddressString(n),address:{one:n.one,two:n.two,city:n.city,state:n.state,zip:n.zip,country:n.country||""},error:(null==r?void 0:r.message)||"Failed to set manual address"}),this.pubSub.publishAction(o.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(n),address:n,coordinates:i,error:(null==r?void 0:r.message)||"Failed to set manual address"}),r}}async clearSelectedAddress(){this.store.set("address",V),this.pubSub.publishAction(o.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart(),await this.store.persist()}getDetails(){const n=this.store.get("address");return n.id?{id:n.id,formattedAddress:n.formattedAddress,address:n.address,coordinates:n.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:n=>this.command.product.productDataForEventFromStore(n)},this.addressActions={setAddressByPlacesId:async n=>{try{if(!n||""===n.trim())throw new Error("Invalid placesId provided");const i=await this.command.address.getAddressDetails(n);await this.command.address.setSelectedAddress({id:n,address:i.address,coordinates:i.coords,formattedAddress:i.formattedAddress})}catch(i){throw this.logger.error("Error setting address by placesId:",i),i}},setAddressManually:async(n,i)=>{try{if(!n||!i)throw new Error("Invalid address or coordinates provided");if(!(n.one&&n.city&&n.state&&n.zip))throw new Error("Address must include street address, city, state, and zip code");if("number"!=typeof i.lat||"number"!=typeof i.long)throw new Error("Coordinates must be valid numbers");if(i.lat<-90||i.lat>90)throw new Error("Latitude must be between -90 and 90");if(i.long<-180||i.long>180)throw new Error("Longitude must be between -180 and 180");await this.command.address.setAddressManually(n,i)}catch(o){throw this.logger.error("Error setting manual address:",o),o}},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 n=this.store.get("ui.drawer.isOpen");n?this.command.ui.closeDrawer():this.command.ui.openDrawer(s.CART)},addProduct:async(n,i)=>{var r,c;try{if(!n||0===n.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=n,this.pendingCartOpenFlag=null!=i?i:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(s.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;i===!![]&&this.command.ui.openDrawer(s.CART);const u=[...new Set(n.map(n=>n.identifier))],h=await this.api.getProductsData(u,l);if(!h||!h.products||0===h.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(o.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const i of n){let n=null;for(let r=0;r<h.products.length;r++){const o=h.products[r];let s=![];for(let n=0;n<o.sizes.length;n++){const r=o.sizes[n];if(r.upc===i.identifier||r.id===i.identifier||o.salsifyGrouping===i.identifier){s=!![];break}}if(s){n=o;break}}if(!n){this.logger.warn("No product found for identifier: "+i.identifier);continue}const o=n.sizes[0];if(!o){this.logger.warn("No sizes found for product: "+i.identifier);continue}if((null===(c=null===(r=null==o?void 0:o.attributes)||void 0===r?void 0:r.presale)||void 0===c?void 0:c.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+i.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let s=null;for(let r=0;r<o.variants.length;r++){const n=o.variants[r];let c=![];if(i.fulfillmentType===a.ON_DEMAND&&(c=!(!n.fulfillmentTypes||!n.fulfillmentTypes.onDemand||""===n.fulfillmentTypes.onDemand)),i.fulfillmentType===a.SHIPPING&&(c=!(!n.fulfillmentTypes||!n.fulfillmentTypes.shipping||""===n.fulfillmentTypes.shipping)),c){s=n;break}}if(!s){this.logger.warn("No supported variant found for product: "+i.identifier+" with fulfillment type: "+i.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const l=i.fulfillmentType===a.ON_DEMAND?s.fulfillmentTypes.onDemand:s.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:o.upc,fulfillmentId:l,partNumber:s.partNumber,quantity:i.quantity,identifier:i.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(o.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:n.length,identifiers:u}),this.logger.info("Products added to cart successfully:",u)}catch(l){throw this.logger.error("Error adding products to cart:",l),this.clearPendingCartOperation(),this.pubSub.publishAction(o.CART_PRODUCT_ADD_FAILED,{identifiers:n.map(n=>n.identifier),error:l.message||"Failed to add products to cart"}),l}},applyPromoCode:async n=>{try{if(!n||""===n.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const i=n.trim().toUpperCase(),r=this.themeProvider.getConfigs("global"),s=r.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===i)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(i);const c=this.command.cart.getDetails();this.pubSub.publishAction(o.CART_PROMO_CODE_APPLIED,{applied:!![],discountAmount:c.amounts.discounts,newTotal:c.amounts.total}),this.logger.info("Promo code applied successfully")}catch(i){throw this.logger.error("Failed to apply promo code:",i),this.pubSub.publishAction(o.CART_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),i}},removePromoCode:async()=>{try{const n=this.themeProvider.getConfigs("global"),i=n.layout.allowPromoCodes;if(!i)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(o.CART_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Promo code removed successfully")}catch(n){throw this.logger.error("Failed to remove promo code:",n),n}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(o.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(s.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const n=this.store.get("ui.drawer.isOpen");n?this.command.ui.closeDrawer():this.command.ui.openDrawer(s.CHECKOUT)},addProduct:async(n,i)=>{try{if(!n||0===n.length)return this.logger.warn("No products provided to add to checkout"),void 0;i===!![]&&this.command.ui.openDrawer(s.CHECKOUT);const r=n.map(n=>n.identifier);await this.cartActions.addProduct(n),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:n.length,identifiers:r}),this.logger.info("Products added to checkout successfully:",r)}catch(r){throw this.logger.error("Error adding products to checkout:",r),this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:n.map(n=>n.identifier),error:r.message||"Failed to add products to checkout"}),r}},applyPromoCode:async n=>{var i;try{if(!n||""===n.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const r=n.trim().toUpperCase(),s=this.themeProvider.getConfigs("global"),a=s.layout.allowPromoCodes;if(!a)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const c=this.store.get("checkout.promoCode");if(c&&c.code===r)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(n);const l=this.store.get("checkout"),u=null==l?void 0:l.promoCode;this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_APPLIED,{applied:!![],discountAmount:(null==u?void 0:u.discountAmount)||0,newTotal:(null===(i=null==l?void 0:l.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(r){throw this.logger.error("Failed to apply checkout promo code:",r),this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),r}},removePromoCode:async()=>{try{const n=this.themeProvider.getConfigs("global"),i=n.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode(),this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Checkout promo code removed successfully")}catch(n){throw this.logger.error("Failed to remove checkout promo code:",n),n}},applyGiftCard:async n=>{var i;try{const r=this.themeProvider.getConfigs("checkout"),s=r.layout.allowGiftCards;if(!s)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(n);const a=this.store.get("checkout");this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_APPLIED,{applied:!![],newTotal:(null===(i=null==a?void 0:a.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Gift card applied successfully")}catch(r){throw this.logger.error("Failed to apply gift card:",r),this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be applied"}),r}},removeGiftCard:async n=>{try{const i=this.themeProvider.getConfigs("checkout"),r=i.layout.allowGiftCards;if(!r)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(n),this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_REMOVED,{applied:![]}),this.logger.info("Gift card removed successfully")}catch(i){throw this.logger.error("Failed to remove gift card:",i),this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be removed"}),i}},toggleIsGift:async n=>{await this.command.checkout.toggleIsGift(n)},toggleBillingSameAsShipping:async n=>{await this.command.checkout.toggleBillingSameAsShipping(n)},toggleMarketingPreferences:(n,i)=>{this.command.checkout.toggleMarketingPreferences(n,i)},updateCustomerInfo:n=>{for(const[i,o]of objectEntries(n))this.command.checkout.updateCustomerInfo(i,o)},updateBillingInfo:n=>{for(const[i,o]of objectEntries(n))this.command.checkout.updateBillingInfo(i,o)},updateGiftInfo:n=>{for(const[i,o]of objectEntries(n))this.command.checkout.updateGiftInfo(i,o)},getDetails:()=>{var n;const i=this.store.get("checkout"),o=i.items||{},r={};for(const[s,a]of Object.entries(o)){const n=a,{attributes:i,...o}=n;r[s]=o}return{cartId:i.cartId||"",amounts:i.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}}},items:r,isGift:i.isGift||![],hasAgeVerify:i.hasAgeVerify||![],hasPromoCode:!!(null===(n=i.promoCode)||void 0===n?void 0:n.code),hasGiftCards:Array.isArray(i.giftCards)&&i.giftCards.length>0,itemCount:Object.keys(o).length}}},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 K=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+o.ADDRESS_UPDATED,K)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const n=this.pendingCartParams,i=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(n,i)}catch(n){this.logger.error("Failed to retry cart operation after address update",n)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const n=this.store.get("address");if(n.address.one&&n.coordinates.long&&n.coordinates.lat)return{coords:n.coordinates,address:n.address}}}function componentError({componentType:n,message:i}){const o=document.createElement("div");o.className=n;const r=o.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 </"+n+">";const l=document.createElement("p");return l.textContent=i,a.appendChild(s),a.appendChild(c),a.appendChild(l),r.appendChild(a),o}function productionComponentError({title:n,message:i,componentType:o}){const r=document.createElement("div");r.setAttribute("data-component-type",o);const s=r.attachShadow({mode:"closed"}),a=document.createElement("style");a.textContent="\n div {\n padding: 20px;\n background-color: #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=n;const u=document.createElement("p");return u.textContent=i,c.appendChild(a),c.appendChild(l),c.appendChild(u),s.appendChild(c),r}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(n,i){ComponentFactoryService.getComponentRegistry().set(n,i)}static createElement(n){try{const i=ComponentFactoryService.getComponentRegistry().get(n.type);if(!i)throw new Error("Component type ["+n.type+"] is not registered");const o=ComponentFactoryService.getComponentTagName(n.type);window.customElements.get(o)||window.customElements.define(o,i);const r=document.createElement(o);if(r.initialize){const{type:i,useShadowDom:s,wrapInLceElement:a,...c}=n,l={type:i,tagName:o,useShadowDom:s&&a!==!![]};r.initialize({data:c,config:l})}if(n.wrapInLceElement){const i=ComponentFactoryService.getComponentRegistry().get(s.LCE_ELEMENT),o=ComponentFactoryService.getComponentTagName(s.LCE_ELEMENT);window.customElements.get(o)||window.customElements.define(o,i);const a=document.createElement(o);return a.initialize(n.type,r),a}return r}catch(i){return ComponentFactoryService.logger.error("Failed to create component </"+n.type+">",i),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:n.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:n.type}):componentError({componentType:n.type,message:(null==i?void 0:i.message)||i})}}static componentError({componentType:n,message:i}){return ComponentFactoryService.logger.error("Component type "+n+" failed to load: "+i),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:n.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({componentType:n,message:i})}static getComponentTagName(n){const i={[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 i[n]||n.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;const dt="\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",ut="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 n=LoggerFactory,i=n.instances;if(i)for(const[r,s]of i)this.interceptLoggerInstance(s,r);const o=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=n=>{const i=o(n);return this.interceptLoggerInstance(i,n),i}}interceptLoggerInstance(n,i){if(n.o)return;const o=n.debug.bind(n),r=n.info.bind(n),s=n.warn.bind(n),a=n.error.bind(n),F=(n,o,r)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:n,message:o,data:r,context:i});n.debug=(n,i)=>{o(n,i),this.addLogEntry(F("debug",n,i))},n.info=(n,i)=>{r(n,i),this.addLogEntry(F("info",n,i))},n.warn=(n,i)=>{s(n,i),this.addLogEntry(F("warn",n,i))},n.error=(n,i)=>{a(n,i),this.addLogEntry(F("error",n,i))},n.o=!![]}interceptPubSubEvents(){const n=PubSubService.getInstance(),i=n.publishAction.bind(n);n.publishAction=(n,o)=>{i(n,o),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+n,data:o,context:"PubSub"})};const o=n.publishForm.bind(n);n.publishForm=(n,i)=>{o(n,i),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+n,data:i,context:"PubSub"})}}interceptGtmEvents(){const n=GoogleTagManagerService.getInstance(),i=n.executeEvent.bind(n);n.executeEvent=(n,o,r)=>{i(n,o,r),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+o,data:r,context:"GTM."+n})}}addLogEntry(n){this.logs.push(n),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const n=this.logs.filter(n=>{switch(n.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",n.forEach(n=>{const i=this.createLogElement(n);this.logContainer.appendChild(i)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const n=document.querySelector(ut);n&&n.remove(),this.panelElement=document.createElement(ut);const i=window.innerWidth<=768,o=window.innerWidth<=480;o?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):i?(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 n=this.panelElement.attachShadow({mode:"closed"}),i=document.createElement("style");i.textContent=dt,n.appendChild(i),this.floatingButton=this.createFloatingButton(),n.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const o=this.createHeader();this.panelContainer.appendChild(o);const r=this.createToggles();this.panelContainer.appendChild(r),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const s=this.createResizeHandle();this.panelContainer.appendChild(s),n.appendChild(this.panelContainer),this.setupShadowEventListeners(n)}createHeader(){const n=document.createElement("div");n.className="header",n.title="Drag to move panel";const i=document.createElement("div");i.className="icon",i.innerHTML="🔍",i.title="Elements Debug Console",i.style.cursor="help";const o=document.createElement("div");o.className="title-container";const r=document.createElement("div");r.className="title",r.textContent="Elements Debug Console";const s=document.createElement("div");s.className="subtitle",s.textContent="Live SDK logs, events & GTM tracking",o.appendChild(r),o.appendChild(s);const a=document.createElement("button");return a.className="minimize",a.innerHTML="−",a.title="Minimize debug panel",a.addEventListener("click",()=>this.toggleVisibility()),n.appendChild(i),n.appendChild(o),n.appendChild(a),n}createToggles(){const n=document.createElement("div");n.className="toggles";const i=[{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"}];i.forEach(({key:i,label:o,description:r,color:s})=>{const a=document.createElement("label");a.className="toggle",a.title=r;const c=document.createElement("input");c.type="checkbox",c.checked="showLogs"!==i,c.addEventListener("change",n=>{const o=n.target;"showEvents"===i&&(this.showEvents=o.checked),"showGtmEvents"===i&&(this.showGtmEvents=o.checked),"showLogs"===i&&(this.showLogs=o.checked),this.renderLogs()});const l=document.createElement("span");l.textContent=o,l.style.color=s,a.appendChild(c),a.appendChild(l),n.appendChild(a)});const o=document.createElement("button");return o.className="clear-btn",o.innerHTML="🗑️",o.title="Clear all logs",o.addEventListener("click",()=>this.clearLogs()),n.appendChild(o),n}createResizeHandle(){const n=document.createElement("div");n.className="resize-handle",n.title="Drag to resize panel",n.style.cursor="nw-resize";let i=![],o=0,r=0,s=0,a=0;n.addEventListener("mousedown",n=>{i=!![],o=n.clientX,r=n.clientY,s=Number.parseInt(this.panelElement.style.width,10)||500,a=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",t),document.addEventListener("mouseup",B),n.preventDefault()});const t=n=>{if(!i||!this.panelElement)return;const c=n.clientX-o,l=n.clientY-r,u=window.innerWidth<=768,h=window.innerWidth<=480;let p,m,f,g;h?(p=280,m=window.innerWidth-20,f=200,g=.4*window.innerHeight):u?(p=300,m=window.innerWidth-30,f=200,g=.4*window.innerHeight):(p=300,m=800,f=200,g=600);const v=Math.max(p,Math.min(m,s+c)),y=Math.max(f,Math.min(g,a+l));this.panelElement.style.width=v+"px",this.panelElement.style.height=y+"px"},B=()=>{i=![],document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",B)};return n}setupShadowEventListeners(n){if(!this.panelElement)return;const i=n.querySelector(".header");if(i){let n=![],o=0,r=0,s=0,a=0;i.addEventListener("mousedown",i=>{if(i.target.classList.contains("minimize"))return;n=!![],o=i.clientX,r=i.clientY;const c=this.panelElement.getBoundingClientRect();s=c.left,a=c.top,document.addEventListener("mousemove",t),document.addEventListener("mouseup",B),i.preventDefault()});const t=i=>{if(!n||!this.panelElement)return;const c=i.clientX-o,l=i.clientY-r;this.panelElement.style.left=s+c+"px",this.panelElement.style.top=a+l+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},B=()=>{n=![],document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",B)}}}createFloatingButton(){const n=document.createElement("div");return n.className="floating-btn",n.innerHTML="⚙️",n.title="Open Elements Debug Console",n.style.display="none",n.addEventListener("click",()=>{this.toggleVisibility()}),n}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(n){const i=document.createElement("div");i.className="log-entry "+n.type+" "+n.level;const o=new Date(n.timestamp).toLocaleTimeString();return i.innerHTML='\n <div class="log-meta">\n <div class="log-type '+n.type+'">'+n.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+o+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(n.message)+"\n "+(n.context?'<div class="log-context">'+this.escapeHtml(n.context)+"</div>":"")+"\n "+(n.data?'<div class="log-data"><pre>'+this.formatJsonData(n.data)+"</pre></div>":"")+"\n </div>\n ",i}formatJsonData(n){try{return"object"==typeof n&&null!==n?JSON.stringify(n,null,2):String(n)}catch(i){return String(n)}}escapeHtml(n){const i=document.createElement("div");return i.textContent=n,i.innerHTML}}class FingerPrintService{constructor(){this.keyPrefix=R,this.isLocalStorageAvailable=null,this.cachedFingerprint=null}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(n){if(this.l()){const i=this.u(n);if(i)return this.h(n,i)}this.cachedFingerprint||(this.cachedFingerprint=this.m());const i=this.h(n,this.cachedFingerprint);if(this.l())try{const n=this.keyPrefix+"_"+i;localStorage.setItem(n,Date.now().toString())}catch(o){}return i}getFingerprintData(){return{screen:this.v(),browser:this.C(),timezone:this.k()}}isLocalStorageWebApiAvailable(){return this.l()}h(n,i){return(n+"_"+i).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 i=["setItem","getItem","removeItem","clear"];for(const n of i)if("function"!=="object".localStorage[n])return this.isLocalStorageAvailable=![],![];const o="__localStorage_test_"+Date.now()+"__",r="test";window.localStorage.setItem(o,r);const s=window.localStorage.getItem(o);if(s!==r)return this.isLocalStorageAvailable=![],![];window.localStorage.removeItem(o);try{const n="__quota_test__",i="x".repeat(100);window.localStorage.setItem(n,i),window.localStorage.removeItem(n)}catch(n){this.S()&&console.warn("localStorage has quota limitations in webview environment")}return this.isLocalStorageAvailable=!![],!![]}catch(i){if(this.isLocalStorageAvailable=![],i instanceof DOMException){const n={QuotaExceededError:"Storage quota exceeded",SecurityError:"Access denied due to security policies",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage"},o=n[i.name]||"Storage error: "+i.name,r=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+r+": "+o)}return![]}}u(n){try{const i=this.keyPrefix+"_"+n.toLowerCase()+"_";for(let n=0;n<localStorage.length;n++){const o=localStorage.key(n);if(null==o?void 0:o.startsWith(i)){const n=o.substring(i.length);if(n&&/^[a-f0-9]+$/.test(n))return n}}return null}catch(i){return null}}m(){const n=this.getFingerprintData(),i=Object.keys(n).sort().map(i=>i+":"+n[i]).join("|");return this.T(i)}v(){try{const n=screen,i=n.colorDepth||24,o=n.pixelDepth||i,r=this.I(),s=Math.round(100*(window.devicePixelRatio||1));return i+"|"+o+"|"+r+"|"+s}catch(n){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(L){}return"srgb"}C(){var n;try{const i=navigator,o=[],r=((null===(n=i.languages)||void 0===n?void 0:n[0])||i.language||"en").substring(0,2);o.push(r),o.push(i.hardwareConcurrency||4);const s=(i.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);o.push(s),o.push(i.cookieEnabled?"1":"0"),o.push(i.maxTouchPoints||0),o.push(i.deviceMemory||0),o.push(this.P()),o.push(this.S()?"webview":"browser");const a=["bluetooth"in i?"1":"0","usb"in i?"1":"0","mediaDevices"in i?"1":"0","permissions"in i?"1":"0","credentials"in i?"1":"0","storage"in i?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return o.push(a.join("")),o.join("|")}catch(i){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}P(){try{const n=navigator.userAgent.toLowerCase();return n.includes("instagram")?"ig_webview":n.includes("fban")||n.includes("fbav")?"fb_webview":n.includes("tiktok")?"tiktok_webview":n.includes("linkedin")?"linkedin_webview":n.includes("snapchat")?"snapchat_webview":n.includes("twitter")?"twitter_webview":n.includes("line/")?"line_webview":n.includes("micromessenger")?"wechat_webview":n.includes("firefox")?"gecko":n.includes("edg/")?"edge":n.includes("opr/")||n.includes("opera")?"opera":n.includes("chrome")&&!n.includes("edg")?"blink":n.includes("safari")&&!n.includes("chrome")?"webkit":"unknown"}catch(n){return"unknown"}}S(){try{const n=navigator.userAgent.toLowerCase(),i=navigator,o=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return o.some(i=>n.includes(i))?!![]:void 0===i.standalone||i.standalone?window.self!==window.top?!![]:![]:!![]}catch(n){return![]}}k(){try{const n=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return n.replace(/\//g,"_").substring(0,30)}catch(n){return"UTC"}}T(n){const i=16777619;let o=2166136261,r=2166136261,s=2166136261,a=2166136261;for(let c=0;c<n.length;c++){const l=n.charCodeAt(c);o^=l,o=Math.imul(o,i),r^=l<<1,r=Math.imul(r,i),s^=l<<2,s=Math.imul(s,i),a^=l<<3,a=Math.imul(a,i)}return o=Math.abs(o),r=Math.abs(r),s=Math.abs(s),a=Math.abs(a),o.toString(16)+r.toString(16)+s.toString(16)+a.toString(16)}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance();const n=this.clientConfig.get("env"),o=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!![],endpoint:o,batchSize:n===i.PRODUCTION?5:10,batchInterval:n===i.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(n,i,o={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(n))return;const r=Date.now(),s="event_"+r+"_"+Math.random().toString(36).slice(2,11);try{const a={eventId:s,timestamp:r,level:n,message:i,context:o.context,error:o.error?this.buildErrorContext(o.error):void 0,component:o.component,data:o.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(a)}catch(a){this.handleInternalError(a)}}buildErrorContext(n){return{name:n.name,message:n.message,stack:this.truncateStackTrace(n.stack),code:n.code,statusCode:n.status||n.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(n){switch(n){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(n){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(n),this.stats.totalEvents++,this.stats.eventsByLevel[n.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 n;if(0===this.eventQueue.length||!(null===(n=this.config)||void 0===n?void 0:n.endpoint))return;const i=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const o=this.createBatch(i);try{this.sendBatch(o),this.stats.batchesSent++}catch(r){this.stats.failedBatches++,this.handleInternalError(r),this.eventQueue.unshift(...i),this.stats.queuedEvents=this.eventQueue.length}}createBatch(n){const i=Date.now(),o="batch_"+i+"_"+Math.random().toString(36).slice(2,9);return{batchId:o,timestamp:i,events:n}}sendBatch(n){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const i=new Blob([JSON.stringify(n)],{type:"text/plain"}),o=navigator.sendBeacon(this.config.endpoint,i);if(o)return}catch(i){return this.sendBatchViaXHR(n),void 0}this.sendBatchViaXHR(n)}sendBatchViaXHR(n){try{const i=new XMLHttpRequest;if(i.open("POST",this.config.endpoint,![]),i.setRequestHeader("Content-Type","text/plain"),i.send(JSON.stringify(n)),i.status<200||i.status>=300)throw new Error("XHR request failed with status: "+i.status)}catch(i){throw new Error("Both sendBeacon and XHR failed: "+i.message)}}truncateStackTrace(n){if(n)return n.split("\n").slice(0,10).join("\n")}handleInternalError(n){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",n)}shutdown(){var n;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(n=this.config)||void 0===n?void 0:n.endpoint))){const n=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(n),this.stats.batchesSent++}catch(i){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(n={}){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,...n}}initialize({data:n,config:i}){var o;this.D=Object.freeze(n),this.F=Object.freeze({type:i.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(o=null==i?void 0:i.useShadowDom)&&void 0!==o?o:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(n){return n.map(n=>this.interpolatePath(n))}interpolatePath(n){if("string"!=typeof n)return n;const i=/\{([^}]+)}/g;return n.replace(i,(i,o)=>{const r=this.D[o];return null==r?(this.logger.warn('Parameter "'+o+'" not found in component params for path "'+n+'"'),i):String(r)})}connectedCallback(){var n,i;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.F.useShadowDom?this.attachShadow({mode:this.clientConfig.isDevelopment()?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(n=this.connected)||void 0===n||n.call(this)}catch(o){this.logger.error("Component connectedCallback error in "+((null===(i=this.F)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"connectedCallback")}}disconnectedCallback(){var n,i;try{this.cleanup(),null===(n=this.disconnected)||void 0===n||n.call(this)}catch(o){this.logger.error("Component disconnectedCallback error in "+((null===(i=this.F)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"disconnectedCallback")}}setup(){var n,i,o;try{this.updateHostClasses(),this.updateHostAttributes(),null===(n=this.beforeSetupStoreWatchers)||void 0===n||n.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(i=this.beforeConnected)||void 0===i||i.call(this)}catch(r){this.logger.error("Component setup error in "+((null===(o=this.F)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const i of this.unsubscribers)try{i()}catch(n){this.logger.error("Cleanup error during component destruction",n),n instanceof Error&&this.captureComponentError(n,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var n;if(!this.reactiveOptions.autoDestroy)return;let i=this.reactiveOptions.autoDestroyPath;if(!i&&(null===(n=this.reactiveOptions.watchStorePaths)||void 0===n?void 0:n.length)&&(i=this.reactiveOptions.watchStorePaths[0]),!i)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const o=this.interpolatePath(i),r=this.store.watch(o,(n,i)=>{this.isDestroyed||void 0===n&&void 0!==i&&this.handleAutoDestroy(o)});this.unsubscribers.push(r),this.logger.debug("🔥 AutoDestroy enabled for "+this.F.tagName+" watching path: "+o)}handleAutoDestroy(n){var i;if(this.isDestroyed)return;this.logger.debug("🔥 AutoDestroy triggered for "+this.F.tagName+' - path "'+n+'" was removed'),null===(i=this.beforeAutoDestroy)||void 0===i||i.call(this,n);const o=this.reactiveOptions.autoDestroyDelay||0;o>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},o):this.destroyComponent()}destroyComponent(){var n;if(!this.isDestroyed)try{null===(n=this.onAutoDestroy)||void 0===n?void 0:n.call(this),this.remove()}catch(i){this.logger.error("Error during auto-destroy of "+this.F.tagName,i),i instanceof Error&&this.captureComponentError(i,"auto-destroy")}}setupStoreWatchers(){var n;try{let n=this.reactiveOptions.watchStorePaths;if(!(null==n?void 0:n.length)||!this.D)return;n=this.interpolateStorePaths(n);const i=this.store.watchMany(n,n=>{var i,o;try{if(this.isDestroyed)return;const o=n.map(n=>n.path).join(", "),r="store:["+o+"]",s=null===(i=this.onStoreChanged)||void 0===i?void 0:i.call(this,n);s!==![]&&this.triggerRender(r)}catch(r){this.logger.error("Store watcher callback error in "+((null===(o=this.F)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"storeWatcher")}});this.unsubscribers.push(i)}catch(i){this.logger.error("Store watchers setup error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setupStoreWatchers")}}setupNonRenderingWatchers(){var n;try{let n=this.reactiveOptions.watchOnlyStorePaths;if(!(null==n?void 0:n.length)||!this.D)return;n=this.interpolateStorePaths(n);const i=this.store.watchMany(n,n=>{var i,o;try{if(this.isDestroyed)return;null===(i=this.onStoreWatch)||void 0===i?void 0:i.call(this,n)}catch(r){this.logger.error("Non-rendering watcher callback error in "+((null===(o=this.F)||void 0===o?void 0:o.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"nonRenderingWatcher")}});this.unsubscribers.push(i)}catch(i){this.logger.error("Non-rendering watchers setup error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setupNonRenderingWatchers")}}triggerRender(n){this.lastRenderTrigger=n,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var n,i;if(!this.initialized||this.isDestroyed)return;const o=performance.now();this.renderCount++;try{const i=this.template();"string"==typeof i&&(this.container.innerHTML=i),i instanceof HTMLElement&&safeReplaceChildren(this.container,i),Array.isArray(i)&&safeReplaceChildren(this.container,...i);const s=performance.now()-o;this.logRenderInfo(s);try{null===(n=this.afterRender)||void 0===n?void 0:n.call(this)}catch(r){this.logger.error("❌ afterRender hook error in "+this.F.tagName,r),r instanceof Error&&this.captureComponentError(r,"afterRender")}}catch(s){const n=performance.now()-o;this.logger.error("❌ Component render error in "+this.F.tagName,s),this.captureComponentError(s,"render",n),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.F.type,message:s instanceof Error?s.message:String(s)}));try{null===(i=this.onError)||void 0===i?void 0:i.call(this,s,"render")}catch(a){this.logger.error("❌ onError hook error in "+this.F.tagName,a)}}}logRenderInfo(n){const i=this.F.type,o=this.F.tagName,r=n>16?"🐌":n>8?"⚡":"🚀";this.logger.debug("Rendered "+r+" "+i+" </"+o+"> | #"+this.renderCount+" | "+n.toFixed(2)+"ms | "+this.lastRenderTrigger),n>16&&(this.logger.warn("⚠️ Slow render in "+i+"("+o+"): "+n.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:n,threshold:16,componentType:i,tagName:o,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+n.toFixed(2)+"ms",{context:"Component:"+o+":performance",component:{type:i,tagName:o,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this.F.useShadowDom}}))}rerender(n){this.triggerRender(n?"manual:rerender:"+n:"manual:rerender()")}captureComponentError(n,i,o){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",n.message,{context:"Component:"+this.F.tagName+":"+i,component:{type:this.F.type,tagName:this.F.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:o,useShadowDom:this.F.useShadowDom}})}catch(r){}}updateHostClasses(){const n=this.hostClasses;if(n.length>0){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());i.length>0&&this.classList.add(...i)}}addHostClasses(...n){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());i.length>0&&this.classList.add(...i)}removeHostClasses(...n){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());i.length>0&&this.classList.remove(...i)}toggleHostClasses(...n){const i=n.filter(n=>n&&"string"==typeof n&&n.trim());for(const o of i)this.classList.toggle(o)}addHostAttribute(n,i){n&&"string"==typeof n&&i&&"string"==typeof i&&(this.setAttribute(n,String(i)),this.hostAttributes[n]=String(i))}removeHostAttribute(n){n&&"string"==typeof n&&(this.removeAttribute(n),delete this.hostAttributes[n])}updateHostAttributes(){const n=this.hostAttributes;for(const[i,o]of Object.entries(n))i&&"string"==typeof i&&o&&"string"==typeof o&&this.setAttribute(i,String(o))}get params(){return this.D}get config(){return this.themeProvider.getComponentConfig(this.F.type)}get elementConfig(){return this.F}getConfigs(n){return this.themeProvider.getConfigs(n)}getStoreValue(n){return this.store.get(n)}setStoreValue(n,i){return this.store.set(n,i)}watchStore(n,i){const o=this.store.watch(n,i);return this.unsubscribers.push(o),o}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var n;const i=null!==(n=this.params.options)&&void 0!==n?n:{};return ComponentFactoryService.createElement({type:s.ADDRESS_DISPLAY,isIndependentComponent:!![],options:i})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var n,i,o,r;const a=this.getStoreValue("address"),c=null!==(n=this.params.isIndependentComponent)&&void 0!==n?n:![],l=null!==(i=this.params.productId)&&void 0!==i?i:"",u=null!==(o=this.params.options)&&void 0!==o?o:{},h=null!==(r=u.showLabel)&&void 0!==r?r:!![],p=[];if(h){const n=document.createElement("span");n.textContent="Delivers to:",p.push(n)}const m=document.createElement("button");m.type="button",m.textContent=a.formattedAddress||"Select an address";const f=a.formattedAddress?"Change delivery address, currently set to "+a.formattedAddress:"Select delivery address";return m.setAttribute("aria-label",f),m.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}))}),p.push(m),p}}const ArrowRightIcon=({width:n=16,height:i=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="arrow-right-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:n=24,height:i=24,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 489 489" class="bag-icon '+o+'" 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:n=16,height:i=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="checkbox-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:n=16,height:i=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="'+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:n=16,height:i=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="chevron-left-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},CloseIcon=({width:n=16,height:i=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="close-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:n=16,height:i=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="error-info-icon '+o+'" style="'+s+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:n=16,height:i=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="info-icon '+o+'" style="'+s+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:n=16,height:i=16,className:o="",color:r=null})=>{const s=r||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="search-icon '+o+'">\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:n=16,height:i=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="success-icon '+o+'" style="'+s+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:n=16,height:i=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="trash-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:n=16,height:i=16,className:o="",color:r=null})=>{const s=r?"--icon-color: "+r:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+n+'" height="'+i+'" viewBox="0 0 16 16" class="warning-icon '+o+'" style="'+s+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var n;return null!==(n=this.params.isIndependentComponent)&&void 0!==n?n:![]},this.handleInputChange=n=>{const i=n.target,o=i.value.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const r=/^\d/.test(o);if(o.length<this.minSearchLength||!r)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(o)},300)},this.closeDrawer=async()=>{const n=this.params.productId,i=this.clientConfig.isMobile(),o=this.isIndependentComponent();(i||o)&&this.commands.ui.closeDrawer(),!i&&n&&await this.commands.product.closeProductDrawer(n)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(L){this.logger.error("Address edit cancellation failed",L)}},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 n=this.getStoreValue("address"),i=(null==n?void 0:n.coordinates.lat)!==this.selectedAddress.coordinates.lat||(null==n?void 0:n.coordinates.long)!==this.selectedAddress.coordinates.long;i&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(n){this.logger.error("Address selection and availability check failed",n),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async n=>{const i=n.currentTarget.dataset.suggestionId;if(i)try{this.error=null,this.updateErrorDisplay();const n=await this.commands.address.getAddressDetails(i);if(0===Object.keys(n).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:i,address:n.address,coordinates:n.coords,formattedAddress:n.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(o){this.logger.error("Address details retrieval failed",o),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=n=>{this.container.contains(n.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const n=this.getStoreValue("address");(null==n?void 0:n.formattedAddress)&&(this.selectedAddress=n)}async searchAddresses(n){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const i=await this.commands.address.searchAddresses(n);this.suggestions=i.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(i){this.logger.error("Address search operation failed",i),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 n=this.errorContainer.querySelector(".error-text");n&&(n.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const n=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(n),void 0}for(const n of this.suggestions){const i=this.createElement("li",{className:"suggestion-item"}),o=this.createElement("span",{textContent:n.description});i.appendChild(o),i.setAttribute("data-suggestion-id",n.id),i.setAttribute("role","option"),i.setAttribute("aria-label","Select address: "+n.description),i.setAttribute("tabindex","0"),i.addEventListener("click",this.handleSuggestionClick),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),i.click())}),this.suggestionsContainer.appendChild(i)}}}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(n,i){const o=document.createElement(n);return i&&Object.assign(o,i),o}createErrorContainer(){const n=this.createElement("div",{className:"error-message"});n.style.display="none",n.setAttribute("role","alert"),n.setAttribute("aria-live","assertive"),n.setAttribute("aria-atomic","true");const i=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),o=this.createElement("span",{className:"error-text"});return n.appendChild(i),n.appendChild(o),n}createCheckButton(){const n=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return n.setAttribute("aria-label","Save and check address availability"),n.addEventListener("click",this.handleCheckAvailability),n}createCancelButton(){const n=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return n.setAttribute("aria-label","Cancel address selection"),n.addEventListener("click",this.handleCancel),n}template(){var n,i,o;const r=this.getConfigs("global"),s=null!==(n=this.params.options)&&void 0!==n?n:{},a=null!==(i=s.showLabel)&&void 0!==i?i:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),a){const n=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(n)}const c=this.createElement("div",{className:"input-wrapper "+r.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(o=this.selectedAddress)||void 0===o?void 0:o.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 u=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),h=[this.inputContainer,u,this.errorContainer],p=this.createElement("div",{className:"action-buttons"}),m=this.createCancelButton();p.appendChild(m);const f=this.createCheckButton();return p.appendChild(f),h.push(p),document.addEventListener("click",this.handleDocumentClick),h}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const n=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&n.push("cart-no-header"),this.params.isIndependentComponent&&n.push("independent"),n}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const n=[],i=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!i){const i=ComponentFactoryService.createElement({type:s.CART_HEADER});n.push(i)}const o=ComponentFactoryService.createElement({type:s.CART_BODY});n.push(o);const r=ComponentFactoryService.createElement({type:s.CART_FOOTER});return n.push(r),n}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const n=document.createElement("div");n.className="empty-cart-container";const i=document.createElement("h3");return i.className="empty-cart-content",i.textContent="Your cart is empty",n.appendChild(i),n}createLoadingElement(){const n=document.createElement("div");return n.setAttribute("data-component-type","cart-body-loading"),n.innerHTML=this.loadingTemplate(),n}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(n){try{return ComponentFactoryService.createElement({type:s.CART_RETAILER,retailerId:n.id})}catch(i){return this.logger.error("Cart retailer component creation failed",i),document.createElement("div")}}getRetailerElementById(n){return this.container.querySelector('[data-retailer-id="'+n+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const n=this.createEmptyCartElement();this.container.appendChild(n),this.setupEmptyCartListeners()}addLoadingOverlay(){const n=this.getLoadingElement();if(!n){const n=this.createLoadingElement();this.container.appendChild(n)}}removeLoadingOverlay(){const n=this.getLoadingElement();n&&n.remove()}setupEmptyCartListeners(){const n=this.container.querySelector('[data-action="continue-shopping"]');n&&n.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(n,i){const o=this.createRetailerElement(i);o.setAttribute("data-retailer-id",n),this.container.appendChild(o)}removeRetailerElement(n){const i=this.getRetailerElementById(n);i&&i.remove()}updateRetailerElement(n,i){const o=this.getRetailerElementById(n);if(o){const r=this.createRetailerElement(i);r.setAttribute("data-retailer-id",n),o.replaceWith(r)}}hasRetailerDataChanged(n,i){return n?![]:!![]}getValidRetailers(n){if(!n)return{};const i={};for(const[o,r]of Object.entries(n))r&&"object"==typeof r&&r.id&&(i[o]=r);return i}getValidRetailerIds(n){const i=this.getValidRetailers(n);return new Set(Object.keys(i))}onStoreChanged(n){const i=n.find(n=>"cart.retailers"===n.path),o=n.find(n=>"cart.loading"===n.path);if(i){const n=this.getValidRetailers(i.oldValue),o=this.getValidRetailers(i.value),r=this.getValidRetailerIds(i.oldValue),s=this.getValidRetailerIds(i.value),a=r.size,c=s.size,l=this.getValidRetailers(this.getStoreValue("cart.retailers")),u=Object.keys(l).length;if(c>0&&0===u)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===a&&c>0){this.container.innerHTML="";for(const[n,i]of Object.entries(o))this.addRetailerElement(n,i)}else if(a>0&&0===c)this.showEmptyCartState();else if(c>0){for(const n of r)s.has(n)||this.removeRetailerElement(n);for(const i of s){const s=o[i],a=n[i];r.has(i)?this.hasRetailerDataChanged(a,s)&&this.updateRetailerElement(i,s):this.addRetailerElement(i,s)}}else 0===a&&0===c&&this.showEmptyCartState()}if(o){const n=o.value,i=o.oldValue;n!==i&&(n?this.addLoadingOverlay():this.removeLoadingOverlay())}return o||i,![]}afterRender(){this.setupEmptyCartListeners();const n=this.getStoreValue("cart.loading");n&&this.addLoadingOverlay()}template(){const n=this.getStoreValue("cart.retailers")||{},i=Object.values(n);if(0===i.length)return this.createEmptyCartElement();const o=[];for(const r of i){const n=this.createRetailerElement(r);n.setAttribute("data-retailer-id",r.id),o.push(n)}return o}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(n){const i=n.some(n=>n.path.includes("cart.items")),o=n.some(n=>n.path.includes("cart.totals")),r=n.some(n=>n.path.includes("cart.fulfillments")),s=n.some(n=>"cart.loading"===n.path),a=n.some(n=>n.path.includes("cart.retailers"));if(i&&this.updateSubtotalItemsCount(),o&&this.subtotalPrice){const n=this.getStoreValue("cart.totals.subtotal")||0,i=this.getStoreValue("cart.totals.engravingFee")||0;this.subtotalPrice.textContent=""+formatCentToDollarText(n+i)}(r||o||s||i||a)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const n=this.getStoreValue("cart.loading");if(n)return!![];const i=this.getStoreValue("cart.items")||{},o=Object.values(i).some(n=>n.updating);if(o)return!![];const r=this.getStoreValue("cart.fulfillments")||{},s=Object.values(r).some(n=>n.updating);if(s)return!![];const a=this.getStoreValue("cart.retailers")||{},c=Object.values(a).some(n=>n.updating);return c?!![]:![]}hasUnmetMinimum(n){var i;const o=n.subtotal;if(n.type===a.SHIPPING){const r=n.fees;if((null===(i=r.individual)||void 0===i?void 0:i.active)&&r.individual.min>0&&o<r.individual.min)return!![]}if(n.type===a.ON_DEMAND){const i=n.fees;if(i.min>0&&o<i.min)return!![]}return![]}shouldDisableCheckout(){const n=this.getStoreValue("cart.fulfillments")||{};return Object.values(n).some(n=>this.hasUnmetMinimum(n))}updateCheckoutButtonState(){const n=this.getStoreValue("cart.items")||{},i=Object.keys(n).length>0;if(this.checkoutButton){const n=this.isAnythingLoading(),o=this.shouldDisableCheckout(),r=n||o||!i;this.checkoutButton.disabled=r,this.checkoutButton.classList.toggle("checkout-btn-disabled",r),this.checkoutButton.classList.toggle("loading",n)}}updateSubtotalItemsCount(){const n=this.getStoreValue("cart.items"),i=Object.values(n).reduce((n,i)=>n+i.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+i+" item"+(1!==i?"s":"")+"):")}handleCheckout(n){return this.clientConfig.isBuilder()?(n.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(n.preventDefault(),void 0):(this.commands.cart.handleGoToCheckout(),void 0)}template(){const n=this.getConfigs("global"),i=this.getStoreValue("cart.totals.subtotal")||0,o=this.getStoreValue("cart.totals.engravingFee")||0,r=[],a=document.createElement("div");a.className="cart-footer-header";const c=document.createElement("div");c.className="cart-footer-items-price";const l=document.createElement("span");l.className="subtotal-text",l.textContent="Subtotal (0 items):",this.subtotalText=l,c.appendChild(l);const u=document.createElement("span");u.className="subtotal-price",u.textContent=formatCentToDollarText(i+o),this.subtotalPrice=u,c.appendChild(u);const h=document.createElement("p");if(h.textContent="Taxes & fees will be calculated at checkout",h.className="taxes-fees-info",a.appendChild(c),a.appendChild(h),r.push(a),n.layout.allowPromoCodes){const n=ComponentFactoryService.createElement({type:s.CART_PROMO_CODE});r.push(n)}const p=ComponentFactoryService.createElement({type:s.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});r.push(p);const m=document.createElement("button");if(m.type="button",m.className="checkout-button",m.setAttribute("aria-label","Go to checkout"),m.addEventListener("click",n=>this.handleCheckout(n)),m.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleCheckout(n))}),m.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton=m,r.push(m),n.layout.showPoweredBy){const n=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"general"});r.push(n)}return r}}const ht={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"},pt="America/New_York";function detectUserTimezone(n){try{if(n){const i=n.toUpperCase(),o=ht[i];return o||pt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return pt}}function getCurrentTimeInTimezone$1(n){try{const i=new Date,o=i.getTime(),r=6e4*i.getTimezoneOffset(),s=new Date(o+r),a=new Date(s.toLocaleString("en-US",{timeZone:n})),c=s.getTime()-a.getTime();return new Date(o+c)}catch(i){return new Date}}function getCurrentTimeInUserTimezone(n){const i=detectUserTimezone(n);return getCurrentTimeInTimezone$1(i)}function isDateTimeInRange(n){const{startDate:i,endDate:o,addressState:r}=n;try{const n=getCurrentTimeInUserTimezone(r),s=!i||n>=new Date(i),a=!o||n<=new Date(o);return s&&a}catch(s){return![]}}function filterActiveItems(n,i){return n.filter(n=>isDateTimeInRange({startDate:n.activeFrom,endDate:n.activeUntil,addressState:i}))}function hasActiveItems(n,i){return filterActiveItems(n,i).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var n,i,o;const r=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=r,c.appendChild(l);const u=document.createElement("button");u.type="button",u.className="cart-header-close-btn",u.innerHTML=CloseIcon({width:16,height:16}),u.setAttribute("aria-label","Close cart drawer"),u.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),c.appendChild(u);const h=this.clientConfig.get("promoTicker"),p=null!==(i=null===(n=null==a?void 0:a.experienceFeatures)||void 0===n?void 0:n.promoTicker)&&void 0!==i?i:[],m=null!=h?h:p,f=this.store.get("address"),g=hasActiveItems(m,null===(o=null==f?void 0:f.address)||void 0===o?void 0:o.state);if(!m.length||!g)return[c];const v=ComponentFactoryService.createElement({context:"cart",type:s.PROMO_CODE_TICKER,tickers:m});return[c,v]}}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(n,i){var o,r,a,c,l,u,h,p,m,f;this.commands.ui.openDrawer(s.ENGRAVING_FORM,{identifier:n,context:"cart",lines:(null===(r=null===(o=i.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[],maxLines:(null===(c=null===(a=i.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.maxLines)||1,maxCharsPerLine:(null===(u=null===(l=i.attributes)||void 0===l?void 0:l.engraving)||void 0===u?void 0:u.maxCharsPerLine)||16,fee:(null===(p=null===(h=i.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.fee)||0,location:null===(f=null===(m=i.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.location})}template(){var n,i,o,r,a,c,l,u,h;const p=this.params.itemId,m=this.getStoreValue("cart.items."+p),f=this.getConfigs("global"),g=this.getStoreValue("cart.fulfillments."+m.fulfillmentId),v=m.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(n=null==g?void 0:g.expectation)||void 0===n?void 0:n.detail)||"",y=document.createElement("article");y.className="cart-item";const b=document.createElement("div");b.className="item-image";const x=document.createElement("img");x.src=m.mainImage,x.alt=m.name,b.appendChild(x);const w=document.createElement("div");w.className="item-details";const C=document.createElement("div");C.className="item-header";const k=document.createElement("h3");k.className="item-title",k.textContent=m.name;const S=document.createElement("button");S.className="item-delete",S.innerHTML=TrashIcon({}),S.setAttribute("role","button"),S.setAttribute("tabindex","0"),S.setAttribute("aria-label","Remove "+m.name+" from cart"),S.setAttribute("aria-expanded","true"),S.addEventListener("click",async()=>{await this.commands.cart.removeItem(p)}),S.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.commands.cart.removeItem(p))}),C.appendChild(k),C.appendChild(S);const E=document.createElement("div");E.className="item-specs",E.textContent=m.size+", "+m.container;const T=document.createElement("div");T.className="item-shipping-container";const P=document.createElement("div");if(P.className="item-shipping",P.textContent=v,T.appendChild(P),f.layout.enablePersonalization&&(null===(o=null===(i=null==m?void 0:m.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.isEngravable)&&(null===(a=null===(r=null==m?void 0:m.attributes)||void 0===r?void 0:r.engraving)||void 0===a?void 0:a.hasEngraving)===![]&&g.canEngrave){const n=document.createElement("span");n.className="cart-add-personalization-span",n.textContent=f.layout.personalizationText+" +"+formatCentToDollarText((null===(l=null===(c=m.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.fee)||0,![]),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Add personalization to "+m.name),n.addEventListener("click",()=>this.handleOpenEngravingForm(p,m)),n.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleOpenEngravingForm(p,m))}),T.appendChild(n)}w.appendChild(C),w.appendChild(E),w.appendChild(T),y.appendChild(b),y.appendChild(w);const D=[y],_=ComponentFactoryService.createElement({type:s.CART_ITEM_QUANTITY_PRICE,itemId:p});if((null===(h=null===(u=null==m?void 0:m.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.hasEngraving)===!![]){const n=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:p,context:"cart"});D.push(n)}return D.push(_),D}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(n){const i=n.find(n=>"cart.items"===n.path);if(i){const n=this.calculateQuantityLimits();this.updateButtonStates(n)}}getItemStore(){const n=this.params.itemId,i=this.getStoreValue("cart.items."+n);return i||null}calculateQuantityLimits(){const n=this.getItemStore();if(!n)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const i=n.quantity,o=this.getAvailableQuantity(),r=o>0;return{currentQuantity:i,availableQuantity:o,canIncrease:r,canDecrease:!![]}}getAvailableQuantity(){var n,i,o,r;const s=this.getItemStore();if(!s)return 0;const a=s.partNumber,c=s.fulfillmentId,l=this.getStoreValue("cart.items")||{},u=Object.values(l).filter(n=>n.partNumber===a&&n.fulfillmentId===c),h=u.reduce((n,i)=>n+i.quantity,0),p=this.getStoreValue("products."+s.upc)||this.getStoreValue("products."+s.salsifyGrouping);if(!p)return s.maxQuantity-h;const m=null!==(r=null===(o=null===(i=null===(n=null==p?void 0:p.sizes)||void 0===n?void 0:n[s.liquidId])||void 0===i?void 0:i.attributes)||void 0===o?void 0:o.maxQuantityPerOrder)&&void 0!==r?r:0;return!m||m<=0?s.maxQuantity-h:m-h}updateButtonStates(n){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!n.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!n.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!n.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!n.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=n.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+n.currentQuantity))}async handleQuantityChange(n){const i=this.calculateQuantityLimits();n>0&&!i.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,n)}createQuantityContainer(){const n=this.calculateQuantityLimits(),i=this.getItemStore();if(!i)return document.createElement("div");const o=document.createElement("div");return o.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 n=>{n.preventDefault(),n.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 n=>{n.preventDefault(),n.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(n),o.appendChild(this.qtyDecreaseButton),o.appendChild(this.quantitySpan),o.appendChild(this.qtyIncreaseButton),o}createPriceContainer(){const n=this.getItemStore();if(!n)return document.createElement("div");const i=document.createElement("div");i.className="item-price-container";const o=document.createElement("span");if(o.className="item-price",o.textContent=formatCentToDollarText(n.price),i.appendChild(o),n.quantity>1){const o=document.createElement("span");o.className="item-price-per-unit",o.textContent="("+formatCentToDollarText(n.unitPrice)+" ea)",i.appendChild(o)}return i}template(){const n=[];if(this.config.layout.showQuantityCounter){const i=this.createQuantityContainer();n.push(i)}const i=this.createPriceContainer();return n.push(i),n}}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(n){const i=n.find(n=>"cart.promoCode"===n.path);if(i){const{value:n,oldValue:o}=i,r=Boolean(null==o?void 0:o.code),s=Boolean(null==n?void 0:n.code);if(!r&&s)return this.container.innerHTML="",this.createAppliedContainer(n),void 0;if(r&&!s)return this.container.innerHTML="",this.createInputContainer(),void 0;if(s&&this.promoCodePill&&n.discountAmount!==(null==o?void 0:o.discountAmount))return this.promoCodePill.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")",void 0}}createAppliedContainer(n){const i=document.createElement("div");i.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==n?void 0:n.code)+" (- "+formatCentToDollarText((null==n?void 0:n.discountAmount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("promo-remove-btn"),o.textContent="Remove",o.setAttribute("role","button"),o.setAttribute("aria-label","Remove promo code "+(null==n?void 0:n.code)),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||this.commands.cart.removePromoCode()}),i.appendChild(this.promoCodePill),i.appendChild(o),this.container.appendChild(i),this.promoInput=null,this.applyButton=null}createInputContainer(){const n=document.createElement("div");n.classList.add("promo-code-container");const i=document.createElement("div");i.classList.add("promo-container"),i.appendChild(this.createPromoInput()),i.appendChild(this.createApplyButton()),n.appendChild(i),this.container.appendChild(n),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const n=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),i=n.length>=3&&n.length<=255,o=this.getStoreValue("cart.loading"),r=this.getStoreValue("cart.promoCode"),s=this.getStoreValue("cart.events")||[],a=hasCartAnyPromoCodeEvents(s);this.applyButton.disabled=!i||o||Boolean(null==r?void 0:r.discountAmount)||this.isApplying||a}createPromoInput(){const n=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+n.layout.inputFieldStyle,validation:{min:3,max:255},onChange:n=>{const i=n.toUpperCase(),o=this.promoInput;o.setValue(i),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("aria-label","Apply promo code");const K=async()=>{const n=this.promoInput.getValue().trim().toUpperCase();if(n)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(n),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(i){this.logger.error("Cart promo code application failed",{promoCode:n,error:i instanceof Error?i.message:String(i)})}};return this.applyButton.addEventListener("click",K),this.applyButton.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),K())}),this.applyButton}template(){const n=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==n?void 0:n.code){const i=document.createElement("div");i.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("promo-remove-btn"),o.textContent="Remove",o.setAttribute("role","button"),o.setAttribute("aria-label","Remove promo code "+n.code),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||this.commands.cart.removePromoCode()}),i.appendChild(this.promoCodePill),i.appendChild(o),i}const i=document.createElement("div");i.classList.add("promo-code-container");const o=document.createElement("div");return o.classList.add("promo-container"),o.appendChild(this.createPromoInput()),o.appendChild(this.createApplyButton()),i.appendChild(o),i}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(n){return ComponentFactoryService.createElement({type:s.CART_FULFILLMENT,fulfillmentId:n})}getFulfillmentElementById(n){return this.container.querySelector('[data-fulfillment-id="'+n+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const n=this.getFulfillmentContainer();if(n)return{parent:n.parentElement,nextSibling:n.nextElementSibling};const i=this.container.querySelectorAll("[data-fulfillment-id]");if(i.length>0){const n=i[i.length-1];return{parent:n.parentElement,nextSibling:n.nextElementSibling}}return null}addFulfillmentElement(n){const i=this.getFulfillmentInsertionPoint();if(i){const o=this.createFulfillmentElement(n);o.setAttribute("data-fulfillment-id",n);const r=this.getFulfillmentContainer();r&&r.remove(),i.nextSibling?i.parent.insertBefore(o,i.nextSibling):i.parent.appendChild(o)}}removeFulfillmentElement(n){const i=this.getFulfillmentElementById(n);if(i){const n=i.parentElement,o=i.nextElementSibling;i.remove();const r=this.container.querySelectorAll("[data-fulfillment-id]");if(0===r.length){const i=document.createElement("div");i.id="retailer-fulfillment-container",o?n.insertBefore(i,o):n.appendChild(i)}}}handleFulfillmentsUpdate(n,i){const o=new Set(n||[]),r=new Set(i||[]);for(const s of o)r.has(s)||this.removeFulfillmentElement(s);for(const s of r)o.has(s)||this.addFulfillmentElement(s)}setupFulfillmentElements(){const n=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+n+".fulfillments")||[],o=this.container.querySelectorAll("[data-fulfillment-id]");for(const s of o)s.remove();let r=this.getFulfillmentContainer();if(!r){const n=this.container.querySelector(".retailer-body-container"),i=this.container.querySelector("#retailer-subtotal-container");r=document.createElement("div"),r.id="retailer-fulfillment-container",n&&i&&n.insertBefore(r,i)}for(const s of i)this.addFulfillmentElement(s)}setupSubtotalElement(){const n=this.getRetailerId(),i=this.container.querySelector("#retailer-subtotal-container");if(i){const o=ComponentFactoryService.createElement({type:s.CART_RETAILER_SUBTOTAL,retailerId:n});i.replaceWith(o)}}onStoreChanged(n){const i=this.getRetailerId(),o="cart.retailers."+i,r=n.find(n=>n.path===o);if(r){const n=r.oldValue,i=r.value,o=(null==n?void 0:n.fulfillments)||[],s=(null==i?void 0:i.fulfillments)||[];JSON.stringify(o)!==JSON.stringify(s)&&this.handleFulfillmentsUpdate(o,s)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const n=this.container.querySelector(".section-toggle"),i=this.container.querySelector(".retailer-section"),o=this.container.querySelector(".section-header-label");if(n&&i&&o){const d=()=>{const i=n.checked;o.setAttribute("aria-label",i?"Expand retailer section":"Collapse retailer section"),o.setAttribute("aria-expanded",i?"false":"true")};n.addEventListener("change",()=>{n.checked?i.classList.add("collapsed"):i.classList.remove("collapsed"),d()}),o.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),n.click())}),n.checked?i.classList.add("collapsed"):i.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 n=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+n),o=document.createElement("section");o.className="retailer-section";const r=document.createElement("div");r.className="cart-retailer-header";const s=document.createElement("div");s.className="retailer-info";const a=document.createElement("h2");a.className="section-title",a.textContent=i.name,s.appendChild(a);const c=document.createElement("input");c.type="checkbox",c.id=i.id,c.className="section-toggle",s.appendChild(c);const l=document.createElement("label");l.htmlFor=i.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 u=document.createElement("span");u.className="chevron",u.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),l.appendChild(u),s.appendChild(l),r.appendChild(s),o.appendChild(r);const h=document.createElement("div");h.className="retailer-body-container";const p=document.createElement("div");p.id="retailer-fulfillment-container",h.appendChild(p);const m=document.createElement("div");return m.id="retailer-subtotal-container",h.appendChild(m),o.appendChild(h),o}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(n,i){const o=Object.values(n||{}).filter(n=>n.retailerId===i);let r=0;for(const s of o)r+=s.quantity;return r}template(){const n=this.params.retailerId,i=this.getStoreValue("cart.retailers."+n+".subtotal")||0,o=this.getStoreValue("cart.retailers."+n+".engravingFee")||0,r=this.getStoreValue("cart.items"),s=this.getRetailerItemCount(r,n),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(i+o),[c,l]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.isPresaleLocked","checkout.presaleExpiresAt"]})}template(){var n,i,o;const r=this.store.get("checkout.isPresaleLocked"),a=this.store.get("checkout.presaleExpiresAt"),c=this.getConfigs("global"),l=this.clientConfig.get("promoTicker"),u=null!==(i=null===(n=null==c?void 0:c.experienceFeatures)||void 0===n?void 0:n.promoTicker)&&void 0!==i?i:[],h=null!=l?l:u,p=this.store.get("address"),m=hasActiveItems(h,null===(o=null==p?void 0:p.address)||void 0===o?void 0:o.state),f=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),g=r&&a,v=document.createElement("div");v.classList.add("checkout-container"),f&&v.classList.add("no-header"),this.params.isIndependentComponent&&v.classList.add("independent");const y=ComponentFactoryService.createElement({type:s.CHECKOUT_INFORMATION_SECTION});v.appendChild(y);const b=ComponentFactoryService.createElement({type:s.CHECKOUT_SUMMARY_SECTION});if(v.appendChild(b),!g&&(!h.length||!m)&&f)return[v];const x=document.createElement("div");if(x.classList.add("checkout-header-wrapper"),!f){const n=ComponentFactoryService.createElement({type:s.CHECKOUT_HEADER});x.appendChild(n)}if(h.length&&m&&!g){const n=ComponentFactoryService.createElement({context:"checkout",type:s.PROMO_CODE_TICKER,tickers:h});x.appendChild(n)}if(g){const n=ComponentFactoryService.createElement({type:s.CHECKOUT_PRESALE_COUNTDOWN});x.appendChild(n)}return[x,v]}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const n=this.store.get("checkout.isPresaleLocked"),i=this.getConfigs("checkout");let o=null;if(!n){o=document.createElement("button"),o.classList.add("checkout-header-button"),o.setAttribute("aria-label","Back to Cart"),o.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 n=document.createElement("span");n.innerHTML=ChevronLeftIcon({}),o.appendChild(n)}const r=document.createElement("h1");r.textContent=(null==i?void 0:i.layout.drawerHeaderText)||"Checkout",r.classList.add("checkout-header-title"),r.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()}),o?[o,r,a]:[r,a]}}class CheckoutInformationSectionComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift"]})}onStoreWatch(n){const i=n.find(n=>"checkout.isGift"===n.path);i&&this.handleBuyerInformationVisibility(i.value)}handleBuyerInformationVisibility(n){const i=this.container.querySelector("#buyer-information-container");if(n&&!i){const n=ComponentFactoryService.createElement({type:s.CHECKOUT_BUYER_INFORMATION_FORM});n.id="buyer-information-container";const i=this.container.querySelector(".checkout-delivery-information");i&&i.insertAdjacentElement("afterend",n)}else!n&&i&&setTimeout(()=>{i.remove()},300)}template(){const n=[],i=ComponentFactoryService.createElement({type:s.CHECKOUT_DELIVERY_INFORMATION_FORM});n.push(i);const o=ComponentFactoryService.createElement({type:s.CHECKOUT_PAYMENT_FORM});n.push(o);const r=ComponentFactoryService.createElement({type:s.CHECKOUT_BILLING_FORM});return n.push(r),n}}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(n){var i;const o=n.find(n=>"checkout.presaleExpiresAt"===n.path);if(null==o?void 0:o.value)return this.updateExpiresAt(o.value),!![];const r=n.find(n=>"ui.drawer"===n.path);return(null===(i=null==r?void 0:r.value)||void 0===i?void 0:i.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const n=this.store.get("checkout.presaleExpiresAt");n&&this.updateExpiresAt(n),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var n,i;const o=[".drawer-content"];for(const s of o){const i=null===(n=this.rootElement)||void 0===n?void 0:n.closest(s);if(i&&this.isScrollable(i))return i}let r=null===(i=this.rootElement)||void 0===i?void 0:i.parentElement;for(;r&&r!==document.body;){if(this.isScrollable(r))return r;r=r.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var n,i;if(!this.scrollContainer)return;const o=this.scrollContainer.scrollTop,r=70,s=10;!this.isCurrentlyScrolled&&o>r?(this.isCurrentlyScrolled=!![],null===(n=this.rootElement)||void 0===n||n.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&o<s&&(this.isCurrentlyScrolled=![],null===(i=this.rootElement)||void 0===i||i.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(n){const i=window.getComputedStyle(n),o=i.overflowY;return n.scrollHeight>=n.clientHeight&&("auto"===o||"scroll"===o||"overlay"===o)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(n){this.stopCountdown();try{if(this.expiresAt=new Date(n),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:n}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const i=new Date,o=Math.floor((this.expiresAt.getTime()-i.getTime())/1e3);o<this.totalDuration&&(this.totalDuration=Math.max(o,240)),this.startCountdown()}catch(i){this.logger.error("Failed to parse presale expiration date",i),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 n=new Date,i=Math.max(0,this.expiresAt.getTime()-n.getTime()),o=i/1e3,r=this.totalDuration-o,s=Math.max(0,Math.min(100,r/this.totalDuration*100)),a=o<60;if(a!==this.isUnderOneMinute){this.isUnderOneMinute=a;const n=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==n||n.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==n||n.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}const c=this.rootElement.querySelector("[data-timer]");c&&(c.textContent=this.formatTime(i));const l=this.rootElement.querySelector("[data-progress-fill]");l&&(l.style.width=s+"%"),0===i&&this.handleExpire()}formatTime(n){const i=Math.floor(n/1e3),o=Math.floor(i/60),r=i%60,s=Math.floor(n%1e3/10);return o.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")}handleExpire(){this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer()}template(){const n=document.createElement("div");n.classList.add("checkout-presale-countdown"),this.rootElement=n;const i=document.createElement("div");i.classList.add("checkout-presale-text-container");const o=document.createElement("div");o.classList.add("checkout-presale-heading");const r=document.createElement("h2");r.textContent="LIMITED PRE-ORDER:";const s=document.createElement("div");s.classList.add("checkout-presale-timer"),s.setAttribute("data-timer",""),s.textContent="00:00:00",o.appendChild(r),o.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"),i.appendChild(o),i.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),n.appendChild(i),n.appendChild(c),n}}const mt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],ft={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(n,i){return"href"===n?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(i)?i:null:"src"===n?/^https?:\/\/[^\s<>"']+$/i.test(i)?i:null:"class"===n?i.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():i.replace(/[<>"']/g,"").trim()}function cleanNode(n){if(n.nodeType===Node.TEXT_NODE){const i=n.textContent||"",o=i.replace(/<[^>]*>/g,"");if(o.trim()){const n=document.createTextNode(o);return n}return null}if(n.nodeType===Node.ELEMENT_NODE){const i=n,o=i.tagName.toLowerCase();if(mt.includes(o)){const n=document.createElement(o),r=ft[o]||[];for(const o of Array.from(i.attributes)){const i=o.name.toLowerCase();if(r.includes(i)){const r=sanitizeAttributeValue(i,o.value);null!==r&&n.setAttribute(i,r)}}"a"===o&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"));for(const o of Array.from(i.childNodes)){const i=cleanNode(o);i&&n.appendChild(i)}return n}const r=document.createDocumentFragment();for(const n of Array.from(i.childNodes)){const i=cleanNode(n);i&&r.appendChild(i)}return r.childNodes.length>0?r:null}return null}function sanitizeHTML(n){if(!n||"string"!=typeof n)return"";try{const i=new DOMParser,o=i.parseFromString(n,"text/html"),r=o.querySelector("parsererror");if(r)return console.warn("HTML parsing error detected"),"";const s=document.createDocumentFragment();for(const n of Array.from(o.body.childNodes)){const i=cleanNode(n);i&&s.appendChild(i)}const a=document.createElement("div");return a.appendChild(s),a.innerHTML}catch(i){return console.error("HTML sanitization error:",i),""}}class CheckoutSummarySectionComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(n){const i=n.find(n=>"checkout.amounts"===n.path);if(i){const n=this.getStoreValue("checkout"),i=Object.values(n.items||{}).length;this.updateZeroAmountElement(0===n.amounts.total&&i>0)}}updateZeroAmountElement(n){const i=this.container.querySelector(".checkout-zero-amount-container");if(n&&!i){const n=document.createElement("div");n.classList.add("checkout-zero-amount-container"),n.textContent="Credit card required to complete order (even when fully covered by gift card)";const i=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");i&&i.after(n)}else!n&&i&&i.remove()}afterRender(){const n=this.getStoreValue("checkout.amounts");n&&this.updateZeroAmountElement(0===n.total)}marketingOptInsContainer(){const n=this.config.layout.emailOptIn,i=this.config.layout.smsOptIn;if(!n.show&&!i.show)return null;const o=document.createElement("div");if(o.classList.add("checkout-marketing-opt-ins-container"),n.show){const i=document.createElement("div");let r;i.classList.add("checkout-checkbox-container"),r=this.clientConfig.isBuilder()?n.checked:this.store.get("checkout.marketingPreferences.canEmail");const s=document.createElement("span");s.id="emailOptIn",s.classList.add("checkout-checkbox-visual"),r&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),s.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canEmail"),s.classList.toggle("checked")});const a=document.createElement("label");a.setAttribute("for","emailOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(n.text),a.addEventListener("click",n=>{const i=n.target,o="A"===i.tagName||i.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canEmail"),s.classList.toggle("checked"))}),i.appendChild(s),i.appendChild(a),o.appendChild(i)}if(i.show){const n=document.createElement("div");let r;n.classList.add("checkout-checkbox-container"),r=this.clientConfig.isBuilder()?i.checked:this.store.get("checkout.marketingPreferences.canSms");const s=document.createElement("span");s.classList.add("checkout-checkbox-visual"),s.id="smsOptIn",r&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),s.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canSms"),s.classList.toggle("checked")});const a=document.createElement("label");a.setAttribute("for","smsOptIn"),a.classList.add("checkbox-label"),a.innerHTML=sanitizeHTML(i.text),a.addEventListener("click",n=>{const i=n.target,o="A"===i.tagName||i.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canSms"),s.classList.toggle("checked"))}),n.appendChild(s),n.appendChild(a),o.appendChild(n)}return o}hasOnDemandOrder(){const n=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(n).length>0}template(){var n;const i=[],o=this.getConfigs("global"),r=this.getConfigs("checkout"),a=this.getConfigs("global"),c=r.layout.allowGiftCards,l=null===(n=null==a?void 0:a.layout)||void 0===n?void 0:n.allowPromoCodes,u=document.createElement("div");u.classList.add("section-title-container");const h=document.createElement("h3");h.textContent="Order Summary",h.classList.add("section-title"),u.appendChild(h),i.push(u);const p=ComponentFactoryService.createElement({type:s.CHECKOUT_ITEMS});i.push(p);const m=document.createElement("div");m.classList.add("checkout-separator");const f=document.createElement("div");if(f.classList.add("checkout-separator"),i.push(m),c||l){const n=ComponentFactoryService.createElement({type:s.CHECKOUT_PC_GC});i.push(n)}if(this.hasOnDemandOrder()){const n=ComponentFactoryService.createElement({type:s.CHECKOUT_TIPS});i.push(n),i.push(f)}const g=document.createElement("div");g.classList.add("section-title-container");const v=document.createElement("h3");v.textContent="100% Secure Payments",v.classList.add("disclaimer-header"),g.appendChild(v);const y=document.createElement("p");y.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.",y.classList.add("disclaimer-description"),g.appendChild(y),i.push(g);const b=ComponentFactoryService.createElement({type:s.CHECKOUT_AMOUNTS});i.push(b);const x=ComponentFactoryService.createElement({type:s.CHECKOUT_PLACE_ORDER_BUTTON});i.push(x);const w=this.marketingOptInsContainer();if(w&&i.push(w),r.layout.legalMessage.show){const n=document.createElement("div");n.classList.add("checkout-separator");const o=document.createElement("div");o.classList.add("checkout-legal-message"),o.innerHTML=sanitizeHTML(r.layout.legalMessage.text);const s=document.createElement("div");s.classList.add("checkout-separator"),i.push(n),i.push(o),i.push(s)}if(o.layout.showPoweredBy){const n=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"checkout"});i.push(n)}return i}}class CheckoutBillingFormComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.billingSameAsShipping"]})}async handleFirstNameChange(n){this.commands.checkout.updateBillingInfo(J.firstName,n),this.pubSub.publishForm(r.BILLING,{fieldName:J.firstName})}async handleLastNameChange(n){this.commands.checkout.updateBillingInfo(J.lastName,n),this.pubSub.publishForm(r.BILLING,{fieldName:J.lastName})}async handleEmailChange(n){this.commands.checkout.updateBillingInfo(J.email,n),this.pubSub.publishForm(r.BILLING,{fieldName:J.email})}async handlePhoneChange(n){this.commands.checkout.updateBillingInfo(J.phone,n),this.pubSub.publishForm(r.BILLING,{fieldName:J.phone})}async handleCompanyChange(n){this.commands.checkout.updateBillingInfo(J.company,n),this.pubSub.publishForm(r.BILLING,{fieldName:J.company})}async handleAddressOneChange(n){this.commands.checkout.updateBillingInfo(J.addressOne,n),this.pubSub.publishForm(r.BILLING,{fieldName:J.addressOne})}async handleAddressTwoChange(n){this.commands.checkout.updateBillingInfo(J.addressTwo,n),this.pubSub.publishForm(r.BILLING,{fieldName:J.addressTwo})}async handleCityChange(n){this.commands.checkout.updateBillingInfo(J.city,n),this.pubSub.publishForm(r.BILLING,{fieldName:J.city})}async handleStateChange(n){this.commands.checkout.updateBillingInfo(J.state,n),this.pubSub.publishForm(r.BILLING,{fieldName:J.state})}async handleZipCodeChange(n){this.commands.checkout.updateBillingInfo(J.zipCode,n),this.pubSub.publishForm(r.BILLING,{fieldName:J.zipCode})}billingSameAsShippingToggle(){const n=this.getStoreValue("checkout.billingSameAsShipping"),i=document.createElement("div");i.classList.add("checkout-billing-same-as-shipping-toggle-container");const o=document.createElement("div");o.classList.add("checkout-checkbox-container");const r=document.createElement("span");r.id="billingSameAsShipping",r.classList.add("checkout-checkbox-visual"),n&&r.classList.add("checked"),r.innerHTML=CheckboxIcon({width:16,height:16}),i.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()});const s=document.createElement("label");return s.textContent="Billing address same as shipping address",s.setAttribute("for","billingSameAsShipping"),s.classList.add("billing-checkbox-label"),o.appendChild(r),o.appendChild(s),i.appendChild(o),i}template(){const n=this.getStoreValue("checkout.billingSameAsShipping"),i=[],o=this.billingSameAsShippingToggle();if(i.push(o),n)return i;const r=document.createElement("div");r.classList.add("section-title-container");const a=document.createElement("h3");a.textContent="Your billing info",a.classList.add("section-title"),r.appendChild(a);const c=document.createElement("p");c.textContent="Provide the info relevant to your payment method",c.classList.add("section-subtitle"),r.appendChild(c),i.push(r);const l=document.createElement("div");l.classList.add("section-form-container");const u=document.createElement("div");u.classList.add("checkout-two-col-container");const h=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleFirstNameChange.bind(this),storePath:"billing.firstName"});u.appendChild(h);const p=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleLastNameChange.bind(this),storePath:"billing.lastName"});u.appendChild(p),l.appendChild(u);const m=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:J.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:this.handleEmailChange.bind(this),storePath:"billing.email"});l.appendChild(m);const f=document.createElement("div");f.classList.add("checkout-two-col-container");const g=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:J.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:this.handlePhoneChange.bind(this),storePath:"billing.phone"});f.appendChild(g);const v=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.company,label:"Company (optional)",autocomplete:!![],onChange:this.handleCompanyChange.bind(this)});f.appendChild(v),l.appendChild(f);const y=document.createElement("div");y.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:this.handleAddressOneChange.bind(this),storePath:"billing.addressOne"});y.appendChild(b);const x=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.addressTwo,label:"Apt, suite, etc. (optional)",onChange:this.handleAddressTwoChange.bind(this)});y.appendChild(x),l.appendChild(y);const w=document.createElement("div");w.classList.add("checkout-three-col-container");const C=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:this.handleCityChange.bind(this),storePath:"billing.city"});w.appendChild(C);const k=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:n=>n&&2===n.length&&/^[A-Z]{2}$/.test(n)?null:"State must be 2 uppercase characters"},onChange:this.handleStateChange.bind(this),storePath:"billing.state"});w.appendChild(k);const S=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:J.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:this.handleZipCodeChange.bind(this),storePath:"billing.zipCode"});return w.appendChild(S),l.appendChild(w),i.push(l),i}}class CheckoutBuyerInformationComponent extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}async handleFirstNameChange(n){this.commands.checkout.updateCustomerInfo(Z.firstName,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.firstName})}async handleLastNameChange(n){this.commands.checkout.updateCustomerInfo(Z.lastName,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.lastName})}async handleEmailChange(n){this.commands.checkout.updateCustomerInfo(Z.email,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.email})}async handlePhoneChange(n){this.commands.checkout.updateCustomerInfo(Z.phone,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.phone})}async handleCompanyChange(n){this.commands.checkout.updateCustomerInfo(Z.company,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.company})}async handleDobChange(n){this.commands.checkout.updateCustomerInfo(Z.birthDate,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.birthDate})}template(){const n=this.store.get("checkout.customer"),i=[],o=document.createElement("div");o.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Buyer Information",r.classList.add("section-title"),o.appendChild(r);const a=document.createElement("p");a.textContent="Buyer information is used to process your order and for delivery purposes.",a.classList.add("section-subtitle"),o.appendChild(a),i.push(o);const c=document.createElement("div");c.classList.add("section-form-container");const l=document.createElement("div");l.classList.add("checkout-two-col-container");const u=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Z.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:n.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:"customer.firstName"});l.appendChild(u);const h=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Z.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:n.lastName,onChange:this.handleLastNameChange.bind(this),storePath:"customer.lastName"});l.appendChild(h),c.appendChild(l);const p=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Z.company,label:"Company (optional)",autocomplete:!![],value:n.company,onChange:this.handleCompanyChange.bind(this)});c.appendChild(p);const m=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:Z.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:n.email,onChange:this.handleEmailChange.bind(this),storePath:"customer.email"});c.appendChild(m);const f=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:Z.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:n.phone,onChange:this.handlePhoneChange.bind(this),storePath:"customer.phone"});c.appendChild(f);const g=ComponentFactoryService.createElement({type:s.BIRTHDATE_INPUT,inputType:"date",name:Z.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:n.birthDate,onChange:this.handleDobChange.bind(this),storePath:"customer.birthDate"});return c.appendChild(g),i.push(c),i}}class CheckoutDeliveryInformationComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift","address.formattedAddress","checkout.onDemandFulfillmentTipInfo"]})}hasOnDemandFulfillments(){const n=this.store.get("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(n).length>0}async handleDeliveryInstructionsChange(n){await this.commands.checkout.updateDeliveryInstructions(n)}async handleFirstNameChange(n){const i=this.getStoreValue("checkout.isGift");i?(this.commands.checkout.updateGiftInfo($.firstName,n),this.pubSub.publishForm(r.GIFT,{fieldName:$.firstName})):(this.commands.checkout.updateCustomerInfo(Z.firstName,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.firstName}))}async handleLastNameChange(n){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo($.lastName,n),this.pubSub.publishForm(r.GIFT,{fieldName:$.lastName})):(this.commands.checkout.updateCustomerInfo(Z.lastName,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.lastName}))}async handleEmailChange(n){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo($.email,n),this.pubSub.publishForm(r.GIFT,{fieldName:$.email})):(this.commands.checkout.updateCustomerInfo(Z.email,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.email}))}async handlePhoneChange(n){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo($.phone,n),this.pubSub.publishForm(r.GIFT,{fieldName:$.phone})):(this.commands.checkout.updateCustomerInfo(Z.phone,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.phone}))}async handleAddressTwoChange(n){const i=this.getStoreValue("checkout.isGift")||![];i?(this.commands.checkout.updateGiftInfo($.addressTwo,n),this.pubSub.publishForm(r.GIFT,{fieldName:$.addressTwo})):(this.commands.checkout.updateCustomerInfo(Z.addressTwo,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.addressTwo}))}async handleCompanyChange(n){this.commands.checkout.updateCustomerInfo(Z.company,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.company})}async handleBirthdateChange(n){this.commands.checkout.updateCustomerInfo(Z.birthDate,n),this.pubSub.publishForm(r.CUSTOMER,{fieldName:Z.birthDate})}async handleGiftMessageChange(n){this.commands.checkout.updateGiftInfo($.message,n),this.pubSub.publishForm(r.GIFT,{fieldName:$.message})}template(){const n=this.getConfigs("global"),i=this.getStoreValue("checkout.isGift")||![],o=this.store.get("checkout.giftRecipient"),r=this.store.get("checkout.customer"),a=this.store.get("address.formattedAddress"),c=i?o:r,l=[],u=document.createElement("div");u.classList.add("delivery-header-container");const h=document.createElement("div");h.classList.add("delivery-header-content");const p=document.createElement("div");p.classList.add("delivery-title-container");const m=document.createElement("h3");m.textContent="Deliver to",m.classList.add("delivery-title");const f=document.createElement("p");f.textContent="Package recipient must be 21+",f.classList.add("delivery-subtitle"),p.appendChild(m),p.appendChild(f);const g=document.createElement("div");g.classList.add("gift-toggle-container");const v=document.createElement("div");v.classList.add("gift-label-wrapper");const y=document.createElement("span");y.textContent="Send as Gift? (Free)",y.classList.add("gift-toggle-label"),v.appendChild(y);const b=document.createElement("span");b.textContent="With personalized note & gift receipt.",b.classList.add("gift-toggle-description"),v.appendChild(b);const x=document.createElement("div");x.classList.add("toggle-switch"),x.classList.toggle("active",i);const w=document.createElement("div");w.classList.add("toggle-slider"),x.appendChild(w),g.appendChild(v),g.appendChild(x),x.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),u.appendChild(g),u.appendChild(p),l.push(u);const C=document.createElement("div");C.classList.add("section-form-container");const k=document.createElement("div");k.classList.add("checkout-two-col-container");const S=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:i?$.firstName:Z.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:c.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:i?"giftRecipient.firstName":"customer.firstName"});k.appendChild(S);const E=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:i?$.lastName:Z.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:c.lastName,onChange:this.handleLastNameChange.bind(this),storePath:i?"giftRecipient.lastName":"customer.lastName"});if(k.appendChild(E),C.appendChild(k),!i){const n=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Z.company,label:"Company (optional)",autocomplete:!![],value:c.company,onChange:this.handleCompanyChange.bind(this),storePath:"customer.company"});C.appendChild(n)}const T=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:i?$.email:Z.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:c.email,onChange:this.handleEmailChange.bind(this),storePath:i?"giftRecipient.email":"customer.email"});C.appendChild(T);const P=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:i?$.phone:Z.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:c.phone,onChange:this.handlePhoneChange.bind(this),storePath:i?"giftRecipient.phone":"customer.phone"});if(C.appendChild(P),!i){const n=ComponentFactoryService.createElement({type:s.BIRTHDATE_INPUT,inputType:"date",name:Z.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:formatISODateToMMDDYYYY(c.birthDate),onChange:this.handleBirthdateChange.bind(this),storePath:"customer.birthDate"});C.appendChild(n)}const D=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:a,disabled:!![],className:"disabled-input",validation:{required:!![]}});C.appendChild(D);const _=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:i?$.addressTwo:Z.addressTwo,label:"Apt, suite, etc. (optional)",value:c.addressTwo,onChange:this.handleAddressTwoChange.bind(this),storePath:i?"giftRecipient.addressTwo":"customer.addressTwo"});if(C.appendChild(_),this.hasOnDemandFulfillments()){const i=document.createElement("div");i.classList.add("custom-input","textarea",n.layout.inputFieldStyle);const o=document.createElement("label");o.textContent="Delivery Instructions",o.setAttribute("for","delivery_instructions");const r=document.createElement("textarea");r.id="delivery_instructions",r.name="delivery_instructions",r.rows=4,r.value=this.store.get("checkout.deliveryInstructions")||"",r.addEventListener("blur",async n=>{await this.handleDeliveryInstructionsChange(n.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"),i.appendChild(o),i.appendChild(r),i.appendChild(s),C.appendChild(i)}if(i){const i=document.createElement("div");i.classList.add("custom-input","textarea",n.layout.inputFieldStyle);const r=document.createElement("label");r.textContent="Gift Message*",r.setAttribute("for",$.message);const s=document.createElement("textarea");s.name=$.message,s.id=$.message,s.rows=4,s.value=o.message||"",s.addEventListener("input",async n=>{await this.handleGiftMessageChange(n.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"),i.appendChild(r),i.appendChild(s),i.appendChild(a),C.appendChild(i)}return l.push(C),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 n=this,i=null;for(;n&&n!==document.body;){const o=n.hasAttribute("checkout"),r=n.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(s.LCE_ELEMENT),a=n.hasAttribute("drawer"),c=(null==i?void 0:i.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(s.DRAWER),l="checkout"===(null==i?void 0:i.getAttribute("data-target"));if(o||r&&a&&c&&l)return this.rootComponent=n,n;i=n,n=n.parentElement||n.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){await this.commands.checkout.getPaymentSession();const n=this.store.get("checkout.payment"),i=this.getConfigs("global");return{publishableKey:n.key,clientSecret:n.secret,appearance:{theme:"stripe",variables:{fontFamily:i.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:i.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===i.layout.inputFieldStyle?"none":"1px solid "+i.theme.accentColor,backgroundColor:"filled"===i.layout.inputFieldStyle?i.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 n;if(this.isCreatingStripeForm)return this.logger.debug("Stripe form creation already in progress, skipping"),void 0;const i=this.findRootComponent();if(!i)return;if(null===(n=this.stripeFormElement)||void 0===n?void 0:n.isConnected)return this.logger.debug("Stripe form already exists and is connected, skipping creation"),void 0;const o=i.querySelectorAll('[slot="'+X+'"]');if(o.length>0)for(const s of o)s.remove();this.isCreatingStripeForm=!![];try{const n=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:s.CHECKOUT_STRIPE_FORM,stripeConfig:n}),this.stripeFormElement.setAttribute("slot",X),i.appendChild(this.stripeFormElement),this.setupStripeFormEventListeners()}catch(r){this.logger.error("Stripe form element creation failed",r),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 n=>{await this.commands.checkout.updateStripeFormStatus(n.detail.status),n.detail.status.hasError&&this.logger.error("Stripe form status update failed",n.detail)}),this.stripeFormElement.addEventListener("lce:s:confirmPaymentSession",async n=>{try{const{confirmationTokenId:i,setupIntentId:o}=n.detail;await this.commands.checkout.confirmPaymentSession(i,o)}catch(i){this.logger.error("Failed to confirm payment session",i),this.store.set("checkout.payment.sendSubmitSignal",![])}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var n;try{const i=await this.doStripeConfig(),o=new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:i}});null===(n=this.stripeFormElement)||void 0===n?void 0:n.dispatchEvent(o)}catch(i){this.logger.error("Failed to refresh payment session",i)}})}onStoreChanged(n){const i=n.some(n=>"checkout.payment.sendSubmitSignal"===n.path&&n.value===!![]);if(i&&this.stripeFormElement){const n=new CustomEvent("lce:s:submit");this.stripeFormElement.dispatchEvent(n)}return![]}disconnected(){var n;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],null===(n=super.disconnected)||void 0===n||n.call(this)}template(){const n=[],i=document.createElement("div");i.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Payment",o.classList.add("section-title"),i.appendChild(o);const r=document.createElement("p");r.textContent="All transactions are secure and encrypted.",r.classList.add("section-subtitle"),i.appendChild(r),n.push(i);const s=document.createElement("slot");return s.setAttribute("name",X),n.push(s),n}}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:n}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.B=n.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 n=this.B;this._=window.Stripe(n.publishableKey),this.O=this._.elements({clientSecret:n.clientSecret,appearance:n.appearance}),this.N=this.O.create("payment",n.elementOptions),this.N.mount(this),this.N.on("change",async n=>{const i=!!n.error,o=n.complete,r=i?n.error.message:null;this.L=o,await this.updateStripeFormStatus({isComplete:o,hasError:i,errorMessage:r,isProcessing:this.M})}),this.N.on("focus",async()=>{await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:this.M})}),this.R=![]}catch(n){throw await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to initialize payment form"}),n}}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(n){const{stripeConfig:i}=n.detail;i&&(this.B=i,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 n=await this.createConfirmationTokenId(),i=this.B.clientSecret,o=i.split("_secret_")[0],r=new CustomEvent("lce:s:confirmPaymentSession",{detail:{confirmationTokenId:n,setupIntentId:o}});this.dispatchEvent(r),this.R=!![],await this.updateStripeFormStatus({isComplete:!![],isProcessing:![],hasError:![],errorMessage:null})}catch(n){this.R||(this.R=!![]),await this.updateStripeFormStatus({isComplete:this.L,isProcessing:![],hasError:!![],errorMessage:(null==n?void 0:n.message)||"An unexpected error with payment occurred"})}finally{this.M=![]}}}async requestSessionRefresh(){const n=new CustomEvent("lce:s:requestSessionRefresh");return this.dispatchEvent(n),new Promise((n,i)=>{const o=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",A),i(new Error("Session refresh timeout"))},5e3),A=()=>{clearTimeout(o),this.removeEventListener("lce:s:refreshSession",A),n()};this.addEventListener("lce:s:refreshSession",A,{once:!![]})})}async refreshPaymentSession(){try{this.O&&this.O.update({clientSecret:this.B.clientSecret}),this.R=![]}catch(L){await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to refresh payment session"})}}async updateStripeFormStatus(n){const i=new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:n}});this.dispatchEvent(i)}async createConfirmationTokenId(){if(!this.O)throw new Error("Elements must be provided");try{const{error:n}=await this.O.submit();if(n)throw new Error(n.message);const i={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:o,confirmationToken:r}=await this._.createConfirmationToken(i);if(o)throw new Error(o.message);if(!r||!r.id)throw new Error("Confirmation token not found");return r.id}catch(n){throw new Error(n.message)}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(n=>{console.error("Error during Stripe form disconnection cleanup:",n)})}async cleanupForm(){var n,i;try{this.N&&(this.N.unmount(),this.N=null),this.O&&(null===(i=(n=this.O).destroy)||void 0===i?void 0:i.call(n),this.O=null),this._=null,this.M=![],this.L=![],this.R=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}catch(o){console.warn("Error during Stripe form cleanup:",o)}}loadStripeJS(){return new Promise((n,i)=>{const o=document.createElement("script");o.src="https://js.stripe.com/basil/stripe.js",o.onload=()=>n(),o.onerror=()=>i(new Error("Failed to load Stripe.js")),document.head.appendChild(o)})}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var n,i,o;const r=this.getStoreValue("checkout"),s=Boolean(r.promoCode),a=Boolean(null===(n=r.giftCards)||void 0===n?void 0:n.length),c=this.getConfigs("global"),l=Object.keys(r.onDemandFulfillmentTipInfo||{}).length>0,u=Object.values(r.items||{}),h=[],p=document.createElement("div");p.classList.add("checkout-amount-line");const m=document.createElement("span");m.textContent="Subtotal ("+u.length+" item"+(u.length>1?"s":"")+")",p.appendChild(m);const f=document.createElement("span");f.textContent=formatCentToDollarText(r.amounts.subtotal),p.appendChild(f),h.push(p);const g=document.createElement("div");g.classList.add("checkout-amount-line");const v=document.createElement("span");v.textContent="Shipping",g.appendChild(v);const y=document.createElement("span");y.textContent=formatCentToDollarText(r.amounts.shipping),g.appendChild(y),h.push(g);const b=document.createElement("div");b.classList.add("checkout-amount-line");const x=document.createElement("span");x.textContent="Delivery",b.appendChild(x);const w=document.createElement("span");if(w.textContent=formatCentToDollarText(r.amounts.delivery),b.appendChild(w),h.push(b),(null===(i=null==r?void 0:r.amounts)||void 0===i?void 0:i.engraving)>0){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Engraving",n.appendChild(i);const o=document.createElement("span");o.textContent=formatCentToDollarText(r.amounts.engraving),n.appendChild(o),h.push(n)}const C=document.createElement("div");C.classList.add("checkout-amount-line");const k=document.createElement("span");k.textContent="Taxes & Fees",C.appendChild(k);const S=document.createElement("span");if(S.textContent=formatCentToDollarText(r.amounts.tax+r.amounts.service+r.amounts.platform),C.appendChild(S),h.push(C),s){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Promo Code ("+(null===(o=r.promoCode)||void 0===o?void 0:o.code)+")",n.appendChild(i);const s=document.createElement("span");s.textContent="-"+formatCentToDollarText(r.amounts.discounts),n.appendChild(s),h.push(n)}if(a){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Gift Cards Applied",n.appendChild(i);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(r.amounts.giftCards),n.appendChild(o),h.push(n)}if(l){const n=document.createElement("div");n.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Tips",n.appendChild(i);const o=document.createElement("span");o.textContent=formatCentToDollarText(r.amounts.tip),n.appendChild(o),h.push(n)}const E=document.createElement("div");E.classList.add("checkout-separator"),h.push(E);const T=document.createElement("div");T.classList.add("checkout-amount-total");const P=document.createElement("span");P.textContent="Total",T.appendChild(P);const D=document.createElement("span");D.textContent=formatCentToDollarText(r.amounts.total),T.appendChild(D),h.push(T);const _=this.store.get("checkout.isPresaleLocked");if(_){const n=document.createElement("div");n.classList.add("checkout-amount-due");const i=document.createElement("span");i.textContent="Amount due today",n.appendChild(i);const o=document.createElement("span");o.textContent=formatCentToDollarText(0),n.appendChild(o),h.push(n);const r=document.createElement("div");r.classList.add("checkout-presale-locked-message");const s=htmlStringToElement(InfoIcon({color:c.theme.defaultTextColor}));r.appendChild(s);const a=document.createElement("p");a.textContent="Pre-ordered items will be charged when shipped.",r.appendChild(a),h.push(r)}return h}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){const n=[],i=this.getConfigs("configurations"),o=this.getConfigs("global"),r=this.getConfigs("checkout"),a=this.config.layout.exitUrl||window.location.host,c=this.config.layout.thankYouButtonText||"Continue Shopping";if(this.config.theme.checkoutCompleted.customLogo){const o=document.createElement("div");o.classList.add("checkout-completed-header-container");const r=document.createElement("img");r.src=this.config.theme.checkoutCompleted.customLogo,r.alt=i.partnerName+" Logo",o.appendChild(r),n.push(o)}const l=document.createElement("div");l.classList.add("checkout-completed-section-container");const u=document.createElement("div");u.classList.add("checkout-completed-title-container");const h=document.createElement("div");h.classList.add("checkout-completed-title-section");const p=document.createElement("h3");p.innerHTML=this.config.theme.checkoutCompleted.customText||"Thank You for Your Order!",h.appendChild(p);const m=document.createElement("p");m.textContent="Your payment has been successfully processed.",h.appendChild(m),u.appendChild(h),l.appendChild(u);const f=document.createElement("div");f.classList.add("checkout-completed-sub-section");const g=document.createElement("div");g.classList.add("checkout-completed-line");const v=document.createElement("h3");v.textContent="Order Number",g.appendChild(v);const y=document.createElement("span");y.textContent=this.params.orderNumber,g.appendChild(y),f.appendChild(g);const b=document.createElement("div");b.classList.add("checkout-completed-line");const x=document.createElement("h3");x.textContent="Order Amount",b.appendChild(x);const w=document.createElement("span");w.textContent=""+formatCentToDollarText(this.params.orderTotal),b.appendChild(w),f.appendChild(b);const C=document.createElement("div");C.classList.add("checkout-completed-line");const k=document.createElement("h3");k.textContent="Payment Method",C.appendChild(k);const S=document.createElement("span");S.textContent="** "+this.params.cardLast4,C.appendChild(S),f.appendChild(C),l.appendChild(f);const E=document.createElement("div");E.classList.add("checkout-completed-sub-section");const T=document.createElement("h3");T.textContent="Confirmation email sent",E.appendChild(T);const P=document.createElement("p");P.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>.",E.appendChild(P),l.appendChild(E),n.push(l);const D=document.createElement("div");D.classList.add("checkout-completed-section-container");const _=document.createElement("button");_.type="button";const z=document.createElement("span");z.textContent=c,_.appendChild(z);const O=htmlStringToElement(ArrowRightIcon({width:16,height:16}));_.appendChild(O),_.addEventListener("click",()=>{window.location.href=a}),D.appendChild(_),n.push(D);const N=document.createElement("div");N.classList.add("checkout-completed-section-container");const M=document.createElement("div");M.classList.add("checkout-completed-help-section"),N.appendChild(M);const L=document.createElement("p");L.textContent="Questions about your order? Contact us at "+i.supportEmail,M.appendChild(L);const R=document.createElement("p"),j=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(R.textContent="Order placed on "+j,M.appendChild(R),n.push(N),r.layout.legalMessage.show){const i=document.createElement("div");i.classList.add("checkout-separator");const o=document.createElement("div");o.classList.add("checkout-legal-message"),o.innerHTML=sanitizeHTML(r.layout.legalMessage.text);const s=document.createElement("div");s.classList.add("checkout-separator"),n.push(i),n.push(o),n.push(s)}if(o.layout.showPoweredBy){const i=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"general"});n.push(i)}return n}}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(n){var i;const o=n.find(n=>"checkout.giftCards"===n.path),r=n.find(n=>"checkout.loading"===n.path);o&&o.value.length>((null===(i=o.oldValue)||void 0===i?void 0:i.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),r&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const n=this.giftCardInput.getValue().trim(),i=n.length>=3&&n.length<=255,o=this.getStoreValue("checkout.loading"),r=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!i||o||Boolean(r)||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:n=>{const i=n.toUpperCase(),o=this.giftCardInput;o.setValue(i),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){return this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.addEventListener("click",async()=>{const n=this.giftCardInput.getValue().trim().toUpperCase();if(n)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(n)}catch(i){this.logger.error("Checkout gift card application failed",{giftCardCode:n,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const n=[];return n.push(this.createGiftCardInput()),n.push(this.createApplyButton()),n}disconnected(){this.giftCardInput=null,this.applyButton=null}}const shouldShowMinimumPurchaseAlert=(n,i=![])=>{var o,r;const s=n.subtotal;if(n.type===a.SHIPPING){const a=n.fees;if(i&&(null===(o=a.pack)||void 0===o?void 0:o.active)&&a.pack.min>0&&s<a.pack.min)return!![];if(!i&&(null===(r=a.individual)||void 0===r?void 0:r.active)&&a.individual.min>0&&s<a.individual.min)return!![]}else if(n.type===a.ON_DEMAND){const i=n.fees;if(i.min>0&&s<i.min)return!![]}return![]},getMinimumPurchaseMessage=(n,i=![])=>{var o,r;const s=n.subtotal;if(n.type===a.SHIPPING){const a=n.fees;let c=0;if(i&&(null===(o=a.pack)||void 0===o?void 0:o.active)&&a.pack.min>0?c=a.pack.min:(null===(r=a.individual)||void 0===r?void 0:r.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(n.type===a.ON_DEMAND){const i=n.fees,o=i.min>0?i.min:0;if(o>0&&s<o)return{message:"+"+formatCentToDollarText(o-s)+" needed for order minimum",type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(n,i=![])=>{var o,r;const s=n.subtotal;if(n.type===a.SHIPPING){const a=n.fees;if(i&&(null===(o=a.pack)||void 0===o?void 0:o.active)&&a.pack.min>0&&s<a.pack.min)return!![];if(!i&&(null===(r=a.individual)||void 0===r?void 0:r.active)&&a.individual.min>0&&s<a.individual.min)return!![]}if(n.type===a.ON_DEMAND){const i=n.fees;if(i.min>0&&s<i.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const n=this.config||{};if(n.showIcon===![])return null;const i={warning:"warning",success:"success",info:"info"},o={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},r=i[this.params.messageType]||"warning",s=document.createElement("div");return s.className="alert-icon alert-icon-"+this.params.messageType,s.appendChild(htmlStringToElement(o[r]({width:16,height:16,className:"alert-icon-svg"}))),s}template(){var n;const i=[],o=this.getIconElement();o&&i.push(o);const r=document.createElement("span");if(r.className="alert-message",r.textContent=this.params.message,i.push(r),"detailed"===(null===(n=this.config)||void 0===n?void 0:n.alertType)&&this.params.currentTotal){const n=document.createElement("div");n.className="alert-details";const o=document.createElement("small");o.className="alert-details-text",o.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),n.appendChild(o),i.push(n)}return i}}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(n){var i,o,r,s;const a=n.find(n=>"checkout.items"===n.path);a&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const c=n.find(n=>n.path==="checkout.items."+this.params.itemId);if(c){const n=c.oldValue,a=c.value;if(a.updating)return![];const l=(null==n?void 0:n.quantity)!==(null==a?void 0:a.quantity),u=(null===(o=null===(i=null==n?void 0:n.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],h=(null===(s=null===(r=null==a?void 0:a.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[],p=JSON.stringify(u)!==JSON.stringify(h);(l||p)&&this.updateEngravingElement(a)}return![]}updateEngravingElement(n){var i,o;const r=this.getConfigs("global"),a=this.container.querySelector(".engraving-view-container");if(a&&a.remove(),(null===(o=null===(i=null==n?void 0:n.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.hasEngraving)===!![]&&r.layout.enablePersonalization){const i=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:n.cartItemId,context:"checkout"}),o=this.container.querySelector(".checkout-item-card-footer");o&&o.before(i)}}setupMinimumPurchaseAlert(){const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return;const i=n.fulfillmentId;if(!i)return;if(!this.container)return;const o=this.container.querySelector(".checkout-item-card-header");if(o){const r=this.getStoreValue("cart.fulfillments."+i),a=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(a&&a.remove(),shouldShowMinimumPurchaseAlert(r,n.pack)){const i=getMinimumPurchaseMessage(r,n.pack),a=ComponentFactoryService.createElement({type:s.PURCHASE_MIN_ALERT,message:i.message,messageType:i.type,currentTotal:r.subtotal,config:{showIcon:!![],alertType:"minimal"}});a.setAttribute("data-component-type","checkout-retailer-alert"),o.before(a)}}}updateTrashButtonState(){if(!this.trashButton)return;const n=this.getStoreValue("checkout"),i=Object.keys(n.items).length,o=1===i;this.trashButton.disabled=o,o?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const n=document.createElement("div");n.className="cart-loading-backdrop",n.setAttribute("data-loading-id","item-loading-overlay");const i=document.createElement("div");i.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',i.appendChild(o),n.appendChild(i),n}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const n=this.createLoadingOverlay();this.container.appendChild(n),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const n=this.container.querySelector('[data-loading-id="item-loading-overlay"]');n&&(n.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const n=this.getStoreValue("checkout.items."+this.params.itemId);return n?n.updating===!![]:![]}checkAndUpdateLoadingState(){const n=this.isItemUpdating(),i=this.hasLoadingOverlay();n&&!i?this.showLoadingOverlay():!n&&i&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var n,i,o;const r=this.getConfigs("global"),a=this.getStoreValue("checkout.items."+this.params.itemId),c=null===(n=null==a?void 0:a.attributes)||void 0===n?void 0:n.presale,l=(null==c?void 0:c.isActive)&&(null==c?void 0:c.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(c.estimatedShipBy):"";if(!a)return[];const u=document.createElement("div");u.classList.add("checkout-item-card-header");const h=document.createElement("img");h.classList.add("checkout-item-image"),h.src=a.mainImage,h.alt=a.name,h.loading="lazy",u.appendChild(h);const p=document.createElement("div");p.classList.add("checkout-item-details-container");const m=document.createElement("h4");m.classList.add("checkout-item-title"),m.textContent=a.name,p.appendChild(m);const f=document.createElement("div");f.classList.add("checkout-item-subtitle");const g=document.createElement("span");g.textContent=c.isActive?""+l:((null==a?void 0:a.expectationDetail)||"")+",",f.appendChild(g);const v=document.createElement("span");v.textContent="From "+((null==a?void 0:a.retailerName)||""),f.appendChild(v),p.appendChild(f),u.appendChild(p),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async n=>{var i;if(n.preventDefault(),n.stopPropagation(),!(null===(i=this.trashButton)||void 0===i?void 0:i.disabled))try{await this.commands.checkout.removeItem(a.cartItemId)}catch(o){this.logger.error("Checkout item removal failed",o)}}),u.appendChild(this.trashButton);const y=ComponentFactoryService.createElement({type:s.CHECKOUT_ITEM_QUANTITY,itemId:a.cartItemId}),b=[];if(b.push(u),r.layout.enablePersonalization&&(null===(o=null===(i=null==a?void 0:a.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.hasEngraving)===!![]){const n=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:a.cartItemId,context:"checkout"});b.push(n)}return b.push(y),b}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(n){const i=n.find(n=>"checkout.items"===n.path);if(i){const n=this.calculateQuantityLimits();this.updateButtonStates(n)}}getAvailableQuantity(){var n,i,o;const r=this.getStoreValue("checkout.items."+this.params.itemId);if(!r)return 0;const s=this.getStoreValue("products");if(!s)return 0;const a=r.partNumber,c=r.fulfillmentId,l=null===(o=null===(i=null===(n=Object.values(s).find(n=>n.sizes[r.liquidId]))||void 0===n?void 0:n.sizes)||void 0===i?void 0:i[r.liquidId])||void 0===o?void 0:o.attributes.maxQuantityPerOrder;if(!l)return 0;const u=this.getStoreValue("checkout.items")||{},h=Object.values(u).filter(n=>n.partNumber===a&&n.fulfillmentId===c),p=h.reduce((n,i)=>n+i.quantity,0);return l-p}calculateQuantityLimits(){var n;const i=this.getStoreValue("checkout.items."+this.params.itemId);if(!i)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const o=this.getStoreValue("checkout"),r=1===(null===(n=Object.values(o.items))||void 0===n?void 0:n.length),s=i.quantity,a=this.getAvailableQuantity(),c=a>0,l=!(r&&1===s);return{currentQuantity:s,availableQuantity:a,isTheOnlyItem:r,canIncrease:c,canDecrease:l}}updateButtonStates(n){this.decreaseButton&&(this.decreaseButton.disabled=!n.canDecrease,this.decreaseButton.classList.toggle("disabled",!n.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!n.canIncrease,this.increaseButton.classList.toggle("disabled",!n.canIncrease),n.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=n.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+n.currentQuantity))}async handleQuantityChange(n){const i=this.calculateQuantityLimits(),o=this.params.itemId;if((!(n<0)||i.canDecrease)&&(!(n>0)||i.canIncrease)){if(!o)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:n}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(o,n)}catch(r){this.logger.error("Checkout item quantity change operation failed",r)}}}template(){const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const i=this.calculateQuantityLimits(),o=document.createElement("div");o.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async n=>{n.preventDefault(),n.stopPropagation(),await this.handleQuantityChange(-1)}),o.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),o.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async n=>{n.preventDefault(),n.stopPropagation(),await this.handleQuantityChange(1)}),o.appendChild(this.increaseButton),this.updateButtonStates(i);const r=document.createElement("span");if(r.classList.add("checkout-item-price-text"),r.textContent=formatCentToDollarText(n.price),n.quantity>1){const i=document.createElement("span");i.classList.add("checkout-item-price-each-text"),i.textContent=" ("+formatCentToDollarText(n.unitPrice)+" ea)",r.appendChild(i)}return[o,r]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(n){return ComponentFactoryService.createElement({type:s.CHECKOUT_ITEM,itemId:n})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const n=this.getStoreValue("checkout.items")||{},i=new Map;for(const o of objectValues(n))o&&o.cartItemId&&i.set(o.cartItemId,o);return i}syncItemsWithStore(){const n=this.getItemsListContainer();if(!n)return;const i=this.getCurrentItemsMap(),o=n.querySelectorAll("[data-item-id]"),r=new Set;for(const s of o){const n=s.getAttribute("data-item-id");n&&r.add(n)}for(const s of o){const n=s.getAttribute("data-item-id");n&&!i.has(n)&&s.remove()}for(const[s]of i)if(!r.has(s)){const i=this.createItemElement(s);i.setAttribute("data-item-id",s),n.appendChild(i)}this.updateItemCount()}updateItemCount(){const n=this.getTogglerLabel();if(!n)return;const i=this.getCurrentItemsMap(),o=i.size;n.textContent=o+" item"+(1!==o?"s":"")}onStoreChanged(n){let i;for(let o=0;o<n.length;o++){const r=n[o];if("checkout"===r.path||"checkout.items"===r.path||"checkout.items."===r.path.substring(0,15)){i=r;break}}return i?(this.syncItemsWithStore(),![]):![]}setupToggler(){const n=this.container.querySelector(".checkout-items-toggler"),i=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".checkout-items-list");n&&i&&o&&n.addEventListener("click",()=>{const n=o.classList.contains("show");o.classList.toggle("show"),n?(i.classList.toggle("expanded"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label","Expand checkout items")):(i.classList.toggle("expanded"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label","Collapse checkout items"))})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const n=this.getStoreValue("checkout.items"),i=objectValues(n||{}),o=document.createElement("div");o.classList.add("checkout-items-toggler");const r=document.createElement("span");r.classList.add("checkout-items-toggler-label"),r.textContent=i.length+" item"+(1!==i.length?"s":""),o.appendChild(r);const s=document.createElement("button");s.type="button",s.classList.add("checkout-items-toggler-button"),s.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),o.appendChild(s);const a=document.createElement("div");a.classList.add("checkout-items-list","show");for(const c of i){const n=this.createItemElement(c.cartItemId);n.setAttribute("data-item-id",c.cartItemId),a.appendChild(n)}return[o,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(n){const i=n.some(n=>"checkout.isFormValid"===n.path||"checkout.invalidFields"===n.path||"checkout.stripeFormStatus"===n.path||"checkout.stripeFormStatus."===n.path.substring(0,26)||"checkout.readyForSubmit"===n.path||"checkout.readyForSubmit."===n.path.substring(0,23)||"checkout.loading"===n.path||"checkout.error"===n.path);i&&this.updateButtonState();const o=n.find(n=>"checkout.readyForSubmit"===n.path);return o&&this.handleCheckoutReadyForSubmit(o.value),![]}updateButtonState(){if(!this.placeOrderButton)return;const n=this.store.get("checkout.isFormValid")||![],i=this.store.get("checkout.invalidFields")||[],o=this.store.get("checkout.stripeFormStatus")||{},r=this.store.get("checkout.loading")||![],s=this.store.get("checkout.error")||null,a=o.isComplete||![],c=o.hasError||![],l=o.isProcessing||![],u=o.errorMessage||null;this.updateErrorDisplay(this.determineErrorMessage(s,u));const h=this.determineButtonState({isFormValid:n,invalidFieldsCount:i.length,isPaymentComplete:a,hasPaymentError:c,isStripeProcessing:l,isCheckoutLoading:r,hasCheckoutError:!!s});this.applyButtonState(h)}determineErrorMessage(n,i){return n&&i?i:i||n}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(n){if(!this.errorContainer)return;const i=this.errorContainer.querySelector(".error-text");i&&(this.clearErrorTimeout(),n?(i.textContent=n,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(()=>{this.errorTimeoutId=null,this.commands.checkout.removeCheckoutError();const n=this.store.get("checkout.stripeFormStatus");(null==n?void 0:n.errorMessage)&&this.commands.checkout.updateStripeFormStatus({errorMessage:null})},3e3)):(i.textContent="",this.errorContainer.style.display="none"))}determineButtonState(n){const{isFormValid:i,invalidFieldsCount:o,isPaymentComplete:r,hasPaymentError:s,isStripeProcessing:a,isCheckoutLoading:c,hasCheckoutError:l}=n,u=this.config.layout.placeOrderButtonText,h=this.config.layout.placeOrderButtonShowRequiredFields,p=i&&r&&!s&&!a&&!l,m=this.store.get("checkout.readyForSubmit.payment")||![],f=this.store.get("checkout.readyForSubmit.prepared")||![],g=this.store.get("checkout.payment.sendSubmitSignal")||![],v=this.store.get("checkout.isPresaleLocked")||![];let y=![];if(!v){const n=this.getStoreValue("cart.fulfillments")||{};y=Object.values(n).some(n=>hasUnmetMinimum(n))}const b=a||c||g;if(c&&!a&&!g)return{state:"processing",text:u,disabled:!![]};if(y)return{state:"disabled",text:u,disabled:!![]};if(b)return m&&f?{state:"processing",text:"Placing Order...",disabled:!![]}:m&&!f?{state:"processing",text:"Preparing Order...",disabled:!![]}:f&&!m&&(a||g)||g||a?{state:"processing",text:"Processing Payment...",disabled:!![]}:{state:"processing",text:"Placing Order...",disabled:!![]};if(!i){const n=o>0?" ("+o+")":"";return{state:"form-invalid",text:h?"Complete Required Fields"+n:u,disabled:![]}}return r?s?{state:"payment-error",text:u,disabled:![]}:p?{state:"ready",text:u,disabled:![]}:{state:"disabled",text:u,disabled:!![]}:{state:"payment-incomplete",text:"Complete Payment Information",disabled:![]}}applyButtonState(n){if(!this.placeOrderButton)return;const i=["processing","form-invalid","payment-incomplete","payment-error","ready","disabled"];this.placeOrderButton.classList.remove(...i),this.placeOrderButton.classList.add(n.state),this.placeOrderButton.disabled=n.disabled,this.placeOrderButton.textContent=n.text}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const n=this.store.get("checkout.isFormValid")||![],i=this.store.get("checkout.stripeFormStatus")||{},o=this.store.get("checkout.loading")||![],r=i.isComplete||![],s=i.hasError||![],a=i.isProcessing||![];if(a||o)return;if(!n)return await this.commands.checkout.focusFirstInvalidField(),void 0;if(!r||s)return this.showPaymentError(),void 0;await this.commands.checkout.startPreparingCheckoutSubmit()}catch(n){this.logger.error("Error handling place order click",n)}}showPaymentError(){const n=document.querySelector(".checkout-stripe-form");n&&safeScrollIntoView(n,{behavior:"smooth",block:"center"})}async handleCheckoutReadyForSubmit(n){if(!n)return;const{payment:i,prepared:o,customer:r,gift:s,billing:a}=n,c=i&&o&&r&&a&&s;c&&await this.commands.checkout.checkoutComplete()}template(){const n=document.createElement("button");n.type="button",n.textContent=this.config.layout.placeOrderButtonText,n.classList.add("checkout-place-order-button"),n.disabled=!![],n.addEventListener("click",this.handlePlaceOrderClick.bind(this));const i=document.createElement("div");i.classList.add("checkout-payment-error-wrapper"),i.setAttribute("role","alert"),i.style.display="none";const o=document.createElement("div");o.classList.add("checkout-payment-error");const r=document.createElement("span");r.classList.add("icon-error"),r.innerHTML=ErrorInfoIcon({});const a=document.createElement("span");a.classList.add("error-text"),o.appendChild(r),o.appendChild(a),i.appendChild(o);const c=ComponentFactoryService.createElement({type:s.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[i,c,n]}}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 n=[],i=this.getConfigs("global"),o=document.createElement("div");o.classList.add("checkout-completed-section-container");const r=document.createElement("div");r.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),r.appendChild(a),o.appendChild(r);const u=document.createElement("div");u.classList.add("checkout-completed-help-section");const h=document.createElement("p");h.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.",u.appendChild(h),o.appendChild(u),n.push(o);const p=document.createElement("div");p.classList.add("checkout-completed-section-container");const m=document.createElement("button");m.setAttribute("aria-label","Continue shopping"),m.type="button";const f=document.createElement("span");f.textContent="Continue Shopping",m.appendChild(f);const g=htmlStringToElement(ArrowRightIcon({width:16,height:16}));m.appendChild(g),m.addEventListener("click",()=>this.handleExit()),p.appendChild(m),n.push(p);const v=document.createElement("div");v.classList.add("checkout-completed-section-container");const y=document.createElement("p");y.classList.add("checkout-completed-auto-close-text"),y.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 b=document.createElement("span");if(b.classList.add("checkout-completed-auto-close-text"),b.textContent="seconds",v.appendChild(y),v.appendChild(this.autoCloseElement),v.appendChild(b),n.push(v),i.layout.showPoweredBy){const i=document.createElement("div");i.classList.add("checkout-completed-powered-by-container");const o=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"checkout"});i.appendChild(o),n.push(i)}return n}}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(n){const i=n.find(n=>"checkout.promoCode"===n.path),o=n.find(n=>"checkout.loading"===n.path);if(i){const{value:n,oldValue:o}=i,r=Boolean(o),s=Boolean(n);if(!r&&s)return this.container.innerHTML="",this.createAppliedContainer(n),void 0;if(r&&!s)return this.container.innerHTML="",this.createInputContainer(),void 0;s&&this.promoCodeText&&n.discountAmount!==(null==o?void 0:o.discountAmount)&&(this.promoCodeText.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")")}o&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const n=this.promoInput.getValue().trim(),i=n.length>=3&&n.length<=255,o=this.getStoreValue("checkout.loading"),r=this.getStoreValue("checkout.promoCode"),s=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!i||o||Boolean(r)||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:n=>{const i=n.toUpperCase(),o=this.promoInput;o.setValue(i),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){return this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.addEventListener("click",async()=>{const n=this.promoInput.getValue().trim().toUpperCase();if(n)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(n)}catch(i){this.logger.error("Checkout promo code application failed",{promoCode:n,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}createAppliedContainer(n){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==n?void 0:n.code)+" (- "+formatCentToDollarText((null==n?void 0:n.discountAmount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),i.appendChild(this.promoCodeText),i.appendChild(o),this.container.appendChild(i),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const n=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,n){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),i.appendChild(this.promoCodeText),i.appendChild(o),i}const i=[];return i.push(this.createPromoInput()),i.push(this.createApplyButton()),i}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 n=this.getStoreValue("checkout.tipSelection");return null!=n?n:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(n){const i=this.getStoreValue("checkout.updating")||![];if(!i)try{await this.commands.checkout.updateTips(n)}catch(o){this.logger.error("Checkout tips update failed",o)}}async handleFulfillmentTipInput(n,i){const o=this.getStoreValue("checkout.updating")||![];if(o)return;const r=this.getOnDemandFulfillmentTipInfo();if(!r[n])return;const s=Math.round(100*i);try{await this.commands.checkout.updateFulfillmentTip(n,s)}catch(a){this.logger.error("Checkout fulfillment tip update failed",a)}}async removeTipFromFulfillment(n){const i=this.getStoreValue("checkout.updating")||![];if(i)return;const o=this.getOnDemandFulfillmentTipInfo();if(o[n])try{await this.commands.checkout.removeFulfillmentTip(n)}catch(r){this.logger.error("Checkout fulfillment tip removal failed",r)}}createTipSelectionButtons(){const n=document.createElement("div");n.classList.add("checkout-tip-selection-container");const i=[10,18,20],o=this.getStoreValue("checkout.updating")||![],r=this.getTipSelection();for(const s of i){const i=document.createElement("button");i.type="button",i.textContent=s+"%",i.classList.add("checkout-tip-button"),i.disabled=o,r===s&&i.classList.add("selected"),i.addEventListener("click",()=>this.handlePercentageSelect(s)),n.appendChild(i)}return n}setupToggler(){const n=this.container.querySelector(".checkout-tip-distribution-header"),i=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".retailers-tips-list");n&&i&&o&&n.addEventListener("click",()=>{const n=o.classList.contains("show");o.classList.toggle("show"),n?(i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label","Expand tips section")):(i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label","Collapse tips section")),i.classList.toggle("expanded")})}createTipDistribution(){const n=document.createElement("section");n.classList.add("checkout-tip-distribution-container");const i=this.getFulfillmentTipInfoArray();if(0===i.length)return n;const o=document.createElement("div");o.classList.add("checkout-tip-distribution-header");const r=document.createElement("h3");r.textContent="View Tip Distribution",r.classList.add("checkout-sub-header"),o.appendChild(r);const s=document.createElement("button");s.type="button",s.classList.add("checkout-items-toggler-button"),s.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),o.appendChild(s),n.appendChild(o);const a=document.createElement("div");a.classList.add("retailers-tips-list","show");for(const c of i){const n=document.createElement("div");n.classList.add("checkout-tip-distribution-item");const i=document.createElement("h4");i.textContent=c.retailerName,i.classList.add("checkout-sub-header"),n.appendChild(i);const o=document.createElement("div");o.classList.add("checkout-tip-fulfillment-input-wrapper");const r=document.createElement("div");r.classList.add("dollar-input-container");const s=document.createElement("span");s.classList.add("dollar-sign"),s.textContent="$";const l=document.createElement("input");let u;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",n=>{n.preventDefault()}),l.addEventListener("keydown",n=>{"-"!==n.key&&"+"!==n.key||n.preventDefault()}),l.addEventListener("keydown",n=>{"ArrowUp"!==n.key&&"ArrowDown"!==n.key||n.preventDefault()}),l.addEventListener("paste",n=>{n.preventDefault()}),l.addEventListener("contextmenu",n=>{n.preventDefault()}),l.addEventListener("input",n=>{const i=n.target;let o=i.value;if(Number.parseFloat(o)<0&&(i.value=Math.abs(Number.parseFloat(o)).toString(),o=i.value),o.includes(".")){const n=o.split(".");n.length>1&&n[1].length>2&&(i.value=n[0]+"."+n[1].substring(0,2))}}),l.addEventListener("input",n=>{const i=n.target,o=Number.parseFloat(i.value)||0;u&&clearTimeout(u),u=setTimeout(()=>{this.handleFulfillmentTipInput(c.fulfillmentId,o)},500)}),r.appendChild(s),r.appendChild(l),o.appendChild(r);const h=document.createElement("button");h.type="button",h.textContent="Remove",h.classList.add("checkout-tip-remove-button"),h.disabled=this.getStoreValue("checkout.updating")||![],h.addEventListener("click",()=>this.removeTipFromFulfillment(c.fulfillmentId)),o.appendChild(h),n.appendChild(o),a.appendChild(n)}return n.appendChild(a),n}async initializeDefaultTip(){if(this.isInitialized)return;const n=this.getStoreValue("checkout.tipSelection"),i=this.getFulfillmentTipInfoArray();if(n&&i.length>0){const n=i.some(n=>n.tip>0);if(n)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(o){this.logger.error("Default tip initialization failed",o),this.isInitialized=![]}}if(null==n)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(r){this.logger.error("Default tip initialization failed during fallback",r),this.isInitialized=![]}}template(){const n=[],i=this.getFulfillmentTipInfoArray();if(0===i.length)return n;i.length>0&&this.initializeDefaultTip();const o=document.createElement("section");o.classList.add("checkout-tip-container");const r=document.createElement("h3");r.classList.add("checkout-sub-header"),r.textContent="Add a tip",o.appendChild(r);const s=document.createElement("div");s.classList.add("checkout-tip-config-container");const a=this.createTipSelectionButtons();s.appendChild(a),o.appendChild(s);const c=document.createElement("p");c.classList.add("checkout-tip-disclaimer"),c.textContent="Tips will be split proportionally between retailers.",o.appendChild(c);const l=this.createTipDistribution();return n.push(o,l),n}}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(n){var i,o;const r=n.find(n=>"checkout.giftCardError"===n.path),s=n.find(n=>"checkout.promoCodeError"===n.path),a=n.find(n=>"checkout.giftCards"===n.path);if(a&&this.updateAppliedGiftCards(a.value),r){const n=this.container.querySelector(".input-gift-card-container");if(n){const o=n.nextElementSibling;if((null===(i=null==o?void 0:o.classList)||void 0===i?void 0:i.contains("error-banner-checkout"))&&(null==o?void 0:o.remove()),r.value){const i=this.createErrorElement(r.value);n.after(i)}const s=n.querySelector(".apply-button");s&&(s.disabled=Boolean(r.value))}}if(s){const n=this.container.querySelector(".input-promo-code-container");if(n){const i=n.nextElementSibling;if((null===(o=null==i?void 0:i.classList)||void 0===o?void 0:o.contains("error-banner-checkout"))&&(null==i?void 0:i.remove()),s.value){const i=this.createErrorElement(s.value);n.after(i)}const r=n.querySelector(".apply-button");r&&(r.disabled=Boolean(s.value))}}}updateAppliedGiftCards(n){const i=n&&n.length>0;if(!i)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="",n.forEach(n=>{const i=this.createAppliedGiftCardElement(n);this.appliedGiftCardsContainer.appendChild(i)})}createAppliedGiftCardElement(n){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),i.setAttribute("data-gift-card-code",n.code);const o=document.createElement("span");o.textContent=n.code+" (- "+formatCentToDollarText(n.discountAmount)+")",i.appendChild(o);const r=document.createElement("button");return r.type="button",r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(n.code)}),i.appendChild(r),i}pcInputContainer(){const n=ComponentFactoryService.createElement({type:s.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return n}gcInputContainer(){const n=ComponentFactoryService.createElement({type:s.CHECKOUT_GIFT_CARDS});return n}inputContainer(){var n;const i=this.getConfigs("checkout"),o=this.getConfigs("global"),r=i.layout.allowGiftCards,s=null===(n=null==o?void 0:o.layout)||void 0===n?void 0:n.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 u=this.getStoreValue("checkout.promoCodeError");if(u){const n=this.createErrorElement(u);n.classList.add("promo-code-error-wrapper"),a.appendChild(n)}r&&a.appendChild(l);const h=this.getStoreValue("checkout.giftCardError");if(h){const n=this.createErrorElement(h);a.appendChild(n)}return a}createErrorElement(n){const i=document.createElement("div");i.classList.add("error-banner-checkout");const o=document.createElement("div");o.innerHTML=ErrorInfoIcon({});const r=document.createElement("p");return r.textContent=n.toString(),i.appendChild(o),i.appendChild(r),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),i.remove()},3e3),i}template(){const n=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const i=[];return i.push(this.inputContainer()),n&&n.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),n.forEach(n=>{const i=this.createAppliedGiftCardElement(n);this.appliedGiftCardsContainer.appendChild(i)}),i.push(this.appliedGiftCardsContainer)),i}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(n){const i=this.getProductId(),o=n.find(n=>n.path==="products."+i+".drawer.isOpen"),r=n.find(n=>n.path==="products."+i+".rerender");o&&this.titleElement&&this.titleElement.classList.toggle("hide",o.value),(null==r?void 0:r.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var n;const i=this.getProductId(),o=this.getStoreValue("products."+i);if(o.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:s.PRODUCT});if(o.loading)return ComponentFactoryService.createElement({type:s.PRODUCT_LOADING});const r=o.sizes[o.selectedSizeId],a=document.createElement("div");a.classList.add("product-content-wrapper"),a.setAttribute("role","region"),a.setAttribute("aria-label",""+o.name);const c=document.createElement("div");if(c.classList.add("product-content"),c.setAttribute("role","region"),c.setAttribute("aria-label",""+o.name),this.config.layout.showTitle){const n=document.createElement("h1");n.classList.add("product-title"),n.textContent=o.name,this.titleElement=n,c.appendChild(n)}const l=ComponentFactoryService.createElement({type:s.PRODUCT_OPTIONS,productId:i});c.appendChild(l);const u=ComponentFactoryService.createElement({type:s.PRODUCT_DRAWER,productId:i});if(c.appendChild(u),a.appendChild(c),!this.config.layout.showImages||!(null===(n=o.images)||void 0===n?void 0:n.length))return a;a.classList.add("has-images");const h=ComponentFactoryService.createElement({type:s.PRODUCT_IMAGE_CAROUSEL,images:o.images,mainImage:r.image,productId:i});return a.prepend(h),h.setAttribute("aria-label","Product images"),a}async disconnected(){const n=this.getProductId();n&&await this.commands.product.removeProduct(n)}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["product-engraving"]}beforeConnected(){var n;if(this.engravingLines=this.params.lines,"product"===this.params.context){const i=this.store.get("products."+this.params.identifier);this.fulfillmentId=i.selectedFulfillmentId,this.partNumber=(null===(n=i.selectedFulfillment)||void 0===n?void 0:n.partNumber)||null}if("cart"===this.params.context){const n=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=n.fulfillmentId,this.partNumber=n.partNumber}}calculateTotalPrice(){var n,i;if("product"===this.params.context){const o=this.store.get("products."+this.params.identifier),r=o.sizes[o.selectedSizeId],s=r.shippingFulfillments[this.fulfillmentId],a=s.price,c=(null===(i=null===(n=null==r?void 0:r.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.fee)||0;return a+c}if("cart"===this.params.context){const n=this.store.get("cart.items."+this.params.identifier),i=n.unitPrice,o=n.attributes.engraving.fee||0;return i+o}return 0}productInformationSection(){const n=[];let i="",o="";if("product"===this.params.context){const r=this.store.get("products."+this.params.identifier);r.mainImage?n.push(r.mainImage):n.push(...r.images||[]),i=r.name,o=r.sizes[r.selectedSizeId].size}if("cart"===this.params.context){const r=this.store.get("cart.items."+this.params.identifier);r.mainImage&&n.push(r.mainImage),i=r.name,o=r.size}const r=document.createElement("div");if(r.className="product-info-section",n.length>0){const o=document.createElement("div");o.className="product-image-container";const s=document.createElement("img");s.src=n[0],s.alt=i,s.loading="lazy",s.className="product-image",o.appendChild(s),r.appendChild(o)}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=i,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=o,s.appendChild(l);const u=document.createElement("p");return u.className="personalization-fees-disclaimer",u.textContent="Personalization fees included in total, varies by retailer.",s.appendChild(u),r.appendChild(s),r}addToCartButtonText(n){if("product"!==this.params.context)return"Save";const i=this.getConfigs("product"),o=i.layout.addToCartButtonText;return i.layout.addToCartButtonShowTotalPrice?o+" - "+formatCentToDollarText(n):o}retailersSection(){var n,i,o,r;const s=this.store.get("products."+this.params.identifier),a=s.sizes[s.selectedSizeId],c=objectValues(a.shippingFulfillments).filter(n=>n.isVariantEngravable&&n.canEngrave),l=document.createElement("div");l.className="fulfillment-section";const u=document.createElement("p");if(u.className="shipping-from-text",u.innerHTML="Shipping from: <b>"+(null===(n=s.selectedFulfillment)||void 0===n?void 0:n.retailerName)+"</b>",l.appendChild(u),1===c.length)return l;const h=document.createElement("div");h.className="fulfillment-options-container",l.appendChild(h);const p=document.createElement("span");p.className="see-more-fulfillments",p.textContent="See More Delivery Options ("+c.length+")",p.addEventListener("click",()=>{h.classList.toggle("expanded"),p.textContent=h.classList.contains("expanded")?"See Less Delivery Options":"See More Delivery Options ("+c.length+")"}),l.appendChild(p);for(const m of c){const n=document.createElement("div");n.className="fulfillment-option",n.setAttribute("data-fulfillment-id",m.fulfillmentId),m.fulfillmentId===(null===(i=s.selectedFulfillment)||void 0===i?void 0:i.fulfillmentId)&&n.classList.add("selected"),n.addEventListener("click",()=>{this.fulfillmentId=m.fulfillmentId,this.partNumber=m.partNumber;const i=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(i),this.productPriceSpan.textContent=formatCentToDollarText(i);const o=h.querySelector(".fulfillment-option.selected");o&&o.classList.remove("selected"),n.classList.add("selected"),u.innerHTML="Shipping from: <b>"+m.retailerName+"</b>"});const a=m.price+((null===(r=null===(o=s.sizes[s.selectedSizeId].attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.fee)||0),c=document.createElement("div");c.className="option-row row-1",n.appendChild(c);const l=document.createElement("span");l.className="retailer-name",l.textContent=m.retailerName,c.appendChild(l);const p=document.createElement("span");p.className="fulfillment-price",p.textContent=formatCentToDollarText(a),c.appendChild(p),n.appendChild(c);const f=document.createElement("div");f.className="option-row row-2",n.appendChild(f);const g=document.createElement("span");g.className="estimated-time",g.textContent=""+m.expectation.engraving,f.appendChild(g),n.appendChild(f),h.appendChild(n)}return l}engravingLinesSection(){var n;const{lines:i,maxLines:o,location:r,maxCharsPerLine:s}=this.params,a=document.createElement("div");a.className="personalization-section";const c=document.createElement("p");if(c.className="personalization-title",c.textContent="Personalize Your Bottle",a.appendChild(c),r&&(null===(n=null==r?void 0:r.trim())||void 0===n?void 0:n.length)>0){const n=document.createElement("p");n.className="personalization-location-text",n.textContent="Your message will appear "+r.toLowerCase()+".",a.appendChild(n)}const l=Array.from({length:o},(n,o)=>{const r=o+1,a=document.createElement("div");a.className="personalization-input-wrapper",a.setAttribute("data-line-number",r.toString());const c=document.createElement("input");c.type="text",c.id="engraving-line-"+r,c.dataset.lineNumber=r.toString(),c.maxLength=s,c.value=i[o]||"",c.placeholder=r>1?"Line "+r+" (optional)":"Line "+r,c.className="personalization-input",c.autocomplete="off",c.setAttribute("aria-label",r>1?"Engraving line "+r+", optional, maximum "+s+" characters":"Engraving line "+r+", maximum "+s+" characters");const l=document.createElement("span");return l.className="personalization-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[o]=c.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),a.appendChild(c),a.appendChild(l),a}),u=document.createElement("div");return u.className="personalization-inputs-container",u.append(...l),a.appendChild(u),a}actionButtonsSection(){const{identifier:n,context:i}=this.params,o=document.createElement("div");o.className="action-buttons-container";const r=document.createElement("button");r.type="button",r.className="cancel-action-button",r.textContent="Cancel",r.setAttribute("aria-label","Cancel personalization and close");const e=async()=>{"product"===i&&await this.commands.product.closeProductDrawer(n),"cart"===i&&this.commands.ui.openDrawer(s.CART)};r.addEventListener("click",e),r.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e())}),o.appendChild(r),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"===i?"Add personalized item to cart":"Update personalization and return to cart");const F=async()=>{const o=this.engravingLines.map(n=>n.trim().toUpperCase()).filter(n=>n&&n.length>0);if("product"===i&&this.fulfillmentId&&this.partNumber){const i=this.store.get("products."+n);await this.commands.product.addToCart(n,{upc:i.sizes[i.selectedSizeId].upc,fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:o,identifier:n}),await this.commands.product.closeProductDrawer(n)}"cart"===i&&(await this.commands.cart.updateItemEngraving(n,o),this.commands.ui.openDrawer(s.CART))};return this.addToCartButton.addEventListener("click",F),this.addToCartButton.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),F())}),o.appendChild(this.addToCartButton),o}template(){const n=[],i=this.productInformationSection();if(n.push(i),"product"===this.params.context){const i=this.retailersSection();n.push(i)}const o=this.engravingLinesSection();n.push(o);const r=this.actionButtonsSection();n.push(r);const s=document.createElement("p");return s.className="personalization-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>",n.push(s),n}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const n=this.getConfigs("global");return["engraving-view-container",n.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const n=this.params.identifier;if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+n),o=(null==i?void 0:i.attributes.engraving.fee)||0,r=(null==i?void 0:i.quantity)||1;return{quantity:r,fee:o,total:o*r}}if("checkout"===this.params.context){const i=this.getStoreValue("checkout.items."+n),o=(null==i?void 0:i.attributes.engraving.fee)||0,r=(null==i?void 0:i.quantity)||1;return{quantity:r,fee:o,total:o*r}}return{quantity:0,fee:0,total:0}}engravingLines(){const n=this.params.identifier;if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+n);return(null==i?void 0:i.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const i=this.getStoreValue("checkout.items."+n);return(null==i?void 0:i.attributes.engraving.lines)||[]}return[]}handleEdit(){var n,i,o,r,a,c,l,u,h,p,m,f,g,v,y,b,x,w,C,k;const S=this.params.identifier,E={identifier:S,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const s=this.getStoreValue("cart.items."+S);E.lines=(null===(i=null===(n=null==s?void 0:s.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[],E.maxLines=(null===(r=null===(o=null==s?void 0:s.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.maxLines)||1,E.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,E.fee=(null===(u=null===(l=null==s?void 0:s.attributes)||void 0===l?void 0:l.engraving)||void 0===u?void 0:u.fee)||0,E.location=(null===(p=null===(h=null==s?void 0:s.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.location)||""}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+S);E.lines=(null===(f=null===(m=null==n?void 0:n.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.lines)||[],E.maxLines=(null===(v=null===(g=null==n?void 0:n.attributes)||void 0===g?void 0:g.engraving)||void 0===v?void 0:v.maxLines)||1,E.maxCharsPerLine=(null===(b=null===(y=null==n?void 0:n.attributes)||void 0===y?void 0:y.engraving)||void 0===b?void 0:b.maxCharsPerLine)||16,E.fee=(null===(w=null===(x=null==n?void 0:n.attributes)||void 0===x?void 0:x.engraving)||void 0===w?void 0:w.fee)||0,E.location=(null===(k=null===(C=null==n?void 0:n.attributes)||void 0===C?void 0:C.engraving)||void 0===k?void 0:k.location)||""}this.commands.ui.openDrawer(s.ENGRAVING_FORM,E)}async handleRemove(){const n=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(n,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(n)}template(){const n=this.engravingQuantityFee(),i=this.engravingLines();if(0===i.length)return"";const o=document.createElement("div");o.className="engraving-header";const r=document.createElement("h3");r.textContent="Personalization";const s=document.createElement("span");if(s.className="engraving-fee",1===n.quantity&&(s.textContent=formatCentToDollarText(n.total,![])),n.quantity>1){s.textContent=formatCentToDollarText(n.total,![]);const i=document.createElement("span");i.className="engraving-fee-each",i.textContent=" ("+formatCentToDollarText(n.fee,![])+" ea)",s.appendChild(i)}o.appendChild(r),o.appendChild(s);const a=document.createElement("div");a.className="engraving-body";const c=document.createElement("div");c.className="engraving-lines";for(const h of i){const n=document.createElement("span");n.className="engraving-line",n.textContent=h,c.appendChild(n)}const l=document.createElement("div");l.className="engraving-actions";const u=document.createElement("button");u.type="button",u.classList.add("remove-button"),u.textContent="Remove",u.setAttribute("aria-label","Remove engraving");const I=async()=>{await this.handleRemove()};if(u.addEventListener("click",I),u.addEventListener("keydown",async n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),await I())}),l.appendChild(u),"checkout"!==this.params.context){const n=document.createElement("button");n.type="button",n.classList.add("edit-button"),n.textContent="Edit",n.setAttribute("aria-label","Edit engraving"),n.addEventListener("click",this.handleEdit.bind(this)),n.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handleEdit())}),l.appendChild(n)}return a.appendChild(c),a.appendChild(l),[o,a]}}function fulfillmentAddress(n,i){if(!n)return"";if(i===a.SHIPPING){const i=[n.city,n.state].filter(Boolean);return i.join(", ")}const o=[n.one,n.two,n.city,n.state].filter(Boolean);return o.join(", ")}const gt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],vt=1440;function timeToMinutes(n){const i=n.match(/^(\d{1,2}):(\d{2})$/);if(!i)throw new Error("Invalid time format: "+n);const o=Number.parseInt(i[1],10),r=Number.parseInt(i[2],10);if(o<0||o>47||r<0||r>59)throw new Error("Invalid time values: "+n);return 60*o+r}function getCurrentTimeInTimezone(n){var i,o,r;const s=new Date,a={timeZone:n,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const n=new Intl.DateTimeFormat("en-US",a),c=n.formatToParts(s),l=(null===(i=c.find(n=>"weekday"===n.type))||void 0===i?void 0:i.value.toLowerCase())||"",u=(null===(o=c.find(n=>"hour"===n.type))||void 0===o?void 0:o.value)||"0",h=(null===(r=c.find(n=>"minute"===n.type))||void 0===r?void 0:r.value)||"0",p=60*Number.parseInt(u,10)+Number.parseInt(h,10);return{weekday:l,timeInMinutes:p}}catch(c){throw new Error("Invalid timezone: "+n)}}function format24TimeTo12(n){const i=n.match(/^(\d{1,2}):(\d{2})$/);if(!i||"object"==typeof i)return n;let o=Number.parseInt(i[1],10);const r=i[2];o>=24&&(o-=24);const s=o>=12?"PM":"AM",a=0===o?12:o>12?o-12:o;return a+":"+r+" "+s}function isWithinTimeSlot(n,i){try{const o=timeToMinutes(i.startsAt),r=timeToMinutes(i.endsAt);if(r>vt){if(n>=o||n<r-vt)return"during"}else if(r<o){if(n>=o||n<r)return"during"}else if(n>=o&&n<r)return"during";return n<o?"before":"after"}catch(o){return"after"}}function getNextOpeningTime(n,i,o=7){var r,s;const a=gt.indexOf(i);for(let l=1;l<=o;l++){const i=(a+l)%7,o=gt[i],u=n[o];if((null==u?void 0:u.active)&&u.times&&u.times.length>0)try{const n=1===l?"tomorrow":o;return"Opens "+n+" at "+format24TimeTo12(null!==(s=null===(r=null==u?void 0:u.times[0])||void 0===r?void 0:r.startsAt)&&void 0!==s?s:"")}catch(c){}}return null}function validateFulfillmentData(n){return n&&"object"==typeof n&&n.hours&&n.timezone?"string"!=typeof n.timezone?![]:!![]:![]}function getRetailerOffHours(n){var i;if(!(null==n?void 0:n.type)||(null==n?void 0:n.type)!==a.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(n))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:o,timeInMinutes:r}=getCurrentTimeInTimezone(n.timezone),s=n.hours[o];if(!(null==s?void 0:s.active)||!(null===(i=s.times)||void 0===i?void 0:i.length)){const i=getNextOpeningTime(n.hours,o);return{message:i,isOpen:![],isClosed:!![]}}for(const n of s.times){const i=isWithinTimeSlot(r,n);switch(i){case"before":return{message:"Opens at "+format24TimeTo12(n.startsAt),isOpen:![],isClosed:!![],openTime:n.startsAt,closeTime:n.endsAt};case"during":{let i=n.endsAt;const o=timeToMinutes(i);if(o>vt){const n=Math.floor(o/60)-24,r=o%60;i=n.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(i),isOpen:!![],isClosed:![],openTime:n.startsAt,closeTime:n.endsAt}}}}const a=getNextOpeningTime(n.hours,o);return{message:a,isOpen:![],isClosed:!![]}}catch(o){return{message:null,isOpen:![],isClosed:!![]}}}function renderPopupRetailerCard({fulfillment:n,selectedFulfillmentType:i,isSelected:o,fulfillmentStatus:r,selectedSizeAttributes:s}){var c,l,u,h,p;let m=0;const f=null==s?void 0:s.presale,g=(null==f?void 0:f.isActive)&&(null==f?void 0:f.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(f.estimatedShipBy):"",v=i===a.SHIPPING,y=i===a.ON_DEMAND;v&&(m=(null===(l=null===(c=null==n?void 0:n.fees)||void 0===c?void 0:c.individual)||void 0===l?void 0:l.fee)||0),y&&(m=(null===(u=null==n?void 0:n.fees)||void 0===u?void 0:u.fee)||0);const b=fulfillmentAddress(n.retailerAddress,i);let x=null;i===a.ON_DEMAND&&r.openTime&&(null==r?void 0:r.closeTime)&&(x=r.isOpen?"Closes at "+format24TimeTo12$1(null==r?void 0:r.closeTime):"Opens at "+format24TimeTo12$1(null==r?void 0:r.openTime));const w=i===a.ON_DEMAND&&r&&r.isClosed?"closed":"",C=document.createElement("div");C.className="popup-retailer-card "+(o?"selected":"")+" "+w,C.setAttribute("data-fulfillment-id",n.fulfillmentId),C.setAttribute("role","button"),C.setAttribute("tabindex","0"),C.setAttribute("aria-pressed",o?"true":"false");const k=i===a.SHIPPING?"Shipping":"Same-day delivery";C.setAttribute("aria-label",k+" from "+n.retailerName+", "+formatCentToDollarText(null!==(h=n.price)&&void 0!==h?h:0));const S=document.createElement("div");S.className="row";const E=document.createElement("span");E.className="name",E.textContent=n.retailerName,S.appendChild(E);const T=document.createElement("span");T.className="price",T.textContent=formatCentToDollarText(null!==(p=n.price)&&void 0!==p?p:0),S.appendChild(T),C.appendChild(S);const P=document.createElement("div");P.className="row";const D=document.createElement("span");D.className="expectation",D.textContent=r.isClosed?x:(null==f?void 0:f.isActive)?g:(null==n?void 0:n.expectation.detail)||"No expectation available",P.appendChild(D);const _=document.createElement("span");if(_.className="fee",_.textContent=m>0?formatCentToDollarText(m):"Free Delivery",P.appendChild(_),C.appendChild(P),y){const n=document.createElement("div");n.className="row";const i=document.createElement("span");i.className="address",i.textContent=b,n.appendChild(i),C.appendChild(n)}return C}function renderFulfillmentTabsContainer({shippingFulfillments:n,onDemandFulfillments:i,shippingSelected:o,onDemandSelected:r,onTabClick:s,enableShippingFulfillment:c,enableOnDemandFulfillment:l}){const u=i.length>0,h=document.createElement("div");if(h.className="fulfillment-tabs-container",h.setAttribute("role","tablist"),h.setAttribute("aria-label","Delivery method options"),c){const i=document.createElement("div");i.className="fulfillment-tab "+(o?"selected":""),i.setAttribute("data-fulfillment-type",a.SHIPPING),i.setAttribute("role","tab"),i.setAttribute("tabindex","0"),i.setAttribute("aria-selected",o?"true":"false"),i.setAttribute("aria-label","Shipping, "+n.length+" options"),i.addEventListener("click",s),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),i.click())});const r=document.createElement("span");r.className="fulfillment-tab-label "+(o?"selected":""),r.textContent="Shipping ("+n.length+")",i.appendChild(r),h.appendChild(i)}if(l){const n=document.createElement("div");n.className="fulfillment-tab "+(r?"selected":"")+" "+(u?"":"disabled"),n.setAttribute("data-fulfillment-type",a.ON_DEMAND),n.setAttribute("role","tab"),n.setAttribute("tabindex","0"),n.setAttribute("aria-selected",r?"true":"false"),n.setAttribute("aria-label","Same-day delivery, "+i.length+" options"),u||n.setAttribute("aria-disabled","true"),n.addEventListener("click",s),n.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),n.click())});const o=document.createElement("span");o.className="fulfillment-tab-label "+(r?"selected":""),o.textContent="Same-Day Delivery ("+i.length+")",n.appendChild(o),h.appendChild(n)}return h}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 n;const i=this.getProductId(),o=this.getStoreValue("products."+i);if(!o.selectedFulfillment||!o.selectedSizeId)return 0;const r=o.selectedFulfillment.partNumber,s=o.selectedFulfillment.fulfillmentId,a=null===(n=o.sizes[o.selectedSizeId].attributes)||void 0===n?void 0:n.maxQuantityPerOrder;if(!a)return 0;const c=this.getStoreValue("cart.items")||{},l=Object.values(c).filter(n=>n.partNumber===r&&n.fulfillmentId===s),u=l.reduce((n,i)=>n+i.quantity,0);return a-u}isFulfillmentClosed(){const n=this.getProductId(),i=this.getStoreValue("products."+n);if(!i.selectedFulfillment)return![];const o=getRetailerOffHours(i.selectedFulfillment);return i.selectedFulfillmentType===a.ON_DEMAND&&o&&o.isClosed}isButtonLoading(){const n=this.getProductId();return this.getStoreValue("products."+n+".updating")}calculateQuantityLimits(){const{quantity:n}=this.calculateTotalPrice(),i=this.getAvailableQuantity(),o=n<i;return{currentQuantity:n,availableQuantity:i,canIncrease:o,canDecrease:n>1}}async handleAddToCart(){var n,i,o;const r=this.getProductId(),s=this.getStoreValue("products."+r);if(!s.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:r,selectedSizeId:s.selectedSizeId}),void 0;const a=this.getSizeAttributes(),c=(null===(n=null==a?void 0:a.presale)||void 0===n?void 0:n.isActive)===!![],l=this.isPresaleActive(a);c&&l?await this.commands.product.addPresaleToCart(r,{upc:s.sizes[s.selectedSizeId].upc,fulfillmentId:s.selectedFulfillment.fulfillmentId,partNumber:null===(i=s.selectedFulfillment)||void 0===i?void 0:i.partNumber,quantity:s.quantity,identifier:r}):await this.commands.product.addToCart(r,{upc:s.sizes[s.selectedSizeId].upc,fulfillmentId:s.selectedFulfillment.fulfillmentId,partNumber:null===(o=s.selectedFulfillment)||void 0===o?void 0:o.partNumber,quantity:s.quantity,identifier:r})}async handleQuantityChange(n){const i=this.getProductId();await this.commands.product.updateQuantity(i,n)}calculateTotalPrice(){const n=this.getProductId(),i=this.getStoreValue("products."+n),o=i.selectedFulfillment,r=o.price*i.quantity;return{quantity:i.quantity,totalPrice:r}}createQuantityContainer(n){const i=this.calculateQuantityLimits(),o=document.createElement("div");return o.className="quantity-container "+n,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!i.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!i.canDecrease).toString()),i.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async n=>{n.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=i.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+i.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!i.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!i.canIncrease).toString()),i.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async n=>{n.preventDefault(),await this.handleQuantityChange(1)}),o.appendChild(this.qtyDecreaseButton),o.appendChild(this.quantityText),o.appendChild(this.qtyIncreaseButton),o}getSizeAttributes(){const n=this.getProductId(),i=this.getStoreValue("products."+n+".selectedSizeId"),o=this.getStoreValue("products."+n+".sizes."+i);return(null==o?void 0:o.attributes)||{}}isPresaleActive(n){const i=null==n?void 0:n.presale;if(!i)return![];if(!i.isActive)return![];if(i.canPurchaseOn){const n=new Date(i.canPurchaseOn),o=new Date;if(o.getTime()<n.getTime())return![]}return!![]}createAddToCartButton(){var n;const{totalPrice:i}=this.calculateTotalPrice(),o=this.getSizeAttributes(),r=this.calculateQuantityLimits(),s=(null===(n=null==o?void 0:o.presale)||void 0===n?void 0:n.isActive)===!![],a=this.isPresaleActive(o),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(i):c;const l=s&&!a||0===r.availableQuantity||this.isFulfillmentClosed(),u=this.isButtonLoading(),h=this.config.layout.addToCartButtonShowTotalPrice?c+" for "+formatCentToDollarText(i):c;return this.addToCartButton.setAttribute("aria-label",h),this.addToCartButton.setAttribute("aria-busy",u.toString()),this.addToCartButton.setAttribute("aria-disabled",l.toString()),l&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),u&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async n=>{if(n.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 n=this.getProductId(),i=this.getStoreValue("products."+n+".fulfillmentHasAvailability"),o=this.getConfigs("configurations");if(!i||!o.isElementsEnabled)return[];const r=[],s=this.config.layout.showQuantityCounter;if(s){const n=this.config.layout.quantityCounterStyle,i=this.createQuantityContainer(n);r.push(i)}const a=this.createAddToCartButton();return r.push(a),r}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const n=this.params.productId,i=this.getStoreValue("products."+n+".description"),o=this.getStoreValue("products."+n+".htmlDescription"),r="About this product:",s="See More",a="See Less",c=document.createElement("h3");c.className="title",c.textContent=r;const l=document.createElement("div");l.className="content collapsed",l.innerHTML=""===(null==o?void 0:o.trim())?i:sanitizeHTML(o);const u=document.createElement("span");u.className="collapse-button",u.textContent=s,u.setAttribute("role","button"),u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Show more product information"),u.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,l.classList.toggle("collapsed"),u.textContent=this.isCollapsed?s:a,u.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),u.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return u.addEventListener("click",toggleContent),u.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),toggleContent())}),[c,l,u]}}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(n){var i;const o=n.find(n=>n.path==="products."+this.getProductId()+".drawer");if(!o)return![];const r=o.value,s=r.isOpen,a=null===(i=r.contentConfig)||void 0===i?void 0:i.type,c=a!==this.currentContentType;return s&&!this.isOpen?(this.currentContentType=a,this.openWithContent(r),![]):s&&this.isOpen&&!c?![]:s&&this.isOpen&&c?(this.currentContentType=a,this.openWithContent(r),![]):!s&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:n}){const i=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!n)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:i}),void 0;const{type:o,data:r}=n||{},s=ComponentFactoryService.createElement({type:o,...r});this.contentContainer&&this.contentContainer.appendChild(s),this.open()}catch(o){this.logger.error("Failed to open product drawer",o),this.commands.product.closeProductDrawer(i)}}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 n=document.createElement("div");return n.classList.add("product-drawer-content"),this.contentContainer=n,n}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const n=this.config.layout.fulfillmentDisplay;return["product-image-carousel",n]}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(n){const i=this.params.productId,o=n.find(n=>n.path==="products."+i+".mainImage");if(null==o?void 0:o.value){const n=this.params.images.indexOf(null==o?void 0:o.value);-1!==n?this.selectImage(n):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+o.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 i=0;i<this.thumbnails.length;i++){const n=this.thumbnails[i];n.addEventListener("click",()=>{this.hasMoved||this.selectImage(i)})}const n=this.container.querySelectorAll(".carousel-dot");for(let i=0;i<n.length;i++){const o=n[i];o.addEventListener("click",()=>this.selectImage(i))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(n){var i,o;if(n<0||n>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[n]+"')",this.mainImageElement.title="Product image "+(n+1)),null===(i=this.thumbnails[this.currentImageIndex])||void 0===i||i.classList.remove("selected"),null===(o=this.thumbnails[n])||void 0===o||o.classList.add("selected");const r=this.container.querySelectorAll(".carousel-dot");for(let s=0;s<r.length;s++){const i=r[s];i.classList.toggle("active",s===n)}this.currentImageIndex=n,this.galleryViewport&&this.scrollToIndex(n)}scrollToIndex(n){if(!this.galleryViewport||!this.thumbnails[n])return;const i=this.thumbnails[n],o=this.galleryViewport.offsetWidth,r=i.offsetLeft+i.offsetWidth/2,s=o/2,a=s-r,c=0,l=-(this.galleryContainer.scrollWidth-o);this.translateX=Math.max(l,Math.min(c,a)),this.updateTransform(!![])}setupMainImageSwipe(){var n,i;let o=0,r=0;null===(n=this.mainImageElement)||void 0===n?void 0:n.addEventListener("touchstart",n=>{o=n.touches[0].clientX,r=n.touches[0].clientY},{passive:!![]}),null===(i=this.mainImageElement)||void 0===i||i.addEventListener("touchend",n=>{const i=n.changedTouches[0].clientX-o,s=n.changedTouches[0].clientY-r;Math.abs(i)>Math.abs(s)&&Math.abs(i)>50&&(i>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 n of this.galleryContainer.querySelectorAll("img"))n.addEventListener("dragstart",n=>n.preventDefault())}}handleDragStart(n){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in n?n.touches[0].clientX:n.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(n){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===n.type&&n.preventDefault();const i="touches"in n?n.touches[0].clientX:n.clientX,o=i-this.startX;Math.abs(o)>5&&(this.hasMoved=!![]);const r=this.currentTranslateX+o,s=0,a=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(a,Math.min(s,r)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(n){this.galleryContainer&&(this.galleryContainer.style.transition=n?"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 n=[],i=this.params.images.length>1,o=document.createElement("div");if(o.className="main-image",o.title="Product main image",o.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",i){const n=document.createElement("div");n.className="carousel-dots";for(let i=0;i<this.params.images.length;i++){const o=document.createElement("button");o.type="button",o.className="carousel-dot "+(0===i?"active":""),o.setAttribute("data-index",i.toString()),n.appendChild(o)}o.appendChild(n)}this.mainImageElement=o,n.push(o);const r=document.createElement("div");r.className="gallery-viewport";const s=document.createElement("div");s.className="gallery-container";for(let a=0;a<this.params.images.length;a++){const n=this.params.images[a],i=document.createElement("div");i.className="gallery-image-wrapper "+(0===a?"selected":"");const o=document.createElement("img");o.src=n,o.className="gallery-image",o.alt="Product thumbnail "+(a+1),o.loading="lazy",i.appendChild(o),s.appendChild(i)}return r.appendChild(s),n.push(r),n}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(n){var i,o,r,s;const c=this.getProductId();if(!n.some(n=>n.path==="products."+c+".selectedFulfillmentType"))return;const l=this.getStoreValue("products."+c),u=l.sizes[l.selectedSizeId],h=this.getConfigs("global");this.addPersonalizationSpan&&(l.selectedFulfillmentType===a.SHIPPING&&h.layout.enablePersonalization&&l.productHasAvailability&&(null===(o=null===(i=null==u?void 0:u.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.status)===!![]&&(null===(r=null==l?void 0:l.selectedFulfillment)||void 0===r?void 0:r.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 n=this.getProductId(),i=this.container.querySelectorAll("[select-size]");for(const o of i){const r=o.textContent||"",s=o.classList.contains("selected");o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Select "+r),o.setAttribute("aria-pressed",s?"true":"false"),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),o.click())}),o.addEventListener("click",async()=>{var r,s,a,c;const l=o.dataset.sizeId;if(!l)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:n,buttonElement:o.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(n,l);for(const n of i)n.classList.remove("selected"),n.setAttribute("aria-pressed","false");o.classList.add("selected"),o.setAttribute("aria-pressed","true");const u=this.getStoreValue("products."+n),h=u.sizes[l],p=this.getConfigs("global");this.addPersonalizationSpan&&(p.layout.enablePersonalization&&(null===(s=null===(r=null==h?void 0:h.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.status)===!![]&&u.productHasAvailability&&(null===(a=u.selectedFulfillment)||void 0===a?void 0:a.isVariantEngravable)===!![]&&(null===(c=u.selectedFulfillment)||void 0===c?void 0:c.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(n,i){const o=document.createElement("div");o.className="size-container";const r=document.createElement("h3");r.className="size-label",r.textContent="Size",r.id="size-label",o.appendChild(r);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(i)){const i=document.createElement("span");i.setAttribute("data-size-id",a.id),i.setAttribute("select-size",""),i.className="size-button "+(a.id===n?"selected":"");const o=a.packDesc?" ("+a.packDesc+")":"";i.textContent=""+a.size+o,s.appendChild(i)}return o.appendChild(s),o}hasIndependentAddressComponent(){var n;return(null===(n=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===n?void 0:n.length)>0}template(){var n,i,o,r;const a=this.getProductId(),c=this.getStoreValue("products."+a),l=c.sizes[c.selectedSizeId],u=this.getConfigs("global"),h=[],p=document.createElement("div");p.className="price-personalization-container";const m=ComponentFactoryService.createElement({type:s.PRODUCT_PRICE,productId:a});p.appendChild(m),u.layout.enablePersonalization&&c.productHasAvailability&&(null===(i=null===(n=null==l?void 0:l.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.status)===!![]&&(null===(o=null==c?void 0:c.selectedFulfillment)||void 0===o?void 0:o.canEngrave)===!![]&&(null===(r=null==c?void 0:c.selectedFulfillment)||void 0===r?void 0:r.isVariantEngravable)===!![]&&(this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.addEventListener("click",async()=>{var n,i,o,r,l,u,h,p;const m=c.sizes[c.selectedSizeId];await this.commands.product.openProductDrawer(a,s.ENGRAVING_FORM,{identifier:a,context:"product",lines:[],maxLines:(null===(i=null===(n=m.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.maxLines)||1,maxCharsPerLine:(null===(r=null===(o=m.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.maxCharsPerLine)||16,fee:(null===(u=null===(l=m.attributes)||void 0===l?void 0:l.engraving)||void 0===u?void 0:u.fee)||0,location:null===(p=null===(h=m.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.location})}),p.appendChild(this.addPersonalizationSpan)),h.push(p);const f=this.renderProductSizes(c.selectedSizeId,c.sizes);if(h.push(f),!this.hasIndependentAddressComponent()){const n=ComponentFactoryService.createElement({type:s.ADDRESS_DISPLAY,productId:a});h.push(n)}const g=ComponentFactoryService.createElement({type:s.PRODUCT_RETAILERS,productId:a});h.push(g);const v=ComponentFactoryService.createElement({type:s.PRODUCT_ADD_TO_CART_SECTION,productId:a});if(h.push(v),this.config.layout.showDescription){const n=ComponentFactoryService.createElement({type:s.PRODUCT_DESCRIPTION,productId:a});h.push(n)}return h}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(n){const i=this.getProductId(),o=n.find(n=>n.path==="products."+i+".drawer.isOpen");if(o){const n=o.value===!![];n&&this.addHostClasses("hide-content"),n||this.removeHostClasses("hide-content")}}template(){const n=this.getProductId(),i=this.getStoreValue("address.formattedAddress");if(i)return ComponentFactoryService.createElement({type:s.PRODUCT_INTERACTIONS,productId:this.getProductId()});const o=document.createElement("button");return o.type="button",o.className="product-options-open-address-button",o.textContent=this.config.layout.buyNowButtonText,o.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:n}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(n,s.ADDRESS_INPUT,{productId:n})}),o}}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 n;const i=this.getProductId(),o=this.getStoreValue("products."+i);let r=(null===(n=o.priceInfo)||void 0===n?void 0:n.avg)||0;return o.selectedFulfillment&&(r=o.selectedFulfillment.price),formatCentToDollarText(r)}}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 n=this.getProductId(),i=this.getStoreValue("products."+n),o=this.getConfigs("product"),r=[],a=this.getConfigs("configurations");if(!i.productHasAvailability||!a.isElementsEnabled){const n=document.createElement("p");return n.className="product-no-availability-message",n.textContent="We're sorry, this product is not at nearby vendors and unavailable to ship to your state.",r.push(n),r}const c="carousel"===o.layout.fulfillmentDisplay?s.PRODUCT_RETAILERS_CAROUSEL:s.PRODUCT_RETAILERS_POPUP,l=ComponentFactoryService.createElement({type:c,productId:n});return r.push(l),r}}const yt="This product is currently unavailable to ship to your location.",bt="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 n=this.retailerCards.findIndex(n=>n.classList.contains("selected"));-1!==n&&this.scrollToIndex(n)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(n){const i=this.getProductId(),o=n.find(n=>n.path==="products."+i+".selectedFulfillmentId");(null==o?void 0:o.value)&&this.updateSelectedCard(o.value)}updateSelectedCard(n){for(const o of this.retailerCards)o.classList.remove("selected"),o.setAttribute("aria-pressed","false");const i=this.retailerCards.findIndex(i=>i.dataset.fulfillmentId===n);-1!==i&&(this.retailerCards[i].classList.add("selected"),this.retailerCards[i].setAttribute("aria-pressed","true"),this.scrollToIndex(i))}scrollToIndex(n){if(!this.listViewport||!this.retailerCards[n])return;const i=this.retailerCards[n],o=this.listViewport.offsetWidth,r=i.offsetLeft+i.offsetWidth/2,s=o/2,a=s-r,c=0,l=-(this.listContainer.scrollWidth-o);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(n){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in n?n.touches[0].clientX:n.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(n){if(!this.isDragging||!this.listViewport)return;"touchmove"===n.type&&n.preventDefault();const i="touches"in n?n.touches[0].clientX:n.clientX,o=i-this.startX;Math.abs(o)>5&&(this.hasMoved=!![]);const r=this.currentTranslateX+o,s=0,a=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(a,Math.min(s,r)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(n){this.listContainer&&(this.listContainer.style.transition=n?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(n){const i=this.getProductId(),o=n.currentTarget.dataset.fulfillmentType;if(!o)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(i,o)}async onRetailerCardClick(n){if(this.hasMoved)return;const i=this.getProductId(),o=n.currentTarget.dataset.fulfillmentId;if(!o)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;const r=this.getStoreValue("products."+i+".selectedFulfillment");if(r&&r.fulfillmentId===o)return this.logger.debug("Product retailer selection skipped: Same fulfillment already selected",{productId:i,fulfillmentId:o}),void 0;await this.commands.product.selectFulfillment(i,o)}generateRetailerCard({fulfillment:n,selectedFulfillmentType:i,isSelected:o,fulfillmentStatus:r,selectedSizeAttributes:s}){var c,l,u,h,p;let m=0;const f=null==s?void 0:s.presale,g=(null==f?void 0:f.isActive)&&(null==f?void 0:f.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(f.estimatedShipBy):"",v=i===a.SHIPPING,y=i===a.ON_DEMAND;v&&(m=(null===(l=null===(c=null==n?void 0:n.fees)||void 0===c?void 0:c.individual)||void 0===l?void 0:l.fee)||0),y&&(m=(null===(u=null==n?void 0:n.fees)||void 0===u?void 0:u.fee)||0);const b=fulfillmentAddress(n.retailerAddress,i);let x=null;i===a.ON_DEMAND&&r.openTime&&(null==r?void 0:r.closeTime)&&(x=r.isOpen?"Closes at "+format24TimeTo12$1(null==r?void 0:r.closeTime):"Opens at "+format24TimeTo12$1(null==r?void 0:r.openTime));const w=i===a.ON_DEMAND&&r&&r.isClosed?"closed":"",C=document.createElement("div");C.className="carousel-retailer-card "+(o?"selected":"")+" "+w,C.setAttribute("data-fulfillment-id",n.fulfillmentId),C.setAttribute("role","button"),C.setAttribute("tabindex","0"),C.setAttribute("aria-pressed",o?"true":"false");const k=i===a.SHIPPING?"Shipping":"Same-day delivery";C.setAttribute("aria-label",k+" from "+n.retailerName+", "+formatCentToDollarText(null!==(h=n.price)&&void 0!==h?h:0));const S=document.createElement("div");S.className="retailer-header";const E=document.createElement("h3");if(E.className="name",E.textContent=n.retailerName,S.appendChild(E),y){const n=document.createElement("h3");n.className="address",n.textContent=b,S.appendChild(n)}const T=document.createElement("div");T.className="retailer-body";const P=document.createElement("span");P.className="product-price",P.textContent=formatCentToDollarText(null!==(p=n.price)&&void 0!==p?p:0);const D=document.createElement("span");D.className="shipping-price",D.textContent=m>0?"+ "+formatCentToDollarText(m):"FREE Delivery";const _=document.createElement("span");return _.className="expectation",_.textContent=r.isClosed?x:(null==f?void 0:f.isActive)?g:(null==n?void 0:n.expectation.detail)||"No expectation available",T.append(P,D,_),C.append(S,T),C}template(){const n=this.getProductId(),i=this.getStoreValue("products."+n),o=this.getStoreValue("products."+n+".sizes."+i.selectedSizeId),r=(null==o?void 0:o.attributes)||null,s=this.config.layout.enableShippingFulfillment,c=this.config.layout.enableOnDemandFulfillment,l=[];for(const a in o.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(o.shippingFulfillments,a)){const n=o.shippingFulfillments[a],i=getRetailerOffHours(n);if(i.isClosed&&!this.config.layout.showOffHours)continue;l.push(n)}const u=[];for(const a in o.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,a)){const n=o.onDemandFulfillments[a],i=getRetailerOffHours(n);if(i.isClosed&&!this.config.layout.showOffHours)continue;u.push(n)}const h=i.selectedFulfillmentType===a.SHIPPING,p=i.selectedFulfillmentType===a.ON_DEMAND,m=h?l:u,f=renderFulfillmentTabsContainer({shippingFulfillments:l,onDemandFulfillments:u,shippingSelected:h,onDemandSelected:p,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:s,enableOnDemandFulfillment:c});if(!i.fulfillmentHasAvailability||0===m.length){const n=document.createElement("p");return n.className="product-no-availability-message",n.textContent=h?yt:bt,[f,n]}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 g of m){const n=getRetailerOffHours(g),o=this.generateRetailerCard({fulfillment:g,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:g.fulfillmentId===i.selectedFulfillmentId,fulfillmentStatus:n,selectedSizeAttributes:r}),s=i.selectedFulfillmentType===a.ON_DEMAND&&n&&n.isClosed;s?o.setAttribute("aria-disabled","true"):(o.addEventListener("click",this.onRetailerCardClick.bind(this)),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),o.click())})),this.listContainer.appendChild(o)}return this.listViewport.appendChild(this.listContainer),[f,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 n=this.getProductId(),i=this.getStoreValue("products."+n),o=this.getStoreValue("products."+n+".sizes."+i.selectedSizeId),r=(null==o?void 0:o.attributes)||null,c=this.config.layout.enableShippingFulfillment,l=this.config.layout.enableOnDemandFulfillment,u=Object.values(o.shippingFulfillments),h=Object.values(o.onDemandFulfillments),p=(c?u.length:0)+(l?h.length:0),m=document.createElement("div");m.className="header";const f=document.createElement("span");f.className="header-label",f.textContent=i.selectedFulfillmentType===a.SHIPPING?"Shipping From:":"Delivering From:";const g=document.createElement("button");if(g.className="delivery-options",g.type="button",g.textContent="See Delivery Options ("+p+")",g.setAttribute("aria-label","View all "+p+" delivery options"),g.addEventListener("click",async()=>{0!==p&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(s.PRODUCT_RETAILERS_POPUP_LIST,{productId:n}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(n,s.PRODUCT_RETAILERS_POPUP_LIST,{productId:n}))}),m.appendChild(f),m.appendChild(g),!i.fulfillmentHasAvailability){const n=document.createElement("p");return n.className="fulfillments-no-availability-message",n.textContent=i.selectedFulfillmentType===a.SHIPPING?yt:bt,[m,n]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";const y=getRetailerOffHours(i.selectedFulfillment),b=renderPopupRetailerCard({fulfillment:i.selectedFulfillment,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:![],fulfillmentStatus:y,selectedSizeAttributes:r});return v.appendChild(b),[m,v]}}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(n){const i=this.getProductId(),o=n.currentTarget.dataset.fulfillmentType;if(!o)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(i,o)}async onRetailerCardClick(n){const i=this.getProductId(),o=n.currentTarget.dataset.fulfillmentId;if(!o)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:i,targetElement:n.currentTarget.outerHTML.substring(0,100)}),void 0;const d=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(i),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},r=this.getStoreValue("products."+i+".selectedFulfillment");if(r&&r.fulfillmentId===o)return await d(),void 0;await this.commands.product.selectFulfillment(i,o),await d()}template(){const n=this.getProductId(),i=this.getStoreValue("products."+n),o=this.getStoreValue("products."+n+".sizes."+i.selectedSizeId),r=(null==o?void 0:o.attributes)||null,s=this.config.layout.enableShippingFulfillment,c=this.config.layout.enableOnDemandFulfillment,l=[];for(const a in o.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(o.shippingFulfillments,a)){const n=o.shippingFulfillments[a],i=getRetailerOffHours(n);if(i.isClosed&&!this.config.layout.showOffHours)continue;l.push(n)}const u=[];for(const a in o.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,a)){const n=o.onDemandFulfillments[a],i=getRetailerOffHours(n);if(i.isClosed&&!this.config.layout.showOffHours)continue;u.push(n)}const h=i.selectedFulfillmentType===a.SHIPPING,p=i.selectedFulfillmentType===a.ON_DEMAND,m=h?l:u,f=document.createElement("h5");f.className="popup-retailers-section-title",f.textContent="Delivery Options";const g=renderFulfillmentTabsContainer({shippingFulfillments:l,onDemandFulfillments:u,shippingSelected:h,onDemandSelected:p,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:s,enableOnDemandFulfillment:c});if(!i.fulfillmentHasAvailability||0===m.length){const n=document.createElement("p");return n.className="fulfillments-no-availability-message",n.textContent=h?yt:bt,[f,g,n]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";for(const a of m){const n=getRetailerOffHours(a),o=renderPopupRetailerCard({fulfillment:a,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:a.fulfillmentId===i.selectedFulfillmentId,fulfillmentStatus:n,selectedSizeAttributes:r});o.addEventListener("click",this.onRetailerCardClick.bind(this)),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),o.click())}),v.appendChild(o)}return[f,g,v]}}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(n){n.length>0&&this.updateAlert()}getErrorMessages(){var n,i;const o=null!==(n=this.params.fromEvents)&&void 0!==n?n:![],r=null!==(i=this.params.showFirstEvent)&&void 0!==i?i:!![];if(o){const n=this.store.get(this.params.errorStorePath)||[],i=n.filter(n=>null==n?void 0:n.message).map(n=>({message:n.message,level:n.level||"error",type:n.type}));return r?i.slice(0,1):i}const s=this.store.get(this.params.errorStorePath);return s?[{message:s,level:"error"}]:[]}createErrorElement(n){const i=document.createElement("div");i.classList.add("alert-container","alert-"+n.level);const o=document.createElement("span");o.classList.add("alert-icon"),o.innerHTML=ErrorInfoIcon({className:n.level+"-icon"});const r=document.createElement("span");return r.classList.add("alert-text"),r.textContent=n.message,i.appendChild(o),i.appendChild(r),i}scheduleHide(){var n;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const i=null!==(n=this.params.autoHideDelay)&&void 0!==n?n:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},i)}hideAllErrors(){var n;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(n=>{n.parentNode&&n.parentNode.removeChild(n)}),this.elements=[];const i=null!==(n=this.params.fromEvents)&&void 0!==n?n:![];i?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const n=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(n=>{n.parentNode&&n.parentNode.removeChild(n)}),this.elements=[],0===n.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=n.map(n=>this.createErrorElement(n)),this.elements.forEach(n=>{this.container.appendChild(n)}),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 n=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(s.CART)});const i=document.createElement("span");if(i.className="lce-cart-button-icon",i.innerHTML=BagIcon({color:n.theme.primaryColor}),this.params.showItemsCount){const n=document.createElement("span");return n.className="lce-cart-button-badge",n.style.visibility="hidden",[i,n]}return[i]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const n=this.container.querySelector(".lce-cart-button-badge");if(!n)return;const i=this.getStoreValue("cart.totals.quantity")||0;n.textContent=i.toString(),n.style.visibility=i>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const i=this.getStoreValue("cart.totals.quantity")||0;n.textContent=i.toString(),n.style.visibility=i>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(n){var i;const o=n.find(n=>"ui.drawer"===n.path);if(!o)return![];const r=o.value,s=r.isOpen,a=null===(i=r.contentConfig)||void 0===i?void 0:i.type,c=a!==this.currentContentType;return s&&!this.isOpen?(this.currentContentType=a,this.openWithContent(r),![]):s&&this.isOpen&&!c?![]:s&&this.isOpen&&c?(this.currentContentType=a,this.openWithContent(r),![]):!s&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:n}){try{if(!n)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:i,data:o}=n||{};let r;r=this.isElementsEnabled()?ComponentFactoryService.createElement({type:i,...o}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:i}):componentError({message:"Elements is not enabled.",componentType:i}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(r,i):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(r),this.updateDrawerContentTypeClass(i),this.open()),this.addHostAttribute("data-target",i.toString().toLowerCase())}catch(i){this.logger.error("Drawer content loading failed",i),this.commands.ui.closeDrawer()}}animateContentSwap(n,i){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const o=this.contentContainer.firstElementChild;o.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{o.classList.add("fading")}),setTimeout(()=>{o.remove(),n.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(n),this.updateDrawerContentTypeClass(i),requestAnimationFrame(()=>{n.classList.add("visible"),setTimeout(()=>{n.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(n){this.isOpen&&"Escape"===n.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(n){if(!this.drawerElement)return;const i=["drawer"];this.isOpen&&i.push("open"),i.push(n.toString().toLowerCase()),this.drawerElement.className=i.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 n;try{const i=this.themeProvider.getConfigs("configurations");return null!==(n=null==i?void 0:i.isElementsEnabled)&&void 0!==n?n:![]}catch(i){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",i),!![]}}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 n=this.getConfigs("global");return["custom-input","birthdate",n.layout.inputFieldStyle]}constructor(){super({watchOnlyStorePaths:["checkout.focusField"]})}onStoreWatch(n){const i=n.find(n=>"checkout.focusField"===n.path);i&&i.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 n=this.params.value.split("/");3===n.length&&(this.monthInput.value=n[0],this.dayInput.value=n[1],this.yearInput.value=n[2])}}setupEventListeners(){this.monthInput.addEventListener("input",n=>{this.formatMonth(n),this.handleNavigation(n,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",n=>{this.formatDay(n),this.handleNavigation(n,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",n=>{this.formatYear(n),this.handleChange()}),this.monthInput.addEventListener("blur",()=>this.validateInput()),this.dayInput.addEventListener("blur",()=>this.validateInput()),this.yearInput.addEventListener("blur",()=>this.validateInput());for(const n of[this.monthInput,this.dayInput,this.yearInput])n.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",n=>{"Backspace"===n.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",n=>{"Backspace"===n.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(n){const i=n.target;let o=i.value.replace(/\D/g,"");if(o.length>2&&(o=o.substring(0,2)),1===o.length&&Number.parseInt(o,10)>1)o="0"+o;else if(2===o.length){const n=Number.parseInt(o,10);n>12?o="12":n<1&&(o="01")}i.value=o}formatDay(n){const i=n.target;let o=i.value.replace(/\D/g,"");if(o.length>2&&(o=o.substring(0,2)),1===o.length&&Number.parseInt(o,10)>3)o="0"+o;else if(2===o.length){const n=Number.parseInt(o,10);n>31?o="31":n<1&&(o="01")}i.value=o}formatYear(n){const i=n.target;let o=i.value.replace(/\D/g,"");o.length>4&&(o=o.substring(0,4)),i.value=o}handleNavigation(n,i){const o=n.target,r=o===this.yearInput?4:2;o.value.length===r&&i&&i.focus()}handleChange(){if(this.clearErrors(),this.params.onChange){const n=this.getFormattedValue();this.params.onChange(n)}}getFormattedValue(){const n=this.monthInput.value.padStart(2,"0"),i=this.dayInput.value.padStart(2,"0"),o=this.yearInput.value;return n&&i&&o&&4===o.length?o+"-"+n+"-"+i:""}validateDate(n,i,o){if(!n||!i||!o||4!==o.length)return![];const r=Number.parseInt(n,10),s=Number.parseInt(i,10),a=Number.parseInt(o,10);if(r<1||r>12||s<1||s>31||a<1e3)return![];const c=new Date(a,r-1,s);return c.getFullYear()===a&&c.getMonth()===r-1&&c.getDate()===s}calculateAge(n){const i=new Date;let o=i.getFullYear()-n.getFullYear();const r=i.getMonth()-n.getMonth();return(r<0||0===r&&i.getDate()<n.getDate())&&o--,o}validateInput(){const n=this.monthInput.value,i=this.dayInput.value,o=this.yearInput.value,r=[],s=this.params.validation;if(!s)return this.showErrors([]),!![];if(s.required&&(n&&i&&o||r.push("Please enter a complete date")),n||i||o)if(n&&i&&o&&4===o.length)if(this.validateDate(n,i,o)){const a=Number.parseInt(n,10),c=Number.parseInt(i,10),l=Number.parseInt(o,10),u=new Date(l,a-1,c);if(void 0!==s.minYear&&l<s.minYear&&r.push("Year must be "+s.minYear+" or later"),void 0!==s.maxYear&&l>s.maxYear&&r.push("Year must be "+s.maxYear+" or earlier"),void 0!==s.minAge||void 0!==s.maxAge){const n=this.calculateAge(u);void 0!==s.minAge&&n<s.minAge&&r.push("Must be at least "+s.minAge+" years old"),void 0!==s.maxAge&&n>s.maxAge&&r.push("Must be no more than "+s.maxAge+" years old")}if(s.customValidator){const n=s.customValidator(this.getFormattedValue());n&&r.push(n)}}else r.push("Please enter a valid date");else r.push("Please enter a complete date (MM/DD/YYYY)");this.showErrors(r);const a=0===r.length;return this.params.onValidation&&this.params.onValidation(a,r),a}showErrors(n){this.errorContainer.innerHTML="";const i=[this.monthInput,this.dayInput,this.yearInput];if(n.length>0){this.errorContainer.classList.add("show");for(const n of i)n.classList.add("input-error");for(const i of n){const n=document.createElement("div");n.className="error-message",n.textContent=i,this.errorContainer.appendChild(n)}}else for(const o of i)o.classList.remove("input-error")}clearErrors(){const n=[this.monthInput,this.dayInput,this.yearInput],i=n.some(n=>n.classList.contains("input-error"));if(i){for(const i of n)i.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(n){if(n){const i=n.split("/");3===i.length&&(this.monthInput.value=i[0],this.dayInput.value=i[1],this.yearInput.value=i[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 n;const i=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(n=this.params.validation)||void 0===n?void 0:n.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name+"-month"),i.push(o)}const o=document.createElement("div");o.className="date-input-container";const r=document.createElement("input");r.type="text",r.placeholder="MM",r.name=this.params.name+"-month",r.id=this.params.name+"-month",r.maxLength=2,r.className="date-field month-field",r.setAttribute("data-field","month"),r.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&&(r.disabled=!![],a.disabled=!![],l.disabled=!![]),this.params.className&&(o.className+=" "+this.params.className),o.appendChild(r),o.appendChild(s),o.appendChild(a),o.appendChild(c),o.appendChild(l);const u=document.createElement("div");return u.className="error-container",i.push(o),i.push(u),i}}class InputComponent extends BaseComponent{get hostClasses(){const n=this.getConfigs("global");return["custom-input",n.layout.inputFieldStyle]}constructor(){super({watchStorePaths:["checkout.focusField"]})}onStoreChanged(n){const i=n.find(n=>"checkout.focusField"===n.path);return i&&i.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"})),![]}handlePhoneKeydown(n){if("Backspace"===n.key){const i=n.target,o=i.selectionStart||0,r=i.value;o>0&&/\D/.test(r[o-1])&&setTimeout(()=>{const n=Math.max(0,o-2);i.setSelectionRange(n,n)},0)}}formatPhoneNumber(n){const i=n.target;let o=i.value.replace(/\D/g,"");o.length>10&&(o=o.substring(0,10)),o.length>=6?o="("+o.substring(0,3)+") "+o.substring(3,6)+"-"+o.substring(6):o.length>=3&&(o="("+o.substring(0,3)+") "+o.substring(3)),i.value=o}formatDate(n){const i=n.target;let o=i.value.replace(/\D/g,"");o.length>8&&(o=o.substring(0,8)),o.length>=5?o=o.substring(0,2)+"/"+o.substring(2,4)+"/"+o.substring(4):o.length>=3&&(o=o.substring(0,2)+"/"+o.substring(2)),i.value=o}validateEmail(n){const i=/^[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 i.test(n)}validateTel(n){const i=/^\(\d{3}\) \d{3}-\d{4}$/;return i.test(n)}validateDate(n){const i=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!i.test(n))return![];const[o,r,s]=n.split("/").map(Number),a=new Date(s,o-1,r);return a.getFullYear()===s&&a.getMonth()===o-1&&a.getDate()===r}validateInput(){const n=this.inputElement.value,i=[],o=this.params.validation;if(!o)return this.showErrors([]),!![];if(o.required&&!n.trim()&&i.push("This field is required"),n.trim()){if("email"!==this.params.inputType||this.validateEmail(n)||i.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(n)||i.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(n)||i.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const r=Number.parseFloat(n);Number.isNaN(r)?n.trim()&&i.push("Please enter a valid number"):(void 0!==o.min&&r<o.min&&i.push("Value must be at least "+o.min),void 0!==o.max&&r>o.max&&i.push("Value must be no more than "+o.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==o.min&&n.length<o.min&&i.push("Must be at least "+o.min+" characters"),void 0!==o.max&&n.length>o.max&&i.push("Must be no more than "+o.max+" characters")),o.pattern){const r=new RegExp(o.pattern);r.test(n)||i.push("Invalid format")}if(o.customValidator){const r=o.customValidator(n);r&&i.push(r)}}this.showErrors(i);const r=0===i.length;return this.params.onValidation&&this.params.onValidation(r,i),r}showErrors(n){if(this.errorContainer.innerHTML="",n.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const i of n){const n=document.createElement("div");n.className="error-message",n.textContent=i,this.errorContainer.appendChild(n)}}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(n){this.inputElement.value=n,"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 n;const i=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(n=this.params.validation)||void 0===n?void 0:n.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name),i.push(o)}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",n=>{this.clearErrors(),this.params.onChange&&this.params.onChange(n.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",i.push(this.inputElement),i.push(this.errorContainer),i}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.q=this.attachShadow({mode:"closed"})}initialize(n,i){if(this.A)return;if(!n||"string"!=typeof n)throw new Error("LceElementComponent: contentType must be a non-empty string");if(!(i&&i instanceof HTMLElement))throw new Error("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(n.toLowerCase(),""),!this.q)throw new Error("LceElementComponent: Shadow DOM container is not available");this.q.appendChild(i),this.applyBasicStyles();const o=ThemeProviderService.getInstance(),r=o.getStylesheet(n);this.applyThemeStyles(r),this.A=!![],this.q=null}applyBasicStyles(){const n="\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 i=new CSSStyleSheet;i.replaceSync(n),this.q.adoptedStyleSheets=[i,...this.q.adoptedStyleSheets]}else this.createFallbackStylesheet(n)}catch(L){this.createFallbackStylesheet(n)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const n=new CSSStyleSheet;return n.replaceSync("/* test */"),!![]}catch(n){return![]}}applyThemeStyles(n){n.forEach(n=>{"string"==typeof n?this.createFallbackStylesheet(n):this.q.adoptedStyleSheets=[...this.q.adoptedStyleSheets,n]})}createFallbackStylesheet(n){const i=document.createElement("style");i.textContent=n,this.q&&this.q.appendChild(i)}}class ProductLoadingComponent extends BaseComponent{template(){const n=Boolean(this.getStoreValue("address")),{showTitle:i,showDescription:o,showQuantityCounter:r,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"),i){const n=document.createElement("div");n.classList.add("wave","sc-title"),l.appendChild(n)}if(!n){const n=document.createElement("div");return n.classList.add("wave","sc-add-to-cart"),l.appendChild(n),l}const u=document.createElement("div");u.classList.add("wave","sc-price"),l.appendChild(u);const h=document.createElement("div");h.classList.add("sc-sizes");const p=document.createElement("div");p.classList.add("wave","sc-size-button"),h.appendChild(p);const m=document.createElement("div");m.classList.add("wave","sc-size-button"),h.appendChild(m);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),h.appendChild(f);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),h.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),h.appendChild(v),l.appendChild(h);const y=document.createElement("div");y.classList.add("sc-row");const b=document.createElement("div");b.classList.add("wave","sc-price"),y.appendChild(b);const x=document.createElement("div");x.classList.add("wave","sc-personalization"),y.appendChild(x),l.appendChild(y);const w=document.createElement("div");w.classList.add("wave","sc-deliver-to"),l.appendChild(w);const C=document.createElement("div");C.classList.add("wave","sc-address"),l.appendChild(C);const k=document.createElement("div");k.classList.add("wave","sc-retailers",s),l.appendChild(k);const S=document.createElement("div");if(S.classList.add("sc-row"),r){const n=document.createElement("div");n.classList.add("wave","sc-quantity"),S.appendChild(n)}const E=document.createElement("div");if(E.classList.add("wave","sc-add-to-cart"),S.appendChild(E),l.appendChild(S),o){const n=document.createElement("div");n.classList.add("wave","sc-description-title"),l.appendChild(n);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),l.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-line"),l.appendChild(o);const r=document.createElement("div");r.classList.add("wave","sc-description-line"),l.appendChild(r);const s=document.createElement("div");s.classList.add("wave","sc-description-more"),l.appendChild(s)}const T=document.createElement("div");if(T.classList.add("product-content"),T.appendChild(l),c.appendChild(T),a){c.classList.add("has-images");const n=this.createImageSkeletons();c.prepend(n)}return c}createImageSkeletons(){const n=document.createElement("div");n.classList.add("product-image-carousel","skeleton");const i=document.createElement("div");i.classList.add("wave","sc-main-image"),i.title="Product main image loading";const o=document.createElement("div");o.classList.add("carousel-dots");for(let a=0;a<3;a++){const n=document.createElement("div");n.classList.add("wave","sc-carousel-dot"),o.appendChild(n)}i.appendChild(o),n.appendChild(i);const r=document.createElement("div");r.classList.add("gallery-viewport");const s=document.createElement("div");s.classList.add("gallery-container");for(let a=0;a<4;a++){const n=document.createElement("div");n.classList.add("gallery-image-wrapper");const i=document.createElement("div");i.classList.add("wave","sc-gallery-thumbnail"),n.appendChild(i),s.appendChild(n)}return r.appendChild(s),n.appendChild(r),n}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const n=document.createElement("div");n.className="pb-title-container";const i=document.createElement("span");i.className="pb-text",i.textContent="Powered by",n.appendChild(i);const o=document.createElement("span");o.className="pb-lc",o.textContent="LiquidCommerce",n.appendChild(o);const r=document.createElement("span");return r.className="pb-dot",r.textContent=".",n.appendChild(r),n}createDisclaimerSection(){const n=document.createElement("div");n.className="pb-disclaimer-container";const i=this.getDisclaimerConfig();return i.parts.forEach(i=>{"text"===i.type?n.appendChild(document.createTextNode(i.content)):"link"===i.type&&n.appendChild(this.createLink(i.href,i.text))}),n}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(n,i){const o=document.createElement("a");return o.href=n,o.target="_blank",o.rel="noopener noreferrer",o.className="pb-link",o.textContent=i,o.setAttribute("role","link"),o.setAttribute("aria-label","Read "+i),o}template(){const n=this.createPoweredBySection(),i=this.createDisclaimerSection();return[n,i]}}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(n){const i=n.find(n=>"cart.promoCode"===n.path||"checkout.promoCode"===n.path);if(!i||!this.applyButton||!this.currentActiveTicker)return;const o=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);o&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!o&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(n){const i=this.store.get("cart.promoCode"),o=this.store.get("checkout.promoCode");return(null==i?void 0:i.code)===n||(null==o?void 0:o.code)===n}getActiveTickers(){var n;const i=this.store.get("address");return null===(n=this.params.tickers)||void 0===n?void 0:n.filter(n=>{var o;return isDateTimeInRange({startDate:n.activeFrom,endDate:n.activeUntil,addressState:null===(o=null==i?void 0:i.address)||void 0===o?void 0:o.state})})}selectCurrentTicker(n){return 0===n.length?null:n[0]}generateTextContent(n){const i=document.createElement("div");i.classList.add("promo-ticker__text-group");const o=n.text.map(n=>n.trim()).map(n=>n.substring(0,50)).filter(n=>""!==n.trim()).slice(0,5);for(const r of o){const o=r.trim();if(!o)continue;const s=document.createElement("span");s.classList.add("promo-ticker__text-item"),s.textContent=o,i.appendChild(s);const a=document.createElement("span");a.classList.add("promo-ticker__separator"),a.textContent=n.separator,i.appendChild(a)}return i}async handlePromoClick(){var n;(null===(n=this.currentActiveTicker)||void 0===n?void 0:n.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 n=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(n),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const i=document.createElement("div");i.classList.add("promo-ticker__content");const o=document.createElement("div");o.classList.add("promo-ticker__track");for(let s=0;s<5;s++)o.appendChild(this.generateTextContent(this.currentActiveTicker));i.appendChild(o);const r=document.createElement("button");return r.type="button",r.classList.add("promo-ticker__cta"),r.textContent="APPLY",r.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(r.disabled=!![],r.textContent="APPLIED"),r.addEventListener("click",()=>this.handlePromoClick()),r.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),this.handlePromoClick())}),this.applyButton=r,[i,r]}}const xt=LoggerFactory.get("ElementsClientHelper"),isObject=n=>null!==n&&"object"==typeof n&&!Array.isArray(n),getType=n=>null===n?"null":Array.isArray(n)?"array":typeof n;function deepMergeConfigs(n,i){if(!n||!i)return n;const o={...n},r=[];for(const s in i){const a=i[s],c=o[s];if(!(s in n)){r.push('Property "'+s+'" does not exist in target schema, skipping merge.');continue}const l=getType(a),u=getType(c);l===u?isObject(a)&&isObject(c)?o[s]=deepMergeConfigs(c,a):o[s]=a:r.push('Type mismatch for key "'+s+'": source is '+l+", target is "+u+". Skipping merge.")}return r.length>0&&xt.warn("Merging configurations with warnings:",r),o}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 n=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+n+".items")||{};return Object.values(i).find(i=>i.fulfillmentId===n)}handleItemsUpdate(n,i){const o=new Set(n||[]),r=new Set(i||[]);for(const s of o)if(!r.has(s)){const n=this.container.querySelector('[data-item-id="'+s+'"]');n&&n.remove()}for(const a of r)if(!o.has(a)){const n=ComponentFactoryService.createElement({type:s.CART_ITEM,itemId:a});n.setAttribute("data-item-id",a),this.container.appendChild(n)}}setupItemElements(){const n=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+n+".items")||[],o=this.container.querySelectorAll("[data-item-id]");for(const r of o)r.remove();for(const r of i){const n=ComponentFactoryService.createElement({type:s.CART_ITEM,itemId:r});n.setAttribute("data-item-id",r),this.container.appendChild(n)}}setupMinimumPurchaseAlert(){var n;const i=this.getFulfillmentId(),o=(null===(n=this.getProductStore())||void 0===n?void 0:n.pack)||![],r=this.getStoreValue("cart.fulfillments."+i),a=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(a&&a.remove(),shouldShowMinimumPurchaseAlert(r,o)){const n=getMinimumPurchaseMessage(r,o),i=ComponentFactoryService.createElement({type:s.PURCHASE_MIN_ALERT,message:n.message,messageType:n.type,currentTotal:r.subtotal,config:{showIcon:!![],alertType:"minimal"}});i.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(i)}}createLoadingOverlay(){const n=document.createElement("div");n.className="cart-loading-backdrop",n.setAttribute("data-loading-id","fulfillment-loading-overlay");const i=document.createElement("div");i.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',i.appendChild(o),n.appendChild(i),n}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const n=this.createLoadingOverlay();this.container.appendChild(n),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const n=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');n&&(n.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var n;const i=this.getFulfillmentId(),o=this.getStoreValue("cart.fulfillments."+i);return(null===(n=null==o?void 0:o.items)||void 0===n?void 0:n.length)?o.items.some(n=>{const i=this.getStoreValue("cart.items."+n);return(null==i?void 0:i.updating)===!![]}):![]}checkAndUpdateLoadingState(){const n=this.isAnyItemUpdating(),i=this.hasLoadingOverlay();n&&!i?this.showLoadingOverlay():!n&&i&&this.hideLoadingOverlay()}onStoreChanged(n){const i=this.getFulfillmentId(),o="cart.fulfillments."+i,r=n.find(n=>n.path===o),s=n.filter(n=>"cart.items"===n.path||n.path.startsWith("cart.items."));if(s.length>0&&this.checkAndUpdateLoadingState(),r){const n=r.oldValue,i=r.value,o=(null==n?void 0:n.items)||[],s=(null==i?void 0:i.items)||[],a=JSON.stringify(o)!==JSON.stringify(s);a&&(this.handleItemsUpdate(o,s),this.checkAndUpdateLoadingState());const c=this.hasFulfillmentFeesChanged(n,i),l=this.hasFulfillmentDataChanged(n,i,["items","updating"]);if(c&&!l&&this.setupMinimumPurchaseAlert(),!l)return![]}return![]}hasFulfillmentFeesChanged(n,i){return n?n.subtotal!==i.subtotal||n.shippingFee!==i.shippingFee||n.deliveryFee!==i.deliveryFee||JSON.stringify(n.fees)!==JSON.stringify(i.fees):!![]}hasFulfillmentDataChanged(n,i,o=[]){if(!n)return!![];const r=["type","canEngrave","retailerId"];for(const s of r)if(!o.includes(s)&&n[s]!==i[s])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}class LiquidCommerceElementsClient{constructor(n){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],this.builder={updateComponentGlobalConfigs:async n=>{if(this.ensuredIsBuilder("updateComponentGlobalConfigs"))try{if(!n)throw new Error("Global theme configuration is required");this.themeProvider.updateComponentGlobalConfigs(n),n.layout&&Object.keys(n.layout).length>0&&(await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout()),this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(i){throw this.logger.error("❌ Failed to update global theme configuration",i),new Error("Global theme update failed")}},updateProductComponent:async n=>{if(this.ensuredIsBuilder("updateProductComponent"))try{if(!n)throw new Error("Product component configuration is required");this.themeProvider.updateProductComponent(n),n.layout&&Object.keys(n.layout).length>0&&await this.commands.product.rerenderAllProducts(),this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(i){throw this.logger.error("❌ Failed to update product component theme",i),new Error("Product theme update failed")}},updateCartComponent:n=>{if(this.ensuredIsBuilder("updateCartComponent"))try{if(!n)throw new Error("Cart component configuration is required");this.themeProvider.updateCartComponent(n),n.layout&&Object.keys(n.layout).length>0&&this.commands.cart.rerenderCart(),this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(i){throw this.logger.error("❌ Failed to update cart component theme",i),new Error("Cart theme update failed")}},updateCheckoutComponent:n=>{if(this.ensuredIsBuilder("updateCheckoutComponent"))try{if(!n)throw new Error("Checkout component configuration is required");this.themeProvider.updateCheckoutComponent(n),n.layout&&Object.keys(n.layout).length>0&&this.commands.checkout.rerenderCheckout(),this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(i){throw this.logger.error("❌ Failed to update checkout component theme",i),new Error("Checkout theme update failed")}},updateAddressComponent:n=>{if(this.ensuredIsBuilder("updateAddressComponent"))try{if(!n)throw new Error("Address component configuration is required");this.themeProvider.updateAddressComponent(n),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(i){throw this.logger.error("❌ Failed to update address component theme",i),new Error("Address theme update failed")}},injectElement:async n=>{this.ensuredIsBuilder("injectElement")&&await this.processInjectElement(n)},injectProductElement:async n=>{this.ensuredIsBuilder("injectProductElement")&&await this.processInjectProduct(n)},injectAddressElement:async(n,i)=>{this.ensuredIsBuilder("injectAddressElement")&&await this.processInjectElement({type:s.ADDRESS,containerId:n,options:i})},injectCartElement:async n=>{this.ensuredIsBuilder("injectCartElement")&&await this.processInjectElement({type:s.CART,containerId:n})},injectCheckoutElement:async n=>{this.ensuredIsBuilder("injectCheckoutElement")&&await this.processInjectElement({type:s.CHECKOUT,containerId:n})}},this.ui={cartButton:(n,i)=>{var o;this.ensureCartDrawerExists();const r=document.getElementById(null!==(o=null==n?void 0:n.replace("#",""))&&void 0!==o?o:"");if(!r)throw new Error("Container with ID '"+n+"' not found");const a=ComponentFactoryService.createElement({type:s.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:i});r.innerHTML="",safeReplaceChildren(r,a)},floatingCartButton:n=>{this.ensureCartDrawerExists();const i=ComponentFactoryService.createElement({type:s.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:n});document.body.appendChild(i)},cartSubtotal:n=>{var i;const o=document.getElementById(null!==(i=null==n?void 0:n.replace("#",""))&&void 0!==i?i:"");if(!o)throw new Error("Element with ID '"+n+"' not found");o.innerHTML="";const r=this.store.get("cart.totals.subtotal")||0;o.textContent=formatCentToDollarText(r),this.store.watch("cart.totals",()=>{const n=this.store.get("cart.totals.subtotal")||0;o.textContent=formatCentToDollarText(n)})},cartItemsCount:n=>{var i;const o=document.getElementById(null!==(i=null==n?void 0:n.replace("#",""))&&void 0!==i?i:"");if(!o)throw new Error("Element with ID '"+n+"' not found");o.innerHTML="";const r=this.store.get("cart.totals.quantity")||0;o.textContent=r.toString(),this.store.watch("cart.totals",()=>{const n=this.store.get("cart.totals.quantity")||0;o.textContent=n.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:n.apiKey,env:n.env,baseUrl:n.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(n){throw this.logger.error("Failed to prepare client",n),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),n}}async prepareEssentialServices(){this.clientConfig.set("version",L.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 n=await this.authService.authenticate();if(!n)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 i=await this.apiClient.getAllConfigs();this.logger.debug("✅ Configurations loaded"),this.clientConfig.set("partnerCode",i.configurations.partnerCode),this.logger.debug("🔍 Setting up fingerprinting and store...");const o=await this.fingerPrintService.getId(i.configurations.partnerCode),r=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",o),this.clientConfig.set("isLocalStorageAvailable",r);const s=r?null:await this.apiClient.getPersistedStore(o);if(await this.store.initialize({userDeviceId:o,isLocalStorageAvailable:r,persistedStore:s}),this.logger.debug("✅ Store setup completed"),this.logger.debug("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const n=this.clientConfig.get("customTheme"),o=i.global.layout.showPoweredBy;i=deepMergeConfigs(i,n),i.global.layout.showPoweredBy=o}await this.themeProvider.initialize(i),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(n){this.logger.error("Heavy initialization failed",n)}},0)}async initializeHeavyServices(){const n=this.themeProvider.getConfigs("configurations");if(!this.gtmInitialized)try{await this.googleTagManager.initialize({partnerName:n.partnerName,partnerGtmId:n.googleTagManagerId,partnerEnableGaTracking:n.enablePartnerGaTracking,liquidCommerceEnableGaTracking:n.enableLiquidCommerceGaTracking,liquidCommerceGtmId:n.liquidCommerceGoogleTagManagerId}),this.gtmInitialized=!![]}catch(i){this.logger.error("GTM initialization failed",i)}try{this.isElementsEnabled()&&await this.commands.common.loadCart()}catch(o){this.logger.error("Cart pre-loading failed",o)}this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}async injectProductElement(n){if(this.isElementsEnabled())await this.processInjectProduct(n);else for(const i of n)this.injectDisabledElementsError(i.containerId,s.PRODUCT)}async injectAddressElement(n,i){if(!this.isElementsEnabled())return this.injectDisabledElementsError(n,s.ADDRESS),void 0;await this.processInjectElement({type:s.ADDRESS,containerId:n,options:i})}async injectCartElement(n){if(!this.isElementsEnabled())return this.injectDisabledElementsError(n,s.CART),void 0;await this.processInjectElement({type:s.CART,containerId:n})}async injectCheckoutElement(n){if(!this.isElementsEnabled())return this.injectDisabledElementsError(n,s.CHECKOUT),void 0;await this.processInjectElement({type:s.CHECKOUT,containerId:n})}get actions(){return this.clientAction.actions}async processInjectProduct(n){var i,o;if(this.ensureAllComponentsRegistered(),0===n.length)throw new Error("At least one product must be provided");n.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const r=n.slice(0,20),a=[];for(const s of r){const n=null===(o=null===(i=s.containerId)||void 0===i?void 0:i.replace("#",""))||void 0===o?void 0:o.trim();if(!n){this.logger.warn("Container ID is required for product with ID '"+s.identifier+"'");continue}const r=document.getElementById(n);if(!r){this.logger.warn("Container with ID '"+n+"' not found for product '"+s.identifier+"'");continue}const c=a.every(i=>i.containerId!==n);if(!c){this.logger.warn("Duplicate container ID '"+n+"' found, skipping");continue}if(!s.identifier){this.logger.warn("Product identifier is required for container ID '"+n+"'");continue}const l=a.every(n=>n.identifier!==s.identifier);l?a.push({containerId:n,identifier:s.identifier}):this.logger.warn("Duplicate product identifier '"+s.identifier+"' found, skipping")}for(const c of a){const n=ComponentFactoryService.createElement({type:s.PRODUCT,useShadowDom:!![],productId:c.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),i=document.getElementById(c.containerId);i?(i.innerHTML="",safeReplaceChildren(i,n),await this.commands.product.createProductInstance(c.identifier,!![])):this.logger.warn("Product ("+c.identifier+") container with ID '"+c.containerId+"' not found")}await this.commands.product.loadMultipleProducts(a.map(n=>n.identifier))}async processInjectElement(n){this.ensureAllComponentsRegistered();const{type:i,containerId:o,...r}=n;if(!o)throw new Error("Container ID is required");if(!i)throw new Error("Component type is required");const a=n.containerId.replace("#",""),c=document.getElementById(a);if(!c)return console.warn("Container with ID '"+a+"' not found"),void 0;c.innerHTML="";const l={type:n.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...r},u=ComponentFactoryService.createElement(l);safeReplaceChildren(c,u),n.type===s.CHECKOUT&&await this.commands.checkout.loadCheckout()}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const n=ComponentFactoryService.createElement({type:s.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(n),this.cartDrawerCreated=!![]}catch(n){this.logger.warn("Failed to create cart drawer:",n)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}isElementsEnabled(){var n;try{const i=this.themeProvider.getConfigs("configurations");return null!==(n=null==i?void 0:i.isElementsEnabled)&&void 0!==n?n:![]}catch(i){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",i),!![]}}injectDisabledElementsError(n,i){const o=document.getElementById(n.replace("#",""));if(!o)return this.logger.warn("Container with ID '"+n+"' not found for disabled elements error"),void 0;let r;r=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:i}):componentError({message:"Elements is not enabled.",componentType:i}),o.innerHTML="",safeReplaceChildren(o,r)}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(n){return this.clientConfig.isBuilder()?!![]:(this.logger.error("This method ("+n+") is only available in builder mode"),![])}}async function Elements(n,i){try{const r=ClientConfigService.getInstance();r.initialize(n,{env:i.env,isBuilder:i.isBuilder,debugMode:i.debugMode,customTheme:i.customTheme,proxy:i.proxy,promoTicker:i.promoTicker});const s=r.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};window.elements=c;const l=PubSubService.getInstance();return l.publishAction(o.CLIENT_READY,{isReady:!![],message:"Client Is Ready",timestamp:Date.now(),version:r.get("version")}),c}catch(r){try{const n=LoggerFactory.get("ElementsClientInit");n.error("Elements Client Initialization failed",r)}catch(s){console.error("[LiquidCommerce Elements] Client initialization failed:",null==r?void 0:r.message)}try{const n=ClientConfigService.getInstance(),i=PubSubService.getInstance();i.publishAction(o.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==r?void 0:r.message),timestamp:Date.now(),version:n.get("version")||"unknown"})}catch(a){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}function pairsFromMainScript(n){const i=[];try{const r=n.getAttributeNames().filter(n=>"data-product"===n.substring(0,12));for(const s of r)try{const o=s.match(/^data-product(-(.+))?$/),r=(null==o?void 0:o[2])?"-"+o[2]:"",a="data-container"+r;n.hasAttribute(a)&&i.push({containerId:n.getAttribute(a),identifier:n.getAttribute(s)})}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",o)}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",r)}return i}function pairsFromProductsScript(){const n=[];try{const o=document.querySelectorAll("script[data-liquid-commerce-elements-products]");for(const r of o)try{const i=JSON.parse(r.textContent||"[]");if(!Array.isArray(i))continue;for(const o of i)o.containerId&&o.identifier&&n.push({containerId:o.containerId,identifier:o.identifier})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",i)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",o)}return n}function pairsFromAttributedElements(){const n=[];try{const o=document.querySelectorAll("div[data-lce-product]");for(const r of o)try{const i="lcep-"+(Date.now().toString(36)+Math.random().toString(36).substring(2,15));r.setAttribute("id",i);const o=r.getAttribute("data-lce-product");i&&o&&n.push({containerId:i,identifier:o})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",i)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",o)}return n}function startsWithLcePrefix(n){return null!==n&&"lce_"===n.substring(0,4)}async function addProductToCartViaQueryParam(n,i){const o=i.getAttribute("data-product-param"),r=i.getAttribute("data-product-fulfillment-type-param");if(!o)return;if(!startsWithLcePrefix(o))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+o+'" because it does not start with "lce_" prefix.'),void 0;const s=new URLSearchParams(window.location.search),c=s.get(o);if(!c)return;let l=a.SHIPPING;if(r)if(startsWithLcePrefix(r)){const n=s.get(r);n!==a.ON_DEMAND&&n!==a.SHIPPING||(l=n)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+r+'" because it does not start with "lce_" prefix.');try{await n.actions.cart.addProduct([{identifier:c,fulfillmentType:l,quantity:1}],!![])}catch(u){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",u)}}async function addPromoCodeToCartViaQueryParam(n,i){const o=i.getAttribute("data-promo-code-param");if(!o)return;if(!startsWithLcePrefix(o))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+o+'" because it does not start with "lce_" prefix.'),void 0;const r=new URLSearchParams(window.location.search),s=r.get(o);if(s)try{await n.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 n,o,r,s,a,l;try{const l=document.querySelector("script[data-liquid-commerce-elements]");if(!l)return;const f=l.getAttribute("data-token"),g=l.getAttribute("data-env")||i.PRODUCTION,v=l.getAttribute("data-debug-mode");if(!f)throw new Error("Missing API Key (data-token attribute).");const y=l.getAttribute("data-cart-id"),b=l.hasAttribute("data-show-cart-items"),x=l.hasAttribute("data-hide-cart-floating-button"),w=l.getAttribute("data-promo-code"),C=l.getAttribute("data-promo-text"),k=null!==(n=l.getAttribute("data-promo-separator"))&&void 0!==n?n:"•",S=null!==(o=l.getAttribute("data-promo-active-from"))&&void 0!==o?o:void 0,E=null!==(r=l.getAttribute("data-promo-active-until"))&&void 0!==r?r:void 0,T=pairsFromMainScript(l),P=pairsFromProductsScript(),D=pairsFromAttributedElements(),_=[...T,...P,...D],z=w&&C&&S&&E?{promoCode:w,text:C.split("|").map(n=>n.trim()).filter(n=>n.length>0),separator:k,activeFrom:null===(s=new Date(S))||void 0===s?void 0:s.toISOString(),activeUntil:null===(a=new Date(E))||void 0===a?void 0:a.toISOString()}:void 0;let O=c.NONE;v&&g!==i.PRODUCTION&&(O=v);const N=await Elements(f,{env:g,debugMode:O,promoTicker:z?[z]:void 0});if(!N)throw new Error("Failed to initialize client.");if(0!==_.length)try{await N.injectProductElement(_)}catch(u){console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",u)}try{const n=y&&document.getElementById(y.replace("#",""));n?N.ui.cartButton(y,b):x||(N.ui.floatingCartButton(b),y&&console.warn('[LiquidCommerce Elements Auto Initialization] Cart container with ID "'+y+'" not found. Falling back to floating cart button.'))}catch(h){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",h)}try{await addProductToCartViaQueryParam(N,l)}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",p)}try{await addPromoCodeToCartViaQueryParam(N,l)}catch(m){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",m)}}catch(f){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(l=null==f?void 0:f.message)&&void 0!==l?l:String(f))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(L){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",L)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(L){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",L)}},50)}catch(L){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",L)}}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 n=window.onerror;window.onerror=(i,o,r,s,a)=>{var c,l;const u=(null==o?void 0:o.includes("elements"))||(null==o?void 0:o.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 u?(console.error("[LiquidCommerce Elements] Unhandled error:",{message:i,source:o,lineno:r,colno:s,error:a}),!![]):n?n(i,o,r,s,a):![]};const i=window.onunhandledrejection;window.onunhandledrejection=n=>{var o,r,s,a,c,l;const u=(null===(r=null===(o=n.reason)||void 0===o?void 0:o.stack)||void 0===r?void 0:r.includes("LiquidCommerce"))||(null===(a=null===(s=n.reason)||void 0===s?void 0:s.stack)||void 0===a?void 0:a.includes("elements-sdk"))||(null===(l=null===(c=n.reason)||void 0===c?void 0:c.message)||void 0===l?void 0:l.includes("LiquidCommerce"));if(u)return console.error("[LiquidCommerce Elements] Unhandled promise rejection:",n.reason),n.preventDefault(),void 0;i&&i.call(window,n)};try{initializeDOMPolyfills()}catch(wt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",wt)}try{triggerElementsAutoInit()}catch(Ct){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Ct)}}catch(kt){console.error("[LiquidCommerce Elements] SDK initialization failed:",kt)}initializeDOMPolyfills(),window.Elements=Elements,exports.Elements=Elements,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});