@liquidcommerce/elements-sdk 2.2.0-beta.4 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +7240 -7240
- package/package.json +1 -1
- package/umd/elements.js +1 -1
package/umd/elements.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...t){for(;this.firstChild;)this.removeChild(this.firstChild);for(const e of t)"string"==typeof e?this.appendChild(document.createTextNode(e)):this.appendChild(e)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const e=document.createDocumentFragment();for(const n of t)"string"==typeof n?e.appendChild(document.createTextNode(n)):e.appendChild(n);this.insertBefore(e,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.replaceChild(n,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.insertBefore(n,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.insertBefore(n,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const e={};for(const[n,i]of t)e[n]=i;return e})}function safeScrollIntoView(t,e){try{e&&"function"==typeof t.scrollIntoView?t.scrollIntoView(e):t.scrollIntoView()}catch(n){try{t.scrollIntoView()}catch(i){console.warn("scrollIntoView failed:",i)}}}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(D){console.warn("DOM polyfills initialization failed:",D)}}function safeReplaceChildren(t,...e){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...e);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const n of e)"string"==typeof n?t.appendChild(document.createTextNode(n)):t.appendChild(n)}}catch(n){console.error("replaceChildren operation failed:",n),1===e.length&&"string"==typeof e[0]&&(t.innerHTML=e[0])}}const t={LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},e={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",PRODUCT_ENGRAVING_UPDATED:"product_engraving_updated",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"},n={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},i={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"},o={ON_DEMAND:"onDemand",SHIPPING:"shipping"},r={[t.LOCAL]:"http://0.0.0.0:8080",[t.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[t.STAGING]:"https://staging-elements.liquidcommerce.us",[t.PRODUCTION]:"https://elements.liquidcommerce.us"},s={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 SingletonManager{static getInstances(){return SingletonManager.instances||(SingletonManager.instances=new Map),SingletonManager.instances}constructor(){}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,e){const n=SingletonManager.getInstances();n.has(t)||n.set(t,e());const i=n.get(t);if(!i)throw new Error("ElementsSdk: Instance for class "+t+" could not be created.");return i}static async getClient(t){const e=[t.apiKey,t.env,t.isBuilder,t.enableDebugging].join("_"),n="LiquidCommerceElementsClient_"+e,i=SingletonManager.getInstances();if(i.has(n))return i.get(n);if(!SingletonManager.clientConstructor)throw new Error("LiquidCommerce Elements: Client constructor is not set.");const o=new SingletonManager.clientConstructor(t);return await o.prepare(),i.set(n,o),o}}SingletonManager.instances=null,SingletonManager.clientConstructor=null;class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,e={}){this.validateInputs(t,e),this.config=Object.freeze(this.buildConfiguration(t,e))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,e){if(!this.config)throw new Error("ClientConfigService is not initialized. Please call initialize() first.");this.config=Object.freeze({...this.config,[t]:e})}isDevelopment(){return this.get("env")===t.DEVELOPMENT}isStaging(){return this.get("env")===t.STAGING}isProduction(){return this.get("env")===t.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){return this.get("enableDebugging")}debuggingDisabled(){return!this.get("enableDebugging")}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,n){if(!(null==e?void 0:e.trim()))throw new Error("API key is required");if(n.env&&!Object.values(t).includes(n.env))throw new Error('Invalid environment "'+n.env+'"');if(void 0!==n.isBuilder&&"boolean"!=typeof n.isBuilder)throw new Error("isBuilder must be a boolean");if(void 0!==n.enableDebugging&&"boolean"!=typeof n.enableDebugging)throw new Error("enableDebugging must be a boolean");if(n.promoTicker&&"object"!=typeof n.promoTicker)throw new Error("promoTicker must be an object");if(n.promoTicker){if(!Array.isArray(n.promoTicker))throw new Error("promoTicker must be an array");for(const t of n.promoTicker){if("string"!=typeof t.promoCode||!t.promoCode.trim())throw new Error("promoTicker.promoCode is required and must be a non-empty string");if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))throw new Error("promoTicker.text is required and must be a non-empty array of strings");if("string"!=typeof t.separator||!t.separator.trim())throw new Error("promoTicker.separator is required and must be a non-empty string");if(!t.activeFrom)throw new Error("promoTicker.activeFrom is required");const e="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(e instanceof Date)||Number.isNaN(e.getTime()))throw new Error("promoTicker.activeFrom must be a valid Date object or ISO date string");if(!t.activeUntil)throw new Error("promoTicker.activeUntil is required");const n="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;if(!(n instanceof Date)||Number.isNaN(n.getTime()))throw new Error("promoTicker.activeUntil must be a valid Date object or ISO date string");if(e>=n)throw new Error("promoTicker.activeFrom must be earlier than promoTicker.activeUntil")}}if(n.proxy){if("object"!=typeof n.proxy)throw new Error("proxy must be an object");if(!n.proxy.baseUrl||"string"!=typeof n.proxy.baseUrl)throw new Error("proxy.baseUrl is required and must be a string");if(n.proxy.headers&&"object"!=typeof n.proxy.headers)throw new Error("proxy.headers must be an object")}}buildConfiguration(e,n){var i,o;const s=n.env||t.STAGING,a=r[s];return{apiKey:e.trim(),env:s,isBuilder:null!==(i=n.isBuilder)&&void 0!==i?i:![],enableDebugging:null!==(o=n.enableDebugging)&&void 0!==o?o:![],baseUrl:a,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null}}detectDeviceType(){var t,e;if("undefined"==typeof navigator)return"desktop";const n=navigator.userAgent.toLowerCase(),i="ontouchstart"in window||navigator.maxTouchPoints>0,o=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,r=(null===(e=window.screen)||void 0===e?void 0:e.height)||0,s=Math.max(o,r),a=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],c=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return a.some(t=>t.test(n))?"tablet":c.some(t=>t.test(n))||i&&s<768?"mobile":i&&s>=768&&s<=1200||i&&/macintosh/i.test(n)&&navigator.maxTouchPoints>1||/android/i.test(n)&&i&&s>=768||/windows nt/i.test(n)&&i&&s>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(n),"desktop")}}class LoggerService{constructor(t){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.context=t}static getInstance(t){return SingletonManager.getClassInstance("LoggerService_"+t,()=>new LoggerService(t))}setEnableLogging(t){this.enableLogging=t}getPrefix(t){if(!this.enableLogging)return[];const e=(new Date).toISOString().slice(11,23);return["%c["+e+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[t],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[t],"color: "+this.colors[t]]}debug(...t){if(!this.enableLogging)return;const[e,...n]=this.getPrefix("debug");console.debug(e,...n,...t)}log(...t){if(!this.enableLogging)return;const[e,...n]=this.getPrefix("log");console.log(e,...n,...t)}info(...t){if(!this.enableLogging)return;const[e,...n]=this.getPrefix("info");console.info(e,...n,...t)}warn(...t){if(!this.enableLogging)return;const[e,...n]=this.getPrefix("warn");console.warn(e,...n,...t)}error(...t){if(!this.enableLogging)return;const[e,...n]=this.getPrefix("error");console.error(e,...n,...t)}group(t,e=![]){if(!this.enableLogging)return;const[n,...i]=this.getPrefix("log");e?console.groupCollapsed(n,...i,t):console.group(n,...i,t)}groupEnd(){this.enableLogging&&console.groupEnd()}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const e=this.getInstances();if(!e.has(t)){const n=LoggerService.getInstance(t);n.setEnableLogging(this.enableLoggingGlobally),e.set(t,n)}return e.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const e=this.getInstances();for(const[,n]of e)n.setEnableLogging(t)}}function fetchAdapter(t){return async(e,n)=>{var i;const o=await t(e,n);let r;if("function"==typeof(null===(i=o.headers)||void 0===i?void 0:i.entries))r=Object.fromEntries(o.headers.entries());else{r={};for(const[t,e]of o.headers)r[t]=e}return{ok:o.ok,status:o.status,statusText:o.statusText,headers:r,json:()=>o.json(),text:()=>o.text()}}}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![];const xhrFetch=(t,e)=>new Promise((n,i)=>{const o=new XMLHttpRequest;o.open(e.method||"GET",t);for(const[t,r]of objectEntries(e.headers))o.setRequestHeader(t,r);o.onload=()=>{n({ok:o.status>=200&&o.status<300,status:o.status,statusText:o.statusText,headers:o.getAllResponseHeaders().split("\r\n").reduce((t,e)=>{const[n,i]=e.split(": ");return n&&i&&(t[n]=i),t},{}),json:()=>Promise.resolve(JSON.parse(o.responseText)),text:()=>Promise.resolve(o.responseText)})},o.onerror=()=>{i(new TypeError("Network request failed"))},o.send(e.body)});function getFetchImplementation(){return"undefined"!=typeof fetch?fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?fetchAdapter(global.fetch):window.fetch?fetchAdapter(window.fetch):xhrFetch}function objectValues(t){const e=[];for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(t[n]);return e}function objectEntries(t){const e=[];for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push([n,t[n]]);return e}class AuthService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=getFetchImplementation(),this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(t))}async authenticate(){var t,e;if(this.isAuthenticating)return await new Promise(t=>{const O=()=>{this.isAuthenticating?setTimeout(O,100):t(void 0)};O()}),!!this.accessToken;this.isAuthenticating=!![];try{const n=await this.requestWithoutAuth("/auth",{method:"GET"});return this.accessToken=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.token,this.tokenExpiration=Date.now()+1e3*(null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.exp),!![]}catch(n){return this.logger.error("Authentication failed:",(null==n?void 0:n.message)||n),![]}finally{this.isAuthenticating=![]}}async requestWithoutAuth(t,e){const n=this.buildUrl(t),i={"Content-Type":"application/json","X-Liquid-Api-Key":this.apiKey,"X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now(),...this.getProxyHeaders(),...e.headers};this.clientConfig.isBuilder()&&(i["X-Liquid-Api-Builder"]=!![]);const o={method:e.method,headers:i,body:e.body?JSON.stringify(e.body):void 0},r=await this.httpClient(n,o);if(!r.ok)throw new Error("HTTP error status: "+r.status);return r.json()}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(t,e){this.accessToken&&!this.isTokenExpired()||await this.authenticate();const n=this.buildUrl(t),i={"Content-Type":"application/json",Authorization:"Bearer "+this.accessToken,"X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now(),...this.getProxyHeaders(),...e.headers};this.clientConfig.isBuilder()&&(i["X-Liquid-Api-Builder"]=!![]);const o={method:e.method,headers:i,body:e.body?JSON.stringify(e.body):void 0},r=await this.httpClient(n,o);let s;try{s=await r.json()}catch(a){const t=await r.text().catch(()=>"HTTP error status: "+r.status);s={message:t||a}}if(!r.ok)throw{...s,status:r.status,message:(null==s?void 0:s.message)||"HTTP error status: "+r.status};return s}buildUrl(t){const e=this.clientConfig.getProxyConfig();return new URL("api"+t,e?e.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}async get(t,e){return this.request(t,{method:"GET",headers:e})}async post(t,e,n){return this.request(t,{method:"POST",body:e,headers:n})}async put(t,e,n){return this.request(t,{method:"PUT",body:e,headers:n})}async delete(t,e){return this.request(t,{method:"DELETE",headers:e})}}const a="@liquidcommerce/elements-sdk",c="LiquidCommerce Elements SDK",l="UNLICENSED",h="LiquidCommerce Team",u="2.2.0-beta.4",p="https://docs.liquidcommerce.co/elements-sdk",m={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},f={url:"https://github.com/liquidcommerce/elements-sdk/issues"},g="./dist/index.esm.js",v="./umd/elements.js",y="./dist/types/index.d.ts",b="pnpm@10.0.0",x={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},w=["dist","umd","README.md"],C={access:"public",registry:"https://registry.npmjs.org/"},k="module",S=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],E={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"'},I=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],T={"@biomejs/biome":"2.2.2","@commitlint/cli":"^19.8.1","@commitlint/config-conventional":"^19.8.1","@rollup/plugin-alias":"^5.1.1","@rollup/plugin-commonjs":"^28.0.6","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.3.1","@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":"^11.0.6","@semantic-release/npm":"^12.0.2","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.5.2","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.52.2","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^24.2.9","ts-node":"^10.9.2",typescript:"^5.9.2"},P={node:">=20"},F={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},D={name:a,description:c,license:l,author:h,version:u,homepage:p,repository:m,bugs:f,module:g,browser:v,types:y,packageManager:b,exports:x,files:w,publishConfig:C,type:k,sideEffects:S,scripts:E,keywords:I,devDependencies:T,engines:P,pnpm:F};class GoogleTagManagerService{constructor(){this.partnerEnableGaTracking=![],this.liquidCommerceEnableGaTracking=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){if("function"==="object".gtag)return!![];const t=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return t.length>0}isContainerLoaded(t){const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.some(e=>{const n=e.src;return n.includes("id="+t)})}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...t)=>window.dataLayer.push(t),window.dataLayer.push({"gtm.start":Date.now(),event:"gtm.js"}),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(t){return new Promise((e,n)=>{if(this.isContainerLoaded(t))return this.logger.info("GTM container "+t+" already loaded, skipping script injection"),e(),void 0;this.logger.info("Loading GTM container "+t);const i=document.createElement("script");i.src="https://www.googletagmanager.com/gtm.js?id="+t,i.async=!![];const o=setTimeout(()=>n(new Error("GTM script timeout: "+t)),5e3);i.onload=()=>{clearTimeout(o),this.logger.info("GTM container "+t+" loaded successfully"),e()},i.onerror=()=>{clearTimeout(o),n(new Error("GTM script failed: "+t))},document.head.appendChild(i)})}processEventQueue(){const t=Date.now(),e=this.eventQueue.filter(e=>t-e.timestamp<3e4);for(const i of e)try{const t={event:i.eventName,...i.eventData};window.dataLayer.push(t),"function"==="object".gtag&&window.gtag("event",i.eventName,i.eventData),this.logger.debug("Processed queued GTM event: "+i.eventName,{data:i.eventData})}catch(n){this.logger.error("Error processing queued event "+i.methodName+":",n)}this.eventQueue=[],e.length>0&&this.logger.info("Processed "+e.length+" queued GTM events")}getSendToTargets(){const t=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&(!this.isContainerLoaded(this.liquidCommerceGtmId)&&this.isGTMAlreadyLoaded()||t.push(this.liquidCommerceGtmId)),this.partnerEnableGaTracking&&this.partnerGtmId&&(this.isGTMAlreadyLoaded()||this.isContainerLoaded(this.partnerGtmId))&&t.push(this.partnerGtmId),0===t.length&&this.isGTMAlreadyLoaded()&&this.logger.debug("No specific targets configured, letting GTM route events naturally"),t}async initialize(t){if(this.isInitialized||this.isInitializing)return this.initializationPromise;if(!this.clientConfigService.isBuilder()){this.isInitializing=!![],this.initializationPromise=this.doInitialize(t);try{await this.initializationPromise}catch(e){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed:",e)}}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGtmId))throw new Error("GTM config missing required fields");if(!t.liquidCommerceEnableGaTracking&&!t.partnerEnableGaTracking)return this.logger.warn("GTM initialization skipped: No tracking enabled"),this.isInitialized=!![],this.isInitializing=![],void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerGtmId=t.partnerGtmId,this.liquidCommerceGtmId=t.liquidCommerceGtmId,this.partnerEnableGaTracking=t.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=t.liquidCommerceEnableGaTracking;const e=this.isGTMAlreadyLoaded();e&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let n=![],i="";if(t.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(t.liquidCommerceGtmId),n=!![],i=e?"GTM integrated with existing setup (Partner GTM detected, LC container: "+t.liquidCommerceGtmId+")":"GTM initialized with container "+t.liquidCommerceGtmId}catch(o){this.logger.warn("Failed to load LiquidCommerce GTM container: "+o+". Checking if partner GTM is available.")}if(n||(e&&window.dataLayer?(n=!![],i="GTM integrated with existing partner setup"):window.dataLayer&&Array.isArray(window.dataLayer)&&(n=!![],i="GTM initialized with dataLayer (basic functionality available)")),!n)throw this.isInitializing=![],new Error("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(i),this.processEventQueue()}executeEvent(t,e,n){try{if(this.clientConfigService.isBuilder())return;const i=this.getSendToTargets(),o={...n,...i.length>0&&{send_to:i},tenant_source:D.description+" v"+D.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:e,eventData:o,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+e+" (initialization pending)",{data:o}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+e+" skipped: dataLayer not available"),void 0;const r={event:e,...o};window.dataLayer.push(r),"function"==="object".gtag&&window.gtag("event",e,o),this.logger.debug("Sent GTM event: "+e,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:i.length>0?i:"no targeting",data:o})}catch(i){this.logger.error("GTM "+t+" error:",i)}}calculateValue(t){return t.reduce((t,e)=>t+(e.price||0)*(e.quantity||1),0)}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,e,n){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:e,item_list_name:n,items:t})}selectItem(t,e,n){this.executeEvent("selectItem","select_item",{item_list_id:e,item_list_name:n,items:[t]})}addToCart(t){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),quantity:t.quantity||1,items:[t]})}viewCart(t){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(t),items:t})}removeFromCart(t){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}beginCheckout(t,e){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfo(t,e){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfoWithCustomerData(t,e,n){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:t,coupon:e,phone:null==n?void 0:n.phone,email:null==n?void 0:n.email,birth_date:null==n?void 0:n.birth_date,customer_id:null==n?void 0:n.customer_id})}addPaymentInfo(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:e,coupon:n,items:t})}addPaymentInfoWithoutItems(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:t,payment_type:e,coupon:n})}purchase(t){this.executeEvent("purchase","purchase",{transaction_id:t.transaction_id,value:t.value,currency:this.currency,tax:t.tax,shipping:t.shipping,coupon:t.coupon,items:t.items})}increaseQuantity(t){this.executeEvent("increaseQuantity","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}decreaseQuantity(t){this.executeEvent("decreaseQuantity","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}}class PubSubService{constructor(){this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub")}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,e){this.publishSpecific("actions."+t,e)}publishForm(t,e){this.publishSpecific("forms."+t,e)}publishSpecific(t,e){const[n,i]=t.includes(".")?t.split(".",2):["actions",t];let o=i.split("_")[0];["product","cart","address","checkout"].includes(o)||(o="other");const r=Date.now(),s={eventId:this.generateEventId(r),namespace:n,event:i,originalEvent:t,actionNamespace:"actions"===n?o:void 0,timestamp:r},a={data:e,metadata:s};this.dispatchNativeEvents(t,a)}dispatchNativeEvents(t,e){const[n]=t.split(".",2);try{const i=new CustomEvent(this.eventPrefix+":"+t,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(i);const o=new CustomEvent(this.eventPrefix+":"+n,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(o)}catch(i){this.logger.error("Error dispatching native events for "+t+":",i)}}generateEventId(t){return"evt_"+t+"_"+Math.random().toString(36).slice(2,9)}}const A="liquid_elements",_={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:o.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,engravingLines:[],drawer:{isOpen:![],contentConfig:null},rerender:![],mainImage:null},N={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:[]},z={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,company: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:[]},M={drawer:{isOpen:![],contentConfig:null}},R={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},B={products:{},cart:N,address:R,checkout:z,ui:M};class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async getAllConfigs(){var t;try{this.ensureClientInitialized();const t=await this.client.get("/configs");if(!this.validResponseData(t))throw this.logger.error(t),new Error("Failed to fetch all configs: Invalid response data");return t.data}catch(e){throw this.logger.error("Error fetching configs:",null!==(t=null==e?void 0:e.message)&&void 0!==t?t:e),e}}async setPersistedStore(t,e){var n;try{this.ensureClientInitialized();const n=await this.client.post("/configs/store/"+t,e);200!==n.statusCode&&this.logger.error("Failed to set persisted store:",n)}catch(i){this.logger.error("Error setting persisted store:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i)}}async getPersistedStore(t){var e;try{this.ensureClientInitialized();const e=await this.client.get("/configs/store/"+t);return 200!==e.statusCode?(this.logger.error("Failed to fetch persisted store:",e),null):e.data}catch(n){return this.logger.error("Error fetching persisted store:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),null}}async getProductsData(t,e){var n;try{this.ensureClientInitialized();const n={upcs:t,ids:t,grouping:t,shouldShowOffHours:!![],isLegacy:!![],loc:e},i=await this.client.post("/cloud/catalog/availability",n);return 200===i.statusCode&&i.products&&0!==i.products.length?{products:i.products,retailers:i.retailers}:(this.logger.error(i),null)}catch(i){return this.logger.error("Error fetching product data:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),null}}async getCartData(t){var e;try{this.ensureClientInitialized();const e=await this.client.get("/cloud/cart"+(t?"?id="+t:""));if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to fetch cart data: "+e.message);return e.cart}catch(n){throw this.logger.error("Error fetching cart data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async updateCart(t){var e;try{this.ensureClientInitialized();const e=await this.client.put("/cloud/cart",t);if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to update cart: "+e.message);return e.cart}catch(n){throw this.logger.error("Error updating cart:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async getAddressSuggestions(t){var e;try{this.ensureClientInitialized();const e=await this.client.get("/cloud/address/autocomplete?input="+t);if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to fetch address suggestions: "+e.message);return e.data}catch(n){throw this.logger.error("Error fetching address suggestions:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async getAddressDetails(t){var e;try{this.ensureClientInitialized();const e=await this.client.get("/cloud/address/details/"+t);if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to fetch address details: "+e.message);return e.data}catch(n){throw this.logger.error("Error fetching address details:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async prepareCheckout(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/checkout/prepare",t);if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to fetch prepare checkout data: "+e.message);return e.checkout}catch(n){throw this.logger.error("Error fetching prepare checkout data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async getPaymentSession(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/payment/session",t);if(201!==e.statusCode)throw this.logger.error(e),new Error("Failed to get payment session: "+e.message);return e.data}catch(n){throw this.logger.error("Error fetching payment session:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async confirmPaymentSession(t,e){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/payment/confirm",{confirmationTokenId:t,setupIntentId:e});if(200!==n.statusCode)throw this.logger.error(n),new Error("Failed to confirm payment session: "+n.message);return n.data}catch(i){throw this.logger.error("Error confirming payment session:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),i}}async checkoutComplete(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/checkout/complete",t);if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to complete checkout: "+e.message);return e.order}catch(n){if(this.logger.error("Error completing checkout:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),null==n?void 0:n.error)throw new Error(n.error);throw n}}validResponseData(t){return t.data&&"object"==typeof t.data&&Object.keys(t.data).length>0}ensureClientInitialized(){if(!this.client)throw new Error("API client is not initialized")}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:e,next:n})=>{const i=performance.now();this.logger.group("🏪 Store "+t+" ---------------------------------"),this.logger.debug("Payload:",e);try{const t=n(),e=performance.now()-i;return this.logger.debug("Completed in "+e.toFixed(3)+"ms"),t}catch(o){throw this.logger.error("Error:",o),o}finally{this.logger.groupEnd()}},this.performanceMiddleware=({action:t,next:e})=>{const n=performance.now(),i=e(),o=performance.now()-n;return o>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+o.toFixed(2)+"ms"),i},this.state=B,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable:e,persistedStore:n}){this.localStorageKey=A+"_"+t,this.isLocalStorageAvailable=e,e?await this.loadPersistedState():n&&await this.loadFromDBPersistence(n),this.addBeforeUnloadHandler(),this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:e,hasPersistedState:null!==n,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const e=t.split(".");let n=this.state;for(const i of e){if(null==n)return;n=n[i]}return void 0!==n?Array.isArray(n)?[...n]:"object"==typeof n&&null!==n?{...n}:n:void 0}set(t,e){return this.runWithMiddleware("set",{path:t,value:e},()=>{const n=this.get(t);return this.state=this.immutableSet(this.state,t,e),this.notifyListeners(t,e,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,e){const n=this.get(t),i=e(n);return this.set(t,i)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const e=this.get(t);if(void 0===e)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const n=t.split(".");let i=this.state;const o=n.pop();for(const r of n){if(void 0===i[r])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];i=i[r]}if(Array.isArray(i))i=i.filter((t,e)=>e!==Number.parseInt(o,10));else{if("object"!=typeof i||null===i)return this.logger.warn('Cannot remove property "'+o+'" from non-object type at path "'+t+'".'),![];{const{[o]:t,...e}=i;i=e}}return this.state=this.immutableSet(this.state,n.join("."),i),this.notifyListeners(t,void 0,e),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const e=[];if("function"==typeof t){const n=t(this.state);for(const[t,i]of Object.entries(n)){const n=this.get(t);e.push({path:t,oldValue:n,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,i)}}else for(const[n,i]of Object.entries(t)){const t=this.get(n);e.push({path:n,oldValue:t,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,i)}for(const{path:t,oldValue:n,newValue:i}of e)this.notifyListeners(t,i,n);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,e){const n=t;return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),()=>{var t;null===(t=this.listeners.get(n))||void 0===t?void 0:t.delete(e)}}watchMany(t,e){const n=[];let i;const o=t.map(t=>this.watch(t,(o,r)=>{n.push({path:t,value:o,oldValue:r}),clearTimeout(i),i=setTimeout(()=>{n.length>0&&(e([...n]),n.length=0)},0)}));return()=>{for(const t of o)t()}}createProductInstance(t){const e="products."+t,n=this.get(e);return n?!![]:this.set(e,_)}removeProductInstance(t){const e=this.get("products"),{[t]:n,...i}=e;return this.set("products",i)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(t,e,n){let i=0;const d=()=>{if(i>=this.middleware.length)return n();const o=this.middleware[i++];return o({action:t,payload:e,state:this.getState(),next:d})};return d()}immutableSet(t,e,n){const i=e.split(".");if(1===i.length){if(Array.isArray(t)){const e=[...t];return e[i[0]]=n,e}return{...t,[i[0]]:n}}const[o,...r]=i,s=t[o],a=Array.isArray(s)?[]:{};if(Array.isArray(t)){const e=[...t];return e[o]=this.immutableSet(s||a,r.join("."),n),e}return{...t,[o]:this.immutableSet(s||a,r.join("."),n)}}notifyListeners(t,e,n){const i=this.listeners.get(t);if(i)for(const a of i)try{a(e,n)}catch(r){this.logger.error('Error in store listener for path "'+t+'":',r)}const o=t.split(".");for(let a=o.length-1;a>0;a--){const t=o.slice(0,a).join("."),e=this.listeners.get(t);if(e){const i=this.get(t),r=o.slice(a).join("."),c=this.immutableSet(i,r,n);for(const n of e)try{n(i,c)}catch(s){this.logger.error('Error in store listener for parent path "'+t+'":',s)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const e=this.get("address.id")||"",n=this.get("cart.id")||"";t=e+"_"+n}else t=this.getState();t&&localStorage.setItem(this.localStorageKey,"string"!=typeof t?JSON.stringify(t):t)}catch(t){this.logger.warn("Failed to persist store state:",t)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const e=localStorage.getItem(this.localStorageKey);if(!e)return;try{const t=JSON.parse(e);for(const[e,n]of Object.entries(t))this.set(e,n);return}catch(t){if(e.includes("_")){const[t,n]=e.split("_");if(void 0!==t){const e=await this.getAddressDataFromId(t);this.set("address",e)}return void 0!==n&&this.set("cart.id",n||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:e})}}catch(e){this.logger.warn("Failed to load persisted state:",e),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{t.p&&(this.state.address=await this.getAddressDataFromId(t.p)),t.c&&(this.state.cart.id=t.c),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(e){this.logger.error("Failed to load session data from DB persistence",e)}}addBeforeUnloadHandler(){window.addEventListener("beforeunload",()=>{this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())})}async getAddressDataFromId(t){if(!t||""===t.trim())return R;try{const e=await this.api.getAddressDetails(t);return e&&0!==Object.keys(e).length?{id:t,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},coordinates:{lat:e.coords.lat,long:e.coords.long}}:{...R,id:t}}catch(e){return{...R,id:t}}}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}const includeCartEvents=(t,e)=>t.filter(t=>e.includes(t.type)),excludeCartEvents=(t,e)=>t.filter(t=>!e.includes(t.type)),eventsForCart=t=>excludeCartEvents(t,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet"]),hasCartAnyPromoCodeEvents=t=>{const e=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],n=includeCartEvents(t,e);return n.length>0},includeCheckoutEvents=(t,e)=>t.filter(t=>e.includes(t.type)),eventsForCheckout=t=>includeCheckoutEvents(t,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=t=>includeCheckoutEvents(t,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=t=>includeCheckoutEvents(t,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=t=>{const e=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return t.some(t=>e.includes(t.type))},L={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"},j={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:L[t.type]||"error"})),transformCheckoutEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:j[t.type]||"error"})),transformEventsForCart=t=>{const e=eventsForCart(t);return transformCartEventsRaw(e)},transformEventsForCheckout=t=>{const e=eventsForCheckout(t);return transformCheckoutEventsRaw(e)},transformPromoCodeCheckoutEvents=t=>{const e=promoCodeCheckoutEvents(t);return transformCheckoutEventsRaw(e)},transformGiftCardCheckoutEvents=t=>{const e=giftCardCheckoutEvents(t);return transformCheckoutEventsRaw(e)};function buildCartItemStore(t){return{id:t.id,variantId:t.variantId,liquidId:t.liquidId,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,salsifyGrouping:t.salsifyGrouping,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price,quantity:t.quantity,maxQuantity:t.maxQuantity,unitPrice:t.unitPrice,mainImage:t.mainImage,attributes:t.attributes,loading:![],updating:![],error:null}}function buildCartTotals(t){return{subtotal:t.subtotal||0,total:t.total||0,shippingFee:t.shippingFee||0,platformFee:t.platformFee||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,discounts:t.discounts||0,quantity:t.quantity||0}}function buildRetailerStore(t){var e;return{id:t.id,name:t.name,platformFee:t.platformFee||0,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,address:t.address,total:t.total||0,deliveryFee:t.deliveryFee||0,engravingFee:t.engravingFee||0,fulfillments:(null===(e=t.fulfillments)||void 0===e?void 0:e.map(t=>t.id))||[]}}function buildFulfillmentStore(t,e){return{id:t.id,canEngrave:t.canEngrave||![],type:t.type,fees:t.fees,expectation:t.expectation,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,items:t.items||[],retailerId:e.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(t,e){var n;const i=e.formattedAddress?e:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},o={};for(const r in t.items||{}){const e=t.items[r];o[r]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,salsifyGrouping:e.salsifyGrouping,catPath:e.catPath,volume:e.volume,uom:e.uom,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,name:e.name,brand:e.brand,size:e.size,price:e.price||0,quantity:e.quantity||0,maxQuantity:e.maxQuantity||0,unitPrice:e.unitPrice||0,mainImage:e.mainImage||"",attributes:e.attributes||{}}}return{id:t.id,promoCode:(null===(n=t.promoCode)||void 0===n?void 0:n.code)||"",items:o,location:{placesId:i.id,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:{latitude:i.coordinates.lat,longitude:i.coordinates.long}},amounts:{deliveryFee:t.totals.deliveryFee,discounts:t.totals.discounts,engravingFee:t.totals.engravingFee,giftCardTotal:0,platformFee:t.totals.platformFee,shippingFee:t.totals.shippingFee,subtotal:t.totals.subtotal,total:t.totals.total},updatedAt:t.updatedAt,createdAt:t.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}async loadCart(){var t,n,i,o,r,s,a;try{this.store.set("cart.loading",!![]);const c=this.store.get("cart"),l=await this.api.getCartData(c.id);for(const t of Object.keys(c.items))this.store.remove("cart.items."+t);for(const t of Object.keys(c.retailers))this.store.remove("cart.retailers."+t);for(const t of Object.keys(c.fulfillments))this.store.remove("cart.fulfillments."+t);const h={"cart.id":l.id,"cart.error":null,"cart.totals":buildCartTotals(l),"cart.updatedAt":l.updatedAt||(new Date).toISOString(),"cart.createdAt":l.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":{code:(null===(i=null===(n=null===(t=l.attributes)||void 0===t?void 0:t.promoCode)||void 0===n?void 0:n.value)||void 0===i?void 0:i.toUpperCase())||null,discountAmount:l.attributes.promoCode.discount||0,error:null}};if((null===(o=l.items)||void 0===o?void 0:o.length)>0)for(const t of l.items)h["cart.items."+t.id]=buildCartItemStore(t);if((null===(r=l.retailers)||void 0===r?void 0:r.length)>0)for(const t of l.retailers)if(h["cart.retailers."+t.id]=buildRetailerStore(t),(null===(s=t.fulfillments)||void 0===s?void 0:s.length)>0)for(const e of t.fulfillments)h["cart.fulfillments."+e.id]=buildFulfillmentStore(e,t);l.id!==c.id&&await this.persistSessionData(l.id),(null===(a=l.events)||void 0===a?void 0:a.length)>0&&(h["cart.events"]=transformEventsForCart(l.events||[])),this.store.batch(h);const u=this.store.get("cart"),p=this.store.get("address");this.pubSub.publishAction(e.CART_LOADED,cartDataForEventFromStore(u,p))}catch(c){throw this.store.set("cart.error",(null==c?void 0:c.message)||"Failed to load cart"),c}finally{this.store.set("cart.loading",![])}}async persistSessionData(t){var e;const n=this.store.get("address.id")||"";if(this.clientConfig.isLocalStorageAvailable())this.store.forceSave(),this.logger.info("Cart ID changed, triggering localStorage save",{newCartId:t});else try{const i=null!==(e=this.clientConfig.get("userDeviceId"))&&void 0!==e?e:"";await this.api.setPersistedStore(i,{p:n,c:t}),this.logger.info("Cart ID changed, persisted to DB",{userDeviceId:i,newCartId:t})}catch(i){this.logger.error("Failed to persist cart ID to DB",{error:(null==i?void 0:i.message)||i})}}}const q="lce-checkout-stripe-slot",G={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},U={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",company:"company",message:"message"},V={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};function centToDollar(t){return t/100}function formatCentToDollarText(t,e=!![]){const n=Math.floor(t/100),i=t%100;let o="$"+n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(e||i>0)&&(o+=".",o+=i<10?"0"+i:i.toString()),o}function htmlStringToElement(t){const e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstElementChild}function format24TimeTo12$1(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new Error("Invalid time format: "+t);const n=Number.parseInt(e[1],10),i=Number.parseInt(e[2],10);if(n<0||n>23||i<0||i>59)throw new Error("Invalid time values: "+t);const o=n>=12?"PM":"AM",r=n%12||12;return r+":"+i.toString().padStart(2,"0")+" "+o}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const e=new Date(t);if(Number.isNaN(e.getTime()))return"";const n=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),o=e.getFullYear().toString();return n+"/"+i+"/"+o}catch(e){return""}}function validateMinimumAge(t,e=21,n=1930){if(!t)return{isValid:![],age:null,error:"Birth date is required"};try{const i=t instanceof Date?t:new Date(t);if(Number.isNaN(i.getTime()))return{isValid:![],age:null,error:"Invalid date format"};const o=new Date;if(i>o)return{isValid:![],age:null,error:"Birth date cannot be in the future"};const r=i.getFullYear();if(r<n)return{isValid:![],age:null,error:"Birth year cannot be before "+n+". Please check your birth date."};const s=calculateAge(i,o);return s<e?{isValid:![],age:s,error:"Must be at least "+e+" years old"}:{isValid:!![],age:s}}catch(i){return{isValid:![],age:null,error:"Error processing birth date"}}}function calculateAge(t,e){let n=e.getFullYear()-t.getFullYear();const i=e.getMonth()-t.getMonth();return(i<0||0===i&&e.getDate()<t.getDate())&&n--,Math.max(0,n)}function buildFormattedAddressString(t){const e=[],n=[];t.one&&t.one.trim()&&n.push(t.one.trim()),t.two&&t.two.trim()&&n.push(t.two.trim()),n.length>0&&e.push(n.join(" ")),t.city&&t.city.trim()&&e.push(t.city.trim());const i=[];return t.state&&t.state.trim()&&i.push(t.state.trim()),t.zip&&t.zip.trim()&&i.push(t.zip.trim()),i.length>0&&e.push(i.join(" ")),t.country&&t.country.trim()&&e.push(t.country.trim()),e.join(", ")}function splitCategoryPath(t){const e=(null==t?void 0:t.split(" > "))||[];return{category:e[0]||"",category2:e[1]||"",category3:e[2]||""}}function validateCustomerInfo(t){const e=[G.firstName,G.lastName,G.email,G.phone,G.birthDate];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const i of e){const e=t[i];if(!e||"string"==typeof e&&""===e.trim())n.push(i);else if("birthDate"===i){const t=validateMinimumAge(e,21,1930);t.isValid||n.push(i)}}return{isValid:0===n.length,invalidFields:n}}function validateGiftRecipientInfo(t){const e=[U.firstName,U.lastName,U.email,U.phone,U.message];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const i of e){const e=t[i];(!e||"string"==typeof e&&""===e.trim())&&n.push(i)}return{isValid:0===n.length,invalidFields:n}}function validateBillingInfo(t){const e=[V.firstName,V.lastName,V.email,V.phone,V.addressOne,V.city,V.state,V.zipCode];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const i of e){const e=t[i];(!e||"string"==typeof e&&""===e.trim())&&n.push(i)}return{isValid:0===n.length,invalidFields:n}}const H=[i.ADDRESS,i.ADDRESS_INPUT,i.ADDRESS_DISPLAY,i.PRODUCT,i.CART,i.CHECKOUT],W=[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL,i.PRODUCT_OPTIONS,i.PRODUCT_INTERACTIONS,i.PRODUCT_DESCRIPTION,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST,i.PRODUCT_PRICE,i.PRODUCT_ADD_TO_CART_SECTION,i.PRODUCT_DRAWER,i.PRODUCT_LOADING,i.ENGRAVING_FORM,i.ENGRAVING_VIEW],Q=[i.ADDRESS_INPUT,i.ADDRESS_DISPLAY],Z=[i.CART,i.CART_RETAILER,i.CART_ITEM,i.CART_FOOTER,i.CART_ITEM_QUANTITY_PRICE,i.CART_RETAILER_SUBTOTAL,i.CART_PROMO_CODE,i.CART_HEADER,i.CART_BODY,i.CART_FULFILLMENT,i.BUTTONS_CART_OPEN],X=[i.CHECKOUT,i.CHECKOUT_INFORMATION_SECTION,i.CHECKOUT_STRIPE_FORM,i.CHECKOUT_PAYMENT_FORM,i.CHECKOUT_BILLING_FORM,i.CHECKOUT_SUMMARY_SECTION,i.CHECKOUT_PROMO_CODE,i.CHECKOUT_GIFT_CARDS,i.CHECKOUT_AMOUNTS,i.CHECKOUT_ITEMS,i.CHECKOUT_COMPLETED,i.CHECKOUT_DELIVERY_INFORMATION_FORM,i.CHECKOUT_BUYER_INFORMATION_FORM,i.CHECKOUT_TIPS,i.CHECKOUT_PC_GC,i.CHECKOUT_ITEM,i.CHECKOUT_ITEM_QUANTITY,i.CHECKOUT_PLACE_ORDER_BUTTON,i.CHECKOUT_HEADER,i.CHECKOUT_PRESALE_COUNTDOWN],isMainComponent=t=>-1!==H.indexOf(t);class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}]}loadGoogleFonts(t,e="swap"){if(!t||0===t.length)return;const n=[...this.defaultFontFamilies,...t],i=n.map(t=>{const e=encodeURIComponent(t.name);return"family="+e+":wght@"+t.weights.join(";")}).join("&"),o="display="+e;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+i+"&"+o,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,e="swap"){const n=document.querySelector("link[data-liquid-fonts]");this.loadGoogleFonts(t,e),n&&n.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),e=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!t){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",t.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(t)}if(!e){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="",t.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(t)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const t=document.createElement("link");t.rel="stylesheet",t.href=this.googleFontsUrl,t.setAttribute("data-liquid-fonts",""),document.head.appendChild(t)}}const getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n padding-bottom: 8px;\n }\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: "+s.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: "+s.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: "+s.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: "+s.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 line-height: 100%;\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 .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: "+s.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: "+s.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: "+s.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: "+s.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: "+s.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-two-col-container > .custom-input {\n min-width: 200px;\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: "+s.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-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-logo {\n color: var(--icon-color, var(--primary-color, #E4E4E7));\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: 4px;\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: '+s.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: "+s.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 font-style: normal;\n font-weight: 400;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 8px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form-container {\n display: flex;\n width: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .engraving-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n }\n\n .engraving-form-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 margin-bottom: 8px;\n }\n\n .engraving-form-location {\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: 24px;\n }\n\n .engraving-form-header > :not(.engraving-form-location) {\n margin-bottom: 0;\n }\n\n .engraving-form-lines {\n display: flex;\n width: 100%;\n height: auto;\n flex-direction: column;\n align-items: center;\n }\n\n .engraving-form-lines .engraving-form-input-container:not(:last-child) {\n margin-bottom: 16px;\n }\n\n .engraving-form-input-container {\n display: flex;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--border-radius-md, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .engraving-form-input-container .engraving-form-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(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-form-input-container .engraving-form-input-char-count {\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: 400;\n line-height: 20px;\n margin-left: 4px;\n }\n\n .engraving-form-actions {\n display: flex;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-form-actions > button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: none;\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 cursor: pointer;\n }\n\n .engraving-form-actions > button:first-child {\n margin-right: 8px;\n }\n\n .engraving-form-actions .engraving-form-button-cancel {\n color: var(--primary-color, #1D4ED8);\n }\n\n .engraving-form-actions .engraving-form-button-save {\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 flex: 1 0 0;\n }\n\n .engraving-form-actions .engraving-form-button-save.disabled {\n opacity: 0.5;\n }\n\n .engraving-form-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n }\n\n .engraving-form-disclaimer > span {\n color: var(--default-text-color, #18181B);\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 /** 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: "+s.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.has-header {\n width: 100%;\n padding: 16px;\n }\n\n .price-personalization-container > .main-product-price + .engraving-view-container.has-header {\n margin-top: 24px;\n }\n\n .engraving-view-container.outlined.has-header {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled.has-header {\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.has-header .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-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 .engraving-view-container.product .add-engraving-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n height: 36px;\n cursor: pointer;\n\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n background: transparent;\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\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 .engraving-view-container:not(.product) .add-engraving-button {\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 }\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',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: "+s.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 /** 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: "+s.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: "+s.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 /* 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: "+s.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: "+s.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: "+s.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: "+s.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 $={"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"},J={backgroundColor:"--product-background-color"},tt={backgroundColor:"--cart-background-color"},et={backgroundColor:"--address-background-color"},nt={backgroundColor:"--checkout-background-color"},it={global:$,product:J,cart:tt,address:et,checkout:nt};function getCSSVariableMapping(t){return it[t]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(t,e){const n={},i=getCSSVariableMapping(e);for(const[o,r]of Object.entries(i)){const e=this.getValueByPath(t,o);void 0!==e&&this.isCSSValue(e)&&(n[r]=e,this.isColorVariable(r,e)&&this.generateOpacityVariants(n,r,e))}return n}extractVariablesFromPartialTheme(t,e){const n={},i=getCSSVariableMapping(e);for(const[o,r]of Object.entries(i))if(this.hasValueAtPath(t,o)){const e=this.getValueByPath(t,o);void 0!==e&&this.isCSSValue(e)&&(n[r]=e,this.isColorVariable(r,e)&&this.generateOpacityVariants(n,r,e))}return n}generateCSSVariablesString(t){return Object.entries(t).map(([t,e])=>" "+t+": "+e+";").join("\n")}updateCSSVariablesInStylesheet(t,e){if(0!==Object.keys(e).length)try{const n=this.findOrCreateRule(t);for(const[t,i]of Object.entries(e))n.style.setProperty(t,String(i))}catch(n){this.logger.warn("Failed to update CSS variables:",n)}}getValueByPath(t,e){return e.split(".").reduce((t,e)=>t&&void 0!==t[e]?t[e]:void 0,t)}hasValueAtPath(t,e){const n=e.split(".");let i=t;for(const o of n){if(null==i||!(o in i))return![];i=i[o]}return!![]}findOrCreateRule(t){const e=":host";for(const i of Array.from(t.cssRules))if(i instanceof CSSStyleRule&&i.selectorText===e)return i;const n=t.insertRule(e+" {}");return t.cssRules[n]}isCSSValue(t){if("string"==typeof t){if(""===t.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(t.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(t))return!![];if(/^[a-z-]+$/.test(t))return!![]}return"number"==typeof t}generateOpacityVariants(t,e,n){for(const i of this.opacityLevels){const o=e+"-"+i.suffix,r=this.addOpacityToHexColor(n,i.value);r&&(t[o]=r)}}isColorVariable(t,e){if("string"!=typeof e)return![];const n=t.toLowerCase().includes("color"),i=/^#[0-9a-f]{3,8}$/i.test(e);return n&&i}addOpacityToHexColor(t,e){if(!t.startsWith("#"))return null;let n=t.slice(1);if(3===n.length&&(n=n.split("").map(t=>t+t).join("")),6!==n.length)return null;const i=Math.round(255*e),o=i.toString(16).padStart(2,"0");return"#"+n+o}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,e){const n=this.cssProcessor.extractVariablesFromTheme(e,t),i=this.cssProcessor.generateCSSVariablesString(n),o=this.getStylesheetStyles(t).join("\n\n"),r=0===i.length?"":":host { "+i+" }",s=("\n "+r+"\n\n "+o+"\n ").trim();this.createStylesheet(t,s)}createStylesheet(t,e){try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(e),this.styleSheets.set(t,n)}else this.styleSheets.set(t,e)}catch(D){this.styleSheets.set(t,e)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}updateVariablesInStylesheet(t,e,n){const i=this.styleSheets.get(t);if(i&&"string"!=typeof i){const t=this.cssProcessor.extractVariablesFromPartialTheme(e,n);this.cssProcessor.updateCSSVariablesInStylesheet(i,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme)}updateComponentGlobalConfigs(t){var e,n;this.data.global=this.deepMerge(this.getConfigs("global"),t),((null===(e=t.theme)||void 0===e?void 0:e.headingFont)||(null===(n=t.theme)||void 0===n?void 0:n.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==W.indexOf(t)?this.getConfigs("product"):-1!==Q.indexOf(t)?this.getConfigs("address"):-1!==Z.indexOf(t)?this.getConfigs("cart"):-1!==X.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===i.DRAWER){const t=[...e],n=this.stylesheetGenerator.getStylesheet("product"),i=this.stylesheetGenerator.getStylesheet("cart"),o=this.stylesheetGenerator.getStylesheet("checkout"),r=this.stylesheetGenerator.getStylesheet("address");return n&&t.push(n),i&&t.push(i),o&&t.push(o),r&&t.push(r),t}if(!isMainComponent(t))return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;let n;if(t===i.ADDRESS||t===i.ADDRESS_INPUT||t===i.ADDRESS_DISPLAY)n="address";else if(t===i.PRODUCT)n="product";else if(t===i.CART)n="cart";else{if(t!==i.CHECKOUT)return this.logger.warn("Unknown main component type: "+t+", returning base stylesheets only."),e;n="checkout"}const o=this.stylesheetGenerator.getStylesheet(n);return o?[...e,o]:e}getBaseStylesheets(){const t=[],e=this.stylesheetGenerator.getStylesheet("global"),n=this.stylesheetGenerator.getStylesheet("ui");return e&&t.push(e),n&&t.push(n),t}deepMerge(t,e){const n={...t};for(const i in e)null!==e[i]&&void 0!==e[i]&&("object"!=typeof e[i]||Array.isArray(e[i])||"object"!=typeof t[i]||Array.isArray(t[i])?n[i]=e[i]:n[i]=this.deepMerge(t[i],e[i]));return n}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,n){const o={type:t,data:n||{}};if(this.store.set("ui.drawer",{isOpen:!![],contentConfig:o}),t===i.CART){this.pubSub.publishAction(e.CART_OPENED,!![]);const t=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(t.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}t===i.CHECKOUT&&this.pubSub.publishAction(e.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===i.CART&&this.pubSub.publishAction(e.CART_CLOSED,!![]),(null==t?void 0:t.type)===i.CHECKOUT&&this.pubSub.publishAction(e.CHECKOUT_CLOSED,!![])}}function buildCheckoutItemStore(t,e,n){return{liquidId:t.liquidId,variantId:t.variantId,cartItemId:t.cartItemId,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes,retailerName:e.name,expectationDetail:n.expectation.detail,loading:![],updating:![],error:null}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(t){var n,i,r;try{this.store.set("checkout.loading",!![]);const s=t||this.store.get("cart.id"),a=this.store.get("cart");if(0===(null===(n=Object.values(a.items))||void 0===n?void 0:n.length)&&!t)return;const c=this.themeProvider.getConfigs("checkout"),l={canEmail:c.layout.emailOptIn.checked,canSms:c.layout.smsOptIn.checked};if(!s)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:""}},u=await this.api.prepareCheckout({cartId:s,marketingPreferences:l});if((null===(i=u.retailers)||void 0===i?void 0:i.length)>0)for(const t of u.retailers)for(const e of t.fulfillments)e.type===o.ON_DEMAND&&(h["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});if((null===(r=u.items)||void 0===r?void 0:r.length)>0){this.store.remove("checkout.items");for(const t of u.items){const e=u.retailers.find(e=>e.id===t.retailerId),n=e.fulfillments.find(e=>e.id===t.fulfillmentId);h["checkout.items."+t.cartItemId]=buildCheckoutItemStore(t,e,n)}}u.isPresaleLocked&&u.presaleExpiresAt&&(h["checkout.isPresaleLocked"]=u.isPresaleLocked,h["checkout.presaleExpiresAt"]=u.presaleExpiresAt),h["checkout.token"]=u.token,h["checkout.cartId"]=u.cartId,h["checkout.customer"]=u.customer,h["checkout.acceptedAccountCreation"]=u.acceptedAccountCreation,h["checkout.billingSameAsShipping"]=u.billingSameAsShipping,h["checkout.hasAgeVerify"]=u.hasAgeVerify,h["checkout.hasSubstitutionPolicy"]=u.hasSubstitutionPolicy,h["checkout.isGift"]=u.isGift,h["checkout.marketingPreferences"]=u.marketingPreferences,h["checkout.giftCards"]=u.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),h["checkout.promoCode"]=u.promoCode.value?{code:u.promoCode.value,discountAmount:u.promoCode.discount}:null,h["checkout.marketingPreferences.canEmail"]=u.marketingPreferences.canEmail,h["checkout.marketingPreferences.canSms"]=u.marketingPreferences.canSms,h["checkout.amounts"]=u.amounts,h["checkout.error"]=null,h["checkout.updating"]=![],h["checkout.events"]=u.events||[],this.store.batch(h),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_LOADED,{cartId:u.cartId})}catch(s){throw this.store.set("checkout.error",s.message),this.pubSub.publishAction(e.CHECKOUT_FAILED,{message:s.message}),s}finally{this.store.set("checkout.loading",![])}}async partialLoadCheckout(t){var n,i,r,s,a;try{let e;if(this.store.set("checkout.updating",!![]),await this.commonCommands.loadCart(),null==t?void 0:t.response)e=t.response;else{const i=null!==(n=null==t?void 0:t.cartId)&&void 0!==n?n:this.store.get("checkout.cartId");if(!i)return this.store.set("checkout.error","Cart ID is not provided"),void 0;e=await this.api.prepareCheckout({cartId:i})}const c={"checkout.token":e.token,"checkout.events":transformEventsForCheckout(e.events||[]),"checkout.amounts":e.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCards":e.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),"checkout.promoCode":(null===(r=null===(i=null==e?void 0:e.promoCode)||void 0===i?void 0:i.value)||void 0===r?void 0:r.trim())?{code:e.promoCode.value,discountAmount:e.promoCode.discount}:null};if((null===(s=e.retailers)||void 0===s?void 0:s.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const t of e.retailers)for(const e of t.fulfillments)e.type===o.ON_DEMAND&&(c["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal})}if((null===(a=e.items)||void 0===a?void 0:a.length)>0){this.store.remove("checkout.items");for(const t of e.items){const n=e.retailers.find(e=>e.id===t.retailerId),i=n.fulfillments.find(e=>e.id===t.fulfillmentId);c["checkout.items."+t.cartItemId]=buildCheckoutItemStore(t,n,i)}}this.store.batch(c),this.validateAndUpdateFormStatus()}catch(c){const t=(null==c?void 0:c.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(e.CHECKOUT_FAILED,{message:t}),c}finally{this.store.set("checkout.updating",![])}}async toggleIsGift(t){const n=this.store.get("checkout.isGift"),i=null!=t?t:!n;this.store.batch({"checkout.isGift":i,"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,email:"",firstName:"",lastName:"",message:null,phone:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_IS_GIFT_TOGGLED,{isActive:i})}async toggleBillingSameAsShipping(t){const n=this.store.get("checkout.billingSameAsShipping"),i=null!=t?t:!n;this.store.batch({"checkout.billingSameAsShipping":i,"checkout.billing":{firstName:"",lastName:"",email:"",phone:"",addressOne:"",addressTwo:"",city:"",state:"",zipCode:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:i})}toggleMarketingPreferences(t,n){const i=this.store.get("checkout.marketingPreferences."+t),o=null!=n?n:!i;this.store.set("checkout.marketingPreferences."+t,o),this.pubSub.publishAction(e.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:t,isActive:o})}async getPaymentSession(){try{const t=this.store.get("cart.id"),e=await this.api.getPaymentSession({cartId:t});this.store.set("checkout.payment",{key:e.key,secret:e.secret,paymentMethodId:null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){try{const n=await this.api.confirmPaymentSession(t,e);this.store.batch({"checkout.payment.paymentMethodId":n.id,"checkout.readyForSubmit.payment":!![],"checkout.card":{...n.card}})}catch(n){throw new Error("Failed to confirm payment session. Please try again.")}}async applyPromoCode(t){var e;try{const n=this.dataForCheckoutPrepare(),i=await this.api.prepareCheckout({...n,promoCode:t}),o=0!==i.amounts.discounts,r=null===(e=transformPromoCodeCheckoutEvents(i.events||[]))||void 0===e?void 0:e[0];if(!o)return this.store.set("checkout.promoCodeError",r?r.message:'Code "'+t+'" does not exist'),void 0;await this.partialLoadCheckout({response:i})}catch(n){const t=(null==n?void 0:n.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",t),n}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(D){const e=D.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),D}}async removePromoCode(){try{const t=this.dataForCheckoutPrepare(),e=await this.api.prepareCheckout({...t,promoCode:""});if(0!==e.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;await this.partialLoadCheckout({response:e})}catch(t){throw this.store.set("checkout.error",(null==t?void 0:t.message)||"Failed to remove promo code. Please try again."),t}}async applyGiftCard(t=""){var e;try{const n=this.dataForCheckoutPrepare(),i=n.giftCards||[],o=await this.api.prepareCheckout({...n,giftCards:[...i,t]}),r=null===(e=transformGiftCardCheckoutEvents(o.events||[]))||void 0===e?void 0:e[0],s=hasAnyRetailerGiftCardRestriction(o.events||[]);if(r){if(!s)return this.store.set("checkout.giftCardError",r.message),void 0;this.store.set("checkout.giftCardError",r.message)}const a=o.giftCards.find(e=>e.code===t);if(!a)return this.store.set("checkout.giftCardError","Gift card could not be applied"),void 0;await this.partialLoadCheckout({response:o})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to apply gift card. Please try again."),n}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(D){throw this.store.set("checkout.error",(null==D?void 0:D.message)||"Failed to clear gift card error. Please try again."),D}}async removeGiftCard(t){var e;try{const n=this.dataForCheckoutPrepare(),i=(null===(e=n.giftCards)||void 0===e?void 0:e.filter(e=>e!==t))||[],o=await this.api.prepareCheckout({...n,giftCards:i}),r=o.giftCards.find(e=>e.code===t);if(r)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+t),void 0;await this.partialLoadCheckout({response:o})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to remove gift card. Please try again."),n}}updateCustomerInfo(t,n){try{this.store.set("checkout.customer."+t,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{fieldName:t})}catch(i){throw this.store.set("checkout.error",i.message),i}}updateBillingInfo(t,n){try{this.store.set("checkout.billing."+t,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_BILLING_INFORMATION_UPDATED,{fieldName:t})}catch(i){throw this.store.set("checkout.error",i.message),i}}updateGiftInfo(t,n){try{this.store.set("checkout.giftRecipient."+t,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_GIFT_INFORMATION_UPDATED,{fieldName:t})}catch(i){throw this.store.set("checkout.error",i.message),i}}triggerAddShippingInfoEvent(){var t,e,n;const i=this.store.get("checkout");if(i.customer.email||i.customer.phone){const o=(null===(t=null==i?void 0:i.customer)||void 0===t?void 0:t.id)||(null===(e=null==i?void 0:i.customer)||void 0===e?void 0:e.email);this.googleTagManager.addShippingInfoWithCustomerData(centToDollar(i.amounts.total),null===(n=i.promoCode)||void 0===n?void 0:n.code,{phone:i.customer.phone,email:i.customer.email,birth_date:i.customer.birthDate,customer_id:o})}}validateAndUpdateFormStatus(){const t=this.store.get("checkout"),e=validateCustomerInfo(t.customer),n=t.isGift?validateGiftRecipientInfo(t.giftRecipient):{isValid:!![],invalidFields:[]},i=t.billingSameAsShipping?{isValid:!![],invalidFields:[]}:validateBillingInfo(t.billing),o=e.isValid&&n.isValid&&i.isValid,r=[...e.invalidFields.map(t=>"customer."+t),...n.invalidFields.map(t=>"giftRecipient."+t),...i.invalidFields.map(t=>"billing."+t)];this.store.batch({"checkout.isFormValid":o,"checkout.invalidFields":r,"checkout.readyForSubmit.customer":e.isValid,"checkout.readyForSubmit.gift":n.isValid,"checkout.readyForSubmit.billing":i.isValid})}async checkoutComplete(){var t;try{const n=this.store.get("checkout"),o=this.store.get("checkout.payment.paymentMethodId");if(!n.token||!o)return;const r=await this.api.checkoutComplete({token:n.token,payment:o}),s=r.legacyOrderNumber||r.referenceId||"N/A";n.isPresaleLocked||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(i.CHECKOUT_COMPLETED,{orderNumber:s,orderTotal:n.amounts.total,cardLast4:n.card.last4,customerEmail:n.customer.email,giftRecipientEmail:(null===(t=n.giftRecipient)||void 0===t?void 0:t.email)||null}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:s,orderTotal:n.amounts.total}),this.googleTagManager.purchase({transaction_id:s,tax:centToDollar(n.amounts.tax||0),shipping:centToDollar(n.amounts.shipping||0),items:[...Object.values(n.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(n.amounts.total)})}catch(n){const t=(null==n?void 0:n.message)||"Checkout complete failed";throw this.store.batch({"checkout.error":t,"checkout.readyForSubmit.prepared":![],"checkout.readyForSubmit.payment":![],"checkout.payment.sendSubmitSignal":![]}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_FAILED,{message:t}),n}finally{this.store.set("checkout.loading",![])}}async startPreparingCheckoutSubmit(){var t,n,i;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_STARTED,{started:!![]});const o=this.store.get("checkout");this.store.set("checkout.payment.sendSubmitSignal",!![]);const r={cartId:o.cartId,customer:{firstName:o.customer.firstName,lastName:o.customer.lastName,email:o.customer.email,phone:o.customer.phone,birthDate:o.customer.birthDate,company:o.customer.company},...o.isGift&&{giftOptions:{recipient:{email:o.giftRecipient.email,phone:o.giftRecipient.phone,name:o.giftRecipient.firstName+" "+o.giftRecipient.lastName},message:o.giftRecipient.message||""}},...!o.billingSameAsShipping&&(null==o?void 0:o.billing)&&{billingAddress:{firstName:null==o?void 0:o.billing.firstName,lastName:o.billing.lastName,email:o.billing.email,phone:o.billing.phone,city:o.billing.city,state:o.billing.state,zip:o.billing.zipCode,one:o.billing.addressOne,two:o.billing.addressTwo||""}},billingSameAsShipping:o.billingSameAsShipping,acceptedAccountCreation:o.acceptedAccountCreation,hasAgeVerify:o.hasAgeVerify,hasSubstitutionPolicy:o.hasSubstitutionPolicy,isGift:o.isGift,marketingPreferences:o.marketingPreferences,promoCode:(null===(t=o.promoCode)||void 0===t?void 0:t.code)||void 0,giftCards:(null===(n=o.giftCards)||void 0===n?void 0:n.map(t=>t.code))||[],deliveryInstructions:Object.values(o.onDemandFulfillmentTipInfo||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:o.deliveryInstructions||""}))},s=await this.api.prepareCheckout(r);this.store.batch({"checkout.customer":s.customer,"checkout.acceptedAccountCreation":s.acceptedAccountCreation,"checkout.billingSameAsShipping":s.billingSameAsShipping,"checkout.hasAgeVerify":s.hasAgeVerify,"checkout.hasSubstitutionPolicy":s.hasSubstitutionPolicy,"checkout.isGift":s.isGift,"checkout.marketingPreferences":s.marketingPreferences,"checkout.events":s.events||[],"checkout.readyForSubmit.prepared":!![]}),this.triggerAddShippingInfoEvent(),this.googleTagManager.addPaymentInfoWithoutItems(centToDollar(o.amounts.total),"card",null===(i=o.promoCode)||void 0===i?void 0:i.code)}catch(o){const t=(null==o?void 0:o.message)||"Checkout preparation failed";throw this.store.batch({"checkout.error":t,"checkout.loading":![]}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_FAILED,{message:t}),o}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(i.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async focusFirstInvalidField(){try{const t=this.store.get("checkout.invalidFields")||[];if(0===t.length)return;const e=t[0];this.store.set("checkout.focusField",e),setTimeout(()=>{this.store.set("checkout.focusField",null)},100)}catch(t){this.logger.error("Checkout form validation focus operation failed",{error:t instanceof Error?t.message:String(t)})}}buildItemUpdate(t,e){var n,i,o;const r={id:t.cartItemId,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},s=(null===(o=null===(i=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||void 0===o?void 0:o.filter(t=>""!==t.trim()))||[];return s.length>0&&(r.engravingLines=s),r}async updateCheckoutItemQuantity(t,n){try{this.store.set("checkout.items."+t+".updating",!![]);const i=this.store.get("checkout.cartId"),o=this.store.get("checkout.items."+t);if(!o)throw new Error("Item not found");const r=o.quantity,s=o.quantity+n;if(s<1)return this.removeItem(t,!![]);const a=this.buildItemUpdate(o,s);await this.api.updateCart({id:i,items:[a],loc:this.getLocation()}),this.pubSub.publishAction(n>0?e.CHECKOUT_ITEM_QUANTITY_INCREASE:e.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:o.cartItemId,quantity:s,previousQuantity:r}),await this.partialLoadCheckout()}catch(i){throw this.store.set("checkout.items."+t+".error",i.message),i}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var n,i,o;try{const r=this.store.get("checkout.cartId"),s=this.store.get("checkout.items."+t);if(!s)throw new Error("Item not found in checkout");if(!(null===(n=s.attributes)||void 0===n?void 0:n.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const a=(null===(o=null===(i=s.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],c={id:s.cartItemId,fulfillmentId:s.fulfillmentId,partNumber:s.partNumber,quantity:s.quantity,engravingLines:[]};await this.api.updateCart({id:r,items:[c],loc:this.getLocation()}),this.pubSub.publishAction(e.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:s.cartItemId,engravingLines:[],previousEngravingLines:a}),await this.partialLoadCheckout()}catch(r){throw this.store.set("checkout.items."+t+".error",r.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:r.message}),r}}async removeItem(t,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."+t+".updating",!![]);const i=this.store.get("checkout.cartId"),o=this.store.get("checkout.items."+t);if(!o)throw new Error("Item not found");const r=this.buildItemUpdate(o,0);await this.api.updateCart({id:i,items:[r],loc:this.getLocation()}),this.store.remove("checkout.items."+t),this.pubSub.publishAction(e.CHECKOUT_ITEM_REMOVED,{cartItemId:o.cartItemId}),await this.partialLoadCheckout()}catch(i){throw this.store.set("checkout.items."+t+".error",i.message),i}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const n=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},i=Object.values(n).map(e=>{const n=Math.round(e.subtotal*t/100);return{fulfillmentId:e.fulfillmentId,tip:n}}),o=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:i});this.updateStoreFromCheckoutResponse(o),this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{deliveryTips:i})}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(t,n){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},o=Object.values(i).map(e=>({fulfillmentId:e.fulfillmentId,tip:e.fulfillmentId===t?n:e.tip})),r={...this.dataForCheckoutPrepare(),deliveryTips:o},s=await this.api.prepareCheckout(r);this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const n=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},i=Object.values(n).map(e=>({fulfillmentId:e.fulfillmentId,tip:e.fulfillmentId===t?0:e.tip})),o=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:i});this.updateStoreFromCheckoutResponse(o),this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{deliveryTips:i})}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(t){var e;const n={"checkout.amounts":t.amounts,"checkout.warning":t.warning,"checkout.events":transformEventsForCheckout(t.events||[]),"checkout.error":null};if((null===(e=t.retailers)||void 0===e?void 0:e.length)>0)for(const i of t.retailers)for(const t of i.fulfillments)t.type===o.ON_DEMAND&&(n["checkout.onDemandFulfillmentTipInfo."+t.id]={retailerId:i.id,retailerName:i.name,fulfillmentId:t.id,tip:t.tip,subtotal:t.subtotal});this.store.batch(n)}async updateStripeFormStatus(t){try{const e=this.store.get("checkout.stripeFormStatus")||{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},n={...e,...t};this.store.set("checkout.stripeFormStatus",n)}catch(e){throw console.error("Error updating Stripe form status:",e),e}}async removeCheckoutError(){this.store.set("checkout.error",null)}async updateDeliveryInstructions(t){this.store.set("checkout.deliveryInstructions",t)}dataForCheckoutPrepare(){var t,e,n;const i=this.store.get("checkout"),o=(null===(t=null==i?void 0:i.customer)||void 0===t?void 0:t.email)?{firstName:i.customer.firstName,lastName:i.customer.lastName,email:i.customer.email,phone:i.customer.phone,birthDate:i.customer.birthDate,company:i.customer.company}:void 0;return{cartId:i.cartId,customer:o,billingSameAsShipping:i.billingSameAsShipping,acceptedAccountCreation:i.acceptedAccountCreation,hasAgeVerify:i.hasAgeVerify,hasSubstitutionPolicy:i.hasSubstitutionPolicy,marketingPreferences:i.marketingPreferences,promoCode:(null===(e=i.promoCode)||void 0===e?void 0:e.code)||void 0,giftCards:(null===(n=null==i?void 0:i.giftCards)||void 0===n?void 0:n.map(t=>t.code))||[]}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.pubSubService=PubSubService.getInstance(),this.commonCommands=CommonCommands.getInstance(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,n){var i;try{this.store.set("cart.items."+t+".updating",!![]);const o=this.store.get("cart.id"),r=this.store.get("cart.items."+t);if(!r)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+n),new Error("Item not found");const s=r.quantity+n;if(s<1)return this.removeItem(t,!![]);const a=this.buildItemUpdate(r,s),c=await this.api.updateCart({id:o,items:[a],loc:this.getLocation()});this.syncItemsFromApiResponse(c,[t]),this.updateFulfillment(r.fulfillmentId,c);const l=null===(i=c.retailers)||void 0===i?void 0:i.find(t=>t.id===r.retailerId);if(l&&this.store.set("cart.retailers."+r.retailerId,buildRetailerStore(l)),this.syncCartMetaFromApiResponse(c),this.pubSubService.publishAction(n<0?e.CART_ITEM_QUANTITY_DECREASE:e.CART_ITEM_QUANTITY_INCREASE,{id:r.id,quantity:s,previousQuantity:r.quantity}),n<0){const t=splitCategoryPath(r.catPath);this.googleTagManager.decreaseQuantity({item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_category:t.category,item_category2:t.category2,item_category3:t.category3,quantity:Math.abs(n),price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId})}else{const t=splitCategoryPath(r.catPath);this.googleTagManager.increaseQuantity({item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_category:t.category,item_category2:t.category2,item_category3:t.category3,quantity:n,price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId})}}catch(o){throw this.store.set("cart.items."+t+".error",o.message),o}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,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."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw new Error("Item not found");const r={itemId:o.id,fulfillmentId:o.fulfillmentId,retailerId:o.retailerId},s=this.buildItemUpdate(o,0),a=await this.api.updateCart({id:i,items:[s],loc:this.getLocation()});this.syncItemsFromApiResponse(a,[]),this.cleanupAfterItemRemoval(r,a),this.syncCartMetaFromApiResponse(a),this.pubSubService.publishAction(e.CART_ITEM_REMOVED,{id:o.id});const c=splitCategoryPath(o.catPath);this.googleTagManager.removeFromCart({item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_category:c.category,item_category2:c.category2,item_category3:c.category3,quantity:o.quantity,price:centToDollar(o.unitPrice||0),upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId})}catch(i){throw this.store.set("cart.items."+t+".error",i.message),i}}async updateItemEngraving(t,n){var i,o,r;try{const s=this.store.get("cart"),a=null===(i=s.items)||void 0===i?void 0:i[t];if(!a)throw new Error("Item not found");this.store.set("cart.items."+t+".updating",!![]);const c={id:a.id,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:n},l=await this.api.updateCart({id:s.id||"",items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(l,[t]),this.syncCartMetaFromApiResponse(l);const h=this.store.get("cart"),u=this.store.get("address");this.pubSubService.publishAction(e.CART_UPDATED,{previous:cartDataForEventFromStore(s,u),current:cartDataForEventFromStore(h,u)}),this.pubSubService.publishAction(e.CART_ITEM_ENGRAVING_UPDATED,{id:a.id,engravingLines:n,previousEngravingLines:(null===(r=null===(o=a.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[]})}catch(s){throw this.store.set("cart.items."+t+".error",s.message),s}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var n,i,o,r;try{this.store.set("cart.loading",!![]);const s=this.store.get("cart"),a={...s},c=(null===(n=t.engravingLines)||void 0===n?void 0:n.filter(t=>""!==t.trim()))||[],l=c.length>0,h=Object.values(s.items||{}).find(e=>{var n,i,o,r,s;const a=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!a)return![];if(l){const t=(null===(i=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[];return c.join(",")===t.join(",")}return!(null===(s=null===(r=null===(o=e.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.length)}),u={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:h?t.quantity+h.quantity:t.quantity};l&&(u.engravingLines=c);const p=await this.api.updateCart({id:s.id||"",items:[u],loc:this.getLocation()}),m=null===(i=p.items)||void 0===i?void 0:i.find(t=>t.fulfillmentId===u.fulfillmentId&&t.partNumber===u.partNumber&&t.upc===u.upc);if(!m)throw new Error("Added item not found in cart response");this.syncItemsFromApiResponse(p,[]);const f=this.store.get("cart.fulfillments."+t.fulfillmentId);if(f){this.updateFulfillment(t.fulfillmentId,p);const e=null===(o=p.retailers)||void 0===o?void 0:o.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t.fulfillmentId)});if(e){const t=null===(r=p.retailers)||void 0===r?void 0:r.find(t=>t.id===e.id);t&&this.store.set("cart.retailers."+e.id,buildRetailerStore(t))}}else this.addNewFulfillmentAndRetailer(t.fulfillmentId,p);this.syncCartMetaFromApiResponse(p);const g=this.store.get("cart"),v=this.store.get("address");this.pubSubService.publishAction(e.PRODUCT_ADD_TO_CART,{...t}),this.pubSubService.publishAction(e.CART_ITEM_ADDED,{id:m.id,upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSubService.publishAction(e.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),s}finally{this.store.set("cart.loading",![])}}async addPresaleItem(t){var e;try{const n={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity};(null==t?void 0:t.engravingLines)&&(null===(e=null==t?void 0:t.engravingLines)||void 0===e?void 0:e.length)>0&&(n.engravingLines=t.engravingLines);const i=await this.api.updateCart({id:"",items:[n],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(i.id)}catch(n){throw this.store.set("cart.error",n.message),n}}async handleGoToCheckout(){var t;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(i.CHECKOUT);const e=this.store.get("cart");this.googleTagManager.beginCheckout([...Object.values(e.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(t=e.promoCode)||void 0===t?void 0:t.code)||"")}catch(e){throw this.store.set("cart.error",e.message),e}finally{this.store.set("cart.loading",![])}}async applyPromoCode(t){var e,n,i;if(!(null==t?void 0:t.trim()))throw new Error("Promo code is required");const o=t.trim().toUpperCase();try{const t=this.store.get("cart.id"),r=await this.api.updateCart({id:t,items:[],promoCode:o,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(r)),this.store.set("cart.events",transformEventsForCart(r.events||[]));const s=(null===(i=null===(n=null===(e=r.attributes)||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.value)||void 0===i?void 0:i.toLowerCase())===o.toLowerCase();s?this.store.set("cart.promoCode",{code:o,discountAmount:r.discounts||0,error:null}):this.store.set("cart.promoCode",{code:o,discountAmount:0,error:'Code "'+o+'" does not exist'})}catch(r){throw this.store.set("cart.error","Failed to apply promo code. Please try again."),r}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(e),"cart.promoCode":null})}catch(t){const e=t.message||"Failed to remove promo code. Please try again.";throw this.store.set("cart.error",e),t}}async clearPromoCodeError(){try{this.store.set("cart.promoCode",null)}catch(D){const e=D.message||"Failed to clear promo code. Please try again.";throw this.store.set("cart.error",e),D}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("cart",N),await this.commonCommands.loadCart(),this.store.set("checkout",z)}getDetails(){var t;const e=this.store.get("cart"),n=this.store.get("address"),i=n.id?n:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},o={};for(const r in e.items||{}){const t=e.items[r];o[r]={id:t.id,variantId:t.variantId,liquidId:t.liquidId,salsifyGrouping:t.salsifyGrouping,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price||0,quantity:t.quantity||0,maxQuantity:t.maxQuantity||0,unitPrice:t.unitPrice||0,mainImage:t.mainImage||"",attributes:t.attributes||{}}}return{id:e.id,promoCode:(null===(t=e.promoCode)||void 0===t?void 0:t.code)||"",items:o,location:{placesId:i.id,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:{latitude:i.coordinates.lat,longitude:i.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}}buildItemUpdate(t,e){var n,i,o;const r={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},s=(null===(o=null===(i=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||void 0===o?void 0:o.filter(t=>""!==t.trim()))||[];return s.length>0&&(r.engravingLines=s),r}syncItemsFromApiResponse(t,e=[]){var n;const i=this.store.get("cart.items")||{},o=new Set((null===(n=t.items)||void 0===n?void 0:n.map(t=>t.id))||[]);for(const s of Object.keys(i))o.has(s)||this.store.remove("cart.items."+s);const r={};for(const s of t.items)0!==e.length&&!e.includes(s.id)&&i[s.id]||(r["cart.items."+s.id]=buildCartItemStore(s));Object.keys(r).length>0&&this.store.batch(r)}syncCartMetaFromApiResponse(t){var e,n;const i={"cart.totals":buildCartTotals(t),"cart.error":null,"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(t.events||[])},o=null===(n=null===(e=t.attributes)||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.value;if(o)i["cart.promoCode"]={code:o.toUpperCase(),discountAmount:t.discounts||0,error:null};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&this.store.set("cart.promoCode",null)}this.store.batch(i)}updateFulfillment(t,e){var n,i;const o=null===(n=e.retailers)||void 0===n?void 0:n.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t)}),r=null===(i=null==o?void 0:o.fulfillments)||void 0===i?void 0:i.find(e=>e.id===t);r&&o&&this.store.set("cart.fulfillments."+t,buildFulfillmentStore(r,o))}addNewFulfillmentAndRetailer(t,e){var n,i;const o=null===(n=e.retailers)||void 0===n?void 0:n.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t)}),r=null===(i=null==o?void 0:o.fulfillments)||void 0===i?void 0:i.find(e=>e.id===t);if(r&&o){const e={["cart.fulfillments."+t]:buildFulfillmentStore(r,o),["cart.retailers."+o.id]:buildRetailerStore(o)};this.store.batch(e)}}cleanupAfterItemRemoval(t,e){var n,i,o;const r=this.store.get("cart.fulfillments."+t.fulfillmentId),s=this.store.get("cart.retailers."+t.retailerId);if(!r||!s)return;const a=1===r.items.length,c=1===s.fulfillments.length,l=null===(n=e.retailers)||void 0===n?void 0:n.some(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t.fulfillmentId)}),h=null===(i=e.retailers)||void 0===i?void 0:i.some(e=>e.id===t.retailerId);if(a&&!l){if(this.store.remove("cart.fulfillments."+t.fulfillmentId),c&&!h)this.store.remove("cart.retailers."+t.retailerId);else if(h){const n=null===(o=e.retailers)||void 0===o?void 0:o.find(e=>e.id===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(n))}}else l&&this.updateFulfillment(t.fulfillmentId,e)}}class ProductCommands extends BaseCommand{constructor(){super(),this.themeProvider=ThemeProviderService.getInstance(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,e=![]){this.store.createProductInstance(t),e&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var e;if(!Array.isArray(t)||0===t.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=!![],t["products."+e+".error"]=null,t),{}));const n=await this.api.getProductsData(t,this.getLocation());if(!n||!n.products||0===n.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]=!![],t),{})),void 0;const i=[];for(const r of n.products){const o=r.sizes.filter(e=>t.some(t=>t===(e.upc||e.id||r.salsifyGrouping))),s=t.find(t=>o.some(e=>t===e.upc||t===e.id)||t===r.salsifyGrouping),a=s||(null===(e=null==o?void 0:o[0])||void 0===e?void 0:e.upc);await this.loadProduct(a,{products:[r],retailers:n.retailers}),i.push(a)}const o=t.filter(t=>-1===i.indexOf(t));this.store.batch(o.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]="Product data not found",t),{}))}async loadProduct(t,n=null){var i,o;try{const r=this.store.get("products."+t);r.loading||this.store.set("products."+t+".loading",!![]);let s=null;if(n&&(s=n),n||(s=await this.api.getProductsData([t],this.getLocation())),!s||!(null===(i=null==s?void 0:s.products)||void 0===i?void 0:i[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const a=this.loadProductStoreUpdate(s);if(!a)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...a,identifier:t}),this.pubSub.publishAction(e.PRODUCT_LOADED,this.productDataForEventFromStore(t));const c=s.products[0],l=a.sizes[a.selectedSizeId],h=splitCategoryPath(c.category);this.googleTagManager.viewItem({item_id:c.id,item_name:c.name,item_brand:c.brand,item_category:h.category,item_category2:h.category2,item_category3:h.category3,price:centToDollar((null===(o=c.priceInfo)||void 0===o?void 0:o.average)||0),item_type:c.type,item_subtype:c.subType,upc:(null==l?void 0:l.upc)||"",grouping_id:c.salsifyGrouping,product_id:c.id})}catch(r){throw this.store.set("products."+t+".error",r.message),r}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,n){var i,r,s,a,c,l,h;const u=this.store.get("products."+t);let p=u.selectedFulfillmentType;const m=null===(i=u.sizes[n])||void 0===i?void 0:i.shippingFulfillments,f=null===(r=u.sizes[n])||void 0===r?void 0:r.onDemandFulfillments;let g=null,v=null;if(p!==o.SHIPPING||objectValues(m).length)if(p!==o.ON_DEMAND||objectValues(f).length){const t=p===o.SHIPPING?m:f,e=objectValues(t);g=e[0]||null,v=(null==g?void 0:g.fulfillmentId)||null}else{p=o.SHIPPING;const t=objectValues(m);g=t[0]||null,v=(null==g?void 0:g.fulfillmentId)||null}else{p=o.ON_DEMAND;const t=objectValues(f);g=t[0]||null,v=(null==g?void 0:g.fulfillmentId)||null}const y=p===o.SHIPPING?m:f,b=splitCategoryPath(u.catPath);this.googleTagManager.viewItem({item_id:u.id,item_name:u.name,item_brand:u.brand,item_category:b.category,item_category2:b.category2,item_category3:b.category3,price:centToDollar((null===(s=u.priceInfo)||void 0===s?void 0:s.avg)||0),item_type:u.type,item_subtype:u.subType,upc:(null===(a=u.sizes[n])||void 0===a?void 0:a.upc)||"",grouping_id:u.salsifyGrouping,product_id:u.id}),this.pubSub.publishAction(e.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:n,size:(null===(c=u.sizes[n])||void 0===c?void 0:c.size)||"",previousSizeId:u.selectedSizeId||"",previousSize:(null===(l=u.sizes[u.selectedSizeId])||void 0===l?void 0:l.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:n,["products."+t+".mainImage"]:(null===(h=u.sizes[n])||void 0===h?void 0:h.image)||null,["products."+t+".productHasAvailability"]:Object.keys(m).length+Object.keys(f).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(y).length),["products."+t+".selectedFulfillmentType"]:p,["products."+t+".selectedFulfillment"]:g,["products."+t+".selectedFulfillmentId"]:v,["products."+t+".engravingLines"]:[]})}async selectFulfillment(t,n){var i,r,s,a,c;const l=this.store.get("products."+t),h=null===(i=l.sizes[l.selectedSizeId])||void 0===i?void 0:i.shippingFulfillments,u=null===(r=l.sizes[l.selectedSizeId])||void 0===r?void 0:r.onDemandFulfillments,p=l.selectedFulfillmentType===o.SHIPPING?h:u,m=p[n];this.pubSub.publishAction(e.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:n,selectedFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId||"",previousFulfillmentType:l.selectedFulfillmentType});const f=splitCategoryPath(l.catPath);this.googleTagManager.viewItem({item_id:l.id,item_name:l.name,item_brand:l.brand,item_category:f.category,item_category2:f.category2,item_category3:f.category3,price:centToDollar((null===(s=l.priceInfo)||void 0===s?void 0:s.avg)||0),item_type:l.type,item_subtype:l.subType,upc:(null===(c=l.sizes[null!==(a=l.selectedSizeId)&&void 0!==a?a:""])||void 0===c?void 0:c.upc)||"",grouping_id:l.salsifyGrouping,product_id:l.id}),this.store.batch({["products."+t+".selectedFulfillment"]:m,["products."+t+".selectedFulfillmentId"]:n,["products."+t+".engravingLines"]:[],["products."+t+".quantity"]:1})}async updateQuantity(t,n){var i;const o=this.store.get("products."+t),r=o.quantity,s=r+n,a=1,c=(null===(i=null==o?void 0:o.selectedFulfillment)||void 0===i?void 0:i.stock)||5,l=Math.max(a,Math.min(c,s));this.pubSub.publishAction(n<0?e.PRODUCT_QUANTITY_DECREASE:e.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:l,previousQuantity:r}),this.store.set("products."+t+".quantity",l)}async changeFulfillmentType(t,n){var i,r,s;const a=this.store.get("products."+t),{shippingFulfillments:c,onDemandFulfillments:l}=a.sizes[a.selectedSizeId],h=n===o.SHIPPING?c:l,u=objectValues(h);if(0===u.length)return this.logger.warn("No fulfillments available for type "+n+" on product "+t),void 0;const p=u[0]||null,m=(null==p?void 0:p.fulfillmentId)||null;this.pubSub.publishAction(e.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:n,selectedFulfillmentId:m,previousFulfillmentType:a.selectedFulfillmentType,previousFulfillmentId:a.selectedFulfillmentId,fulfillmentHasAvailability:u.length>0});const f=splitCategoryPath(a.catPath);this.googleTagManager.viewItem({item_id:a.id,item_name:a.name,item_brand:a.brand,item_category:f.category,item_category2:f.category2,item_category3:f.category3,price:centToDollar((null===(i=a.priceInfo)||void 0===i?void 0:i.avg)||0),item_type:a.type,item_subtype:a.subType,upc:(null===(s=a.sizes[null!==(r=a.selectedSizeId)&&void 0!==r?r:""])||void 0===s?void 0:s.upc)||"",grouping_id:a.salsifyGrouping,product_id:a.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:n,["products."+t+".selectedFulfillment"]:p,["products."+t+".selectedFulfillmentId"]:m,["products."+t+".fulfillmentHasAvailability"]:u.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async updateEngravingLines(t,n){const i=this.store.get("products."+t);if(!i)return this.logger.warn("Product store for ID "+t+" does not exist."),void 0;this.store.set("products."+t+".engravingLines",n),this.pubSub.publishAction(e.PRODUCT_ENGRAVING_UPDATED,{identifier:t,engravingLines:n,previousEngravingLines:i.engravingLines||[]})}async openProductDrawer(t,e,n){const i={type:e,data:n||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:i})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),e=Object.keys(t);for(const n of e)this.store.set("products."+n+".rerender",!![])}async addToCart(t,e){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(i.CART),await this.cartCommands.addItem(e),this.store.batch({["products."+t+".engravingLines"]:[],["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.warn("Error adding to cart"),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,e){try{this.store.set("products."+t+".updating",!![]),await this.cartCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(i.CHECKOUT),this.store.batch({["products."+t+".engravingLines"]:[],["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.warn("Error adding presale to cart"),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const e=this.store.get("products."+t),n={},fulfillmentEventData=t=>{const e={};for(const n in t){const i=t[n];e[n]={retailerId:i.retailerId,retailerName:i.retailerName,retailerAddress:i.retailerAddress,retailerTimezone:i.timezone,price:i.price,partNumber:i.partNumber,fulfillmentId:i.fulfillmentId,fulfillmentType:i.fulfillmentType,modalities:i.modalities||[]}}return e};for(const i in e.sizes||{}){const t=e.sizes[i];n[i]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc||"",container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.maxQuantityPerOrder,image:t.image,uom:t.uom,volume:t.volume,shippingFulfillments:fulfillmentEventData(t.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(t.onDemandFulfillments||{})}}return{identifier:t,id:e.id,name:e.name,brand:e.brand,category:e.category,catPath:e.catPath,classification:e.classification,priceInfo:e.priceInfo||null,sizes:n}}loadProductStoreUpdate(t){var e,n,i,r,s,a,c,l,h;try{const{products:[u,...p],retailers:m}=t,f=this.themeProvider.getConfigs("product"),g={};let v=![],y=![],b="",x=null,w=f.layout.enableShippingFulfillment?o.SHIPPING:o.ON_DEMAND,C=null,k=null;const S={};if(m&&Array.isArray(m)&&m.length>0)for(const t of m)for(const e of t.fulfillments)S[e.id]={retailerName:t.name,retailerAddress:t.address||null,type:e.type,timezone:e.timezone||"",canEngrave:e.canEngrave||![],expectation:e.expectation,fees:e.fees,hours:e.hours,retailerId:t.id,fulfillmentId:e.id,fulfillmentType:e.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]};if(u.sizes&&Array.isArray(u.sizes)&&u.sizes.length>0)for(const t of u.sizes){const s={},a={};for(const c of t.variants){if((null===(e=null==c?void 0:c.fulfillmentTypes)||void 0===e?void 0:e.onDemand)&&""!==c.fulfillmentTypes.onDemand){const t=c.fulfillmentTypes.onDemand,e=S[t];e?a[t]={...e,isVariantEngravable:c.isEngravable,stock:c.stock,price:c.price,retailerId:c.retailerId,fulfillmentId:t,fulfillmentType:o.ON_DEMAND,modalities:[...e.modalities,...null!==(n=null==c?void 0:c.modalities)&&void 0!==n?n:[]],partNumber:c.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId:",t)}if((null===(i=null==c?void 0:c.fulfillmentTypes)||void 0===i?void 0:i.shipping)&&""!==c.fulfillmentTypes.shipping){const t=c.fulfillmentTypes.shipping,e=S[t];e?s[t]={...e,isVariantEngravable:c.isEngravable,stock:c.stock,price:c.price,retailerId:c.retailerId,fulfillmentId:t,fulfillmentType:o.SHIPPING,modalities:[...e.modalities,...null!==(r=null==c?void 0:c.modalities)&&void 0!==r?r:[]],partNumber:c.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId:",t)}}g[t.id]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.maxQuantityPerOrder,image:t.image,uom:t.uom,volume:t.volume,attributes:t.attributes,loading:![],error:null,shippingFulfillments:s,onDemandFulfillments:a}}const E=objectValues(g);b=E[0]&&E[0].id||"",x=E[0]&&E[0].image||null;const I=(null===(s=g[b])||void 0===s?void 0:s.shippingFulfillments)||{},T=(null===(a=g[b])||void 0===a?void 0:a.onDemandFulfillments)||{},P=objectValues(I).length,F=objectValues(T).length;v=P+F>0;const D=w===o.SHIPPING?objectValues(I):objectValues(T);if(y=D.length>0,k=D[0]||null,C=(null==k?void 0:k.fulfillmentId)||null,!y){const t=w===o.SHIPPING?o.ON_DEMAND:o.SHIPPING,e=t===o.SHIPPING?objectValues(I):objectValues(T);e.length>0&&(w=t,k=e[0],C=(null==k?void 0:k.fulfillmentId)||null,y=!![])}return{identifier:"",id:u.id||"",name:u.name,description:u.description,htmlDescription:u.htmlDescription,images:u.images,priceInfo:{min:(null===(c=u.priceInfo)||void 0===c?void 0:c.minimum)||0,max:(null===(l=u.priceInfo)||void 0===l?void 0:l.maximum)||0,avg:(null===(h=u.priceInfo)||void 0===h?void 0:h.average)||0},brand:u.brand,catPath:u.catPath,category:u.category,classification:u.classification,type:u.type,subType:u.subType,salsifyGrouping:u.salsifyGrouping,sizes:g,productHasAvailability:v,fulfillmentHasAvailability:y,selectedSizeId:b,mainImage:x,selectedFulfillmentType:w,selectedFulfillmentId:C,selectedFulfillment:k,drawer:{isOpen:![],contentConfig:null},engravingLines:[],error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(u){throw this.logger.error("Error processing product data:",u),u}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(t){return!t||t.length<3?[]:await this.api.getAddressSuggestions(t)}async getAddressDetails(t){return await this.api.getAddressDetails(t)}async setSelectedAddress(t){const n=this.store.get("address"),i=this.shouldResetCartForAddressChange(n,t);this.store.batch({"address.id":t.id,"address.formattedAddress":t.formattedAddress,"address.address":t.address,"address.coordinates":t.coordinates});const o=this.store.get("products");try{await this.productCommands.loadMultipleProducts(Object.keys(o)),i&&await this.cartCommands.resetCart()}catch(r){throw this.pubSub.publishAction(e.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==r?void 0:r.message)||"Failed to update downstream state after address change"}),r}this.pubSub.publishAction(e.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},coordinates:t.coordinates,formattedAddress:t.formattedAddress}),await this.persistSessionData()}async setAddressManually(t,n){try{const e=buildFormattedAddressString(t),i={id:"",formattedAddress:e,address:t,coordinates:n};await this.setSelectedAddress(i)}catch(i){throw this.pubSub.publishAction(e.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:t,coordinates:n,error:(null==i?void 0:i.message)||"Failed to set manual address"}),i}}clearSelectedAddress(){this.store.set("address",R),this.pubSub.publishAction(e.ADDRESS_CLEARED,!![]),this.clientConfig.isLocalStorageAvailable()&&this.store.forceSave()}shouldResetCartForAddressChange(t,e){return t.id?t.address.city!==e.address.city||t.address.state!==e.address.state||t.address.zip!==e.address.zip:![]}async persistSessionData(){var t;const e=this.store.get("address.id")||"",n=this.store.get("cart.id")||"";if(this.clientConfig.isLocalStorageAvailable())this.store.forceSave();else try{const i=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"";await this.api.setPersistedStore(i,{p:e,c:n}),this.logger.info("Session data persisted to DB",{userDeviceId:i,addressId:e,cartId:n})}catch(i){this.logger.error("Failed to persist session data to DB",{error:(null==i?void 0:i.message)||i})}}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}class ClientActionService{constructor(){this.productActions={getDetails:t=>this.command.product.productDataForEventFromStore(t)},this.addressActions={setAddressByPlacesId:async t=>{try{if(!t||""===t.trim())throw new Error("Invalid placesId provided");const e=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:e.address,coordinates:e.coords,formattedAddress:e.formattedAddress})}catch(e){throw this.logger.error("Error setting address by placesId:",e),e}},setAddressManually:async(t,e)=>{try{if(!t||!e)throw new Error("Invalid address or coordinates provided");if(!(t.one&&t.city&&t.state&&t.zip))throw new Error("Address must include street address, city, state, and zip code");if("number"!=typeof e.lat||"number"!=typeof e.long)throw new Error("Coordinates must be valid numbers");if(e.lat<-90||e.lat>90)throw new Error("Latitude must be between -90 and 90");if(e.long<-180||e.long>180)throw new Error("Longitude must be between -180 and 180");await this.command.address.setAddressManually(t,e)}catch(n){throw this.logger.error("Error setting manual address:",n),n}},clear:()=>{this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(i.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CART)},addProduct:async(t,n)=>{var r,s;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;n===!![]&&this.command.ui.openDrawer(i.CART);const a=[...new Set(t.map(t=>t.identifier))],c=await this.api.getProductsData(a,this.getLocation());if(!c||!c.products||0===c.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(e.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const e of t){let t=null;for(let o=0;o<c.products.length;o++){const n=c.products[o];let i=![];for(let t=0;t<n.sizes.length;t++){const o=n.sizes[t];if(o.upc===e.identifier||o.id===e.identifier||n.salsifyGrouping===e.identifier){i=!![];break}}if(i){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=t.sizes[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(s=null===(r=null==n?void 0:n.attributes)||void 0===r?void 0:r.presale)||void 0===s?void 0:s.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+e.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let i=null;for(let r=0;r<n.variants.length;r++){const t=n.variants[r];let s=![];if(e.fulfillmentType===o.ON_DEMAND&&(s=!(!t.fulfillmentTypes||!t.fulfillmentTypes.onDemand||""===t.fulfillmentTypes.onDemand)),e.fulfillmentType===o.SHIPPING&&(s=!(!t.fulfillmentTypes||!t.fulfillmentTypes.shipping||""===t.fulfillmentTypes.shipping)),s){i=t;break}}if(!i){this.logger.warn("No supported variant found for product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const a=e.fulfillmentType===o.ON_DEMAND?i.fulfillmentTypes.onDemand:i.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:n.upc,fulfillmentId:a,partNumber:i.partNumber,quantity:e.quantity,identifier:e.identifier})}this.pubSub.publishAction(e.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:a}),this.logger.info("Products added to cart successfully:",a)}catch(a){throw this.logger.error("Error adding products to cart:",a),this.pubSub.publishAction(e.CART_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:a.message||"Failed to add products to cart"}),a}},applyPromoCode:async t=>{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.applyPromoCode(t);const o=this.command.cart.getDetails();this.pubSub.publishAction(e.CART_PROMO_CODE_APPLIED,{applied:!![],discountAmount:o.amounts.discounts,newTotal:o.amounts.total}),this.logger.info("Promo code applied successfully")}catch(n){throw this.logger.error("Failed to apply promo code:",n),this.pubSub.publishAction(e.CART_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),n}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),n=t.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(e.CART_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(e.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(i.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CHECKOUT)},addProduct:async(t,n)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;n===!![]&&this.command.ui.openDrawer(i.CHECKOUT);const o=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:o}),this.logger.info("Products added to checkout successfully:",o)}catch(o){throw this.logger.error("Error adding products to checkout:",o),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:o.message||"Failed to add products to checkout"}),o}},applyPromoCode:async t=>{var n;try{const i=this.themeProvider.getConfigs("global"),o=i.layout.allowPromoCodes;if(!o)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.applyPromoCode(t);const r=this.store.get("checkout"),s=null==r?void 0:r.promoCode;this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_APPLIED,{applied:!![],discountAmount:(null==s?void 0:s.discountAmount)||0,newTotal:(null===(n=null==r?void 0:r.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(i){throw this.logger.error("Failed to apply checkout promo code:",i),this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),i}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),n=t.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(e.CHECKOUT_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Checkout promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove checkout promo code:",t),t}},applyGiftCard:async t=>{var n;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_APPLIED,{applied:!![],newTotal:(null===(n=null==r?void 0:r.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card applied successfully")}catch(i){throw this.logger.error("Failed to apply gift card:",i),this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be applied"}),i}},removeGiftCard:async t=>{try{const n=this.themeProvider.getConfigs("checkout"),i=n.layout.allowGiftCards;if(!i)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t),this.pubSub.publishAction(e.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(e.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be removed"}),n}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:(t,e)=>{this.command.checkout.toggleMarketingPreferences(t,e)},updateCustomerInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateCustomerInfo(e,n)},updateBillingInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateBillingInfo(e,n)},updateGiftInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateGiftInfo(e,n)},getDetails:()=>{var t;const e=this.store.get("checkout"),n=e.items||{},i={};for(const[o,r]of Object.entries(n)){const t=r,{attributes:e,...n}=t;i[o]=n}return{cartId:e.cartId||"",amounts:e.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:i,isGift:e.isGift||![],hasAgeVerify:e.hasAgeVerify||![],hasPromoCode:!!(null===(t=e.promoCode)||void 0===t?void 0:t.code),hasGiftCards:Array.isArray(e.giftCards)&&e.giftCards.length>0,itemCount:Object.keys(n).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")}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}function componentError({componentType:t,message:e}){const n=document.createElement("div");n.className=t;const i=n.attachShadow({mode:"closed"}),o=document.createElement("style");o.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 r=document.createElement("div"),s=document.createElement("h3");s.textContent="Component </"+t+">";const a=document.createElement("p");return a.textContent=e,r.appendChild(o),r.appendChild(s),r.appendChild(a),i.appendChild(r),n}function productionComponentError({title:t,message:e,componentType:n}){const i=document.createElement("div");i.setAttribute("data-component-type",n);const o=i.attachShadow({mode:"closed"}),r=document.createElement("style");r.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 s=document.createElement("div"),a=document.createElement("h2");a.textContent=t;const c=document.createElement("p");return c.textContent=e,s.appendChild(r),s.appendChild(a),s.appendChild(c),o.appendChild(s),i}class ComponentFactoryService{static get logger(){return ComponentFactoryService.t||(ComponentFactoryService.t=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.t}static get clientConfig(){return ComponentFactoryService.i||(ComponentFactoryService.i=ClientConfigService.getInstance()),ComponentFactoryService.i}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(t,e){ComponentFactoryService.getComponentRegistry().set(t,e)}static createElement(t){try{const e=ComponentFactoryService.getComponentRegistry().get(t.type);if(!e)throw new Error("Component type ["+t.type+"] is not registered");const n=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(n)||window.customElements.define(n,e);const o=document.createElement(n);if(o.initialize){const{type:e,useShadowDom:i,wrapInLceElement:r,...s}=t,a={type:e,tagName:n,useShadowDom:i&&r!==!![]};o.initialize({data:s,config:a})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(i.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const r=document.createElement(n);return r.initialize(t.type,o),r}return o}catch(e){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">:",(null==e?void 0:e.message)||e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t.type}):componentError({componentType:t.type,message:(null==e?void 0:e.message)||e})}}static componentError({componentType:t,message:e}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t}):componentError({componentType:t,message:e})}static getComponentTagName(t){const e={[i.DRAWER]:"drawer-lc",[i.INPUT]:"input-lc",[i.BIRTHDATE_INPUT]:"birthdate-input-lc",[i.ENGRAVING_FORM]:"engraving-form-lc",[i.ENGRAVING_VIEW]:"engraving-view-lc",[i.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[i.POWERED_BY]:"powered-by-lc",[i.LCE_ELEMENT]:"lce-element",[i.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[i.ALERT]:"alert-lc",[i.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[i.ADDRESS]:"address-lc",[i.ADDRESS_INPUT]:"address-input-lc",[i.ADDRESS_DISPLAY]:"address-display-lc",[i.PRODUCT]:"product-lc",[i.PRODUCT_OPTIONS]:"product-options-lc",[i.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[i.PRODUCT_INTERACTIONS]:"product-interactions-lc",[i.PRODUCT_DESCRIPTION]:"product-description-lc",[i.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[i.PRODUCT_RETAILERS]:"product-retailers-lc",[i.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[i.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[i.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[i.PRODUCT_PRICE]:"product-price-lc",[i.PRODUCT_DRAWER]:"product-drawer-lc",[i.PRODUCT_LOADING]:"product-loading-lc",[i.CART]:"cart-lc",[i.CART_RETAILER]:"cart-retailer-lc",[i.CART_ITEM]:"cart-item-lc",[i.CART_FOOTER]:"cart-footer-lc",[i.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[i.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[i.CART_PROMO_CODE]:"cart-promo-code-lc",[i.CART_HEADER]:"cart-header-lc",[i.CART_BODY]:"cart-body-lc",[i.CART_FULFILLMENT]:"cart-fulfillment-lc",[i.CHECKOUT]:"checkout-lc",[i.CHECKOUT_INFORMATION_SECTION]:"checkout-information-section-lc",[i.CHECKOUT_PAYMENT_FORM]:"checkout-payment-form-lc",[i.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[i.CHECKOUT_BILLING_FORM]:"checkout-billing-form-lc",[i.CHECKOUT_SUMMARY_SECTION]:"checkout-summary-section-lc",[i.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[i.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[i.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[i.CHECKOUT_ITEMS]:"checkout-items-lc",[i.CHECKOUT_COMPLETED]:"checkout-completed-lc",[i.CHECKOUT_DELIVERY_INFORMATION_FORM]:"checkout-delivery-information-form-lc",[i.CHECKOUT_BUYER_INFORMATION_FORM]:"checkout-buyer-information-form-lc",[i.CHECKOUT_TIPS]:"checkout-tips-lc",[i.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[i.CHECKOUT_ITEM]:"checkout-item-lc",[i.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[i.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[i.CHECKOUT_HEADER]:"checkout-header-lc",[i.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[i.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc"};return e[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;class FingerPrintService{constructor(){this.keyPrefix=A,this.isLocalStorageAvailable=null}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.o()){const e=this.l(t);if(e)return this.h(t,e)}const e=await this.u();return this.h(t,e)}async getFingerprintData(){return{screen:this.m(),webgl:this.v(),canvas:await this.C(),browser:this.k(),timezone:this.S(),audio:this.I()}}isLocalStorageWebApiAvailable(){return this.o()}h(t,e){return(t+"_"+e).toLowerCase()}o(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{const t="__localStorage_test__";return localStorage.setItem(t,"test"),localStorage.removeItem(t),this.isLocalStorageAvailable=!![],!![]}catch(t){return this.isLocalStorageAvailable=![],![]}}l(t){try{const e=this.keyPrefix+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(n&&n.startsWith(e)){const t=n.substring(e.length);if(t&&32===t.length&&/^[a-f0-9]{32}$/.test(t))return t}}return null}catch(e){return null}}async u(){const t=await this.getFingerprintData(),e=Object.keys(t).sort(),n=e.map(e=>e+":"+t[e]).join("|");return await this.T(n)}m(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,i=this.P(),o=Math.round(100*window.devicePixelRatio)||100;return e+"|"+n+"|"+i+"|"+o}catch(t){return"24|24|srgb|100"}}P(){try{if(window.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(D){}return"srgb"}v(){var t;try{const e=document.createElement("canvas"),n=e.getContext("webgl")||e.getContext("experimental-webgl");if(!n)return"no_webgl";const i=n,o=i.getExtension("WEBGL_debug_renderer_info");let r="unknown",s="unknown";o&&(r=i.getParameter(o.UNMASKED_VENDOR_WEBGL)||"unknown",s=i.getParameter(o.UNMASKED_RENDERER_WEBGL)||"unknown"),r=r.toLowerCase().replace(/\s+/g,"_").substring(0,30),s=s.toLowerCase().replace(/\s+/g,"_").substring(0,30);const a=i.getParameter(i.MAX_TEXTURE_SIZE)||0,c=i.getParameter(i.MAX_VERTEX_ATTRIBS)||0,l=(null===(t=i.getParameter(i.MAX_VIEWPORT_DIMS))||void 0===t?void 0:t[0])||0,h=i.getSupportedExtensions()||[],u=h.length;return e.remove(),r+"|"+s+"|"+a+"|"+c+"|"+l+"|"+u}catch(e){return"webgl_error|unknown|0|0|0|0"}}async C(){try{const t=document.createElement("canvas");t.width=200,t.height=50;const e=t.getContext("2d",{willReadFrequently:!![]});if(!e)return"no_canvas";e.imageSmoothingEnabled=![],e.fillStyle="#FFFFFF",e.fillRect(0,0,200,50),e.textBaseline="alphabetic",e.fillStyle="#000000",e.font="14px monospace",e.fillText("Fingerprint123",10,20),e.font="16px sans-serif",e.fillText("Test@2024",10,40),e.fillStyle="#FF0000",e.fillRect(130,10,20,20),e.fillStyle="#0000FF",e.beginPath(),e.arc(170,25,10,0,2*Math.PI),e.fill();const n=e.getImageData(50,15,100,20);let i="";for(let o=0;o<n.data.length;o+=40)i+=n.data[o].toString(16),i+=n.data[o+1].toString(16),i+=n.data[o+2].toString(16);return t.remove(),this.F(i).substring(0,8)}catch(t){return"canvas_error"}}k(){var t,e;try{const n=navigator,i=[],o=((null===(t=n.languages)||void 0===t?void 0:t[0])||n.language||"en").substring(0,2);i.push(o),i.push(n.hardwareConcurrency||1);const r=(null===(e=n.platform)||void 0===e?void 0:e.toLowerCase())||"unknown";i.push(r.replace(/\s+/g,"_").substring(0,10)),i.push(n.cookieEnabled?"1":"0"),i.push(n.maxTouchPoints||0),i.push(n.deviceMemory||0),i.push(this.D());const s=["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(s.join("")),i.join("|")}catch(n){return"unknown|1|unknown|1|0|0|unknown|00000000"}}D(){try{const t=navigator.userAgent.toLowerCase();return t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}S(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}I(){try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return"no_audio";const e=new t,n=e.sampleRate||44100,i=e.destination.channelCount||2,o=e.destination.maxChannelCount||2;return e.close(),n+"|"+i+"|"+o}catch(t){return"44100|2|2"}}async T(t){if((null===crypto||void 0===crypto?void 0:crypto.subtle)&&TextEncoder)try{const e=new TextEncoder,n=e.encode(t),i=await crypto.subtle.digest("SHA-256",n),o=Array.from(new Uint8Array(i));return o.map(t=>t.toString(16).padStart(2,"0")).join("").substring(0,32)}catch(e){}return this.F(t)}F(t){const e=16777619,n=2166136261;let i=n,o=n;for(let s=0;s<t.length;s++){const n=t.charCodeAt(s);i^=n,i=Math.imul(i,e),o^=n<<1,o=Math.imul(o,e)}i=Math.abs(i),o=Math.abs(o);let r=i.toString(16).padStart(8,"0")+o.toString(16).padStart(8,"0");for(;r.length<32;)i=Math.imul(i,e),o=Math.imul(o,e),r+=(i^o).toString(16);return r.substring(0,32).padStart(32,"0")}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:e}){var n;this.A=Object.freeze(t),this._=Object.freeze({type:e.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(n=null==e?void 0:e.useShadowDom)&&void 0!==n?n:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(t){return t.map(t=>this.interpolatePath(t))}interpolatePath(t){if("string"!=typeof t)return t;const e=/\{([^}]+)}/g;return t.replace(e,(e,n)=>{const i=this.A[n];return null==i?(this.logger.warn('Parameter "'+n+'" not found in component params for path "'+t+'"'),e):String(i)})}connectedCallback(){var t;this.isDestroyed||(this.initialized=!![],this.container=this._.useShadowDom?this.attachShadow({mode:this.clientConfig.isDevelopment()?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this))}disconnectedCallback(){var t;this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}setup(){var t,e;this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(e=this.beforeConnected)||void 0===e||e.call(this)}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const e of this.unsubscribers)try{e()}catch(t){this.logger.error("Cleanup error:",t)}this.unsubscribers=[]}setupAutoDestroy(){var t;if(!this.reactiveOptions.autoDestroy)return;let e=this.reactiveOptions.autoDestroyPath;if(!e&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(e=this.reactiveOptions.watchStorePaths[0]),!e)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const n=this.interpolatePath(e),i=this.store.watch(n,(t,e)=>{this.isDestroyed||void 0===t&&void 0!==e&&this.handleAutoDestroy(n)});this.unsubscribers.push(i),this.logger.debug("🔥 AutoDestroy enabled for "+this._.tagName+" watching path: "+n)}handleAutoDestroy(t){var e;if(this.isDestroyed)return;this.logger.debug("🔥 AutoDestroy triggered for "+this._.tagName+' - path "'+t+'" was removed'),null===(e=this.beforeAutoDestroy)||void 0===e||e.call(this,t);const n=this.reactiveOptions.autoDestroyDelay||0;n>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},n):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(e){this.logger.error("Error during auto-destroy of "+this._.tagName+":",e)}}setupStoreWatchers(){let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.A)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e;if(this.isDestroyed)return;const n=t.map(t=>t.path).join(", "),i="store:["+n+"]",o=null===(e=this.onStoreChanged)||void 0===e?void 0:e.call(this,t);o!==![]&&this.triggerRender(i)});this.unsubscribers.push(e)}setupNonRenderingWatchers(){let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.A)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e;this.isDestroyed||(null===(e=this.onStoreWatch)||void 0===e?void 0:e.call(this,t))});this.unsubscribers.push(e)}triggerRender(t){this.lastRenderTrigger=t,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var t,e;if(!this.initialized||this.isDestroyed)return;const n=performance.now();this.renderCount++;try{const e=this.template();"string"==typeof e&&(this.container.innerHTML=e),e instanceof HTMLElement&&safeReplaceChildren(this.container,e),Array.isArray(e)&&safeReplaceChildren(this.container,...e);const i=performance.now()-n;this.logRenderInfo(i),null===(t=this.afterRender)||void 0===t||t.call(this)}catch(i){this.logger.error("❌ Component error in "+this._.tagName+":",i),this.logger.error("Last render trigger: "+this.lastRenderTrigger),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this._.type,message:i instanceof Error?i.message:String(i)})),null===(e=this.onError)||void 0===e||e.call(this,i,"render")}}logRenderInfo(t){const e=this._.type,n=this._.tagName,i=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+i+" "+e+" </"+n+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&this.logger.warn("⚠️ Slow render in "+e+"("+n+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger)}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}}addHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}removeHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.remove(...e)}toggleHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const n of e)this.classList.toggle(n)}addHostAttribute(t,e){t&&"string"==typeof t&&e&&"string"==typeof e&&(this.setAttribute(t,String(e)),this.hostAttributes[t]=String(e))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[e,n]of Object.entries(t))e&&"string"==typeof e&&n&&"string"==typeof n&&this.setAttribute(e,String(n))}get params(){return this.A}get config(){return this.themeProvider.getComponentConfig(this._.type)}get elementConfig(){return this._}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,e){return this.store.set(t,e)}watchStore(t,e){const n=this.store.watch(t,e);return this.unsubscribers.push(n),n}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const e=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:i.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,o;const r=this.getStoreValue("address"),s=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],a=null!==(e=this.params.productId)&&void 0!==e?e:"",c=null!==(n=this.params.options)&&void 0!==n?n:{},l=null!==(o=c.showLabel)&&void 0!==o?o:!![],h=[];if(l){const t=document.createElement("span");t.textContent="Delivers to:",h.push(t)}const u=document.createElement("button");return u.type="button",u.textContent=r.formattedAddress||"Select an address",u.addEventListener("click",async()=>{if(s)return this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a,isIndependentComponent:!![]}),void 0;!s&&a&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(a,i.ADDRESS_INPUT,{productId:a}))}),h.push(u),h}}const ArrowRightIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="arrow-right-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:t=24,height:e=24,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 489 489" class="bag-icon '+n+'" style="'+o+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckboxIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="checkbox-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="chevron-left-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},CloseIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="close-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},CompletedIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 32 32" class="completed-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M20.8847 5.03171C18.521 3.97851 15.8802 3.7176 13.3561 4.28788C10.832 4.85817 8.55988 6.22909 6.87859 8.1962C5.1973 10.1633 4.19693 12.6212 4.02667 15.2033C3.8564 17.7854 4.52537 20.3534 5.93381 22.5242C7.34224 24.695 9.41467 26.3524 11.842 27.2492C14.2694 28.146 16.9216 28.2341 19.4031 27.5004C21.8846 26.7667 24.0625 25.2505 25.6119 23.1779C27.1613 21.1053 27.9992 18.5874 28.0007 15.9997V14.7738C28.0007 14.0374 28.5976 13.4405 29.334 13.4405C30.0704 13.4405 30.6673 14.0374 30.6673 14.7738V16.0005C30.6655 19.1632 29.6414 22.2414 27.7477 24.7746C25.854 27.3077 23.1921 29.1609 20.1592 30.0576C17.1262 30.9544 13.8846 30.8467 10.9179 29.7506C7.95112 28.6546 5.41814 26.6288 3.69673 23.9756C1.97531 21.3224 1.15768 18.1837 1.36578 15.0278C1.57388 11.8719 2.79655 8.86785 4.85146 6.46361C6.90637 4.05937 9.6834 2.38379 12.7684 1.68678C15.8534 0.989768 19.081 1.30866 21.97 2.5959C22.6426 2.89561 22.9449 3.68384 22.6452 4.35647C22.3455 5.0291 21.5573 5.33142 20.8847 5.03171ZM30.2768 4.39085C30.7975 4.91155 30.7975 5.75577 30.2768 6.27647L16.9435 19.6098C16.4228 20.1305 15.5785 20.1305 15.0578 19.6098L11.0578 15.6098C10.5371 15.0891 10.5371 14.2449 11.0578 13.7242C11.5785 13.2035 12.4228 13.2035 12.9435 13.7242L16.0007 16.7814L28.3912 4.39085C28.9119 3.87015 29.7561 3.87015 30.2768 4.39085Z"/>\n </svg>\n '},ErrorInfoIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="error-info-icon '+n+'" style="'+o+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="info-icon '+n+'" style="'+o+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="search-icon '+n+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+o+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="success-icon '+n+'" style="'+o+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="trash-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="warning-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const e=t.target,n=e.value.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const i=/^\d/.test(n);if(n.length<this.minSearchLength||!i)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(n)},300)},this.closeDrawer=async()=>{const t=this.params.productId,e=this.clientConfig.isMobile(),n=this.isIndependentComponent();(e||n)&&this.commands.ui.closeDrawer(),!e&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(D){this.logger.error("Address edit cancellation failed",{error:D instanceof Error?D.message:String(D)})}},this.handleCheckAvailability=async()=>{var t;if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const t=this.getStoreValue("address"),e=(null==t?void 0:t.coordinates.lat)!==this.selectedAddress.coordinates.lat&&(null==t?void 0:t.coordinates.long)!==this.selectedAddress.coordinates.long;e&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(e){this.logger.error("Address selection and availability check failed",{selectedAddress:this.selectedAddress,productId:null!==(t=this.params.productId)&&void 0!==t?t:"",error:e instanceof Error?e.message:String(e)}),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async t=>{const e=t.currentTarget.dataset.suggestionId;if(e)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(e);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:e,address:t.address,coordinates:t.coords,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(n){this.logger.error("Address details retrieval failed",{addressId:e,error:n instanceof Error?n.message:String(n)}),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=t=>{this.container.contains(t.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const t=this.getStoreValue("address");(null==t?void 0:t.formattedAddress)&&(this.selectedAddress=t)}async searchAddresses(t){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const e=await this.commands.address.searchAddresses(t);this.suggestions=e.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(e){this.logger.error("Address search operation failed",{query:t,error:e instanceof Error?e.message:String(e)}),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const t=this.errorContainer.querySelector(".error-text");t&&(t.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const t=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(t),void 0}for(const t of this.suggestions){const e=this.createElement("li",{className:"suggestion-item"}),n=this.createElement("span",{textContent:t.description});e.appendChild(n),e.setAttribute("data-suggestion-id",t.id),e.addEventListener("click",this.handleSuggestionClick),this.suggestionsContainer.appendChild(e)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,e){const n=document.createElement(t);return e&&Object.assign(n,e),n}createErrorContainer(){const t=this.createElement("div",{className:"error-message"});t.style.display="none";const e=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),n=this.createElement("span",{className:"error-text"});return t.appendChild(e),t.appendChild(n),t}createCheckButton(){const t=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return t.addEventListener("click",this.handleCheckAvailability),t}createCancelButton(){const t=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return t.addEventListener("click",this.handleCancel),t}template(){var t,e,n;const i=this.getConfigs("global"),o=null!==(t=this.params.options)&&void 0!==t?t:{},r=null!==(e=o.showLabel)&&void 0!==e?e:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),r){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const s=this.createElement("div",{className:"input-wrapper "+i.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(n=this.selectedAddress)||void 0===n?void 0:n.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.addEventListener("input",this.handleInputChange),s.appendChild(this.inputElement);const a=this.createElement("span");a.className="input-icon",a.innerHTML=SearchIcon({width:16,height:16,className:""}),s.appendChild(a),this.inputContainer.appendChild(s),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const c=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),l=[this.inputContainer,c,this.errorContainer],h=this.createElement("div",{className:"action-buttons"}),u=this.createCancelButton();h.appendChild(u);const p=this.createCheckButton();return h.appendChild(p),l.push(h),document.addEventListener("click",this.handleDocumentClick),l}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchOnlyStorePaths:["cart.rerender"]})}onStoreWatch(t){const e=t.find(t=>"cart.rerender"===t.path);(null==e?void 0:e.value)&&this.rerender()}template(){const t=[],e=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!e){const e=ComponentFactoryService.createElement({type:i.CART_HEADER});t.push(e)}const n=ComponentFactoryService.createElement({type:i.CART_BODY});t.push(n);const o=ComponentFactoryService.createElement({type:i.CART_FOOTER});return t.push(o),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=document.createElement("div");t.className="empty-cart-container";const e=document.createElement("h3");return e.className="empty-cart-content",e.textContent="Your cart is empty",t.appendChild(e),t}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:i.CART_RETAILER,retailerId:t.id})}catch(e){return this.logger.error("Cart retailer component creation failed",{retailerId:t.id,retailerName:t.name,error:e instanceof Error?e.message:String(e)}),document.createElement("div")}}getRetailerElementById(t){return this.container.querySelector('[data-retailer-id="'+t+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const t=this.createEmptyCartElement();this.container.appendChild(t),this.setupEmptyCartListeners()}addLoadingOverlay(){const t=this.getLoadingElement();if(!t){const t=this.createLoadingElement();this.container.appendChild(t)}}removeLoadingOverlay(){const t=this.getLoadingElement();t&&t.remove()}setupEmptyCartListeners(){const t=this.container.querySelector('[data-action="continue-shopping"]');t&&t.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(t,e){const n=this.createRetailerElement(e);n.setAttribute("data-retailer-id",t),this.container.appendChild(n)}removeRetailerElement(t){const e=this.getRetailerElementById(t);e&&e.remove()}updateRetailerElement(t,e){const n=this.getRetailerElementById(t);if(n){const i=this.createRetailerElement(e);i.setAttribute("data-retailer-id",t),n.replaceWith(i)}}hasRetailerDataChanged(t,e){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const e={};for(const[n,i]of Object.entries(t))i&&"object"==typeof i&&i.id&&(e[n]=i);return e}getValidRetailerIds(t){const e=this.getValidRetailers(t);return new Set(Object.keys(e))}onStoreChanged(t){const e=t.find(t=>"cart.retailers"===t.path),n=t.find(t=>"cart.loading"===t.path);if(e){const t=this.getValidRetailers(e.oldValue),n=this.getValidRetailers(e.value),i=this.getValidRetailerIds(e.oldValue),o=this.getValidRetailerIds(e.value),r=i.size,s=o.size,a=this.getValidRetailers(this.getStoreValue("cart.retailers")),c=Object.keys(a).length;if(s>0&&0===c)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===r&&s>0){this.container.innerHTML="";for(const[t,e]of Object.entries(n))this.addRetailerElement(t,e)}else if(r>0&&0===s)this.showEmptyCartState();else if(s>0){for(const t of i)o.has(t)||this.removeRetailerElement(t);for(const e of o){const o=n[e],r=t[e];i.has(e)?this.hasRetailerDataChanged(r,o)&&this.updateRetailerElement(e,o):this.addRetailerElement(e,o)}}else 0===r&&0===s&&this.showEmptyCartState()}if(n){const t=n.value,e=n.oldValue;t!==e&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return n||e,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},e=Object.values(t);if(0===e.length)return this.createEmptyCartElement();const n=[];for(const i of e){const t=this.createRetailerElement(i);t.setAttribute("data-retailer-id",i.id),n.push(t)}return n}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const e=t.some(t=>t.path.includes("cart.items")),n=t.some(t=>t.path.includes("cart.totals")),i=t.some(t=>t.path.includes("cart.fulfillments")),o=t.some(t=>"cart.loading"===t.path),r=t.some(t=>t.path.includes("cart.retailers"));if(e&&this.updateSubtotalItemsCount(),n&&this.subtotalPrice){const t=this.getStoreValue("cart.totals.subtotal")||0;this.subtotalPrice.textContent=""+formatCentToDollarText(t)}(i||n||o||e||r)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const e=this.getStoreValue("cart.items")||{},n=Object.values(e).some(t=>t.updating);if(n)return!![];const i=this.getStoreValue("cart.fulfillments")||{},o=Object.values(i).some(t=>t.updating);if(o)return!![];const r=this.getStoreValue("cart.retailers")||{},s=Object.values(r).some(t=>t.updating);return s?!![]:![]}hasUnmetMinimum(t){var e;const n=t.subtotal;if(t.type===o.SHIPPING){const i=t.fees;if((null===(e=i.individual)||void 0===e?void 0:e.active)&&i.individual.min>0&&n<i.individual.min)return!![]}if(t.type===o.ON_DEMAND){const e=t.fees;if(e.min>0&&n<e.min)return!![]}return![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments")||{};return Object.values(t).some(t=>this.hasUnmetMinimum(t))}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},e=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),n=this.shouldDisableCheckout(),i=t||n||!e;this.checkoutButton.disabled=i,this.checkoutButton.classList.toggle("checkout-btn-disabled",i),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),e=Object.values(t).reduce((t,e)=>t+e.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+e+" item"+(1!==e?"s":"")+"):")}template(){const t=this.getConfigs("global"),e=this.getStoreValue("cart.totals.subtotal")||0,n=[],o=document.createElement("div");o.className="cart-footer-header";const r=document.createElement("div");r.className="cart-footer-items-price";const s=document.createElement("span");s.className="subtotal-text",s.textContent="Subtotal (0 items):",this.subtotalText=s,r.appendChild(s);const a=document.createElement("span");a.className="subtotal-price",a.textContent=formatCentToDollarText(e),this.subtotalPrice=a,r.appendChild(a);const c=document.createElement("p");if(c.textContent="Taxes & fees will be calculated at checkout",c.className="taxes-fees-info",o.appendChild(r),o.appendChild(c),n.push(o),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:i.CART_PROMO_CODE});n.push(t)}const l=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});n.push(l);const h=document.createElement("button");if(h.type="button",h.className="checkout-button",h.addEventListener("click",async t=>this.clientConfig.isBuilder()?(t.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(t.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)),h.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton=h,n.push(h),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});n.push(t)}return n}}const ot={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"},rt="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=ot[e];return n||rt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return rt}}function getCurrentTimeInTimezone$1(t){try{const e=new Date,n=e.getTime(),i=6e4*e.getTimezoneOffset(),o=new Date(n+i),r=new Date(o.toLocaleString("en-US",{timeZone:t})),s=o.getTime()-r.getTime();return new Date(n+s)}catch(e){return new Date}}function getCurrentTimeInUserTimezone(t){const e=detectUserTimezone(t);return getCurrentTimeInTimezone$1(e)}function isDateTimeInRange(t){const{startDate:e,endDate:n,addressState:i}=t;try{const t=getCurrentTimeInUserTimezone(i),o=!e||t>=new Date(e),r=!n||t<=new Date(n);return o&&r}catch(o){return![]}}function filterActiveItems(t,e){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:e}))}function hasActiveItems(t,e){return filterActiveItems(t,e).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,e,n;const o=this.config.layout.drawerHeaderText,r=this.getConfigs("global"),s=document.createElement("div");s.className="cart-header-content";const a=document.createElement("h2");a.className="cart-title",a.textContent=o,s.appendChild(a);const c=document.createElement("button");c.type="button",c.className="cart-header-close-btn",c.innerHTML=CloseIcon({width:16,height:16}),c.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),s.appendChild(c);const l=this.clientConfig.get("promoTicker"),h=null!==(e=null===(t=null==r?void 0:r.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],u=null!=l?l:h,p=this.store.get("address"),m=hasActiveItems(u,null===(n=null==p?void 0:p.address)||void 0===n?void 0:n.state);if(!u.length||!m)return[s];const f=ComponentFactoryService.createElement({context:"cart",type:i.PROMO_CODE_TICKER,tickers:u});return[s,f]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.getItemId()}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}getItemId(){return this.params.itemId}onStoreChanged(t){const e=this.getItemId(),n=t.find(t=>t.path==="cart.items."+e);if(null==n?void 0:n.oldValue){const t=n.oldValue,e=n.value,i=t.attributes.engraving.lines&&t.attributes.engraving.lines.length>0,o=e.attributes.engraving.lines&&e.attributes.engraving.lines.length>0;i!==o&&(this.handleEngravingElement(),this.updateShippingTime())}return![]}handleEngravingElement(){const t=this.getConfigs("global");if(!t.layout.enablePersonalization)return;const e=this.getItemId(),n=this.getStoreValue("cart.items."+e),o=n.attributes.engraving.lines&&n.attributes.engraving.lines.length>0,r=this.container.querySelector(".engraving-view-container");r&&r.remove();const s=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:e,context:"cart",watchStorePaths:["cart.items.{identifier}"]}),a=this.container.querySelector(".item-shipping-container"),c=this.container.querySelector(".cart-item");o?c&&c.insertAdjacentElement("afterend",s):a&&a.appendChild(s)}updateShippingTime(){var t;const e=this.getItemId(),n=this.getStoreValue("cart.items."+e),i=this.getStoreValue("cart.fulfillments."+n.fulfillmentId),o=n.attributes.engraving.lines&&n.attributes.engraving.lines.length>0,r=o?"10 days":(null===(t=null==i?void 0:i.expectation)||void 0===t?void 0:t.short)||"2-3 days",s=this.container.querySelector(".item-shipping span");s&&(s.textContent="Ships in "+r)}template(){var t;const e=this.getItemId(),n=this.getStoreValue("cart.items."+e),o=this.getStoreValue("cart.fulfillments."+n.fulfillmentId),r=n.attributes.engraving.lines&&n.attributes.engraving.lines.length>0,s=r?"Ships in 10 days":(null===(t=null==o?void 0:o.expectation)||void 0===t?void 0:t.detail)||"",a=document.createElement("article");a.className="cart-item";const c=document.createElement("div");c.className="item-image";const l=document.createElement("img");l.src=n.mainImage,l.alt=n.name,c.appendChild(l);const h=document.createElement("div");h.className="item-details";const u=document.createElement("div");u.className="item-header";const p=document.createElement("h3");p.className="item-title",p.textContent=n.name;const m=document.createElement("button");m.className="item-delete",m.innerHTML=TrashIcon({}),m.addEventListener("click",async()=>{await this.commands.cart.removeItem(e)}),u.appendChild(p),u.appendChild(m);const f=document.createElement("div");f.className="item-specs",f.textContent=n.size+", "+n.container;const g=document.createElement("div");g.className="item-shipping-container";const v=document.createElement("div");v.className="item-shipping";const y=document.createElement("span");y.textContent=""+s,v.appendChild(y),g.appendChild(v),h.appendChild(u),h.appendChild(f),h.appendChild(g),a.appendChild(c),a.appendChild(h);const b=[a],x=ComponentFactoryService.createElement({type:i.CART_ITEM_QUANTITY_PRICE,itemId:e});return b.push(x),b}afterRender(){this.handleEngravingElement()}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const e=t.find(t=>"cart.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,e=this.getStoreValue("cart.items."+t);return e||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const e=t.quantity,n=this.getAvailableQuantity(),i=n>0;return{currentQuantity:e,availableQuantity:n,canIncrease:i,canDecrease:!![]}}getAvailableQuantity(){var t;const e=this.getItemStore();if(!e)return 0;const n=e.partNumber,i=e.fulfillmentId,o=this.getStoreValue("cart.items")||{},r=Object.values(o).filter(t=>t.partNumber===n&&t.fulfillmentId===i),s=r.reduce((t,e)=>t+e.quantity,0),a=this.getStoreValue("products."+e.upc)||this.getStoreValue("products."+e.salsifyGrouping);if(!a)return e.maxQuantity-s;const c=null===(t=a.sizes[e.liquidId].attributes)||void 0===t?void 0:t.maxQuantityPerOrder;return!c||c<=0?e.maxQuantity-s:c-s}updateButtonStates(t){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!t.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!t.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!t.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!t.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits();t>0&&!e.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),e=this.getItemStore();if(!e)return document.createElement("div");const n=document.createElement("div");return n.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),this.quantitySpan=document.createElement("span"),this.quantitySpan.className="quantity-value",this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-btn-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(t),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantitySpan),n.appendChild(this.qtyIncreaseButton),n}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const e=document.createElement("div");e.className="item-price-container";const n=document.createElement("span");if(n.className="item-price",n.textContent=formatCentToDollarText(t.price),e.appendChild(n),t.quantity>1){const n=document.createElement("span");n.className="item-price-per-unit",n.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",e.appendChild(n)}return e}template(){const t=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer();t.push(e)}const e=this.createPriceContainer();return t.push(e),t}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path);if(e){const{value:t,oldValue:n}=e,i=(null==n?void 0:n.code)&&!(null==n?void 0:n.error),o=(null==t?void 0:t.code)&&!(null==t?void 0:t.error);if(!i&&o)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!o)return this.container.innerHTML="",this.createInputContainer(),void 0;if(o&&this.promoCodePill&&t.discountAmount!==(null==n?void 0:n.discountAmount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",void 0}}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const e=document.createElement("div");e.classList.add("promo-container"),e.appendChild(this.createPromoInput()),e.appendChild(this.createApplyButton()),t.appendChild(e),this.container.appendChild(t),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),e=t.length>=3,n=this.getStoreValue("cart.loading"),i=this.getStoreValue("cart.promoCode"),o=this.getStoreValue("cart.events")||[],r=hasCartAnyPromoCodeEvents(o);this.applyButton.disabled=!e||n||Boolean(null==i?void 0:i.discountAmount)||this.isApplying||r}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:20},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),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 t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],await this.commands.cart.applyPromoCode(t)}catch(e){this.logger.error("Cart promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,(null==t?void 0:t.code)&&!t.error){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),e}const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");return n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:i.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const e=this.container.querySelectorAll("[data-fulfillment-id]");if(e.length>0){const t=e[e.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const e=this.getFulfillmentInsertionPoint();if(e){const n=this.createFulfillmentElement(t);n.setAttribute("data-fulfillment-id",t);const i=this.getFulfillmentContainer();i&&i.remove(),e.nextSibling?e.parent.insertBefore(n,e.nextSibling):e.parent.appendChild(n)}}removeFulfillmentElement(t){const e=this.getFulfillmentElementById(t);if(e){const t=e.parentElement,n=e.nextElementSibling;e.remove();const i=this.container.querySelectorAll("[data-fulfillment-id]");if(0===i.length){const e=document.createElement("div");e.id="retailer-fulfillment-container",n?t.insertBefore(e,n):t.appendChild(e)}}}handleFulfillmentsUpdate(t,e){const n=new Set(t||[]),i=new Set(e||[]);for(const o of n)i.has(o)||this.removeFulfillmentElement(o);for(const o of i)n.has(o)||this.addFulfillmentElement(o)}setupFulfillmentElements(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],n=this.container.querySelectorAll("[data-fulfillment-id]");for(const o of n)o.remove();let i=this.getFulfillmentContainer();if(!i){const t=this.container.querySelector(".retailer-body-container"),e=this.container.querySelector("#retailer-subtotal-container");i=document.createElement("div"),i.id="retailer-fulfillment-container",t&&e&&t.insertBefore(i,e)}for(const o of e)this.addFulfillmentElement(o)}setupSubtotalElement(){const t=this.getRetailerId(),e=this.container.querySelector("#retailer-subtotal-container");if(e){const n=ComponentFactoryService.createElement({type:i.CART_RETAILER_SUBTOTAL,retailerId:t});e.replaceWith(n)}}onStoreChanged(t){const e=this.getRetailerId(),n="cart.retailers."+e,i=t.find(t=>t.path===n);if(i){const t=i.oldValue,e=i.value,n=(null==t?void 0:t.fulfillments)||[],o=(null==e?void 0:e.fulfillments)||[];JSON.stringify(n)!==JSON.stringify(o)&&this.handleFulfillmentsUpdate(n,o)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),e=this.container.querySelector(".retailer-section");t&&e&&(t.addEventListener("change",()=>{t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed")}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"))}beforeAutoDestroy(){this.logger.debug("Cart retailer component cleanup initiated",{retailerId:this.getRetailerId()})}onAutoDestroy(){this.logger.debug("Cart retailer component successfully destroyed",{retailerId:this.getRetailerId()})}template(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t),n=document.createElement("section");n.className="retailer-section";const i=document.createElement("div");i.className="cart-retailer-header";const o=document.createElement("div");o.className="retailer-info";const r=document.createElement("h2");r.className="section-title",r.textContent=e.name,o.appendChild(r);const s=document.createElement("input");s.type="checkbox",s.id=e.id,s.className="section-toggle",o.appendChild(s);const a=document.createElement("label");a.htmlFor=e.id,a.className="section-header-label";const c=document.createElement("span");c.className="chevron",c.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),a.appendChild(c),o.appendChild(a),i.appendChild(o),n.appendChild(i);const l=document.createElement("div");l.className="retailer-body-container";const h=document.createElement("div");h.id="retailer-fulfillment-container",l.appendChild(h);const u=document.createElement("div");return u.id="retailer-subtotal-container",l.appendChild(u),n.appendChild(l),n}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,e){const n=Object.values(t||{}).filter(t=>t.retailerId===e);let i=0;for(const o of n)i+=o.quantity;return i}template(){const t=this.params.retailerId,e=this.getStoreValue("cart.retailers."+t+".subtotal"),n=this.getStoreValue("cart.items"),i=this.getRetailerItemCount(n,t),o=1===i?"item":"items",r=document.createElement("h3");r.className="retailer-subtotal-header",r.textContent="Subtotal ("+i+" "+o+"):";const s=document.createElement("span");return s.className="retailer-subtotal-amount",s.textContent=formatCentToDollarText(e),[r,s]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.isPresaleLocked","checkout.presaleExpiresAt"],watchOnlyStorePaths:["checkout.rerender"]})}onStoreWatch(t){const e=t.find(t=>"checkout.rerender"===t.path);(null==e?void 0:e.value)===!![]&&this.rerender("CheckoutComponentRerender")}template(){var t,e,n;const o=this.store.get("checkout.isPresaleLocked"),r=this.store.get("checkout.presaleExpiresAt"),s=this.getConfigs("global"),a=this.clientConfig.get("promoTicker"),c=null!==(e=null===(t=null==s?void 0:s.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],l=null!=a?a:c,h=this.store.get("address"),u=hasActiveItems(l,null===(n=null==h?void 0:h.address)||void 0===n?void 0:n.state),p=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),m=o&&r,f=document.createElement("div");f.classList.add("checkout-container"),p&&f.classList.add("no-header"),this.params.isIndependentComponent&&f.classList.add("independent");const g=ComponentFactoryService.createElement({type:i.CHECKOUT_INFORMATION_SECTION});f.appendChild(g);const v=ComponentFactoryService.createElement({type:i.CHECKOUT_SUMMARY_SECTION});if(f.appendChild(v),!m&&(!l.length||!u)&&p)return[f];const y=document.createElement("div");if(y.classList.add("checkout-header-wrapper"),!p){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_HEADER});y.appendChild(t)}if(l.length&&u&&!m){const t=ComponentFactoryService.createElement({context:"checkout",type:i.PROMO_CODE_TICKER,tickers:l});y.appendChild(t)}if(m){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_PRESALE_COUNTDOWN});y.appendChild(t)}return[y,f]}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.isPresaleLocked"),e=this.getConfigs("checkout");let n=null;if(!t){n=document.createElement("button"),n.classList.add("checkout-header-button"),n.setAttribute("aria-label","Back to Cart"),n.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(i.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),n.appendChild(t)}const o=document.createElement("h1");o.textContent=(null==e?void 0:e.layout.drawerHeaderText)||"Checkout",o.classList.add("checkout-header-title"),o.setAttribute("aria-label","Checkout Page");const r=document.createElement("button");return r.innerHTML=CloseIcon({width:16,height:16}),r.classList.add("checkout-header-button-close"),r.setAttribute("aria-label","Close Checkout"),r.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),n?[n,o,r]:[o,r]}}class CheckoutInformationSectionComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift"]})}onStoreWatch(t){const e=t.find(t=>"checkout.isGift"===t.path);e&&this.handleBuyerInformationVisibility(e.value)}handleBuyerInformationVisibility(t){const e=this.container.querySelector("#buyer-information-container");if(t&&!e){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_BUYER_INFORMATION_FORM});t.id="buyer-information-container";const e=this.container.querySelector(".checkout-delivery-information");e&&e.insertAdjacentElement("afterend",t)}else!t&&e&&setTimeout(()=>{e.remove()},300)}template(){const t=[],e=ComponentFactoryService.createElement({type:i.CHECKOUT_DELIVERY_INFORMATION_FORM});t.push(e);const n=ComponentFactoryService.createElement({type:i.CHECKOUT_PAYMENT_FORM});t.push(n);const o=ComponentFactoryService.createElement({type:i.CHECKOUT_BILLING_FORM});return t.push(o),t}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presaleExpiresAt","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var e;const n=t.find(t=>"checkout.presaleExpiresAt"===t.path);if(null==n?void 0:n.value)return this.updateExpiresAt(n.value),!![];const i=t.find(t=>"ui.drawer"===t.path);return(null===(e=null==i?void 0:i.value)||void 0===e?void 0:e.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const t=this.store.get("checkout.presaleExpiresAt");t&&this.updateExpiresAt(t),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var t,e;const n=[".drawer-content"];for(const o of n){const e=null===(t=this.rootElement)||void 0===t?void 0:t.closest(o);if(e&&this.isScrollable(e))return e}let i=null===(e=this.rootElement)||void 0===e?void 0:e.parentElement;for(;i&&i!==document.body;){if(this.isScrollable(i))return i;i=i.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var t,e;if(!this.scrollContainer)return;const n=this.scrollContainer.scrollTop,i=70,o=10;!this.isCurrentlyScrolled&&n>i?(this.isCurrentlyScrolled=!![],null===(t=this.rootElement)||void 0===t||t.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&n<o&&(this.isCurrentlyScrolled=![],null===(e=this.rootElement)||void 0===e||e.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(t){const e=window.getComputedStyle(t),n=e.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===n||"scroll"===n||"overlay"===n)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(t){this.stopCountdown();try{if(this.expiresAt=new Date(t),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:t}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const e=new Date,n=Math.floor((this.expiresAt.getTime()-e.getTime())/1e3);n<this.totalDuration&&(this.totalDuration=Math.max(n,240)),this.startCountdown()}catch(e){this.logger.error("Failed to parse presale expiration date",{expiresAtString:t,error:e instanceof Error?e.message:String(e)}),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const t=new Date,e=Math.max(0,this.expiresAt.getTime()-t.getTime()),n=e/1e3,i=this.totalDuration-n,o=Math.max(0,Math.min(100,i/this.totalDuration*100)),r=n<60;if(r!==this.isUnderOneMinute){this.isUnderOneMinute=r;const t=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==t||t.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==t||t.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}const s=this.rootElement.querySelector("[data-timer]");s&&(s.textContent=this.formatTime(e));const a=this.rootElement.querySelector("[data-progress-fill]");a&&(a.style.width=o+"%"),0===e&&this.handleExpire()}formatTime(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),i=e%60,o=Math.floor(t%1e3/10);return n.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")}handleExpire(){this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer()}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const e=document.createElement("div");e.classList.add("checkout-presale-text-container");const n=document.createElement("div");n.classList.add("checkout-presale-heading");const i=document.createElement("h2");i.textContent="LIMITED PRE-ORDER:";const o=document.createElement("div");o.classList.add("checkout-presale-timer"),o.setAttribute("data-timer",""),o.textContent="00:00:00",n.appendChild(i),n.appendChild(o);const r=document.createElement("p");r.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",r.classList.add("checkout-presale-subtitle"),e.appendChild(n),e.appendChild(r);const s=document.createElement("div");s.className="checkout-presale-progress-bar",s.setAttribute("data-progress","");const a=document.createElement("div");return a.className="checkout-presale-progress-fill",a.setAttribute("data-progress-fill",""),a.style.width="0%",s.appendChild(a),t.appendChild(e),t.appendChild(s),t}}const st=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],at={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(t,e){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(e)?e:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(e)?e:null:"class"===t?e.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():e.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const e=t.textContent||"",n=e.replace(/<[^>]*>/g,"");if(n.trim()){const t=document.createTextNode(n);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const e=t,n=e.tagName.toLowerCase();if(st.includes(n)){const t=document.createElement(n),i=at[n]||[];for(const n of Array.from(e.attributes)){const e=n.name.toLowerCase();if(i.includes(e)){const i=sanitizeAttributeValue(e,n.value);null!==i&&t.setAttribute(e,i)}}"a"===n&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const n of Array.from(e.childNodes)){const e=cleanNode(n);e&&t.appendChild(e)}return t}const i=document.createDocumentFragment();for(const t of Array.from(e.childNodes)){const e=cleanNode(t);e&&i.appendChild(e)}return i.childNodes.length>0?i:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const e=new DOMParser,n=e.parseFromString(t,"text/html"),i=n.querySelector("parsererror");if(i)return console.warn("HTML parsing error detected"),"";const o=document.createDocumentFragment();for(const t of Array.from(n.body.childNodes)){const e=cleanNode(t);e&&o.appendChild(e)}const r=document.createElement("div");return r.appendChild(o),r.innerHTML}catch(e){return console.error("HTML sanitization error:",e),""}}class CheckoutSummarySectionComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const e=t.find(t=>"checkout.amounts"===t.path);if(e){const t=this.getStoreValue("checkout"),e=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&e>0)}}updateZeroAmountElement(t){const e=this.container.querySelector(".checkout-zero-amount-container");if(t&&!e){const t=document.createElement("div");t.classList.add("checkout-zero-amount-container"),t.textContent="Credit card required to complete order (even when fully covered by gift card)";const e=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");e&&e.after(t)}else!t&&e&&e.remove()}afterRender(){const t=this.getStoreValue("checkout.amounts");t&&this.updateZeroAmountElement(0===t.total)}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,e=this.config.layout.smsOptIn;if(!t.show&&!e.show)return null;const n=document.createElement("div");if(n.classList.add("checkout-marketing-opt-ins-container"),t.show){const e=document.createElement("div");let i;e.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const o=document.createElement("span");o.id="emailOptIn",o.classList.add("checkout-checkbox-visual"),i&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),o.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canEmail"),o.classList.toggle("checked")});const r=document.createElement("label");r.setAttribute("for","emailOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(t.text),r.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canEmail"),o.classList.toggle("checked"))}),e.appendChild(o),e.appendChild(r),n.appendChild(e)}if(e.show){const t=document.createElement("div");let i;t.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canSms");const o=document.createElement("span");o.classList.add("checkout-checkbox-visual"),o.id="smsOptIn",i&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),o.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canSms"),o.classList.toggle("checked")});const r=document.createElement("label");r.setAttribute("for","smsOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(e.text),r.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canSms"),o.classList.toggle("checked"))}),t.appendChild(o),t.appendChild(r),n.appendChild(t)}return n}hasOnDemandOrder(){const t=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}template(){var t;const e=[],n=this.getConfigs("global"),o=this.getConfigs("checkout"),r=this.getConfigs("global"),s=o.layout.allowGiftCards,a=null===(t=null==r?void 0:r.layout)||void 0===t?void 0:t.allowPromoCodes,c=document.createElement("div");c.classList.add("section-title-container");const l=document.createElement("h3");l.textContent="Order Summary",l.classList.add("section-title"),c.appendChild(l),e.push(c);const h=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEMS});e.push(h);const u=document.createElement("div");u.classList.add("checkout-separator");const p=document.createElement("div");if(p.classList.add("checkout-separator"),e.push(u),s||a){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_PC_GC});e.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_TIPS});e.push(t),e.push(p)}const m=document.createElement("div");m.classList.add("section-title-container");const f=document.createElement("h3");f.textContent="100% Secure Payments",f.classList.add("disclaimer-header"),m.appendChild(f);const g=document.createElement("p");g.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",g.classList.add("disclaimer-description"),m.appendChild(g),e.push(m);const v=ComponentFactoryService.createElement({type:i.CHECKOUT_AMOUNTS});e.push(v);const y=ComponentFactoryService.createElement({type:i.CHECKOUT_PLACE_ORDER_BUTTON});e.push(y);const b=this.marketingOptInsContainer();if(b&&e.push(b),o.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(o.layout.legalMessage.text);const i=document.createElement("div");i.classList.add("checkout-separator"),e.push(t),e.push(n),e.push(i)}if(n.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});e.push(t)}return e}}class CheckoutBillingFormComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.billingSameAsShipping"]})}async handleFirstNameChange(t){this.commands.checkout.updateBillingInfo(V.firstName,t),this.pubSub.publishForm(n.BILLING,{fieldName:V.firstName,fieldValue:t})}async handleLastNameChange(t){this.commands.checkout.updateBillingInfo(V.lastName,t),this.pubSub.publishForm(n.BILLING,{fieldName:V.lastName,fieldValue:t})}async handleEmailChange(t){this.commands.checkout.updateBillingInfo(V.email,t),this.pubSub.publishForm(n.BILLING,{fieldName:V.email,fieldValue:t})}async handlePhoneChange(t){this.commands.checkout.updateBillingInfo(V.phone,t),this.pubSub.publishForm(n.BILLING,{fieldName:V.phone,fieldValue:t})}async handleCompanyChange(t){this.commands.checkout.updateBillingInfo(V.company,t),this.pubSub.publishForm(n.BILLING,{fieldName:V.company,fieldValue:t})}async handleAddressOneChange(t){this.commands.checkout.updateBillingInfo(V.addressOne,t),this.pubSub.publishForm(n.BILLING,{fieldName:V.addressOne,fieldValue:t})}async handleAddressTwoChange(t){this.commands.checkout.updateBillingInfo(V.addressTwo,t),this.pubSub.publishForm(n.BILLING,{fieldName:V.addressTwo,fieldValue:t})}async handleCityChange(t){this.commands.checkout.updateBillingInfo(V.city,t),this.pubSub.publishForm(n.BILLING,{fieldName:V.city,fieldValue:t})}async handleStateChange(t){this.commands.checkout.updateBillingInfo(V.state,t),this.pubSub.publishForm(n.BILLING,{fieldName:V.state,fieldValue:t})}async handleZipCodeChange(t){this.commands.checkout.updateBillingInfo(V.zipCode,t),this.pubSub.publishForm(n.BILLING,{fieldName:V.zipCode,fieldValue:t})}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.billingSameAsShipping"),e=document.createElement("div");e.classList.add("checkout-billing-same-as-shipping-toggle-container");const n=document.createElement("div");n.classList.add("checkout-checkbox-container");const i=document.createElement("span");i.id="billingSameAsShipping",i.classList.add("checkout-checkbox-visual"),t&&i.classList.add("checked"),i.innerHTML=CheckboxIcon({width:16,height:16}),e.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()});const o=document.createElement("label");return o.textContent="Billing address same as shipping address",o.setAttribute("for","billingSameAsShipping"),o.classList.add("billing-checkbox-label"),n.appendChild(i),n.appendChild(o),e.appendChild(n),e}template(){const t=this.getStoreValue("checkout.billingSameAsShipping"),e=[],n=this.billingSameAsShippingToggle();if(e.push(n),t)return e;const o=document.createElement("div");o.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Your billing info",r.classList.add("section-title"),o.appendChild(r);const s=document.createElement("p");s.textContent="Provide the info relevant to your payment method",s.classList.add("section-subtitle"),o.appendChild(s),e.push(o);const a=document.createElement("div");a.classList.add("section-form-container");const c=document.createElement("div");c.classList.add("checkout-two-col-container");const l=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleFirstNameChange.bind(this),storePath:"billing.firstName"});c.appendChild(l);const h=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleLastNameChange.bind(this),storePath:"billing.lastName"});c.appendChild(h),a.appendChild(c);const u=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:V.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:this.handleEmailChange.bind(this),storePath:"billing.email"});a.appendChild(u);const p=document.createElement("div");p.classList.add("checkout-two-col-container");const m=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:V.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:this.handlePhoneChange.bind(this),storePath:"billing.phone"});p.appendChild(m);const f=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.company,label:"Company (optional)",autocomplete:!![],onChange:this.handleCompanyChange.bind(this)});p.appendChild(f),a.appendChild(p);const g=document.createElement("div");g.classList.add("checkout-two-col-container");const v=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:this.handleAddressOneChange.bind(this),storePath:"billing.addressOne"});g.appendChild(v);const y=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.addressTwo,label:"Apartment, suite, etc. (optional)",onChange:this.handleAddressTwoChange.bind(this)});g.appendChild(y),a.appendChild(g);const b=document.createElement("div");b.classList.add("checkout-three-col-container");const x=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:this.handleCityChange.bind(this),storePath:"billing.city"});b.appendChild(x);const w=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:t=>t&&2===t.length&&/^[A-Z]{2}$/.test(t)?null:"State must be 2 uppercase characters"},onChange:this.handleStateChange.bind(this),storePath:"billing.state"});b.appendChild(w);const C=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:this.handleZipCodeChange.bind(this),storePath:"billing.zipCode"});return b.appendChild(C),a.appendChild(b),e.push(a),e}}class CheckoutBuyerInformationComponent extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}async handleFirstNameChange(t){this.commands.checkout.updateCustomerInfo(G.firstName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.firstName,fieldValue:t})}async handleLastNameChange(t){this.commands.checkout.updateCustomerInfo(G.lastName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.lastName,fieldValue:t})}async handleEmailChange(t){this.commands.checkout.updateCustomerInfo(G.email,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.email,fieldValue:t})}async handlePhoneChange(t){this.commands.checkout.updateCustomerInfo(G.phone,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.phone,fieldValue:t})}async handleCompanyChange(t){this.commands.checkout.updateCustomerInfo(G.company,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.company,fieldValue:t})}async handleDobChange(t){this.commands.checkout.updateCustomerInfo(G.birthDate,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.birthDate,fieldValue:t})}template(){const t=this.store.get("checkout.customer"),e=[],n=document.createElement("div");n.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Buyer Information",o.classList.add("section-title"),n.appendChild(o);const r=document.createElement("p");r.textContent="Buyer information is used to process your order and for delivery purposes.",r.classList.add("section-subtitle"),n.appendChild(r),e.push(n);const s=document.createElement("div");s.classList.add("section-form-container");const a=document.createElement("div");a.classList.add("checkout-two-col-container");const c=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:G.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:"customer.firstName"});a.appendChild(c);const l=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:G.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:this.handleLastNameChange.bind(this),storePath:"customer.lastName"});a.appendChild(l),s.appendChild(a);const h=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:G.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:this.handleCompanyChange.bind(this)});s.appendChild(h);const u=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:G.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:this.handleEmailChange.bind(this),storePath:"customer.email"});s.appendChild(u);const p=document.createElement("div");p.classList.add("checkout-two-col-container");const m=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:G.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:this.handlePhoneChange.bind(this),storePath:"customer.phone"});p.appendChild(m);const f=ComponentFactoryService.createElement({type:i.BIRTHDATE_INPUT,inputType:"date",name:G.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:this.handleDobChange.bind(this),storePath:"customer.birthDate"});return p.appendChild(f),s.appendChild(p),e.push(s),e}}class CheckoutDeliveryInformationComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.isGift","address.formattedAddress","checkout.onDemandFulfillmentTipInfo"]})}get hostClasses(){return["checkout-delivery-information"]}hasOnDemandFulfillments(){const t=this.store.get("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}async handleDeliveryInstructionsChange(t){await this.commands.checkout.updateDeliveryInstructions(t)}async handleFirstNameChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(U.firstName,t),this.pubSub.publishForm(n.GIFT,{fieldName:U.firstName,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(G.firstName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.firstName,fieldValue:t}))}async handleLastNameChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(U.lastName,t),this.pubSub.publishForm(n.GIFT,{fieldName:U.lastName,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(G.lastName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.lastName,fieldValue:t}))}async handleEmailChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(U.email,t),this.pubSub.publishForm(n.GIFT,{fieldName:U.email,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(G.email,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.email,fieldValue:t}))}async handlePhoneChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(U.phone,t),this.pubSub.publishForm(n.GIFT,{fieldName:U.phone,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(G.phone,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.phone,fieldValue:t}))}async handleAddressTwoChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(U.addressTwo,t),this.pubSub.publishForm(n.GIFT,{fieldName:U.addressTwo,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(G.addressTwo,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.addressTwo,fieldValue:t}))}async handleCompanyChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(U.company,t),this.pubSub.publishForm(n.GIFT,{fieldName:U.company,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(G.company,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.company,fieldValue:t}))}async handleBirthdateChange(t){this.commands.checkout.updateCustomerInfo(G.birthDate,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:G.birthDate,fieldValue:t})}async handleGiftMessageChange(t){this.commands.checkout.updateGiftInfo(U.message,t),this.pubSub.publishForm(n.GIFT,{fieldName:U.message,fieldValue:t})}template(){const t=this.getConfigs("global"),e=this.getStoreValue("checkout.isGift")||![],n=this.store.get("checkout.giftRecipient"),o=this.store.get("checkout.customer"),r=this.store.get("address.formattedAddress"),s=e?n:o,a=[],c=document.createElement("div");c.classList.add("delivery-header-container");const l=document.createElement("div");l.classList.add("delivery-header-content");const h=document.createElement("div");h.classList.add("delivery-title-container");const u=document.createElement("h3");u.textContent="Deliver to",u.classList.add("delivery-title");const p=document.createElement("p");p.textContent="Package recipient must be 21+",p.classList.add("delivery-subtitle"),h.appendChild(u),h.appendChild(p);const m=document.createElement("div");m.classList.add("gift-toggle-container");const f=document.createElement("div");f.classList.add("gift-label-wrapper");const g=document.createElement("span");g.textContent="Send as Gift? (Free)",g.classList.add("gift-toggle-label"),f.appendChild(g);const v=document.createElement("span");v.textContent="With personalized note & gift receipt.",v.classList.add("gift-toggle-description"),f.appendChild(v);const y=document.createElement("div");y.classList.add("toggle-switch"),y.classList.toggle("active",e);const b=document.createElement("div");b.classList.add("toggle-slider"),y.appendChild(b),m.appendChild(f),m.appendChild(y),y.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),c.appendChild(m),c.appendChild(h),a.push(c);const x=document.createElement("div");x.classList.add("section-form-container");const w=document.createElement("div");w.classList.add("checkout-two-col-container");const C=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?U.firstName:G.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:s.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:e?"giftRecipient.firstName":"customer.firstName"});w.appendChild(C);const k=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?U.lastName:G.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:s.lastName,onChange:this.handleLastNameChange.bind(this),storePath:e?"giftRecipient.lastName":"customer.lastName"});w.appendChild(k),x.appendChild(w);const S=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?U.company:G.company,label:"Company (optional)",autocomplete:!![],value:s.company,onChange:this.handleCompanyChange.bind(this),storePath:e?"giftRecipient.company":"customer.company"});x.appendChild(S);const E=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:e?U.email:G.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:s.email,onChange:this.handleEmailChange.bind(this),storePath:e?"giftRecipient.email":"customer.email"});x.appendChild(E);const I=document.createElement("div");I.classList.add("checkout-two-col-container");const T=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:e?U.phone:G.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:s.phone,onChange:this.handlePhoneChange.bind(this),storePath:e?"giftRecipient.phone":"customer.phone"});if(!e){const t=ComponentFactoryService.createElement({type:i.BIRTHDATE_INPUT,inputType:"date",name:G.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:formatISODateToMMDDYYYY(s.birthDate),onChange:this.handleBirthdateChange.bind(this),storePath:"customer.birthDate"});I.appendChild(T),I.appendChild(t),x.appendChild(I)}e&&(I.remove(),x.appendChild(T));const P=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:r,disabled:!![],className:"disabled-input",validation:{required:!![]}});x.appendChild(P);const F=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?U.addressTwo:G.addressTwo,label:"Apt, suite, etc. (optional)",value:s.addressTwo,onChange:this.handleAddressTwoChange.bind(this),storePath:e?"giftRecipient.addressTwo":"customer.addressTwo"});if(x.appendChild(F),this.hasOnDemandFulfillments()){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const n=document.createElement("label");n.textContent="Delivery Instructions",n.setAttribute("for","delivery_instructions");const i=document.createElement("textarea");i.id="delivery_instructions",i.name="delivery_instructions",i.rows=4,i.value=this.store.get("checkout.deliveryInstructions")||"",i.addEventListener("blur",async t=>{await this.handleDeliveryInstructionsChange(t.target.value)});const o=document.createElement("p");o.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",o.classList.add("textarea-message-disclaimer"),e.appendChild(n),e.appendChild(i),e.appendChild(o),x.appendChild(e)}if(e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Gift Message*",i.setAttribute("for",U.message);const o=document.createElement("textarea");o.name=U.message,o.id=U.message,o.rows=4,o.value=n.message||"",o.addEventListener("input",async t=>{await this.handleGiftMessageChange(t.target.value)});const r=document.createElement("p");r.textContent="Your gift message will be emailed to the recipient along with delivery details.",r.classList.add("textarea-message-disclaimer"),e.appendChild(i),e.appendChild(o),e.appendChild(r),x.appendChild(e)}return a.push(x),a}}class CheckoutPaymentFormComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchStorePaths:["checkout.payment.sendSubmitSignal"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![]}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,e=null;for(;t&&t!==document.body;){const n=t.hasAttribute("checkout"),o=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT),r=t.hasAttribute("drawer"),s=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(i.DRAWER),a="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||o&&r&&s&&a)return this.rootComponent=t,t;e=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){await this.commands.checkout.getPaymentSession();const t=this.store.get("checkout.payment"),e=this.getConfigs("global");return{publishableKey:t.key,clientSecret:t.secret,appearance:{theme:"stripe",variables:{fontFamily:e.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:e.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===e.layout.inputFieldStyle?"none":"1px solid "+e.theme.accentColor,backgroundColor:"filled"===e.layout.inputFieldStyle?e.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t;if(this.isCreatingStripeForm)return this.logger.debug("Stripe form creation already in progress, skipping"),void 0;const e=this.findRootComponent();if(!e)return;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.debug("Stripe form already exists and is connected, skipping creation"),void 0;const n=e.querySelectorAll('[slot="'+q+'"]');if(n.length>0)for(const i of n)i.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:i.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.stripeFormElement.setAttribute("slot",q),e.appendChild(this.stripeFormElement),this.setupStripeFormEventListeners()}catch(o){this.logger.error("Stripe form element creation failed",{error:o instanceof Error?o.message:String(o)}),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}async afterRender(){this.removeExistingStripeForm(),await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",async t=>{await this.commands.checkout.updateStripeFormStatus(t.detail.status)}),this.stripeFormElement.addEventListener("lce:s:confirmPaymentSession",async t=>{try{const{confirmationTokenId:e,setupIntentId:n}=t.detail;await this.commands.checkout.confirmPaymentSession(e,n)}catch(e){this.logger.error("Failed to confirm payment session",{error:e instanceof Error?e.message:String(e)}),this.store.set("checkout.payment.sendSubmitSignal",![])}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const e=await this.doStripeConfig(),n=new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:e}});null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(n)}catch(e){this.logger.error("Failed to refresh payment session",{error:e instanceof Error?e.message:String(e)})}})}onStoreChanged(t){const e=t.some(t=>"checkout.payment.sendSubmitSignal"===t.path&&t.value===!![]);if(e&&this.stripeFormElement){const t=new CustomEvent("lce:s:submit");this.stripeFormElement.dispatchEvent(t)}return![]}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],null===(t=super.disconnected)||void 0===t||t.call(this)}template(){const t=[],e=document.createElement("div");e.classList.add("section-title-container");const n=document.createElement("h3");n.textContent="Payment",n.classList.add("section-title"),e.appendChild(n);const i=document.createElement("p");i.textContent="All transactions are secure and encrypted.",i.classList.add("section-subtitle"),e.appendChild(i),t.push(e);const o=document.createElement("slot");return o.setAttribute("name",q),t.push(o),t}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.O=![],this.N=null,this.M=null,this.R=null,this.B=![],this.L=![],this.j=![]}async initialize({data:t}){if(this.O)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.O=!![],await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.N=window.Stripe(t.publishableKey),this.M=this.N.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.R=this.M.create("payment",t.elementOptions),this.R.mount(this),this.R.on("change",async t=>{const e=!!t.error,n=t.complete,i=e?t.error.message:null;this.L=n,await this.updateStripeFormStatus({isComplete:n,hasError:e,errorMessage:i,isProcessing:this.B})}),this.R.on("focus",async()=>{await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:this.B})}),this.j=![]}catch(t){throw await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",this.handleSubmitEvent.bind(this)),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this))}async handleSubmitEvent(){await this.handleSubmit()}async handleRefreshSession(t){const{stripeConfig:e}=t.detail;e&&(this.q=e,await this.refreshPaymentSession())}async handleSubmit(){if(!this.B){this.B=!![],await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:!![]});try{if(!this.L)throw new Error("Please complete all required payment fields");this.j&&await this.requestSessionRefresh();const t=await this.createConfirmationTokenId(),e=this.q.clientSecret,n=e.split("_secret_")[0],i=new CustomEvent("lce:s:confirmPaymentSession",{detail:{confirmationTokenId:t,setupIntentId:n}});this.dispatchEvent(i),this.j=!![],await this.updateStripeFormStatus({isComplete:!![],isProcessing:![],hasError:![],errorMessage:null})}catch(t){this.j||(this.j=!![]),await this.updateStripeFormStatus({isComplete:this.L,isProcessing:![],hasError:!![],errorMessage:(null==t?void 0:t.message)||"An unexpected error with payment occurred"})}finally{this.B=![]}}}async requestSessionRefresh(){const t=new CustomEvent("lce:s:requestSessionRefresh");return this.dispatchEvent(t),new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",K),e(new Error("Session refresh timeout"))},5e3),K=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",K),t()};this.addEventListener("lce:s:refreshSession",K,{once:!![]})})}async refreshPaymentSession(){try{this.M&&this.M.update({clientSecret:this.q.clientSecret}),this.j=![]}catch(D){await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to refresh payment session"})}}async updateStripeFormStatus(t){const e=new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t}});this.dispatchEvent(e)}async createConfirmationTokenId(){if(!this.M)throw new Error("Elements must be provided");try{const{error:t}=await this.M.submit();if(t)throw new Error(t.message);const e={elements:this.M,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:n,confirmationToken:i}=await this.N.createConfirmationToken(e);if(n)throw new Error(n.message);if(!i||!i.id)throw new Error("Confirmation token not found");return i.id}catch(t){throw new Error(t.message)}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,e;try{this.R&&(this.R.unmount(),this.R=null),this.M&&(null===(e=(t=this.M).destroy)||void 0===e?void 0:e.call(t),this.M=null),this.N=null,this.B=![],this.L=![],this.j=![],this.O=![],this.isConnected&&await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}catch(n){console.warn("Error during Stripe form cleanup:",n)}}loadStripeJS(){return new Promise((t,e)=>{const n=document.createElement("script");n.src="https://js.stripe.com/basil/stripe.js",n.onload=()=>t(),n.onerror=()=>e(new Error("Failed to load Stripe.js")),document.head.appendChild(n)})}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,e,n;const i=this.getStoreValue("checkout"),o=Boolean(i.promoCode),r=Boolean(null===(t=i.giftCards)||void 0===t?void 0:t.length),s=this.getConfigs("global"),a=Object.values(i.items||{}),c=[],l=document.createElement("div");l.classList.add("checkout-amount-line");const h=document.createElement("span");h.textContent="Subtotal ("+a.length+" item"+(a.length>1?"s":"")+")",l.appendChild(h);const u=document.createElement("span");u.textContent=formatCentToDollarText(i.amounts.subtotal),l.appendChild(u),c.push(l);const p=document.createElement("div");p.classList.add("checkout-amount-line");const m=document.createElement("span");m.textContent="Shipping",p.appendChild(m);const f=document.createElement("span");f.textContent=formatCentToDollarText(i.amounts.shipping),p.appendChild(f),c.push(p);const g=document.createElement("div");g.classList.add("checkout-amount-line");const v=document.createElement("span");v.textContent="Delivery",g.appendChild(v);const y=document.createElement("span");if(y.textContent=formatCentToDollarText(i.amounts.delivery),g.appendChild(y),c.push(g),(null===(e=null==i?void 0:i.amounts)||void 0===e?void 0:e.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Engraving",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.engraving),t.appendChild(n),c.push(t)}const b=document.createElement("div");b.classList.add("checkout-amount-line");const x=document.createElement("span");x.textContent="Taxes & Fees",b.appendChild(x);const w=document.createElement("span");if(w.textContent=formatCentToDollarText(i.amounts.tax+i.amounts.service+i.amounts.platform),b.appendChild(w),c.push(b),o){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Promo Code ("+(null===(n=i.promoCode)||void 0===n?void 0:n.code)+")",t.appendChild(e);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(i.amounts.discounts),t.appendChild(o),c.push(t)}if(r){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Gift Cards Applied",t.appendChild(e);const n=document.createElement("span");n.textContent="-"+formatCentToDollarText(i.amounts.giftCards),t.appendChild(n),c.push(t)}const C=document.createElement("div");C.classList.add("checkout-amount-line");const k=document.createElement("span");k.textContent="Tips",C.appendChild(k);const S=document.createElement("span");S.textContent=formatCentToDollarText(i.amounts.tip),C.appendChild(S),c.push(C);const E=document.createElement("div");E.classList.add("checkout-separator"),C.appendChild(E),c.push(E);const I=document.createElement("div");I.classList.add("checkout-amount-total");const T=document.createElement("span");T.textContent="Total",I.appendChild(T);const P=document.createElement("span");P.textContent=formatCentToDollarText(i.amounts.total),I.appendChild(P),c.push(I);const F=this.store.get("checkout.isPresaleLocked");if(F){const t=document.createElement("div");t.classList.add("checkout-amount-due");const e=document.createElement("span");e.textContent="Amount due today",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(0),t.appendChild(n),c.push(t);const i=document.createElement("div");i.classList.add("checkout-presale-locked-message");const o=htmlStringToElement(InfoIcon({color:s.theme.defaultTextColor}));i.appendChild(o);const r=document.createElement("p");r.textContent="Pre-ordered items will be charged when shipped.",i.appendChild(r),c.push(i)}return c}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){const t=[],e=this.getConfigs("configurations"),n=this.getConfigs("global"),o=this.getConfigs("checkout"),r=this.config.layout.exitUrl||window.location.host,s=this.config.layout.thankYouButtonText||"Continue Shopping";if(this.config.theme.checkoutCompleted.customLogo){const n=document.createElement("div");n.classList.add("checkout-completed-header-container");const i=document.createElement("img");i.src=this.config.theme.checkoutCompleted.customLogo,i.alt=e.partnerName+" Logo",n.appendChild(i),t.push(n)}const a=document.createElement("div");a.classList.add("checkout-completed-section-container");const c=document.createElement("div");c.classList.add("checkout-completed-title-container");const l=document.createElement("div");l.innerHTML=CompletedIcon({width:32,height:32,className:"checkout-completed-logo"}),c.appendChild(l);const h=document.createElement("div");h.classList.add("checkout-completed-title-section");const u=document.createElement("h3");u.innerHTML=this.config.theme.checkoutCompleted.customText||"Thank You for Your Order!",h.appendChild(u);const p=document.createElement("p");p.textContent="Your payment has been successfully processed.",h.appendChild(p),c.appendChild(h),a.appendChild(c);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 k=document.createElement("span");k.textContent="** "+this.params.cardLast4,w.appendChild(k),m.appendChild(w),a.appendChild(m);const S=document.createElement("div");S.classList.add("checkout-completed-sub-section");const E=document.createElement("h3");E.textContent="Confirmation email sent",S.appendChild(E);const I=document.createElement("p");I.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<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>.",S.appendChild(I),a.appendChild(S),t.push(a);const T=document.createElement("div");T.classList.add("checkout-completed-section-container");const P=document.createElement("button");P.type="button";const F=document.createElement("span");F.textContent=s,P.appendChild(F);const D=htmlStringToElement(ArrowRightIcon({width:16,height:16}));P.appendChild(D),P.addEventListener("click",()=>{window.location.href=r}),T.appendChild(P),t.push(T);const A=document.createElement("div");A.classList.add("checkout-completed-section-container");const _=document.createElement("div");_.classList.add("checkout-completed-help-section"),A.appendChild(_);const N=document.createElement("p");N.textContent="Questions about your order? Contact us at "+e.supportEmail,_.appendChild(N);const z=document.createElement("p"),M=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(z.textContent="Order placed on "+M,_.appendChild(z),t.push(A),o.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(o.layout.legalMessage.text);const i=document.createElement("div");i.classList.add("checkout-separator"),t.push(e),t.push(n),t.push(i)}if(n.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});t.push(e)}return t}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(t){var e;const n=t.find(t=>"checkout.giftCards"===t.path),i=t.find(t=>"checkout.loading"===t.path);n&&n.value.length>((null===(e=n.oldValue)||void 0===e?void 0:e.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),i&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),e=t.length>=3&&t.length<=20,n=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!e||n||Boolean(i)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:20},onChange:()=>{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 t=this.giftCardInput.getValue().trim();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(e){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const t=[];return t.push(this.createGiftCardInput()),t.push(this.createApplyButton()),t}disconnected(){this.giftCardInput=null,this.applyButton=null}}const shouldShowMinimumPurchaseAlert=(t,e=![])=>{var n,i;const r=t.subtotal;if(t.type===o.SHIPPING){const o=t.fees;if(e&&(null===(n=o.pack)||void 0===n?void 0:n.active)&&o.pack.min>0&&r<o.pack.min)return!![];if(!e&&(null===(i=o.individual)||void 0===i?void 0:i.active)&&o.individual.min>0&&r<o.individual.min)return!![]}else if(t.type===o.ON_DEMAND){const e=t.fees;if(e.min>0&&r<e.min)return!![]}return![]},getMinimumPurchaseMessage=(t,e=![])=>{var n,i,r,s;const a=t.subtotal;if(t.type===o.SHIPPING){const o=t.fees;let s=0;if(e&&(null===(n=o.pack)||void 0===n?void 0:n.active)&&o.pack.min>0?s=o.pack.min:(null===(i=o.individual)||void 0===i?void 0:i.active)&&o.individual.min>0&&(s=o.individual.min),s>0&&a<s)return{message:formatCentToDollarText(s-a)+" more needed - "+(null===(r=null==t?void 0:t.expectation)||void 0===r?void 0:r.detail),type:"warning"}}if(t.type===o.ON_DEMAND){const e=t.fees,n=e.min>0?e.min:0;if(n>0&&a<n)return{message:formatCentToDollarText(n-a)+" more needed - "+(null===(s=null==t?void 0:t.expectation)||void 0===s?void 0:s.detail),type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(t,e=![])=>{var n,i;const r=t.subtotal;if(t.type===o.SHIPPING){const o=t.fees;if(e&&(null===(n=o.pack)||void 0===n?void 0:n.active)&&o.pack.min>0&&r<o.pack.min)return!![];if(!e&&(null===(i=o.individual)||void 0===i?void 0:i.active)&&o.individual.min>0&&r<o.individual.min)return!![]}if(t.type===o.ON_DEMAND){const e=t.fees;if(e.min>0&&r<e.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const e={warning:"warning",success:"success",info:"info"},n={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},i=e[this.params.messageType]||"warning",o=document.createElement("div");return o.className="alert-icon alert-icon-"+this.params.messageType,o.appendChild(htmlStringToElement(n[i]({width:16,height:16,className:"alert-icon-svg"}))),o}template(){var t;const e=[],n=this.getIconElement();n&&e.push(n);const i=document.createElement("span");if(i.className="alert-message",i.textContent=this.params.message,e.push(i),"detailed"===(null===(t=this.config)||void 0===t?void 0:t.alertType)&&this.params.currentTotal){const t=document.createElement("div");t.className="alert-details";const n=document.createElement("small");n.className="alert-details-text",n.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(n),e.push(t)}return e}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchOnlyStorePaths:["checkout.items"]}),this.trashButton=null}onStoreWatch(t){const e=t.find(t=>"checkout.items"===t.path);e&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState())}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const e=t.fulfillmentId;if(!e)return;if(!this.container)return;const n=this.container.querySelector(".checkout-item-card-header");if(n){const o=this.getStoreValue("cart.fulfillments."+e),r=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(r&&r.remove(),shouldShowMinimumPurchaseAlert(o,t.pack)){const e=getMinimumPurchaseMessage(o,t.pack),r=ComponentFactoryService.createElement({type:i.PURCHASE_MIN_ALERT,message:e.message,messageType:e.type,currentTotal:o.subtotal,config:{showIcon:!![],alertType:"minimal"}});r.setAttribute("data-component-type","checkout-retailer-alert"),n.before(r)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),e=Object.keys(t.items).length,n=1===e;this.trashButton.disabled=n,n?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","item-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="item-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const t=this.getStoreValue("checkout.items."+this.params.itemId);return t?t.updating===!![]:![]}checkAndUpdateLoadingState(){const t=this.isItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t;const e=this.getConfigs("global"),n=this.getStoreValue("checkout.items."+this.params.itemId),o=null===(t=null==n?void 0:n.attributes)||void 0===t?void 0:t.presale,r=(null==o?void 0:o.isActive)&&(null==o?void 0:o.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(o.estimatedShipBy):"";if(!n)return[];const s=document.createElement("div");s.classList.add("checkout-item-card-header");const a=document.createElement("img");a.classList.add("checkout-item-image"),a.src=n.mainImage,a.alt=n.name,a.loading="lazy",s.appendChild(a);const c=document.createElement("div");c.classList.add("checkout-item-details-container");const l=document.createElement("h4");l.classList.add("checkout-item-title"),l.textContent=n.name,c.appendChild(l);const h=document.createElement("div");h.classList.add("checkout-item-subtitle");const u=document.createElement("span");u.textContent=o.isActive?""+r:((null==n?void 0:n.expectationDetail)||"")+",",h.appendChild(u);const p=document.createElement("span");p.textContent="From "+((null==n?void 0:n.retailerName)||""),h.appendChild(p),c.appendChild(h),s.appendChild(c),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var e;if(t.preventDefault(),t.stopPropagation(),!(null===(e=this.trashButton)||void 0===e?void 0:e.disabled))try{await this.commands.checkout.removeItem(n.cartItemId)}catch(i){this.logger.error("Checkout item removal failed",{itemId:n.cartItemId,error:i instanceof Error?i.message:String(i)})}}),s.appendChild(this.trashButton);const m=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM_QUANTITY,itemId:n.cartItemId}),f=[];if(f.push(s),e.layout.enablePersonalization){const t=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:n.cartItemId,context:"checkout",watchStorePaths:["checkout.items.{identifier}"]});f.push(t)}return f.push(m),f}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(t){const e=t.find(t=>"checkout.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getCheckoutItemStore(){const t=this.params.itemId,e=this.getStoreValue("checkout.items."+t);return e||null}getAvailableQuantity(){var t,e,n;const i=this.getCheckoutItemStore();if(!i)return 0;const o=this.getStoreValue("products");if(!o)return 0;const r=i.partNumber,s=i.fulfillmentId,a=null===(n=null===(e=null===(t=Object.values(o).find(t=>t.sizes[i.liquidId]))||void 0===t?void 0:t.sizes)||void 0===e?void 0:e[i.liquidId])||void 0===n?void 0:n.attributes.maxQuantityPerOrder;if(!a)return 0;const c=this.getStoreValue("checkout.items")||{},l=Object.values(c).filter(t=>t.partNumber===r&&t.fulfillmentId===s),h=l.reduce((t,e)=>t+e.quantity,0);return a-h}calculateQuantityLimits(){var t;const e=this.getCheckoutItemStore();if(!e)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const n=this.getStoreValue("checkout"),i=1===(null===(t=Object.values(n.items))||void 0===t?void 0:t.length),o=e.quantity,r=this.getAvailableQuantity(),s=r>0,a=!(i&&1===o);return{currentQuantity:o,availableQuantity:r,isTheOnlyItem:i,canIncrease:s,canDecrease:a}}updateButtonStates(t){this.decreaseButton&&(this.decreaseButton.disabled=!t.canDecrease,this.decreaseButton.classList.toggle("disabled",!t.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!t.canIncrease,this.increaseButton.classList.toggle("disabled",!t.canIncrease),t.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits(),n=this.params.itemId;if((!(t<0)||e.canDecrease)&&(!(t>0)||e.canIncrease)){if(!n)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:t}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(n,t)}catch(i){this.logger.error("Checkout item quantity change operation failed",{itemId:n,delta:t,error:i instanceof Error?i.message:String(i)})}}}createQuantityContainer(){const t=this.calculateQuantityLimits(),e=document.createElement("div");return e.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),e.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),e.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),e.appendChild(this.increaseButton),this.updateButtonStates(t),e}template(){const t=this.getCheckoutItemStore();if(!t)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const e=this.createQuantityContainer(),n=document.createElement("span");return n.classList.add("checkout-item-price-text"),n.textContent=formatCentToDollarText(t.price),[e,n]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(t){return ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM,itemId:t})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},e=new Map;for(const n of objectValues(t))n&&n.cartItemId&&e.set(n.cartItemId,n);return e}syncItemsWithStore(){const t=this.getItemsListContainer();if(!t)return;const e=this.getCurrentItemsMap(),n=t.querySelectorAll("[data-item-id]"),i=new Set;for(const o of n){const t=o.getAttribute("data-item-id");t&&i.add(t)}for(const o of n){const t=o.getAttribute("data-item-id");t&&!e.has(t)&&o.remove()}for(const[o]of e)if(!i.has(o)){const e=this.createItemElement(o);e.setAttribute("data-item-id",o),t.appendChild(e)}this.updateItemCount()}updateItemCount(){const t=this.getTogglerLabel();if(!t)return;const e=this.getCurrentItemsMap(),n=e.size;t.textContent=n+" item"+(1!==n?"s":"")}onStoreChanged(t){let e;for(let n=0;n<t.length;n++){const i=t[n];if("checkout"===i.path||"checkout.items"===i.path||"checkout.items."===i.path.substring(0,15)){e=i;break}}return e?(this.syncItemsWithStore(),![]):![]}setupToggler(){const t=this.container.querySelector(".checkout-items-toggler"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");t&&e&&n&&t.addEventListener("click",()=>{const t=n.classList.contains("show");n.classList.toggle("show"),t?(e.classList.toggle("expanded"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand checkout items")):(e.classList.toggle("expanded"),e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse checkout items"))})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.items"),e=objectValues(t||{}),n=document.createElement("div");n.classList.add("checkout-items-toggler");const i=document.createElement("span");i.classList.add("checkout-items-toggler-label"),i.textContent=e.length+" item"+(1!==e.length?"s":""),n.appendChild(i);const o=document.createElement("button");o.type="button",o.classList.add("checkout-items-toggler-button"),o.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(o);const r=document.createElement("div");r.classList.add("checkout-items-list","show");for(const s of e){const t=this.createItemElement(s.cartItemId);t.setAttribute("data-item-id",s.cartItemId),r.appendChild(t)}return[n,r]}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchStorePaths:["checkout.isFormValid","checkout.invalidFields","checkout.stripeFormStatus","checkout.stripeFormStatus.isComplete","checkout.stripeFormStatus.hasError","checkout.stripeFormStatus.isProcessing","checkout.stripeFormStatus.errorMessage","checkout.readyForSubmit","checkout.readyForSubmit.payment","checkout.readyForSubmit.prepared","checkout.loading","checkout.error","checkout.payment.sendSubmitSignal"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-payment-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreChanged(t){const e=t.some(t=>"checkout.isFormValid"===t.path||"checkout.invalidFields"===t.path||"checkout.stripeFormStatus"===t.path||"checkout.stripeFormStatus."===t.path.substring(0,26)||"checkout.readyForSubmit"===t.path||"checkout.readyForSubmit."===t.path.substring(0,23)||"checkout.loading"===t.path||"checkout.error"===t.path);e&&this.updateButtonState();const n=t.find(t=>"checkout.readyForSubmit"===t.path);return n&&this.handleCheckoutReadyForSubmit(n.value),![]}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.isFormValid")||![],e=this.store.get("checkout.invalidFields")||[],n=this.store.get("checkout.stripeFormStatus")||{},i=this.store.get("checkout.loading")||![],o=this.store.get("checkout.error")||null,r=n.isComplete||![],s=n.hasError||![],a=n.isProcessing||![],c=n.errorMessage||null;this.updateErrorDisplay(this.determineErrorMessage(o,c));const l=this.determineButtonState({isFormValid:t,invalidFieldsCount:e.length,isPaymentComplete:r,hasPaymentError:s,isStripeProcessing:a,isCheckoutLoading:i,hasCheckoutError:!!o});this.applyButtonState(l)}determineErrorMessage(t,e){return t&&e?e:e||t}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const e=this.errorContainer.querySelector(".error-text");e&&(this.clearErrorTimeout(),t?(e.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(()=>{this.errorTimeoutId=null,this.commands.checkout.removeCheckoutError();const t=this.store.get("checkout.stripeFormStatus");(null==t?void 0:t.errorMessage)&&this.commands.checkout.updateStripeFormStatus({errorMessage:null})},3e3)):(e.textContent="",this.errorContainer.style.display="none"))}determineButtonState(t){const{isFormValid:e,invalidFieldsCount:n,isPaymentComplete:i,hasPaymentError:o,isStripeProcessing:r,isCheckoutLoading:s,hasCheckoutError:a}=t,c=this.config.layout.placeOrderButtonText,l=this.config.layout.placeOrderButtonShowRequiredFields,h=e&&i&&!o&&!r&&!a,u=this.store.get("checkout.readyForSubmit.payment")||![],p=this.store.get("checkout.readyForSubmit.prepared")||![],m=this.store.get("checkout.payment.sendSubmitSignal")||![],f=this.store.get("checkout.isPresaleLocked")||![];let g=![];if(!f){const t=this.getStoreValue("cart.fulfillments")||{};g=Object.values(t).some(t=>hasUnmetMinimum(t))}const v=r||s||m;if(s&&!r&&!m)return{state:"processing",text:c,disabled:!![]};if(g)return{state:"disabled",text:c,disabled:!![]};if(v)return u&&p?{state:"processing",text:"Placing Order...",disabled:!![]}:u&&!p?{state:"processing",text:"Preparing Order...",disabled:!![]}:p&&!u&&(r||m)||m||r?{state:"processing",text:"Processing Payment...",disabled:!![]}:{state:"processing",text:"Placing Order...",disabled:!![]};if(!e){const t=n>0?" ("+n+")":"";return{state:"form-invalid",text:l?"Complete Required Fields"+t:c,disabled:![]}}return i?o?{state:"payment-error",text:c,disabled:![]}:h?{state:"ready",text:c,disabled:![]}:{state:"disabled",text:c,disabled:!![]}:{state:"payment-incomplete",text:"Complete Payment Information",disabled:![]}}applyButtonState(t){if(!this.placeOrderButton)return;const e=["processing","form-invalid","payment-incomplete","payment-error","ready","disabled"];this.placeOrderButton.classList.remove(...e),this.placeOrderButton.classList.add(t.state),this.placeOrderButton.disabled=t.disabled,this.placeOrderButton.textContent=t.text}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const t=this.store.get("checkout.isFormValid")||![],e=this.store.get("checkout.stripeFormStatus")||{},n=this.store.get("checkout.loading")||![],i=e.isComplete||![],o=e.hasError||![],r=e.isProcessing||![];if(r||n)return;if(!t)return await this.focusFirstInvalidField(),void 0;if(!i||o)return this.showPaymentError(),void 0;await this.commands.checkout.startPreparingCheckoutSubmit()}catch(t){console.error("Error during checkout:",t)}}async focusFirstInvalidField(){try{this.commands.checkout.focusFirstInvalidField&&await this.commands.checkout.focusFirstInvalidField()}catch(D){console.error("Error focusing invalid field:",D)}}showPaymentError(){const t=document.querySelector(".checkout-stripe-form");t&&safeScrollIntoView(t,{behavior:"smooth",block:"center"})}async handleCheckoutReadyForSubmit(t){if(!t)return;const{payment:e,prepared:n,customer:i,gift:o,billing:r}=t,s=e&&n&&i&&r&&o;s&&await this.commands.checkout.checkoutComplete()}template(){const t=document.createElement("button");t.type="button",t.textContent=this.config.layout.placeOrderButtonText,t.classList.add("checkout-place-order-button"),t.disabled=!![],t.addEventListener("click",this.handlePlaceOrderClick.bind(this));const e=document.createElement("div");e.classList.add("checkout-payment-error-wrapper"),e.setAttribute("role","alert"),e.style.display="none";const n=document.createElement("div");n.classList.add("checkout-payment-error");const o=document.createElement("span");o.classList.add("icon-error"),o.innerHTML=ErrorInfoIcon({});const r=document.createElement("span");r.classList.add("error-text"),n.appendChild(o),n.appendChild(r),e.appendChild(n);const s=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,s,t]}}class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const t=[],e=this.getConfigs("global"),n=document.createElement("div");n.classList.add("checkout-completed-section-container");const o=document.createElement("div");o.classList.add("checkout-completed-title-section");const r=document.createElement("div");r.classList.add("checkout-completed-title-section");const s=document.createElement("p");s.textContent="Session Expired",r.appendChild(s);const a=document.createElement("p");a.textContent="Your reservation time has ended. The item has been released for other customers.",r.appendChild(a),o.appendChild(r),n.appendChild(o);const c=document.createElement("div");c.classList.add("checkout-completed-help-section");const l=document.createElement("p");l.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.",c.appendChild(l),n.appendChild(c),t.push(n);const h=document.createElement("div");h.classList.add("checkout-completed-section-container");const u=document.createElement("button");u.setAttribute("aria-label","Continue shopping"),u.type="button";const p=document.createElement("span");p.textContent="Continue Shopping",u.appendChild(p);const m=htmlStringToElement(ArrowRightIcon({width:16,height:16}));u.appendChild(m),u.addEventListener("click",()=>this.handleExit()),h.appendChild(u),t.push(h);const f=document.createElement("div");f.classList.add("checkout-completed-section-container");const g=document.createElement("p");g.classList.add("checkout-completed-auto-close-text"),g.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 v=document.createElement("span");if(v.classList.add("checkout-completed-auto-close-text"),v.textContent="seconds",f.appendChild(g),f.appendChild(this.autoCloseElement),f.appendChild(v),t.push(f),e.layout.showPoweredBy){const e=document.createElement("div");e.classList.add("checkout-completed-powered-by-container");const n=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});e.appendChild(n),t.push(e)}return t}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(t){const e=t.find(t=>"checkout.promoCode"===t.path),n=t.find(t=>"checkout.loading"===t.path);if(e){const{value:t,oldValue:n}=e,i=Boolean(n),o=Boolean(t);if(!i&&o)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!o)return this.container.innerHTML="",this.createInputContainer(),void 0;o&&this.promoCodeText&&t.discountAmount!==(null==n?void 0:n.discountAmount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")")}n&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),e=t.length>=3&&t.length<=20,n=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.promoCode"),o=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!e||n||Boolean(i)||Boolean(o)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:20},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),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 t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(e){this.logger.error("Checkout promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const t=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),e}const e=[];return e.push(this.createPromoInput()),e.push(this.createApplyButton()),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(t){const e=this.getStoreValue("checkout.updating")||![];if(!e)try{await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Checkout tips update failed",{percentage:t,error:n instanceof Error?n.message:String(n)})}}async handleFulfillmentTipInput(t,e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const i=this.getOnDemandFulfillmentTipInfo();if(!i[t])return;const o=Math.round(100*e);try{await this.commands.checkout.updateFulfillmentTip(t,o)}catch(r){this.logger.error("Checkout fulfillment tip update failed",{fulfillmentId:t,tipAmountInCents:o,originalAmount:e,error:r instanceof Error?r.message:String(r)})}}async removeTipFromFulfillment(t){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const n=this.getOnDemandFulfillmentTipInfo();if(n[t])try{await this.commands.checkout.removeFulfillmentTip(t)}catch(i){this.logger.error("Checkout fulfillment tip removal failed",{fulfillmentId:t,error:i instanceof Error?i.message:String(i)})}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const e=[10,18,20],n=this.getStoreValue("checkout.updating")||![],i=this.getTipSelection();for(const o of e){const e=document.createElement("button");e.type="button",e.textContent=o+"%",e.classList.add("checkout-tip-button"),e.disabled=n,i===o&&e.classList.add("selected"),e.addEventListener("click",()=>this.handlePercentageSelect(o)),t.appendChild(e)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".retailers-tips-list");t&&e&&n&&t.addEventListener("click",()=>{const t=n.classList.contains("show");n.classList.toggle("show"),t?(e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand tips section")):(e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse tips section")),e.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;const n=document.createElement("div");n.classList.add("checkout-tip-distribution-header");const i=document.createElement("h3");i.textContent="View Tip Distribution",i.classList.add("checkout-sub-header"),n.appendChild(i);const o=document.createElement("button");o.type="button",o.classList.add("checkout-items-toggler-button"),o.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(o),t.appendChild(n);const r=document.createElement("div");r.classList.add("retailers-tips-list","show");for(const s of e){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const e=document.createElement("h4");e.textContent=s.retailerName,e.classList.add("checkout-sub-header"),t.appendChild(e);const n=document.createElement("div");n.classList.add("checkout-tip-fulfillment-input-wrapper");const i=document.createElement("div");i.classList.add("dollar-input-container");const o=document.createElement("span");o.classList.add("dollar-sign"),o.textContent="$";const a=document.createElement("input");let c;a.type="number",a.id="tip-input-"+s.fulfillmentId,a.name="tip-"+s.fulfillmentId,a.min="0",a.step="0.01",a.placeholder="0.00",a.classList.add("dollar-input"),a.value=s.tip>0?(s.tip/100).toFixed(2):"",a.disabled=this.getStoreValue("checkout.updating")||![],a.addEventListener("wheel",t=>{t.preventDefault()}),a.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),a.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),a.addEventListener("paste",t=>{t.preventDefault()}),a.addEventListener("contextmenu",t=>{t.preventDefault()}),a.addEventListener("input",t=>{const e=t.target;let n=e.value;if(Number.parseFloat(n)<0&&(e.value=Math.abs(Number.parseFloat(n)).toString(),n=e.value),n.includes(".")){const t=n.split(".");t.length>1&&t[1].length>2&&(e.value=t[0]+"."+t[1].substring(0,2))}}),a.addEventListener("input",t=>{const e=t.target,n=Number.parseFloat(e.value)||0;c&&clearTimeout(c),c=setTimeout(()=>{this.handleFulfillmentTipInput(s.fulfillmentId,n)},500)}),i.appendChild(o),i.appendChild(a),n.appendChild(i);const l=document.createElement("button");l.type="button",l.textContent="Remove",l.classList.add("checkout-tip-remove-button"),l.disabled=this.getStoreValue("checkout.updating")||![],l.addEventListener("click",()=>this.removeTipFromFulfillment(s.fulfillmentId)),n.appendChild(l),t.appendChild(n),r.appendChild(t)}return t.appendChild(r),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),e=this.getFulfillmentTipInfoArray();if(t&&e.length>0){const i=e.some(t=>t.tip>0);if(i)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(n){this.logger.error("Default tip initialization failed",{currentTipSelection:t,fulfillmentCount:e.length,error:n instanceof Error?n.message:String(n)}),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(i){this.logger.error("Default tip initialization failed during fallback",{currentTipSelection:t,error:i instanceof Error?i.message:String(i)}),this.isInitialized=![]}}template(){const t=[],e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;e.length>0&&this.initializeDefaultTip();const n=document.createElement("section");n.classList.add("checkout-tip-container");const i=document.createElement("h3");i.classList.add("checkout-sub-header"),i.textContent="Add a tip",n.appendChild(i);const o=document.createElement("div");o.classList.add("checkout-tip-config-container");const r=this.createTipSelectionButtons();o.appendChild(r),n.appendChild(o);const s=document.createElement("p");s.classList.add("checkout-tip-disclaimer"),s.textContent="Tips will be split proportionally between retailers.",n.appendChild(s);const a=this.createTipDistribution();return t.push(n,a),t}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(t){var e,n;const i=t.find(t=>"checkout.giftCardError"===t.path),o=t.find(t=>"checkout.promoCodeError"===t.path),r=t.find(t=>"checkout.giftCards"===t.path);if(r&&this.updateAppliedGiftCards(r.value),i){const t=this.container.querySelector(".input-gift-card-container");if(t){const n=t.nextElementSibling;if((null===(e=null==n?void 0:n.classList)||void 0===e?void 0:e.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),i.value){const e=this.createErrorElement(i.value);t.after(e)}const o=t.querySelector(".apply-button");o&&(o.disabled=Boolean(i.value))}}if(o){const t=this.container.querySelector(".input-promo-code-container");if(t){const e=t.nextElementSibling;if((null===(n=null==e?void 0:e.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==e?void 0:e.remove()),o.value){const e=this.createErrorElement(o.value);t.after(e)}const i=t.querySelector(".apply-button");i&&(i.disabled=Boolean(o.value))}}}updateAppliedGiftCards(t){const e=t&&t.length>0;if(!e)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)})}createAppliedGiftCardElement(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),e.setAttribute("data-gift-card-code",t.code);const n=document.createElement("span");n.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",e.appendChild(n);const i=document.createElement("button");return i.type="button",i.textContent="Remove",i.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),e.appendChild(i),e}pcInputContainer(){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return t}gcInputContainer(){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_GIFT_CARDS});return t}inputContainer(){var t;const e=this.getConfigs("checkout"),n=this.getConfigs("global"),i=e.layout.allowGiftCards,o=null===(t=null==n?void 0:n.layout)||void 0===t?void 0:t.allowPromoCodes,r=document.createElement("div");r.classList.add("checkout-pc-gc-sub-container");const s=this.pcInputContainer(),a=this.gcInputContainer();o&&r.appendChild(s);const c=this.getStoreValue("checkout.promoCodeError");if(c){const t=this.createErrorElement(c);t.classList.add("promo-code-error-wrapper"),r.appendChild(t)}i&&r.appendChild(a);const l=this.getStoreValue("checkout.giftCardError");if(l){const t=this.createErrorElement(l);r.appendChild(t)}return r}createErrorElement(t){const e=document.createElement("div");e.classList.add("error-banner-checkout");const n=document.createElement("div");n.innerHTML=ErrorInfoIcon({});const i=document.createElement("p");return i.textContent=t.toString(),e.appendChild(n),e.appendChild(i),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),e.remove()},3e3),e}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const e=[];return e.push(this.inputContainer()),t&&t.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)}),e.push(this.appliedGiftCardsContainer)),e}disconnected(){this.appliedGiftCardsContainer=null}}class ProductComponent extends BaseComponent{constructor(){super({watchStorePaths:["products.{productId}.loading","products.{productId}.error"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen","products.{productId}.rerender"]}),this.titleElement=null}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen"),i=t.find(t=>t.path==="products."+e+".rerender");n&&this.titleElement&&this.titleElement.classList.toggle("hide",n.value),(null==i?void 0:i.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:i.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:i.PRODUCT_LOADING});const o=n.sizes[n.selectedSizeId],r=document.createElement("div");r.classList.add("product-content-wrapper");const s=document.createElement("div");if(s.classList.add("product-content"),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=n.name,this.titleElement=t,s.appendChild(t)}const a=ComponentFactoryService.createElement({type:i.PRODUCT_OPTIONS,productId:e});s.appendChild(a);const c=ComponentFactoryService.createElement({type:i.PRODUCT_DRAWER,productId:e});if(s.appendChild(c),r.appendChild(s),!this.config.layout.showImages||!(null===(t=n.images)||void 0===t?void 0:t.length))return r;r.classList.add("has-images");const l=ComponentFactoryService.createElement({type:i.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:o.image,productId:e});return r.prepend(l),r}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}class EngravingViewComponent extends BaseComponent{constructor(){super(...arguments),this.openEngravingDrawer=async()=>{const t=this.params.identifier,e=this.createEngravingFormParams();if(this.clientConfig.isMobile()){const n="product"===this.params.context?{...e,productId:t}:e;this.commands.ui.openDrawer(i.ENGRAVING_FORM,n)}if(!this.clientConfig.isMobile())if("product"===this.params.context){const n={...e,productId:t};await this.commands.product.openProductDrawer(t,i.ENGRAVING_FORM,n)}else this.commands.ui.openDrawer(i.ENGRAVING_FORM,e)}}get hostClasses(){const t=this.getConfigs("global");return["engraving-view-container",t.layout.personalizationCardStyle,this.params.context]}beforeSetupStoreWatchers(){var t;this.reactiveOptions.watchStorePaths=null!==(t=this.params.watchStorePaths)&&void 0!==t?t:[]}createEngravingFormParams(){var t,e;const n=this.params.identifier,i={identifier:n,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("product"===this.params.context){const o=this.getStoreValue("products."+n),r=null===(e=null===(t=o.sizes[o.selectedSizeId])||void 0===t?void 0:t.attributes)||void 0===e?void 0:e.engraving;i.lines=o.engravingLines||[],i.maxLines=(null==r?void 0:r.maxLines)||1,i.maxCharsPerLine=(null==r?void 0:r.maxCharsPerLine)||16,i.fee=(null==r?void 0:r.fee)||0,i.location=(null==r?void 0:r.location)||""}if("cart"===this.params.context){const t=this.getStoreValue("cart.items."+n);i.lines=(null==t?void 0:t.attributes.engraving.lines)||[],i.maxLines=(null==t?void 0:t.attributes.engraving.maxLines)||1,i.maxCharsPerLine=(null==t?void 0:t.attributes.engraving.maxCharsPerLine)||16,i.fee=(null==t?void 0:t.attributes.engraving.fee)||0,i.location=(null==t?void 0:t.attributes.engraving.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+n);i.lines=(null==t?void 0:t.attributes.engraving.lines)||[],i.maxLines=(null==t?void 0:t.attributes.engraving.maxLines)||1,i.maxCharsPerLine=(null==t?void 0:t.attributes.engraving.maxCharsPerLine)||16,i.fee=(null==t?void 0:t.attributes.engraving.fee)||0,i.location=(null==t?void 0:t.attributes.engraving.location)||""}return i}createEngravingContainer(t,e){const n=document.createElement("div");n.className="engraving-header";const i=document.createElement("h3");i.textContent="Personalization";const o=document.createElement("span");o.textContent=formatCentToDollarText(e,![]),n.appendChild(i),n.appendChild(o);const r=document.createElement("div");r.className="engraving-body";const s=document.createElement("div");s.className="engraving-lines";for(const l of t){const t=document.createElement("span");t.className="engraving-line",t.textContent=l,s.appendChild(t)}const a=document.createElement("div");a.className="engraving-actions";const c=document.createElement("button");if(c.type="button",c.classList.add("remove-button"),c.textContent="Remove",c.addEventListener("click",async()=>{const t=this.params.identifier;"product"===this.params.context&&await this.commands.product.updateEngravingLines(t,[]),"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(t,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(t)}),a.appendChild(c),"checkout"!==this.params.context){const t=document.createElement("button");t.type="button",t.classList.add("edit-button"),t.textContent="Edit",t.addEventListener("click",this.openEngravingDrawer),a.appendChild(t)}return r.appendChild(s),r.appendChild(a),[n,r]}isEngravingAvailable(){var t,e,n;const i=this.params.identifier;if("product"===this.params.context){const o=this.getStoreValue("products."+i),r=o.sizes[o.selectedSizeId];return Boolean((null===(t=o.selectedFulfillment)||void 0===t?void 0:t.canEngrave)&&(null===(e=o.selectedFulfillment)||void 0===e?void 0:e.isVariantEngravable)&&(null===(n=r.attributes.engraving)||void 0===n?void 0:n.status))}if("cart"===this.params.context){const t=this.getStoreValue("cart.items."+i),e=this.getStoreValue("cart.fulfillments."+t.fulfillmentId),n=t.attributes.engraving.isEngravable,o=(null==e?void 0:e.canEngrave)||![];return Boolean(n&&o)}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+i);return Boolean(null==t?void 0:t.attributes.engraving.isEngravable)}return![]}engravingFee(){var t;const e=this.params.identifier;if("product"===this.params.context){const n=this.getStoreValue("products."+e),i=n.sizes[n.selectedSizeId];return(null===(t=i.attributes.engraving)||void 0===t?void 0:t.fee)||0}if("cart"===this.params.context){const t=this.getStoreValue("cart.items."+e);return(null==t?void 0:t.attributes.engraving.fee)||0}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+e);return(null==t?void 0:t.attributes.engraving.fee)||0}return 0}engravingLines(){const t=this.params.identifier;if("product"===this.params.context){const e=this.getStoreValue("products."+t);return e.engravingLines||[]}if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}return[]}template(){const t=this.isEngravingAvailable();if(!t)return this.removeHostClasses("has-header"),"";const e=this.engravingFee(),n=this.engravingLines();if(n&&n.length>0)return this.addHostClasses("has-header"),this.createEngravingContainer(n,e);if(this.removeHostClasses("has-header"),"checkout"===this.params.context)return"";const i=this.getConfigs("global"),o=document.createElement("button");return o.type="button",o.className="add-engraving-button",o.textContent=i.layout.personalizationText+" +"+formatCentToDollarText(e,![]),o.addEventListener("click",this.openEngravingDrawer),o}}function fulfillmentAddress(t,e){if(!t)return"";if(e===o.SHIPPING){const e=[t.city,t.state].filter(Boolean);return e.join(", ")}const n=[t.one,t.two,t.city,t.state].filter(Boolean);return n.join(", ")}const ct=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],lt=1440;function timeToMinutes(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new Error("Invalid time format: "+t);const n=Number.parseInt(e[1],10),i=Number.parseInt(e[2],10);if(n<0||n>47||i<0||i>59)throw new Error("Invalid time values: "+t);return 60*n+i}function getCurrentTimeInTimezone(t){var e,n,i;const o=new Date,r={timeZone:t,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const t=new Intl.DateTimeFormat("en-US",r),s=t.formatToParts(o),a=(null===(e=s.find(t=>"weekday"===t.type))||void 0===e?void 0:e.value.toLowerCase())||"",c=(null===(n=s.find(t=>"hour"===t.type))||void 0===n?void 0:n.value)||"0",l=(null===(i=s.find(t=>"minute"===t.type))||void 0===i?void 0:i.value)||"0",h=60*Number.parseInt(c,10)+Number.parseInt(l,10);return{weekday:a,timeInMinutes:h}}catch(s){throw new Error("Invalid timezone: "+t)}}function format24TimeTo12(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e||"object"==typeof e)return t;let n=Number.parseInt(e[1],10);const i=e[2];n>=24&&(n-=24);const o=n>=12?"PM":"AM",r=0===n?12:n>12?n-12:n;return r+":"+i+" "+o}function isWithinTimeSlot(t,e){try{const n=timeToMinutes(e.startsAt),i=timeToMinutes(e.endsAt);if(i>lt){if(t>=n||t<i-lt)return"during"}else if(i<n){if(t>=n||t<i)return"during"}else if(t>=n&&t<i)return"during";return t<n?"before":"after"}catch(n){return"after"}}function getNextOpeningTime(t,e,n=7){var i,o;const r=ct.indexOf(e);for(let a=1;a<=n;a++){const e=(r+a)%7,n=ct[e],c=t[n];if((null==c?void 0:c.active)&&c.times&&c.times.length>0)try{const t=1===a?"tomorrow":n;return"Opens "+t+" at "+format24TimeTo12(null!==(o=null===(i=null==c?void 0:c.times[0])||void 0===i?void 0:i.startsAt)&&void 0!==o?o:"")}catch(s){}}return null}function validateFulfillmentData(t){return t&&"object"==typeof t&&t.hours&&t.timezone?"string"!=typeof t.timezone?![]:!![]:![]}function getRetailerOffHours(t){var e;if(!(null==t?void 0:t.type)||(null==t?void 0:t.type)!==o.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(t))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:n,timeInMinutes:i}=getCurrentTimeInTimezone(t.timezone),o=t.hours[n];if(!(null==o?void 0:o.active)||!(null===(e=o.times)||void 0===e?void 0:e.length)){const e=getNextOpeningTime(t.hours,n);return{message:e,isOpen:![],isClosed:!![]}}for(const t of o.times){const e=isWithinTimeSlot(i,t);switch(e){case"before":return{message:"Opens at "+format24TimeTo12(t.startsAt),isOpen:![],isClosed:!![],openTime:t.startsAt,closeTime:t.endsAt};case"during":{let e=t.endsAt;const n=timeToMinutes(e);if(n>lt){const t=Math.floor(n/60)-24,i=n%60;e=t.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(e),isOpen:!![],isClosed:![],openTime:t.startsAt,closeTime:t.endsAt}}}}const r=getNextOpeningTime(t.hours,n);return{message:r,isOpen:![],isClosed:!![]}}catch(n){return console.error("Error getting retailer status:",n),{message:null,isOpen:![],isClosed:!![]}}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,fulfillmentStatus:i,selectedSizeAttributes:r}){var s,a,c,l;let h=0;const u=null==r?void 0:r.presale,p=(null==u?void 0:u.isActive)&&(null==u?void 0:u.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(u.estimatedShipBy):"",m=e===o.SHIPPING,f=e===o.ON_DEMAND;m&&(h=(null===(a=null===(s=null==t?void 0:t.fees)||void 0===s?void 0:s.individual)||void 0===a?void 0:a.fee)||0),f&&(h=(null===(c=null==t?void 0:t.fees)||void 0===c?void 0:c.fee)||0);const g=fulfillmentAddress(t.retailerAddress,e);let v=null;e===o.ON_DEMAND&&i.openTime&&(null==i?void 0:i.closeTime)&&(v=i.isOpen?"Closes at "+format24TimeTo12$1(null==i?void 0:i.closeTime):"Opens at "+format24TimeTo12$1(null==i?void 0:i.openTime));const y=e===o.ON_DEMAND&&i&&i.isClosed?"closed":"",b=document.createElement("div");b.className="popup-retailer-card "+(n?"selected":"")+" "+y,b.setAttribute("data-fulfillment-id",t.fulfillmentId);const x=document.createElement("div");x.className="row";const w=document.createElement("span");w.className="name",w.textContent=t.retailerName,x.appendChild(w);const C=document.createElement("span");C.className="price",C.textContent=formatCentToDollarText(null!==(l=t.price)&&void 0!==l?l:0),x.appendChild(C),b.appendChild(x);const k=document.createElement("div");k.className="row";const S=document.createElement("span");S.className="expectation",S.textContent=i.isClosed?v:(null==u?void 0:u.isActive)?p:(null==t?void 0:t.expectation.detail)||"No expectation available",k.appendChild(S);const E=document.createElement("span");if(E.className="fee",E.textContent=h>0?formatCentToDollarText(h):"Free Delivery",k.appendChild(E),b.appendChild(k),f){const t=document.createElement("div");t.className="row";const e=document.createElement("span");e.className="address",e.textContent=g,t.appendChild(e),b.appendChild(t)}return b}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:e,shippingSelected:n,onDemandSelected:i,onTabClick:r,enableShippingFulfillment:s,enableOnDemandFulfillment:a}){const c=e.length>0,l=document.createElement("div");if(l.className="fulfillment-tabs-container",s){const e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",o.SHIPPING),e.addEventListener("click",r);const i=document.createElement("span");i.className="fulfillment-tab-label "+(n?"selected":""),i.textContent="Shipping ("+t.length+")",e.appendChild(i),l.appendChild(e)}if(a){const t=document.createElement("div");t.className="fulfillment-tab "+(i?"selected":"")+" "+(c?"":"disabled"),t.setAttribute("data-fulfillment-type",o.ON_DEMAND),t.addEventListener("click",r);const n=document.createElement("span");n.className="fulfillment-tab-label "+(i?"selected":""),n.textContent="Same-Day Delivery ("+e.length+")",t.appendChild(n),l.appendChild(t)}return l}class ProductAddToCartSectionComponent extends BaseComponent{get hostClasses(){return["add-to-cart-container"]}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","products.{productId}.engravingLines","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment||!n.selectedSizeId)return 0;const i=n.selectedFulfillment.partNumber,o=n.selectedFulfillment.fulfillmentId,r=null===(t=n.sizes[n.selectedSizeId].attributes)||void 0===t?void 0:t.maxQuantityPerOrder;if(!r)return 0;const s=this.getStoreValue("cart.items")||{},a=Object.values(s).filter(t=>t.partNumber===i&&t.fulfillmentId===o),c=a.reduce((t,e)=>t+e.quantity,0);return r-c}isFulfillmentClosed(){const t=this.getProductId(),e=this.getStoreValue("products."+t);if(!e.selectedFulfillment)return![];const n=getRetailerOffHours(e.selectedFulfillment);return e.selectedFulfillmentType===o.ON_DEMAND&&n&&n.isClosed}isButtonLoading(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".updating");return e}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),e=this.getAvailableQuantity(),n=t<e;return{currentQuantity:t,availableQuantity:e,canIncrease:n,canDecrease:t>1}}async handleAddToCart(){var t,e,n;const i=this.getProductId(),o=this.getStoreValue("products."+i);if(!o.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:i,selectedSizeId:o.selectedSizeId}),void 0;const r=this.getSizeAttributes(),s=(null===(t=null==r?void 0:r.presale)||void 0===t?void 0:t.isActive)===!![],a=this.isPresaleActive(r);s&&a?await this.commands.product.addPresaleToCart(i,{upc:o.sizes[o.selectedSizeId].upc,fulfillmentId:o.selectedFulfillment.fulfillmentId,partNumber:null===(e=o.selectedFulfillment)||void 0===e?void 0:e.partNumber,quantity:o.quantity,engravingLines:o.engravingLines,identifier:i}):await this.commands.product.addToCart(i,{upc:o.sizes[o.selectedSizeId].upc,fulfillmentId:o.selectedFulfillment.fulfillmentId,partNumber:null===(n=o.selectedFulfillment)||void 0===n?void 0:n.partNumber,quantity:o.quantity,engravingLines:o.engravingLines,identifier:i})}async handleQuantityChange(t){const e=this.getProductId();await this.commands.product.updateQuantity(e,t)}calculateTotalPrice(){var t,e;const n=this.getProductId(),i=this.getStoreValue("products."+n),o=i.sizes[i.selectedSizeId],r=i.selectedFulfillment,s=r.price*i.quantity,a=i.engravingLines.length>0,c=a&&(null===(e=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.fee)||0;return{quantity:i.quantity,totalPrice:s+c}}createQuantityContainer(t){const e=this.calculateQuantityLimits(),n=document.createElement("div");return n.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!e.canDecrease,e.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=e.currentQuantity.toString(),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!e.canIncrease,e.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantityText),n.appendChild(this.qtyIncreaseButton),n}getSizeAttributes(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".selectedSizeId"),n=this.getStoreValue("products."+t+".sizes."+e);return(null==n?void 0:n.attributes)||{}}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:e}=this.calculateTotalPrice(),n=this.getSizeAttributes(),i=this.calculateQuantityLimits(),o=(null===(t=null==n?void 0:n.presale)||void 0===t?void 0:t.isActive)===!![],r=this.isPresaleActive(n),s=o?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;return this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?s+" - "+formatCentToDollarText(e):s,(o&&!r||0===i.availableQuantity||this.isFulfillmentClosed())&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),this.isButtonLoading()&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async t=>{if(t.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),n=this.getConfigs("configurations");if(!e||!n.isElementsEnabled)return[];const i=[],o=this.config.layout.showQuantityCounter;if(o){const t=this.config.layout.quantityCounterStyle,e=this.createQuantityContainer(t);i.push(e)}const r=this.createAddToCartButton();return i.push(r),i}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const t=this.params.productId,e=this.getStoreValue("products."+t+".description"),n=this.getStoreValue("products."+t+".htmlDescription"),i="About this product:",o="See More",r="See Less",s=document.createElement("h3");s.className="title",s.textContent=i;const a=document.createElement("div");a.className="content collapsed",a.innerHTML=""===(null==n?void 0:n.trim())?e:sanitizeHTML(n);const c=document.createElement("span");return c.className="collapse-button",c.textContent=o,c.addEventListener("click",()=>{this.isCollapsed=!this.isCollapsed,a.classList.toggle("collapsed"),c.textContent=this.isCollapsed?o:r}),[s,a,c]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(t){var e;const n=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!n)return![];const i=n.value,o=i.isOpen,r=null===(e=i.contentConfig)||void 0===e?void 0:e.type,s=r!==this.currentContentType;return o&&!this.isOpen?(this.currentContentType=r,this.openWithContent(i),![]):o&&this.isOpen&&!s?![]:o&&this.isOpen&&s?(this.currentContentType=r,this.openWithContent(i),![]):!o&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const e=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:e}),void 0;const{type:n,data:i}=t||{},o=ComponentFactoryService.createElement({type:n,...i});this.contentContainer&&this.contentContainer.appendChild(o),this.open()}catch(n){this.logger.error("Product drawer content loading failed",{productId:e,contentType:null==t?void 0:t.type,error:n instanceof Error?n.message:String(n)}),this.commands.product.closeProductDrawer(e)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay;return["product-image-carousel",t]}constructor(){super({watchOnlyStorePaths:["products.{productId}.mainImage"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){const e=this.params.productId,n=t.find(t=>t.path==="products."+e+".mainImage");if(null==n?void 0:n.value){const t=this.params.images.indexOf(null==n?void 0:n.value);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+n.value+"')")}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let e=0;e<this.thumbnails.length;e++){const t=this.thumbnails[e];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(e)})}const t=this.container.querySelectorAll(".carousel-dot");for(let e=0;e<t.length;e++){const n=t[e];n.addEventListener("click",()=>this.selectImage(e))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var e,n;if(t<0||t>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[t]+"')",this.mainImageElement.title="Product image "+(t+1)),null===(e=this.thumbnails[this.currentImageIndex])||void 0===e||e.classList.remove("selected"),null===(n=this.thumbnails[t])||void 0===n||n.classList.add("selected");const i=this.container.querySelectorAll(".carousel-dot");for(let o=0;o<i.length;o++){const e=i[o];e.classList.toggle("active",o===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const e=this.thumbnails[t],n=this.galleryViewport.offsetWidth,i=e.offsetLeft+e.offsetWidth/2,o=n/2,r=o-i,s=0,a=-(this.galleryContainer.scrollWidth-n);this.translateX=Math.max(a,Math.min(s,r)),this.updateTransform(!![])}setupMainImageSwipe(){var t,e;let n=0,i=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{n=t.touches[0].clientX,i=t.touches[0].clientY},{passive:!![]}),null===(e=this.mainImageElement)||void 0===e||e.addEventListener("touchend",t=>{const e=t.changedTouches[0].clientX-n,o=t.changedTouches[0].clientY-i;Math.abs(e)>Math.abs(o)&&Math.abs(e)>50&&(e>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const t of this.galleryContainer.querySelectorAll("img"))t.addEventListener("dragstart",t=>t.preventDefault())}}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const i=this.currentTranslateX+n,o=0,r=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(r,Math.min(o,i)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const t=[],e=this.params.images.length>1,n=document.createElement("div");if(n.className="main-image",n.title="Product main image",n.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",e){const t=document.createElement("div");t.className="carousel-dots";for(let e=0;e<this.params.images.length;e++){const n=document.createElement("button");n.type="button",n.className="carousel-dot "+(0===e?"active":""),n.setAttribute("data-index",e.toString()),t.appendChild(n)}n.appendChild(t)}this.mainImageElement=n,t.push(n);const i=document.createElement("div");i.className="gallery-viewport";const o=document.createElement("div");o.className="gallery-container";for(let r=0;r<this.params.images.length;r++){const t=this.params.images[r],e=document.createElement("div");e.className="gallery-image-wrapper "+(0===r?"selected":"");const n=document.createElement("img");n.src=t,n.className="gallery-image",n.alt="Product thumbnail "+(r+1),n.loading="lazy",e.appendChild(n),o.appendChild(e)}return i.appendChild(o),t.push(i),t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),e=this.container.querySelectorAll("[select-size]");for(const n of e)n.addEventListener("click",async()=>{const i=n.dataset.sizeId;if(!i)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:n.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,i);for(const t of e)t.classList.remove("selected");n.classList.add("selected")})}renderProductSizes(t,e){const n=document.createElement("div");n.className="size-container";const i=document.createElement("h3");i.className="size-label",i.textContent="Size",n.appendChild(i);const o=document.createElement("div");o.className="size-buttons-container";for(const r of Object.values(e)){const e=document.createElement("span");e.setAttribute("data-size-id",r.id),e.setAttribute("select-size",""),e.className="size-button "+(r.id===t?"selected":"");const n=r.packDesc?" ("+r.packDesc+")":"";e.textContent=""+r.size+n,o.appendChild(e)}return n.appendChild(o),n}hasIndependentAddressComponent(){var t;return(null===(t=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===t?void 0:t.length)>0}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.config.layout.showDescription,o=this.getConfigs("global"),r=[],s=document.createElement("div");s.className="price-personalization-container";const a=ComponentFactoryService.createElement({type:i.PRODUCT_PRICE,productId:t});if(s.appendChild(a),o.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:t,context:"product",watchStorePaths:["products.{identifier}.selectedSizeId","products.{identifier}.selectedFulfillmentType","products.{identifier}.selectedFulfillment","products.{identifier}.engravingLines"]});s.appendChild(e)}r.push(s);const c=this.renderProductSizes(e.selectedSizeId,e.sizes);if(r.push(c),!this.hasIndependentAddressComponent()){const e=ComponentFactoryService.createElement({type:i.ADDRESS_DISPLAY,productId:t});r.push(e)}const l=ComponentFactoryService.createElement({type:i.PRODUCT_RETAILERS,productId:t});r.push(l);const h=ComponentFactoryService.createElement({type:i.PRODUCT_ADD_TO_CART_SECTION,productId:t});if(r.push(h),n){const e=ComponentFactoryService.createElement({type:i.PRODUCT_DESCRIPTION,productId:t});r.push(e)}return r}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen");if(n){const t=n.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),e=this.getStoreValue("address.formattedAddress");if(e)return ComponentFactoryService.createElement({type:i.PRODUCT_INTERACTIONS,productId:this.getProductId()});const n=document.createElement("button");return n.type="button",n.className="product-options-open-address-button",n.textContent=this.config.layout.buyNowButtonText,n.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,i.ADDRESS_INPUT,{productId:t})}),n}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);let i=(null===(t=n.priceInfo)||void 0===t?void 0:t.avg)||0;return n.selectedFulfillment&&(i=n.selectedFulfillment.price),formatCentToDollarText(i)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getConfigs("product"),o=[],r=this.getConfigs("configurations");if(!e.productHasAvailability||!r.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.textContent="We're sorry, this product is not at nearby vendors and unavailable to ship to your state.",o.push(t),o}const s="carousel"===n.layout.fulfillmentDisplay?i.PRODUCT_RETAILERS_CAROUSEL:i.PRODUCT_RETAILERS_POPUP,a=ComponentFactoryService.createElement({type:s,productId:t});return o.push(a),o}}const dt="This product is currently unavailable to ship to your location.",ht="Same-day delivery is currently unavailable for your location.";class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const t=this.retailerCards.findIndex(t=>t.classList.contains("selected"));-1!==t&&this.scrollToIndex(t)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".selectedFulfillmentId");(null==n?void 0:n.value)&&this.updateSelectedCard(n.value)}updateSelectedCard(t){for(const n of this.retailerCards)n.classList.remove("selected");const e=this.retailerCards.findIndex(e=>e.dataset.fulfillmentId===t);-1!==e&&(this.retailerCards[e].classList.add("selected"),this.scrollToIndex(e))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const e=this.retailerCards[t],n=this.listViewport.offsetWidth,i=e.offsetLeft+e.offsetWidth/2,o=n/2,r=o-i,s=0,a=-(this.listContainer.scrollWidth-n);this.translateX=Math.max(a,Math.min(s,r)),this.updateTransform(!![])}setupDrag(){this.listContainer&&(this.listContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.listContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this)))}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.listViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const i=this.currentTranslateX+n,o=0,r=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(r,Math.min(o,i)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.listContainer&&(this.listContainer.style.transition=t?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){if(this.hasMoved)return;const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const i=this.getStoreValue("products."+e+".selectedFulfillment");if(i&&i.fulfillmentId===n)return this.logger.debug("Product retailer selection skipped: Same fulfillment already selected",{productId:e,fulfillmentId:n}),void 0;await this.commands.product.selectFulfillment(e,n)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,fulfillmentStatus:i,selectedSizeAttributes:r}){var s,a,c,l;let h=0;const u=null==r?void 0:r.presale,p=(null==u?void 0:u.isActive)&&(null==u?void 0:u.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(u.estimatedShipBy):"",m=e===o.SHIPPING,f=e===o.ON_DEMAND;m&&(h=(null===(a=null===(s=null==t?void 0:t.fees)||void 0===s?void 0:s.individual)||void 0===a?void 0:a.fee)||0),f&&(h=(null===(c=null==t?void 0:t.fees)||void 0===c?void 0:c.fee)||0);const g=fulfillmentAddress(t.retailerAddress,e);let v=null;e===o.ON_DEMAND&&i.openTime&&(null==i?void 0:i.closeTime)&&(v=i.isOpen?"Closes at "+format24TimeTo12$1(null==i?void 0:i.closeTime):"Opens at "+format24TimeTo12$1(null==i?void 0:i.openTime));const y=e===o.ON_DEMAND&&i&&i.isClosed?"closed":"",b=document.createElement("div");b.className="carousel-retailer-card "+(n?"selected":"")+" "+y,b.setAttribute("data-fulfillment-id",t.fulfillmentId);const x=document.createElement("div");x.className="retailer-header";const w=document.createElement("h3");if(w.className="name",w.textContent=t.retailerName,x.appendChild(w),f){const t=document.createElement("h3");t.className="address",t.textContent=g,x.appendChild(t)}const C=document.createElement("div");C.className="retailer-body";const k=document.createElement("span");k.className="product-price",k.textContent=formatCentToDollarText(null!==(l=t.price)&&void 0!==l?l:0);const S=document.createElement("span");S.className="shipping-price",S.textContent=h>0?"+ "+formatCentToDollarText(h):"FREE Delivery";const E=document.createElement("span");return E.className="expectation",E.textContent=i.isClosed?v:(null==u?void 0:u.isActive)?p:(null==t?void 0:t.expectation.detail)||"No expectation available",C.append(k,S,E),b.append(x,C),b}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,r=this.config.layout.enableShippingFulfillment,s=this.config.layout.enableOnDemandFulfillment,a=[];for(const o in n.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(n.shippingFulfillments,o)){const t=n.shippingFulfillments[o],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;a.push(t)}const c=[];for(const o in n.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,o)){const t=n.onDemandFulfillments[o],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;c.push(t)}const l=e.selectedFulfillmentType===o.SHIPPING,h=e.selectedFulfillmentType===o.ON_DEMAND,u=l?a:c,p=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:c,shippingSelected:l,onDemandSelected:h,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:r,enableOnDemandFulfillment:s});if(!e.fulfillmentHasAvailability||0===u.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.textContent=l?dt:ht,[p,t]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const m of u){const t=getRetailerOffHours(m),n=this.generateRetailerCard({fulfillment:m,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:m.fulfillmentId===e.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:i}),r=e.selectedFulfillmentType===o.ON_DEMAND&&t&&t.isClosed;r||n.addEventListener("click",this.onRetailerCardClick.bind(this)),this.listContainer.appendChild(n)}return this.listViewport.appendChild(this.listContainer),[p,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),r=(null==n?void 0:n.attributes)||null,s=this.config.layout.enableShippingFulfillment,a=this.config.layout.enableOnDemandFulfillment,c=Object.values(n.shippingFulfillments),l=Object.values(n.onDemandFulfillments),h=(s?c.length:0)+(a?l.length:0),u=document.createElement("div");u.className="header";const p=document.createElement("span");p.className="header-label",p.textContent=e.selectedFulfillmentType===o.SHIPPING?"Shipping From:":"Delivering From:";const m=document.createElement("button");if(m.className="delivery-options",m.type="button",m.textContent="See Delivery Options ("+h+")",m.addEventListener("click",async()=>{0!==h&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,i.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),u.appendChild(p),u.appendChild(m),!e.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.textContent=e.selectedFulfillmentType===o.SHIPPING?dt:ht,[u,t]}const f=document.createElement("div");f.className="popup-fulfillment-list-container";const g=getRetailerOffHours(e.selectedFulfillment),v=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],fulfillmentStatus:g,selectedSizeAttributes:r});return f.appendChild(v),[u,f]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const Y=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(e),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},i=this.getStoreValue("products."+e+".selectedFulfillment");if(i&&i.fulfillmentId===n)return await Y(),void 0;await this.commands.product.selectFulfillment(e,n),await Y()}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,r=this.config.layout.enableShippingFulfillment,s=this.config.layout.enableOnDemandFulfillment,a=[];for(const o in n.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(n.shippingFulfillments,o)){const t=n.shippingFulfillments[o],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;a.push(t)}const c=[];for(const o in n.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,o)){const t=n.onDemandFulfillments[o],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;c.push(t)}const l=e.selectedFulfillmentType===o.SHIPPING,h=e.selectedFulfillmentType===o.ON_DEMAND,u=l?a:c,p=document.createElement("h5");p.className="popup-retailers-section-title",p.textContent="Delivery Options";const m=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:c,shippingSelected:l,onDemandSelected:h,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:r,enableOnDemandFulfillment:s});if(!e.fulfillmentHasAvailability||0===u.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.textContent=l?dt:ht,[p,m,t]}const f=document.createElement("div");f.className="popup-fulfillment-list-container";for(const o of u){const t=getRetailerOffHours(o),n=renderPopupRetailerCard({fulfillment:o,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:o.fulfillmentId===e.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:i});n.addEventListener("click",this.onRetailerCardClick.bind(this)),f.appendChild(n)}return[p,m,f]}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,e;const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],i=null!==(e=this.params.showFirstEvent)&&void 0!==e?e:!![];if(n){const t=this.store.get(this.params.errorStorePath)||[],e=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return i?e.slice(0,1):e}const o=this.store.get(this.params.errorStorePath);return o?[{message:o,level:"error"}]:[]}createErrorElement(t){const e=document.createElement("div");e.classList.add("alert-container","alert-"+t.level);const n=document.createElement("span");n.classList.add("alert-icon"),n.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const i=document.createElement("span");return i.classList.add("alert-text"),i.textContent=t.message,e.appendChild(n),e.appendChild(i),e}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const e=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},e)}hideAllErrors(){var t;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[];const e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];e?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(i.CART)});const e=document.createElement("span");if(e.className="lce-cart-button-icon",e.innerHTML=BagIcon({color:t.theme.primaryColor}),this.params.showItemsCount){const t=document.createElement("span");return t.className="lce-cart-button-badge",t.style.visibility="hidden",[e,t]}return[e]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const e=this.getStoreValue("cart.totals.quantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const e=this.getStoreValue("cart.totals.quantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var e;const n=t.find(t=>"ui.drawer"===t.path);if(!n)return![];const i=n.value,o=i.isOpen,r=null===(e=i.contentConfig)||void 0===e?void 0:e.type,s=r!==this.currentContentType;return o&&!this.isOpen?(this.currentContentType=r,this.openWithContent(i),![]):o&&this.isOpen&&!s?![]:o&&this.isOpen&&s?(this.currentContentType=r,this.openWithContent(i),![]):!o&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:e,data:n}=t||{};let i;i=this.isElementsEnabled()?ComponentFactoryService.createElement({type:e,...n}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(i,e):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(i),this.updateDrawerContentTypeClass(e),this.open()),this.addHostAttribute("data-target",e.toString().toLowerCase())}catch(e){this.logger.error("Drawer content loading failed",{contentType:null==t?void 0:t.type,error:e instanceof Error?e.message:String(e)}),this.commands.ui.closeDrawer()}}animateContentSwap(t,e){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const n=this.contentContainer.firstElementChild;n.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{n.classList.add("fading")}),setTimeout(()=>{n.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(e),requestAnimationFrame(()=>{t.classList.add("visible"),setTimeout(()=>{t.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(t){if(!this.drawerElement)return;const e=["drawer"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.drawerElement.className=e.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled:",e),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.inputs=[],this.charCountElements=[]}get hostClasses(){return["engraving-form-container"]}afterRender(){this.initializeCharacterCounts()}async handleClick(t){const e=t.target;e.matches(".engraving-form-button-save")&&await this.handleSave(),e.matches(".engraving-form-button-cancel")&&await this.closeDrawer()}handleInput(t){const e=t.target;e.matches(".engraving-form-input")&&this.updateCharacterCount(e)}updateCharacterCount(t){const e=Number.parseInt(t.dataset.line||"0",10)-1,n=this.charCountElements[e];if(n){const e=t.value.length,i=this.params.maxCharsPerLine;n.textContent=e+"/"+i}}initializeCharacterCounts(){for(const t of this.inputs)this.updateCharacterCount(t)}async closeDrawer(){const{identifier:t,context:e}=this.params;"product"===e&&(this.clientConfig.isMobile()?this.commands.ui.closeDrawer():await this.commands.product.closeProductDrawer(t)),"cart"===e&&this.commands.ui.openDrawer(i.CART),"checkout"===e&&this.commands.ui.closeDrawer()}collectEngravingLines(){return this.inputs.map(t=>t.value.toString().trim().toUpperCase()).filter(t=>t.length>0)}async handleSave(){const{identifier:t,context:e}=this.params,n=this.collectEngravingLines();if(0===n.length)return await this.closeDrawer(),void 0;"product"===e&&await this.commands.product.updateEngravingLines(t,n),"cart"===e&&await this.commands.cart.updateItemEngraving(t,n),"checkout"===e&&await this.commands.cart.updateItemEngraving(t,n),await this.closeDrawer()}template(){var t;const{maxLines:e,lines:n,location:i,maxCharsPerLine:o}=this.params;this.inputs=[],this.charCountElements=[];const r=Array.from({length:e},(t,e)=>{const i=n[e]||"",r=document.createElement("div");r.className="engraving-form-input-container",r.setAttribute("data-line-container","");const s=document.createElement("input");s.type="text",s.id="engraving-line-"+(e+1),s.dataset.line=(e+1).toString(),s.maxLength=o,s.value=i,s.placeholder="Line "+(e+1),s.className="engraving-form-input",s.autocomplete="off",this.inputs.push(s);const a=document.createElement("span");return a.className="engraving-form-input-char-count",a.textContent=i.length+"/"+o,this.charCountElements.push(a),r.appendChild(s),r.appendChild(a),r}),s=document.createElement("div");s.className="engraving-form-header";const a=document.createElement("p");if(a.className="engraving-form-title",a.textContent="Personalize with a message",s.appendChild(a),i&&(null===(t=null==i?void 0:i.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-form-location",t.textContent="Engraving will appear "+i.toLowerCase(),s.appendChild(t)}const c=document.createElement("div");c.className="engraving-form-lines";for(const m of r)c.appendChild(m);const l=document.createElement("div");l.className="engraving-form-actions";const h=document.createElement("button");h.type="button",h.className="engraving-form-button-cancel",h.textContent="Cancel",l.appendChild(h);const u=document.createElement("button");u.type="button",u.className="engraving-form-button-save",u.textContent="Save",l.appendChild(u);const p=document.createElement("p");return p.className="engraving-form-disclaimer",p.innerHTML="\n Personalized orders require up to 10 business days to be processed and then shipped.\n Tracking information will be provided once processed.\n <span>Personalized bottle orders cannot be canceled.</span>\n ",this.container.addEventListener("click",this.handleClick.bind(this)),this.container.addEventListener("input",this.handleInput.bind(this)),[s,c,l,p]}}class BirthdateInputComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["custom-input","birthdate",t.layout.inputFieldStyle]}constructor(){super({watchOnlyStorePaths:["checkout.focusField"]})}onStoreWatch(t){const e=t.find(t=>"checkout.focusField"===t.path);e&&e.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"}))}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const t=this.params.value.split("/");3===t.length&&(this.monthInput.value=t[0],this.dayInput.value=t[1],this.yearInput.value=t[2])}}setupEventListeners(){this.monthInput.addEventListener("input",t=>{this.formatMonth(t),this.handleNavigation(t,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",t=>{this.formatDay(t),this.handleNavigation(t,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",t=>{this.formatYear(t),this.handleChange()}),this.monthInput.addEventListener("blur",()=>this.validateInput()),this.dayInput.addEventListener("blur",()=>this.validateInput()),this.yearInput.addEventListener("blur",()=>this.validateInput());for(const t of[this.monthInput,this.dayInput,this.yearInput])t.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length&&Number.parseInt(n,10)>1)n="0"+n;else if(2===n.length){const t=Number.parseInt(n,10);t>12?n="12":t<1&&(n="01")}e.value=n}formatDay(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length&&Number.parseInt(n,10)>3)n="0"+n;else if(2===n.length){const t=Number.parseInt(n,10);t>31?n="31":t<1&&(n="01")}e.value=n}formatYear(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>4&&(n=n.substring(0,4)),e.value=n}handleNavigation(t,e){const n=t.target,i=n===this.yearInput?4:2;n.value.length===i&&e&&e.focus()}handleChange(){if(this.clearErrors(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}getFormattedValue(){const t=this.monthInput.value.padStart(2,"0"),e=this.dayInput.value.padStart(2,"0"),n=this.yearInput.value;return t&&e&&n&&4===n.length?n+"-"+t+"-"+e:""}validateDate(t,e,n){if(!t||!e||!n||4!==n.length)return![];const i=Number.parseInt(t,10),o=Number.parseInt(e,10),r=Number.parseInt(n,10);if(i<1||i>12||o<1||o>31||r<1e3)return![];const s=new Date(r,i-1,o);return s.getFullYear()===r&&s.getMonth()===i-1&&s.getDate()===o}calculateAge(t){const e=new Date;let n=e.getFullYear()-t.getFullYear();const i=e.getMonth()-t.getMonth();return(i<0||0===i&&e.getDate()<t.getDate())&&n--,n}validateInput(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value,i=[],o=this.params.validation;if(!o)return this.showErrors([]),!![];if(o.required&&(t&&e&&n||i.push("Please enter a complete date")),t||e||n)if(t&&e&&n&&4===n.length)if(this.validateDate(t,e,n)){const r=Number.parseInt(t,10),s=Number.parseInt(e,10),a=Number.parseInt(n,10),c=new Date(a,r-1,s);if(void 0!==o.minYear&&a<o.minYear&&i.push("Year must be "+o.minYear+" or later"),void 0!==o.maxYear&&a>o.maxYear&&i.push("Year must be "+o.maxYear+" or earlier"),void 0!==o.minAge||void 0!==o.maxAge){const t=this.calculateAge(c);void 0!==o.minAge&&t<o.minAge&&i.push("Must be at least "+o.minAge+" years old"),void 0!==o.maxAge&&t>o.maxAge&&i.push("Must be no more than "+o.maxAge+" years old")}if(o.customValidator){const t=o.customValidator(this.getFormattedValue());t&&i.push(t)}}else i.push("Please enter a valid date");else i.push("Please enter a complete date (MM/DD/YYYY)");this.showErrors(i);const r=0===i.length;return this.params.onValidation&&this.params.onValidation(r,i),r}showErrors(t){this.errorContainer.innerHTML="";const e=[this.monthInput,this.dayInput,this.yearInput];if(t.length>0){this.errorContainer.classList.add("show");for(const t of e)t.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else for(const n of e)n.classList.remove("input-error")}clearErrors(){const t=[this.monthInput,this.dayInput,this.yearInput],e=t.some(t=>t.classList.contains("input-error"));if(e){for(const e of t)e.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(t){if(t){const e=t.split("/");3===e.length&&(this.monthInput.value=e[0],this.dayInput.value=e[1],this.yearInput.value=e[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name+"-month"),e.push(n)}const n=document.createElement("div");n.className="date-input-container";const i=document.createElement("input");i.type="text",i.placeholder="MM",i.name=this.params.name+"-month",i.id=this.params.name+"-month",i.maxLength=2,i.className="date-field month-field",i.setAttribute("data-field","month"),i.inputMode="numeric";const o=document.createElement("span");o.className="date-separator",o.textContent="/";const r=document.createElement("input");r.type="text",r.placeholder="DD",r.name=this.params.name+"-day",r.id=this.params.name+"-day",r.maxLength=2,r.className="date-field day-field",r.setAttribute("data-field","day"),r.inputMode="numeric";const s=document.createElement("span");s.className="date-separator",s.textContent="/";const a=document.createElement("input");a.type="text",a.placeholder="YYYY",a.name=this.params.name+"-year",a.id=this.params.name+"-year",a.maxLength=4,a.className="date-field year-field",a.setAttribute("data-field","year"),a.inputMode="numeric",this.params.disabled&&(i.disabled=!![],r.disabled=!![],a.disabled=!![]),this.params.className&&(n.className+=" "+this.params.className),n.appendChild(i),n.appendChild(o),n.appendChild(r),n.appendChild(s),n.appendChild(a);const c=document.createElement("div");return c.className="error-container",e.push(n),e.push(c),e}}class InputComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}constructor(){super({watchStorePaths:["checkout.focusField"]})}onStoreChanged(t){const e=t.find(t=>"checkout.focusField"===t.path);return e&&e.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"})),![]}handlePhoneKeydown(t){if("Backspace"===t.key){const e=t.target,n=e.selectionStart||0,i=e.value;n>0&&/\D/.test(i[n-1])&&setTimeout(()=>{const t=Math.max(0,n-2);e.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>10&&(n=n.substring(0,10)),n.length>=6?n="("+n.substring(0,3)+") "+n.substring(3,6)+"-"+n.substring(6):n.length>=3&&(n="("+n.substring(0,3)+") "+n.substring(3)),e.value=n}formatDate(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>8&&(n=n.substring(0,8)),n.length>=5?n=n.substring(0,2)+"/"+n.substring(2,4)+"/"+n.substring(4):n.length>=3&&(n=n.substring(0,2)+"/"+n.substring(2)),e.value=n}validateEmail(t){const e=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/;return e.test(t)}validateTel(t){const e=/^\(\d{3}\) \d{3}-\d{4}$/;return e.test(t)}validateDate(t){const e=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!e.test(t))return![];const[n,i,o]=t.split("/").map(Number),r=new Date(o,n-1,i);return r.getFullYear()===o&&r.getMonth()===n-1&&r.getDate()===i}validateInput(){const t=this.inputElement.value,e=[],n=this.params.validation;if(!n)return this.showErrors([]),!![];if(n.required&&!t.trim()&&e.push("This field is required"),t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||e.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||e.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(t)||e.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const i=Number.parseFloat(t);Number.isNaN(i)?t.trim()&&e.push("Please enter a valid number"):(void 0!==n.min&&i<n.min&&e.push("Value must be at least "+n.min),void 0!==n.max&&i>n.max&&e.push("Value must be no more than "+n.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==n.min&&t.length<n.min&&e.push("Must be at least "+n.min+" characters"),void 0!==n.max&&t.length>n.max&&e.push("Must be no more than "+n.max+" characters")),n.pattern){const i=new RegExp(n.pattern);i.test(t)||e.push("Invalid format")}if(n.customValidator){const i=n.customValidator(t);i&&e.push(i)}}this.showErrors(e);const i=0===e.length;return this.params.onValidation&&this.params.onValidation(i,e),i}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===this.params.inputType&&this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name),e.push(n)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&"number"===this.params.inputType&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&"number"===this.params.inputType&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"===this.params.inputType&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("blur",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",e.push(this.inputElement),e.push(this.errorContainer),e}}class LceElementComponent extends HTMLElement{constructor(){super(),this.O=![],this.G=this.attachShadow({mode:"closed"})}initialize(t,e){if(this.O)return console.warn("Already initialized, ignoring subsequent calls"),void 0;if(!t||"string"!=typeof t)throw new Error("LceElementComponent: contentType must be a non-empty string");if(!(e&&e instanceof HTMLElement))throw new Error("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.G)throw new Error("LceElementComponent: Shadow DOM container is not available");this.G.appendChild(e),this.applyBasicStyles();const n=ThemeProviderService.getInstance(),i=n.getStylesheet(t);this.applyThemeStyles(i),this.O=!![],this.G=null}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n }\n\n :host([drawer]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const e=new CSSStyleSheet;e.replaceSync(t),this.G.adoptedStyleSheets=[e,...this.G.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(D){this.createFallbackStylesheet(t)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}applyThemeStyles(t){t.forEach(t=>{"string"==typeof t?this.createFallbackStylesheet(t):this.G.adoptedStyleSheets=[...this.G.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const e=document.createElement("style");e.textContent=t,this.G&&this.G.appendChild(e)}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:e,showDescription:n,showQuantityCounter:i,fulfillmentDisplay:o,showImages:r}=this.config.layout,s=document.createElement("div");s.classList.add("product-content-wrapper");const a=document.createElement("div");if(a.classList.add("skeleton-container"),e){const t=document.createElement("div");t.classList.add("wave","sc-title"),a.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),a.appendChild(t),a}const c=document.createElement("div");c.classList.add("wave","sc-price"),a.appendChild(c);const l=document.createElement("div");l.classList.add("sc-sizes");const h=document.createElement("div");h.classList.add("wave","sc-size-button"),l.appendChild(h);const u=document.createElement("div");u.classList.add("wave","sc-size-button"),l.appendChild(u);const p=document.createElement("div");p.classList.add("wave","sc-size-button"),l.appendChild(p);const m=document.createElement("div");m.classList.add("wave","sc-size-button"),l.appendChild(m);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),l.appendChild(f),a.appendChild(l);const g=document.createElement("div");g.classList.add("sc-row");const v=document.createElement("div");v.classList.add("wave","sc-price"),g.appendChild(v);const y=document.createElement("div");y.classList.add("wave","sc-personalization"),g.appendChild(y),a.appendChild(g);const b=document.createElement("div");b.classList.add("wave","sc-deliver-to"),a.appendChild(b);const x=document.createElement("div");x.classList.add("wave","sc-address"),a.appendChild(x);const w=document.createElement("div");w.classList.add("wave","sc-retailers",o),a.appendChild(w);const C=document.createElement("div");if(C.classList.add("sc-row"),i){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),C.appendChild(t)}const k=document.createElement("div");if(k.classList.add("wave","sc-add-to-cart"),C.appendChild(k),a.appendChild(C),n){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),a.appendChild(t);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),a.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),a.appendChild(n);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),a.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-more"),a.appendChild(o)}const S=document.createElement("div");if(S.classList.add("product-content"),S.appendChild(a),s.appendChild(S),r){s.classList.add("has-images");const t=this.createImageSkeletons();s.prepend(t)}return s}createImageSkeletons(){const t=document.createElement("div");t.classList.add("product-image-carousel","skeleton");const e=document.createElement("div");e.classList.add("wave","sc-main-image"),e.title="Product main image loading";const n=document.createElement("div");n.classList.add("carousel-dots");for(let r=0;r<3;r++){const t=document.createElement("div");t.classList.add("wave","sc-carousel-dot"),n.appendChild(t)}e.appendChild(n),t.appendChild(e);const i=document.createElement("div");i.classList.add("gallery-viewport");const o=document.createElement("div");o.classList.add("gallery-container");for(let r=0;r<4;r++){const t=document.createElement("div");t.classList.add("gallery-image-wrapper");const e=document.createElement("div");e.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(e),o.appendChild(t)}return i.appendChild(o),t.appendChild(i),t}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const t=document.createElement("div");t.className="pb-title-container";const e=document.createElement("span");e.className="pb-text",e.textContent="Powered by",t.appendChild(e);const n=document.createElement("span");n.className="pb-lc",n.textContent="LiquidCommerce",t.appendChild(n);const i=document.createElement("span");return i.className="pb-dot",i.textContent=".",t.appendChild(i),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const e=this.getDisclaimerConfig();return e.parts.forEach(e=>{"text"===e.type?t.appendChild(document.createTextNode(e.content)):"link"===e.type&&t.appendChild(this.createLink(e.href,e.text))}),t}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(t,e){const n=document.createElement("a");return n.href=t,n.target="_blank",n.rel="noopener noreferrer",n.className="pb-link",n.textContent=e,n}template(){const t=this.createPoweredBySection(),e=this.createDisclaimerSection();return[t,e]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!e||!this.applyButton||!this.currentActiveTicker)return;const n=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);n&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!n&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const e=this.store.get("cart.promoCode"),n=this.store.get("checkout.promoCode");return(null==e?void 0:e.code)===t||(null==n?void 0:n.code)===t}getActiveTickers(){var t;const e=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var n;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const e=document.createElement("div");e.classList.add("promo-ticker__text-group");const n=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const i of n){const n=i.trim();if(!n)continue;const o=document.createElement("span");o.classList.add("promo-ticker__text-item"),o.textContent=n,e.appendChild(o);const r=document.createElement("span");r.classList.add("promo-ticker__separator"),r.textContent=t.separator,e.appendChild(r)}return e}async handlePromoClick(){var t;(null===(t=this.currentActiveTicker)||void 0===t?void 0:t.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const t=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(t),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const e=document.createElement("div");e.classList.add("promo-ticker__content");const n=document.createElement("div");n.classList.add("promo-ticker__track");for(let o=0;o<5;o++)n.appendChild(this.generateTextContent(this.currentActiveTicker));e.appendChild(n);const i=document.createElement("button");return i.type="button",i.classList.add("promo-ticker__cta"),i.textContent="APPLY",this.promoCodeApplied&&(i.disabled=!![],i.textContent="APPLIED"),i.addEventListener("click",()=>this.handlePromoClick()),this.applyButton=i,[e,i]}}const ut=LoggerFactory.get("ElementsClientHelper"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,e){if(!t||!e)return t;const n={...t},i=[];for(const o in e){const r=e[o],s=n[o];if(!(o in t)){i.push('Property "'+o+'" does not exist in target schema, skipping merge.');continue}const a=getType(r),c=getType(s);a===c?isObject(r)&&isObject(s)?n[o]=deepMergeConfigs(s,r):n[o]=r:i.push('Type mismatch for key "'+o+'": source is '+a+", target is "+c+". Skipping merge.")}return i.length>0&&ut.warn("Merging configurations with warnings:",i),n}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}getProductStore(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".items")||{};return Object.values(e).find(e=>e.fulfillmentId===t)}handleItemsUpdate(t,e){const n=new Set(t||[]),o=new Set(e||[]);for(const i of n)if(!o.has(i)){const t=this.container.querySelector('[data-item-id="'+i+'"]');t&&t.remove()}for(const r of o)if(!n.has(r)){const t=ComponentFactoryService.createElement({type:i.CART_ITEM,itemId:r});t.setAttribute("data-item-id",r),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".items")||[],n=this.container.querySelectorAll("[data-item-id]");for(const i of n)i.remove();for(const o of e){const t=ComponentFactoryService.createElement({type:i.CART_ITEM,itemId:o});t.setAttribute("data-item-id",o),this.container.appendChild(t)}}setupMinimumPurchaseAlert(){var t;const e=this.getFulfillmentId(),n=(null===(t=this.getProductStore())||void 0===t?void 0:t.pack)||![],o=this.getStoreValue("cart.fulfillments."+e),r=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(r&&r.remove(),shouldShowMinimumPurchaseAlert(o,n)){const t=getMinimumPurchaseMessage(o,n),e=ComponentFactoryService.createElement({type:i.PURCHASE_MIN_ALERT,message:t.message,messageType:t.type,currentTotal:o.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(e)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var t;const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e);return(null===(t=null==n?void 0:n.items)||void 0===t?void 0:t.length)?n.items.some(t=>{const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.updating)===!![]}):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}onStoreChanged(t){const e=this.getFulfillmentId(),n="cart.fulfillments."+e,i=t.find(t=>t.path===n),o=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(o.length>0&&this.checkAndUpdateLoadingState(),i){const t=i.oldValue,e=i.value,n=(null==t?void 0:t.items)||[],o=(null==e?void 0:e.items)||[],r=JSON.stringify(n)!==JSON.stringify(o);r&&(this.handleItemsUpdate(n,o),this.checkAndUpdateLoadingState());const s=this.hasFulfillmentFeesChanged(t,e),a=this.hasFulfillmentDataChanged(t,e,["items","updating"]);if(s&&!a&&this.setupMinimumPurchaseAlert(),!a)return![]}return![]}hasFulfillmentFeesChanged(t,e){return t?t.subtotal!==e.subtotal||t.shippingFee!==e.shippingFee||t.deliveryFee!==e.deliveryFee||JSON.stringify(t.fees)!==JSON.stringify(e.fees):!![]}hasFulfillmentDataChanged(t,e,n=[]){if(!t)return!![];const i=["type","canEngrave","retailerId"];for(const o of i)if(!n.includes(o)&&t[o]!==e[o])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}class LiquidCommerceElementsClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],this.builder={updateComponentGlobalConfigs:async t=>{if(this.ensuredIsBuilder("updateComponentGlobalConfigs"))try{if(!t)throw new Error("Global theme configuration is required");this.themeProvider.updateComponentGlobalConfigs(t),t.layout&&Object.keys(t.layout).length>0&&(await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout()),this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(e){throw this.logger.error("❌ Failed to update global theme configuration:",e),new Error("Global theme update failed")}},updateProductComponent:async t=>{if(this.ensuredIsBuilder("updateProductComponent"))try{if(!t)throw new Error("Product component configuration is required");this.themeProvider.updateProductComponent(t),t.layout&&Object.keys(t.layout).length>0&&await this.commands.product.rerenderAllProducts(),this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(e){throw this.logger.error("❌ Failed to update product component theme:",e),new Error("Product theme update failed")}},updateCartComponent:t=>{if(this.ensuredIsBuilder("updateCartComponent"))try{if(!t)throw new Error("Cart component configuration is required");this.themeProvider.updateCartComponent(t),t.layout&&Object.keys(t.layout).length>0&&this.commands.cart.rerenderCart(),this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(e){throw this.logger.error("❌ Failed to update cart component theme:",e),new Error("Cart theme update failed")}},updateCheckoutComponent:t=>{if(this.ensuredIsBuilder("updateCheckoutComponent"))try{if(!t)throw new Error("Checkout component configuration is required");this.themeProvider.updateCheckoutComponent(t),t.layout&&Object.keys(t.layout).length>0&&this.commands.checkout.rerenderCheckout(),this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(e){throw this.logger.error("❌ Failed to update checkout component theme:",e),new Error("Checkout theme update failed")}},updateAddressComponent:t=>{if(this.ensuredIsBuilder("updateAddressComponent"))try{if(!t)throw new Error("Address component configuration is required");this.themeProvider.updateAddressComponent(t),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(e){throw this.logger.error("❌ Failed to update address component theme:",e),new Error("Address theme update failed")}},injectElement:async t=>{this.ensuredIsBuilder("injectElement")&&await this.processInjectElement(t)},injectProductElement:async t=>{this.ensuredIsBuilder("injectProductElement")&&await this.processInjectProduct(t)},injectAddressElement:async(t,e)=>{this.ensuredIsBuilder("injectAddressElement")&&await this.processInjectElement({type:i.ADDRESS,containerId:t,options:e})},injectCartElement:async t=>{this.ensuredIsBuilder("injectCartElement")&&await this.processInjectElement({type:i.CART,containerId:t})},injectCheckoutElement:async t=>{this.ensuredIsBuilder("injectCheckoutElement")&&await this.processInjectElement({type:i.CHECKOUT,containerId:t})}},this.ui={cartButton:(t,e)=>{var n;this.ensureCartDrawerExists();const o=document.getElementById(null!==(n=null==t?void 0:t.replace("#",""))&&void 0!==n?n:"");if(!o)throw new Error("Container with ID '"+t+"' not found");const r=ComponentFactoryService.createElement({type:i.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});o.innerHTML="",safeReplaceChildren(o,r)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:i.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(e)},cartSubtotal:t=>{var e;const n=document.getElementById(null!==(e=null==t?void 0:t.replace("#",""))&&void 0!==e?e:"");if(!n)throw new Error("Element with ID '"+t+"' not found");n.innerHTML="";const i=this.store.get("cart.totals.subtotal")||0;n.textContent=formatCentToDollarText(i),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.subtotal")||0;n.textContent=formatCentToDollarText(t)})},cartItemsCount:t=>{var e;const n=document.getElementById(null!==(e=null==t?void 0:t.replace("#",""))&&void 0!==e?e:"");if(!n)throw new Error("Element with ID '"+t+"' not found");n.innerHTML="";const i=this.store.get("cart.totals.quantity")||0;n.textContent=i.toString(),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.quantity")||0;n.textContent=t.toString()})}},this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authService=AuthService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Failed to prepare client:",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",D.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&LoggerFactory.setEnableLogging(!![]),this.logger.debug("🔐 Starting authentication...");const t=await this.authService.authenticate();if(!t)throw this.clientPrepared=![],new Error("Authentication failed");this.logger.debug("✅ Authentication completed"),this.logger.debug("🌐 Setting up API client..."),await this.apiClient.setClient(this.authService),this.logger.debug("✅ API client setup completed"),this.logger.debug("⚙️ Loading configurations...");let e=await this.apiClient.getAllConfigs();this.logger.debug("✅ Configurations loaded"),this.logger.debug("🔍 Setting up fingerprinting and store...");const n=await this.fingerPrintService.getId(e.configurations.partnerCode),i=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",n),this.clientConfig.set("isLocalStorageAvailable",i);const o=i?null:await this.apiClient.getPersistedStore(n);if(await this.store.initialize({userDeviceId:n,isLocalStorageAvailable:i,persistedStore:o}),this.logger.debug("✅ Store setup completed"),this.logger.debug("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme");e=deepMergeConfigs(e,t)}await this.themeProvider.initialize(e),this.logger.debug("✅ Theme provider initialized"),this.logger.debug("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.debug("✅ Essential components registered"),this.logger.debug("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(t){this.logger.warn("Heavy initialization failed, but client remains functional:",t)}},0)}async initializeHeavyServices(){const t=this.themeProvider.getConfigs("configurations");if(!this.gtmInitialized)try{await this.googleTagManager.initialize({partnerName:t.partnerName,partnerGtmId:t.googleTagManagerId,partnerEnableGaTracking:t.enablePartnerGaTracking,liquidCommerceEnableGaTracking:t.enableLiquidCommerceGaTracking,liquidCommerceGtmId:t.liquidCommerceGoogleTagManagerId}),this.gtmInitialized=!![]}catch(e){this.logger.warn("GTM initialization failed:",e)}try{this.isElementsEnabled()&&await this.commands.common.loadCart()}catch(n){this.logger.warn("Cart pre-loading failed:",n)}this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}async injectProductElement(t){if(this.isElementsEnabled())await this.processInjectProduct(t);else for(const e of t)this.injectDisabledElementsError(e.containerId,i.PRODUCT)}async injectAddressElement(t,e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t,i.ADDRESS),void 0;await this.processInjectElement({type:i.ADDRESS,containerId:t,options:e})}async injectCartElement(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t,i.CART),void 0;await this.processInjectElement({type:i.CART,containerId:t})}async injectCheckoutElement(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t,i.CHECKOUT),void 0;await this.processInjectElement({type:i.CHECKOUT,containerId:t})}get actions(){return this.clientAction.actions}async processInjectProduct(t){var e,n;if(this.ensureAllComponentsRegistered(),0===t.length)throw new Error("At least one product must be provided");t.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const o=t.slice(0,20),r=[];for(const i of o){const t=null===(n=null===(e=i.containerId)||void 0===e?void 0:e.replace("#",""))||void 0===n?void 0:n.trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+i.identifier+"'");continue}const o=document.getElementById(t);if(!o){this.logger.warn("Container with ID '"+t+"' not found for product '"+i.identifier+"'");continue}const s=r.every(e=>e.containerId!==t);if(!s){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!i.identifier){this.logger.warn("Product identifier is required for container ID '"+t+"'");continue}const a=r.every(t=>t.identifier!==i.identifier);a?r.push({containerId:t,identifier:i.identifier}):this.logger.warn("Duplicate product identifier '"+i.identifier+"' found, skipping")}for(const s of r){const t=ComponentFactoryService.createElement({type:i.PRODUCT,useShadowDom:!![],productId:s.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(s.containerId);e?(e.innerHTML="",safeReplaceChildren(e,t),await this.commands.product.createProductInstance(s.identifier,!![])):this.logger.warn("Product ("+s.identifier+") container with ID '"+s.containerId+"' not found")}await this.commands.product.loadMultipleProducts(r.map(t=>t.identifier))}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t.containerId)throw new Error("Container ID is required");if(!t.type)throw new Error("Component type is required");const e=t.containerId.replace("#",""),n=document.getElementById(e);if(!n)return console.warn("Container with ID '"+e+"' not found"),void 0;n.innerHTML="";const o={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]};t.type===i.ADDRESS&&t.options&&(o.options=t.options);const r=ComponentFactoryService.createElement(o);safeReplaceChildren(n,r),t.type===i.CHECKOUT&&await this.commands.checkout.loadCheckout()}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:i.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled:",e),!![]}}injectDisabledElementsError(t,e){const n=document.getElementById(t.replace("#",""));if(!n)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let i;i=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),n.innerHTML="",safeReplaceChildren(n,i)}registerEssentialComponents(){ComponentFactoryService.registerComponent(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(i.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LOADING,ProductLoadingComponent)}registerComponents(){this.componentFactoryInitialized||(ComponentFactoryService.registerComponent(i.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(i.INPUT,InputComponent),ComponentFactoryService.registerComponent(i.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(i.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(i.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(i.ALERT,AlertComponent),ComponentFactoryService.registerComponent(i.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(i.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(i.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(i.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(i.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(i.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(i.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(i.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(i.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(i.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(i.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(i.CART,CartComponent),ComponentFactoryService.registerComponent(i.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(i.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(i.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(i.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(i.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(i.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(i.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(i.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(i.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(i.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_INFORMATION_SECTION,CheckoutInformationSectionComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PAYMENT_FORM,CheckoutPaymentFormComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BILLING_FORM,CheckoutBillingFormComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_SUMMARY_SECTION,CheckoutSummarySectionComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_DELIVERY_INFORMATION_FORM,CheckoutDeliveryInformationComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BUYER_INFORMATION_FORM,CheckoutBuyerInformationComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent))}ensuredIsBuilder(t){return this.clientConfig.isBuilder()?!![]:(this.logger.error("This method ("+t+") is only available in builder mode"),![])}}async function Elements(t,n){try{const i=ClientConfigService.getInstance();i.initialize(t,{env:n.env,isBuilder:n.isBuilder,enableDebugging:n.enableDebugging,customTheme:n.customTheme,proxy:n.proxy,promoTicker:n.promoTicker});const o=i.getConfigs();SingletonManager.setClientConstructor(LiquidCommerceElementsClient);const r=await SingletonManager.getClient(o);if(!r.clientPrepared)throw new Error("LiquidCommerce Elements failed to initialize properly.");const s={builder:r.builder,injectProductElement:r.injectProductElement.bind(r),injectAddressElement:r.injectAddressElement.bind(r),injectCartElement:r.injectCartElement.bind(r),injectCheckoutElement:r.injectCheckoutElement.bind(r),ui:r.ui,actions:r.actions};window.elements=s;const a=PubSubService.getInstance();return a.publishAction(e.CLIENT_READY,{isReady:!![],message:"Client Is Ready",timestamp:Date.now(),version:i.get("version")}),s}catch(i){const t=(null==i?void 0:i.message)||"Unknown initialization error";console.error("LiquidCommerce Elements initialization failed:",t);try{const n=ClientConfigService.getInstance(),i=PubSubService.getInstance();i.publishAction(e.CLIENT_READY,{isReady:![],message:"Initialization failed: "+t,timestamp:Date.now(),version:n.get("version")||"unknown"})}catch(o){console.warn("LiquidCommerce Elements: Could not fire error event - services unavailable")}return null}}function pairsFromMainScript(t){const e=[],n=t.getAttributeNames().filter(t=>"data-product"===t.substring(0,12));for(const i of n){const n=i.match(/^data-product(-(.+))?$/),o=(null==n?void 0:n[2])?"-"+n[2]:"",r="data-container"+o;t.hasAttribute(r)&&e.push({containerId:t.getAttribute(r),identifier:t.getAttribute(i)})}return e}function pairsFromProductsScript(){const t=[],e=document.querySelectorAll("script[data-liquid-commerce-elements-products]");for(const i of e)try{const e=JSON.parse(i.textContent||"[]");if(!Array.isArray(e))continue;for(const n of e)n.containerId&&n.identifier&&t.push({containerId:n.containerId,identifier:n.identifier})}catch(n){console.error("LiquidCommerce Elements Auto Initialization: Invalid JSON in data-liquid-commerce-elements-products script",n)}return t}function pairsFromAttributedElements(){const t=document.querySelectorAll("div[data-lce-product]"),e=[];for(const n of t){const t="lcep-"+(Date.now().toString(36)+Math.random().toString(36).substring(2,15));n.setAttribute("id",t);const i=n.getAttribute("data-lce-product");t&&i&&e.push({containerId:t,identifier:i})}return e}async function ElementsAutoInitialize(){var e,n,i,o,r,s;try{const s=document.querySelector("script[data-liquid-commerce-elements]");if(!s)return;const a=s.getAttribute("data-token"),c=s.getAttribute("data-env")||t.PRODUCTION,l=s.hasAttribute("data-enable-debugging"),h=s.getAttribute("data-cart-id"),u=s.hasAttribute("data-show-cart-items"),p=s.hasAttribute("data-hide-cart-floating-button"),m=s.getAttribute("data-promo-code"),f=s.getAttribute("data-promo-text"),g=null!==(e=s.getAttribute("data-promo-separator"))&&void 0!==e?e:"•",v=null!==(n=s.getAttribute("data-promo-active-from"))&&void 0!==n?n:void 0,y=null!==(i=s.getAttribute("data-promo-active-until"))&&void 0!==i?i:void 0;if(!a)throw new Error("API key is missing.");const b=pairsFromMainScript(s),x=pairsFromProductsScript(),w=pairsFromAttributedElements(),C=[...b,...x,...w],k=m&&f&&v&&y?{promoCode:m,text:f.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:g,activeFrom:null===(o=new Date(v))||void 0===o?void 0:o.toISOString(),activeUntil:null===(r=new Date(y))||void 0===r?void 0:r.toISOString()}:void 0,S=await Elements(a,{env:c,enableDebugging:l&&c!==t.PRODUCTION,promoTicker:k?[k]:void 0});if(!S)throw new Error("Failed to initialize client.");0!==C.length&&await S.injectProductElement(C),h?S.ui.cartButton(h,u):p||S.ui.floatingCartButton(u)}catch(a){console.error("LiquidCommerce Elements Auto Initialization:",null!==(s=null==a?void 0:a.message)&&void 0!==s?s:String(a))}}function triggerElementsAutoInit(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{setTimeout(ElementsAutoInitialize,100)}):setTimeout(ElementsAutoInitialize,100)}if(void 0===window.customElements)throw new Error("LiquidCommerce Elements SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");if(void 0===HTMLElement.prototype.attachShadow)throw new Error("LiquidCommerce Elements SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");initializeDOMPolyfills(),triggerElementsAutoInit(),initializeDOMPolyfills(),window.Elements=Elements,exports.Elements=Elements,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...t){for(;this.firstChild;)this.removeChild(this.firstChild);for(const e of t)"string"==typeof e?this.appendChild(document.createTextNode(e)):this.appendChild(e)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const e=document.createDocumentFragment();for(const n of t)"string"==typeof n?e.appendChild(document.createTextNode(n)):e.appendChild(n);this.insertBefore(e,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.replaceChild(n,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.insertBefore(n,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.insertBefore(n,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const e={};for(const[n,i]of t)e[n]=i;return e})}function safeScrollIntoView(t,e){try{e&&"function"==typeof t.scrollIntoView?t.scrollIntoView(e):t.scrollIntoView()}catch(n){try{t.scrollIntoView()}catch(i){console.warn("scrollIntoView failed:",i)}}}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(_){console.warn("DOM polyfills initialization failed:",_)}}function safeReplaceChildren(t,...e){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...e);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const n of e)"string"==typeof n?t.appendChild(document.createTextNode(n)):t.appendChild(n)}}catch(n){console.error("replaceChildren operation failed:",n),1===e.length&&"string"==typeof e[0]&&(t.innerHTML=e[0])}}const t={LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},e={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",PRODUCT_ENGRAVING_UPDATED:"product_engraving_updated",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"},n={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},i={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"},o={ON_DEMAND:"onDemand",SHIPPING:"shipping"},r={[t.LOCAL]:"http://0.0.0.0:8080",[t.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[t.STAGING]:"https://staging-elements.liquidcommerce.us",[t.PRODUCTION]:"https://elements.liquidcommerce.us"},s={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 SingletonManager{static getInstances(){return SingletonManager.instances||(SingletonManager.instances=new Map),SingletonManager.instances}constructor(){}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,e){const n=SingletonManager.getInstances();n.has(t)||n.set(t,e());const i=n.get(t);if(!i)throw new Error("ElementsSdk: Instance for class "+t+" could not be created.");return i}static async getClient(t){const e=[t.apiKey,t.env,t.isBuilder,t.enableDebugging].join("_"),n="LiquidCommerceElementsClient_"+e,i=SingletonManager.getInstances();if(i.has(n))return i.get(n);if(!SingletonManager.clientConstructor)throw new Error("LiquidCommerce Elements: Client constructor is not set.");const o=new SingletonManager.clientConstructor(t);return await o.prepare(),i.set(n,o),o}}SingletonManager.instances=null,SingletonManager.clientConstructor=null;class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,e={}){this.validateInputs(t,e),this.config=Object.freeze(this.buildConfiguration(t,e))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,e){if(!this.config)throw new Error("ClientConfigService is not initialized. Please call initialize() first.");this.config=Object.freeze({...this.config,[t]:e})}isDevelopment(){return this.get("env")===t.DEVELOPMENT}isStaging(){return this.get("env")===t.STAGING}isProduction(){return this.get("env")===t.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){return this.get("enableDebugging")}debuggingDisabled(){return!this.get("enableDebugging")}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,n){if(!(null==e?void 0:e.trim()))throw new Error("API key is required");if(n.env&&!Object.values(t).includes(n.env))throw new Error('Invalid environment "'+n.env+'"');if(void 0!==n.isBuilder&&"boolean"!=typeof n.isBuilder)throw new Error("isBuilder must be a boolean");if(void 0!==n.enableDebugging&&"boolean"!=typeof n.enableDebugging)throw new Error("enableDebugging must be a boolean");if(n.promoTicker&&"object"!=typeof n.promoTicker)throw new Error("promoTicker must be an object");if(n.promoTicker){if(!Array.isArray(n.promoTicker))throw new Error("promoTicker must be an array");for(const t of n.promoTicker){if("string"!=typeof t.promoCode||!t.promoCode.trim())throw new Error("promoTicker.promoCode is required and must be a non-empty string");if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))throw new Error("promoTicker.text is required and must be a non-empty array of strings");if("string"!=typeof t.separator||!t.separator.trim())throw new Error("promoTicker.separator is required and must be a non-empty string");if(!t.activeFrom)throw new Error("promoTicker.activeFrom is required");const e="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(e instanceof Date)||Number.isNaN(e.getTime()))throw new Error("promoTicker.activeFrom must be a valid Date object or ISO date string");if(!t.activeUntil)throw new Error("promoTicker.activeUntil is required");const n="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;if(!(n instanceof Date)||Number.isNaN(n.getTime()))throw new Error("promoTicker.activeUntil must be a valid Date object or ISO date string");if(e>=n)throw new Error("promoTicker.activeFrom must be earlier than promoTicker.activeUntil")}}if(n.proxy){if("object"!=typeof n.proxy)throw new Error("proxy must be an object");if(!n.proxy.baseUrl||"string"!=typeof n.proxy.baseUrl)throw new Error("proxy.baseUrl is required and must be a string");if(n.proxy.headers&&"object"!=typeof n.proxy.headers)throw new Error("proxy.headers must be an object")}}buildConfiguration(e,n){var i,o;const s=n.env||t.STAGING,a=r[s];return{apiKey:e.trim(),env:s,isBuilder:null!==(i=n.isBuilder)&&void 0!==i?i:![],enableDebugging:null!==(o=n.enableDebugging)&&void 0!==o?o:![],baseUrl:a,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null}}detectDeviceType(){var t,e;if("undefined"==typeof navigator)return"desktop";const n=navigator.userAgent.toLowerCase(),i="ontouchstart"in window||navigator.maxTouchPoints>0,o=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,r=(null===(e=window.screen)||void 0===e?void 0:e.height)||0,s=Math.max(o,r),a=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],c=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return a.some(t=>t.test(n))?"tablet":c.some(t=>t.test(n))||i&&s<768?"mobile":i&&s>=768&&s<=1200||i&&/macintosh/i.test(n)&&navigator.maxTouchPoints>1||/android/i.test(n)&&i&&s>=768||/windows nt/i.test(n)&&i&&s>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(n),"desktop")}}class LoggerService{constructor(t){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.context=t}static getInstance(t){return SingletonManager.getClassInstance("LoggerService_"+t,()=>new LoggerService(t))}setEnableLogging(t){this.enableLogging=t}getPrefix(t){if(!this.enableLogging)return[];const e=(new Date).toISOString().slice(11,23);return["%c["+e+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[t],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[t],"color: "+this.colors[t]]}debug(...t){if(!this.enableLogging)return;const[e,...n]=this.getPrefix("debug");console.debug(e,...n,...t)}log(...t){if(!this.enableLogging)return;const[e,...n]=this.getPrefix("log");console.log(e,...n,...t)}info(...t){if(!this.enableLogging)return;const[e,...n]=this.getPrefix("info");console.info(e,...n,...t)}warn(...t){if(!this.enableLogging)return;const[e,...n]=this.getPrefix("warn");console.warn(e,...n,...t)}error(...t){if(!this.enableLogging)return;const[e,...n]=this.getPrefix("error");console.error(e,...n,...t)}group(t,e=![]){if(!this.enableLogging)return;const[n,...i]=this.getPrefix("log");e?console.groupCollapsed(n,...i,t):console.group(n,...i,t)}groupEnd(){this.enableLogging&&console.groupEnd()}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const e=this.getInstances();if(!e.has(t)){const n=LoggerService.getInstance(t);n.setEnableLogging(this.enableLoggingGlobally),e.set(t,n)}return e.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const e=this.getInstances();for(const[,n]of e)n.setEnableLogging(t)}}function fetchAdapter(t){return async(e,n)=>{var i;const o=await t(e,n);let r;if("function"==typeof(null===(i=o.headers)||void 0===i?void 0:i.entries))r=Object.fromEntries(o.headers.entries());else{r={};for(const[t,e]of o.headers)r[t]=e}return{ok:o.ok,status:o.status,statusText:o.statusText,headers:r,json:()=>o.json(),text:()=>o.text()}}}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![];const xhrFetch=(t,e)=>new Promise((n,i)=>{const o=new XMLHttpRequest;o.open(e.method||"GET",t);for(const[t,r]of objectEntries(e.headers))o.setRequestHeader(t,r);o.onload=()=>{n({ok:o.status>=200&&o.status<300,status:o.status,statusText:o.statusText,headers:o.getAllResponseHeaders().split("\r\n").reduce((t,e)=>{const[n,i]=e.split(": ");return n&&i&&(t[n]=i),t},{}),json:()=>Promise.resolve(JSON.parse(o.responseText)),text:()=>Promise.resolve(o.responseText)})},o.onerror=()=>{i(new TypeError("Network request failed"))},o.send(e.body)});function getFetchImplementation(){return"undefined"!=typeof fetch?fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?fetchAdapter(global.fetch):window.fetch?fetchAdapter(window.fetch):xhrFetch}function objectValues(t){const e=[];for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(t[n]);return e}function objectEntries(t){const e=[];for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push([n,t[n]]);return e}class AuthService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=getFetchImplementation(),this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(t))}async authenticate(){var t,e;if(this.isAuthenticating)return await new Promise(t=>{const D=()=>{this.isAuthenticating?setTimeout(D,100):t(void 0)};D()}),!!this.accessToken;this.isAuthenticating=!![];try{const n=await this.requestWithoutAuth("/auth",{method:"GET"});return this.accessToken=null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.token,this.tokenExpiration=Date.now()+1e3*(null===(e=null==n?void 0:n.data)||void 0===e?void 0:e.exp),!![]}catch(n){return this.logger.error("Authentication failed:",(null==n?void 0:n.message)||n),![]}finally{this.isAuthenticating=![]}}async requestWithoutAuth(t,e){const n=this.buildUrl(t),i={"Content-Type":"application/json","X-Liquid-Api-Key":this.apiKey,"X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now(),...this.getProxyHeaders(),...e.headers};this.clientConfig.isBuilder()&&(i["X-Liquid-Api-Builder"]=!![]);const o={method:e.method,headers:i,body:e.body?JSON.stringify(e.body):void 0},r=await this.httpClient(n,o);if(!r.ok)throw new Error("HTTP error status: "+r.status);return r.json()}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(t,e){this.accessToken&&!this.isTokenExpired()||await this.authenticate();const n=this.buildUrl(t),i={"Content-Type":"application/json",Authorization:"Bearer "+this.accessToken,"X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now(),...this.getProxyHeaders(),...e.headers};this.clientConfig.isBuilder()&&(i["X-Liquid-Api-Builder"]=!![]);const o={method:e.method,headers:i,body:e.body?JSON.stringify(e.body):void 0},r=await this.httpClient(n,o);let s;try{s=await r.json()}catch(a){const t=await r.text().catch(()=>"HTTP error status: "+r.status);s={message:t||a}}if(!r.ok)throw{...s,status:r.status,message:(null==s?void 0:s.message)||"HTTP error status: "+r.status};return s}buildUrl(t){const e=this.clientConfig.getProxyConfig();return new URL("api"+t,e?e.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}async get(t,e){return this.request(t,{method:"GET",headers:e})}async post(t,e,n){return this.request(t,{method:"POST",body:e,headers:n})}async put(t,e,n){return this.request(t,{method:"PUT",body:e,headers:n})}async delete(t,e){return this.request(t,{method:"DELETE",headers:e})}}const a="@liquidcommerce/elements-sdk",c="LiquidCommerce Elements SDK",l="UNLICENSED",d="LiquidCommerce Team",h="2.2.0",u="https://docs.liquidcommerce.co/elements-sdk",p={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},m={url:"https://github.com/liquidcommerce/elements-sdk/issues"},f="./dist/index.esm.js",g="./umd/elements.js",v="./dist/types/index.d.ts",y="pnpm@10.0.0",x={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},C=["dist","umd","README.md"],k={access:"public",registry:"https://registry.npmjs.org/"},S="module",E=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],I={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"'},T=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],P={"@biomejs/biome":"2.2.2","@commitlint/cli":"^19.8.1","@commitlint/config-conventional":"^19.8.1","@rollup/plugin-alias":"^5.1.1","@rollup/plugin-commonjs":"^28.0.6","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.3.1","@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":"^11.0.6","@semantic-release/npm":"^12.0.2","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.5.2","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.52.2","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^24.2.9","ts-node":"^10.9.2",typescript:"^5.9.2"},F={node:">=20"},A={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},_={name:a,description:c,license:l,author:d,version:h,homepage:u,repository:p,bugs:m,module:f,browser:g,types:v,packageManager:y,exports:x,files:C,publishConfig:k,type:S,sideEffects:E,scripts:I,keywords:T,devDependencies:P,engines:F,pnpm:A};class GoogleTagManagerService{constructor(){this.partnerEnableGaTracking=![],this.liquidCommerceEnableGaTracking=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){if("function"==="object".gtag)return!![];const t=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return t.length>0}isContainerLoaded(t){const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.some(e=>{const n=e.src;return n.includes("id="+t)})}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...t)=>window.dataLayer.push(t),window.dataLayer.push({"gtm.start":Date.now(),event:"gtm.js"}),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(t){return new Promise((e,n)=>{if(this.isContainerLoaded(t))return this.logger.info("GTM container "+t+" already loaded, skipping script injection"),e(),void 0;this.logger.info("Loading GTM container "+t);const i=document.createElement("script");i.src="https://www.googletagmanager.com/gtm.js?id="+t,i.async=!![];const o=setTimeout(()=>n(new Error("GTM script timeout: "+t)),5e3);i.onload=()=>{clearTimeout(o),this.logger.info("GTM container "+t+" loaded successfully"),e()},i.onerror=()=>{clearTimeout(o),n(new Error("GTM script failed: "+t))},document.head.appendChild(i)})}processEventQueue(){const t=Date.now(),e=this.eventQueue.filter(e=>t-e.timestamp<3e4);for(const i of e)try{const t={event:i.eventName,...i.eventData};window.dataLayer.push(t),"function"==="object".gtag&&window.gtag("event",i.eventName,i.eventData),this.logger.debug("Processed queued GTM event: "+i.eventName,{data:i.eventData})}catch(n){this.logger.error("Error processing queued event "+i.methodName+":",n)}this.eventQueue=[],e.length>0&&this.logger.info("Processed "+e.length+" queued GTM events")}getSendToTargets(){const t=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&(!this.isContainerLoaded(this.liquidCommerceGtmId)&&this.isGTMAlreadyLoaded()||t.push(this.liquidCommerceGtmId)),this.partnerEnableGaTracking&&this.partnerGtmId&&(this.isGTMAlreadyLoaded()||this.isContainerLoaded(this.partnerGtmId))&&t.push(this.partnerGtmId),0===t.length&&this.isGTMAlreadyLoaded()&&this.logger.debug("No specific targets configured, letting GTM route events naturally"),t}async initialize(t){if(this.isInitialized||this.isInitializing)return this.initializationPromise;if(!this.clientConfigService.isBuilder()){this.isInitializing=!![],this.initializationPromise=this.doInitialize(t);try{await this.initializationPromise}catch(e){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed:",e)}}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGtmId))throw new Error("GTM config missing required fields");if(!t.liquidCommerceEnableGaTracking&&!t.partnerEnableGaTracking)return this.logger.warn("GTM initialization skipped: No tracking enabled"),this.isInitialized=!![],this.isInitializing=![],void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerGtmId=t.partnerGtmId,this.liquidCommerceGtmId=t.liquidCommerceGtmId,this.partnerEnableGaTracking=t.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=t.liquidCommerceEnableGaTracking;const e=this.isGTMAlreadyLoaded();e&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let n=![],i="";if(t.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(t.liquidCommerceGtmId),n=!![],i=e?"GTM integrated with existing setup (Partner GTM detected, LC container: "+t.liquidCommerceGtmId+")":"GTM initialized with container "+t.liquidCommerceGtmId}catch(o){this.logger.warn("Failed to load LiquidCommerce GTM container: "+o+". Checking if partner GTM is available.")}if(n||(e&&window.dataLayer?(n=!![],i="GTM integrated with existing partner setup"):window.dataLayer&&Array.isArray(window.dataLayer)&&(n=!![],i="GTM initialized with dataLayer (basic functionality available)")),!n)throw this.isInitializing=![],new Error("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(i),this.processEventQueue()}executeEvent(t,e,n){try{if(this.clientConfigService.isBuilder())return;const i=this.getSendToTargets(),o={...n,...i.length>0&&{send_to:i},tenant_source:_.description+" v"+_.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:e,eventData:o,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+e+" (initialization pending)",{data:o}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+e+" skipped: dataLayer not available"),void 0;const r={event:e,...o};window.dataLayer.push(r),"function"==="object".gtag&&window.gtag("event",e,o),this.logger.debug("Sent GTM event: "+e,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:i.length>0?i:"no targeting",data:o})}catch(i){this.logger.error("GTM "+t+" error:",i)}}calculateValue(t){return t.reduce((t,e)=>t+(e.price||0)*(e.quantity||1),0)}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,e,n){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:e,item_list_name:n,items:t})}selectItem(t,e,n){this.executeEvent("selectItem","select_item",{item_list_id:e,item_list_name:n,items:[t]})}addToCart(t){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),quantity:t.quantity||1,items:[t]})}viewCart(t){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(t),items:t})}removeFromCart(t){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}beginCheckout(t,e){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfo(t,e){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfoWithCustomerData(t,e,n){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:t,coupon:e,phone:null==n?void 0:n.phone,email:null==n?void 0:n.email,birth_date:null==n?void 0:n.birth_date,customer_id:null==n?void 0:n.customer_id})}addPaymentInfo(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:e,coupon:n,items:t})}addPaymentInfoWithoutItems(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:t,payment_type:e,coupon:n})}purchase(t){this.executeEvent("purchase","purchase",{transaction_id:t.transaction_id,value:t.value,currency:this.currency,tax:t.tax,shipping:t.shipping,coupon:t.coupon,items:t.items})}increaseQuantity(t){this.executeEvent("increaseQuantity","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}decreaseQuantity(t){this.executeEvent("decreaseQuantity","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}}class PubSubService{constructor(){this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub")}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,e){this.publishSpecific("actions."+t,e)}publishForm(t,e){this.publishSpecific("forms."+t,e)}publishSpecific(t,e){const[n,i]=t.includes(".")?t.split(".",2):["actions",t];let o=i.split("_")[0];["product","cart","address","checkout"].includes(o)||(o="other");const r=Date.now(),s={eventId:this.generateEventId(r),namespace:n,event:i,originalEvent:t,actionNamespace:"actions"===n?o:void 0,timestamp:r},a={data:e,metadata:s};this.dispatchNativeEvents(t,a)}dispatchNativeEvents(t,e){const[n]=t.split(".",2);try{const i=new CustomEvent(this.eventPrefix+":"+t,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(i);const o=new CustomEvent(this.eventPrefix+":"+n,{detail:e,bubbles:!![],cancelable:!![]});window.dispatchEvent(o)}catch(i){this.logger.error("Error dispatching native events for "+t+":",i)}}generateEventId(t){return"evt_"+t+"_"+Math.random().toString(36).slice(2,9)}}const O="liquid_elements",N={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:o.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,engravingLines:[],drawer:{isOpen:![],contentConfig:null},rerender:![],mainImage:null},z={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:[]},M={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,company: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:[]},B={drawer:{isOpen:![],contentConfig:null}},L={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},j={products:{},cart:z,address:L,checkout:M,ui:B};class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async getAllConfigs(){var t;try{this.ensureClientInitialized();const t=await this.client.get("/configs");if(!this.validResponseData(t))throw this.logger.error(t),new Error("Failed to fetch all configs: Invalid response data");return t.data}catch(e){throw this.logger.error("Error fetching configs:",null!==(t=null==e?void 0:e.message)&&void 0!==t?t:e),e}}async setPersistedStore(t,e){var n;try{this.ensureClientInitialized();const n=await this.client.post("/configs/store/"+t,e);200!==n.statusCode&&this.logger.error("Failed to set persisted store:",n)}catch(i){this.logger.error("Error setting persisted store:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i)}}async getPersistedStore(t){var e;try{this.ensureClientInitialized();const e=await this.client.get("/configs/store/"+t);return 200!==e.statusCode?(this.logger.error("Failed to fetch persisted store:",e),null):e.data}catch(n){return this.logger.error("Error fetching persisted store:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),null}}async getProductsData(t,e){var n;try{this.ensureClientInitialized();const n={upcs:t,ids:t,grouping:t,shouldShowOffHours:!![],isLegacy:!![],loc:e},i=await this.client.post("/cloud/catalog/availability",n);return 200===i.statusCode&&i.products&&0!==i.products.length?{products:i.products,retailers:i.retailers}:(this.logger.error(i),null)}catch(i){return this.logger.error("Error fetching product data:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),null}}async getCartData(t){var e;try{this.ensureClientInitialized();const e=await this.client.get("/cloud/cart"+(t?"?id="+t:""));if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to fetch cart data: "+e.message);return e.cart}catch(n){throw this.logger.error("Error fetching cart data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async updateCart(t){var e;try{this.ensureClientInitialized();const e=await this.client.put("/cloud/cart",t);if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to update cart: "+e.message);return e.cart}catch(n){throw this.logger.error("Error updating cart:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async getAddressSuggestions(t){var e;try{this.ensureClientInitialized();const e=await this.client.get("/cloud/address/autocomplete?input="+t);if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to fetch address suggestions: "+e.message);return e.data}catch(n){throw this.logger.error("Error fetching address suggestions:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async getAddressDetails(t){var e;try{this.ensureClientInitialized();const e=await this.client.get("/cloud/address/details/"+t);if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to fetch address details: "+e.message);return e.data}catch(n){throw this.logger.error("Error fetching address details:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async prepareCheckout(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/checkout/prepare",t);if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to fetch prepare checkout data: "+e.message);return e.checkout}catch(n){throw this.logger.error("Error fetching prepare checkout data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async getPaymentSession(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/payment/session",t);if(201!==e.statusCode)throw this.logger.error(e),new Error("Failed to get payment session: "+e.message);return e.data}catch(n){throw this.logger.error("Error fetching payment session:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),n}}async confirmPaymentSession(t,e){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/payment/confirm",{confirmationTokenId:t,setupIntentId:e});if(200!==n.statusCode)throw this.logger.error(n),new Error("Failed to confirm payment session: "+n.message);return n.data}catch(i){throw this.logger.error("Error confirming payment session:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),i}}async checkoutComplete(t){var e;try{this.ensureClientInitialized();const e=await this.client.post("/cloud/checkout/complete",t);if(200!==e.statusCode)throw this.logger.error(e),new Error("Failed to complete checkout: "+e.message);return e.order}catch(n){if(this.logger.error("Error completing checkout:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),null==n?void 0:n.error)throw new Error(n.error);throw n}}validResponseData(t){return t.data&&"object"==typeof t.data&&Object.keys(t.data).length>0}ensureClientInitialized(){if(!this.client)throw new Error("API client is not initialized")}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:e,next:n})=>{const i=performance.now();this.logger.group("🏪 Store "+t+" ---------------------------------"),this.logger.debug("Payload:",e);try{const t=n(),e=performance.now()-i;return this.logger.debug("Completed in "+e.toFixed(3)+"ms"),t}catch(o){throw this.logger.error("Error:",o),o}finally{this.logger.groupEnd()}},this.performanceMiddleware=({action:t,next:e})=>{const n=performance.now(),i=e(),o=performance.now()-n;return o>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+o.toFixed(2)+"ms"),i},this.state=j,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable:e,persistedStore:n}){this.localStorageKey=O+"_"+t,this.isLocalStorageAvailable=e,e?await this.loadPersistedState():n&&await this.loadFromDBPersistence(n),this.addBeforeUnloadHandler(),this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:e,hasPersistedState:null!==n,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const e=t.split(".");let n=this.state;for(const i of e){if(null==n)return;n=n[i]}return void 0!==n?Array.isArray(n)?[...n]:"object"==typeof n&&null!==n?{...n}:n:void 0}set(t,e){return this.runWithMiddleware("set",{path:t,value:e},()=>{const n=this.get(t);return this.state=this.immutableSet(this.state,t,e),this.notifyListeners(t,e,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,e){const n=this.get(t),i=e(n);return this.set(t,i)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const e=this.get(t);if(void 0===e)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const n=t.split(".");let i=this.state;const o=n.pop();for(const r of n){if(void 0===i[r])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];i=i[r]}if(Array.isArray(i))i=i.filter((t,e)=>e!==Number.parseInt(o,10));else{if("object"!=typeof i||null===i)return this.logger.warn('Cannot remove property "'+o+'" from non-object type at path "'+t+'".'),![];{const{[o]:t,...e}=i;i=e}}return this.state=this.immutableSet(this.state,n.join("."),i),this.notifyListeners(t,void 0,e),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const e=[];if("function"==typeof t){const n=t(this.state);for(const[t,i]of Object.entries(n)){const n=this.get(t);e.push({path:t,oldValue:n,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,i)}}else for(const[n,i]of Object.entries(t)){const t=this.get(n);e.push({path:n,oldValue:t,newValue:i,timestamp:Date.now()}),this.state=this.immutableSet(this.state,n,i)}for(const{path:t,oldValue:n,newValue:i}of e)this.notifyListeners(t,i,n);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,e){const n=t;return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),()=>{var t;null===(t=this.listeners.get(n))||void 0===t?void 0:t.delete(e)}}watchMany(t,e){const n=[];let i;const o=t.map(t=>this.watch(t,(o,r)=>{n.push({path:t,value:o,oldValue:r}),clearTimeout(i),i=setTimeout(()=>{n.length>0&&(e([...n]),n.length=0)},0)}));return()=>{for(const t of o)t()}}createProductInstance(t){const e="products."+t,n=this.get(e);return n?!![]:this.set(e,N)}removeProductInstance(t){const e=this.get("products"),{[t]:n,...i}=e;return this.set("products",i)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(t,e,n){let i=0;const w=()=>{if(i>=this.middleware.length)return n();const o=this.middleware[i++];return o({action:t,payload:e,state:this.getState(),next:w})};return w()}immutableSet(t,e,n){const i=e.split(".");if(1===i.length){if(Array.isArray(t)){const e=[...t];return e[i[0]]=n,e}return{...t,[i[0]]:n}}const[o,...r]=i,s=t[o],a=Array.isArray(s)?[]:{};if(Array.isArray(t)){const e=[...t];return e[o]=this.immutableSet(s||a,r.join("."),n),e}return{...t,[o]:this.immutableSet(s||a,r.join("."),n)}}notifyListeners(t,e,n){const i=this.listeners.get(t);if(i)for(const a of i)try{a(e,n)}catch(r){this.logger.error('Error in store listener for path "'+t+'":',r)}const o=t.split(".");for(let a=o.length-1;a>0;a--){const t=o.slice(0,a).join("."),e=this.listeners.get(t);if(e){const i=this.get(t),r=o.slice(a).join("."),c=this.immutableSet(i,r,n);for(const n of e)try{n(i,c)}catch(s){this.logger.error('Error in store listener for parent path "'+t+'":',s)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const e=this.get("address.id")||"",n=this.get("cart.id")||"";t=e+"_"+n}else t=this.getState();t&&localStorage.setItem(this.localStorageKey,"string"!=typeof t?JSON.stringify(t):t)}catch(t){this.logger.warn("Failed to persist store state:",t)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const e=localStorage.getItem(this.localStorageKey);if(!e)return;try{const t=JSON.parse(e);for(const[e,n]of Object.entries(t))this.set(e,n);return}catch(t){if(e.includes("_")){const[t,n]=e.split("_");if(void 0!==t){const e=await this.getAddressDataFromId(t);this.set("address",e)}return void 0!==n&&this.set("cart.id",n||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:e})}}catch(e){this.logger.warn("Failed to load persisted state:",e),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{t.p&&(this.state.address=await this.getAddressDataFromId(t.p)),t.c&&(this.state.cart.id=t.c),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(e){this.logger.error("Failed to load session data from DB persistence",e)}}addBeforeUnloadHandler(){window.addEventListener("beforeunload",()=>{this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())}),document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&this.isLocalStorageAvailable&&this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveStore())})}async getAddressDataFromId(t){if(!t||""===t.trim())return L;try{const e=await this.api.getAddressDetails(t);return e&&0!==Object.keys(e).length?{id:t,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},coordinates:{lat:e.coords.lat,long:e.coords.long}}:{...L,id:t}}catch(e){return{...L,id:t}}}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}const includeCartEvents=(t,e)=>t.filter(t=>e.includes(t.type)),excludeCartEvents=(t,e)=>t.filter(t=>!e.includes(t.type)),eventsForCart=t=>excludeCartEvents(t,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet"]),hasCartAnyPromoCodeEvents=t=>{const e=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],n=includeCartEvents(t,e);return n.length>0},includeCheckoutEvents=(t,e)=>t.filter(t=>e.includes(t.type)),eventsForCheckout=t=>includeCheckoutEvents(t,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=t=>includeCheckoutEvents(t,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=t=>includeCheckoutEvents(t,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=t=>{const e=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return t.some(t=>e.includes(t.type))},q={OutOfStock:"error",ItemsNotAdded:"warning",ItemsRequestedNotAdded:"warning",ItemEngravingError:"error",AddressChange:"warning",LocationAvailability:"warning",PartnerProductConfigs:"warning",RemovedExistingCartItems:"warning",RetailerMinNotMet:"warning",NoItemsInCart:"warning",InvalidId:"warning",NoId:"warning",CartCheckoutProcessed:"success",NewCart:"warning",CartError:"error",ItemQuantityChange:"warning",ItemIdNotFound:"error",ItemsRemoved:"warning",CouponProcessingError:"error",CouponNotFound:"error",CouponExpired:"error",NoApplicableDiscount:"warning",CouponNotStarted:"error",MinimumOrderValueNotMet:"warning",MinimumOrderUnitsNotMet:"warning",MinimumDistinctItemsNotMet:"warning",QuotaExceeded:"error",UserLimitExceeded:"error",NotFirstPurchase:"warning",InvalidCoupon:"error",InvalidMembership:"error",InvalidDomain:"error",InvalidRequirements:"error",InvalidOrganization:"error",ProductNotEligible:"warning",NotEnoughPreviousOrders:"warning",PresaleItemsNotAllowed:"error",PresaleLimitExceeded:"error",PresaleNotStarted:"error",PresaleExpired:"error",PresaleMixedCart:"error",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning"},G={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:q[t.type]||"error"})),transformCheckoutEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:G[t.type]||"error"})),transformEventsForCart=t=>{const e=eventsForCart(t);return transformCartEventsRaw(e)},transformEventsForCheckout=t=>{const e=eventsForCheckout(t);return transformCheckoutEventsRaw(e)},transformPromoCodeCheckoutEvents=t=>{const e=promoCodeCheckoutEvents(t);return transformCheckoutEventsRaw(e)},transformGiftCardCheckoutEvents=t=>{const e=giftCardCheckoutEvents(t);return transformCheckoutEventsRaw(e)};function buildCartItemStore(t){return{id:t.id,variantId:t.variantId,liquidId:t.liquidId,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,salsifyGrouping:t.salsifyGrouping,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price,quantity:t.quantity,maxQuantity:t.maxQuantity,unitPrice:t.unitPrice,mainImage:t.mainImage,attributes:t.attributes,loading:![],updating:![],error:null}}function buildCartTotals(t){return{subtotal:t.subtotal||0,total:t.total||0,shippingFee:t.shippingFee||0,platformFee:t.platformFee||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,discounts:t.discounts||0,quantity:t.quantity||0}}function buildRetailerStore(t){var e;return{id:t.id,name:t.name,platformFee:t.platformFee||0,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,address:t.address,total:t.total||0,deliveryFee:t.deliveryFee||0,engravingFee:t.engravingFee||0,fulfillments:(null===(e=t.fulfillments)||void 0===e?void 0:e.map(t=>t.id))||[]}}function buildFulfillmentStore(t,e){return{id:t.id,canEngrave:t.canEngrave||![],type:t.type,fees:t.fees,expectation:t.expectation,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,items:t.items||[],retailerId:e.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(t,e){var n;const i=e.formattedAddress?e:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},o={};for(const r in t.items||{}){const e=t.items[r];o[r]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,salsifyGrouping:e.salsifyGrouping,catPath:e.catPath,volume:e.volume,uom:e.uom,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,name:e.name,brand:e.brand,size:e.size,price:e.price||0,quantity:e.quantity||0,maxQuantity:e.maxQuantity||0,unitPrice:e.unitPrice||0,mainImage:e.mainImage||"",attributes:e.attributes||{}}}return{id:t.id,promoCode:(null===(n=t.promoCode)||void 0===n?void 0:n.code)||"",items:o,location:{placesId:i.id,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:{latitude:i.coordinates.lat,longitude:i.coordinates.long}},amounts:{deliveryFee:t.totals.deliveryFee,discounts:t.totals.discounts,engravingFee:t.totals.engravingFee,giftCardTotal:0,platformFee:t.totals.platformFee,shippingFee:t.totals.shippingFee,subtotal:t.totals.subtotal,total:t.totals.total},updatedAt:t.updatedAt,createdAt:t.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}async loadCart(){var t,n,i,o,r,s,a;try{this.store.set("cart.loading",!![]);const c=this.store.get("cart"),l=await this.api.getCartData(c.id);for(const t of Object.keys(c.items))this.store.remove("cart.items."+t);for(const t of Object.keys(c.retailers))this.store.remove("cart.retailers."+t);for(const t of Object.keys(c.fulfillments))this.store.remove("cart.fulfillments."+t);const d={"cart.id":l.id,"cart.error":null,"cart.totals":buildCartTotals(l),"cart.updatedAt":l.updatedAt||(new Date).toISOString(),"cart.createdAt":l.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":{code:(null===(i=null===(n=null===(t=l.attributes)||void 0===t?void 0:t.promoCode)||void 0===n?void 0:n.value)||void 0===i?void 0:i.toUpperCase())||null,discountAmount:l.attributes.promoCode.discount||0,error:null}};if((null===(o=l.items)||void 0===o?void 0:o.length)>0)for(const t of l.items)d["cart.items."+t.id]=buildCartItemStore(t);if((null===(r=l.retailers)||void 0===r?void 0:r.length)>0)for(const t of l.retailers)if(d["cart.retailers."+t.id]=buildRetailerStore(t),(null===(s=t.fulfillments)||void 0===s?void 0:s.length)>0)for(const e of t.fulfillments)d["cart.fulfillments."+e.id]=buildFulfillmentStore(e,t);l.id!==c.id&&await this.persistSessionData(l.id),(null===(a=l.events)||void 0===a?void 0:a.length)>0&&(d["cart.events"]=transformEventsForCart(l.events||[])),this.store.batch(d);const h=this.store.get("cart"),u=this.store.get("address");this.pubSub.publishAction(e.CART_LOADED,cartDataForEventFromStore(h,u))}catch(c){throw this.store.set("cart.error",(null==c?void 0:c.message)||"Failed to load cart"),c}finally{this.store.set("cart.loading",![])}}async persistSessionData(t){var e;const n=this.store.get("address.id")||"";if(this.clientConfig.isLocalStorageAvailable())this.store.forceSave(),this.logger.info("Cart ID changed, triggering localStorage save",{newCartId:t});else try{const i=null!==(e=this.clientConfig.get("userDeviceId"))&&void 0!==e?e:"";await this.api.setPersistedStore(i,{p:n,c:t}),this.logger.info("Cart ID changed, persisted to DB",{userDeviceId:i,newCartId:t})}catch(i){this.logger.error("Failed to persist cart ID to DB",{error:(null==i?void 0:i.message)||i})}}}const U="lce-checkout-stripe-slot",V={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},H={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",company:"company",message:"message"},Y={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};function centToDollar(t){return t/100}function formatCentToDollarText(t,e=!![]){const n=Math.floor(t/100),i=t%100;let o="$"+n.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(e||i>0)&&(o+=".",o+=i<10?"0"+i:i.toString()),o}function htmlStringToElement(t){const e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstElementChild}function format24TimeTo12$1(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new Error("Invalid time format: "+t);const n=Number.parseInt(e[1],10),i=Number.parseInt(e[2],10);if(n<0||n>23||i<0||i>59)throw new Error("Invalid time values: "+t);const o=n>=12?"PM":"AM",r=n%12||12;return r+":"+i.toString().padStart(2,"0")+" "+o}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const e=new Date(t);if(Number.isNaN(e.getTime()))return"";const n=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),o=e.getFullYear().toString();return n+"/"+i+"/"+o}catch(e){return""}}function validateMinimumAge(t,e=21,n=1930){if(!t)return{isValid:![],age:null,error:"Birth date is required"};try{const i=t instanceof Date?t:new Date(t);if(Number.isNaN(i.getTime()))return{isValid:![],age:null,error:"Invalid date format"};const o=new Date;if(i>o)return{isValid:![],age:null,error:"Birth date cannot be in the future"};const r=i.getFullYear();if(r<n)return{isValid:![],age:null,error:"Birth year cannot be before "+n+". Please check your birth date."};const s=calculateAge(i,o);return s<e?{isValid:![],age:s,error:"Must be at least "+e+" years old"}:{isValid:!![],age:s}}catch(i){return{isValid:![],age:null,error:"Error processing birth date"}}}function calculateAge(t,e){let n=e.getFullYear()-t.getFullYear();const i=e.getMonth()-t.getMonth();return(i<0||0===i&&e.getDate()<t.getDate())&&n--,Math.max(0,n)}function buildFormattedAddressString(t){const e=[],n=[];t.one&&t.one.trim()&&n.push(t.one.trim()),t.two&&t.two.trim()&&n.push(t.two.trim()),n.length>0&&e.push(n.join(" ")),t.city&&t.city.trim()&&e.push(t.city.trim());const i=[];return t.state&&t.state.trim()&&i.push(t.state.trim()),t.zip&&t.zip.trim()&&i.push(t.zip.trim()),i.length>0&&e.push(i.join(" ")),t.country&&t.country.trim()&&e.push(t.country.trim()),e.join(", ")}function splitCategoryPath(t){const e=(null==t?void 0:t.split(" > "))||[];return{category:e[0]||"",category2:e[1]||"",category3:e[2]||""}}function validateCustomerInfo(t){const e=[V.firstName,V.lastName,V.email,V.phone,V.birthDate];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const i of e){const e=t[i];if(!e||"string"==typeof e&&""===e.trim())n.push(i);else if("birthDate"===i){const t=validateMinimumAge(e,21,1930);t.isValid||n.push(i)}}return{isValid:0===n.length,invalidFields:n}}function validateGiftRecipientInfo(t){const e=[H.firstName,H.lastName,H.email,H.phone,H.message];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const i of e){const e=t[i];(!e||"string"==typeof e&&""===e.trim())&&n.push(i)}return{isValid:0===n.length,invalidFields:n}}function validateBillingInfo(t){const e=[Y.firstName,Y.lastName,Y.email,Y.phone,Y.addressOne,Y.city,Y.state,Y.zipCode];if(!t)return{isValid:![],invalidFields:e};const n=[];for(const i of e){const e=t[i];(!e||"string"==typeof e&&""===e.trim())&&n.push(i)}return{isValid:0===n.length,invalidFields:n}}const K=[i.ADDRESS,i.ADDRESS_INPUT,i.ADDRESS_DISPLAY,i.PRODUCT,i.CART,i.CHECKOUT],W=[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL,i.PRODUCT_OPTIONS,i.PRODUCT_INTERACTIONS,i.PRODUCT_DESCRIPTION,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST,i.PRODUCT_PRICE,i.PRODUCT_ADD_TO_CART_SECTION,i.PRODUCT_DRAWER,i.PRODUCT_LOADING,i.ENGRAVING_FORM,i.ENGRAVING_VIEW],Q=[i.ADDRESS_INPUT,i.ADDRESS_DISPLAY],Z=[i.CART,i.CART_RETAILER,i.CART_ITEM,i.CART_FOOTER,i.CART_ITEM_QUANTITY_PRICE,i.CART_RETAILER_SUBTOTAL,i.CART_PROMO_CODE,i.CART_HEADER,i.CART_BODY,i.CART_FULFILLMENT,i.BUTTONS_CART_OPEN],X=[i.CHECKOUT,i.CHECKOUT_INFORMATION_SECTION,i.CHECKOUT_STRIPE_FORM,i.CHECKOUT_PAYMENT_FORM,i.CHECKOUT_BILLING_FORM,i.CHECKOUT_SUMMARY_SECTION,i.CHECKOUT_PROMO_CODE,i.CHECKOUT_GIFT_CARDS,i.CHECKOUT_AMOUNTS,i.CHECKOUT_ITEMS,i.CHECKOUT_COMPLETED,i.CHECKOUT_DELIVERY_INFORMATION_FORM,i.CHECKOUT_BUYER_INFORMATION_FORM,i.CHECKOUT_TIPS,i.CHECKOUT_PC_GC,i.CHECKOUT_ITEM,i.CHECKOUT_ITEM_QUANTITY,i.CHECKOUT_PLACE_ORDER_BUTTON,i.CHECKOUT_HEADER,i.CHECKOUT_PRESALE_COUNTDOWN],isMainComponent=t=>-1!==K.indexOf(t);class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}]}loadGoogleFonts(t,e="swap"){if(!t||0===t.length)return;const n=[...this.defaultFontFamilies,...t],i=n.map(t=>{const e=encodeURIComponent(t.name);return"family="+e+":wght@"+t.weights.join(";")}).join("&"),o="display="+e;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+i+"&"+o,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,e="swap"){const n=document.querySelector("link[data-liquid-fonts]");this.loadGoogleFonts(t,e),n&&n.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),e=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!t){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",t.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(t)}if(!e){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="",t.setAttribute("data-liquid-fonts-hint",""),document.head.appendChild(t)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const t=document.createElement("link");t.rel="stylesheet",t.href=this.googleFontsUrl,t.setAttribute("data-liquid-fonts",""),document.head.appendChild(t)}}const getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n padding-bottom: 8px;\n }\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: "+s.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: "+s.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: "+s.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: "+s.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 line-height: 100%;\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 .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: "+s.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: "+s.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: "+s.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: "+s.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: "+s.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-two-col-container > .custom-input {\n min-width: 200px;\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: "+s.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-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-logo {\n color: var(--icon-color, var(--primary-color, #E4E4E7));\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: 4px;\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: '+s.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: "+s.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 font-style: normal;\n font-weight: 400;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 8px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form-container {\n display: flex;\n width: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .engraving-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n }\n\n .engraving-form-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 margin-bottom: 8px;\n }\n\n .engraving-form-location {\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: 24px;\n }\n\n .engraving-form-header > :not(.engraving-form-location) {\n margin-bottom: 0;\n }\n\n .engraving-form-lines {\n display: flex;\n width: 100%;\n height: auto;\n flex-direction: column;\n align-items: center;\n }\n\n .engraving-form-lines .engraving-form-input-container:not(:last-child) {\n margin-bottom: 16px;\n }\n\n .engraving-form-input-container {\n display: flex;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--border-radius-md, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .engraving-form-input-container .engraving-form-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(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-form-input-container .engraving-form-input-char-count {\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: 400;\n line-height: 20px;\n margin-left: 4px;\n }\n\n .engraving-form-actions {\n display: flex;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-form-actions > button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: none;\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 cursor: pointer;\n }\n\n .engraving-form-actions > button:first-child {\n margin-right: 8px;\n }\n\n .engraving-form-actions .engraving-form-button-cancel {\n color: var(--primary-color, #1D4ED8);\n }\n\n .engraving-form-actions .engraving-form-button-save {\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 flex: 1 0 0;\n }\n\n .engraving-form-actions .engraving-form-button-save.disabled {\n opacity: 0.5;\n }\n\n .engraving-form-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n }\n\n .engraving-form-disclaimer > span {\n color: var(--default-text-color, #18181B);\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 /** 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: "+s.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.has-header {\n width: 100%;\n padding: 16px;\n }\n\n .price-personalization-container > .main-product-price + .engraving-view-container.has-header {\n margin-top: 24px;\n }\n\n .engraving-view-container.outlined.has-header {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled.has-header {\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.has-header .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-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 .engraving-view-container.product .add-engraving-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n height: 36px;\n cursor: pointer;\n\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n background: transparent;\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\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 .engraving-view-container:not(.product) .add-engraving-button {\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 }\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',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: "+s.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 /** 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: "+s.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: "+s.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 /* 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: "+s.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: "+s.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: "+s.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: "+s.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 $={"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"},J={backgroundColor:"--product-background-color"},tt={backgroundColor:"--cart-background-color"},et={backgroundColor:"--address-background-color"},nt={backgroundColor:"--checkout-background-color"},it={global:$,product:J,cart:tt,address:et,checkout:nt};function getCSSVariableMapping(t){return it[t]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(t,e){const n={},i=getCSSVariableMapping(e);for(const[o,r]of Object.entries(i)){const e=this.getValueByPath(t,o);void 0!==e&&this.isCSSValue(e)&&(n[r]=e,this.isColorVariable(r,e)&&this.generateOpacityVariants(n,r,e))}return n}extractVariablesFromPartialTheme(t,e){const n={},i=getCSSVariableMapping(e);for(const[o,r]of Object.entries(i))if(this.hasValueAtPath(t,o)){const e=this.getValueByPath(t,o);void 0!==e&&this.isCSSValue(e)&&(n[r]=e,this.isColorVariable(r,e)&&this.generateOpacityVariants(n,r,e))}return n}generateCSSVariablesString(t){return Object.entries(t).map(([t,e])=>" "+t+": "+e+";").join("\n")}updateCSSVariablesInStylesheet(t,e){if(0!==Object.keys(e).length)try{const n=this.findOrCreateRule(t);for(const[t,i]of Object.entries(e))n.style.setProperty(t,String(i))}catch(n){this.logger.warn("Failed to update CSS variables:",n)}}getValueByPath(t,e){return e.split(".").reduce((t,e)=>t&&void 0!==t[e]?t[e]:void 0,t)}hasValueAtPath(t,e){const n=e.split(".");let i=t;for(const o of n){if(null==i||!(o in i))return![];i=i[o]}return!![]}findOrCreateRule(t){const e=":host";for(const i of Array.from(t.cssRules))if(i instanceof CSSStyleRule&&i.selectorText===e)return i;const n=t.insertRule(e+" {}");return t.cssRules[n]}isCSSValue(t){if("string"==typeof t){if(""===t.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(t.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(t))return!![];if(/^[a-z-]+$/.test(t))return!![]}return"number"==typeof t}generateOpacityVariants(t,e,n){for(const i of this.opacityLevels){const o=e+"-"+i.suffix,r=this.addOpacityToHexColor(n,i.value);r&&(t[o]=r)}}isColorVariable(t,e){if("string"!=typeof e)return![];const n=t.toLowerCase().includes("color"),i=/^#[0-9a-f]{3,8}$/i.test(e);return n&&i}addOpacityToHexColor(t,e){if(!t.startsWith("#"))return null;let n=t.slice(1);if(3===n.length&&(n=n.split("").map(t=>t+t).join("")),6!==n.length)return null;const i=Math.round(255*e),o=i.toString(16).padStart(2,"0");return"#"+n+o}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,e){const n=this.cssProcessor.extractVariablesFromTheme(e,t),i=this.cssProcessor.generateCSSVariablesString(n),o=this.getStylesheetStyles(t).join("\n\n"),r=0===i.length?"":":host { "+i+" }",s=("\n "+r+"\n\n "+o+"\n ").trim();this.createStylesheet(t,s)}createStylesheet(t,e){try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(e),this.styleSheets.set(t,n)}else this.styleSheets.set(t,e)}catch(_){this.styleSheets.set(t,e)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}updateVariablesInStylesheet(t,e,n){const i=this.styleSheets.get(t);if(i&&"string"!=typeof i){const t=this.cssProcessor.extractVariablesFromPartialTheme(e,n);this.cssProcessor.updateCSSVariablesInStylesheet(i,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme)}updateComponentGlobalConfigs(t){var e,n;this.data.global=this.deepMerge(this.getConfigs("global"),t),((null===(e=t.theme)||void 0===e?void 0:e.headingFont)||(null===(n=t.theme)||void 0===n?void 0:n.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==W.indexOf(t)?this.getConfigs("product"):-1!==Q.indexOf(t)?this.getConfigs("address"):-1!==Z.indexOf(t)?this.getConfigs("cart"):-1!==X.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===i.DRAWER){const t=[...e],n=this.stylesheetGenerator.getStylesheet("product"),i=this.stylesheetGenerator.getStylesheet("cart"),o=this.stylesheetGenerator.getStylesheet("checkout"),r=this.stylesheetGenerator.getStylesheet("address");return n&&t.push(n),i&&t.push(i),o&&t.push(o),r&&t.push(r),t}if(!isMainComponent(t))return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;let n;if(t===i.ADDRESS||t===i.ADDRESS_INPUT||t===i.ADDRESS_DISPLAY)n="address";else if(t===i.PRODUCT)n="product";else if(t===i.CART)n="cart";else{if(t!==i.CHECKOUT)return this.logger.warn("Unknown main component type: "+t+", returning base stylesheets only."),e;n="checkout"}const o=this.stylesheetGenerator.getStylesheet(n);return o?[...e,o]:e}getBaseStylesheets(){const t=[],e=this.stylesheetGenerator.getStylesheet("global"),n=this.stylesheetGenerator.getStylesheet("ui");return e&&t.push(e),n&&t.push(n),t}deepMerge(t,e){const n={...t};for(const i in e)null!==e[i]&&void 0!==e[i]&&("object"!=typeof e[i]||Array.isArray(e[i])||"object"!=typeof t[i]||Array.isArray(t[i])?n[i]=e[i]:n[i]=this.deepMerge(t[i],e[i]));return n}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,n){const o={type:t,data:n||{}};if(this.store.set("ui.drawer",{isOpen:!![],contentConfig:o}),t===i.CART){this.pubSub.publishAction(e.CART_OPENED,!![]);const t=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(t.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}t===i.CHECKOUT&&this.pubSub.publishAction(e.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===i.CART&&this.pubSub.publishAction(e.CART_CLOSED,!![]),(null==t?void 0:t.type)===i.CHECKOUT&&this.pubSub.publishAction(e.CHECKOUT_CLOSED,!![])}}function buildCheckoutItemStore(t,e,n){return{liquidId:t.liquidId,variantId:t.variantId,cartItemId:t.cartItemId,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes,retailerName:e.name,expectationDetail:n.expectation.detail,loading:![],updating:![],error:null}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(t){var n,i,r;try{this.store.set("checkout.loading",!![]);const s=t||this.store.get("cart.id"),a=this.store.get("cart");if(0===(null===(n=Object.values(a.items))||void 0===n?void 0:n.length)&&!t)return;const c=this.themeProvider.getConfigs("checkout"),l={canEmail:c.layout.emailOptIn.checked,canSms:c.layout.smsOptIn.checked};if(!s)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const d={"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:""}},h=await this.api.prepareCheckout({cartId:s,marketingPreferences:l});if((null===(i=h.retailers)||void 0===i?void 0:i.length)>0)for(const t of h.retailers)for(const e of t.fulfillments)e.type===o.ON_DEMAND&&(d["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});if((null===(r=h.items)||void 0===r?void 0:r.length)>0){this.store.remove("checkout.items");for(const t of h.items){const e=h.retailers.find(e=>e.id===t.retailerId),n=e.fulfillments.find(e=>e.id===t.fulfillmentId);d["checkout.items."+t.cartItemId]=buildCheckoutItemStore(t,e,n)}}h.isPresaleLocked&&h.presaleExpiresAt&&(d["checkout.isPresaleLocked"]=h.isPresaleLocked,d["checkout.presaleExpiresAt"]=h.presaleExpiresAt),d["checkout.token"]=h.token,d["checkout.cartId"]=h.cartId,d["checkout.customer"]=h.customer,d["checkout.acceptedAccountCreation"]=h.acceptedAccountCreation,d["checkout.billingSameAsShipping"]=h.billingSameAsShipping,d["checkout.hasAgeVerify"]=h.hasAgeVerify,d["checkout.hasSubstitutionPolicy"]=h.hasSubstitutionPolicy,d["checkout.isGift"]=h.isGift,d["checkout.marketingPreferences"]=h.marketingPreferences,d["checkout.giftCards"]=h.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),d["checkout.promoCode"]=h.promoCode.value?{code:h.promoCode.value,discountAmount:h.promoCode.discount}:null,d["checkout.marketingPreferences.canEmail"]=h.marketingPreferences.canEmail,d["checkout.marketingPreferences.canSms"]=h.marketingPreferences.canSms,d["checkout.amounts"]=h.amounts,d["checkout.error"]=null,d["checkout.updating"]=![],d["checkout.events"]=h.events||[],this.store.batch(d),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_LOADED,{cartId:h.cartId})}catch(s){throw this.store.set("checkout.error",s.message),this.pubSub.publishAction(e.CHECKOUT_FAILED,{message:s.message}),s}finally{this.store.set("checkout.loading",![])}}async partialLoadCheckout(t){var n,i,r,s,a;try{let e;if(this.store.set("checkout.updating",!![]),await this.commonCommands.loadCart(),null==t?void 0:t.response)e=t.response;else{const i=null!==(n=null==t?void 0:t.cartId)&&void 0!==n?n:this.store.get("checkout.cartId");if(!i)return this.store.set("checkout.error","Cart ID is not provided"),void 0;e=await this.api.prepareCheckout({cartId:i})}const c={"checkout.token":e.token,"checkout.events":transformEventsForCheckout(e.events||[]),"checkout.amounts":e.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCards":e.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),"checkout.promoCode":(null===(r=null===(i=null==e?void 0:e.promoCode)||void 0===i?void 0:i.value)||void 0===r?void 0:r.trim())?{code:e.promoCode.value,discountAmount:e.promoCode.discount}:null};if((null===(s=e.retailers)||void 0===s?void 0:s.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const t of e.retailers)for(const e of t.fulfillments)e.type===o.ON_DEMAND&&(c["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal})}if((null===(a=e.items)||void 0===a?void 0:a.length)>0){this.store.remove("checkout.items");for(const t of e.items){const n=e.retailers.find(e=>e.id===t.retailerId),i=n.fulfillments.find(e=>e.id===t.fulfillmentId);c["checkout.items."+t.cartItemId]=buildCheckoutItemStore(t,n,i)}}this.store.batch(c),this.validateAndUpdateFormStatus()}catch(c){const t=(null==c?void 0:c.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(e.CHECKOUT_FAILED,{message:t}),c}finally{this.store.set("checkout.updating",![])}}async toggleIsGift(t){const n=this.store.get("checkout.isGift"),i=null!=t?t:!n;this.store.batch({"checkout.isGift":i,"checkout.giftRecipient":{addressTwo:null,birthDate:"",company:null,email:"",firstName:"",lastName:"",message:null,phone:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_IS_GIFT_TOGGLED,{isActive:i})}async toggleBillingSameAsShipping(t){const n=this.store.get("checkout.billingSameAsShipping"),i=null!=t?t:!n;this.store.batch({"checkout.billingSameAsShipping":i,"checkout.billing":{firstName:"",lastName:"",email:"",phone:"",addressOne:"",addressTwo:"",city:"",state:"",zipCode:""}}),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:i})}toggleMarketingPreferences(t,n){const i=this.store.get("checkout.marketingPreferences."+t),o=null!=n?n:!i;this.store.set("checkout.marketingPreferences."+t,o),this.pubSub.publishAction(e.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:t,isActive:o})}async getPaymentSession(){try{const t=this.store.get("cart.id"),e=await this.api.getPaymentSession({cartId:t});this.store.set("checkout.payment",{key:e.key,secret:e.secret,paymentMethodId:null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){try{const n=await this.api.confirmPaymentSession(t,e);this.store.batch({"checkout.payment.paymentMethodId":n.id,"checkout.readyForSubmit.payment":!![],"checkout.card":{...n.card}})}catch(n){throw new Error("Failed to confirm payment session. Please try again.")}}async applyPromoCode(t){var e;try{const n=this.dataForCheckoutPrepare(),i=await this.api.prepareCheckout({...n,promoCode:t}),o=0!==i.amounts.discounts,r=null===(e=transformPromoCodeCheckoutEvents(i.events||[]))||void 0===e?void 0:e[0];if(!o)return this.store.set("checkout.promoCodeError",r?r.message:'Code "'+t+'" does not exist'),void 0;await this.partialLoadCheckout({response:i})}catch(n){const t=(null==n?void 0:n.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",t),n}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(_){const e=_.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),_}}async removePromoCode(){try{const t=this.dataForCheckoutPrepare(),e=await this.api.prepareCheckout({...t,promoCode:""});if(0!==e.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;await this.partialLoadCheckout({response:e})}catch(t){throw this.store.set("checkout.error",(null==t?void 0:t.message)||"Failed to remove promo code. Please try again."),t}}async applyGiftCard(t=""){var e;try{const n=this.dataForCheckoutPrepare(),i=n.giftCards||[],o=await this.api.prepareCheckout({...n,giftCards:[...i,t]}),r=null===(e=transformGiftCardCheckoutEvents(o.events||[]))||void 0===e?void 0:e[0],s=hasAnyRetailerGiftCardRestriction(o.events||[]);if(r){if(!s)return this.store.set("checkout.giftCardError",r.message),void 0;this.store.set("checkout.giftCardError",r.message)}const a=o.giftCards.find(e=>e.code===t);if(!a)return this.store.set("checkout.giftCardError","Gift card could not be applied"),void 0;await this.partialLoadCheckout({response:o})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to apply gift card. Please try again."),n}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(_){throw this.store.set("checkout.error",(null==_?void 0:_.message)||"Failed to clear gift card error. Please try again."),_}}async removeGiftCard(t){var e;try{const n=this.dataForCheckoutPrepare(),i=(null===(e=n.giftCards)||void 0===e?void 0:e.filter(e=>e!==t))||[],o=await this.api.prepareCheckout({...n,giftCards:i}),r=o.giftCards.find(e=>e.code===t);if(r)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+t),void 0;await this.partialLoadCheckout({response:o})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to remove gift card. Please try again."),n}}updateCustomerInfo(t,n){try{this.store.set("checkout.customer."+t,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{fieldName:t})}catch(i){throw this.store.set("checkout.error",i.message),i}}updateBillingInfo(t,n){try{this.store.set("checkout.billing."+t,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_BILLING_INFORMATION_UPDATED,{fieldName:t})}catch(i){throw this.store.set("checkout.error",i.message),i}}updateGiftInfo(t,n){try{this.store.set("checkout.giftRecipient."+t,n),this.validateAndUpdateFormStatus(),this.pubSub.publishAction(e.CHECKOUT_GIFT_INFORMATION_UPDATED,{fieldName:t})}catch(i){throw this.store.set("checkout.error",i.message),i}}triggerAddShippingInfoEvent(){var t,e,n;const i=this.store.get("checkout");if(i.customer.email||i.customer.phone){const o=(null===(t=null==i?void 0:i.customer)||void 0===t?void 0:t.id)||(null===(e=null==i?void 0:i.customer)||void 0===e?void 0:e.email);this.googleTagManager.addShippingInfoWithCustomerData(centToDollar(i.amounts.total),null===(n=i.promoCode)||void 0===n?void 0:n.code,{phone:i.customer.phone,email:i.customer.email,birth_date:i.customer.birthDate,customer_id:o})}}validateAndUpdateFormStatus(){const t=this.store.get("checkout"),e=validateCustomerInfo(t.customer),n=t.isGift?validateGiftRecipientInfo(t.giftRecipient):{isValid:!![],invalidFields:[]},i=t.billingSameAsShipping?{isValid:!![],invalidFields:[]}:validateBillingInfo(t.billing),o=e.isValid&&n.isValid&&i.isValid,r=[...e.invalidFields.map(t=>"customer."+t),...n.invalidFields.map(t=>"giftRecipient."+t),...i.invalidFields.map(t=>"billing."+t)];this.store.batch({"checkout.isFormValid":o,"checkout.invalidFields":r,"checkout.readyForSubmit.customer":e.isValid,"checkout.readyForSubmit.gift":n.isValid,"checkout.readyForSubmit.billing":i.isValid})}async checkoutComplete(){var t;try{const n=this.store.get("checkout"),o=this.store.get("checkout.payment.paymentMethodId");if(!n.token||!o)return;const r=await this.api.checkoutComplete({token:n.token,payment:o}),s=r.legacyOrderNumber||r.referenceId||"N/A";n.isPresaleLocked||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(i.CHECKOUT_COMPLETED,{orderNumber:s,orderTotal:n.amounts.total,cardLast4:n.card.last4,customerEmail:n.customer.email,giftRecipientEmail:(null===(t=n.giftRecipient)||void 0===t?void 0:t.email)||null}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:s,orderTotal:n.amounts.total}),this.googleTagManager.purchase({transaction_id:s,tax:centToDollar(n.amounts.tax||0),shipping:centToDollar(n.amounts.shipping||0),items:[...Object.values(n.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(n.amounts.total)})}catch(n){const t=(null==n?void 0:n.message)||"Checkout complete failed";throw this.store.batch({"checkout.error":t,"checkout.readyForSubmit.prepared":![],"checkout.readyForSubmit.payment":![],"checkout.payment.sendSubmitSignal":![]}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_FAILED,{message:t}),n}finally{this.store.set("checkout.loading",![])}}async startPreparingCheckoutSubmit(){var t,n,i;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_STARTED,{started:!![]});const o=this.store.get("checkout");this.store.set("checkout.payment.sendSubmitSignal",!![]);const r={cartId:o.cartId,customer:{firstName:o.customer.firstName,lastName:o.customer.lastName,email:o.customer.email,phone:o.customer.phone,birthDate:o.customer.birthDate,company:o.customer.company},...o.isGift&&{giftOptions:{recipient:{email:o.giftRecipient.email,phone:o.giftRecipient.phone,name:o.giftRecipient.firstName+" "+o.giftRecipient.lastName},message:o.giftRecipient.message||""}},...!o.billingSameAsShipping&&(null==o?void 0:o.billing)&&{billingAddress:{firstName:null==o?void 0:o.billing.firstName,lastName:o.billing.lastName,email:o.billing.email,phone:o.billing.phone,city:o.billing.city,state:o.billing.state,zip:o.billing.zipCode,one:o.billing.addressOne,two:o.billing.addressTwo||""}},billingSameAsShipping:o.billingSameAsShipping,acceptedAccountCreation:o.acceptedAccountCreation,hasAgeVerify:o.hasAgeVerify,hasSubstitutionPolicy:o.hasSubstitutionPolicy,isGift:o.isGift,marketingPreferences:o.marketingPreferences,promoCode:(null===(t=o.promoCode)||void 0===t?void 0:t.code)||void 0,giftCards:(null===(n=o.giftCards)||void 0===n?void 0:n.map(t=>t.code))||[],deliveryInstructions:Object.values(o.onDemandFulfillmentTipInfo||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:o.deliveryInstructions||""}))},s=await this.api.prepareCheckout(r);this.store.batch({"checkout.customer":s.customer,"checkout.acceptedAccountCreation":s.acceptedAccountCreation,"checkout.billingSameAsShipping":s.billingSameAsShipping,"checkout.hasAgeVerify":s.hasAgeVerify,"checkout.hasSubstitutionPolicy":s.hasSubstitutionPolicy,"checkout.isGift":s.isGift,"checkout.marketingPreferences":s.marketingPreferences,"checkout.events":s.events||[],"checkout.readyForSubmit.prepared":!![]}),this.triggerAddShippingInfoEvent(),this.googleTagManager.addPaymentInfoWithoutItems(centToDollar(o.amounts.total),"card",null===(i=o.promoCode)||void 0===i?void 0:i.code)}catch(o){const t=(null==o?void 0:o.message)||"Checkout preparation failed";throw this.store.batch({"checkout.error":t,"checkout.loading":![]}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_FAILED,{message:t}),o}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(i.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async focusFirstInvalidField(){try{const t=this.store.get("checkout.invalidFields")||[];if(0===t.length)return;const e=t[0];this.store.set("checkout.focusField",e),setTimeout(()=>{this.store.set("checkout.focusField",null)},100)}catch(t){this.logger.error("Checkout form validation focus operation failed",{error:t instanceof Error?t.message:String(t)})}}buildItemUpdate(t,e){var n,i,o;const r={id:t.cartItemId,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},s=(null===(o=null===(i=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||void 0===o?void 0:o.filter(t=>""!==t.trim()))||[];return s.length>0&&(r.engravingLines=s),r}async updateCheckoutItemQuantity(t,n){try{this.store.set("checkout.items."+t+".updating",!![]);const i=this.store.get("checkout.cartId"),o=this.store.get("checkout.items."+t);if(!o)throw new Error("Item not found");const r=o.quantity,s=o.quantity+n;if(s<1)return this.removeItem(t,!![]);const a=this.buildItemUpdate(o,s);await this.api.updateCart({id:i,items:[a],loc:this.getLocation()}),this.pubSub.publishAction(n>0?e.CHECKOUT_ITEM_QUANTITY_INCREASE:e.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:o.cartItemId,quantity:s,previousQuantity:r}),await this.partialLoadCheckout()}catch(i){throw this.store.set("checkout.items."+t+".error",i.message),i}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var n,i,o;try{const r=this.store.get("checkout.cartId"),s=this.store.get("checkout.items."+t);if(!s)throw new Error("Item not found in checkout");if(!(null===(n=s.attributes)||void 0===n?void 0:n.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const a=(null===(o=null===(i=s.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],c={id:s.cartItemId,fulfillmentId:s.fulfillmentId,partNumber:s.partNumber,quantity:s.quantity,engravingLines:[]};await this.api.updateCart({id:r,items:[c],loc:this.getLocation()}),this.pubSub.publishAction(e.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:s.cartItemId,engravingLines:[],previousEngravingLines:a}),await this.partialLoadCheckout()}catch(r){throw this.store.set("checkout.items."+t+".error",r.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:r.message}),r}}async removeItem(t,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."+t+".updating",!![]);const i=this.store.get("checkout.cartId"),o=this.store.get("checkout.items."+t);if(!o)throw new Error("Item not found");const r=this.buildItemUpdate(o,0);await this.api.updateCart({id:i,items:[r],loc:this.getLocation()}),this.store.remove("checkout.items."+t),this.pubSub.publishAction(e.CHECKOUT_ITEM_REMOVED,{cartItemId:o.cartItemId}),await this.partialLoadCheckout()}catch(i){throw this.store.set("checkout.items."+t+".error",i.message),i}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const n=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},i=Object.values(n).map(e=>{const n=Math.round(e.subtotal*t/100);return{fulfillmentId:e.fulfillmentId,tip:n}}),o=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:i});this.updateStoreFromCheckoutResponse(o),this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{deliveryTips:i})}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(t,n){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},o=Object.values(i).map(e=>({fulfillmentId:e.fulfillmentId,tip:e.fulfillmentId===t?n:e.tip})),r={...this.dataForCheckoutPrepare(),deliveryTips:o},s=await this.api.prepareCheckout(r);this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const n=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},i=Object.values(n).map(e=>({fulfillmentId:e.fulfillmentId,tip:e.fulfillmentId===t?0:e.tip})),o=await this.api.prepareCheckout({...this.dataForCheckoutPrepare(),deliveryTips:i});this.updateStoreFromCheckoutResponse(o),this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{deliveryTips:i})}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(t){var e;const n={"checkout.amounts":t.amounts,"checkout.warning":t.warning,"checkout.events":transformEventsForCheckout(t.events||[]),"checkout.error":null};if((null===(e=t.retailers)||void 0===e?void 0:e.length)>0)for(const i of t.retailers)for(const t of i.fulfillments)t.type===o.ON_DEMAND&&(n["checkout.onDemandFulfillmentTipInfo."+t.id]={retailerId:i.id,retailerName:i.name,fulfillmentId:t.id,tip:t.tip,subtotal:t.subtotal});this.store.batch(n)}async updateStripeFormStatus(t){try{const e=this.store.get("checkout.stripeFormStatus")||{isComplete:![],hasError:![],isProcessing:![],errorMessage:null},n={...e,...t};this.store.set("checkout.stripeFormStatus",n)}catch(e){throw console.error("Error updating Stripe form status:",e),e}}async removeCheckoutError(){this.store.set("checkout.error",null)}async updateDeliveryInstructions(t){this.store.set("checkout.deliveryInstructions",t)}dataForCheckoutPrepare(){var t,e,n;const i=this.store.get("checkout"),o=(null===(t=null==i?void 0:i.customer)||void 0===t?void 0:t.email)?{firstName:i.customer.firstName,lastName:i.customer.lastName,email:i.customer.email,phone:i.customer.phone,birthDate:i.customer.birthDate,company:i.customer.company}:void 0;return{cartId:i.cartId,customer:o,billingSameAsShipping:i.billingSameAsShipping,acceptedAccountCreation:i.acceptedAccountCreation,hasAgeVerify:i.hasAgeVerify,hasSubstitutionPolicy:i.hasSubstitutionPolicy,marketingPreferences:i.marketingPreferences,promoCode:(null===(e=i.promoCode)||void 0===e?void 0:e.code)||void 0,giftCards:(null===(n=null==i?void 0:i.giftCards)||void 0===n?void 0:n.map(t=>t.code))||[]}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.pubSubService=PubSubService.getInstance(),this.commonCommands=CommonCommands.getInstance(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,n){var i;try{this.store.set("cart.items."+t+".updating",!![]);const o=this.store.get("cart.id"),r=this.store.get("cart.items."+t);if(!r)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+n),new Error("Item not found");const s=r.quantity+n;if(s<1)return this.removeItem(t,!![]);const a=this.buildItemUpdate(r,s),c=await this.api.updateCart({id:o,items:[a],loc:this.getLocation()});this.syncItemsFromApiResponse(c,[t]),this.updateFulfillment(r.fulfillmentId,c);const l=null===(i=c.retailers)||void 0===i?void 0:i.find(t=>t.id===r.retailerId);if(l&&this.store.set("cart.retailers."+r.retailerId,buildRetailerStore(l)),this.syncCartMetaFromApiResponse(c),this.pubSubService.publishAction(n<0?e.CART_ITEM_QUANTITY_DECREASE:e.CART_ITEM_QUANTITY_INCREASE,{id:r.id,quantity:s,previousQuantity:r.quantity}),n<0){const t=splitCategoryPath(r.catPath);this.googleTagManager.decreaseQuantity({item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_category:t.category,item_category2:t.category2,item_category3:t.category3,quantity:Math.abs(n),price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId})}else{const t=splitCategoryPath(r.catPath);this.googleTagManager.increaseQuantity({item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_category:t.category,item_category2:t.category2,item_category3:t.category3,quantity:n,price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId})}}catch(o){throw this.store.set("cart.items."+t+".error",o.message),o}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,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."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw new Error("Item not found");const r={itemId:o.id,fulfillmentId:o.fulfillmentId,retailerId:o.retailerId},s=this.buildItemUpdate(o,0),a=await this.api.updateCart({id:i,items:[s],loc:this.getLocation()});this.syncItemsFromApiResponse(a,[]),this.cleanupAfterItemRemoval(r,a),this.syncCartMetaFromApiResponse(a),this.pubSubService.publishAction(e.CART_ITEM_REMOVED,{id:o.id});const c=splitCategoryPath(o.catPath);this.googleTagManager.removeFromCart({item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_category:c.category,item_category2:c.category2,item_category3:c.category3,quantity:o.quantity,price:centToDollar(o.unitPrice||0),upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId})}catch(i){throw this.store.set("cart.items."+t+".error",i.message),i}}async updateItemEngraving(t,n){var i,o,r;try{const s=this.store.get("cart"),a=null===(i=s.items)||void 0===i?void 0:i[t];if(!a)throw new Error("Item not found");this.store.set("cart.items."+t+".updating",!![]);const c={id:a.id,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:n},l=await this.api.updateCart({id:s.id||"",items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(l,[t]),this.syncCartMetaFromApiResponse(l);const d=this.store.get("cart"),h=this.store.get("address");this.pubSubService.publishAction(e.CART_UPDATED,{previous:cartDataForEventFromStore(s,h),current:cartDataForEventFromStore(d,h)}),this.pubSubService.publishAction(e.CART_ITEM_ENGRAVING_UPDATED,{id:a.id,engravingLines:n,previousEngravingLines:(null===(r=null===(o=a.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[]})}catch(s){throw this.store.set("cart.items."+t+".error",s.message),s}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var n,i,o,r;try{this.store.set("cart.loading",!![]);const s=this.store.get("cart"),a={...s},c=(null===(n=t.engravingLines)||void 0===n?void 0:n.filter(t=>""!==t.trim()))||[],l=c.length>0,d=Object.values(s.items||{}).find(e=>{var n,i,o,r,s;const a=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!a)return![];if(l){const t=(null===(i=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[];return c.join(",")===t.join(",")}return!(null===(s=null===(r=null===(o=e.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.length)}),h={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:d?t.quantity+d.quantity:t.quantity};l&&(h.engravingLines=c);const u=await this.api.updateCart({id:s.id||"",items:[h],loc:this.getLocation()}),p=null===(i=u.items)||void 0===i?void 0:i.find(t=>t.fulfillmentId===h.fulfillmentId&&t.partNumber===h.partNumber&&t.upc===h.upc);if(!p)throw new Error("Added item not found in cart response");this.syncItemsFromApiResponse(u,[]);const m=this.store.get("cart.fulfillments."+t.fulfillmentId);if(m){this.updateFulfillment(t.fulfillmentId,u);const e=null===(o=u.retailers)||void 0===o?void 0:o.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t.fulfillmentId)});if(e){const t=null===(r=u.retailers)||void 0===r?void 0:r.find(t=>t.id===e.id);t&&this.store.set("cart.retailers."+e.id,buildRetailerStore(t))}}else this.addNewFulfillmentAndRetailer(t.fulfillmentId,u);this.syncCartMetaFromApiResponse(u);const f=this.store.get("cart"),g=this.store.get("address");this.pubSubService.publishAction(e.PRODUCT_ADD_TO_CART,{...t}),this.pubSubService.publishAction(e.CART_ITEM_ADDED,{id:p.id,upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSubService.publishAction(e.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(s){throw this.store.set("cart.error",s.message),s}finally{this.store.set("cart.loading",![])}}async addPresaleItem(t){var e;try{const n={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity};(null==t?void 0:t.engravingLines)&&(null===(e=null==t?void 0:t.engravingLines)||void 0===e?void 0:e.length)>0&&(n.engravingLines=t.engravingLines);const i=await this.api.updateCart({id:"",items:[n],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(i.id)}catch(n){throw this.store.set("cart.error",n.message),n}}async handleGoToCheckout(){var t;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(i.CHECKOUT);const e=this.store.get("cart");this.googleTagManager.beginCheckout([...Object.values(e.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(t=e.promoCode)||void 0===t?void 0:t.code)||"")}catch(e){throw this.store.set("cart.error",e.message),e}finally{this.store.set("cart.loading",![])}}async applyPromoCode(t){var e,n,i;if(!(null==t?void 0:t.trim()))throw new Error("Promo code is required");const o=t.trim().toUpperCase();try{const t=this.store.get("cart.id"),r=await this.api.updateCart({id:t,items:[],promoCode:o,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(r)),this.store.set("cart.events",transformEventsForCart(r.events||[]));const s=(null===(i=null===(n=null===(e=r.attributes)||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.value)||void 0===i?void 0:i.toLowerCase())===o.toLowerCase();s?this.store.set("cart.promoCode",{code:o,discountAmount:r.discounts||0,error:null}):this.store.set("cart.promoCode",{code:o,discountAmount:0,error:'Code "'+o+'" does not exist'})}catch(r){throw this.store.set("cart.error","Failed to apply promo code. Please try again."),r}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(e),"cart.promoCode":null})}catch(t){const e=t.message||"Failed to remove promo code. Please try again.";throw this.store.set("cart.error",e),t}}async clearPromoCodeError(){try{this.store.set("cart.promoCode",null)}catch(_){const e=_.message||"Failed to clear promo code. Please try again.";throw this.store.set("cart.error",e),_}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("cart",z),await this.commonCommands.loadCart(),this.store.set("checkout",M)}getDetails(){var t;const e=this.store.get("cart"),n=this.store.get("address"),i=n.id?n:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},o={};for(const r in e.items||{}){const t=e.items[r];o[r]={id:t.id,variantId:t.variantId,liquidId:t.liquidId,salsifyGrouping:t.salsifyGrouping,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price||0,quantity:t.quantity||0,maxQuantity:t.maxQuantity||0,unitPrice:t.unitPrice||0,mainImage:t.mainImage||"",attributes:t.attributes||{}}}return{id:e.id,promoCode:(null===(t=e.promoCode)||void 0===t?void 0:t.code)||"",items:o,location:{placesId:i.id,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:{latitude:i.coordinates.lat,longitude:i.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}}buildItemUpdate(t,e){var n,i,o;const r={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:e},s=(null===(o=null===(i=null===(n=t.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||void 0===o?void 0:o.filter(t=>""!==t.trim()))||[];return s.length>0&&(r.engravingLines=s),r}syncItemsFromApiResponse(t,e=[]){var n;const i=this.store.get("cart.items")||{},o=new Set((null===(n=t.items)||void 0===n?void 0:n.map(t=>t.id))||[]);for(const s of Object.keys(i))o.has(s)||this.store.remove("cart.items."+s);const r={};for(const s of t.items)0!==e.length&&!e.includes(s.id)&&i[s.id]||(r["cart.items."+s.id]=buildCartItemStore(s));Object.keys(r).length>0&&this.store.batch(r)}syncCartMetaFromApiResponse(t){var e,n;const i={"cart.totals":buildCartTotals(t),"cart.error":null,"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(t.events||[])},o=null===(n=null===(e=t.attributes)||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.value;if(o)i["cart.promoCode"]={code:o.toUpperCase(),discountAmount:t.discounts||0,error:null};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&this.store.set("cart.promoCode",null)}this.store.batch(i)}updateFulfillment(t,e){var n,i;const o=null===(n=e.retailers)||void 0===n?void 0:n.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t)}),r=null===(i=null==o?void 0:o.fulfillments)||void 0===i?void 0:i.find(e=>e.id===t);r&&o&&this.store.set("cart.fulfillments."+t,buildFulfillmentStore(r,o))}addNewFulfillmentAndRetailer(t,e){var n,i;const o=null===(n=e.retailers)||void 0===n?void 0:n.find(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t)}),r=null===(i=null==o?void 0:o.fulfillments)||void 0===i?void 0:i.find(e=>e.id===t);if(r&&o){const e={["cart.fulfillments."+t]:buildFulfillmentStore(r,o),["cart.retailers."+o.id]:buildRetailerStore(o)};this.store.batch(e)}}cleanupAfterItemRemoval(t,e){var n,i,o;const r=this.store.get("cart.fulfillments."+t.fulfillmentId),s=this.store.get("cart.retailers."+t.retailerId);if(!r||!s)return;const a=1===r.items.length,c=1===s.fulfillments.length,l=null===(n=e.retailers)||void 0===n?void 0:n.some(e=>{var n;return null===(n=e.fulfillments)||void 0===n?void 0:n.some(e=>e.id===t.fulfillmentId)}),d=null===(i=e.retailers)||void 0===i?void 0:i.some(e=>e.id===t.retailerId);if(a&&!l){if(this.store.remove("cart.fulfillments."+t.fulfillmentId),c&&!d)this.store.remove("cart.retailers."+t.retailerId);else if(d){const n=null===(o=e.retailers)||void 0===o?void 0:o.find(e=>e.id===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(n))}}else l&&this.updateFulfillment(t.fulfillmentId,e)}}class ProductCommands extends BaseCommand{constructor(){super(),this.themeProvider=ThemeProviderService.getInstance(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,e=![]){this.store.createProductInstance(t),e&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var e;if(!Array.isArray(t)||0===t.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=!![],t["products."+e+".error"]=null,t),{}));const n=await this.api.getProductsData(t,this.getLocation());if(!n||!n.products||0===n.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]=!![],t),{})),void 0;const i=[];for(const r of n.products){const o=r.sizes.filter(e=>t.some(t=>t===(e.upc||e.id||r.salsifyGrouping))),s=t.find(t=>o.some(e=>t===e.upc||t===e.id)||t===r.salsifyGrouping),a=s||(null===(e=null==o?void 0:o[0])||void 0===e?void 0:e.upc);await this.loadProduct(a,{products:[r],retailers:n.retailers}),i.push(a)}const o=t.filter(t=>-1===i.indexOf(t));this.store.batch(o.reduce((t,e)=>(t["products."+e+".loading"]=![],t["products."+e+".error"]="Product data not found",t),{}))}async loadProduct(t,n=null){var i,o;try{const r=this.store.get("products."+t);r.loading||this.store.set("products."+t+".loading",!![]);let s=null;if(n&&(s=n),n||(s=await this.api.getProductsData([t],this.getLocation())),!s||!(null===(i=null==s?void 0:s.products)||void 0===i?void 0:i[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const a=this.loadProductStoreUpdate(s);if(!a)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...a,identifier:t}),this.pubSub.publishAction(e.PRODUCT_LOADED,this.productDataForEventFromStore(t));const c=s.products[0],l=a.sizes[a.selectedSizeId],d=splitCategoryPath(c.category);this.googleTagManager.viewItem({item_id:c.id,item_name:c.name,item_brand:c.brand,item_category:d.category,item_category2:d.category2,item_category3:d.category3,price:centToDollar((null===(o=c.priceInfo)||void 0===o?void 0:o.average)||0),item_type:c.type,item_subtype:c.subType,upc:(null==l?void 0:l.upc)||"",grouping_id:c.salsifyGrouping,product_id:c.id})}catch(r){throw this.store.set("products."+t+".error",r.message),r}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,n){var i,r,s,a,c,l,d;const h=this.store.get("products."+t);let u=h.selectedFulfillmentType;const p=null===(i=h.sizes[n])||void 0===i?void 0:i.shippingFulfillments,m=null===(r=h.sizes[n])||void 0===r?void 0:r.onDemandFulfillments;let f=null,g=null;if(u!==o.SHIPPING||objectValues(p).length)if(u!==o.ON_DEMAND||objectValues(m).length){const t=u===o.SHIPPING?p:m,e=objectValues(t);f=e[0]||null,g=(null==f?void 0:f.fulfillmentId)||null}else{u=o.SHIPPING;const t=objectValues(p);f=t[0]||null,g=(null==f?void 0:f.fulfillmentId)||null}else{u=o.ON_DEMAND;const t=objectValues(m);f=t[0]||null,g=(null==f?void 0:f.fulfillmentId)||null}const v=u===o.SHIPPING?p:m,y=splitCategoryPath(h.catPath);this.googleTagManager.viewItem({item_id:h.id,item_name:h.name,item_brand:h.brand,item_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar((null===(s=h.priceInfo)||void 0===s?void 0:s.avg)||0),item_type:h.type,item_subtype:h.subType,upc:(null===(a=h.sizes[n])||void 0===a?void 0:a.upc)||"",grouping_id:h.salsifyGrouping,product_id:h.id}),this.pubSub.publishAction(e.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:n,size:(null===(c=h.sizes[n])||void 0===c?void 0:c.size)||"",previousSizeId:h.selectedSizeId||"",previousSize:(null===(l=h.sizes[h.selectedSizeId])||void 0===l?void 0:l.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:n,["products."+t+".mainImage"]:(null===(d=h.sizes[n])||void 0===d?void 0:d.image)||null,["products."+t+".productHasAvailability"]:Object.keys(p).length+Object.keys(m).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(v).length),["products."+t+".selectedFulfillmentType"]:u,["products."+t+".selectedFulfillment"]:f,["products."+t+".selectedFulfillmentId"]:g,["products."+t+".engravingLines"]:[]})}async selectFulfillment(t,n){var i,r,s,a,c;const l=this.store.get("products."+t),d=null===(i=l.sizes[l.selectedSizeId])||void 0===i?void 0:i.shippingFulfillments,h=null===(r=l.sizes[l.selectedSizeId])||void 0===r?void 0:r.onDemandFulfillments,u=l.selectedFulfillmentType===o.SHIPPING?d:h,p=u[n];this.pubSub.publishAction(e.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:n,selectedFulfillmentType:l.selectedFulfillmentType,previousFulfillmentId:l.selectedFulfillmentId||"",previousFulfillmentType:l.selectedFulfillmentType});const m=splitCategoryPath(l.catPath);this.googleTagManager.viewItem({item_id:l.id,item_name:l.name,item_brand:l.brand,item_category:m.category,item_category2:m.category2,item_category3:m.category3,price:centToDollar((null===(s=l.priceInfo)||void 0===s?void 0:s.avg)||0),item_type:l.type,item_subtype:l.subType,upc:(null===(c=l.sizes[null!==(a=l.selectedSizeId)&&void 0!==a?a:""])||void 0===c?void 0:c.upc)||"",grouping_id:l.salsifyGrouping,product_id:l.id}),this.store.batch({["products."+t+".selectedFulfillment"]:p,["products."+t+".selectedFulfillmentId"]:n,["products."+t+".engravingLines"]:[],["products."+t+".quantity"]:1})}async updateQuantity(t,n){var i;const o=this.store.get("products."+t),r=o.quantity,s=r+n,a=1,c=(null===(i=null==o?void 0:o.selectedFulfillment)||void 0===i?void 0:i.stock)||5,l=Math.max(a,Math.min(c,s));this.pubSub.publishAction(n<0?e.PRODUCT_QUANTITY_DECREASE:e.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:l,previousQuantity:r}),this.store.set("products."+t+".quantity",l)}async changeFulfillmentType(t,n){var i,r,s;const a=this.store.get("products."+t),{shippingFulfillments:c,onDemandFulfillments:l}=a.sizes[a.selectedSizeId],d=n===o.SHIPPING?c:l,h=objectValues(d);if(0===h.length)return this.logger.warn("No fulfillments available for type "+n+" on product "+t),void 0;const u=h[0]||null,p=(null==u?void 0:u.fulfillmentId)||null;this.pubSub.publishAction(e.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:n,selectedFulfillmentId:p,previousFulfillmentType:a.selectedFulfillmentType,previousFulfillmentId:a.selectedFulfillmentId,fulfillmentHasAvailability:h.length>0});const m=splitCategoryPath(a.catPath);this.googleTagManager.viewItem({item_id:a.id,item_name:a.name,item_brand:a.brand,item_category:m.category,item_category2:m.category2,item_category3:m.category3,price:centToDollar((null===(i=a.priceInfo)||void 0===i?void 0:i.avg)||0),item_type:a.type,item_subtype:a.subType,upc:(null===(s=a.sizes[null!==(r=a.selectedSizeId)&&void 0!==r?r:""])||void 0===s?void 0:s.upc)||"",grouping_id:a.salsifyGrouping,product_id:a.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:n,["products."+t+".selectedFulfillment"]:u,["products."+t+".selectedFulfillmentId"]:p,["products."+t+".fulfillmentHasAvailability"]:h.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async updateEngravingLines(t,n){const i=this.store.get("products."+t);if(!i)return this.logger.warn("Product store for ID "+t+" does not exist."),void 0;this.store.set("products."+t+".engravingLines",n),this.pubSub.publishAction(e.PRODUCT_ENGRAVING_UPDATED,{identifier:t,engravingLines:n,previousEngravingLines:i.engravingLines||[]})}async openProductDrawer(t,e,n){const i={type:e,data:n||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:i})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),e=Object.keys(t);for(const n of e)this.store.set("products."+n+".rerender",!![])}async addToCart(t,e){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(i.CART),await this.cartCommands.addItem(e),this.store.batch({["products."+t+".engravingLines"]:[],["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.warn("Error adding to cart"),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,e){try{this.store.set("products."+t+".updating",!![]),await this.cartCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(i.CHECKOUT),this.store.batch({["products."+t+".engravingLines"]:[],["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.warn("Error adding presale to cart"),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const e=this.store.get("products."+t),n={},fulfillmentEventData=t=>{const e={};for(const n in t){const i=t[n];e[n]={retailerId:i.retailerId,retailerName:i.retailerName,retailerAddress:i.retailerAddress,retailerTimezone:i.timezone,price:i.price,partNumber:i.partNumber,fulfillmentId:i.fulfillmentId,fulfillmentType:i.fulfillmentType,modalities:i.modalities||[]}}return e};for(const i in e.sizes||{}){const t=e.sizes[i];n[i]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc||"",container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.maxQuantityPerOrder,image:t.image,uom:t.uom,volume:t.volume,shippingFulfillments:fulfillmentEventData(t.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(t.onDemandFulfillments||{})}}return{identifier:t,id:e.id,name:e.name,brand:e.brand,category:e.category,catPath:e.catPath,classification:e.classification,priceInfo:e.priceInfo||null,sizes:n}}loadProductStoreUpdate(t){var e,n,i,r,s,a,c,l,d;try{const{products:[h,...u],retailers:p}=t,m=this.themeProvider.getConfigs("product"),f={};let g=![],v=![],y="",x=null,C=m.layout.enableShippingFulfillment?o.SHIPPING:o.ON_DEMAND,k=null,S=null;const E={};if(p&&Array.isArray(p)&&p.length>0)for(const t of p)for(const e of t.fulfillments)E[e.id]={retailerName:t.name,retailerAddress:t.address||null,type:e.type,timezone:e.timezone||"",canEngrave:e.canEngrave||![],expectation:e.expectation,fees:e.fees,hours:e.hours,retailerId:t.id,fulfillmentId:e.id,fulfillmentType:e.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]};if(h.sizes&&Array.isArray(h.sizes)&&h.sizes.length>0)for(const t of h.sizes){const s={},a={};for(const c of t.variants){if((null===(e=null==c?void 0:c.fulfillmentTypes)||void 0===e?void 0:e.onDemand)&&""!==c.fulfillmentTypes.onDemand){const t=c.fulfillmentTypes.onDemand,e=E[t];e?a[t]={...e,isVariantEngravable:c.isEngravable,stock:c.stock,price:c.price,retailerId:c.retailerId,fulfillmentId:t,fulfillmentType:o.ON_DEMAND,modalities:[...e.modalities,...null!==(n=null==c?void 0:c.modalities)&&void 0!==n?n:[]],partNumber:c.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId:",t)}if((null===(i=null==c?void 0:c.fulfillmentTypes)||void 0===i?void 0:i.shipping)&&""!==c.fulfillmentTypes.shipping){const t=c.fulfillmentTypes.shipping,e=E[t];e?s[t]={...e,isVariantEngravable:c.isEngravable,stock:c.stock,price:c.price,retailerId:c.retailerId,fulfillmentId:t,fulfillmentType:o.SHIPPING,modalities:[...e.modalities,...null!==(r=null==c?void 0:c.modalities)&&void 0!==r?r:[]],partNumber:c.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId:",t)}}f[t.id]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.maxQuantityPerOrder,image:t.image,uom:t.uom,volume:t.volume,attributes:t.attributes,loading:![],error:null,shippingFulfillments:s,onDemandFulfillments:a}}const I=objectValues(f);y=I[0]&&I[0].id||"",x=I[0]&&I[0].image||null;const T=(null===(s=f[y])||void 0===s?void 0:s.shippingFulfillments)||{},P=(null===(a=f[y])||void 0===a?void 0:a.onDemandFulfillments)||{},F=objectValues(T).length,A=objectValues(P).length;g=F+A>0;const _=C===o.SHIPPING?objectValues(T):objectValues(P);if(v=_.length>0,S=_[0]||null,k=(null==S?void 0:S.fulfillmentId)||null,!v){const t=C===o.SHIPPING?o.ON_DEMAND:o.SHIPPING,e=t===o.SHIPPING?objectValues(T):objectValues(P);e.length>0&&(C=t,S=e[0],k=(null==S?void 0:S.fulfillmentId)||null,v=!![])}return{identifier:"",id:h.id||"",name:h.name,description:h.description,htmlDescription:h.htmlDescription,images:h.images,priceInfo:{min:(null===(c=h.priceInfo)||void 0===c?void 0:c.minimum)||0,max:(null===(l=h.priceInfo)||void 0===l?void 0:l.maximum)||0,avg:(null===(d=h.priceInfo)||void 0===d?void 0:d.average)||0},brand:h.brand,catPath:h.catPath,category:h.category,classification:h.classification,type:h.type,subType:h.subType,salsifyGrouping:h.salsifyGrouping,sizes:f,productHasAvailability:g,fulfillmentHasAvailability:v,selectedSizeId:y,mainImage:x,selectedFulfillmentType:C,selectedFulfillmentId:k,selectedFulfillment:S,drawer:{isOpen:![],contentConfig:null},engravingLines:[],error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(h){throw this.logger.error("Error processing product data:",h),h}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(t){return!t||t.length<3?[]:await this.api.getAddressSuggestions(t)}async getAddressDetails(t){return await this.api.getAddressDetails(t)}async setSelectedAddress(t){const n=this.store.get("address"),i=this.shouldResetCartForAddressChange(n,t);this.store.batch({"address.id":t.id,"address.formattedAddress":t.formattedAddress,"address.address":t.address,"address.coordinates":t.coordinates});const o=this.store.get("products");try{await this.productCommands.loadMultipleProducts(Object.keys(o)),i&&await this.cartCommands.resetCart()}catch(r){throw this.pubSub.publishAction(e.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==r?void 0:r.message)||"Failed to update downstream state after address change"}),r}this.pubSub.publishAction(e.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},coordinates:t.coordinates,formattedAddress:t.formattedAddress}),await this.persistSessionData()}async setAddressManually(t,n){try{const e=buildFormattedAddressString(t),i={id:"",formattedAddress:e,address:t,coordinates:n};await this.setSelectedAddress(i)}catch(i){throw this.pubSub.publishAction(e.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:t,coordinates:n,error:(null==i?void 0:i.message)||"Failed to set manual address"}),i}}clearSelectedAddress(){this.store.set("address",L),this.pubSub.publishAction(e.ADDRESS_CLEARED,!![]),this.clientConfig.isLocalStorageAvailable()&&this.store.forceSave()}shouldResetCartForAddressChange(t,e){return t.id?t.address.city!==e.address.city||t.address.state!==e.address.state||t.address.zip!==e.address.zip:![]}async persistSessionData(){var t;const e=this.store.get("address.id")||"",n=this.store.get("cart.id")||"";if(this.clientConfig.isLocalStorageAvailable())this.store.forceSave();else try{const i=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"";await this.api.setPersistedStore(i,{p:e,c:n}),this.logger.info("Session data persisted to DB",{userDeviceId:i,addressId:e,cartId:n})}catch(i){this.logger.error("Failed to persist session data to DB",{error:(null==i?void 0:i.message)||i})}}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}class ClientActionService{constructor(){this.productActions={getDetails:t=>this.command.product.productDataForEventFromStore(t)},this.addressActions={setAddressByPlacesId:async t=>{try{if(!t||""===t.trim())throw new Error("Invalid placesId provided");const e=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:e.address,coordinates:e.coords,formattedAddress:e.formattedAddress})}catch(e){throw this.logger.error("Error setting address by placesId:",e),e}},setAddressManually:async(t,e)=>{try{if(!t||!e)throw new Error("Invalid address or coordinates provided");if(!(t.one&&t.city&&t.state&&t.zip))throw new Error("Address must include street address, city, state, and zip code");if("number"!=typeof e.lat||"number"!=typeof e.long)throw new Error("Coordinates must be valid numbers");if(e.lat<-90||e.lat>90)throw new Error("Latitude must be between -90 and 90");if(e.long<-180||e.long>180)throw new Error("Longitude must be between -180 and 180");await this.command.address.setAddressManually(t,e)}catch(n){throw this.logger.error("Error setting manual address:",n),n}},clear:()=>{this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(i.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CART)},addProduct:async(t,n)=>{var r,s;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;n===!![]&&this.command.ui.openDrawer(i.CART);const a=[...new Set(t.map(t=>t.identifier))],c=await this.api.getProductsData(a,this.getLocation());if(!c||!c.products||0===c.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(e.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const e of t){let t=null;for(let o=0;o<c.products.length;o++){const n=c.products[o];let i=![];for(let t=0;t<n.sizes.length;t++){const o=n.sizes[t];if(o.upc===e.identifier||o.id===e.identifier||n.salsifyGrouping===e.identifier){i=!![];break}}if(i){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=t.sizes[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(s=null===(r=null==n?void 0:n.attributes)||void 0===r?void 0:r.presale)||void 0===s?void 0:s.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+e.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let i=null;for(let r=0;r<n.variants.length;r++){const t=n.variants[r];let s=![];if(e.fulfillmentType===o.ON_DEMAND&&(s=!(!t.fulfillmentTypes||!t.fulfillmentTypes.onDemand||""===t.fulfillmentTypes.onDemand)),e.fulfillmentType===o.SHIPPING&&(s=!(!t.fulfillmentTypes||!t.fulfillmentTypes.shipping||""===t.fulfillmentTypes.shipping)),s){i=t;break}}if(!i){this.logger.warn("No supported variant found for product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const a=e.fulfillmentType===o.ON_DEMAND?i.fulfillmentTypes.onDemand:i.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:n.upc,fulfillmentId:a,partNumber:i.partNumber,quantity:e.quantity,identifier:e.identifier})}this.pubSub.publishAction(e.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:a}),this.logger.info("Products added to cart successfully:",a)}catch(a){throw this.logger.error("Error adding products to cart:",a),this.pubSub.publishAction(e.CART_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:a.message||"Failed to add products to cart"}),a}},applyPromoCode:async t=>{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.applyPromoCode(t);const o=this.command.cart.getDetails();this.pubSub.publishAction(e.CART_PROMO_CODE_APPLIED,{applied:!![],discountAmount:o.amounts.discounts,newTotal:o.amounts.total}),this.logger.info("Promo code applied successfully")}catch(n){throw this.logger.error("Failed to apply promo code:",n),this.pubSub.publishAction(e.CART_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),n}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),n=t.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(e.CART_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(e.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(i.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CHECKOUT)},addProduct:async(t,n)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;n===!![]&&this.command.ui.openDrawer(i.CHECKOUT);const o=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:o}),this.logger.info("Products added to checkout successfully:",o)}catch(o){throw this.logger.error("Error adding products to checkout:",o),this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:o.message||"Failed to add products to checkout"}),o}},applyPromoCode:async t=>{var n;try{const i=this.themeProvider.getConfigs("global"),o=i.layout.allowPromoCodes;if(!o)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.applyPromoCode(t);const r=this.store.get("checkout"),s=null==r?void 0:r.promoCode;this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_APPLIED,{applied:!![],discountAmount:(null==s?void 0:s.discountAmount)||0,newTotal:(null===(n=null==r?void 0:r.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(i){throw this.logger.error("Failed to apply checkout promo code:",i),this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_FAILED,{attempted:!![],error:"Promo code could not be applied"}),i}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),n=t.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(e.CHECKOUT_PROMO_CODE_REMOVED,{applied:![]}),this.logger.info("Checkout promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove checkout promo code:",t),t}},applyGiftCard:async t=>{var n;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_APPLIED,{applied:!![],newTotal:(null===(n=null==r?void 0:r.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card applied successfully")}catch(i){throw this.logger.error("Failed to apply gift card:",i),this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be applied"}),i}},removeGiftCard:async t=>{try{const n=this.themeProvider.getConfigs("checkout"),i=n.layout.allowGiftCards;if(!i)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t),this.pubSub.publishAction(e.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(e.CHECKOUT_GIFT_CARD_FAILED,{attempted:!![],error:"Gift card could not be removed"}),n}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:(t,e)=>{this.command.checkout.toggleMarketingPreferences(t,e)},updateCustomerInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateCustomerInfo(e,n)},updateBillingInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateBillingInfo(e,n)},updateGiftInfo:t=>{for(const[e,n]of objectEntries(t))this.command.checkout.updateGiftInfo(e,n)},getDetails:()=>{var t;const e=this.store.get("checkout"),n=e.items||{},i={};for(const[o,r]of Object.entries(n)){const t=r,{attributes:e,...n}=t;i[o]=n}return{cartId:e.cartId||"",amounts:e.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:i,isGift:e.isGift||![],hasAgeVerify:e.hasAgeVerify||![],hasPromoCode:!!(null===(t=e.promoCode)||void 0===t?void 0:t.code),hasGiftCards:Array.isArray(e.giftCards)&&e.giftCards.length>0,itemCount:Object.keys(n).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")}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}function componentError({componentType:t,message:e}){const n=document.createElement("div");n.className=t;const i=n.attachShadow({mode:"closed"}),o=document.createElement("style");o.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 r=document.createElement("div"),s=document.createElement("h3");s.textContent="Component </"+t+">";const a=document.createElement("p");return a.textContent=e,r.appendChild(o),r.appendChild(s),r.appendChild(a),i.appendChild(r),n}function productionComponentError({title:t,message:e,componentType:n}){const i=document.createElement("div");i.setAttribute("data-component-type",n);const o=i.attachShadow({mode:"closed"}),r=document.createElement("style");r.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 s=document.createElement("div"),a=document.createElement("h2");a.textContent=t;const c=document.createElement("p");return c.textContent=e,s.appendChild(r),s.appendChild(a),s.appendChild(c),o.appendChild(s),i}class ComponentFactoryService{static get logger(){return ComponentFactoryService.t||(ComponentFactoryService.t=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.t}static get clientConfig(){return ComponentFactoryService.i||(ComponentFactoryService.i=ClientConfigService.getInstance()),ComponentFactoryService.i}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(t,e){ComponentFactoryService.getComponentRegistry().set(t,e)}static createElement(t){try{const e=ComponentFactoryService.getComponentRegistry().get(t.type);if(!e)throw new Error("Component type ["+t.type+"] is not registered");const n=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(n)||window.customElements.define(n,e);const o=document.createElement(n);if(o.initialize){const{type:e,useShadowDom:i,wrapInLceElement:r,...s}=t,a={type:e,tagName:n,useShadowDom:i&&r!==!![]};o.initialize({data:s,config:a})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(i.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const r=document.createElement(n);return r.initialize(t.type,o),r}return o}catch(e){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">:",(null==e?void 0:e.message)||e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t.type}):componentError({componentType:t.type,message:(null==e?void 0:e.message)||e})}}static componentError({componentType:t,message:e}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t}):componentError({componentType:t,message:e})}static getComponentTagName(t){const e={[i.DRAWER]:"drawer-lc",[i.INPUT]:"input-lc",[i.BIRTHDATE_INPUT]:"birthdate-input-lc",[i.ENGRAVING_FORM]:"engraving-form-lc",[i.ENGRAVING_VIEW]:"engraving-view-lc",[i.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[i.POWERED_BY]:"powered-by-lc",[i.LCE_ELEMENT]:"lce-element",[i.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[i.ALERT]:"alert-lc",[i.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[i.ADDRESS]:"address-lc",[i.ADDRESS_INPUT]:"address-input-lc",[i.ADDRESS_DISPLAY]:"address-display-lc",[i.PRODUCT]:"product-lc",[i.PRODUCT_OPTIONS]:"product-options-lc",[i.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[i.PRODUCT_INTERACTIONS]:"product-interactions-lc",[i.PRODUCT_DESCRIPTION]:"product-description-lc",[i.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[i.PRODUCT_RETAILERS]:"product-retailers-lc",[i.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[i.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[i.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[i.PRODUCT_PRICE]:"product-price-lc",[i.PRODUCT_DRAWER]:"product-drawer-lc",[i.PRODUCT_LOADING]:"product-loading-lc",[i.CART]:"cart-lc",[i.CART_RETAILER]:"cart-retailer-lc",[i.CART_ITEM]:"cart-item-lc",[i.CART_FOOTER]:"cart-footer-lc",[i.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[i.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[i.CART_PROMO_CODE]:"cart-promo-code-lc",[i.CART_HEADER]:"cart-header-lc",[i.CART_BODY]:"cart-body-lc",[i.CART_FULFILLMENT]:"cart-fulfillment-lc",[i.CHECKOUT]:"checkout-lc",[i.CHECKOUT_INFORMATION_SECTION]:"checkout-information-section-lc",[i.CHECKOUT_PAYMENT_FORM]:"checkout-payment-form-lc",[i.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[i.CHECKOUT_BILLING_FORM]:"checkout-billing-form-lc",[i.CHECKOUT_SUMMARY_SECTION]:"checkout-summary-section-lc",[i.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[i.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[i.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[i.CHECKOUT_ITEMS]:"checkout-items-lc",[i.CHECKOUT_COMPLETED]:"checkout-completed-lc",[i.CHECKOUT_DELIVERY_INFORMATION_FORM]:"checkout-delivery-information-form-lc",[i.CHECKOUT_BUYER_INFORMATION_FORM]:"checkout-buyer-information-form-lc",[i.CHECKOUT_TIPS]:"checkout-tips-lc",[i.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[i.CHECKOUT_ITEM]:"checkout-item-lc",[i.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[i.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[i.CHECKOUT_HEADER]:"checkout-header-lc",[i.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[i.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc"};return e[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;class FingerPrintService{constructor(){this.keyPrefix=O,this.isLocalStorageAvailable=null}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.o()){const e=this.l(t);if(e)return this.h(t,e)}const e=await this.u();return this.h(t,e)}async getFingerprintData(){return{screen:this.m(),webgl:this.v(),canvas:await this.C(),browser:this.k(),timezone:this.S(),audio:this.I()}}isLocalStorageWebApiAvailable(){return this.o()}h(t,e){return(t+"_"+e).toLowerCase()}o(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{const t="__localStorage_test__";return localStorage.setItem(t,"test"),localStorage.removeItem(t),this.isLocalStorageAvailable=!![],!![]}catch(t){return this.isLocalStorageAvailable=![],![]}}l(t){try{const e=this.keyPrefix+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(n&&n.startsWith(e)){const t=n.substring(e.length);if(t&&32===t.length&&/^[a-f0-9]{32}$/.test(t))return t}}return null}catch(e){return null}}async u(){const t=await this.getFingerprintData(),e=Object.keys(t).sort(),n=e.map(e=>e+":"+t[e]).join("|");return await this.T(n)}m(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,i=this.P(),o=Math.round(100*window.devicePixelRatio)||100;return e+"|"+n+"|"+i+"|"+o}catch(t){return"24|24|srgb|100"}}P(){try{if(window.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(_){}return"srgb"}v(){var t;try{const e=document.createElement("canvas"),n=e.getContext("webgl")||e.getContext("experimental-webgl");if(!n)return"no_webgl";const i=n,o=i.getExtension("WEBGL_debug_renderer_info");let r="unknown",s="unknown";o&&(r=i.getParameter(o.UNMASKED_VENDOR_WEBGL)||"unknown",s=i.getParameter(o.UNMASKED_RENDERER_WEBGL)||"unknown"),r=r.toLowerCase().replace(/\s+/g,"_").substring(0,30),s=s.toLowerCase().replace(/\s+/g,"_").substring(0,30);const a=i.getParameter(i.MAX_TEXTURE_SIZE)||0,c=i.getParameter(i.MAX_VERTEX_ATTRIBS)||0,l=(null===(t=i.getParameter(i.MAX_VIEWPORT_DIMS))||void 0===t?void 0:t[0])||0,d=i.getSupportedExtensions()||[],h=d.length;return e.remove(),r+"|"+s+"|"+a+"|"+c+"|"+l+"|"+h}catch(e){return"webgl_error|unknown|0|0|0|0"}}async C(){try{const t=document.createElement("canvas");t.width=200,t.height=50;const e=t.getContext("2d",{willReadFrequently:!![]});if(!e)return"no_canvas";e.imageSmoothingEnabled=![],e.fillStyle="#FFFFFF",e.fillRect(0,0,200,50),e.textBaseline="alphabetic",e.fillStyle="#000000",e.font="14px monospace",e.fillText("Fingerprint123",10,20),e.font="16px sans-serif",e.fillText("Test@2024",10,40),e.fillStyle="#FF0000",e.fillRect(130,10,20,20),e.fillStyle="#0000FF",e.beginPath(),e.arc(170,25,10,0,2*Math.PI),e.fill();const n=e.getImageData(50,15,100,20);let i="";for(let o=0;o<n.data.length;o+=40)i+=n.data[o].toString(16),i+=n.data[o+1].toString(16),i+=n.data[o+2].toString(16);return t.remove(),this.F(i).substring(0,8)}catch(t){return"canvas_error"}}k(){var t,e;try{const n=navigator,i=[],o=((null===(t=n.languages)||void 0===t?void 0:t[0])||n.language||"en").substring(0,2);i.push(o),i.push(n.hardwareConcurrency||1);const r=(null===(e=n.platform)||void 0===e?void 0:e.toLowerCase())||"unknown";i.push(r.replace(/\s+/g,"_").substring(0,10)),i.push(n.cookieEnabled?"1":"0"),i.push(n.maxTouchPoints||0),i.push(n.deviceMemory||0),i.push(this.D());const s=["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(s.join("")),i.join("|")}catch(n){return"unknown|1|unknown|1|0|0|unknown|00000000"}}D(){try{const t=navigator.userAgent.toLowerCase();return t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}S(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}I(){try{const t=window.AudioContext||window.webkitAudioContext;if(!t)return"no_audio";const e=new t,n=e.sampleRate||44100,i=e.destination.channelCount||2,o=e.destination.maxChannelCount||2;return e.close(),n+"|"+i+"|"+o}catch(t){return"44100|2|2"}}async T(t){if((null===crypto||void 0===crypto?void 0:crypto.subtle)&&TextEncoder)try{const e=new TextEncoder,n=e.encode(t),i=await crypto.subtle.digest("SHA-256",n),o=Array.from(new Uint8Array(i));return o.map(t=>t.toString(16).padStart(2,"0")).join("").substring(0,32)}catch(e){}return this.F(t)}F(t){const e=16777619,n=2166136261;let i=n,o=n;for(let s=0;s<t.length;s++){const n=t.charCodeAt(s);i^=n,i=Math.imul(i,e),o^=n<<1,o=Math.imul(o,e)}i=Math.abs(i),o=Math.abs(o);let r=i.toString(16).padStart(8,"0")+o.toString(16).padStart(8,"0");for(;r.length<32;)i=Math.imul(i,e),o=Math.imul(o,e),r+=(i^o).toString(16);return r.substring(0,32).padStart(32,"0")}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:e}){var n;this.A=Object.freeze(t),this._=Object.freeze({type:e.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(n=null==e?void 0:e.useShadowDom)&&void 0!==n?n:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(t){return t.map(t=>this.interpolatePath(t))}interpolatePath(t){if("string"!=typeof t)return t;const e=/\{([^}]+)}/g;return t.replace(e,(e,n)=>{const i=this.A[n];return null==i?(this.logger.warn('Parameter "'+n+'" not found in component params for path "'+t+'"'),e):String(i)})}connectedCallback(){var t;this.isDestroyed||(this.initialized=!![],this.container=this._.useShadowDom?this.attachShadow({mode:this.clientConfig.isDevelopment()?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this))}disconnectedCallback(){var t;this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}setup(){var t,e;this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(e=this.beforeConnected)||void 0===e||e.call(this)}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const e of this.unsubscribers)try{e()}catch(t){this.logger.error("Cleanup error:",t)}this.unsubscribers=[]}setupAutoDestroy(){var t;if(!this.reactiveOptions.autoDestroy)return;let e=this.reactiveOptions.autoDestroyPath;if(!e&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(e=this.reactiveOptions.watchStorePaths[0]),!e)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const n=this.interpolatePath(e),i=this.store.watch(n,(t,e)=>{this.isDestroyed||void 0===t&&void 0!==e&&this.handleAutoDestroy(n)});this.unsubscribers.push(i),this.logger.debug("🔥 AutoDestroy enabled for "+this._.tagName+" watching path: "+n)}handleAutoDestroy(t){var e;if(this.isDestroyed)return;this.logger.debug("🔥 AutoDestroy triggered for "+this._.tagName+' - path "'+t+'" was removed'),null===(e=this.beforeAutoDestroy)||void 0===e||e.call(this,t);const n=this.reactiveOptions.autoDestroyDelay||0;n>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},n):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(e){this.logger.error("Error during auto-destroy of "+this._.tagName+":",e)}}setupStoreWatchers(){let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.A)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e;if(this.isDestroyed)return;const n=t.map(t=>t.path).join(", "),i="store:["+n+"]",o=null===(e=this.onStoreChanged)||void 0===e?void 0:e.call(this,t);o!==![]&&this.triggerRender(i)});this.unsubscribers.push(e)}setupNonRenderingWatchers(){let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.A)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e;this.isDestroyed||(null===(e=this.onStoreWatch)||void 0===e?void 0:e.call(this,t))});this.unsubscribers.push(e)}triggerRender(t){this.lastRenderTrigger=t,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var t,e;if(!this.initialized||this.isDestroyed)return;const n=performance.now();this.renderCount++;try{const e=this.template();"string"==typeof e&&(this.container.innerHTML=e),e instanceof HTMLElement&&safeReplaceChildren(this.container,e),Array.isArray(e)&&safeReplaceChildren(this.container,...e);const i=performance.now()-n;this.logRenderInfo(i),null===(t=this.afterRender)||void 0===t||t.call(this)}catch(i){this.logger.error("❌ Component error in "+this._.tagName+":",i),this.logger.error("Last render trigger: "+this.lastRenderTrigger),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this._.type,message:i instanceof Error?i.message:String(i)})),null===(e=this.onError)||void 0===e||e.call(this,i,"render")}}logRenderInfo(t){const e=this._.type,n=this._.tagName,i=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+i+" "+e+" </"+n+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&this.logger.warn("⚠️ Slow render in "+e+"("+n+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger)}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}}addHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.add(...e)}removeHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());e.length>0&&this.classList.remove(...e)}toggleHostClasses(...t){const e=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const n of e)this.classList.toggle(n)}addHostAttribute(t,e){t&&"string"==typeof t&&e&&"string"==typeof e&&(this.setAttribute(t,String(e)),this.hostAttributes[t]=String(e))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[e,n]of Object.entries(t))e&&"string"==typeof e&&n&&"string"==typeof n&&this.setAttribute(e,String(n))}get params(){return this.A}get config(){return this.themeProvider.getComponentConfig(this._.type)}get elementConfig(){return this._}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,e){return this.store.set(t,e)}watchStore(t,e){const n=this.store.watch(t,e);return this.unsubscribers.push(n),n}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const e=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:i.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,o;const r=this.getStoreValue("address"),s=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],a=null!==(e=this.params.productId)&&void 0!==e?e:"",c=null!==(n=this.params.options)&&void 0!==n?n:{},l=null!==(o=c.showLabel)&&void 0!==o?o:!![],d=[];if(l){const t=document.createElement("span");t.textContent="Delivers to:",d.push(t)}const h=document.createElement("button");return h.type="button",h.textContent=r.formattedAddress||"Select an address",h.addEventListener("click",async()=>{if(s)return this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a,isIndependentComponent:!![]}),void 0;!s&&a&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(a,i.ADDRESS_INPUT,{productId:a}))}),d.push(h),d}}const ArrowRightIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="arrow-right-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:t=24,height:e=24,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 489 489" class="bag-icon '+n+'" style="'+o+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckboxIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="checkbox-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="'+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="chevron-left-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},CloseIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="close-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},CompletedIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 32 32" class="completed-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M20.8847 5.03171C18.521 3.97851 15.8802 3.7176 13.3561 4.28788C10.832 4.85817 8.55988 6.22909 6.87859 8.1962C5.1973 10.1633 4.19693 12.6212 4.02667 15.2033C3.8564 17.7854 4.52537 20.3534 5.93381 22.5242C7.34224 24.695 9.41467 26.3524 11.842 27.2492C14.2694 28.146 16.9216 28.2341 19.4031 27.5004C21.8846 26.7667 24.0625 25.2505 25.6119 23.1779C27.1613 21.1053 27.9992 18.5874 28.0007 15.9997V14.7738C28.0007 14.0374 28.5976 13.4405 29.334 13.4405C30.0704 13.4405 30.6673 14.0374 30.6673 14.7738V16.0005C30.6655 19.1632 29.6414 22.2414 27.7477 24.7746C25.854 27.3077 23.1921 29.1609 20.1592 30.0576C17.1262 30.9544 13.8846 30.8467 10.9179 29.7506C7.95112 28.6546 5.41814 26.6288 3.69673 23.9756C1.97531 21.3224 1.15768 18.1837 1.36578 15.0278C1.57388 11.8719 2.79655 8.86785 4.85146 6.46361C6.90637 4.05937 9.6834 2.38379 12.7684 1.68678C15.8534 0.989768 19.081 1.30866 21.97 2.5959C22.6426 2.89561 22.9449 3.68384 22.6452 4.35647C22.3455 5.0291 21.5573 5.33142 20.8847 5.03171ZM30.2768 4.39085C30.7975 4.91155 30.7975 5.75577 30.2768 6.27647L16.9435 19.6098C16.4228 20.1305 15.5785 20.1305 15.0578 19.6098L11.0578 15.6098C10.5371 15.0891 10.5371 14.2449 11.0578 13.7242C11.5785 13.2035 12.4228 13.2035 12.9435 13.7242L16.0007 16.7814L28.3912 4.39085C28.9119 3.87015 29.7561 3.87015 30.2768 4.39085Z"/>\n </svg>\n '},ErrorInfoIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="error-info-icon '+n+'" style="'+o+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="info-icon '+n+'" style="'+o+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="search-icon '+n+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+o+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="success-icon '+n+'" style="'+o+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="trash-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:t=16,height:e=16,className:n="",color:i=null})=>{const o=i?"--icon-color: "+i:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+e+'" viewBox="0 0 16 16" class="warning-icon '+n+'" style="'+o+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const e=t.target,n=e.value.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const i=/^\d/.test(n);if(n.length<this.minSearchLength||!i)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(n)},300)},this.closeDrawer=async()=>{const t=this.params.productId,e=this.clientConfig.isMobile(),n=this.isIndependentComponent();(e||n)&&this.commands.ui.closeDrawer(),!e&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(_){this.logger.error("Address edit cancellation failed",{error:_ instanceof Error?_.message:String(_)})}},this.handleCheckAvailability=async()=>{var t;if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const t=this.getStoreValue("address"),e=(null==t?void 0:t.coordinates.lat)!==this.selectedAddress.coordinates.lat&&(null==t?void 0:t.coordinates.long)!==this.selectedAddress.coordinates.long;e&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(e){this.logger.error("Address selection and availability check failed",{selectedAddress:this.selectedAddress,productId:null!==(t=this.params.productId)&&void 0!==t?t:"",error:e instanceof Error?e.message:String(e)}),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async t=>{const e=t.currentTarget.dataset.suggestionId;if(e)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(e);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:e,address:t.address,coordinates:t.coords,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(n){this.logger.error("Address details retrieval failed",{addressId:e,error:n instanceof Error?n.message:String(n)}),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=t=>{this.container.contains(t.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const t=this.getStoreValue("address");(null==t?void 0:t.formattedAddress)&&(this.selectedAddress=t)}async searchAddresses(t){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const e=await this.commands.address.searchAddresses(t);this.suggestions=e.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(e){this.logger.error("Address search operation failed",{query:t,error:e instanceof Error?e.message:String(e)}),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const t=this.errorContainer.querySelector(".error-text");t&&(t.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const t=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(t),void 0}for(const t of this.suggestions){const e=this.createElement("li",{className:"suggestion-item"}),n=this.createElement("span",{textContent:t.description});e.appendChild(n),e.setAttribute("data-suggestion-id",t.id),e.addEventListener("click",this.handleSuggestionClick),this.suggestionsContainer.appendChild(e)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,e){const n=document.createElement(t);return e&&Object.assign(n,e),n}createErrorContainer(){const t=this.createElement("div",{className:"error-message"});t.style.display="none";const e=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),n=this.createElement("span",{className:"error-text"});return t.appendChild(e),t.appendChild(n),t}createCheckButton(){const t=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return t.addEventListener("click",this.handleCheckAvailability),t}createCancelButton(){const t=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return t.addEventListener("click",this.handleCancel),t}template(){var t,e,n;const i=this.getConfigs("global"),o=null!==(t=this.params.options)&&void 0!==t?t:{},r=null!==(e=o.showLabel)&&void 0!==e?e:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),r){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const s=this.createElement("div",{className:"input-wrapper "+i.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(n=this.selectedAddress)||void 0===n?void 0:n.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.addEventListener("input",this.handleInputChange),s.appendChild(this.inputElement);const a=this.createElement("span");a.className="input-icon",a.innerHTML=SearchIcon({width:16,height:16,className:""}),s.appendChild(a),this.inputContainer.appendChild(s),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const c=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),l=[this.inputContainer,c,this.errorContainer],d=this.createElement("div",{className:"action-buttons"}),h=this.createCancelButton();d.appendChild(h);const u=this.createCheckButton();return d.appendChild(u),l.push(d),document.addEventListener("click",this.handleDocumentClick),l}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchOnlyStorePaths:["cart.rerender"]})}onStoreWatch(t){const e=t.find(t=>"cart.rerender"===t.path);(null==e?void 0:e.value)&&this.rerender()}template(){const t=[],e=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!e){const e=ComponentFactoryService.createElement({type:i.CART_HEADER});t.push(e)}const n=ComponentFactoryService.createElement({type:i.CART_BODY});t.push(n);const o=ComponentFactoryService.createElement({type:i.CART_FOOTER});return t.push(o),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=document.createElement("div");t.className="empty-cart-container";const e=document.createElement("h3");return e.className="empty-cart-content",e.textContent="Your cart is empty",t.appendChild(e),t}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:i.CART_RETAILER,retailerId:t.id})}catch(e){return this.logger.error("Cart retailer component creation failed",{retailerId:t.id,retailerName:t.name,error:e instanceof Error?e.message:String(e)}),document.createElement("div")}}getRetailerElementById(t){return this.container.querySelector('[data-retailer-id="'+t+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const t=this.createEmptyCartElement();this.container.appendChild(t),this.setupEmptyCartListeners()}addLoadingOverlay(){const t=this.getLoadingElement();if(!t){const t=this.createLoadingElement();this.container.appendChild(t)}}removeLoadingOverlay(){const t=this.getLoadingElement();t&&t.remove()}setupEmptyCartListeners(){const t=this.container.querySelector('[data-action="continue-shopping"]');t&&t.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(t,e){const n=this.createRetailerElement(e);n.setAttribute("data-retailer-id",t),this.container.appendChild(n)}removeRetailerElement(t){const e=this.getRetailerElementById(t);e&&e.remove()}updateRetailerElement(t,e){const n=this.getRetailerElementById(t);if(n){const i=this.createRetailerElement(e);i.setAttribute("data-retailer-id",t),n.replaceWith(i)}}hasRetailerDataChanged(t,e){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const e={};for(const[n,i]of Object.entries(t))i&&"object"==typeof i&&i.id&&(e[n]=i);return e}getValidRetailerIds(t){const e=this.getValidRetailers(t);return new Set(Object.keys(e))}onStoreChanged(t){const e=t.find(t=>"cart.retailers"===t.path),n=t.find(t=>"cart.loading"===t.path);if(e){const t=this.getValidRetailers(e.oldValue),n=this.getValidRetailers(e.value),i=this.getValidRetailerIds(e.oldValue),o=this.getValidRetailerIds(e.value),r=i.size,s=o.size,a=this.getValidRetailers(this.getStoreValue("cart.retailers")),c=Object.keys(a).length;if(s>0&&0===c)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===r&&s>0){this.container.innerHTML="";for(const[t,e]of Object.entries(n))this.addRetailerElement(t,e)}else if(r>0&&0===s)this.showEmptyCartState();else if(s>0){for(const t of i)o.has(t)||this.removeRetailerElement(t);for(const e of o){const o=n[e],r=t[e];i.has(e)?this.hasRetailerDataChanged(r,o)&&this.updateRetailerElement(e,o):this.addRetailerElement(e,o)}}else 0===r&&0===s&&this.showEmptyCartState()}if(n){const t=n.value,e=n.oldValue;t!==e&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return n||e,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},e=Object.values(t);if(0===e.length)return this.createEmptyCartElement();const n=[];for(const i of e){const t=this.createRetailerElement(i);t.setAttribute("data-retailer-id",i.id),n.push(t)}return n}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const e=t.some(t=>t.path.includes("cart.items")),n=t.some(t=>t.path.includes("cart.totals")),i=t.some(t=>t.path.includes("cart.fulfillments")),o=t.some(t=>"cart.loading"===t.path),r=t.some(t=>t.path.includes("cart.retailers"));if(e&&this.updateSubtotalItemsCount(),n&&this.subtotalPrice){const t=this.getStoreValue("cart.totals.subtotal")||0;this.subtotalPrice.textContent=""+formatCentToDollarText(t)}(i||n||o||e||r)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const e=this.getStoreValue("cart.items")||{},n=Object.values(e).some(t=>t.updating);if(n)return!![];const i=this.getStoreValue("cart.fulfillments")||{},o=Object.values(i).some(t=>t.updating);if(o)return!![];const r=this.getStoreValue("cart.retailers")||{},s=Object.values(r).some(t=>t.updating);return s?!![]:![]}hasUnmetMinimum(t){var e;const n=t.subtotal;if(t.type===o.SHIPPING){const i=t.fees;if((null===(e=i.individual)||void 0===e?void 0:e.active)&&i.individual.min>0&&n<i.individual.min)return!![]}if(t.type===o.ON_DEMAND){const e=t.fees;if(e.min>0&&n<e.min)return!![]}return![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments")||{};return Object.values(t).some(t=>this.hasUnmetMinimum(t))}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},e=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),n=this.shouldDisableCheckout(),i=t||n||!e;this.checkoutButton.disabled=i,this.checkoutButton.classList.toggle("checkout-btn-disabled",i),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),e=Object.values(t).reduce((t,e)=>t+e.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+e+" item"+(1!==e?"s":"")+"):")}template(){const t=this.getConfigs("global"),e=this.getStoreValue("cart.totals.subtotal")||0,n=[],o=document.createElement("div");o.className="cart-footer-header";const r=document.createElement("div");r.className="cart-footer-items-price";const s=document.createElement("span");s.className="subtotal-text",s.textContent="Subtotal (0 items):",this.subtotalText=s,r.appendChild(s);const a=document.createElement("span");a.className="subtotal-price",a.textContent=formatCentToDollarText(e),this.subtotalPrice=a,r.appendChild(a);const c=document.createElement("p");if(c.textContent="Taxes & fees will be calculated at checkout",c.className="taxes-fees-info",o.appendChild(r),o.appendChild(c),n.push(o),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:i.CART_PROMO_CODE});n.push(t)}const l=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});n.push(l);const d=document.createElement("button");if(d.type="button",d.className="checkout-button",d.addEventListener("click",async t=>this.clientConfig.isBuilder()?(t.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(t.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)),d.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton=d,n.push(d),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});n.push(t)}return n}}const ot={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"},rt="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=ot[e];return n||rt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return rt}}function getCurrentTimeInTimezone$1(t){try{const e=new Date,n=e.getTime(),i=6e4*e.getTimezoneOffset(),o=new Date(n+i),r=new Date(o.toLocaleString("en-US",{timeZone:t})),s=o.getTime()-r.getTime();return new Date(n+s)}catch(e){return new Date}}function getCurrentTimeInUserTimezone(t){const e=detectUserTimezone(t);return getCurrentTimeInTimezone$1(e)}function isDateTimeInRange(t){const{startDate:e,endDate:n,addressState:i}=t;try{const t=getCurrentTimeInUserTimezone(i),o=!e||t>=new Date(e),r=!n||t<=new Date(n);return o&&r}catch(o){return![]}}function filterActiveItems(t,e){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:e}))}function hasActiveItems(t,e){return filterActiveItems(t,e).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,e,n;const o=this.config.layout.drawerHeaderText,r=this.getConfigs("global"),s=document.createElement("div");s.className="cart-header-content";const a=document.createElement("h2");a.className="cart-title",a.textContent=o,s.appendChild(a);const c=document.createElement("button");c.type="button",c.className="cart-header-close-btn",c.innerHTML=CloseIcon({width:16,height:16}),c.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),s.appendChild(c);const l=this.clientConfig.get("promoTicker"),d=null!==(e=null===(t=null==r?void 0:r.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],h=null!=l?l:d,u=this.store.get("address"),p=hasActiveItems(h,null===(n=null==u?void 0:u.address)||void 0===n?void 0:n.state);if(!h.length||!p)return[s];const m=ComponentFactoryService.createElement({context:"cart",type:i.PROMO_CODE_TICKER,tickers:h});return[s,m]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.getItemId()}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}getItemId(){return this.params.itemId}onStoreChanged(t){const e=this.getItemId(),n=t.find(t=>t.path==="cart.items."+e);if(null==n?void 0:n.oldValue){const t=n.oldValue,e=n.value,i=t.attributes.engraving.lines&&t.attributes.engraving.lines.length>0,o=e.attributes.engraving.lines&&e.attributes.engraving.lines.length>0;i!==o&&(this.handleEngravingElement(),this.updateShippingTime())}return![]}handleEngravingElement(){const t=this.getConfigs("global");if(!t.layout.enablePersonalization)return;const e=this.getItemId(),n=this.getStoreValue("cart.items."+e),o=n.attributes.engraving.lines&&n.attributes.engraving.lines.length>0,r=this.container.querySelector(".engraving-view-container");r&&r.remove();const s=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:e,context:"cart",watchStorePaths:["cart.items.{identifier}"]}),a=this.container.querySelector(".item-shipping-container"),c=this.container.querySelector(".cart-item");o?c&&c.insertAdjacentElement("afterend",s):a&&a.appendChild(s)}updateShippingTime(){var t;const e=this.getItemId(),n=this.getStoreValue("cart.items."+e),i=this.getStoreValue("cart.fulfillments."+n.fulfillmentId),o=n.attributes.engraving.lines&&n.attributes.engraving.lines.length>0,r=o?"10 days":(null===(t=null==i?void 0:i.expectation)||void 0===t?void 0:t.short)||"2-3 days",s=this.container.querySelector(".item-shipping span");s&&(s.textContent="Ships in "+r)}template(){var t;const e=this.getItemId(),n=this.getStoreValue("cart.items."+e),o=this.getStoreValue("cart.fulfillments."+n.fulfillmentId),r=n.attributes.engraving.lines&&n.attributes.engraving.lines.length>0,s=r?"Ships in 10 days":(null===(t=null==o?void 0:o.expectation)||void 0===t?void 0:t.detail)||"",a=document.createElement("article");a.className="cart-item";const c=document.createElement("div");c.className="item-image";const l=document.createElement("img");l.src=n.mainImage,l.alt=n.name,c.appendChild(l);const d=document.createElement("div");d.className="item-details";const h=document.createElement("div");h.className="item-header";const u=document.createElement("h3");u.className="item-title",u.textContent=n.name;const p=document.createElement("button");p.className="item-delete",p.innerHTML=TrashIcon({}),p.addEventListener("click",async()=>{await this.commands.cart.removeItem(e)}),h.appendChild(u),h.appendChild(p);const m=document.createElement("div");m.className="item-specs",m.textContent=n.size+", "+n.container;const f=document.createElement("div");f.className="item-shipping-container";const g=document.createElement("div");g.className="item-shipping";const v=document.createElement("span");v.textContent=""+s,g.appendChild(v),f.appendChild(g),d.appendChild(h),d.appendChild(m),d.appendChild(f),a.appendChild(c),a.appendChild(d);const y=[a],x=ComponentFactoryService.createElement({type:i.CART_ITEM_QUANTITY_PRICE,itemId:e});return y.push(x),y}afterRender(){this.handleEngravingElement()}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const e=t.find(t=>"cart.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,e=this.getStoreValue("cart.items."+t);return e||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const e=t.quantity,n=this.getAvailableQuantity(),i=n>0;return{currentQuantity:e,availableQuantity:n,canIncrease:i,canDecrease:!![]}}getAvailableQuantity(){var t;const e=this.getItemStore();if(!e)return 0;const n=e.partNumber,i=e.fulfillmentId,o=this.getStoreValue("cart.items")||{},r=Object.values(o).filter(t=>t.partNumber===n&&t.fulfillmentId===i),s=r.reduce((t,e)=>t+e.quantity,0),a=this.getStoreValue("products."+e.upc)||this.getStoreValue("products."+e.salsifyGrouping);if(!a)return e.maxQuantity-s;const c=null===(t=a.sizes[e.liquidId].attributes)||void 0===t?void 0:t.maxQuantityPerOrder;return!c||c<=0?e.maxQuantity-s:c-s}updateButtonStates(t){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!t.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!t.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!t.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!t.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits();t>0&&!e.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),e=this.getItemStore();if(!e)return document.createElement("div");const n=document.createElement("div");return n.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),this.quantitySpan=document.createElement("span"),this.quantitySpan.className="quantity-value",this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-btn-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(t),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantitySpan),n.appendChild(this.qtyIncreaseButton),n}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const e=document.createElement("div");e.className="item-price-container";const n=document.createElement("span");if(n.className="item-price",n.textContent=formatCentToDollarText(t.price),e.appendChild(n),t.quantity>1){const n=document.createElement("span");n.className="item-price-per-unit",n.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",e.appendChild(n)}return e}template(){const t=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer();t.push(e)}const e=this.createPriceContainer();return t.push(e),t}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path);if(e){const{value:t,oldValue:n}=e,i=(null==n?void 0:n.code)&&!(null==n?void 0:n.error),o=(null==t?void 0:t.code)&&!(null==t?void 0:t.error);if(!i&&o)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!o)return this.container.innerHTML="",this.createInputContainer(),void 0;if(o&&this.promoCodePill&&t.discountAmount!==(null==n?void 0:n.discountAmount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",void 0}}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const e=document.createElement("div");e.classList.add("promo-container"),e.appendChild(this.createPromoInput()),e.appendChild(this.createApplyButton()),t.appendChild(e),this.container.appendChild(t),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),e=t.length>=3,n=this.getStoreValue("cart.loading"),i=this.getStoreValue("cart.promoCode"),o=this.getStoreValue("cart.events")||[],r=hasCartAnyPromoCodeEvents(o);this.applyButton.disabled=!e||n||Boolean(null==i?void 0:i.discountAmount)||this.isApplying||r}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:20},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),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 t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],await this.commands.cart.applyPromoCode(t)}catch(e){this.logger.error("Cart promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,(null==t?void 0:t.code)&&!t.error){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),e}const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");return n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:i.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const e=this.container.querySelectorAll("[data-fulfillment-id]");if(e.length>0){const t=e[e.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const e=this.getFulfillmentInsertionPoint();if(e){const n=this.createFulfillmentElement(t);n.setAttribute("data-fulfillment-id",t);const i=this.getFulfillmentContainer();i&&i.remove(),e.nextSibling?e.parent.insertBefore(n,e.nextSibling):e.parent.appendChild(n)}}removeFulfillmentElement(t){const e=this.getFulfillmentElementById(t);if(e){const t=e.parentElement,n=e.nextElementSibling;e.remove();const i=this.container.querySelectorAll("[data-fulfillment-id]");if(0===i.length){const e=document.createElement("div");e.id="retailer-fulfillment-container",n?t.insertBefore(e,n):t.appendChild(e)}}}handleFulfillmentsUpdate(t,e){const n=new Set(t||[]),i=new Set(e||[]);for(const o of n)i.has(o)||this.removeFulfillmentElement(o);for(const o of i)n.has(o)||this.addFulfillmentElement(o)}setupFulfillmentElements(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],n=this.container.querySelectorAll("[data-fulfillment-id]");for(const o of n)o.remove();let i=this.getFulfillmentContainer();if(!i){const t=this.container.querySelector(".retailer-body-container"),e=this.container.querySelector("#retailer-subtotal-container");i=document.createElement("div"),i.id="retailer-fulfillment-container",t&&e&&t.insertBefore(i,e)}for(const o of e)this.addFulfillmentElement(o)}setupSubtotalElement(){const t=this.getRetailerId(),e=this.container.querySelector("#retailer-subtotal-container");if(e){const n=ComponentFactoryService.createElement({type:i.CART_RETAILER_SUBTOTAL,retailerId:t});e.replaceWith(n)}}onStoreChanged(t){const e=this.getRetailerId(),n="cart.retailers."+e,i=t.find(t=>t.path===n);if(i){const t=i.oldValue,e=i.value,n=(null==t?void 0:t.fulfillments)||[],o=(null==e?void 0:e.fulfillments)||[];JSON.stringify(n)!==JSON.stringify(o)&&this.handleFulfillmentsUpdate(n,o)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),e=this.container.querySelector(".retailer-section");t&&e&&(t.addEventListener("change",()=>{t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed")}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"))}beforeAutoDestroy(){this.logger.debug("Cart retailer component cleanup initiated",{retailerId:this.getRetailerId()})}onAutoDestroy(){this.logger.debug("Cart retailer component successfully destroyed",{retailerId:this.getRetailerId()})}template(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t),n=document.createElement("section");n.className="retailer-section";const i=document.createElement("div");i.className="cart-retailer-header";const o=document.createElement("div");o.className="retailer-info";const r=document.createElement("h2");r.className="section-title",r.textContent=e.name,o.appendChild(r);const s=document.createElement("input");s.type="checkbox",s.id=e.id,s.className="section-toggle",o.appendChild(s);const a=document.createElement("label");a.htmlFor=e.id,a.className="section-header-label";const c=document.createElement("span");c.className="chevron",c.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),a.appendChild(c),o.appendChild(a),i.appendChild(o),n.appendChild(i);const l=document.createElement("div");l.className="retailer-body-container";const d=document.createElement("div");d.id="retailer-fulfillment-container",l.appendChild(d);const h=document.createElement("div");return h.id="retailer-subtotal-container",l.appendChild(h),n.appendChild(l),n}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,e){const n=Object.values(t||{}).filter(t=>t.retailerId===e);let i=0;for(const o of n)i+=o.quantity;return i}template(){const t=this.params.retailerId,e=this.getStoreValue("cart.retailers."+t+".subtotal"),n=this.getStoreValue("cart.items"),i=this.getRetailerItemCount(n,t),o=1===i?"item":"items",r=document.createElement("h3");r.className="retailer-subtotal-header",r.textContent="Subtotal ("+i+" "+o+"):";const s=document.createElement("span");return s.className="retailer-subtotal-amount",s.textContent=formatCentToDollarText(e),[r,s]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.isPresaleLocked","checkout.presaleExpiresAt"],watchOnlyStorePaths:["checkout.rerender"]})}onStoreWatch(t){const e=t.find(t=>"checkout.rerender"===t.path);(null==e?void 0:e.value)===!![]&&this.rerender("CheckoutComponentRerender")}template(){var t,e,n;const o=this.store.get("checkout.isPresaleLocked"),r=this.store.get("checkout.presaleExpiresAt"),s=this.getConfigs("global"),a=this.clientConfig.get("promoTicker"),c=null!==(e=null===(t=null==s?void 0:s.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],l=null!=a?a:c,d=this.store.get("address"),h=hasActiveItems(l,null===(n=null==d?void 0:d.address)||void 0===n?void 0:n.state),u=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),p=o&&r,m=document.createElement("div");m.classList.add("checkout-container"),u&&m.classList.add("no-header"),this.params.isIndependentComponent&&m.classList.add("independent");const f=ComponentFactoryService.createElement({type:i.CHECKOUT_INFORMATION_SECTION});m.appendChild(f);const g=ComponentFactoryService.createElement({type:i.CHECKOUT_SUMMARY_SECTION});if(m.appendChild(g),!p&&(!l.length||!h)&&u)return[m];const v=document.createElement("div");if(v.classList.add("checkout-header-wrapper"),!u){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_HEADER});v.appendChild(t)}if(l.length&&h&&!p){const t=ComponentFactoryService.createElement({context:"checkout",type:i.PROMO_CODE_TICKER,tickers:l});v.appendChild(t)}if(p){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_PRESALE_COUNTDOWN});v.appendChild(t)}return[v,m]}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.isPresaleLocked"),e=this.getConfigs("checkout");let n=null;if(!t){n=document.createElement("button"),n.classList.add("checkout-header-button"),n.setAttribute("aria-label","Back to Cart"),n.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(i.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),n.appendChild(t)}const o=document.createElement("h1");o.textContent=(null==e?void 0:e.layout.drawerHeaderText)||"Checkout",o.classList.add("checkout-header-title"),o.setAttribute("aria-label","Checkout Page");const r=document.createElement("button");return r.innerHTML=CloseIcon({width:16,height:16}),r.classList.add("checkout-header-button-close"),r.setAttribute("aria-label","Close Checkout"),r.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),n?[n,o,r]:[o,r]}}class CheckoutInformationSectionComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift"]})}onStoreWatch(t){const e=t.find(t=>"checkout.isGift"===t.path);e&&this.handleBuyerInformationVisibility(e.value)}handleBuyerInformationVisibility(t){const e=this.container.querySelector("#buyer-information-container");if(t&&!e){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_BUYER_INFORMATION_FORM});t.id="buyer-information-container";const e=this.container.querySelector(".checkout-delivery-information");e&&e.insertAdjacentElement("afterend",t)}else!t&&e&&setTimeout(()=>{e.remove()},300)}template(){const t=[],e=ComponentFactoryService.createElement({type:i.CHECKOUT_DELIVERY_INFORMATION_FORM});t.push(e);const n=ComponentFactoryService.createElement({type:i.CHECKOUT_PAYMENT_FORM});t.push(n);const o=ComponentFactoryService.createElement({type:i.CHECKOUT_BILLING_FORM});return t.push(o),t}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presaleExpiresAt","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var e;const n=t.find(t=>"checkout.presaleExpiresAt"===t.path);if(null==n?void 0:n.value)return this.updateExpiresAt(n.value),!![];const i=t.find(t=>"ui.drawer"===t.path);return(null===(e=null==i?void 0:i.value)||void 0===e?void 0:e.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const t=this.store.get("checkout.presaleExpiresAt");t&&this.updateExpiresAt(t),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var t,e;const n=[".drawer-content"];for(const o of n){const e=null===(t=this.rootElement)||void 0===t?void 0:t.closest(o);if(e&&this.isScrollable(e))return e}let i=null===(e=this.rootElement)||void 0===e?void 0:e.parentElement;for(;i&&i!==document.body;){if(this.isScrollable(i))return i;i=i.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var t,e;if(!this.scrollContainer)return;const n=this.scrollContainer.scrollTop,i=70,o=10;!this.isCurrentlyScrolled&&n>i?(this.isCurrentlyScrolled=!![],null===(t=this.rootElement)||void 0===t||t.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&n<o&&(this.isCurrentlyScrolled=![],null===(e=this.rootElement)||void 0===e||e.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(t){const e=window.getComputedStyle(t),n=e.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===n||"scroll"===n||"overlay"===n)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(t){this.stopCountdown();try{if(this.expiresAt=new Date(t),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:t}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const e=new Date,n=Math.floor((this.expiresAt.getTime()-e.getTime())/1e3);n<this.totalDuration&&(this.totalDuration=Math.max(n,240)),this.startCountdown()}catch(e){this.logger.error("Failed to parse presale expiration date",{expiresAtString:t,error:e instanceof Error?e.message:String(e)}),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const t=new Date,e=Math.max(0,this.expiresAt.getTime()-t.getTime()),n=e/1e3,i=this.totalDuration-n,o=Math.max(0,Math.min(100,i/this.totalDuration*100)),r=n<60;if(r!==this.isUnderOneMinute){this.isUnderOneMinute=r;const t=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==t||t.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==t||t.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}const s=this.rootElement.querySelector("[data-timer]");s&&(s.textContent=this.formatTime(e));const a=this.rootElement.querySelector("[data-progress-fill]");a&&(a.style.width=o+"%"),0===e&&this.handleExpire()}formatTime(t){const e=Math.floor(t/1e3),n=Math.floor(e/60),i=e%60,o=Math.floor(t%1e3/10);return n.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")}handleExpire(){this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer()}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const e=document.createElement("div");e.classList.add("checkout-presale-text-container");const n=document.createElement("div");n.classList.add("checkout-presale-heading");const i=document.createElement("h2");i.textContent="LIMITED PRE-ORDER:";const o=document.createElement("div");o.classList.add("checkout-presale-timer"),o.setAttribute("data-timer",""),o.textContent="00:00:00",n.appendChild(i),n.appendChild(o);const r=document.createElement("p");r.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",r.classList.add("checkout-presale-subtitle"),e.appendChild(n),e.appendChild(r);const s=document.createElement("div");s.className="checkout-presale-progress-bar",s.setAttribute("data-progress","");const a=document.createElement("div");return a.className="checkout-presale-progress-fill",a.setAttribute("data-progress-fill",""),a.style.width="0%",s.appendChild(a),t.appendChild(e),t.appendChild(s),t}}const st=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],at={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(t,e){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(e)?e:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(e)?e:null:"class"===t?e.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():e.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const e=t.textContent||"",n=e.replace(/<[^>]*>/g,"");if(n.trim()){const t=document.createTextNode(n);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const e=t,n=e.tagName.toLowerCase();if(st.includes(n)){const t=document.createElement(n),i=at[n]||[];for(const n of Array.from(e.attributes)){const e=n.name.toLowerCase();if(i.includes(e)){const i=sanitizeAttributeValue(e,n.value);null!==i&&t.setAttribute(e,i)}}"a"===n&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const n of Array.from(e.childNodes)){const e=cleanNode(n);e&&t.appendChild(e)}return t}const i=document.createDocumentFragment();for(const t of Array.from(e.childNodes)){const e=cleanNode(t);e&&i.appendChild(e)}return i.childNodes.length>0?i:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const e=new DOMParser,n=e.parseFromString(t,"text/html"),i=n.querySelector("parsererror");if(i)return console.warn("HTML parsing error detected"),"";const o=document.createDocumentFragment();for(const t of Array.from(n.body.childNodes)){const e=cleanNode(t);e&&o.appendChild(e)}const r=document.createElement("div");return r.appendChild(o),r.innerHTML}catch(e){return console.error("HTML sanitization error:",e),""}}class CheckoutSummarySectionComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const e=t.find(t=>"checkout.amounts"===t.path);if(e){const t=this.getStoreValue("checkout"),e=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&e>0)}}updateZeroAmountElement(t){const e=this.container.querySelector(".checkout-zero-amount-container");if(t&&!e){const t=document.createElement("div");t.classList.add("checkout-zero-amount-container"),t.textContent="Credit card required to complete order (even when fully covered by gift card)";const e=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");e&&e.after(t)}else!t&&e&&e.remove()}afterRender(){const t=this.getStoreValue("checkout.amounts");t&&this.updateZeroAmountElement(0===t.total)}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,e=this.config.layout.smsOptIn;if(!t.show&&!e.show)return null;const n=document.createElement("div");if(n.classList.add("checkout-marketing-opt-ins-container"),t.show){const e=document.createElement("div");let i;e.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const o=document.createElement("span");o.id="emailOptIn",o.classList.add("checkout-checkbox-visual"),i&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),o.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canEmail"),o.classList.toggle("checked")});const r=document.createElement("label");r.setAttribute("for","emailOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(t.text),r.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canEmail"),o.classList.toggle("checked"))}),e.appendChild(o),e.appendChild(r),n.appendChild(e)}if(e.show){const t=document.createElement("div");let i;t.classList.add("checkout-checkbox-container"),i=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canSms");const o=document.createElement("span");o.classList.add("checkout-checkbox-visual"),o.id="smsOptIn",i&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),o.addEventListener("click",()=>{this.commands.checkout.toggleMarketingPreferences("canSms"),o.classList.toggle("checked")});const r=document.createElement("label");r.setAttribute("for","smsOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(e.text),r.addEventListener("click",t=>{const e=t.target,n="A"===e.tagName||e.closest("a");n||(this.commands.checkout.toggleMarketingPreferences("canSms"),o.classList.toggle("checked"))}),t.appendChild(o),t.appendChild(r),n.appendChild(t)}return n}hasOnDemandOrder(){const t=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}template(){var t;const e=[],n=this.getConfigs("global"),o=this.getConfigs("checkout"),r=this.getConfigs("global"),s=o.layout.allowGiftCards,a=null===(t=null==r?void 0:r.layout)||void 0===t?void 0:t.allowPromoCodes,c=document.createElement("div");c.classList.add("section-title-container");const l=document.createElement("h3");l.textContent="Order Summary",l.classList.add("section-title"),c.appendChild(l),e.push(c);const d=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEMS});e.push(d);const h=document.createElement("div");h.classList.add("checkout-separator");const u=document.createElement("div");if(u.classList.add("checkout-separator"),e.push(h),s||a){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_PC_GC});e.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_TIPS});e.push(t),e.push(u)}const p=document.createElement("div");p.classList.add("section-title-container");const m=document.createElement("h3");m.textContent="100% Secure Payments",m.classList.add("disclaimer-header"),p.appendChild(m);const f=document.createElement("p");f.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.",f.classList.add("disclaimer-description"),p.appendChild(f),e.push(p);const g=ComponentFactoryService.createElement({type:i.CHECKOUT_AMOUNTS});e.push(g);const v=ComponentFactoryService.createElement({type:i.CHECKOUT_PLACE_ORDER_BUTTON});e.push(v);const y=this.marketingOptInsContainer();if(y&&e.push(y),o.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(o.layout.legalMessage.text);const i=document.createElement("div");i.classList.add("checkout-separator"),e.push(t),e.push(n),e.push(i)}if(n.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});e.push(t)}return e}}class CheckoutBillingFormComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.billingSameAsShipping"]})}async handleFirstNameChange(t){this.commands.checkout.updateBillingInfo(Y.firstName,t),this.pubSub.publishForm(n.BILLING,{fieldName:Y.firstName,fieldValue:t})}async handleLastNameChange(t){this.commands.checkout.updateBillingInfo(Y.lastName,t),this.pubSub.publishForm(n.BILLING,{fieldName:Y.lastName,fieldValue:t})}async handleEmailChange(t){this.commands.checkout.updateBillingInfo(Y.email,t),this.pubSub.publishForm(n.BILLING,{fieldName:Y.email,fieldValue:t})}async handlePhoneChange(t){this.commands.checkout.updateBillingInfo(Y.phone,t),this.pubSub.publishForm(n.BILLING,{fieldName:Y.phone,fieldValue:t})}async handleCompanyChange(t){this.commands.checkout.updateBillingInfo(Y.company,t),this.pubSub.publishForm(n.BILLING,{fieldName:Y.company,fieldValue:t})}async handleAddressOneChange(t){this.commands.checkout.updateBillingInfo(Y.addressOne,t),this.pubSub.publishForm(n.BILLING,{fieldName:Y.addressOne,fieldValue:t})}async handleAddressTwoChange(t){this.commands.checkout.updateBillingInfo(Y.addressTwo,t),this.pubSub.publishForm(n.BILLING,{fieldName:Y.addressTwo,fieldValue:t})}async handleCityChange(t){this.commands.checkout.updateBillingInfo(Y.city,t),this.pubSub.publishForm(n.BILLING,{fieldName:Y.city,fieldValue:t})}async handleStateChange(t){this.commands.checkout.updateBillingInfo(Y.state,t),this.pubSub.publishForm(n.BILLING,{fieldName:Y.state,fieldValue:t})}async handleZipCodeChange(t){this.commands.checkout.updateBillingInfo(Y.zipCode,t),this.pubSub.publishForm(n.BILLING,{fieldName:Y.zipCode,fieldValue:t})}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.billingSameAsShipping"),e=document.createElement("div");e.classList.add("checkout-billing-same-as-shipping-toggle-container");const n=document.createElement("div");n.classList.add("checkout-checkbox-container");const i=document.createElement("span");i.id="billingSameAsShipping",i.classList.add("checkout-checkbox-visual"),t&&i.classList.add("checked"),i.innerHTML=CheckboxIcon({width:16,height:16}),e.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()});const o=document.createElement("label");return o.textContent="Billing address same as shipping address",o.setAttribute("for","billingSameAsShipping"),o.classList.add("billing-checkbox-label"),n.appendChild(i),n.appendChild(o),e.appendChild(n),e}template(){const t=this.getStoreValue("checkout.billingSameAsShipping"),e=[],n=this.billingSameAsShippingToggle();if(e.push(n),t)return e;const o=document.createElement("div");o.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Your billing info",r.classList.add("section-title"),o.appendChild(r);const s=document.createElement("p");s.textContent="Provide the info relevant to your payment method",s.classList.add("section-subtitle"),o.appendChild(s),e.push(o);const a=document.createElement("div");a.classList.add("section-form-container");const c=document.createElement("div");c.classList.add("checkout-two-col-container");const l=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Y.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleFirstNameChange.bind(this),storePath:"billing.firstName"});c.appendChild(l);const d=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Y.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:this.handleLastNameChange.bind(this),storePath:"billing.lastName"});c.appendChild(d),a.appendChild(c);const h=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:Y.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:this.handleEmailChange.bind(this),storePath:"billing.email"});a.appendChild(h);const u=document.createElement("div");u.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:Y.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:this.handlePhoneChange.bind(this),storePath:"billing.phone"});u.appendChild(p);const m=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Y.company,label:"Company (optional)",autocomplete:!![],onChange:this.handleCompanyChange.bind(this)});u.appendChild(m),a.appendChild(u);const f=document.createElement("div");f.classList.add("checkout-two-col-container");const g=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Y.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:this.handleAddressOneChange.bind(this),storePath:"billing.addressOne"});f.appendChild(g);const v=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Y.addressTwo,label:"Apartment, suite, etc. (optional)",onChange:this.handleAddressTwoChange.bind(this)});f.appendChild(v),a.appendChild(f);const y=document.createElement("div");y.classList.add("checkout-three-col-container");const x=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Y.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:this.handleCityChange.bind(this),storePath:"billing.city"});y.appendChild(x);const C=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Y.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:t=>t&&2===t.length&&/^[A-Z]{2}$/.test(t)?null:"State must be 2 uppercase characters"},onChange:this.handleStateChange.bind(this),storePath:"billing.state"});y.appendChild(C);const k=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Y.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:this.handleZipCodeChange.bind(this),storePath:"billing.zipCode"});return y.appendChild(k),a.appendChild(y),e.push(a),e}}class CheckoutBuyerInformationComponent extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}async handleFirstNameChange(t){this.commands.checkout.updateCustomerInfo(V.firstName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.firstName,fieldValue:t})}async handleLastNameChange(t){this.commands.checkout.updateCustomerInfo(V.lastName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.lastName,fieldValue:t})}async handleEmailChange(t){this.commands.checkout.updateCustomerInfo(V.email,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.email,fieldValue:t})}async handlePhoneChange(t){this.commands.checkout.updateCustomerInfo(V.phone,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.phone,fieldValue:t})}async handleCompanyChange(t){this.commands.checkout.updateCustomerInfo(V.company,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.company,fieldValue:t})}async handleDobChange(t){this.commands.checkout.updateCustomerInfo(V.birthDate,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.birthDate,fieldValue:t})}template(){const t=this.store.get("checkout.customer"),e=[],n=document.createElement("div");n.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Buyer Information",o.classList.add("section-title"),n.appendChild(o);const r=document.createElement("p");r.textContent="Buyer information is used to process your order and for delivery purposes.",r.classList.add("section-subtitle"),n.appendChild(r),e.push(n);const s=document.createElement("div");s.classList.add("section-form-container");const a=document.createElement("div");a.classList.add("checkout-two-col-container");const c=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:"customer.firstName"});a.appendChild(c);const l=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:this.handleLastNameChange.bind(this),storePath:"customer.lastName"});a.appendChild(l),s.appendChild(a);const d=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:V.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:this.handleCompanyChange.bind(this)});s.appendChild(d);const h=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:V.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:this.handleEmailChange.bind(this),storePath:"customer.email"});s.appendChild(h);const u=document.createElement("div");u.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:V.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:this.handlePhoneChange.bind(this),storePath:"customer.phone"});u.appendChild(p);const m=ComponentFactoryService.createElement({type:i.BIRTHDATE_INPUT,inputType:"date",name:V.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:this.handleDobChange.bind(this),storePath:"customer.birthDate"});return u.appendChild(m),s.appendChild(u),e.push(s),e}}class CheckoutDeliveryInformationComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.isGift","address.formattedAddress","checkout.onDemandFulfillmentTipInfo"]})}get hostClasses(){return["checkout-delivery-information"]}hasOnDemandFulfillments(){const t=this.store.get("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}async handleDeliveryInstructionsChange(t){await this.commands.checkout.updateDeliveryInstructions(t)}async handleFirstNameChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(H.firstName,t),this.pubSub.publishForm(n.GIFT,{fieldName:H.firstName,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(V.firstName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.firstName,fieldValue:t}))}async handleLastNameChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(H.lastName,t),this.pubSub.publishForm(n.GIFT,{fieldName:H.lastName,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(V.lastName,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.lastName,fieldValue:t}))}async handleEmailChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(H.email,t),this.pubSub.publishForm(n.GIFT,{fieldName:H.email,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(V.email,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.email,fieldValue:t}))}async handlePhoneChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(H.phone,t),this.pubSub.publishForm(n.GIFT,{fieldName:H.phone,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(V.phone,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.phone,fieldValue:t}))}async handleAddressTwoChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(H.addressTwo,t),this.pubSub.publishForm(n.GIFT,{fieldName:H.addressTwo,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(V.addressTwo,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.addressTwo,fieldValue:t}))}async handleCompanyChange(t){const e=this.getStoreValue("checkout.isGift")||![];e?(this.commands.checkout.updateGiftInfo(H.company,t),this.pubSub.publishForm(n.GIFT,{fieldName:H.company,fieldValue:t})):(this.commands.checkout.updateCustomerInfo(V.company,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.company,fieldValue:t}))}async handleBirthdateChange(t){this.commands.checkout.updateCustomerInfo(V.birthDate,t),this.pubSub.publishForm(n.CUSTOMER,{fieldName:V.birthDate,fieldValue:t})}async handleGiftMessageChange(t){this.commands.checkout.updateGiftInfo(H.message,t),this.pubSub.publishForm(n.GIFT,{fieldName:H.message,fieldValue:t})}template(){const t=this.getConfigs("global"),e=this.getStoreValue("checkout.isGift")||![],n=this.store.get("checkout.giftRecipient"),o=this.store.get("checkout.customer"),r=this.store.get("address.formattedAddress"),s=e?n:o,a=[],c=document.createElement("div");c.classList.add("delivery-header-container");const l=document.createElement("div");l.classList.add("delivery-header-content");const d=document.createElement("div");d.classList.add("delivery-title-container");const h=document.createElement("h3");h.textContent="Deliver to",h.classList.add("delivery-title");const u=document.createElement("p");u.textContent="Package recipient must be 21+",u.classList.add("delivery-subtitle"),d.appendChild(h),d.appendChild(u);const p=document.createElement("div");p.classList.add("gift-toggle-container");const m=document.createElement("div");m.classList.add("gift-label-wrapper");const f=document.createElement("span");f.textContent="Send as Gift? (Free)",f.classList.add("gift-toggle-label"),m.appendChild(f);const g=document.createElement("span");g.textContent="With personalized note & gift receipt.",g.classList.add("gift-toggle-description"),m.appendChild(g);const v=document.createElement("div");v.classList.add("toggle-switch"),v.classList.toggle("active",e);const y=document.createElement("div");y.classList.add("toggle-slider"),v.appendChild(y),p.appendChild(m),p.appendChild(v),v.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),c.appendChild(p),c.appendChild(d),a.push(c);const x=document.createElement("div");x.classList.add("section-form-container");const C=document.createElement("div");C.classList.add("checkout-two-col-container");const k=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?H.firstName:V.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:s.firstName,onChange:this.handleFirstNameChange.bind(this),storePath:e?"giftRecipient.firstName":"customer.firstName"});C.appendChild(k);const S=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?H.lastName:V.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:s.lastName,onChange:this.handleLastNameChange.bind(this),storePath:e?"giftRecipient.lastName":"customer.lastName"});C.appendChild(S),x.appendChild(C);const E=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?H.company:V.company,label:"Company (optional)",autocomplete:!![],value:s.company,onChange:this.handleCompanyChange.bind(this),storePath:e?"giftRecipient.company":"customer.company"});x.appendChild(E);const I=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:e?H.email:V.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:s.email,onChange:this.handleEmailChange.bind(this),storePath:e?"giftRecipient.email":"customer.email"});x.appendChild(I);const T=document.createElement("div");T.classList.add("checkout-two-col-container");const P=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:e?H.phone:V.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:s.phone,onChange:this.handlePhoneChange.bind(this),storePath:e?"giftRecipient.phone":"customer.phone"});if(!e){const t=ComponentFactoryService.createElement({type:i.BIRTHDATE_INPUT,inputType:"date",name:V.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:formatISODateToMMDDYYYY(s.birthDate),onChange:this.handleBirthdateChange.bind(this),storePath:"customer.birthDate"});T.appendChild(P),T.appendChild(t),x.appendChild(T)}e&&(T.remove(),x.appendChild(P));const F=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:r,disabled:!![],className:"disabled-input",validation:{required:!![]}});x.appendChild(F);const A=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?H.addressTwo:V.addressTwo,label:"Apt, suite, etc. (optional)",value:s.addressTwo,onChange:this.handleAddressTwoChange.bind(this),storePath:e?"giftRecipient.addressTwo":"customer.addressTwo"});if(x.appendChild(A),this.hasOnDemandFulfillments()){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const n=document.createElement("label");n.textContent="Delivery Instructions",n.setAttribute("for","delivery_instructions");const i=document.createElement("textarea");i.id="delivery_instructions",i.name="delivery_instructions",i.rows=4,i.value=this.store.get("checkout.deliveryInstructions")||"",i.addEventListener("blur",async t=>{await this.handleDeliveryInstructionsChange(t.target.value)});const o=document.createElement("p");o.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",o.classList.add("textarea-message-disclaimer"),e.appendChild(n),e.appendChild(i),e.appendChild(o),x.appendChild(e)}if(e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Gift Message*",i.setAttribute("for",H.message);const o=document.createElement("textarea");o.name=H.message,o.id=H.message,o.rows=4,o.value=n.message||"",o.addEventListener("input",async t=>{await this.handleGiftMessageChange(t.target.value)});const r=document.createElement("p");r.textContent="Your gift message will be emailed to the recipient along with delivery details.",r.classList.add("textarea-message-disclaimer"),e.appendChild(i),e.appendChild(o),e.appendChild(r),x.appendChild(e)}return a.push(x),a}}class CheckoutPaymentFormComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchStorePaths:["checkout.payment.sendSubmitSignal"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![]}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,e=null;for(;t&&t!==document.body;){const n=t.hasAttribute("checkout"),o=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT),r=t.hasAttribute("drawer"),s=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(i.DRAWER),a="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||o&&r&&s&&a)return this.rootComponent=t,t;e=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){await this.commands.checkout.getPaymentSession();const t=this.store.get("checkout.payment"),e=this.getConfigs("global");return{publishableKey:t.key,clientSecret:t.secret,appearance:{theme:"stripe",variables:{fontFamily:e.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:e.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===e.layout.inputFieldStyle?"none":"1px solid "+e.theme.accentColor,backgroundColor:"filled"===e.layout.inputFieldStyle?e.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t;if(this.isCreatingStripeForm)return this.logger.debug("Stripe form creation already in progress, skipping"),void 0;const e=this.findRootComponent();if(!e)return;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.debug("Stripe form already exists and is connected, skipping creation"),void 0;const n=e.querySelectorAll('[slot="'+U+'"]');if(n.length>0)for(const i of n)i.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:i.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.stripeFormElement.setAttribute("slot",U),e.appendChild(this.stripeFormElement),this.setupStripeFormEventListeners()}catch(o){this.logger.error("Stripe form element creation failed",{error:o instanceof Error?o.message:String(o)}),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}async afterRender(){this.removeExistingStripeForm(),await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",async t=>{await this.commands.checkout.updateStripeFormStatus(t.detail.status)}),this.stripeFormElement.addEventListener("lce:s:confirmPaymentSession",async t=>{try{const{confirmationTokenId:e,setupIntentId:n}=t.detail;await this.commands.checkout.confirmPaymentSession(e,n)}catch(e){this.logger.error("Failed to confirm payment session",{error:e instanceof Error?e.message:String(e)}),this.store.set("checkout.payment.sendSubmitSignal",![])}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const e=await this.doStripeConfig(),n=new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:e}});null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(n)}catch(e){this.logger.error("Failed to refresh payment session",{error:e instanceof Error?e.message:String(e)})}})}onStoreChanged(t){const e=t.some(t=>"checkout.payment.sendSubmitSignal"===t.path&&t.value===!![]);if(e&&this.stripeFormElement){const t=new CustomEvent("lce:s:submit");this.stripeFormElement.dispatchEvent(t)}return![]}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],null===(t=super.disconnected)||void 0===t||t.call(this)}template(){const t=[],e=document.createElement("div");e.classList.add("section-title-container");const n=document.createElement("h3");n.textContent="Payment",n.classList.add("section-title"),e.appendChild(n);const i=document.createElement("p");i.textContent="All transactions are secure and encrypted.",i.classList.add("section-subtitle"),e.appendChild(i),t.push(e);const o=document.createElement("slot");return o.setAttribute("name",U),t.push(o),t}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.O=![],this.N=null,this.M=null,this.R=null,this.B=![],this.L=![],this.j=![]}async initialize({data:t}){if(this.O)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.O=!![],await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.N=window.Stripe(t.publishableKey),this.M=this.N.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.R=this.M.create("payment",t.elementOptions),this.R.mount(this),this.R.on("change",async t=>{const e=!!t.error,n=t.complete,i=e?t.error.message:null;this.L=n,await this.updateStripeFormStatus({isComplete:n,hasError:e,errorMessage:i,isProcessing:this.B})}),this.R.on("focus",async()=>{await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:this.B})}),this.j=![]}catch(t){throw await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",this.handleSubmitEvent.bind(this)),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this))}async handleSubmitEvent(){await this.handleSubmit()}async handleRefreshSession(t){const{stripeConfig:e}=t.detail;e&&(this.q=e,await this.refreshPaymentSession())}async handleSubmit(){if(!this.B){this.B=!![],await this.updateStripeFormStatus({isComplete:this.L,hasError:![],errorMessage:null,isProcessing:!![]});try{if(!this.L)throw new Error("Please complete all required payment fields");this.j&&await this.requestSessionRefresh();const t=await this.createConfirmationTokenId(),e=this.q.clientSecret,n=e.split("_secret_")[0],i=new CustomEvent("lce:s:confirmPaymentSession",{detail:{confirmationTokenId:t,setupIntentId:n}});this.dispatchEvent(i),this.j=!![],await this.updateStripeFormStatus({isComplete:!![],isProcessing:![],hasError:![],errorMessage:null})}catch(t){this.j||(this.j=!![]),await this.updateStripeFormStatus({isComplete:this.L,isProcessing:![],hasError:!![],errorMessage:(null==t?void 0:t.message)||"An unexpected error with payment occurred"})}finally{this.B=![]}}}async requestSessionRefresh(){const t=new CustomEvent("lce:s:requestSessionRefresh");return this.dispatchEvent(t),new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",b),e(new Error("Session refresh timeout"))},5e3),b=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",b),t()};this.addEventListener("lce:s:refreshSession",b,{once:!![]})})}async refreshPaymentSession(){try{this.M&&this.M.update({clientSecret:this.q.clientSecret}),this.j=![]}catch(_){await this.updateStripeFormStatus({isComplete:![],hasError:!![],isProcessing:![],errorMessage:"Failed to refresh payment session"})}}async updateStripeFormStatus(t){const e=new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t}});this.dispatchEvent(e)}async createConfirmationTokenId(){if(!this.M)throw new Error("Elements must be provided");try{const{error:t}=await this.M.submit();if(t)throw new Error(t.message);const e={elements:this.M,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:n,confirmationToken:i}=await this.N.createConfirmationToken(e);if(n)throw new Error(n.message);if(!i||!i.id)throw new Error("Confirmation token not found");return i.id}catch(t){throw new Error(t.message)}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,e;try{this.R&&(this.R.unmount(),this.R=null),this.M&&(null===(e=(t=this.M).destroy)||void 0===e?void 0:e.call(t),this.M=null),this.N=null,this.B=![],this.L=![],this.j=![],this.O=![],this.isConnected&&await this.updateStripeFormStatus({isComplete:![],hasError:![],isProcessing:![],errorMessage:null})}catch(n){console.warn("Error during Stripe form cleanup:",n)}}loadStripeJS(){return new Promise((t,e)=>{const n=document.createElement("script");n.src="https://js.stripe.com/basil/stripe.js",n.onload=()=>t(),n.onerror=()=>e(new Error("Failed to load Stripe.js")),document.head.appendChild(n)})}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,e,n;const i=this.getStoreValue("checkout"),o=Boolean(i.promoCode),r=Boolean(null===(t=i.giftCards)||void 0===t?void 0:t.length),s=this.getConfigs("global"),a=Object.values(i.items||{}),c=[],l=document.createElement("div");l.classList.add("checkout-amount-line");const d=document.createElement("span");d.textContent="Subtotal ("+a.length+" item"+(a.length>1?"s":"")+")",l.appendChild(d);const h=document.createElement("span");h.textContent=formatCentToDollarText(i.amounts.subtotal),l.appendChild(h),c.push(l);const u=document.createElement("div");u.classList.add("checkout-amount-line");const p=document.createElement("span");p.textContent="Shipping",u.appendChild(p);const m=document.createElement("span");m.textContent=formatCentToDollarText(i.amounts.shipping),u.appendChild(m),c.push(u);const f=document.createElement("div");f.classList.add("checkout-amount-line");const g=document.createElement("span");g.textContent="Delivery",f.appendChild(g);const v=document.createElement("span");if(v.textContent=formatCentToDollarText(i.amounts.delivery),f.appendChild(v),c.push(f),(null===(e=null==i?void 0:i.amounts)||void 0===e?void 0:e.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Engraving",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.engraving),t.appendChild(n),c.push(t)}const y=document.createElement("div");y.classList.add("checkout-amount-line");const x=document.createElement("span");x.textContent="Taxes & Fees",y.appendChild(x);const C=document.createElement("span");if(C.textContent=formatCentToDollarText(i.amounts.tax+i.amounts.service+i.amounts.platform),y.appendChild(C),c.push(y),o){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Promo Code ("+(null===(n=i.promoCode)||void 0===n?void 0:n.code)+")",t.appendChild(e);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(i.amounts.discounts),t.appendChild(o),c.push(t)}if(r){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Gift Cards Applied",t.appendChild(e);const n=document.createElement("span");n.textContent="-"+formatCentToDollarText(i.amounts.giftCards),t.appendChild(n),c.push(t)}const k=document.createElement("div");k.classList.add("checkout-amount-line");const S=document.createElement("span");S.textContent="Tips",k.appendChild(S);const E=document.createElement("span");E.textContent=formatCentToDollarText(i.amounts.tip),k.appendChild(E),c.push(k);const I=document.createElement("div");I.classList.add("checkout-separator"),k.appendChild(I),c.push(I);const T=document.createElement("div");T.classList.add("checkout-amount-total");const P=document.createElement("span");P.textContent="Total",T.appendChild(P);const F=document.createElement("span");F.textContent=formatCentToDollarText(i.amounts.total),T.appendChild(F),c.push(T);const A=this.store.get("checkout.isPresaleLocked");if(A){const t=document.createElement("div");t.classList.add("checkout-amount-due");const e=document.createElement("span");e.textContent="Amount due today",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(0),t.appendChild(n),c.push(t);const i=document.createElement("div");i.classList.add("checkout-presale-locked-message");const o=htmlStringToElement(InfoIcon({color:s.theme.defaultTextColor}));i.appendChild(o);const r=document.createElement("p");r.textContent="Pre-ordered items will be charged when shipped.",i.appendChild(r),c.push(i)}return c}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){const t=[],e=this.getConfigs("configurations"),n=this.getConfigs("global"),o=this.getConfigs("checkout"),r=this.config.layout.exitUrl||window.location.host,s=this.config.layout.thankYouButtonText||"Continue Shopping";if(this.config.theme.checkoutCompleted.customLogo){const n=document.createElement("div");n.classList.add("checkout-completed-header-container");const i=document.createElement("img");i.src=this.config.theme.checkoutCompleted.customLogo,i.alt=e.partnerName+" Logo",n.appendChild(i),t.push(n)}const a=document.createElement("div");a.classList.add("checkout-completed-section-container");const c=document.createElement("div");c.classList.add("checkout-completed-title-container");const l=document.createElement("div");l.innerHTML=CompletedIcon({width:32,height:32,className:"checkout-completed-logo"}),c.appendChild(l);const d=document.createElement("div");d.classList.add("checkout-completed-title-section");const h=document.createElement("h3");h.innerHTML=this.config.theme.checkoutCompleted.customText||"Thank You for Your Order!",d.appendChild(h);const u=document.createElement("p");u.textContent="Your payment has been successfully processed.",d.appendChild(u),c.appendChild(d),a.appendChild(c);const p=document.createElement("div");p.classList.add("checkout-completed-sub-section");const m=document.createElement("div");m.classList.add("checkout-completed-line");const f=document.createElement("h3");f.textContent="Order Number",m.appendChild(f);const g=document.createElement("span");g.textContent=this.params.orderNumber,m.appendChild(g),p.appendChild(m);const v=document.createElement("div");v.classList.add("checkout-completed-line");const y=document.createElement("h3");y.textContent="Order Amount",v.appendChild(y);const x=document.createElement("span");x.textContent=""+formatCentToDollarText(this.params.orderTotal),v.appendChild(x),p.appendChild(v);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),p.appendChild(C),a.appendChild(p);const E=document.createElement("div");E.classList.add("checkout-completed-sub-section");const I=document.createElement("h3");I.textContent="Confirmation email sent",E.appendChild(I);const T=document.createElement("p");T.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<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(T),a.appendChild(E),t.push(a);const P=document.createElement("div");P.classList.add("checkout-completed-section-container");const F=document.createElement("button");F.type="button";const A=document.createElement("span");A.textContent=s,F.appendChild(A);const _=htmlStringToElement(ArrowRightIcon({width:16,height:16}));F.appendChild(_),F.addEventListener("click",()=>{window.location.href=r}),P.appendChild(F),t.push(P);const O=document.createElement("div");O.classList.add("checkout-completed-section-container");const N=document.createElement("div");N.classList.add("checkout-completed-help-section"),O.appendChild(N);const z=document.createElement("p");z.textContent="Questions about your order? Contact us at "+e.supportEmail,N.appendChild(z);const M=document.createElement("p"),B=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(M.textContent="Order placed on "+B,N.appendChild(M),t.push(O),o.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(o.layout.legalMessage.text);const i=document.createElement("div");i.classList.add("checkout-separator"),t.push(e),t.push(n),t.push(i)}if(n.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});t.push(e)}return t}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(t){var e;const n=t.find(t=>"checkout.giftCards"===t.path),i=t.find(t=>"checkout.loading"===t.path);n&&n.value.length>((null===(e=n.oldValue)||void 0===e?void 0:e.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),i&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),e=t.length>=3&&t.length<=20,n=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!e||n||Boolean(i)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:20},onChange:()=>{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 t=this.giftCardInput.getValue().trim();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(e){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const t=[];return t.push(this.createGiftCardInput()),t.push(this.createApplyButton()),t}disconnected(){this.giftCardInput=null,this.applyButton=null}}const shouldShowMinimumPurchaseAlert=(t,e=![])=>{var n,i;const r=t.subtotal;if(t.type===o.SHIPPING){const o=t.fees;if(e&&(null===(n=o.pack)||void 0===n?void 0:n.active)&&o.pack.min>0&&r<o.pack.min)return!![];if(!e&&(null===(i=o.individual)||void 0===i?void 0:i.active)&&o.individual.min>0&&r<o.individual.min)return!![]}else if(t.type===o.ON_DEMAND){const e=t.fees;if(e.min>0&&r<e.min)return!![]}return![]},getMinimumPurchaseMessage=(t,e=![])=>{var n,i,r,s;const a=t.subtotal;if(t.type===o.SHIPPING){const o=t.fees;let s=0;if(e&&(null===(n=o.pack)||void 0===n?void 0:n.active)&&o.pack.min>0?s=o.pack.min:(null===(i=o.individual)||void 0===i?void 0:i.active)&&o.individual.min>0&&(s=o.individual.min),s>0&&a<s)return{message:formatCentToDollarText(s-a)+" more needed - "+(null===(r=null==t?void 0:t.expectation)||void 0===r?void 0:r.detail),type:"warning"}}if(t.type===o.ON_DEMAND){const e=t.fees,n=e.min>0?e.min:0;if(n>0&&a<n)return{message:formatCentToDollarText(n-a)+" more needed - "+(null===(s=null==t?void 0:t.expectation)||void 0===s?void 0:s.detail),type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(t,e=![])=>{var n,i;const r=t.subtotal;if(t.type===o.SHIPPING){const o=t.fees;if(e&&(null===(n=o.pack)||void 0===n?void 0:n.active)&&o.pack.min>0&&r<o.pack.min)return!![];if(!e&&(null===(i=o.individual)||void 0===i?void 0:i.active)&&o.individual.min>0&&r<o.individual.min)return!![]}if(t.type===o.ON_DEMAND){const e=t.fees;if(e.min>0&&r<e.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const e={warning:"warning",success:"success",info:"info"},n={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},i=e[this.params.messageType]||"warning",o=document.createElement("div");return o.className="alert-icon alert-icon-"+this.params.messageType,o.appendChild(htmlStringToElement(n[i]({width:16,height:16,className:"alert-icon-svg"}))),o}template(){var t;const e=[],n=this.getIconElement();n&&e.push(n);const i=document.createElement("span");if(i.className="alert-message",i.textContent=this.params.message,e.push(i),"detailed"===(null===(t=this.config)||void 0===t?void 0:t.alertType)&&this.params.currentTotal){const t=document.createElement("div");t.className="alert-details";const n=document.createElement("small");n.className="alert-details-text",n.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(n),e.push(t)}return e}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchOnlyStorePaths:["checkout.items"]}),this.trashButton=null}onStoreWatch(t){const e=t.find(t=>"checkout.items"===t.path);e&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState())}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const e=t.fulfillmentId;if(!e)return;if(!this.container)return;const n=this.container.querySelector(".checkout-item-card-header");if(n){const o=this.getStoreValue("cart.fulfillments."+e),r=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(r&&r.remove(),shouldShowMinimumPurchaseAlert(o,t.pack)){const e=getMinimumPurchaseMessage(o,t.pack),r=ComponentFactoryService.createElement({type:i.PURCHASE_MIN_ALERT,message:e.message,messageType:e.type,currentTotal:o.subtotal,config:{showIcon:!![],alertType:"minimal"}});r.setAttribute("data-component-type","checkout-retailer-alert"),n.before(r)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),e=Object.keys(t.items).length,n=1===e;this.trashButton.disabled=n,n?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","item-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="item-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const t=this.getStoreValue("checkout.items."+this.params.itemId);return t?t.updating===!![]:![]}checkAndUpdateLoadingState(){const t=this.isItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t;const e=this.getConfigs("global"),n=this.getStoreValue("checkout.items."+this.params.itemId),o=null===(t=null==n?void 0:n.attributes)||void 0===t?void 0:t.presale,r=(null==o?void 0:o.isActive)&&(null==o?void 0:o.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(o.estimatedShipBy):"";if(!n)return[];const s=document.createElement("div");s.classList.add("checkout-item-card-header");const a=document.createElement("img");a.classList.add("checkout-item-image"),a.src=n.mainImage,a.alt=n.name,a.loading="lazy",s.appendChild(a);const c=document.createElement("div");c.classList.add("checkout-item-details-container");const l=document.createElement("h4");l.classList.add("checkout-item-title"),l.textContent=n.name,c.appendChild(l);const d=document.createElement("div");d.classList.add("checkout-item-subtitle");const h=document.createElement("span");h.textContent=o.isActive?""+r:((null==n?void 0:n.expectationDetail)||"")+",",d.appendChild(h);const u=document.createElement("span");u.textContent="From "+((null==n?void 0:n.retailerName)||""),d.appendChild(u),c.appendChild(d),s.appendChild(c),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var e;if(t.preventDefault(),t.stopPropagation(),!(null===(e=this.trashButton)||void 0===e?void 0:e.disabled))try{await this.commands.checkout.removeItem(n.cartItemId)}catch(i){this.logger.error("Checkout item removal failed",{itemId:n.cartItemId,error:i instanceof Error?i.message:String(i)})}}),s.appendChild(this.trashButton);const p=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM_QUANTITY,itemId:n.cartItemId}),m=[];if(m.push(s),e.layout.enablePersonalization){const t=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:n.cartItemId,context:"checkout",watchStorePaths:["checkout.items.{identifier}"]});m.push(t)}return m.push(p),m}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(t){const e=t.find(t=>"checkout.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getCheckoutItemStore(){const t=this.params.itemId,e=this.getStoreValue("checkout.items."+t);return e||null}getAvailableQuantity(){var t,e,n;const i=this.getCheckoutItemStore();if(!i)return 0;const o=this.getStoreValue("products");if(!o)return 0;const r=i.partNumber,s=i.fulfillmentId,a=null===(n=null===(e=null===(t=Object.values(o).find(t=>t.sizes[i.liquidId]))||void 0===t?void 0:t.sizes)||void 0===e?void 0:e[i.liquidId])||void 0===n?void 0:n.attributes.maxQuantityPerOrder;if(!a)return 0;const c=this.getStoreValue("checkout.items")||{},l=Object.values(c).filter(t=>t.partNumber===r&&t.fulfillmentId===s),d=l.reduce((t,e)=>t+e.quantity,0);return a-d}calculateQuantityLimits(){var t;const e=this.getCheckoutItemStore();if(!e)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const n=this.getStoreValue("checkout"),i=1===(null===(t=Object.values(n.items))||void 0===t?void 0:t.length),o=e.quantity,r=this.getAvailableQuantity(),s=r>0,a=!(i&&1===o);return{currentQuantity:o,availableQuantity:r,isTheOnlyItem:i,canIncrease:s,canDecrease:a}}updateButtonStates(t){this.decreaseButton&&(this.decreaseButton.disabled=!t.canDecrease,this.decreaseButton.classList.toggle("disabled",!t.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!t.canIncrease,this.increaseButton.classList.toggle("disabled",!t.canIncrease),t.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const e=this.calculateQuantityLimits(),n=this.params.itemId;if((!(t<0)||e.canDecrease)&&(!(t>0)||e.canIncrease)){if(!n)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:t}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(n,t)}catch(i){this.logger.error("Checkout item quantity change operation failed",{itemId:n,delta:t,error:i instanceof Error?i.message:String(i)})}}}createQuantityContainer(){const t=this.calculateQuantityLimits(),e=document.createElement("div");return e.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),e.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),e.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),e.appendChild(this.increaseButton),this.updateButtonStates(t),e}template(){const t=this.getCheckoutItemStore();if(!t)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const e=this.createQuantityContainer(),n=document.createElement("span");return n.classList.add("checkout-item-price-text"),n.textContent=formatCentToDollarText(t.price),[e,n]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(t){return ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM,itemId:t})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},e=new Map;for(const n of objectValues(t))n&&n.cartItemId&&e.set(n.cartItemId,n);return e}syncItemsWithStore(){const t=this.getItemsListContainer();if(!t)return;const e=this.getCurrentItemsMap(),n=t.querySelectorAll("[data-item-id]"),i=new Set;for(const o of n){const t=o.getAttribute("data-item-id");t&&i.add(t)}for(const o of n){const t=o.getAttribute("data-item-id");t&&!e.has(t)&&o.remove()}for(const[o]of e)if(!i.has(o)){const e=this.createItemElement(o);e.setAttribute("data-item-id",o),t.appendChild(e)}this.updateItemCount()}updateItemCount(){const t=this.getTogglerLabel();if(!t)return;const e=this.getCurrentItemsMap(),n=e.size;t.textContent=n+" item"+(1!==n?"s":"")}onStoreChanged(t){let e;for(let n=0;n<t.length;n++){const i=t[n];if("checkout"===i.path||"checkout.items"===i.path||"checkout.items."===i.path.substring(0,15)){e=i;break}}return e?(this.syncItemsWithStore(),![]):![]}setupToggler(){const t=this.container.querySelector(".checkout-items-toggler"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");t&&e&&n&&t.addEventListener("click",()=>{const t=n.classList.contains("show");n.classList.toggle("show"),t?(e.classList.toggle("expanded"),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand checkout items")):(e.classList.toggle("expanded"),e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse checkout items"))})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.items"),e=objectValues(t||{}),n=document.createElement("div");n.classList.add("checkout-items-toggler");const i=document.createElement("span");i.classList.add("checkout-items-toggler-label"),i.textContent=e.length+" item"+(1!==e.length?"s":""),n.appendChild(i);const o=document.createElement("button");o.type="button",o.classList.add("checkout-items-toggler-button"),o.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(o);const r=document.createElement("div");r.classList.add("checkout-items-list","show");for(const s of e){const t=this.createItemElement(s.cartItemId);t.setAttribute("data-item-id",s.cartItemId),r.appendChild(t)}return[n,r]}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchStorePaths:["checkout.isFormValid","checkout.invalidFields","checkout.stripeFormStatus","checkout.stripeFormStatus.isComplete","checkout.stripeFormStatus.hasError","checkout.stripeFormStatus.isProcessing","checkout.stripeFormStatus.errorMessage","checkout.readyForSubmit","checkout.readyForSubmit.payment","checkout.readyForSubmit.prepared","checkout.loading","checkout.error","checkout.payment.sendSubmitSignal"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-payment-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreChanged(t){const e=t.some(t=>"checkout.isFormValid"===t.path||"checkout.invalidFields"===t.path||"checkout.stripeFormStatus"===t.path||"checkout.stripeFormStatus."===t.path.substring(0,26)||"checkout.readyForSubmit"===t.path||"checkout.readyForSubmit."===t.path.substring(0,23)||"checkout.loading"===t.path||"checkout.error"===t.path);e&&this.updateButtonState();const n=t.find(t=>"checkout.readyForSubmit"===t.path);return n&&this.handleCheckoutReadyForSubmit(n.value),![]}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.isFormValid")||![],e=this.store.get("checkout.invalidFields")||[],n=this.store.get("checkout.stripeFormStatus")||{},i=this.store.get("checkout.loading")||![],o=this.store.get("checkout.error")||null,r=n.isComplete||![],s=n.hasError||![],a=n.isProcessing||![],c=n.errorMessage||null;this.updateErrorDisplay(this.determineErrorMessage(o,c));const l=this.determineButtonState({isFormValid:t,invalidFieldsCount:e.length,isPaymentComplete:r,hasPaymentError:s,isStripeProcessing:a,isCheckoutLoading:i,hasCheckoutError:!!o});this.applyButtonState(l)}determineErrorMessage(t,e){return t&&e?e:e||t}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const e=this.errorContainer.querySelector(".error-text");e&&(this.clearErrorTimeout(),t?(e.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(()=>{this.errorTimeoutId=null,this.commands.checkout.removeCheckoutError();const t=this.store.get("checkout.stripeFormStatus");(null==t?void 0:t.errorMessage)&&this.commands.checkout.updateStripeFormStatus({errorMessage:null})},3e3)):(e.textContent="",this.errorContainer.style.display="none"))}determineButtonState(t){const{isFormValid:e,invalidFieldsCount:n,isPaymentComplete:i,hasPaymentError:o,isStripeProcessing:r,isCheckoutLoading:s,hasCheckoutError:a}=t,c=this.config.layout.placeOrderButtonText,l=this.config.layout.placeOrderButtonShowRequiredFields,d=e&&i&&!o&&!r&&!a,h=this.store.get("checkout.readyForSubmit.payment")||![],u=this.store.get("checkout.readyForSubmit.prepared")||![],p=this.store.get("checkout.payment.sendSubmitSignal")||![],m=this.store.get("checkout.isPresaleLocked")||![];let f=![];if(!m){const t=this.getStoreValue("cart.fulfillments")||{};f=Object.values(t).some(t=>hasUnmetMinimum(t))}const g=r||s||p;if(s&&!r&&!p)return{state:"processing",text:c,disabled:!![]};if(f)return{state:"disabled",text:c,disabled:!![]};if(g)return h&&u?{state:"processing",text:"Placing Order...",disabled:!![]}:h&&!u?{state:"processing",text:"Preparing Order...",disabled:!![]}:u&&!h&&(r||p)||p||r?{state:"processing",text:"Processing Payment...",disabled:!![]}:{state:"processing",text:"Placing Order...",disabled:!![]};if(!e){const t=n>0?" ("+n+")":"";return{state:"form-invalid",text:l?"Complete Required Fields"+t:c,disabled:![]}}return i?o?{state:"payment-error",text:c,disabled:![]}:d?{state:"ready",text:c,disabled:![]}:{state:"disabled",text:c,disabled:!![]}:{state:"payment-incomplete",text:"Complete Payment Information",disabled:![]}}applyButtonState(t){if(!this.placeOrderButton)return;const e=["processing","form-invalid","payment-incomplete","payment-error","ready","disabled"];this.placeOrderButton.classList.remove(...e),this.placeOrderButton.classList.add(t.state),this.placeOrderButton.disabled=t.disabled,this.placeOrderButton.textContent=t.text}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const t=this.store.get("checkout.isFormValid")||![],e=this.store.get("checkout.stripeFormStatus")||{},n=this.store.get("checkout.loading")||![],i=e.isComplete||![],o=e.hasError||![],r=e.isProcessing||![];if(r||n)return;if(!t)return await this.focusFirstInvalidField(),void 0;if(!i||o)return this.showPaymentError(),void 0;await this.commands.checkout.startPreparingCheckoutSubmit()}catch(t){console.error("Error during checkout:",t)}}async focusFirstInvalidField(){try{this.commands.checkout.focusFirstInvalidField&&await this.commands.checkout.focusFirstInvalidField()}catch(_){console.error("Error focusing invalid field:",_)}}showPaymentError(){const t=document.querySelector(".checkout-stripe-form");t&&safeScrollIntoView(t,{behavior:"smooth",block:"center"})}async handleCheckoutReadyForSubmit(t){if(!t)return;const{payment:e,prepared:n,customer:i,gift:o,billing:r}=t,s=e&&n&&i&&r&&o;s&&await this.commands.checkout.checkoutComplete()}template(){const t=document.createElement("button");t.type="button",t.textContent=this.config.layout.placeOrderButtonText,t.classList.add("checkout-place-order-button"),t.disabled=!![],t.addEventListener("click",this.handlePlaceOrderClick.bind(this));const e=document.createElement("div");e.classList.add("checkout-payment-error-wrapper"),e.setAttribute("role","alert"),e.style.display="none";const n=document.createElement("div");n.classList.add("checkout-payment-error");const o=document.createElement("span");o.classList.add("icon-error"),o.innerHTML=ErrorInfoIcon({});const r=document.createElement("span");r.classList.add("error-text"),n.appendChild(o),n.appendChild(r),e.appendChild(n);const s=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,s,t]}}class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const t=[],e=this.getConfigs("global"),n=document.createElement("div");n.classList.add("checkout-completed-section-container");const o=document.createElement("div");o.classList.add("checkout-completed-title-section");const r=document.createElement("div");r.classList.add("checkout-completed-title-section");const s=document.createElement("p");s.textContent="Session Expired",r.appendChild(s);const a=document.createElement("p");a.textContent="Your reservation time has ended. The item has been released for other customers.",r.appendChild(a),o.appendChild(r),n.appendChild(o);const c=document.createElement("div");c.classList.add("checkout-completed-help-section");const l=document.createElement("p");l.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.",c.appendChild(l),n.appendChild(c),t.push(n);const d=document.createElement("div");d.classList.add("checkout-completed-section-container");const h=document.createElement("button");h.setAttribute("aria-label","Continue shopping"),h.type="button";const u=document.createElement("span");u.textContent="Continue Shopping",h.appendChild(u);const p=htmlStringToElement(ArrowRightIcon({width:16,height:16}));h.appendChild(p),h.addEventListener("click",()=>this.handleExit()),d.appendChild(h),t.push(d);const m=document.createElement("div");m.classList.add("checkout-completed-section-container");const f=document.createElement("p");f.classList.add("checkout-completed-auto-close-text"),f.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 g=document.createElement("span");if(g.classList.add("checkout-completed-auto-close-text"),g.textContent="seconds",m.appendChild(f),m.appendChild(this.autoCloseElement),m.appendChild(g),t.push(m),e.layout.showPoweredBy){const e=document.createElement("div");e.classList.add("checkout-completed-powered-by-container");const n=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});e.appendChild(n),t.push(e)}return t}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(t){const e=t.find(t=>"checkout.promoCode"===t.path),n=t.find(t=>"checkout.loading"===t.path);if(e){const{value:t,oldValue:n}=e,i=Boolean(n),o=Boolean(t);if(!i&&o)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(i&&!o)return this.container.innerHTML="",this.createInputContainer(),void 0;o&&this.promoCodeText&&t.discountAmount!==(null==n?void 0:n.discountAmount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")")}n&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),e=t.length>=3&&t.length<=20,n=this.getStoreValue("checkout.loading"),i=this.getStoreValue("checkout.promoCode"),o=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!e||n||Boolean(i)||Boolean(o)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:20},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),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 t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(e){this.logger.error("Checkout promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}}),this.applyButton}createAppliedContainer(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const n=document.createElement("button");n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const t=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("remove-button"),n.textContent="Remove",n.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),e.appendChild(this.promoCodeText),e.appendChild(n),e}const e=[];return e.push(this.createPromoInput()),e.push(this.createApplyButton()),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(t){const e=this.getStoreValue("checkout.updating")||![];if(!e)try{await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Checkout tips update failed",{percentage:t,error:n instanceof Error?n.message:String(n)})}}async handleFulfillmentTipInput(t,e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const i=this.getOnDemandFulfillmentTipInfo();if(!i[t])return;const o=Math.round(100*e);try{await this.commands.checkout.updateFulfillmentTip(t,o)}catch(r){this.logger.error("Checkout fulfillment tip update failed",{fulfillmentId:t,tipAmountInCents:o,originalAmount:e,error:r instanceof Error?r.message:String(r)})}}async removeTipFromFulfillment(t){const e=this.getStoreValue("checkout.updating")||![];if(e)return;const n=this.getOnDemandFulfillmentTipInfo();if(n[t])try{await this.commands.checkout.removeFulfillmentTip(t)}catch(i){this.logger.error("Checkout fulfillment tip removal failed",{fulfillmentId:t,error:i instanceof Error?i.message:String(i)})}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const e=[10,18,20],n=this.getStoreValue("checkout.updating")||![],i=this.getTipSelection();for(const o of e){const e=document.createElement("button");e.type="button",e.textContent=o+"%",e.classList.add("checkout-tip-button"),e.disabled=n,i===o&&e.classList.add("selected"),e.addEventListener("click",()=>this.handlePercentageSelect(o)),t.appendChild(e)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".retailers-tips-list");t&&e&&n&&t.addEventListener("click",()=>{const t=n.classList.contains("show");n.classList.toggle("show"),t?(e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand tips section")):(e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse tips section")),e.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;const n=document.createElement("div");n.classList.add("checkout-tip-distribution-header");const i=document.createElement("h3");i.textContent="View Tip Distribution",i.classList.add("checkout-sub-header"),n.appendChild(i);const o=document.createElement("button");o.type="button",o.classList.add("checkout-items-toggler-button"),o.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),n.appendChild(o),t.appendChild(n);const r=document.createElement("div");r.classList.add("retailers-tips-list","show");for(const s of e){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const e=document.createElement("h4");e.textContent=s.retailerName,e.classList.add("checkout-sub-header"),t.appendChild(e);const n=document.createElement("div");n.classList.add("checkout-tip-fulfillment-input-wrapper");const i=document.createElement("div");i.classList.add("dollar-input-container");const o=document.createElement("span");o.classList.add("dollar-sign"),o.textContent="$";const a=document.createElement("input");let c;a.type="number",a.id="tip-input-"+s.fulfillmentId,a.name="tip-"+s.fulfillmentId,a.min="0",a.step="0.01",a.placeholder="0.00",a.classList.add("dollar-input"),a.value=s.tip>0?(s.tip/100).toFixed(2):"",a.disabled=this.getStoreValue("checkout.updating")||![],a.addEventListener("wheel",t=>{t.preventDefault()}),a.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),a.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),a.addEventListener("paste",t=>{t.preventDefault()}),a.addEventListener("contextmenu",t=>{t.preventDefault()}),a.addEventListener("input",t=>{const e=t.target;let n=e.value;if(Number.parseFloat(n)<0&&(e.value=Math.abs(Number.parseFloat(n)).toString(),n=e.value),n.includes(".")){const t=n.split(".");t.length>1&&t[1].length>2&&(e.value=t[0]+"."+t[1].substring(0,2))}}),a.addEventListener("input",t=>{const e=t.target,n=Number.parseFloat(e.value)||0;c&&clearTimeout(c),c=setTimeout(()=>{this.handleFulfillmentTipInput(s.fulfillmentId,n)},500)}),i.appendChild(o),i.appendChild(a),n.appendChild(i);const l=document.createElement("button");l.type="button",l.textContent="Remove",l.classList.add("checkout-tip-remove-button"),l.disabled=this.getStoreValue("checkout.updating")||![],l.addEventListener("click",()=>this.removeTipFromFulfillment(s.fulfillmentId)),n.appendChild(l),t.appendChild(n),r.appendChild(t)}return t.appendChild(r),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),e=this.getFulfillmentTipInfoArray();if(t&&e.length>0){const i=e.some(t=>t.tip>0);if(i)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(n){this.logger.error("Default tip initialization failed",{currentTipSelection:t,fulfillmentCount:e.length,error:n instanceof Error?n.message:String(n)}),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(i){this.logger.error("Default tip initialization failed during fallback",{currentTipSelection:t,error:i instanceof Error?i.message:String(i)}),this.isInitialized=![]}}template(){const t=[],e=this.getFulfillmentTipInfoArray();if(0===e.length)return t;e.length>0&&this.initializeDefaultTip();const n=document.createElement("section");n.classList.add("checkout-tip-container");const i=document.createElement("h3");i.classList.add("checkout-sub-header"),i.textContent="Add a tip",n.appendChild(i);const o=document.createElement("div");o.classList.add("checkout-tip-config-container");const r=this.createTipSelectionButtons();o.appendChild(r),n.appendChild(o);const s=document.createElement("p");s.classList.add("checkout-tip-disclaimer"),s.textContent="Tips will be split proportionally between retailers.",n.appendChild(s);const a=this.createTipDistribution();return t.push(n,a),t}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(t){var e,n;const i=t.find(t=>"checkout.giftCardError"===t.path),o=t.find(t=>"checkout.promoCodeError"===t.path),r=t.find(t=>"checkout.giftCards"===t.path);if(r&&this.updateAppliedGiftCards(r.value),i){const t=this.container.querySelector(".input-gift-card-container");if(t){const n=t.nextElementSibling;if((null===(e=null==n?void 0:n.classList)||void 0===e?void 0:e.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),i.value){const e=this.createErrorElement(i.value);t.after(e)}const o=t.querySelector(".apply-button");o&&(o.disabled=Boolean(i.value))}}if(o){const t=this.container.querySelector(".input-promo-code-container");if(t){const e=t.nextElementSibling;if((null===(n=null==e?void 0:e.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==e?void 0:e.remove()),o.value){const e=this.createErrorElement(o.value);t.after(e)}const i=t.querySelector(".apply-button");i&&(i.disabled=Boolean(o.value))}}}updateAppliedGiftCards(t){const e=t&&t.length>0;if(!e)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)})}createAppliedGiftCardElement(t){const e=document.createElement("div");e.classList.add("checkout-pc-gc-applied"),e.setAttribute("data-gift-card-code",t.code);const n=document.createElement("span");n.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",e.appendChild(n);const i=document.createElement("button");return i.type="button",i.textContent="Remove",i.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),e.appendChild(i),e}pcInputContainer(){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return t}gcInputContainer(){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_GIFT_CARDS});return t}inputContainer(){var t;const e=this.getConfigs("checkout"),n=this.getConfigs("global"),i=e.layout.allowGiftCards,o=null===(t=null==n?void 0:n.layout)||void 0===t?void 0:t.allowPromoCodes,r=document.createElement("div");r.classList.add("checkout-pc-gc-sub-container");const s=this.pcInputContainer(),a=this.gcInputContainer();o&&r.appendChild(s);const c=this.getStoreValue("checkout.promoCodeError");if(c){const t=this.createErrorElement(c);t.classList.add("promo-code-error-wrapper"),r.appendChild(t)}i&&r.appendChild(a);const l=this.getStoreValue("checkout.giftCardError");if(l){const t=this.createErrorElement(l);r.appendChild(t)}return r}createErrorElement(t){const e=document.createElement("div");e.classList.add("error-banner-checkout");const n=document.createElement("div");n.innerHTML=ErrorInfoIcon({});const i=document.createElement("p");return i.textContent=t.toString(),e.appendChild(n),e.appendChild(i),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),e.remove()},3e3),e}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const e=[];return e.push(this.inputContainer()),t&&t.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),t.forEach(t=>{const e=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(e)}),e.push(this.appliedGiftCardsContainer)),e}disconnected(){this.appliedGiftCardsContainer=null}}class ProductComponent extends BaseComponent{constructor(){super({watchStorePaths:["products.{productId}.loading","products.{productId}.error"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen","products.{productId}.rerender"]}),this.titleElement=null}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen"),i=t.find(t=>t.path==="products."+e+".rerender");n&&this.titleElement&&this.titleElement.classList.toggle("hide",n.value),(null==i?void 0:i.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:i.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:i.PRODUCT_LOADING});const o=n.sizes[n.selectedSizeId],r=document.createElement("div");r.classList.add("product-content-wrapper");const s=document.createElement("div");if(s.classList.add("product-content"),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=n.name,this.titleElement=t,s.appendChild(t)}const a=ComponentFactoryService.createElement({type:i.PRODUCT_OPTIONS,productId:e});s.appendChild(a);const c=ComponentFactoryService.createElement({type:i.PRODUCT_DRAWER,productId:e});if(s.appendChild(c),r.appendChild(s),!this.config.layout.showImages||!(null===(t=n.images)||void 0===t?void 0:t.length))return r;r.classList.add("has-images");const l=ComponentFactoryService.createElement({type:i.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:o.image,productId:e});return r.prepend(l),r}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}class EngravingViewComponent extends BaseComponent{constructor(){super(...arguments),this.openEngravingDrawer=async()=>{const t=this.params.identifier,e=this.createEngravingFormParams();if(this.clientConfig.isMobile()){const n="product"===this.params.context?{...e,productId:t}:e;this.commands.ui.openDrawer(i.ENGRAVING_FORM,n)}if(!this.clientConfig.isMobile())if("product"===this.params.context){const n={...e,productId:t};await this.commands.product.openProductDrawer(t,i.ENGRAVING_FORM,n)}else this.commands.ui.openDrawer(i.ENGRAVING_FORM,e)}}get hostClasses(){const t=this.getConfigs("global");return["engraving-view-container",t.layout.personalizationCardStyle,this.params.context]}beforeSetupStoreWatchers(){var t;this.reactiveOptions.watchStorePaths=null!==(t=this.params.watchStorePaths)&&void 0!==t?t:[]}createEngravingFormParams(){var t,e;const n=this.params.identifier,i={identifier:n,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("product"===this.params.context){const o=this.getStoreValue("products."+n),r=null===(e=null===(t=o.sizes[o.selectedSizeId])||void 0===t?void 0:t.attributes)||void 0===e?void 0:e.engraving;i.lines=o.engravingLines||[],i.maxLines=(null==r?void 0:r.maxLines)||1,i.maxCharsPerLine=(null==r?void 0:r.maxCharsPerLine)||16,i.fee=(null==r?void 0:r.fee)||0,i.location=(null==r?void 0:r.location)||""}if("cart"===this.params.context){const t=this.getStoreValue("cart.items."+n);i.lines=(null==t?void 0:t.attributes.engraving.lines)||[],i.maxLines=(null==t?void 0:t.attributes.engraving.maxLines)||1,i.maxCharsPerLine=(null==t?void 0:t.attributes.engraving.maxCharsPerLine)||16,i.fee=(null==t?void 0:t.attributes.engraving.fee)||0,i.location=(null==t?void 0:t.attributes.engraving.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+n);i.lines=(null==t?void 0:t.attributes.engraving.lines)||[],i.maxLines=(null==t?void 0:t.attributes.engraving.maxLines)||1,i.maxCharsPerLine=(null==t?void 0:t.attributes.engraving.maxCharsPerLine)||16,i.fee=(null==t?void 0:t.attributes.engraving.fee)||0,i.location=(null==t?void 0:t.attributes.engraving.location)||""}return i}createEngravingContainer(t,e){const n=document.createElement("div");n.className="engraving-header";const i=document.createElement("h3");i.textContent="Personalization";const o=document.createElement("span");o.textContent=formatCentToDollarText(e,![]),n.appendChild(i),n.appendChild(o);const r=document.createElement("div");r.className="engraving-body";const s=document.createElement("div");s.className="engraving-lines";for(const l of t){const t=document.createElement("span");t.className="engraving-line",t.textContent=l,s.appendChild(t)}const a=document.createElement("div");a.className="engraving-actions";const c=document.createElement("button");if(c.type="button",c.classList.add("remove-button"),c.textContent="Remove",c.addEventListener("click",async()=>{const t=this.params.identifier;"product"===this.params.context&&await this.commands.product.updateEngravingLines(t,[]),"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(t,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(t)}),a.appendChild(c),"checkout"!==this.params.context){const t=document.createElement("button");t.type="button",t.classList.add("edit-button"),t.textContent="Edit",t.addEventListener("click",this.openEngravingDrawer),a.appendChild(t)}return r.appendChild(s),r.appendChild(a),[n,r]}isEngravingAvailable(){var t,e,n;const i=this.params.identifier;if("product"===this.params.context){const o=this.getStoreValue("products."+i),r=o.sizes[o.selectedSizeId];return Boolean((null===(t=o.selectedFulfillment)||void 0===t?void 0:t.canEngrave)&&(null===(e=o.selectedFulfillment)||void 0===e?void 0:e.isVariantEngravable)&&(null===(n=r.attributes.engraving)||void 0===n?void 0:n.status))}if("cart"===this.params.context){const t=this.getStoreValue("cart.items."+i),e=this.getStoreValue("cart.fulfillments."+t.fulfillmentId),n=t.attributes.engraving.isEngravable,o=(null==e?void 0:e.canEngrave)||![];return Boolean(n&&o)}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+i);return Boolean(null==t?void 0:t.attributes.engraving.isEngravable)}return![]}engravingFee(){var t;const e=this.params.identifier;if("product"===this.params.context){const n=this.getStoreValue("products."+e),i=n.sizes[n.selectedSizeId];return(null===(t=i.attributes.engraving)||void 0===t?void 0:t.fee)||0}if("cart"===this.params.context){const t=this.getStoreValue("cart.items."+e);return(null==t?void 0:t.attributes.engraving.fee)||0}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+e);return(null==t?void 0:t.attributes.engraving.fee)||0}return 0}engravingLines(){const t=this.params.identifier;if("product"===this.params.context){const e=this.getStoreValue("products."+t);return e.engravingLines||[]}if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}return[]}template(){const t=this.isEngravingAvailable();if(!t)return this.removeHostClasses("has-header"),"";const e=this.engravingFee(),n=this.engravingLines();if(n&&n.length>0)return this.addHostClasses("has-header"),this.createEngravingContainer(n,e);if(this.removeHostClasses("has-header"),"checkout"===this.params.context)return"";const i=this.getConfigs("global"),o=document.createElement("button");return o.type="button",o.className="add-engraving-button",o.textContent=i.layout.personalizationText+" +"+formatCentToDollarText(e,![]),o.addEventListener("click",this.openEngravingDrawer),o}}function fulfillmentAddress(t,e){if(!t)return"";if(e===o.SHIPPING){const e=[t.city,t.state].filter(Boolean);return e.join(", ")}const n=[t.one,t.two,t.city,t.state].filter(Boolean);return n.join(", ")}const ct=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],lt=1440;function timeToMinutes(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new Error("Invalid time format: "+t);const n=Number.parseInt(e[1],10),i=Number.parseInt(e[2],10);if(n<0||n>47||i<0||i>59)throw new Error("Invalid time values: "+t);return 60*n+i}function getCurrentTimeInTimezone(t){var e,n,i;const o=new Date,r={timeZone:t,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const t=new Intl.DateTimeFormat("en-US",r),s=t.formatToParts(o),a=(null===(e=s.find(t=>"weekday"===t.type))||void 0===e?void 0:e.value.toLowerCase())||"",c=(null===(n=s.find(t=>"hour"===t.type))||void 0===n?void 0:n.value)||"0",l=(null===(i=s.find(t=>"minute"===t.type))||void 0===i?void 0:i.value)||"0",d=60*Number.parseInt(c,10)+Number.parseInt(l,10);return{weekday:a,timeInMinutes:d}}catch(s){throw new Error("Invalid timezone: "+t)}}function format24TimeTo12(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e||"object"==typeof e)return t;let n=Number.parseInt(e[1],10);const i=e[2];n>=24&&(n-=24);const o=n>=12?"PM":"AM",r=0===n?12:n>12?n-12:n;return r+":"+i+" "+o}function isWithinTimeSlot(t,e){try{const n=timeToMinutes(e.startsAt),i=timeToMinutes(e.endsAt);if(i>lt){if(t>=n||t<i-lt)return"during"}else if(i<n){if(t>=n||t<i)return"during"}else if(t>=n&&t<i)return"during";return t<n?"before":"after"}catch(n){return"after"}}function getNextOpeningTime(t,e,n=7){var i,o;const r=ct.indexOf(e);for(let a=1;a<=n;a++){const e=(r+a)%7,n=ct[e],c=t[n];if((null==c?void 0:c.active)&&c.times&&c.times.length>0)try{const t=1===a?"tomorrow":n;return"Opens "+t+" at "+format24TimeTo12(null!==(o=null===(i=null==c?void 0:c.times[0])||void 0===i?void 0:i.startsAt)&&void 0!==o?o:"")}catch(s){}}return null}function validateFulfillmentData(t){return t&&"object"==typeof t&&t.hours&&t.timezone?"string"!=typeof t.timezone?![]:!![]:![]}function getRetailerOffHours(t){var e;if(!(null==t?void 0:t.type)||(null==t?void 0:t.type)!==o.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(t))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:n,timeInMinutes:i}=getCurrentTimeInTimezone(t.timezone),o=t.hours[n];if(!(null==o?void 0:o.active)||!(null===(e=o.times)||void 0===e?void 0:e.length)){const e=getNextOpeningTime(t.hours,n);return{message:e,isOpen:![],isClosed:!![]}}for(const t of o.times){const e=isWithinTimeSlot(i,t);switch(e){case"before":return{message:"Opens at "+format24TimeTo12(t.startsAt),isOpen:![],isClosed:!![],openTime:t.startsAt,closeTime:t.endsAt};case"during":{let e=t.endsAt;const n=timeToMinutes(e);if(n>lt){const t=Math.floor(n/60)-24,i=n%60;e=t.toString().padStart(2,"0")+":"+i.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(e),isOpen:!![],isClosed:![],openTime:t.startsAt,closeTime:t.endsAt}}}}const r=getNextOpeningTime(t.hours,n);return{message:r,isOpen:![],isClosed:!![]}}catch(n){return console.error("Error getting retailer status:",n),{message:null,isOpen:![],isClosed:!![]}}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,fulfillmentStatus:i,selectedSizeAttributes:r}){var s,a,c,l;let d=0;const h=null==r?void 0:r.presale,u=(null==h?void 0:h.isActive)&&(null==h?void 0:h.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(h.estimatedShipBy):"",p=e===o.SHIPPING,m=e===o.ON_DEMAND;p&&(d=(null===(a=null===(s=null==t?void 0:t.fees)||void 0===s?void 0:s.individual)||void 0===a?void 0:a.fee)||0),m&&(d=(null===(c=null==t?void 0:t.fees)||void 0===c?void 0:c.fee)||0);const f=fulfillmentAddress(t.retailerAddress,e);let g=null;e===o.ON_DEMAND&&i.openTime&&(null==i?void 0:i.closeTime)&&(g=i.isOpen?"Closes at "+format24TimeTo12$1(null==i?void 0:i.closeTime):"Opens at "+format24TimeTo12$1(null==i?void 0:i.openTime));const v=e===o.ON_DEMAND&&i&&i.isClosed?"closed":"",y=document.createElement("div");y.className="popup-retailer-card "+(n?"selected":"")+" "+v,y.setAttribute("data-fulfillment-id",t.fulfillmentId);const x=document.createElement("div");x.className="row";const C=document.createElement("span");C.className="name",C.textContent=t.retailerName,x.appendChild(C);const k=document.createElement("span");k.className="price",k.textContent=formatCentToDollarText(null!==(l=t.price)&&void 0!==l?l:0),x.appendChild(k),y.appendChild(x);const S=document.createElement("div");S.className="row";const E=document.createElement("span");E.className="expectation",E.textContent=i.isClosed?g:(null==h?void 0:h.isActive)?u:(null==t?void 0:t.expectation.detail)||"No expectation available",S.appendChild(E);const I=document.createElement("span");if(I.className="fee",I.textContent=d>0?formatCentToDollarText(d):"Free Delivery",S.appendChild(I),y.appendChild(S),m){const t=document.createElement("div");t.className="row";const e=document.createElement("span");e.className="address",e.textContent=f,t.appendChild(e),y.appendChild(t)}return y}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:e,shippingSelected:n,onDemandSelected:i,onTabClick:r,enableShippingFulfillment:s,enableOnDemandFulfillment:a}){const c=e.length>0,l=document.createElement("div");if(l.className="fulfillment-tabs-container",s){const e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",o.SHIPPING),e.addEventListener("click",r);const i=document.createElement("span");i.className="fulfillment-tab-label "+(n?"selected":""),i.textContent="Shipping ("+t.length+")",e.appendChild(i),l.appendChild(e)}if(a){const t=document.createElement("div");t.className="fulfillment-tab "+(i?"selected":"")+" "+(c?"":"disabled"),t.setAttribute("data-fulfillment-type",o.ON_DEMAND),t.addEventListener("click",r);const n=document.createElement("span");n.className="fulfillment-tab-label "+(i?"selected":""),n.textContent="Same-Day Delivery ("+e.length+")",t.appendChild(n),l.appendChild(t)}return l}class ProductAddToCartSectionComponent extends BaseComponent{get hostClasses(){return["add-to-cart-container"]}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","products.{productId}.engravingLines","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment||!n.selectedSizeId)return 0;const i=n.selectedFulfillment.partNumber,o=n.selectedFulfillment.fulfillmentId,r=null===(t=n.sizes[n.selectedSizeId].attributes)||void 0===t?void 0:t.maxQuantityPerOrder;if(!r)return 0;const s=this.getStoreValue("cart.items")||{},a=Object.values(s).filter(t=>t.partNumber===i&&t.fulfillmentId===o),c=a.reduce((t,e)=>t+e.quantity,0);return r-c}isFulfillmentClosed(){const t=this.getProductId(),e=this.getStoreValue("products."+t);if(!e.selectedFulfillment)return![];const n=getRetailerOffHours(e.selectedFulfillment);return e.selectedFulfillmentType===o.ON_DEMAND&&n&&n.isClosed}isButtonLoading(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".updating");return e}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),e=this.getAvailableQuantity(),n=t<e;return{currentQuantity:t,availableQuantity:e,canIncrease:n,canDecrease:t>1}}async handleAddToCart(){var t,e,n;const i=this.getProductId(),o=this.getStoreValue("products."+i);if(!o.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:i,selectedSizeId:o.selectedSizeId}),void 0;const r=this.getSizeAttributes(),s=(null===(t=null==r?void 0:r.presale)||void 0===t?void 0:t.isActive)===!![],a=this.isPresaleActive(r);s&&a?await this.commands.product.addPresaleToCart(i,{upc:o.sizes[o.selectedSizeId].upc,fulfillmentId:o.selectedFulfillment.fulfillmentId,partNumber:null===(e=o.selectedFulfillment)||void 0===e?void 0:e.partNumber,quantity:o.quantity,engravingLines:o.engravingLines,identifier:i}):await this.commands.product.addToCart(i,{upc:o.sizes[o.selectedSizeId].upc,fulfillmentId:o.selectedFulfillment.fulfillmentId,partNumber:null===(n=o.selectedFulfillment)||void 0===n?void 0:n.partNumber,quantity:o.quantity,engravingLines:o.engravingLines,identifier:i})}async handleQuantityChange(t){const e=this.getProductId();await this.commands.product.updateQuantity(e,t)}calculateTotalPrice(){var t,e;const n=this.getProductId(),i=this.getStoreValue("products."+n),o=i.sizes[i.selectedSizeId],r=i.selectedFulfillment,s=r.price*i.quantity,a=i.engravingLines.length>0,c=a&&(null===(e=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.fee)||0;return{quantity:i.quantity,totalPrice:s+c}}createQuantityContainer(t){const e=this.calculateQuantityLimits(),n=document.createElement("div");return n.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!e.canDecrease,e.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=e.currentQuantity.toString(),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!e.canIncrease,e.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantityText),n.appendChild(this.qtyIncreaseButton),n}getSizeAttributes(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".selectedSizeId"),n=this.getStoreValue("products."+t+".sizes."+e);return(null==n?void 0:n.attributes)||{}}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:e}=this.calculateTotalPrice(),n=this.getSizeAttributes(),i=this.calculateQuantityLimits(),o=(null===(t=null==n?void 0:n.presale)||void 0===t?void 0:t.isActive)===!![],r=this.isPresaleActive(n),s=o?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;return this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?s+" - "+formatCentToDollarText(e):s,(o&&!r||0===i.availableQuantity||this.isFulfillmentClosed())&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),this.isButtonLoading()&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async t=>{if(t.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),n=this.getConfigs("configurations");if(!e||!n.isElementsEnabled)return[];const i=[],o=this.config.layout.showQuantityCounter;if(o){const t=this.config.layout.quantityCounterStyle,e=this.createQuantityContainer(t);i.push(e)}const r=this.createAddToCartButton();return i.push(r),i}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const t=this.params.productId,e=this.getStoreValue("products."+t+".description"),n=this.getStoreValue("products."+t+".htmlDescription"),i="About this product:",o="See More",r="See Less",s=document.createElement("h3");s.className="title",s.textContent=i;const a=document.createElement("div");a.className="content collapsed",a.innerHTML=""===(null==n?void 0:n.trim())?e:sanitizeHTML(n);const c=document.createElement("span");return c.className="collapse-button",c.textContent=o,c.addEventListener("click",()=>{this.isCollapsed=!this.isCollapsed,a.classList.toggle("collapsed"),c.textContent=this.isCollapsed?o:r}),[s,a,c]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(t){var e;const n=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!n)return![];const i=n.value,o=i.isOpen,r=null===(e=i.contentConfig)||void 0===e?void 0:e.type,s=r!==this.currentContentType;return o&&!this.isOpen?(this.currentContentType=r,this.openWithContent(i),![]):o&&this.isOpen&&!s?![]:o&&this.isOpen&&s?(this.currentContentType=r,this.openWithContent(i),![]):!o&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const e=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:e}),void 0;const{type:n,data:i}=t||{},o=ComponentFactoryService.createElement({type:n,...i});this.contentContainer&&this.contentContainer.appendChild(o),this.open()}catch(n){this.logger.error("Product drawer content loading failed",{productId:e,contentType:null==t?void 0:t.type,error:n instanceof Error?n.message:String(n)}),this.commands.product.closeProductDrawer(e)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay;return["product-image-carousel",t]}constructor(){super({watchOnlyStorePaths:["products.{productId}.mainImage"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){const e=this.params.productId,n=t.find(t=>t.path==="products."+e+".mainImage");if(null==n?void 0:n.value){const t=this.params.images.indexOf(null==n?void 0:n.value);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+n.value+"')")}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let e=0;e<this.thumbnails.length;e++){const t=this.thumbnails[e];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(e)})}const t=this.container.querySelectorAll(".carousel-dot");for(let e=0;e<t.length;e++){const n=t[e];n.addEventListener("click",()=>this.selectImage(e))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var e,n;if(t<0||t>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[t]+"')",this.mainImageElement.title="Product image "+(t+1)),null===(e=this.thumbnails[this.currentImageIndex])||void 0===e||e.classList.remove("selected"),null===(n=this.thumbnails[t])||void 0===n||n.classList.add("selected");const i=this.container.querySelectorAll(".carousel-dot");for(let o=0;o<i.length;o++){const e=i[o];e.classList.toggle("active",o===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const e=this.thumbnails[t],n=this.galleryViewport.offsetWidth,i=e.offsetLeft+e.offsetWidth/2,o=n/2,r=o-i,s=0,a=-(this.galleryContainer.scrollWidth-n);this.translateX=Math.max(a,Math.min(s,r)),this.updateTransform(!![])}setupMainImageSwipe(){var t,e;let n=0,i=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{n=t.touches[0].clientX,i=t.touches[0].clientY},{passive:!![]}),null===(e=this.mainImageElement)||void 0===e||e.addEventListener("touchend",t=>{const e=t.changedTouches[0].clientX-n,o=t.changedTouches[0].clientY-i;Math.abs(e)>Math.abs(o)&&Math.abs(e)>50&&(e>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const t of this.galleryContainer.querySelectorAll("img"))t.addEventListener("dragstart",t=>t.preventDefault())}}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const i=this.currentTranslateX+n,o=0,r=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(r,Math.min(o,i)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const t=[],e=this.params.images.length>1,n=document.createElement("div");if(n.className="main-image",n.title="Product main image",n.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",e){const t=document.createElement("div");t.className="carousel-dots";for(let e=0;e<this.params.images.length;e++){const n=document.createElement("button");n.type="button",n.className="carousel-dot "+(0===e?"active":""),n.setAttribute("data-index",e.toString()),t.appendChild(n)}n.appendChild(t)}this.mainImageElement=n,t.push(n);const i=document.createElement("div");i.className="gallery-viewport";const o=document.createElement("div");o.className="gallery-container";for(let r=0;r<this.params.images.length;r++){const t=this.params.images[r],e=document.createElement("div");e.className="gallery-image-wrapper "+(0===r?"selected":"");const n=document.createElement("img");n.src=t,n.className="gallery-image",n.alt="Product thumbnail "+(r+1),n.loading="lazy",e.appendChild(n),o.appendChild(e)}return i.appendChild(o),t.push(i),t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),e=this.container.querySelectorAll("[select-size]");for(const n of e)n.addEventListener("click",async()=>{const i=n.dataset.sizeId;if(!i)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:n.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,i);for(const t of e)t.classList.remove("selected");n.classList.add("selected")})}renderProductSizes(t,e){const n=document.createElement("div");n.className="size-container";const i=document.createElement("h3");i.className="size-label",i.textContent="Size",n.appendChild(i);const o=document.createElement("div");o.className="size-buttons-container";for(const r of Object.values(e)){const e=document.createElement("span");e.setAttribute("data-size-id",r.id),e.setAttribute("select-size",""),e.className="size-button "+(r.id===t?"selected":"");const n=r.packDesc?" ("+r.packDesc+")":"";e.textContent=""+r.size+n,o.appendChild(e)}return n.appendChild(o),n}hasIndependentAddressComponent(){var t;return(null===(t=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===t?void 0:t.length)>0}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.config.layout.showDescription,o=this.getConfigs("global"),r=[],s=document.createElement("div");s.className="price-personalization-container";const a=ComponentFactoryService.createElement({type:i.PRODUCT_PRICE,productId:t});if(s.appendChild(a),o.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:t,context:"product",watchStorePaths:["products.{identifier}.selectedSizeId","products.{identifier}.selectedFulfillmentType","products.{identifier}.selectedFulfillment","products.{identifier}.engravingLines"]});s.appendChild(e)}r.push(s);const c=this.renderProductSizes(e.selectedSizeId,e.sizes);if(r.push(c),!this.hasIndependentAddressComponent()){const e=ComponentFactoryService.createElement({type:i.ADDRESS_DISPLAY,productId:t});r.push(e)}const l=ComponentFactoryService.createElement({type:i.PRODUCT_RETAILERS,productId:t});r.push(l);const d=ComponentFactoryService.createElement({type:i.PRODUCT_ADD_TO_CART_SECTION,productId:t});if(r.push(d),n){const e=ComponentFactoryService.createElement({type:i.PRODUCT_DESCRIPTION,productId:t});r.push(e)}return r}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".drawer.isOpen");if(n){const t=n.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),e=this.getStoreValue("address.formattedAddress");if(e)return ComponentFactoryService.createElement({type:i.PRODUCT_INTERACTIONS,productId:this.getProductId()});const n=document.createElement("button");return n.type="button",n.className="product-options-open-address-button",n.textContent=this.config.layout.buyNowButtonText,n.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,i.ADDRESS_INPUT,{productId:t})}),n}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);let i=(null===(t=n.priceInfo)||void 0===t?void 0:t.avg)||0;return n.selectedFulfillment&&(i=n.selectedFulfillment.price),formatCentToDollarText(i)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getConfigs("product"),o=[],r=this.getConfigs("configurations");if(!e.productHasAvailability||!r.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.textContent="We're sorry, this product is not at nearby vendors and unavailable to ship to your state.",o.push(t),o}const s="carousel"===n.layout.fulfillmentDisplay?i.PRODUCT_RETAILERS_CAROUSEL:i.PRODUCT_RETAILERS_POPUP,a=ComponentFactoryService.createElement({type:s,productId:t});return o.push(a),o}}const dt="This product is currently unavailable to ship to your location.",ht="Same-day delivery is currently unavailable for your location.";class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const t=this.retailerCards.findIndex(t=>t.classList.contains("selected"));-1!==t&&this.scrollToIndex(t)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".selectedFulfillmentId");(null==n?void 0:n.value)&&this.updateSelectedCard(n.value)}updateSelectedCard(t){for(const n of this.retailerCards)n.classList.remove("selected");const e=this.retailerCards.findIndex(e=>e.dataset.fulfillmentId===t);-1!==e&&(this.retailerCards[e].classList.add("selected"),this.scrollToIndex(e))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const e=this.retailerCards[t],n=this.listViewport.offsetWidth,i=e.offsetLeft+e.offsetWidth/2,o=n/2,r=o-i,s=0,a=-(this.listContainer.scrollWidth-n);this.translateX=Math.max(a,Math.min(s,r)),this.updateTransform(!![])}setupDrag(){this.listContainer&&(this.listContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.listContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this)))}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.listViewport)return;"touchmove"===t.type&&t.preventDefault();const e="touches"in t?t.touches[0].clientX:t.clientX,n=e-this.startX;Math.abs(n)>5&&(this.hasMoved=!![]);const i=this.currentTranslateX+n,o=0,r=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(r,Math.min(o,i)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.listContainer&&(this.listContainer.style.transition=t?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){if(this.hasMoved)return;const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const i=this.getStoreValue("products."+e+".selectedFulfillment");if(i&&i.fulfillmentId===n)return this.logger.debug("Product retailer selection skipped: Same fulfillment already selected",{productId:e,fulfillmentId:n}),void 0;await this.commands.product.selectFulfillment(e,n)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,fulfillmentStatus:i,selectedSizeAttributes:r}){var s,a,c,l;let d=0;const h=null==r?void 0:r.presale,u=(null==h?void 0:h.isActive)&&(null==h?void 0:h.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(h.estimatedShipBy):"",p=e===o.SHIPPING,m=e===o.ON_DEMAND;p&&(d=(null===(a=null===(s=null==t?void 0:t.fees)||void 0===s?void 0:s.individual)||void 0===a?void 0:a.fee)||0),m&&(d=(null===(c=null==t?void 0:t.fees)||void 0===c?void 0:c.fee)||0);const f=fulfillmentAddress(t.retailerAddress,e);let g=null;e===o.ON_DEMAND&&i.openTime&&(null==i?void 0:i.closeTime)&&(g=i.isOpen?"Closes at "+format24TimeTo12$1(null==i?void 0:i.closeTime):"Opens at "+format24TimeTo12$1(null==i?void 0:i.openTime));const v=e===o.ON_DEMAND&&i&&i.isClosed?"closed":"",y=document.createElement("div");y.className="carousel-retailer-card "+(n?"selected":"")+" "+v,y.setAttribute("data-fulfillment-id",t.fulfillmentId);const x=document.createElement("div");x.className="retailer-header";const C=document.createElement("h3");if(C.className="name",C.textContent=t.retailerName,x.appendChild(C),m){const t=document.createElement("h3");t.className="address",t.textContent=f,x.appendChild(t)}const k=document.createElement("div");k.className="retailer-body";const S=document.createElement("span");S.className="product-price",S.textContent=formatCentToDollarText(null!==(l=t.price)&&void 0!==l?l:0);const E=document.createElement("span");E.className="shipping-price",E.textContent=d>0?"+ "+formatCentToDollarText(d):"FREE Delivery";const I=document.createElement("span");return I.className="expectation",I.textContent=i.isClosed?g:(null==h?void 0:h.isActive)?u:(null==t?void 0:t.expectation.detail)||"No expectation available",k.append(S,E,I),y.append(x,k),y}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,r=this.config.layout.enableShippingFulfillment,s=this.config.layout.enableOnDemandFulfillment,a=[];for(const o in n.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(n.shippingFulfillments,o)){const t=n.shippingFulfillments[o],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;a.push(t)}const c=[];for(const o in n.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,o)){const t=n.onDemandFulfillments[o],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;c.push(t)}const l=e.selectedFulfillmentType===o.SHIPPING,d=e.selectedFulfillmentType===o.ON_DEMAND,h=l?a:c,u=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:c,shippingSelected:l,onDemandSelected:d,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:r,enableOnDemandFulfillment:s});if(!e.fulfillmentHasAvailability||0===h.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.textContent=l?dt:ht,[u,t]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const p of h){const t=getRetailerOffHours(p),n=this.generateRetailerCard({fulfillment:p,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:p.fulfillmentId===e.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:i}),r=e.selectedFulfillmentType===o.ON_DEMAND&&t&&t.isClosed;r||n.addEventListener("click",this.onRetailerCardClick.bind(this)),this.listContainer.appendChild(n)}return this.listViewport.appendChild(this.listContainer),[u,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),r=(null==n?void 0:n.attributes)||null,s=this.config.layout.enableShippingFulfillment,a=this.config.layout.enableOnDemandFulfillment,c=Object.values(n.shippingFulfillments),l=Object.values(n.onDemandFulfillments),d=(s?c.length:0)+(a?l.length:0),h=document.createElement("div");h.className="header";const u=document.createElement("span");u.className="header-label",u.textContent=e.selectedFulfillmentType===o.SHIPPING?"Shipping From:":"Delivering From:";const p=document.createElement("button");if(p.className="delivery-options",p.type="button",p.textContent="See Delivery Options ("+d+")",p.addEventListener("click",async()=>{0!==d&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,i.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),h.appendChild(u),h.appendChild(p),!e.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.textContent=e.selectedFulfillmentType===o.SHIPPING?dt:ht,[h,t]}const m=document.createElement("div");m.className="popup-fulfillment-list-container";const f=getRetailerOffHours(e.selectedFulfillment),g=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],fulfillmentStatus:f,selectedSizeAttributes:r});return m.appendChild(g),[h,m]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentType;if(!n)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(e,n)}async onRetailerCardClick(t){const e=this.getProductId(),n=t.currentTarget.dataset.fulfillmentId;if(!n)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:e,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const R=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(e),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},i=this.getStoreValue("products."+e+".selectedFulfillment");if(i&&i.fulfillmentId===n)return await R(),void 0;await this.commands.product.selectFulfillment(e,n),await R()}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,r=this.config.layout.enableShippingFulfillment,s=this.config.layout.enableOnDemandFulfillment,a=[];for(const o in n.shippingFulfillments)if(Object.prototype.hasOwnProperty.call(n.shippingFulfillments,o)){const t=n.shippingFulfillments[o],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;a.push(t)}const c=[];for(const o in n.onDemandFulfillments)if(Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,o)){const t=n.onDemandFulfillments[o],e=getRetailerOffHours(t);if(e.isClosed&&!this.config.layout.showOffHours)continue;c.push(t)}const l=e.selectedFulfillmentType===o.SHIPPING,d=e.selectedFulfillmentType===o.ON_DEMAND,h=l?a:c,u=document.createElement("h5");u.className="popup-retailers-section-title",u.textContent="Delivery Options";const p=renderFulfillmentTabsContainer({shippingFulfillments:a,onDemandFulfillments:c,shippingSelected:l,onDemandSelected:d,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:r,enableOnDemandFulfillment:s});if(!e.fulfillmentHasAvailability||0===h.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.textContent=l?dt:ht,[u,p,t]}const m=document.createElement("div");m.className="popup-fulfillment-list-container";for(const o of h){const t=getRetailerOffHours(o),n=renderPopupRetailerCard({fulfillment:o,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:o.fulfillmentId===e.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:i});n.addEventListener("click",this.onRetailerCardClick.bind(this)),m.appendChild(n)}return[u,p,m]}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,e;const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],i=null!==(e=this.params.showFirstEvent)&&void 0!==e?e:!![];if(n){const t=this.store.get(this.params.errorStorePath)||[],e=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return i?e.slice(0,1):e}const o=this.store.get(this.params.errorStorePath);return o?[{message:o,level:"error"}]:[]}createErrorElement(t){const e=document.createElement("div");e.classList.add("alert-container","alert-"+t.level);const n=document.createElement("span");n.classList.add("alert-icon"),n.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const i=document.createElement("span");return i.classList.add("alert-text"),i.textContent=t.message,e.appendChild(n),e.appendChild(i),e}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const e=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},e)}hideAllErrors(){var t;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[];const e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];e?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(i.CART)});const e=document.createElement("span");if(e.className="lce-cart-button-icon",e.innerHTML=BagIcon({color:t.theme.primaryColor}),this.params.showItemsCount){const t=document.createElement("span");return t.className="lce-cart-button-badge",t.style.visibility="hidden",[e,t]}return[e]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const e=this.getStoreValue("cart.totals.quantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const e=this.getStoreValue("cart.totals.quantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var e;const n=t.find(t=>"ui.drawer"===t.path);if(!n)return![];const i=n.value,o=i.isOpen,r=null===(e=i.contentConfig)||void 0===e?void 0:e.type,s=r!==this.currentContentType;return o&&!this.isOpen?(this.currentContentType=r,this.openWithContent(i),![]):o&&this.isOpen&&!s?![]:o&&this.isOpen&&s?(this.currentContentType=r,this.openWithContent(i),![]):!o&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:e,data:n}=t||{};let i;i=this.isElementsEnabled()?ComponentFactoryService.createElement({type:e,...n}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(i,e):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(i),this.updateDrawerContentTypeClass(e),this.open()),this.addHostAttribute("data-target",e.toString().toLowerCase())}catch(e){this.logger.error("Drawer content loading failed",{contentType:null==t?void 0:t.type,error:e instanceof Error?e.message:String(e)}),this.commands.ui.closeDrawer()}}animateContentSwap(t,e){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const n=this.contentContainer.firstElementChild;n.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{n.classList.add("fading")}),setTimeout(()=>{n.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(e),requestAnimationFrame(()=>{t.classList.add("visible"),setTimeout(()=>{t.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(t){if(!this.drawerElement)return;const e=["drawer"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.drawerElement.className=e.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled:",e),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.inputs=[],this.charCountElements=[]}get hostClasses(){return["engraving-form-container"]}afterRender(){this.initializeCharacterCounts()}async handleClick(t){const e=t.target;e.matches(".engraving-form-button-save")&&await this.handleSave(),e.matches(".engraving-form-button-cancel")&&await this.closeDrawer()}handleInput(t){const e=t.target;e.matches(".engraving-form-input")&&this.updateCharacterCount(e)}updateCharacterCount(t){const e=Number.parseInt(t.dataset.line||"0",10)-1,n=this.charCountElements[e];if(n){const e=t.value.length,i=this.params.maxCharsPerLine;n.textContent=e+"/"+i}}initializeCharacterCounts(){for(const t of this.inputs)this.updateCharacterCount(t)}async closeDrawer(){const{identifier:t,context:e}=this.params;"product"===e&&(this.clientConfig.isMobile()?this.commands.ui.closeDrawer():await this.commands.product.closeProductDrawer(t)),"cart"===e&&this.commands.ui.openDrawer(i.CART),"checkout"===e&&this.commands.ui.closeDrawer()}collectEngravingLines(){return this.inputs.map(t=>t.value.toString().trim().toUpperCase()).filter(t=>t.length>0)}async handleSave(){const{identifier:t,context:e}=this.params,n=this.collectEngravingLines();if(0===n.length)return await this.closeDrawer(),void 0;"product"===e&&await this.commands.product.updateEngravingLines(t,n),"cart"===e&&await this.commands.cart.updateItemEngraving(t,n),"checkout"===e&&await this.commands.cart.updateItemEngraving(t,n),await this.closeDrawer()}template(){var t;const{maxLines:e,lines:n,location:i,maxCharsPerLine:o}=this.params;this.inputs=[],this.charCountElements=[];const r=Array.from({length:e},(t,e)=>{const i=n[e]||"",r=document.createElement("div");r.className="engraving-form-input-container",r.setAttribute("data-line-container","");const s=document.createElement("input");s.type="text",s.id="engraving-line-"+(e+1),s.dataset.line=(e+1).toString(),s.maxLength=o,s.value=i,s.placeholder="Line "+(e+1),s.className="engraving-form-input",s.autocomplete="off",this.inputs.push(s);const a=document.createElement("span");return a.className="engraving-form-input-char-count",a.textContent=i.length+"/"+o,this.charCountElements.push(a),r.appendChild(s),r.appendChild(a),r}),s=document.createElement("div");s.className="engraving-form-header";const a=document.createElement("p");if(a.className="engraving-form-title",a.textContent="Personalize with a message",s.appendChild(a),i&&(null===(t=null==i?void 0:i.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-form-location",t.textContent="Engraving will appear "+i.toLowerCase(),s.appendChild(t)}const c=document.createElement("div");c.className="engraving-form-lines";for(const p of r)c.appendChild(p);const l=document.createElement("div");l.className="engraving-form-actions";const d=document.createElement("button");d.type="button",d.className="engraving-form-button-cancel",d.textContent="Cancel",l.appendChild(d);const h=document.createElement("button");h.type="button",h.className="engraving-form-button-save",h.textContent="Save",l.appendChild(h);const u=document.createElement("p");return u.className="engraving-form-disclaimer",u.innerHTML="\n Personalized orders require up to 10 business days to be processed and then shipped.\n Tracking information will be provided once processed.\n <span>Personalized bottle orders cannot be canceled.</span>\n ",this.container.addEventListener("click",this.handleClick.bind(this)),this.container.addEventListener("input",this.handleInput.bind(this)),[s,c,l,u]}}class BirthdateInputComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["custom-input","birthdate",t.layout.inputFieldStyle]}constructor(){super({watchOnlyStorePaths:["checkout.focusField"]})}onStoreWatch(t){const e=t.find(t=>"checkout.focusField"===t.path);e&&e.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"}))}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const t=this.params.value.split("/");3===t.length&&(this.monthInput.value=t[0],this.dayInput.value=t[1],this.yearInput.value=t[2])}}setupEventListeners(){this.monthInput.addEventListener("input",t=>{this.formatMonth(t),this.handleNavigation(t,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",t=>{this.formatDay(t),this.handleNavigation(t,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",t=>{this.formatYear(t),this.handleChange()}),this.monthInput.addEventListener("blur",()=>this.validateInput()),this.dayInput.addEventListener("blur",()=>this.validateInput()),this.yearInput.addEventListener("blur",()=>this.validateInput());for(const t of[this.monthInput,this.dayInput,this.yearInput])t.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length&&Number.parseInt(n,10)>1)n="0"+n;else if(2===n.length){const t=Number.parseInt(n,10);t>12?n="12":t<1&&(n="01")}e.value=n}formatDay(t){const e=t.target;let n=e.value.replace(/\D/g,"");if(n.length>2&&(n=n.substring(0,2)),1===n.length&&Number.parseInt(n,10)>3)n="0"+n;else if(2===n.length){const t=Number.parseInt(n,10);t>31?n="31":t<1&&(n="01")}e.value=n}formatYear(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>4&&(n=n.substring(0,4)),e.value=n}handleNavigation(t,e){const n=t.target,i=n===this.yearInput?4:2;n.value.length===i&&e&&e.focus()}handleChange(){if(this.clearErrors(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}getFormattedValue(){const t=this.monthInput.value.padStart(2,"0"),e=this.dayInput.value.padStart(2,"0"),n=this.yearInput.value;return t&&e&&n&&4===n.length?n+"-"+t+"-"+e:""}validateDate(t,e,n){if(!t||!e||!n||4!==n.length)return![];const i=Number.parseInt(t,10),o=Number.parseInt(e,10),r=Number.parseInt(n,10);if(i<1||i>12||o<1||o>31||r<1e3)return![];const s=new Date(r,i-1,o);return s.getFullYear()===r&&s.getMonth()===i-1&&s.getDate()===o}calculateAge(t){const e=new Date;let n=e.getFullYear()-t.getFullYear();const i=e.getMonth()-t.getMonth();return(i<0||0===i&&e.getDate()<t.getDate())&&n--,n}validateInput(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value,i=[],o=this.params.validation;if(!o)return this.showErrors([]),!![];if(o.required&&(t&&e&&n||i.push("Please enter a complete date")),t||e||n)if(t&&e&&n&&4===n.length)if(this.validateDate(t,e,n)){const r=Number.parseInt(t,10),s=Number.parseInt(e,10),a=Number.parseInt(n,10),c=new Date(a,r-1,s);if(void 0!==o.minYear&&a<o.minYear&&i.push("Year must be "+o.minYear+" or later"),void 0!==o.maxYear&&a>o.maxYear&&i.push("Year must be "+o.maxYear+" or earlier"),void 0!==o.minAge||void 0!==o.maxAge){const t=this.calculateAge(c);void 0!==o.minAge&&t<o.minAge&&i.push("Must be at least "+o.minAge+" years old"),void 0!==o.maxAge&&t>o.maxAge&&i.push("Must be no more than "+o.maxAge+" years old")}if(o.customValidator){const t=o.customValidator(this.getFormattedValue());t&&i.push(t)}}else i.push("Please enter a valid date");else i.push("Please enter a complete date (MM/DD/YYYY)");this.showErrors(i);const r=0===i.length;return this.params.onValidation&&this.params.onValidation(r,i),r}showErrors(t){this.errorContainer.innerHTML="";const e=[this.monthInput,this.dayInput,this.yearInput];if(t.length>0){this.errorContainer.classList.add("show");for(const t of e)t.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else for(const n of e)n.classList.remove("input-error")}clearErrors(){const t=[this.monthInput,this.dayInput,this.yearInput],e=t.some(t=>t.classList.contains("input-error"));if(e){for(const e of t)e.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(t){if(t){const e=t.split("/");3===e.length&&(this.monthInput.value=e[0],this.dayInput.value=e[1],this.yearInput.value=e[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name+"-month"),e.push(n)}const n=document.createElement("div");n.className="date-input-container";const i=document.createElement("input");i.type="text",i.placeholder="MM",i.name=this.params.name+"-month",i.id=this.params.name+"-month",i.maxLength=2,i.className="date-field month-field",i.setAttribute("data-field","month"),i.inputMode="numeric";const o=document.createElement("span");o.className="date-separator",o.textContent="/";const r=document.createElement("input");r.type="text",r.placeholder="DD",r.name=this.params.name+"-day",r.id=this.params.name+"-day",r.maxLength=2,r.className="date-field day-field",r.setAttribute("data-field","day"),r.inputMode="numeric";const s=document.createElement("span");s.className="date-separator",s.textContent="/";const a=document.createElement("input");a.type="text",a.placeholder="YYYY",a.name=this.params.name+"-year",a.id=this.params.name+"-year",a.maxLength=4,a.className="date-field year-field",a.setAttribute("data-field","year"),a.inputMode="numeric",this.params.disabled&&(i.disabled=!![],r.disabled=!![],a.disabled=!![]),this.params.className&&(n.className+=" "+this.params.className),n.appendChild(i),n.appendChild(o),n.appendChild(r),n.appendChild(s),n.appendChild(a);const c=document.createElement("div");return c.className="error-container",e.push(n),e.push(c),e}}class InputComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}constructor(){super({watchStorePaths:["checkout.focusField"]})}onStoreChanged(t){const e=t.find(t=>"checkout.focusField"===t.path);return e&&e.value===this.params.storePath&&(this.focus(),this.validate(),safeScrollIntoView(this,{behavior:"smooth",block:"center"})),![]}handlePhoneKeydown(t){if("Backspace"===t.key){const e=t.target,n=e.selectionStart||0,i=e.value;n>0&&/\D/.test(i[n-1])&&setTimeout(()=>{const t=Math.max(0,n-2);e.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>10&&(n=n.substring(0,10)),n.length>=6?n="("+n.substring(0,3)+") "+n.substring(3,6)+"-"+n.substring(6):n.length>=3&&(n="("+n.substring(0,3)+") "+n.substring(3)),e.value=n}formatDate(t){const e=t.target;let n=e.value.replace(/\D/g,"");n.length>8&&(n=n.substring(0,8)),n.length>=5?n=n.substring(0,2)+"/"+n.substring(2,4)+"/"+n.substring(4):n.length>=3&&(n=n.substring(0,2)+"/"+n.substring(2)),e.value=n}validateEmail(t){const e=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\.[a-zA-Z]{2,}$/;return e.test(t)}validateTel(t){const e=/^\(\d{3}\) \d{3}-\d{4}$/;return e.test(t)}validateDate(t){const e=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!e.test(t))return![];const[n,i,o]=t.split("/").map(Number),r=new Date(o,n-1,i);return r.getFullYear()===o&&r.getMonth()===n-1&&r.getDate()===i}validateInput(){const t=this.inputElement.value,e=[],n=this.params.validation;if(!n)return this.showErrors([]),!![];if(n.required&&!t.trim()&&e.push("This field is required"),t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||e.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||e.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(t)||e.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const i=Number.parseFloat(t);Number.isNaN(i)?t.trim()&&e.push("Please enter a valid number"):(void 0!==n.min&&i<n.min&&e.push("Value must be at least "+n.min),void 0!==n.max&&i>n.max&&e.push("Value must be no more than "+n.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==n.min&&t.length<n.min&&e.push("Must be at least "+n.min+" characters"),void 0!==n.max&&t.length>n.max&&e.push("Must be no more than "+n.max+" characters")),n.pattern){const i=new RegExp(n.pattern);i.test(t)||e.push("Invalid format")}if(n.customValidator){const i=n.customValidator(t);i&&e.push(i)}}this.showErrors(e);const i=0===e.length;return this.params.onValidation&&this.params.onValidation(i,e),i}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===this.params.inputType&&this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name),e.push(n)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&"number"===this.params.inputType&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&"number"===this.params.inputType&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"===this.params.inputType&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("blur",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",e.push(this.inputElement),e.push(this.errorContainer),e}}class LceElementComponent extends HTMLElement{constructor(){super(),this.O=![],this.G=this.attachShadow({mode:"closed"})}initialize(t,e){if(this.O)return console.warn("Already initialized, ignoring subsequent calls"),void 0;if(!t||"string"!=typeof t)throw new Error("LceElementComponent: contentType must be a non-empty string");if(!(e&&e instanceof HTMLElement))throw new Error("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.G)throw new Error("LceElementComponent: Shadow DOM container is not available");this.G.appendChild(e),this.applyBasicStyles();const n=ThemeProviderService.getInstance(),i=n.getStylesheet(t);this.applyThemeStyles(i),this.O=!![],this.G=null}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n }\n\n :host([drawer]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const e=new CSSStyleSheet;e.replaceSync(t),this.G.adoptedStyleSheets=[e,...this.G.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(_){this.createFallbackStylesheet(t)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}applyThemeStyles(t){t.forEach(t=>{"string"==typeof t?this.createFallbackStylesheet(t):this.G.adoptedStyleSheets=[...this.G.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const e=document.createElement("style");e.textContent=t,this.G&&this.G.appendChild(e)}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:e,showDescription:n,showQuantityCounter:i,fulfillmentDisplay:o,showImages:r}=this.config.layout,s=document.createElement("div");s.classList.add("product-content-wrapper");const a=document.createElement("div");if(a.classList.add("skeleton-container"),e){const t=document.createElement("div");t.classList.add("wave","sc-title"),a.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),a.appendChild(t),a}const c=document.createElement("div");c.classList.add("wave","sc-price"),a.appendChild(c);const l=document.createElement("div");l.classList.add("sc-sizes");const d=document.createElement("div");d.classList.add("wave","sc-size-button"),l.appendChild(d);const h=document.createElement("div");h.classList.add("wave","sc-size-button"),l.appendChild(h);const u=document.createElement("div");u.classList.add("wave","sc-size-button"),l.appendChild(u);const p=document.createElement("div");p.classList.add("wave","sc-size-button"),l.appendChild(p);const m=document.createElement("div");m.classList.add("wave","sc-size-button"),l.appendChild(m),a.appendChild(l);const f=document.createElement("div");f.classList.add("sc-row");const g=document.createElement("div");g.classList.add("wave","sc-price"),f.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-personalization"),f.appendChild(v),a.appendChild(f);const y=document.createElement("div");y.classList.add("wave","sc-deliver-to"),a.appendChild(y);const x=document.createElement("div");x.classList.add("wave","sc-address"),a.appendChild(x);const C=document.createElement("div");C.classList.add("wave","sc-retailers",o),a.appendChild(C);const k=document.createElement("div");if(k.classList.add("sc-row"),i){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),k.appendChild(t)}const S=document.createElement("div");if(S.classList.add("wave","sc-add-to-cart"),k.appendChild(S),a.appendChild(k),n){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),a.appendChild(t);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),a.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),a.appendChild(n);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),a.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-more"),a.appendChild(o)}const E=document.createElement("div");if(E.classList.add("product-content"),E.appendChild(a),s.appendChild(E),r){s.classList.add("has-images");const t=this.createImageSkeletons();s.prepend(t)}return s}createImageSkeletons(){const t=document.createElement("div");t.classList.add("product-image-carousel","skeleton");const e=document.createElement("div");e.classList.add("wave","sc-main-image"),e.title="Product main image loading";const n=document.createElement("div");n.classList.add("carousel-dots");for(let r=0;r<3;r++){const t=document.createElement("div");t.classList.add("wave","sc-carousel-dot"),n.appendChild(t)}e.appendChild(n),t.appendChild(e);const i=document.createElement("div");i.classList.add("gallery-viewport");const o=document.createElement("div");o.classList.add("gallery-container");for(let r=0;r<4;r++){const t=document.createElement("div");t.classList.add("gallery-image-wrapper");const e=document.createElement("div");e.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(e),o.appendChild(t)}return i.appendChild(o),t.appendChild(i),t}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const t=document.createElement("div");t.className="pb-title-container";const e=document.createElement("span");e.className="pb-text",e.textContent="Powered by",t.appendChild(e);const n=document.createElement("span");n.className="pb-lc",n.textContent="LiquidCommerce",t.appendChild(n);const i=document.createElement("span");return i.className="pb-dot",i.textContent=".",t.appendChild(i),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const e=this.getDisclaimerConfig();return e.parts.forEach(e=>{"text"===e.type?t.appendChild(document.createTextNode(e.content)):"link"===e.type&&t.appendChild(this.createLink(e.href,e.text))}),t}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(t,e){const n=document.createElement("a");return n.href=t,n.target="_blank",n.rel="noopener noreferrer",n.className="pb-link",n.textContent=e,n}template(){const t=this.createPoweredBySection(),e=this.createDisclaimerSection();return[t,e]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!e||!this.applyButton||!this.currentActiveTicker)return;const n=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);n&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!n&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const e=this.store.get("cart.promoCode"),n=this.store.get("checkout.promoCode");return(null==e?void 0:e.code)===t||(null==n?void 0:n.code)===t}getActiveTickers(){var t;const e=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var n;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const e=document.createElement("div");e.classList.add("promo-ticker__text-group");const n=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const i of n){const n=i.trim();if(!n)continue;const o=document.createElement("span");o.classList.add("promo-ticker__text-item"),o.textContent=n,e.appendChild(o);const r=document.createElement("span");r.classList.add("promo-ticker__separator"),r.textContent=t.separator,e.appendChild(r)}return e}async handlePromoClick(){var t;(null===(t=this.currentActiveTicker)||void 0===t?void 0:t.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const t=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(t),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const e=document.createElement("div");e.classList.add("promo-ticker__content");const n=document.createElement("div");n.classList.add("promo-ticker__track");for(let o=0;o<5;o++)n.appendChild(this.generateTextContent(this.currentActiveTicker));e.appendChild(n);const i=document.createElement("button");return i.type="button",i.classList.add("promo-ticker__cta"),i.textContent="APPLY",this.promoCodeApplied&&(i.disabled=!![],i.textContent="APPLIED"),i.addEventListener("click",()=>this.handlePromoClick()),this.applyButton=i,[e,i]}}const ut=LoggerFactory.get("ElementsClientHelper"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,e){if(!t||!e)return t;const n={...t},i=[];for(const o in e){const r=e[o],s=n[o];if(!(o in t)){i.push('Property "'+o+'" does not exist in target schema, skipping merge.');continue}const a=getType(r),c=getType(s);a===c?isObject(r)&&isObject(s)?n[o]=deepMergeConfigs(s,r):n[o]=r:i.push('Type mismatch for key "'+o+'": source is '+a+", target is "+c+". Skipping merge.")}return i.length>0&&ut.warn("Merging configurations with warnings:",i),n}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}getProductStore(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".items")||{};return Object.values(e).find(e=>e.fulfillmentId===t)}handleItemsUpdate(t,e){const n=new Set(t||[]),o=new Set(e||[]);for(const i of n)if(!o.has(i)){const t=this.container.querySelector('[data-item-id="'+i+'"]');t&&t.remove()}for(const r of o)if(!n.has(r)){const t=ComponentFactoryService.createElement({type:i.CART_ITEM,itemId:r});t.setAttribute("data-item-id",r),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".items")||[],n=this.container.querySelectorAll("[data-item-id]");for(const i of n)i.remove();for(const o of e){const t=ComponentFactoryService.createElement({type:i.CART_ITEM,itemId:o});t.setAttribute("data-item-id",o),this.container.appendChild(t)}}setupMinimumPurchaseAlert(){var t;const e=this.getFulfillmentId(),n=(null===(t=this.getProductStore())||void 0===t?void 0:t.pack)||![],o=this.getStoreValue("cart.fulfillments."+e),r=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(r&&r.remove(),shouldShowMinimumPurchaseAlert(o,n)){const t=getMinimumPurchaseMessage(o,n),e=ComponentFactoryService.createElement({type:i.PURCHASE_MIN_ALERT,message:t.message,messageType:t.type,currentTotal:o.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(e)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var t;const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e);return(null===(t=null==n?void 0:n.items)||void 0===t?void 0:t.length)?n.items.some(t=>{const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.updating)===!![]}):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}onStoreChanged(t){const e=this.getFulfillmentId(),n="cart.fulfillments."+e,i=t.find(t=>t.path===n),o=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(o.length>0&&this.checkAndUpdateLoadingState(),i){const t=i.oldValue,e=i.value,n=(null==t?void 0:t.items)||[],o=(null==e?void 0:e.items)||[],r=JSON.stringify(n)!==JSON.stringify(o);r&&(this.handleItemsUpdate(n,o),this.checkAndUpdateLoadingState());const s=this.hasFulfillmentFeesChanged(t,e),a=this.hasFulfillmentDataChanged(t,e,["items","updating"]);if(s&&!a&&this.setupMinimumPurchaseAlert(),!a)return![]}return![]}hasFulfillmentFeesChanged(t,e){return t?t.subtotal!==e.subtotal||t.shippingFee!==e.shippingFee||t.deliveryFee!==e.deliveryFee||JSON.stringify(t.fees)!==JSON.stringify(e.fees):!![]}hasFulfillmentDataChanged(t,e,n=[]){if(!t)return!![];const i=["type","canEngrave","retailerId"];for(const o of i)if(!n.includes(o)&&t[o]!==e[o])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}class LiquidCommerceElementsClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],this.builder={updateComponentGlobalConfigs:async t=>{if(this.ensuredIsBuilder("updateComponentGlobalConfigs"))try{if(!t)throw new Error("Global theme configuration is required");this.themeProvider.updateComponentGlobalConfigs(t),t.layout&&Object.keys(t.layout).length>0&&(await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout()),this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(e){throw this.logger.error("❌ Failed to update global theme configuration:",e),new Error("Global theme update failed")}},updateProductComponent:async t=>{if(this.ensuredIsBuilder("updateProductComponent"))try{if(!t)throw new Error("Product component configuration is required");this.themeProvider.updateProductComponent(t),t.layout&&Object.keys(t.layout).length>0&&await this.commands.product.rerenderAllProducts(),this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(e){throw this.logger.error("❌ Failed to update product component theme:",e),new Error("Product theme update failed")}},updateCartComponent:t=>{if(this.ensuredIsBuilder("updateCartComponent"))try{if(!t)throw new Error("Cart component configuration is required");this.themeProvider.updateCartComponent(t),t.layout&&Object.keys(t.layout).length>0&&this.commands.cart.rerenderCart(),this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(e){throw this.logger.error("❌ Failed to update cart component theme:",e),new Error("Cart theme update failed")}},updateCheckoutComponent:t=>{if(this.ensuredIsBuilder("updateCheckoutComponent"))try{if(!t)throw new Error("Checkout component configuration is required");this.themeProvider.updateCheckoutComponent(t),t.layout&&Object.keys(t.layout).length>0&&this.commands.checkout.rerenderCheckout(),this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(e){throw this.logger.error("❌ Failed to update checkout component theme:",e),new Error("Checkout theme update failed")}},updateAddressComponent:t=>{if(this.ensuredIsBuilder("updateAddressComponent"))try{if(!t)throw new Error("Address component configuration is required");this.themeProvider.updateAddressComponent(t),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(e){throw this.logger.error("❌ Failed to update address component theme:",e),new Error("Address theme update failed")}},injectElement:async t=>{this.ensuredIsBuilder("injectElement")&&await this.processInjectElement(t)},injectProductElement:async t=>{this.ensuredIsBuilder("injectProductElement")&&await this.processInjectProduct(t)},injectAddressElement:async(t,e)=>{this.ensuredIsBuilder("injectAddressElement")&&await this.processInjectElement({type:i.ADDRESS,containerId:t,options:e})},injectCartElement:async t=>{this.ensuredIsBuilder("injectCartElement")&&await this.processInjectElement({type:i.CART,containerId:t})},injectCheckoutElement:async t=>{this.ensuredIsBuilder("injectCheckoutElement")&&await this.processInjectElement({type:i.CHECKOUT,containerId:t})}},this.ui={cartButton:(t,e)=>{var n;this.ensureCartDrawerExists();const o=document.getElementById(null!==(n=null==t?void 0:t.replace("#",""))&&void 0!==n?n:"");if(!o)throw new Error("Container with ID '"+t+"' not found");const r=ComponentFactoryService.createElement({type:i.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});o.innerHTML="",safeReplaceChildren(o,r)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:i.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(e)},cartSubtotal:t=>{var e;const n=document.getElementById(null!==(e=null==t?void 0:t.replace("#",""))&&void 0!==e?e:"");if(!n)throw new Error("Element with ID '"+t+"' not found");n.innerHTML="";const i=this.store.get("cart.totals.subtotal")||0;n.textContent=formatCentToDollarText(i),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.subtotal")||0;n.textContent=formatCentToDollarText(t)})},cartItemsCount:t=>{var e;const n=document.getElementById(null!==(e=null==t?void 0:t.replace("#",""))&&void 0!==e?e:"");if(!n)throw new Error("Element with ID '"+t+"' not found");n.innerHTML="";const i=this.store.get("cart.totals.quantity")||0;n.textContent=i.toString(),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.quantity")||0;n.textContent=t.toString()})}},this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authService=AuthService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Failed to prepare client:",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",_.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&LoggerFactory.setEnableLogging(!![]),this.logger.debug("🔐 Starting authentication...");const t=await this.authService.authenticate();if(!t)throw this.clientPrepared=![],new Error("Authentication failed");this.logger.debug("✅ Authentication completed"),this.logger.debug("🌐 Setting up API client..."),await this.apiClient.setClient(this.authService),this.logger.debug("✅ API client setup completed"),this.logger.debug("⚙️ Loading configurations...");let e=await this.apiClient.getAllConfigs();this.logger.debug("✅ Configurations loaded"),this.logger.debug("🔍 Setting up fingerprinting and store...");const n=await this.fingerPrintService.getId(e.configurations.partnerCode),i=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",n),this.clientConfig.set("isLocalStorageAvailable",i);const o=i?null:await this.apiClient.getPersistedStore(n);if(await this.store.initialize({userDeviceId:n,isLocalStorageAvailable:i,persistedStore:o}),this.logger.debug("✅ Store setup completed"),this.logger.debug("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme");e=deepMergeConfigs(e,t)}await this.themeProvider.initialize(e),this.logger.debug("✅ Theme provider initialized"),this.logger.debug("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.debug("✅ Essential components registered"),this.logger.debug("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(t){this.logger.warn("Heavy initialization failed, but client remains functional:",t)}},0)}async initializeHeavyServices(){const t=this.themeProvider.getConfigs("configurations");if(!this.gtmInitialized)try{await this.googleTagManager.initialize({partnerName:t.partnerName,partnerGtmId:t.googleTagManagerId,partnerEnableGaTracking:t.enablePartnerGaTracking,liquidCommerceEnableGaTracking:t.enableLiquidCommerceGaTracking,liquidCommerceGtmId:t.liquidCommerceGoogleTagManagerId}),this.gtmInitialized=!![]}catch(e){this.logger.warn("GTM initialization failed:",e)}try{this.isElementsEnabled()&&await this.commands.common.loadCart()}catch(n){this.logger.warn("Cart pre-loading failed:",n)}this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}async injectProductElement(t){if(this.isElementsEnabled())await this.processInjectProduct(t);else for(const e of t)this.injectDisabledElementsError(e.containerId,i.PRODUCT)}async injectAddressElement(t,e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t,i.ADDRESS),void 0;await this.processInjectElement({type:i.ADDRESS,containerId:t,options:e})}async injectCartElement(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t,i.CART),void 0;await this.processInjectElement({type:i.CART,containerId:t})}async injectCheckoutElement(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t,i.CHECKOUT),void 0;await this.processInjectElement({type:i.CHECKOUT,containerId:t})}get actions(){return this.clientAction.actions}async processInjectProduct(t){var e,n;if(this.ensureAllComponentsRegistered(),0===t.length)throw new Error("At least one product must be provided");t.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const o=t.slice(0,20),r=[];for(const i of o){const t=null===(n=null===(e=i.containerId)||void 0===e?void 0:e.replace("#",""))||void 0===n?void 0:n.trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+i.identifier+"'");continue}const o=document.getElementById(t);if(!o){this.logger.warn("Container with ID '"+t+"' not found for product '"+i.identifier+"'");continue}const s=r.every(e=>e.containerId!==t);if(!s){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!i.identifier){this.logger.warn("Product identifier is required for container ID '"+t+"'");continue}const a=r.every(t=>t.identifier!==i.identifier);a?r.push({containerId:t,identifier:i.identifier}):this.logger.warn("Duplicate product identifier '"+i.identifier+"' found, skipping")}for(const s of r){const t=ComponentFactoryService.createElement({type:i.PRODUCT,useShadowDom:!![],productId:s.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(s.containerId);e?(e.innerHTML="",safeReplaceChildren(e,t),await this.commands.product.createProductInstance(s.identifier,!![])):this.logger.warn("Product ("+s.identifier+") container with ID '"+s.containerId+"' not found")}await this.commands.product.loadMultipleProducts(r.map(t=>t.identifier))}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t.containerId)throw new Error("Container ID is required");if(!t.type)throw new Error("Component type is required");const e=t.containerId.replace("#",""),n=document.getElementById(e);if(!n)return console.warn("Container with ID '"+e+"' not found"),void 0;n.innerHTML="";const o={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]};t.type===i.ADDRESS&&t.options&&(o.options=t.options);const r=ComponentFactoryService.createElement(o);safeReplaceChildren(n,r),t.type===i.CHECKOUT&&await this.commands.checkout.loadCheckout()}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:i.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled:",e),!![]}}injectDisabledElementsError(t,e){const n=document.getElementById(t.replace("#",""));if(!n)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let i;i=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({message:"Elements is not enabled.",componentType:e}),n.innerHTML="",safeReplaceChildren(n,i)}registerEssentialComponents(){ComponentFactoryService.registerComponent(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(i.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LOADING,ProductLoadingComponent)}registerComponents(){this.componentFactoryInitialized||(ComponentFactoryService.registerComponent(i.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(i.INPUT,InputComponent),ComponentFactoryService.registerComponent(i.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(i.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(i.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(i.ALERT,AlertComponent),ComponentFactoryService.registerComponent(i.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(i.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(i.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(i.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(i.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(i.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(i.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(i.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(i.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(i.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(i.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(i.CART,CartComponent),ComponentFactoryService.registerComponent(i.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(i.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(i.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(i.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(i.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(i.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(i.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(i.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(i.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(i.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_INFORMATION_SECTION,CheckoutInformationSectionComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PAYMENT_FORM,CheckoutPaymentFormComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BILLING_FORM,CheckoutBillingFormComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_SUMMARY_SECTION,CheckoutSummarySectionComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_DELIVERY_INFORMATION_FORM,CheckoutDeliveryInformationComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BUYER_INFORMATION_FORM,CheckoutBuyerInformationComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent))}ensuredIsBuilder(t){return this.clientConfig.isBuilder()?!![]:(this.logger.error("This method ("+t+") is only available in builder mode"),![])}}async function Elements(t,n){try{const i=ClientConfigService.getInstance();i.initialize(t,{env:n.env,isBuilder:n.isBuilder,enableDebugging:n.enableDebugging,customTheme:n.customTheme,proxy:n.proxy,promoTicker:n.promoTicker});const o=i.getConfigs();SingletonManager.setClientConstructor(LiquidCommerceElementsClient);const r=await SingletonManager.getClient(o);if(!r.clientPrepared)throw new Error("LiquidCommerce Elements failed to initialize properly.");const s={builder:r.builder,injectProductElement:r.injectProductElement.bind(r),injectAddressElement:r.injectAddressElement.bind(r),injectCartElement:r.injectCartElement.bind(r),injectCheckoutElement:r.injectCheckoutElement.bind(r),ui:r.ui,actions:r.actions};window.elements=s;const a=PubSubService.getInstance();return a.publishAction(e.CLIENT_READY,{isReady:!![],message:"Client Is Ready",timestamp:Date.now(),version:i.get("version")}),s}catch(i){const t=(null==i?void 0:i.message)||"Unknown initialization error";console.error("LiquidCommerce Elements initialization failed:",t);try{const n=ClientConfigService.getInstance(),i=PubSubService.getInstance();i.publishAction(e.CLIENT_READY,{isReady:![],message:"Initialization failed: "+t,timestamp:Date.now(),version:n.get("version")||"unknown"})}catch(o){console.warn("LiquidCommerce Elements: Could not fire error event - services unavailable")}return null}}function pairsFromMainScript(t){const e=[],n=t.getAttributeNames().filter(t=>"data-product"===t.substring(0,12));for(const i of n){const n=i.match(/^data-product(-(.+))?$/),o=(null==n?void 0:n[2])?"-"+n[2]:"",r="data-container"+o;t.hasAttribute(r)&&e.push({containerId:t.getAttribute(r),identifier:t.getAttribute(i)})}return e}function pairsFromProductsScript(){const t=[],e=document.querySelectorAll("script[data-liquid-commerce-elements-products]");for(const i of e)try{const e=JSON.parse(i.textContent||"[]");if(!Array.isArray(e))continue;for(const n of e)n.containerId&&n.identifier&&t.push({containerId:n.containerId,identifier:n.identifier})}catch(n){console.error("LiquidCommerce Elements Auto Initialization: Invalid JSON in data-liquid-commerce-elements-products script",n)}return t}function pairsFromAttributedElements(){const t=document.querySelectorAll("div[data-lce-product]"),e=[];for(const n of t){const t="lcep-"+(Date.now().toString(36)+Math.random().toString(36).substring(2,15));n.setAttribute("id",t);const i=n.getAttribute("data-lce-product");t&&i&&e.push({containerId:t,identifier:i})}return e}async function ElementsAutoInitialize(){var e,n,i,o,r,s;try{const s=document.querySelector("script[data-liquid-commerce-elements]");if(!s)return;const a=s.getAttribute("data-token"),c=s.getAttribute("data-env")||t.PRODUCTION,l=s.hasAttribute("data-enable-debugging"),d=s.getAttribute("data-cart-id"),h=s.hasAttribute("data-show-cart-items"),u=s.hasAttribute("data-hide-cart-floating-button"),p=s.getAttribute("data-promo-code"),m=s.getAttribute("data-promo-text"),f=null!==(e=s.getAttribute("data-promo-separator"))&&void 0!==e?e:"•",g=null!==(n=s.getAttribute("data-promo-active-from"))&&void 0!==n?n:void 0,v=null!==(i=s.getAttribute("data-promo-active-until"))&&void 0!==i?i:void 0;if(!a)throw new Error("API key is missing.");const y=pairsFromMainScript(s),x=pairsFromProductsScript(),C=pairsFromAttributedElements(),k=[...y,...x,...C],S=p&&m&&g&&v?{promoCode:p,text:m.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:f,activeFrom:null===(o=new Date(g))||void 0===o?void 0:o.toISOString(),activeUntil:null===(r=new Date(v))||void 0===r?void 0:r.toISOString()}:void 0,E=await Elements(a,{env:c,enableDebugging:l&&c!==t.PRODUCTION,promoTicker:S?[S]:void 0});if(!E)throw new Error("Failed to initialize client.");0!==k.length&&await E.injectProductElement(k),d?E.ui.cartButton(d,h):u||E.ui.floatingCartButton(h)}catch(a){console.error("LiquidCommerce Elements Auto Initialization:",null!==(s=null==a?void 0:a.message)&&void 0!==s?s:String(a))}}function triggerElementsAutoInit(){"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{setTimeout(ElementsAutoInitialize,100)}):setTimeout(ElementsAutoInitialize,100)}if(void 0===window.customElements)throw new Error("LiquidCommerce Elements SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");if(void 0===HTMLElement.prototype.attachShadow)throw new Error("LiquidCommerce Elements SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");initializeDOMPolyfills(),triggerElementsAutoInit(),initializeDOMPolyfills(),window.Elements=Elements,exports.Elements=Elements,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|