@liquidcommerce/elements-sdk 2.6.2 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/umd/elements.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...t){for(;this.firstChild;)this.removeChild(this.firstChild);for(const e of t)"string"==typeof e?this.appendChild(document.createTextNode(e)):this.appendChild(e)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const e=document.createDocumentFragment();for(const n of t)"string"==typeof n?e.appendChild(document.createTextNode(n)):e.appendChild(n);this.insertBefore(e,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const 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 initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(et){console.warn("DOM polyfills initialization failed:",et)}}function safeReplaceChildren(t,...e){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...e);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const n of e)"string"==typeof n?t.appendChild(document.createTextNode(n)):t.appendChild(n)}}catch(n){console.error("replaceChildren operation failed:",n),1===e.length&&"string"==typeof e[0]&&(t.innerHTML=e[0])}}class SDKError extends Error{constructor(t,e=![]){super(t),this.name="SDKError",this.isSdk=!![],this.reThrow=e,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(t,e){if((null==t?void 0:t.isSdk)===!![])return t instanceof SDKError&&t.reThrow?![]:!![];if(!t||"object"!=typeof t)return e?isSDKSource(e):![];const n=String((null==t?void 0:t.message)||""),i=/liquidcommerce\s+elements/i.test(n),o=String((null==t?void 0:t.stack)||""),r=(null==t?void 0:t.source)||e||"",s=[/@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,/elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,/chunk-[a-z0-9]+.*elements/i],a=[/\bElements\b(?!\w)/,/\bElementsBuilder\b/,/\bLiquidCommerceElements\b/,/BaseComponent/,/Elements(?:Base)?Client/,/(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,/(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,/(?:Product|Cart|Checkout|Address|ProductList).*Component/],c=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],l=[/elements-sdk[/\\]/i,/modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,/core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,/@liquidcommerce[/\\]elements-sdk/i],d=isSDKSource(r),u=s.some(t=>t.test(o)),p=a.some(t=>t.test(o)),m=c.some(t=>t.test(o)),g=l.some(t=>t.test(o));return i||d||u||p||m||g}function isSDKSource(t){if(!t||"string"!=typeof t)return![];const e=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return e.some(e=>e.test(t))}const t={BRANDS:"brands",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",CATEGORIES:"categories",SIZES:"sizes",APPELLATION:"appellation",COUNTRY:"country",VINTAGE:"vintage",MATERIALS:"materials"},e={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},i={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},o={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",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},r={ON_DEMAND:"onDemand",SHIPPING:"shipping"},s={NONE:"none",CONSOLE:"console",PANEL:"panel"},a={[e.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[e.STAGING]:"https://staging-elements.liquidcommerce.us",[e.PRODUCTION]:"https://elements.liquidcommerce.us"},c={STANDARD:"standard"},l={PERSONALIZATION:"personalization",PRE_ORDER:"pre-order",DELIVERY_OPTIONS:"delivery-options",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},d={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040};class SingletonManager{static getInstances(){return"builder"===SingletonManager.currentContext?(SingletonManager.builderClientInstances||(SingletonManager.builderClientInstances=new Map),SingletonManager.builderClientInstances):(SingletonManager.regularClientInstances||(SingletonManager.regularClientInstances=new Map),SingletonManager.regularClientInstances)}constructor(){}static setContext({isBuilder:t}){SingletonManager.currentContext=t?"builder":"regular"}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,e){const n=SingletonManager.getInstances();n.has(t)||n.set(t,e());const i=n.get(t);if(!i)throw new SDKError("ElementsSdk: Instance for class "+t+" could not be created.");return i}static async getClient(t){const e=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),n="LiquidCommerceElementsClient_"+e,i=SingletonManager.getInstances();if(i.has(n))return i.get(n);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const o=new SingletonManager.clientConstructor(t);return await o.prepare(),i.set(n,o),o}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const u="lce",p={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},m={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:r.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},g={id:"",subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},v={token:"",cartId:"",loading:![],updating:![],error:null,warning:[],presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddressTwo:"",promoCode:null,giftCards:[],orderNumber:null,items:{},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:![],onDemandFulfillmentTipInfo:{},tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},b={drawer:{isOpen:![],contentConfig:null}},x={products:{},cart:g,address:p,checkout:v,ui:b};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 SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[t]:e})}isDevelopment(){return this.get("env")===e.DEVELOPMENT}isStaging(){return this.get("env")===e.STAGING}isProduction(){return this.get("env")===e.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const t=this.get("debugMode");return t===s.CONSOLE||t===s.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===s.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===s.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}getProxyConfig(){return this.get("proxy")}validateInputs(t,n){if(!(null==t?void 0:t.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(n.env&&!Object.values(e).includes(n.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+n.env+'". Using default environment.'),n.env=void 0),void 0!==n.isBuilder&&"boolean"!=typeof n.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),n.isBuilder=void 0),void 0===n.debugMode||Object.values(s).includes(n.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+n.debugMode+'". Must be one of: '+Object.values(s).join(", ")+". Using default value."),n.debugMode=void 0),n.promoTicker&&"object"!=typeof n.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),n.promoTicker=void 0),n.promoTicker)if(Array.isArray(n.promoTicker)){const t=n.promoTicker.filter((t,e)=>{if("string"!=typeof t.promoCode||!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof t.separator||!t.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom is required. Skipping this promo."),![];const n="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(n instanceof Date)||Number.isNaN(n.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil is required. Skipping this promo."),![];const i="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return i instanceof Date&&!Number.isNaN(i.getTime())?n>=i?(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+e+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});n.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),n.promoTicker=void 0;n.proxy&&("object"!=typeof n.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),n.proxy=void 0):n.proxy.baseUrl&&"string"==typeof n.proxy.baseUrl?n.proxy.headers&&"object"!=typeof n.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),n.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),n.proxy=void 0))}buildConfiguration(t,n){var i,o,r,c;const l=n.env||e.PRODUCTION;let d=a[l];const p=l===e.PRODUCTION,m=n.isBuilder||![],g=u+(p?"":"_"+l)+(m?"builder":"");return(null===(i=n.development)||void 0===i?void 0:i.customApiUrl)&&(d=n.development.customApiUrl),{apiKey:t.trim(),env:l,isBuilder:m,debugMode:n.debugMode||s.NONE,baseUrl:d,partnerCode:void 0,partnerName:void 0,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:g,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:n.promoTicker||null,paymentMethodId:(null===(o=n.development)||void 0===o?void 0:o.paymentMethodId)||void 0,openShadowDom:p?![]:(null===(r=n.development)||void 0===r?void 0:r.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(c=n.development)||void 0===c?void 0:c.customApiUrl)}}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.telemetryService=null,this.context=t}static getInstance(t){return SingletonManager.getClassInstance("LoggerService_"+t,()=>new LoggerService(t))}setEnableLogging(t){this.enableLogging=t}setTelemetryService(t){this.telemetryService=t}getPrefix(t){if(!this.enableLogging)return[];const e=(new Date).toISOString().slice(11,23);return["%c["+e+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[t],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[t],"color: "+this.colors[t]]}debug(t,e){if(this.sendToTelemetry("debug",t,void 0,e),!this.enableLogging)return;const[n,...i]=this.getPrefix("debug");void 0!==e?console.debug(n,...i,t,e):console.debug(n,...i,t)}info(t,e){if(!this.enableLogging)return;const[n,...i]=this.getPrefix("info");void 0!==e?console.info(n,...i,t,e):console.info(n,...i,t)}warn(t,e){if(this.sendToTelemetry("warn",t,void 0,e),!this.enableLogging)return;const[n,...i]=this.getPrefix("warn");void 0!==e?console.warn(n,...i,t,e):console.warn(n,...i,t)}error(t,e){const n=e instanceof Error,i=n?e:void 0,o=!n&&e?e:void 0;if(this.sendToTelemetry("error",t,i,o),!this.enableLogging)return;const[r,...s]=this.getPrefix("error");void 0!==e?console.error(r,...s,t,e):console.error(r,...s,t)}sendToTelemetry(t,e,n,i){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,e,{context:this.context,error:n,data:i})}catch(o){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const e=this.getInstances();if(!e.has(t)){const n=LoggerService.getInstance(t);n.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&n.setTelemetryService(this.telemetryService),e.set(t,n)}return e.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const e=this.getInstances();for(const[,n]of e)n.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const e=this.getInstances();for(const[,n]of e)n.setTelemetryService(t)}}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}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null;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 SDKError("Component type ["+t.type+"] is not registered");const n=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(n)||window.customElements.define(n,e);const i=document.createElement(n);if(i.initialize){const{type:e,useShadowDom:o,wrapInLceElement:r,...s}=t,a={type:e,tagName:n,useShadowDom:o&&r!==!![]};i.initialize({data:s,config:a})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(o.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(o.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const r=document.createElement(n);return r.initialize(t.type,i),r}return i}catch(e){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t.type}):componentError({componentType:t.type,message:(null==e?void 0:e.message)||e})}}static componentError({componentType:t,message:e}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t}):componentError({componentType:t,message:e})}static getComponentTagName(t){const e={[o.DRAWER]:"drawer-lc",[o.INPUT]:"input-lc",[o.BIRTHDATE_INPUT]:"birthdate-input-lc",[o.ENGRAVING_FORM]:"engraving-form-lc",[o.ENGRAVING_VIEW]:"engraving-view-lc",[o.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[o.POWERED_BY]:"powered-by-lc",[o.LCE_ELEMENT]:"lce-element",[o.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[o.ALERT]:"alert-lc",[o.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[o.ADDRESS]:"address-lc",[o.ADDRESS_INPUT]:"address-input-lc",[o.ADDRESS_DISPLAY]:"address-display-lc",[o.PRODUCT]:"product-lc",[o.PRODUCT_OPTIONS]:"product-options-lc",[o.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[o.PRODUCT_INTERACTIONS]:"product-interactions-lc",[o.PRODUCT_DESCRIPTION]:"product-description-lc",[o.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[o.PRODUCT_RETAILERS]:"product-retailers-lc",[o.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[o.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[o.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[o.PRODUCT_PRICE]:"product-price-lc",[o.PRODUCT_DRAWER]:"product-drawer-lc",[o.PRODUCT_LOADING]:"product-loading-lc",[o.PRODUCT_LIST]:"product-list-lc",[o.PRODUCT_LIST_CARD]:"product-list-card-lc",[o.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[o.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[o.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[o.CART]:"cart-lc",[o.CART_RETAILER]:"cart-retailer-lc",[o.CART_ITEM]:"cart-item-lc",[o.CART_FOOTER]:"cart-footer-lc",[o.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[o.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[o.CART_PROMO_CODE]:"cart-promo-code-lc",[o.CART_HEADER]:"cart-header-lc",[o.CART_BODY]:"cart-body-lc",[o.CART_FULFILLMENT]:"cart-fulfillment-lc",[o.CHECKOUT]:"checkout-lc",[o.CHECKOUT_INFORMATION]:"checkout-information-lc",[o.CHECKOUT_PAYMENT]:"checkout-payment-lc",[o.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[o.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[o.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[o.CHECKOUT_BILLING]:"checkout-billing-lc",[o.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[o.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[o.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[o.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[o.CHECKOUT_ITEMS]:"checkout-items-lc",[o.CHECKOUT_COMPLETED]:"checkout-completed-lc",[o.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[o.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[o.CHECKOUT_BUYER]:"checkout-buyer-lc",[o.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[o.CHECKOUT_TIPS]:"checkout-tips-lc",[o.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[o.CHECKOUT_ITEM]:"checkout-item-lc",[o.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[o.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[o.CHECKOUT_HEADER]:"checkout-header-lc",[o.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[o.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[o.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return e[t]||t.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;class PubSubService{constructor(){this.clientReadyEvent=null,this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub"),this.setupClientReadyBuffering()}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(t,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:"evt_"+r+"_"+Math.random().toString(36).slice(2,9),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{"actions.client_ready"===t&&(this.clientReadyEvent=e);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)}}setupClientReadyBuffering(){const t=window.addEventListener,e=this.eventPrefix+":actions.client_ready";window.addEventListener=(n,i,o)=>{if(n!==e)return t.call(window,n,i,o);if(!this.clientReadyEvent)return t.call(window,n,i,o);try{const t=new CustomEvent(e,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof i?i(t):i&&"function"==typeof i.handleEvent&&i.handleEvent(t)}catch(r){this.logger.error("Error replaying CLIENT_READY event",r)}return t.call(window,n,i,o)}}}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(t){const e=t.match(/^(\d{1,2}):(\d{2})$/);if(!e)throw new SDKError("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 SDKError("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 capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const e=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:e[0]||"",category2:e[1]||"",category3:e[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async getAllConfigs(){try{const t=await this.client.get("/configs");return t.data}catch(t){throw this.logger.error("Error fetching configs",t),new SDKError("Failed to fetch all configs: "+(null==t?void 0:t.message))}}async setPersistedStore(t,e){try{if(!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!e||0===Object.keys(e).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+t,{body:e})}catch(n){this.logger.error("Error setting persisted store",n)}}async getPersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to get persisted store"),null;const e=await this.client.get("/configs/store/"+t);return e.data}catch(e){return this.logger.error("Error fetching persisted store",e),null}}async deletePersistedStore(t){try{if(!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+t+"/delete")}catch(e){this.logger.error("Error deleting persisted store",e)}}async getAddressSuggestions(t){try{if(!t||0===t.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const e=await this.client.post("/address/autocomplete",{body:{input:t}});return e.data}catch(e){return this.logger.error("Error fetching address suggestions",e),[]}}async getAddressDetails(t){try{if(!t||0===t.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const e=await this.client.post("/address/details",{body:{id:t}});return e.data}catch(e){throw this.logger.error("Error fetching address details",e),new SDKError("Failed to fetch address details: "+(null==e?void 0:e.message))}}async getProductsData(t,e){try{if(0===t.length)return this.logger.error("No product identifiers provided"),null;const n={identifiers:t,location:e},i=await this.client.post("/product/availability",{body:n});return i.data}catch(n){return this.logger.error("Error fetching product data",n),null}}async catalogSearch(t){var e;try{const e=await this.client.post("/product/search",{body:t});return e.data}catch(n){return this.logger.error("Error fetching catalog search data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),{products:[],retailers:{},navigation:{currentPage:1,totalPages:0,totalCount:0,filters:[]}}}}async getCartData(t){try{const e=await this.client.post("/cart/get",{body:{id:t||void 0}});return e.data}catch(e){throw this.logger.error("Error fetching cart data",e),new SDKError("Failed to fetch cart data: "+e.message)}}async updateCart(t){try{const e=await this.client.post("/cart/update",{body:t});return e.data}catch(e){throw this.logger.error("Error updating cart",e),new SDKError("Failed to update cart: "+(null==e?void 0:e.message))}}async prepareCheckout(t){var e;try{const e=await this.client.post("/checkout/prepare",{body:t});return e.data}catch(n){throw this.logger.error("Error fetching prepare checkout data:",null!==(e=null==n?void 0:n.message)&&void 0!==e?e:n),new SDKError("Failed to fetch prepare checkout data: "+(null==n?void 0:n.message))}}async getPaymentSession(t){var e;try{const e=await this.client.post("/checkout/payment/session",{body:t});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),new SDKError("Failed to get payment session: "+(null==n?void 0:n.message))}}async confirmPaymentSession(t,e){try{const n=await this.client.post("/checkout/payment/confirm",{body:{confirmationTokenId:t,setupIntentId:e}});return n.data}catch(n){throw this.logger.error("Error confirming payment session",n),new SDKError("Failed to confirm payment session: "+(null==n?void 0:n.message))}}async checkoutComplete(t){var e;try{const e=await this.client.post("/checkout/complete",{body:t});return e.data}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 SDKError("Failed to complete checkout: "+(null==n?void 0:n.message));throw n}}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(t,e)=>t||e&&e.status>=500&&e.status<600?!![]:![],this.xhrFetch=(t,e)=>new Promise((n,i)=>{const o=new XMLHttpRequest;o.open(e.method||"GET",t);for(const[t,r]of Object.entries(e.headers))o.setRequestHeader(t,r);o.onload=()=>{const t={ok:o.status>=200&&o.status<300,status:o.status,statusText:o.statusText,headers:o.getAllResponseHeaders().split("\r\n").reduce((t,e)=>{const[n,i]=e.split(": ");return n&&i&&(t[n]=i),t},{}),o:o.responseText,json:()=>Promise.resolve(JSON.parse(o.responseText)),text:()=>Promise.resolve(o.responseText)};n(t)},o.onerror=()=>{i(new TypeError("Network request failed"))},o.ontimeout=()=>{i(new TypeError("Network request timed out"))},o.timeout=3e4,o.send(e.body)}),this.fetchImpl=this.getFetchImplementation()}async request(t){var e,n,i;const{url:o,options:r,retryConfig:s}=t,a=null!==(e=null==s?void 0:s.maxRetries)&&void 0!==e?e:3,c=null!==(n=null==s?void 0:s.retryDelay)&&void 0!==n?n:1e3,l=null!==(i=null==s?void 0:s.shouldRetry)&&void 0!==i?i:this.defaultShouldRetry;let d;const u=Date.now();for(let m=0;m<=a;m++){let t=Date.now();try{t=Date.now();const e=await this.fetchImpl(o,r),n=Date.now()-t;if(e.ok)return e;if(await this.logFailedResponse(o,r,e,n,m,a),m<a&&l(null,e)){await this.delay(c*2**m);continue}return e}catch(p){const e=Date.now()-t;if(d=p,this.logNetworkError(o,r,p,e,m,a),m<a&&l(p,void 0)){await this.delay(c*2**m);continue}throw this.enhanceError(p,o,r,Date.now()-u)}}throw this.enhanceError(d,o,r,Date.now()-u)}async logFailedResponse(t,e,n,i,o,r){const s=o<r;let a,c;try{n.o||(n.o=await n.text());try{a=JSON.parse(n.o)}catch(l){a=n.o}}catch(d){a="[Unable to read response body]"}if(e.body)try{c=JSON.parse(e.body)}catch(u){c=e.body}this.logger.error("HTTP request failed",{method:e.method,url:t,status:n.status,statusText:n.statusText,duration:i+"ms",attempt:o+1+"/"+(r+1),willRetry:s,requestHeaders:this.sanitizeHeaders(e.headers),requestBody:c,responseHeaders:this.sanitizeHeaders(n.headers),responseBody:a})}logNetworkError(t,e,n,i,o,r){var s;const a=o<r;this.logger.error("Network request failed",{method:e.method,url:t,error:(null==n?void 0:n.message)||"Unknown error",errorType:(null===(s=null==n?void 0:n.constructor)||void 0===s?void 0:s.name)||typeof n,duration:i+"ms",attempt:o+1+"/"+(r+1),willRetry:a,possibleCauses:this.diagnosePossibleCauses(n)})}diagnosePossibleCauses(t){var e,n,i,o,r;const s=[];return((null===(e=null==t?void 0:t.message)||void 0===e?void 0:e.includes("timeout"))||(null===(n=null==t?void 0:t.message)||void 0===n?void 0:n.includes("timed out")))&&s.push("Request timeout - server took too long to respond"),((null===(i=null==t?void 0:t.message)||void 0===i?void 0:i.includes("Failed to fetch"))||(null===(o=null==t?void 0:t.message)||void 0===o?void 0:o.includes("Network request failed")))&&(s.push("Network connectivity issue"),s.push("CORS policy blocking the request"),s.push("Server is not responding"),s.push("Request was blocked by browser or firewall")),(null===(r=null==t?void 0:t.message)||void 0===r?void 0:r.includes("aborted"))&&s.push("Request was aborted"),0===s.length&&s.push("Unknown network error"),s}enhanceError(t,e,n,i){const o=new Error((null==t?void 0:t.message)||"Network request failed - no response from server");return o.url=e,o.method=n.method,o.totalDuration=i+"ms",o.isNetworkError=!![],o.originalError=t,o.possibleCauses=this.diagnosePossibleCauses(t),o}sanitizeHeaders(t){const e={...t},n=["authorization","x-liquid-api-key","cookie","set-cookie"];for(const i of Object.keys(e))n.includes(i.toLowerCase())&&(e[i]="[REDACTED]");return e}delay(t){return new Promise(e=>setTimeout(e,t))}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):window.fetch?this.fetchAdapter(window.fetch):this.xhrFetch}fetchAdapter(t){return async(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}const s={ok:o.ok,status:o.status,statusText:o.statusText,headers:r,json:async()=>(s.o||(s.o=await o.text()),JSON.parse(s.o)),text:async()=>(s.o||(s.o=await o.text()),s.o)};return s}}}class AuthClientService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.authPromise=null,this.shouldRetryNonAuth=(t,e)=>t?!![]:e&&this.isAuthError(e)?![]:e&&e.status>=500&&e.status<600,this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(t))}async authenticate(){if(this.authPromise)return this.authPromise;this.authPromise=this.performAuthentication();try{return await this.authPromise}finally{this.authPromise=null}}async performAuthentication(){var t,e,n,i;try{const o=await this.request("/auth",{method:"GET"},!![]);return(null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.token)&&(null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.exp)?(this.accessToken=o.data.token,this.tokenExpiration=o.data.exp-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,!![]):(this.logger.error("Authentication response missing required fields",{hasToken:!!(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.token),hasExp:!!(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.exp),response:null==o?void 0:o.data}),![])}catch(o){return this.logger.error("Failed to obtain access token from authentication endpoint",{error:(null==o?void 0:o.message)||o,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),![]}}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}async request(t,e,n=![],i=![]){if(!n&&(!this.accessToken||this.isTokenExpired())){const t=await this.authenticate();if(!t)throw{status:401,message:"Authentication failed - unable to obtain valid access token",isAuthError:!![]}}const o=this.buildUrl(t),r=this.buildHeaders(e.headers,n),s=n?"API Key":"Bearer Token";let a;try{a=await this.httpClient.request({url:o,options:{method:e.method,headers:r,body:e.body?JSON.stringify(e.body):void 0},retryConfig:{maxRetries:AuthClientService.MAX_RETRIES,retryDelay:AuthClientService.RETRY_DELAY_MS,shouldRetry:this.shouldRetryNonAuth}})}catch(c){throw this.logNetworkError(t,e.method,s,c,r),this.createNetworkError(c,o,e.method)}return a.ok?this.handleSuccessResponse(a,t,e.method,s,r):!this.isAuthError(a)||n||i?this.handleErrorResponse(a,t,e.method,s,r):this.handleAuthError(a,t,e,r)}async handleSuccessResponse(t,e,n,i,o){try{return await t.json()}catch(r){const s=await t.text().catch(()=>"Success");return this.logger.error("Response returned 2xx status but body is not valid JSON",{path:e,method:n,status:t.status,authType:i,responsePreview:s.substring(0,200),error:null==r?void 0:r.message,requestHeaders:o,responseHeaders:t.headers||{}}),{message:s}}}async handleAuthError(t,e,n,i){this.logger.warn("Access token rejected with "+t.status+", attempting to obtain new token and retry request",{status:t.status,statusText:t.statusText,path:e,method:n.method,requestHeaders:i,responseHeaders:t.headers||{}}),this.clearToken();const o=await this.authenticate();return o?this.request(e,n,![],!![]):(this.logger.error("Unable to obtain new access token after receiving auth error, request cannot be retried",{status:t.status,statusText:t.statusText,path:e,method:n.method,requestHeaders:i}),this.handleErrorResponse(t,e,n.method,"Bearer Token",i))}async handleErrorResponse(t,e,n,i,o){var r;let s,a="";try{s=await t.json(),a=JSON.stringify(s)}catch(c){a=await t.text().catch(()=>"HTTP error status: "+t.status),s={message:a||"Unknown error"}}throw this.logger.error(n+" "+e+" failed with "+t.status+" "+t.statusText,{path:e,method:n,authType:i,status:t.status,statusText:t.statusText,message:null==s?void 0:s.message,requestId:null===(r=null==s?void 0:s.metadata)||void 0===r?void 0:r.requestId,responseBody:a,requestHeaders:o,responseHeaders:t.headers||{}}),{...s,status:t.status,message:(null==s?void 0:s.message)||"Request failed"}}buildUrl(t){const e=this.clientConfig.getProxyConfig();return new URL("api"+t,e?e.baseUrl:this.baseUrl).toString()}buildHeaders(t,e=![]){const n={"Content-Type":"application/json","X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now(),"X-Liquid-UD-ID":this.clientConfig.get("userDeviceId")||"unknown",...this.getProxyHeaders(),...t};return e?n["X-Liquid-Api-Key"]=this.apiKey:n.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(n["X-Liquid-Api-Builder"]=!![]),n}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}isAuthError(t){return 401===t.status||403===t.status}clearToken(){this.accessToken=null,this.tokenExpiration=null}logNetworkError(t,e,n,i,o){this.logger.error("Network error: "+e+" "+t+" failed after "+AuthClientService.MAX_RETRIES+" retries - unable to reach server",{path:t,method:e,authType:n,error:null==i?void 0:i.message,possibleCauses:null==i?void 0:i.possibleCauses,maxRetries:AuthClientService.MAX_RETRIES,requestHeaders:o})}createNetworkError(t,e,n){return{status:0,message:(null==t?void 0:t.message)||"Network error: Unable to connect to the API",url:e,method:n,isNetworkError:!![],originalError:t}}async get(t,e){return this.request(t,{method:"GET",headers:null==e?void 0:e.headers})}async post(t,e){return this.request(t,{method:"POST",body:null==e?void 0:e.body,headers:null==e?void 0:e.headers})}}AuthClientService.TOKEN_EXPIRATION_BUFFER_MS=6e5,AuthClientService.MAX_RETRIES=2,AuthClientService.RETRY_DELAY_MS=1e3;const w="@liquidcommerce/elements-sdk",C="LiquidCommerce Elements SDK",k="UNLICENSED",S="LiquidCommerce Team",E="2.6.2",_="https://docs.liquidcommerce.co/elements-sdk",D={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},I={url:"https://github.com/liquidcommerce/elements-sdk/issues"},T="./dist/index.esm.js",z="./umd/elements.js",L="./dist/types/index.d.ts",B="pnpm@10.0.0",j={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},V=["dist","umd","docs","README.md","LICENSE"],G={access:"public",registry:"https://registry.npmjs.org/"},K="module",Y=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],W={build:"rollup -c","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build:dev",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},Q=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],J={"@biomejs/biome":"2.3.8","@commitlint/cli":"^20.2.0","@commitlint/config-conventional":"^20.2.0","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.2","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.10.2","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.53.3","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},$={node:">=22"},tt={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},et={name:w,description:C,license:k,author:S,version:E,homepage:_,repository:D,bugs:I,module:T,browser:z,types:L,packageManager:B,exports:j,files:V,publishConfig:G,type:K,sideEffects:Y,scripts:W,keywords:Q,devDependencies:J,engines:$,pnpm:tt};class GoogleTagManagerService{constructor(){this.enablePartnerGTM=![],this.enableLiquidCommerceGTM=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(t){const e=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return e.some(e=>{const n=e.src;return n.includes("id="+t)})}isContainerInitialized(t){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(t)?window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event)):![]}async loadGTMScript(t){try{if(this.isContainerInitialized(t))return{success:!![],usingExistingGTM:!![],message:"Container "+t+" already loaded"};if(this.isContainerLoaded(t)){const e=await this.waitForContainerInit(t,1e4);return e?{success:!![],usingExistingGTM:!![],message:"Container "+t+" initialized"}:this.checkFallbackGTM(t)}return await this.injectGTMScript(t),{success:!![],usingExistingGTM:![],message:"Container "+t+" loaded successfully"}}catch(e){return this.checkFallbackGTM(t)}}waitForContainerInit(t,e){return new Promise(n=>{let i;const o=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(o),clearTimeout(i),n(!![]))},100);i=setTimeout(()=>{clearInterval(o),n(![])},e)})}injectGTMScript(t){return new Promise((e,n)=>{const i=document.createElement("script");i.src="https://www.googletagmanager.com/gtm.js?id="+t,i.async=!![],i.crossOrigin="anonymous";let o=![];const r=setTimeout(()=>{o||(o=!![],this.isContainerInitialized(t)?e():n(new Error("GTM script timeout")))},15e3);i.onload=()=>{o||setTimeout(()=>{o||(o=!![],clearTimeout(r),this.isContainerInitialized(t)||window.dataLayer&&Array.isArray(window.dataLayer)?e():n(new Error("GTM script loaded but failed to initialize")))},500)},i.onerror=()=>{setTimeout(()=>{o||(o=!![],clearTimeout(r),this.isContainerLoaded(t)&&this.isContainerInitialized(t)?e():n(new Error("GTM script failed to load")))},100)},document.head.appendChild(i)})}checkFallbackGTM(t){if(this.isGTMAlreadyLoaded()&&window.dataLayer&&Array.isArray(window.dataLayer)){if(this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId))return{success:!![],usingExistingGTM:!![],message:"Using partner GTM container"};const t=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));if(t)return{success:!![],usingExistingGTM:!![],message:"Using existing GTM container"}}return window.dataLayer&&Array.isArray(window.dataLayer)?{success:!![],usingExistingGTM:!![],message:"Using basic dataLayer for event tracking"}:{success:![],usingExistingGTM:![],message:"Failed to load container "+t+" and no fallback available"}}processEventQueue(){const t=Date.now(),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)}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.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&t.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&t.push(this.partnerGTMId),t}async initialize(t){try{if(this.isInitialized)return Promise.resolve();if(this.isInitializing&&this.initializationPromise)return this.initializationPromise;if(0,this.clientConfigService.isBuilder())return;this.isInitializing=!![],this.initializationPromise=this.doInitialize(t),await this.initializationPromise}catch(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))return;if(!t.enableLiquidCommerceGTM&&!t.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerCode=t.partnerCode,this.partnerGTMId=t.partnerGTMId,this.liquidCommerceGTMId=t.liquidCommerceGTMId,this.enablePartnerGTM=t.enablePartnerGTM,this.enableLiquidCommerceGTM=t.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...t)=>window.dataLayer.push(t));const e=t.enableLiquidCommerceGTM?await this.loadGTMScript(t.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!e.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+e.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(e.message),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_name:this.partnerName,tenant_code:this.partnerCode,tenant_source:et.description+" v"+et.version};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:e,eventData:o,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const r={event:e,...o};window.dataLayer.push(r)}catch(i){this.logger.error("GTM "+t+" error",i)}}calculateValue(t){const e=t.reduce((t,e)=>t+(e.price||0)*(e.quantity||1),0);return Number.parseFloat(e.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,e,n){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:e,item_list_name:n,items:t})}selectItem(t,e,n){this.executeEvent("selectItem","select_item",{item_list_id:e,item_list_name:n,items:[t]})}addToCart(t){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([t]),quantity:t.quantity||1,items:[t]})}viewCart(t){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(t),items:t})}removeFromCart(t){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}beginCheckout(t,e){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addShippingInfo(t,e){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:e,items:t})}addPaymentInfo(t,e,n){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:e,coupon:n,items:t})}purchase(t){this.executeEvent("purchase","purchase",{transaction_id:t.transaction_id,value:t.value,currency:this.currency,tax:t.tax,shipping:t.shipping,coupon:t.coupon,items:t.items,subtotal:t.subtotal,total:t.total_before_discounts,discounts:t.discounts,gift_cards:t.gift_cards,net_total:t.net_total})}promoCodeAttempt(t){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:t})}promoCodeApplied(t,e){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:e})}promoCodeFailed(t,e){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:e})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,e){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:e})}giftCardFailed(t,e){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:e})}addressUpdated(t){this.executeEvent("addressUpdated","address_updated",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,coordinates:t.coordinates})}addressFailed(t){this.executeEvent("addressFailed","address_failed",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,address_error_message:t.error})}productNoAvailability(t){this.executeEvent("productNoAvailability","product_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productSizeNoAvailability(t){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productFulfillmentNoAvailability(t){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,fulfillment_type:t.fulfillmentType,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:e,next:n})=>{const i=performance.now();try{const o=n(),r=performance.now()-i;return this.logger.info("🏪 Store "+t+" ✓ "+r.toFixed(3)+"ms",e),o}catch(o){const n=performance.now()-i;throw this.logger.error("🏪 Store "+t+" ✗ "+n.toFixed(3)+"ms",{payload:e,error:o}),o}},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=x,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=this.clientConfig.get("localStorageKeyPrefix")+"_"+t,this.isLocalStorageAvailable=e,e?await this.loadPersistedState():n&&await this.loadFromDBPersistence(n),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,m)}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 N=()=>{if(i>=this.middleware.length)return n();const o=this.middleware[i++];return o({action:t,payload:e,state:this.getState(),next:N})};return N()}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()}async persist(){var t;const e=this.get("address.id")||"",n=this.get("cart.id");if(!e&&!n)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:e,cartId:n}),void 0;try{const i=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";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",i)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.info("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.info("localStorage entry completely removed",{key:this.localStorageKey})}catch(et){this.logger.error("Failed to clear localStorage entry",et)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const e=this.get("address.id")||"",n=this.get("cart.id");(e||n)&&(t=e+":"+n)}else t=this.getState();t&&localStorage.setItem(this.localStorageKey,"string"!=typeof t?JSON.stringify(t):t)}catch(t){this.logger.error("Failed to persist store state",t)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const e=localStorage.getItem(this.localStorageKey);if(!e)return;try{const t=JSON.parse(e);for(const[e,n]of Object.entries(t))this.set(e,n);return}catch(t){if(e.includes(":")){const[t,n]=e.split(":");if(void 0!==t){const e=await this.getAddressDataFromId(t);this.set("address",e)}return void 0!==n&&this.set("cart.id",n||""),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:e})}}catch(e){this.logger.error("Failed to load persisted state",e),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const e=await this.getAddressDataFromId(t.p);this.set("address",e)}void 0!==t.c&&this.set("cart.id",t.c||""),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)}}async getAddressDataFromId(t){if(!t||""===t.trim())return p;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:{latitude:e.coordinates.latitude,longitude:e.coordinates.longitude}}:{...p,id:t}}catch(e){return{...p,id:t}}}}const nt=[o.PRODUCT,o.PRODUCT_IMAGE_CAROUSEL,o.PRODUCT_OPTIONS,o.PRODUCT_INTERACTIONS,o.PRODUCT_DESCRIPTION,o.PRODUCT_RETAILERS,o.PRODUCT_RETAILERS_CAROUSEL,o.PRODUCT_RETAILERS_POPUP,o.PRODUCT_RETAILERS_POPUP_LIST,o.PRODUCT_PRICE,o.PRODUCT_ADD_TO_CART_SECTION,o.PRODUCT_DRAWER,o.PRODUCT_LOADING,o.ENGRAVING_FORM,o.ENGRAVING_VIEW,o.PRODUCT_LIST,o.PRODUCT_LIST_CARD,o.PRODUCT_LIST_CARD_LOADING,o.PRODUCT_LIST_FILTERS],it=[o.ADDRESS_INPUT,o.ADDRESS_DISPLAY],ot=[o.CART,o.CART_RETAILER,o.CART_ITEM,o.CART_FOOTER,o.CART_ITEM_QUANTITY_PRICE,o.CART_RETAILER_SUBTOTAL,o.CART_PROMO_CODE,o.CART_HEADER,o.CART_BODY,o.CART_FULFILLMENT,o.BUTTONS_CART_OPEN],rt=[o.CHECKOUT,o.CHECKOUT_INFORMATION,o.CHECKOUT_STRIPE_HANDLER,o.CHECKOUT_STRIPE_FORM,o.CHECKOUT_PAYMENT,o.CHECKOUT_BILLING,o.CHECKOUT_ORDER_SUMMARY,o.CHECKOUT_PROMO_CODE,o.CHECKOUT_GIFT_CARDS,o.CHECKOUT_AMOUNTS,o.CHECKOUT_ITEMS,o.CHECKOUT_COMPLETED,o.CHECKOUT_DELIVER_TO,o.CHECKOUT_DELIVER_TO_SUMMARY,o.CHECKOUT_BUYER,o.CHECKOUT_TIPS,o.CHECKOUT_PC_GC,o.CHECKOUT_ITEM,o.CHECKOUT_ITEM_QUANTITY,o.CHECKOUT_PLACE_ORDER_BUTTON,o.CHECKOUT_HEADER,o.CHECKOUT_PRESALE_COUNTDOWN,o.CHECKOUT_PRESALE_EXPIRED,o.CHECKOUT_SEND_AS_GIFT];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,e="swap"){if(!t||0===t.length)return;const n=[...this.defaultFontFamilies,...t],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["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,e),n&&n.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),e=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!t){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",document.head.appendChild(t)}if(!e){const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="",document.head.appendChild(t)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const t=document.createElement("link");t.rel="stylesheet",t.href=this.googleFontsUrl,t.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(t)}}const getProductListStyles=()=>"\n .product-list {\n width: 100%;\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-search__control-container {\n max-width: 500px;\n width: 100%;\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-icon:hover svg {\n cursor: pointer;\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n }\n\n /* Filters in Drawer */\n .product-list-filters-drawer-content {\n padding: 20px;\n overflow-y: auto;\n max-height: 100%;\n }\n\n .product-list-filters-drawer-content .product-list-filters-container {\n position: static;\n width: 100%;\n top: 0;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n /* Filters Container */\n .product-list-filters-container {\n width: 20%;\n height: fit-content;\n position: sticky;\n top: 24px;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 24px 24px;\n position: static;\n height: 100%;\n overflow-y: auto;\n padding-bottom: 80px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #e5e7eb);\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .product-list-filters-personalized > *:not(:last-child),\n .product-list-filters-pre-order > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-personalized-label,\n .product-list-filters-pre-order-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-delivery-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-delivery-options-header:hover .product-list-filters-delivery-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-personalized:hover .product-list-filters-personalized-label, \n .product-list-filters-pre-order:hover .product-list-filters-pre-order-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n }\n\n .product-list-filters-delivery-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-delivery-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-delivery-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-delivery-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-delivery-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-delivery-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-delivery-option {\n display: flex;\n align-items: center;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n \n .product-list-filters-delivery-option > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-delivery-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-delivery-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-delivery-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:focus,\n .product-list-filters-delivery-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-delivery-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-delivery-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:disabled + .product-list-filters-delivery-radio-label {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+d.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.18s ease-out;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Inputs */\n .product-list-filters-delivery-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n /* Price Range Slider */\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n /* Range Slider */\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--default-text-color, #111827);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n /* Text Inputs Container */\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n /* Checkbox Filter Header */\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-toggle-icon.collapsed {\n transform: rotate(0deg);\n }\n\n .checkbox-filter-toggle-icon.expanded {\n transform: rotate(0deg);\n }\n\n /* Checkbox Filter Content */\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n /* Search Input */\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n /* Checkbox List */\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n /* Custom Scrollbar */\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n /* Checkbox Items */\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 12px 24px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n /* No Results */\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n cursor: pointer;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Product List Card Styles */\n .product-list-card.standard {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #f3f4f6);\n border-radius: var(--card-border-radius, 0.375rem);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.fill {\n background-color: #ffffff;\n }\n\n .product-list-card.standard.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card.standard.not-available:hover {\n cursor: not-allowed;\n }\n\n .product-list-card.standard .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n padding-bottom: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .product-list-card.standard .plc__content {\n width: 100%;\n padding: 0 10px;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .product-list-card.standard .plc__content .plc__title {\n width: 100%;\n height: 4.6875rem;\n font-size: 1.125rem;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n margin-bottom: 10px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n line-height: 1.38;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n .product-list-card.standard .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__image-link:hover {\n text-decoration: none;\n }\n\n .product-list-card.standard .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .product-list-card.standard .plc__title-link .plc__title {\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n font-family: var(--paragraph-font-family, Poppins);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 1rem;\n font-weight: 600;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: auto;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n padding: 0.5rem 0.375rem;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #3b82f6);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n .product-list-sentinel-container > *:not(:last-child) {\n margin-top: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-error-container > *:not(:last-child) {\n margin-top: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Responsive Styles */\n\n /* Mobile and Tablet - Below 1024px */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n /* Hide filters in main product list on mobile */\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n /* Show filters in drawer on mobile */\n .product-list-filters-drawer-wrapper .product-list-filters-container {\n display: block;\n position: static;\n width: 100%;\n padding: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n /* Mobile - 1 column (up to 639px) */\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card.standard {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n /* Small tablets - 2 columns (640px to 767px) */\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card.standard {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n /* Tablets - 3 columns (768px to 1023px) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card.standard {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n /* Desktop - Use configured columns (1024px and up) */\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card.standard {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+d.ADDRESS_SUGGESTIONS+";\n list-style: none;\n overflow-y: auto;\n padding: 4px 0;\n align-self: stretch;\n border-radius: 0 0 6px 6px;\n border-right: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n border-left: 1px solid var(--accent-color, #E4E4E7);\n background: var(--drawer-background-color, #FAFAFA);\n }\n\n .address-input-container .suggestions-list.show {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n .address-input-container .suggestions-list.hide {\n display: none;\n }\n\n .address-input-container .suggestions-list.show {\n display: block;\n }\n\n .address-input-container .suggestion-item {\n display: flex;\n padding: 6px 8px;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n text-align: left;\n }\n\n .address-input-container .suggestion-item > span {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n flex: 1 0 0;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .address-input-container .suggestion-item:hover {\n border-radius: 2px;\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--default-text-color-50, #E4E4E7);\n }\n\n .address-input-container .suggestion-item.no-suggestions {\n color: var(--warning-color, #6B7280);\n text-align: center;\n cursor: default;\n }\n\n .address-input-container .suggestion-item.no-suggestions:hover {\n background-color: transparent;\n }\n\n .address-input-container .error-message {\n display: flex;\n align-items: center;\n padding: 12px;\n border: 1px solid var(--error-color, #B91C1C);\n border-radius: var(--card-border-radius, 6px);\n color: var(--error-color, #B91C1C);\n font-size: 14px;\n position: relative;\n z-index: "+d.ERROR_MESSAGE+";\n }\n\n .address-input-container .error-icon {\n font-size: 16px;\n margin-right: 8px;\n }\n\n .address-input-container .error-text {\n flex: 1;\n }\n\n .address-input-container .action-buttons {\n display: flex;\n justify-content: space-between;\n position: relative;\n z-index: "+d.ADDRESS_ACTIONS+";\n }\n\n .address-input-container .action-buttons > button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n transition: all 0.2s ease;\n width: 50%;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .address-input-container .action-buttons > button:not(:first-child) {\n margin-left: 8px;\n }\n\n .address-input-container .action-buttons .secondary-button {\n color: var(--default-text-color, #18181B);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .action-buttons .primary-button {\n color: var(--selected-text-color, #18181B);\n background-color: var(--primary-color, #E4E4E7);\n border: 1px solid transparent;\n }\n\n .privacy-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\n color: var(--default-text-color, #18181B);\n text-align: left;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .address-input-container .suggestion-item > span {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .address-display-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .address-display-container > span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .address-display-container > button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n text-align: left;\n }\n",getCartStyles=()=>"\n .cart-container {\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .cart-container.no-header .cart-body {\n padding: 0 0 16px 0;\n }\n\n .cart-container.no-header .cart-footer {\n padding: 16px 0 0 0;\n }\n\n .cart-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n position: sticky;\n top: 0;\n background-color: var(--drawer-background-color, #FFFFFF);\n z-index: "+d.CART_HEADER+";\n }\n\n .cart-header-content {\n width: 100%;\n height: 48px;\n display: flex;\n align-items: center;\n align-self: stretch;\n justify-content: space-between;\n padding: 16px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .cart-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-header-close-btn {\n font-size: 1.4rem;\n font-weight: 300;\n border: none;\n background: none;\n }\n\n .cart-header-close-btn:hover {\n cursor: pointer;\n }\n\n .cart-body {\n position: relative;\n flex: 1;\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-self: stretch;\n }\n\n .cart-body > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .empty-cart-container {\n display: flex;\n align-self: center;\n margin: auto;\n }\n\n .retailer-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .section-header-label {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n }\n\n .cart-fulfillment-subtotal {\n color: var(--default-text-color, #18181B);\n }\n\n .section-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-retailer-header {\n display: flex;\n flex-direction: column;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-info {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .retailer-body-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n flex-direction: column;\n max-height: 2000px;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .retailer-subtotal-container {\n display: flex;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailer-subtotal-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-subtotal-amount {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-fulfillment-container {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n max-height: 2000px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-fulfillment-container > .cart-item-container {\n margin-top: 16px;\n }\n\n .cart-item-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item-container > *:not(:first-child) {\n margin-top: 12px;\n }\n\n .cart-item {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .item-image {\n display: flex;\n width: 56px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .item-details {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-details > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .quantity-price {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .item-title {\n font-weight: 500;\n font-size: 0.95rem;\n word-break: break-word;\n margin: 0;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-specs {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-shipping-container {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .cart-add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .item-shipping {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-quantity {\n display: flex;\n width: 106px;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .quantity-btn-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-decrease {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease:disabled,\n .quantity-btn-increase:disabled,\n .quantity-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .quantity-value {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-quantity.outlined .quantity-value {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .item-price-container {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n align-content: center;\n flex: 1 0 0;\n flex-wrap: wrap;\n }\n\n .item-price-container > *:not(:first-child) {\n margin-left: 6px;\n }\n\n .item-price {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .item-price-per-unit {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .item-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n align-self: stretch;\n }\n\n .cart-footer {\n margin-top: auto;\n display: flex;\n min-height: 146px;\n padding: 16px;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n align-self: stretch;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n flex-shrink: 0;\n }\n\n .cart-footer > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .cart-footer-header {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n }\n\n .cart-footer-header > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .cart-footer-header .cart-footer-items-price {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n\n .cart-footer-header .subtotal-text {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .subtotal-price {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .taxes-fees-info {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n max-width: 85%;\n }\n\n .promo-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n width: 100%;\n border-radius: var(--button-border-radius, 6px);\n }\n\n .promo-input.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .promo-input.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .checkout-button {\n display: flex;\n position: relative;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border: none;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #F1F5F9);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+d.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .checkout-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n /* CSS-only accordions */\n .chevron {\n transition: transform 0.3s ease;\n }\n\n /* Product section accordions */\n .section-toggle {\n display: none;\n }\n\n .section-toggle:checked + .section-header-label .chevron {\n transform: rotate(180deg);\n color: var(--default-text-color, #18181B);\n }\n\n .retailer-section.collapsed .retailer-body-container {\n max-height: 0;\n }\n\n .retailer-section.collapsed .cart-retailer-header {\n border-bottom: none;\n }\n\n .shipping-content {\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease-out;\n padding-left: 20px;\n }\n\n /** * Loading spinner styles */\n .cart-loading-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: var(--drawer-background-color-30, #E4E4E7);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: "+d.CART_LOADING+";\n }\n\n /* Modern browsers with backdrop-filter support */\n @supports (backdrop-filter: blur(1px)) {\n .cart-loading-backdrop {\n background-color: var(--drawer-background-color-30, #E4E4E7);\n backdrop-filter: blur(1px);\n }\n }\n\n .cart-loading-spinner-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .cart-loading-spinner {\n margin-bottom: 16px;\n }\n\n .cart-spinner {\n animation: cart-spinner-rotate 2s linear infinite;\n color: var(--primary-color, #1D4ED8);\n }\n\n .cart-spinner-path {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: 0;\n stroke-linecap: round;\n animation: cart-spinner-dash 1.5s ease-in-out infinite;\n }\n\n @keyframes cart-spinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n @keyframes cart-spinner-dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n }\n\n /*PROMO CODE */\n .promo-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-self: stretch;\n flex: 1;\n }\n\n .promo-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .promo-container-wrapper {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-code-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-input-wrapper {\n flex: 1;\n }\n\n /* Style the InputComponent container */\n .promo-input-wrapper .custom-input {\n margin: 0;\n width: 100%;\n }\n\n /* Hide label in promo context since we have placeholder */\n .promo-input-wrapper .custom-input label {\n display: none;\n }\n\n /* Style the actual input inside the InputComponent */\n .promo-input-wrapper .promo-input {\n width: 100%;\n padding: 12px 16px;\n border: 1px solid #ddd;\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n box-sizing: border-box;\n }\n\n .promo-input-wrapper .promo-input:focus {\n outline: none;\n border-color: var(--primary-color, #1D4ED8);\n }\n\n .promo-input-wrapper .promo-input:disabled {\n background-color: #f8f9fa;\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n .promo-input-wrapper .promo-input.input-error {\n border-color: #dc3545; }\n\n /* Error container styling from InputComponent */\n .promo-input-wrapper .error-container {\n margin-top: 4px;\n min-height: 20px;\n }\n\n .promo-input-wrapper .error-message {\n color: #dc3545;\n font-size: 12px;\n margin: 2px 0;\n display: block;\n }\n\n /* Apply button styling */\n .apply-button {\n display: flex;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .apply-button:hover:not(:disabled) {\n opacity: 0.9;\n }\n\n .apply-button:disabled {\n cursor: not-allowed;\n opacity: 0.7;\n }\n\n /* Applied promo code display - matches the design */\n .promo-applied-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n align-items: center;\n flex: 1;\n }\n\n .promo-code-pill {\n display: flex;\n height: var(--height-h-9, 36px);\n padding: 4px 12px;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px\n }\n\n .promo-remove-btn {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.2s ease;\n text-decoration: underline;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n }\n\n .error-banner {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px) 0 0 var(--card-border-radius, 6px);\n }\n\n .error-banner > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .close-btn {\n border: none;\n font-size: 16px;\n cursor: pointer;\n color: #fff;\n border-radius: 0 var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0;\n padding: 8px 16px;\n\n background: var(--error-color, #DC2626);\n }\n\n /* Mobile responsive */\n .promo-code-pill {\n align-self: flex-start;\n }\n\n .promo-remove-btn {\n align-self: flex-end;\n padding: 4px 8px;\n }\n }\n\n /* Optional: Add loading indicator styles if needed */\n .promo-input-wrapper.loading::after {\n content: '';\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+d.LOADING_INDICATOR+";\n width: 16px;\n height: 16px;\n border: 2px solid var(--accent-color, #E4E4E7);\n border-top: 2px solid var(--accent-color, #E4E4E7);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n\n .empty-cart-content {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getCheckoutStyles=()=>"\n .checkout-container {\n width: 100%;\n height: auto;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n align-self: stretch;\n gap: 24px;\n }\n\n .checkout-container:not(.independent) {\n padding: 24px;\n }\n\n .checkout-container.independent {\n padding: 24px;\n }\n\n .checkout-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 padding-top: 24px;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-delivery-information,\n .checkout-buyer-information,\n .checkout-billing-form {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-delivery-information > *:not(:first-child),\n .checkout-buyer-information > *:not(:first-child),\n .checkout-billing-form > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-billing-form {\n margin-top: 24px;\n }\n\n .checkout-payment-form {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .checkout-payment-form > *:not(:last-child) {\n margin-bottom: 24px;\n }\n\n .delivery-header-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .delivery-title-container {\n display: flex;\n min-width: 200px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .delivery-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .section-title-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .section-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .delivery-title-container > .delivery-title,\n .section-title-container > .section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .delivery-title-container > .delivery-subtitle,\n .section-title-container > .section-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-self: stretch;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .gift-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .gift-toggle-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .gift-label-wrapper {\n display: flex;\n flex-direction: column;\n min-width: 200px;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .gift-toggle-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n z-index: "+d.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .checkout-tips-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tips-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-tip-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-distribution-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-distribution-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-tips-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list.show {\n display: flex;\n }\n\n .checkout-tip-distribution-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-fulfillment-input-wrapper {\n display: flex;\n align-items: center;\n }\n\n .checkout-tip-fulfillment-input-wrapper > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-tip-remove-button {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .checkout-tip-distribution-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-sub-header {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-tip-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-tip-config-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-config-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-tip-selection-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-selection-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-tip-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-tip-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-tip-button > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-tip-input-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-input-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-sections-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-sections-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-pc-gc-sub-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-pc-gc-sub-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-pc-gc-applied {\n display: flex;\n width: 100%;\n flex-direction: row;\n align-self: stretch;\n display: flex;\n padding: 0px 12px;\n justify-content: space-between;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-pc-gc-applied span {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .checkout-pc-gc-applied button {\n display: flex;\n height: 36px;\n padding: 8px 0px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+d.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-send-to-subtitle,\n .checkout-your-info-subtitle,\n .checkout-billing-subtitle,\n .checkout-payment-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-summary-section {\n min-width: 320px;\n max-width: 400px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-summary-section > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-disclaimer-title,\n .checkout-summary-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-disclaimer-subtitle,\n .checkout-summary-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-promo-code-container,\n .checkout-gift-cards-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-promo-code-container > *:not(:first-child),\n .checkout-gift-cards-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .input-promo-code-container,\n .input-gift-card-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n }\n\n .input-promo-code-container > *:not(:first-child),\n .input-gift-card-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .input-promo-code-container .apply-button,\n .input-gift-card-container .apply-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-self: flex-start;\n align-items: center;\n\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .input-promo-code-container .apply-button.disabled,\n .input-gift-card-container .apply-button.disabled {\n background: var(--primary-color-50, #1D4ED8);\n }\n\n .checkout-amounts-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-amounts-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-amount-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-amount-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-total {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n\n }\n\n .checkout-amount-total span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-separator {\n width: 100%;\n height: 1px;\n margin: 0px;\n background: var(--accent-color, #E4E4E7);\n }\n\n .checkout-place-order-button-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-place-order-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n font-family: var(--paragraph-font-family, Poppins);\n align-self: stretch;\n font-weight: 600;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n transition: all 0.2s ease;\n cursor: pointer;\n position: relative;\n }\n\n .checkout-place-order-button-container .alert-container, .checkout-place-order-button-container .alert-wrapper {\n margin-bottom: 24px;\n }\n\n .checkout-place-order-button.ready {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-place-order-button.ready:hover {\n filter: brightness(0.9);\n transform: translateY(-1px);\n }\n\n .checkout-place-order-button.ready:active {\n transform: translateY(0);\n }\n\n /* States when things are missing/wrong - use your opacity variants */\n .checkout-place-order-button.form-invalid,\n .checkout-place-order-button.payment-incomplete,\n .checkout-place-order-button.payment-error {\n background: var(--primary-color-70);\n color: var(--selected-text-color);\n }\n\n .checkout-place-order-button.form-invalid:hover,\n .checkout-place-order-button.payment-incomplete:hover,\n .checkout-place-order-button.payment-error:hover {\n background: var(--primary-color-70);\n }\n\n /* Processing state - keep full primary color to show confidence */\n .checkout-place-order-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .checkout-place-order-button.processing::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+d.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-align: center;\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child, .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+d.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\n }\n\n .checkout-header-container {\n display: flex;\n min-width: 320px;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 8px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-header-button {\n display: flex;\n height: 36px;\n padding: 12px 16px;\n padding-right: 0px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-button > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-header-button-close {\n display: flex;\n height: 36px;\n width: 36px;\n padding: 2px 4px;\n justify-content: center;\n align-items: center;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-title {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-presale-countdown-container {\n display: flex;\n min-width: 320px;\n padding: 12px 24px 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n\n &.is-scrolled {\n box-shadow: 0px 6px 10px -2px var(--primary-color-30);\n }\n\n &.time-warning {\n box-shadow: 0px 6px 10px -2px var(--error-color-30, #FDE68A);\n }\n }\n\n .checkout-presale-countdown {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: 0;\n overflow: hidden;\n }\n\n .checkout-presale-countdown.time-warning {\n background: var(--error-color-30, #FDE68A);\n border: 1px solid var(--error-color, #E4E4E7);\n }\n\n .checkout-presale-countdown.time-warning {\n background: transparent;\n border: none;\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-bar {\n background: var(--error-color-70, #FDE68A);\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-fill {\n background: var(--error-color, #EF4444);\n }\n\n .checkout-presale-text-container {\n display: flex;\n padding: 0px 0px 6px;\n justify-content: flex-end;\n align-self: stretch;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-presale-progress-bar {\n display: flex;\n height: 6px;\n align-items: center;\n align-self: stretch;\n border-radius: 40px;\n background: var(--primary-color-50, #E4E4E7);\n position: relative;\n overflow: hidden;\n }\n\n .checkout-presale-progress-fill {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n z-index: "+d.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--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: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 8px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+d.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 500;\n }\n\n .engraving-view-container .engraving-body {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-view-container .engraving-lines {\n display: flex;\n min-width: 136px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .engraving-view-container .engraving-lines .engraving-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-transform: uppercase;\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-lines .engraving-line:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-actions {\n display: flex;\n align-items: center;\n }\n\n .engraving-view-container .engraving-actions .edit-button {\n margin-left: 16px;\n }\n\n .engraving-view-container .engraving-actions button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n',getImageCarouselStyle=()=>"\n .product-image-carousel {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 100%;\n height: auto;\n min-height: 350px;\n overflow: hidden;\n }\n\n .product-image-carousel.popup {\n max-height: 474px;\n }\n\n .product-image-carousel.carousel {\n max-height: 594px;\n }\n\n .main-image {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n border-radius: var(--card-border-radius, 6px);\n overflow: hidden;\n flex: 1;\n background-image: var(--bg-image, none);\n background-position: center center;\n background-size: contain;\n background-repeat: no-repeat;\n }\n\n .carousel-dots {\n position: absolute;\n bottom: 16px;\n left: 50%;\n transform: translateX(-50%);\n z-index: "+d.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n }\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(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+d.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .add-to-cart-container .add-to-cart-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .add-to-cart-container .add-to-cart-button.disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .product-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-title.hide {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .main-product-price {\n display: inline-block;\n width: fit-content;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 30px;\n font-style: normal;\n font-weight: 600;\n line-height: 36px;\n }\n\n .product-presale-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n text-align: left;\n }\n\n .product-description {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-description > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .product-description .title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .product-description .content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n align-self: stretch;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .product-description .content.collapsed {\n /* Modern browsers with line-clamp support */\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n\n /* Fallback for older browsers */\n max-height: 4.5em; /* 3 lines * 1.5 line-height */\n line-height: 1.5;\n word-wrap: break-word;\n\n /* Additional fallback properties */\n text-overflow: ellipsis;\n white-space: normal;\n }\n\n /* Fallback for browsers without line-clamp support */\n @supports not (-webkit-line-clamp: 3) {\n .product-description .content.collapsed {\n display: block;\n max-height: 4.5em;\n overflow: hidden;\n position: relative;\n }\n\n .product-description .content.collapsed::after {\n content: '...';\n position: absolute;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, transparent, var(--default-background-color, white) 50%);\n padding-left: 20px;\n }\n }\n\n .product-description .collapse-button {\n border-radius: var(--button-border-radius, 6px);\n cursor: pointer;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+d.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-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: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n 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 }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+d.DRAWER_WRAPPER+";\n pointer-events: none;\n }\n\n .drawer-wrapper.open {\n pointer-events: auto;\n }\n\n /* Backdrop overlay */\n .drawer-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: "+d.DRAWER_BACKDROP+";\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n pointer-events: none;\n }\n\n .drawer-backdrop.visible {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n /* Main drawer */\n .drawer {\n position: absolute;\n top: 0;\n right: 0;\n width: 400px;\n height: 100vh; /* Fallback for browsers that don't support dvh */\n height: 100dvh;\n z-index: "+d.DRAWER_CONTENT+";\n background-color: #ffffff;\n overflow: hidden;\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n }\n\n /* Opened drawer state */\n .drawer.open {\n transform: translateX(0);\n }\n\n .drawer.address-input .drawer-content,\n .drawer.engraving-form .drawer-content,\n .drawer.product-retailers-popup-list .drawer-content {\n padding: 16px;\n }\n\n /* Content area - fills the remaining space */\n .drawer-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n background-color: var(--drawer-background-color, #FAFAFA);\n }\n\n /* Content swap animation classes */\n .drawer-content-fade-out {\n opacity: 1;\n transition: opacity 150ms ease-out;\n }\n\n .drawer-content-fade-out.fading {\n opacity: 0;\n }\n\n .drawer-content-fade-in {\n opacity: 0;\n transition: opacity 150ms ease-in;\n }\n\n .drawer-content-fade-in.visible {\n opacity: 1;\n }\n\n /* Mobile adjustments */\n @media (max-width: 576px) {\n .drawer {\n width: 100%;\n }\n }\n\n /* Accessibility - respect user's motion preferences */\n @media (prefers-reduced-motion: reduce) {\n .drawer,\n .drawer-backdrop,\n .drawer-content-fade-out,\n .drawer-content-fade-in {\n transition: none;\n }\n }\n "}const getProductLoadingStyles=()=>"\n .skeleton-container {\n min-width: 320px;\n width: 100%;\n height: auto;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n }\n\n .skeleton-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .skeleton-container .wave {\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .skeleton-container .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+d.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n .sc-main-image {\n width: 100%;\n height: 350px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n flex: 1;\n }\n\n .sc-carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background-color: #c4d1e0;\n margin-right: 10px;\n }\n\n .sc-carousel-dot:last-child {\n margin-right: 0;\n }\n\n .sc-gallery-thumbnail {\n width: 60px;\n height: 60px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-main-image::before { animation-delay: 1.5s; }\n .sc-carousel-dot::before { animation-delay: 1.6s; }\n .sc-gallery-thumbnail::before { animation-delay: 1.7s; }\n\n @media (min-width: 480px) {\n .sc-carousel-dot {\n width: 8px;\n height: 8px;\n margin-right: 8px;\n }\n }\n\n @media (min-width: 769px) {\n .sc-gallery-thumbnail {\n width: 80px;\n height: 80px;\n }\n\n .sc-main-image {\n height: 474px;\n }\n }\n\n @keyframes wave {\n 0% {\n left: -100%;\n }\n 100% {\n left: 100%;\n }\n }\n",getProductListCardLoadingStyles=()=>"\n .product-list-card-loading__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n pointer-events: none;\n background-color: transparent;\n border: none;\n border-radius: var(--card-border-radius, 0.375rem);\n overflow: hidden;\n cursor: default;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n }\n\n .slc__card .wave {\n background-color: #c4d1e0;\n position: relative;\n overflow: hidden;\n }\n\n .slc__card .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+d.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const st={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",linkTextColor:"--link-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},at={backgroundColor:"--product-background-color"},ct={backgroundColor:"--cart-background-color"},lt={backgroundColor:"--address-background-color"},dt={backgroundColor:"--checkout-background-color"},ht={global:st,product:at,cart:ct,address:lt,checkout:dt};function getCSSVariableMapping(t){return ht[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")}}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(et){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(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles(),getProductListStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme)}updateComponentGlobalConfigs(t){var e,n;const i=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=i,((null===(e=t.theme)||void 0===e?void 0:e.headingFont)||(null===(n=t.theme)||void 0===n?void 0:n.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==nt.indexOf(t)?this.getConfigs("product"):-1!==it.indexOf(t)?this.getConfigs("address"):-1!==ot.indexOf(t)?this.getConfigs("cart"):-1!==rt.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===o.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}let n;if(it.includes(t)||t===o.ADDRESS)n="address";else if(nt.includes(t)||t===o.PRODUCT)n="product";else if(ot.includes(t)||t===o.CART)n="cart";else{if(!rt.includes(t)&&t!==o.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;n="checkout"}const i=this.stylesheetGenerator.getStylesheet(n);return i?[...e,i]: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 BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.longitude&&t.coordinates.latitude)return{coordinates:t.coordinates,address:t.address}}}const includeCartEvents=(t,e)=>t.filter(t=>e.includes(t.type)),excludeCartEvents=(t,e)=>t.filter(t=>!e.includes(t.type)),eventsForCart=t=>excludeCartEvents(t,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=t=>{const e=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],n=includeCartEvents(t,e);return n.length>0},includeCheckoutEvents=(t,e)=>t.filter(t=>e.includes(t.type)),eventsForCheckout=t=>includeCheckoutEvents(t,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=t=>includeCheckoutEvents(t,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=t=>includeCheckoutEvents(t,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=t=>{const e=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return t.some(t=>e.includes(t.type))},ut={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"},pt={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:ut[t.type]||"error"})),transformCheckoutEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:pt[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)};class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,e=![]){var i,o,r,s,a;const c=this.store.get("cart");for(const n of Object.keys(c.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(c.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(c.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const l={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.events":[],"cart.promoCode":(null===(i=t.promoCode)||void 0===i?void 0:i.code)?{code:t.promoCode.code.toUpperCase(),discountAmount:t.promoCode.discountAmount||0,error:null}:null};if((null===(o=Object.values(t.items))||void 0===o?void 0:o.length)>0)for(const n of Object.values(t.items))l["cart.items."+n.id]=n;if((null===(r=Object.values(t.retailers))||void 0===r?void 0:r.length)>0)for(const n of Object.values(t.retailers))if(l["cart.retailers."+n.id]=n,(null===(s=Object.values(n.fulfillments))||void 0===s?void 0:s.length)>0)for(const t of Object.values(n.fulfillments))l["cart.fulfillments."+t.id]=t;if((null===(a=t.events)||void 0===a?void 0:a.length)>0&&(l["cart.events"]=transformEventsForCart(t.events||[])),this.store.batch(l),e){const t=this.store.get("cart"),e=this.buildCartLoadedEventData(t);this.pubSub.publishAction(n.CART_LOADED,e)}}buildCartLoadedEventData(t){var e,n;const i=this.store.get("address"),o={};for(const r of Object.keys(t.items||{})){const e=t.items[r];o[r]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,salsifyGrouping:e.salsifyGrouping,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,catPath:e.catPath,volume:e.volume,uom:e.uom,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,name:e.name,brand:e.brand,size:e.size,price:e.price,quantity:e.quantity,maxQuantity:e.maxQuantity,unitPrice:e.unitPrice,mainImage:e.mainImage,attributes:e.attributes}}return{cartId:t.id,promoCodeDiscount:null!==(n=null===(e=t.promoCode)||void 0===e?void 0:e.discountAmount)&&void 0!==n?n:null,subtotal:t.subtotal,itemCount:t.itemsQuantity,items:o,retailers:t.retailers||{},location:(null==i?void 0:i.id)&&i.coordinates&&i.address?{placesId:i.id,formattedAddress:i.formattedAddress,address:i.address,coordinates:i.coordinates}:null}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),e=await this.api.getCartData(t.id);this.syncCartFromResponse(e,!![]),e.id!==t.id&&await this.store.persist()}catch(t){const e=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",e);const i=this.store.get("cart.id");this.pubSub.publishAction(n.CART_FAILED,{cartId:i,message:e}),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,e){const i={type:t,data:e||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:i}),t===o.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),t===o.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===o.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==t?void 0:t.type)===o.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(t){var e,i,o,s,a,c,l,d,u,p,m,g;try{this.store.set("checkout.loading",!![]);const v=t||this.store.get("cart.id"),b=this.store.get("cart");if(0===(null===(e=Object.values(b.items||{}))||void 0===e?void 0:e.length)&&!t)return;const x=this.themeProvider.getConfigs("checkout"),w={canEmail:x.layout.emailOptIn.checked,canSms:x.layout.smsOptIn.checked};if(!v)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const C={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.presale":null,"checkout.updating":![]},k=await this.api.prepareCheckout({cartId:v,marketingPreferences:w});if((null===(i=k.retailers)||void 0===i?void 0:i.length)>0)for(const t of k.retailers)for(const e of t.fulfillments)e.type===r.ON_DEMAND&&(C["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});if((null===(o=k.items)||void 0===o?void 0:o.length)>0){this.store.remove("checkout.items");for(const t of k.items){const e=k.retailers.find(e=>e.id===t.retailerId),n=e.fulfillments.find(e=>e.id===t.fulfillmentId);C["checkout.items."+t.cartItemId]=this.buildCheckoutItemStore(t,e,n)}}k.isPresaleLocked&&k.presaleExpiresAt&&(C["checkout.presale"]={isLocked:k.isPresaleLocked,expiresAt:k.presaleExpiresAt}),C["checkout.token"]=k.token,C["checkout.cartId"]=k.cartId,C["checkout.isGift"]=k.isGift,C["checkout.giftRecipientForm.data"]={firstName:((null===(a=null===(s=k.giftOptions)||void 0===s?void 0:s.recipient)||void 0===a?void 0:a.name)||"").split(" ")[0],lastName:((null===(l=null===(c=k.giftOptions)||void 0===c?void 0:c.recipient)||void 0===l?void 0:l.name)||"").split(" ")[1],email:(null===(u=null===(d=k.giftOptions)||void 0===d?void 0:d.recipient)||void 0===u?void 0:u.email)||"",phone:(null===(m=null===(p=k.giftOptions)||void 0===p?void 0:p.recipient)||void 0===m?void 0:m.phone)||"",message:(null===(g=k.giftOptions)||void 0===g?void 0:g.message)||""},C["checkout.paymentForm.billingSameAsShipping"]=k.billingSameAsShipping,C["checkout.marketingPreferences"]=k.marketingPreferences,C["checkout.giftCards"]=k.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),C["checkout.promoCode"]=k.promoCode.value?{code:k.promoCode.value,discountAmount:k.promoCode.discount}:null,C["checkout.amounts"]=k.amounts,C["checkout.events"]=k.events||[],this.store.batch(C),this.pubSub.publishAction(n.CHECKOUT_LOADED,{cartId:k.cartId})}catch(v){this.store.set("checkout.error",v.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:v.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const e=this.store.get("checkout.isGift"),i=null!=t?t:!e,o={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":i,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":o}),this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{isActive:i})}async toggleBillingSameAsShipping(t){const e=this.store.get("checkout.paymentForm.billingSameAsShipping"),i=null!=t?t:!e;this.store.set("checkout.paymentForm.billingSameAsShipping",i),this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:i})}async toggleMarketingPreferences(t,e){const i=this.store.get("checkout.marketingPreferences."+t),o=null!=e?e:!i,r=this.store.get("checkout.marketingPreferences"),s=this.dataForCheckoutPrepare({marketingPreferences:{...r,[t]:o}}),a=await this.api.prepareCheckout(s);this.store.set("checkout.marketingPreferences",a.marketingPreferences),this.pubSub.publishAction(n.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.batch({"checkout.paymentForm.paymentSession":{key:e.key,secret:e.secret},"checkout.paymentForm.paymentMethod":null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){var n,i,o,r;try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"2035"}};const s=await this.api.confirmPaymentSession(t,e);return s&&s.id&&s.card&&s.card.brand&&s.card.last4&&s.card.expMonth&&s.card.expYear?{id:s.id,card:{brand:null===(n=s.card)||void 0===n?void 0:n.brand,last4:null===(i=s.card)||void 0===i?void 0:i.last4.toString(),expMonth:null===(o=s.card)||void 0===o?void 0:o.expMonth.toString(),expYear:null===(r=s.card)||void 0===r?void 0:r.expYear.toString()}}:(this.store.set("checkout.error","Invalid payment method information received."),null)}catch(s){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){var e;try{this.googleTagManager.promoCodeAttempt(t);const i=this.dataForCheckoutPrepare({}),o=await this.api.prepareCheckout({...i,promoCode:t}),r=0!==o.amounts.discounts,s=null===(e=transformPromoCodeCheckoutEvents(o.events||[]))||void 0===e?void 0:e[0];if(!r){this.store.set("checkout.promoCodeError",s?s.message:'Code "'+t+'" does not exist');const e=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:e,error:(null==s?void 0:s.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==s?void 0:s.message)||"not_applied"),void 0}const a=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:a,discountAmount:o.amounts.discounts,newTotal:o.amounts.total}),this.googleTagManager.promoCodeApplied(t,o.amounts.discounts),await this.partialLoadCheckout({response:o})}catch(i){const e=(null==i?void 0:i.message)||"Failed to apply promo code. Please try again.";this.store.set("checkout.error",e);const o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:e}),this.googleTagManager.promoCodeFailed(t,e),i}}async removePromoCode(){var t,e;try{const i=this.dataForCheckoutPrepare({}),o=(null===(e=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===e?void 0:e.code)||"",r=await this.api.prepareCheckout({...i,promoCode:""});if(0!==r.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;const s=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:s,newTotal:r.amounts.total}),this.googleTagManager.promoCodeApplied(o,0),await this.partialLoadCheckout({response:r})}catch(i){const t=(null==i?void 0:i.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.promoCode.code")||"",o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:t}),e&&this.googleTagManager.promoCodeFailed(e,t),i}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(et){const e=et.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),et}}async applyGiftCard(t){var e;const i=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(i);const t=this.dataForCheckoutPrepare({}),o=t.giftCards||[],r=await this.api.prepareCheckout({...t,giftCards:[...o,i]}),s=null===(e=transformGiftCardCheckoutEvents(r.events||[]))||void 0===e?void 0:e[0],a=hasAnyRetailerGiftCardRestriction(r.events||[]);if(s&&(this.store.set("checkout.giftCardError",s.message),!a))return;const c=r.giftCards.find(t=>t.code.toLowerCase()===i.toLowerCase());if(!c){this.store.set("checkout.giftCardError","Gift card could not be applied");const t=this.store.get("checkout.cartId");return this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t,error:(null==s?void 0:s.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(i,(null==s?void 0:s.message)||"not_applied"),void 0}const l=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:l,newTotal:r.amounts.total}),this.googleTagManager.giftCardApplied(i,c.applied),await this.partialLoadCheckout({response:r})}catch(o){const t=(null==o?void 0:o.message)||"Failed to apply gift card. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:e,error:t}),this.googleTagManager.giftCardFailed(i,t),o}}async removeGiftCard(t){var e;const i=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),o=(null===(e=t.giftCards)||void 0===e?void 0:e.filter(t=>t.toLowerCase()!==i.toLowerCase()))||[],r=await this.api.prepareCheckout({...t,giftCards:o}),s=r.giftCards.find(t=>t.code.toLowerCase()===i.toLowerCase());if(s)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+i),void 0;const a=this.store.get("checkout.cartId");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:a,newTotal:r.amounts.total}),this.googleTagManager.giftCardApplied(i,0),await this.partialLoadCheckout({response:r})}catch(o){const t=(null==o?void 0:o.message)||"Failed to remove gift card. Please try again.";this.store.set("checkout.error",t);const e=this.store.get("checkout.cartId");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:e,error:t}),this.googleTagManager.giftCardFailed(i,t),o}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(et){throw this.store.set("checkout.error",(null==et?void 0:et.message)||"Failed to clear gift card error. Please try again."),et}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(o.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,e){var i,o,r;try{this.store.set("checkout.items."+t+".updating",!![]);const s=this.store.get("checkout.cartId"),a=this.store.get("checkout.items."+t);if(!a)throw new SDKError("Item not found");const c=a.quantity,l=a.quantity+e;if(l<1)return this.removeItem(t,!![]);const d={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:l},u=(null===(r=null===(o=null===(i=a.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(t=>""!==t.trim()))||[];u.length>0&&(d.engravingLines=u);const p=await this.api.updateCart({id:s,items:[d],location:this.getLocation()});this.pubSub.publishAction(e>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartId:s,cartItemId:a.cartItemId,quantity:l,previousQuantity:c});const m=splitCategoryPath(a.catPath),g={item_id:a.liquidId,item_name:a.name,item_brand:a.brand,item_size:a.size,item_category:m.category,item_category2:m.category2,item_category3:m.category3,quantity:Math.abs(e),price:centToDollar(a.unitPrice||0),item_image:a.mainImage,upc:a.upc,grouping_id:a.salsifyGrouping,product_id:a.liquidId};e<0?this.googleTagManager.removeFromCart(g):e>0&&this.googleTagManager.addToCart(g),await this.partialLoadCheckout({cartResponse:p})}catch(s){throw this.store.set("checkout.items."+t+".error",s.message),s}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var e,i,o;try{const r=this.store.get("checkout.items."+t);if(!r)throw new SDKError("Item not found in checkout");if(!(null===(e=r.attributes)||void 0===e?void 0:e.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const s=(null===(o=null===(i=r.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],a={id:r.cartItemId,fulfillmentId:r.fulfillmentId,partNumber:r.partNumber,quantity:r.quantity,engravingLines:[]},c=this.store.get("checkout.cartId"),l=await this.api.updateCart({id:c,items:[a],location:this.getLocation()});this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartId:c,cartItemId:r.cartItemId,engravingLines:[],previousEngravingLines:s}),await this.partialLoadCheckout({cartResponse:l})}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,e){var i,o,r;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("checkout.items."+t+".updating",!![]);const s=this.store.get("checkout.cartId"),a=this.store.get("checkout.items."+t);if(!a)throw new SDKError("Item not found");const c={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:0},l=(null===(r=null===(o=null===(i=a.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||void 0===r?void 0:r.filter(t=>""!==t.trim()))||[];l.length>0&&(c.engravingLines=l);const d=await this.api.updateCart({id:s,items:[c],location:this.getLocation()});this.store.remove("checkout.items."+t),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartId:s,cartItemId:a.cartItemId}),await this.partialLoadCheckout({cartResponse:d})}catch(s){throw this.store.set("checkout.items."+t+".error",s.message),s}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const e=this.store.get("checkout.onDemandFulfillmentTipInfo"),i=Object.values(e||{}).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(n.CHECKOUT_TIP_UPDATED,{deliveryTips:i})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to update tips. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,e){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.onDemandFulfillmentTipInfo"),o=Object.values(i||{}).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===t?e:n.tip})),r=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:o}));this.updateStoreFromCheckoutResponse(r),this.pubSub.publishAction(n.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 e=this.store.get("checkout.onDemandFulfillmentTipInfo"),i=Object.values(e||{}).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(n.CHECKOUT_TIP_UPDATED,{deliveryTips:i})}catch(e){throw this.store.set("checkout.error",(null==e?void 0:e.message)||"Failed to remove fulfillment tip. Please try again."),e}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:t,deliveryInstructions:e,customerData:i}){var o,r,s,a,c,l,d,u,p;try{this.store.set("checkout.customerForm.isSaving",!![]);const m=this.store.get("checkout.customerForm.data"),g=this.store.get("checkout.isGift"),v=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,customer:{...m,...i},isGift:g}),b=await this.api.prepareCheckout(v),x={id:(null===(o=b.customer)||void 0===o?void 0:o.id)||"",firstName:(null===(r=b.customer)||void 0===r?void 0:r.firstName)||"",lastName:(null===(s=b.customer)||void 0===s?void 0:s.lastName)||"",email:(null===(a=b.customer)||void 0===a?void 0:a.email)||"",phone:(null===(c=b.customer)||void 0===c?void 0:c.phone)||"",birthDate:(null===(d=null===(l=b.customer)||void 0===l?void 0:l.birthDate)||void 0===d?void 0:d.slice(0,10))||"",company:(null===(u=b.customer)||void 0===u?void 0:u.company)||""};this.store.batch({"checkout.customerForm.data":x,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddressTwo":b.shippingAddress.two,"checkout.deliveryInstructions":e}),this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,!![]);const w=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(w.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(p=w.promoCode)||void 0===p?void 0:p.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:e,...i}){var o,r,s,a,c,l;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const d=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:e||void 0,isGift:!![],giftRecipient:i}),u=await this.api.prepareCheckout(d),p={firstName:(null==i?void 0:i.firstName)||"",lastName:(null==i?void 0:i.lastName)||"",email:(null===(r=null===(o=u.giftOptions)||void 0===o?void 0:o.recipient)||void 0===r?void 0:r.email)||"",phone:(null===(a=null===(s=u.giftOptions)||void 0===s?void 0:s.recipient)||void 0===a?void 0:a.phone)||"",message:(null===(c=u.giftOptions)||void 0===c?void 0:c.message)||""};this.store.batch({"checkout.giftRecipientForm.data":p,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddressTwo":u.shippingAddress.two,"checkout.deliveryInstructions":e}),this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,!![]);const m=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(m.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(l=m.promoCode)||void 0===l?void 0:l.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:t,paymentSession:e}){var i,o,r;try{this.store.set("checkout.paymentForm.isSaving",!![]);const s=this.store.get("checkout"),a={},c=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let l=null,d=null;if(c||e){const t=await this.confirmPaymentSession((null==e?void 0:e.confirmationTokenId)||"",(null==e?void 0:e.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");l=t.card,d=t.id}const u=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:d||void 0}),p=await this.api.prepareCheckout(u);p.payment&&l&&(a["checkout.paymentForm.paymentMethod"]={id:p.payment,card:l}),t&&p.billingAddress&&(a["checkout.paymentForm.data"]={firstName:p.billingAddress.firstName||"",lastName:p.billingAddress.lastName||"",email:p.billingAddress.email||"",phone:p.billingAddress.phone||"",company:p.billingAddress.company||"",addressOne:p.billingAddress.one||"",addressTwo:p.billingAddress.two||"",city:p.billingAddress.city||"",state:p.billingAddress.state||"",zipCode:p.billingAddress.zip||""},this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,!![])),a["checkout.paymentForm.isEditing"]=![],a["checkout.paymentForm.isValid"]=!![],this.store.batch(a);const m=a["checkout.paymentForm.paymentMethod"]||(null===(i=s.paymentForm)||void 0===i?void 0:i.paymentMethod),g=(null===(o=null==m?void 0:m.card)||void 0===o?void 0:o.brand)?m.card.brand+" ****"+m.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(s.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}}),g,(null===(r=s.promoCode)||void 0===r?void 0:r.code)||void 0)}catch(s){throw this.logger.error("Failed to save payment form",s),this.store.set("checkout.error",s.message),s}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var t,e,i,r,s,a;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const c=this.store.get("checkout"),l=await this.api.checkoutComplete({token:c.token}),d=l.legacyOrderNumber||l.referenceId||"N/A";c.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(o.CHECKOUT_COMPLETED,{orderNumber:d,orderTotal:c.amounts.total,cardLast4:null===(i=null===(e=null===(t=null==c?void 0:c.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===e?void 0:e.card)||void 0===i?void 0:i.last4,customerEmail:c.customerForm.data.email,giftRecipientEmail:(null===(s=null===(r=null==c?void 0:c.giftRecipientForm)||void 0===r?void 0:r.data)||void 0===s?void 0:s.email)||null}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:d,orderTotal:c.amounts.total}),this.googleTagManager.purchase({transaction_id:d,tax:centToDollar(c.amounts.tax||0),shipping:centToDollar(c.amounts.shipping||0),coupon:(null===(a=c.promoCode)||void 0===a?void 0:a.code)||void 0,items:[...Object.values(c.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(c.amounts.total),subtotal:centToDollar(c.amounts.subtotal),total_before_discounts:centToDollar(c.amounts.subtotal+c.amounts.tax+c.amounts.shipping+c.amounts.delivery+c.amounts.platform+c.amounts.service),discounts:centToDollar(c.amounts.discounts),gift_cards:centToDollar(c.amounts.giftCards||0),net_total:centToDollar(c.amounts.total)})}catch(c){const t=(null==c?void 0:c.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(t){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===r.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 partialLoadCheckout(t){var e,i,o,s,a;try{let n;if(this.store.set("checkout.updating",!![]),(null==t?void 0:t.cartResponse)?this.commonCommands.syncCartFromResponse(t.cartResponse):await this.commonCommands.loadCart(),null==t?void 0:t.response)n=t.response;else{const i=null!==(e=null==t?void 0:t.cartId)&&void 0!==e?e:this.store.get("checkout.cartId");if(!i)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const o=this.dataForCheckoutPrepare({});n=await this.api.prepareCheckout({...o,cartId:i})}const c={"checkout.token":n.token,"checkout.events":transformEventsForCheckout(n.events||[]),"checkout.amounts":n.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":n.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),"checkout.promoCode":(null===(o=null===(i=null==n?void 0:n.promoCode)||void 0===i?void 0:i.value)||void 0===o?void 0:o.trim())?{code:n.promoCode.value,discountAmount:n.promoCode.discount}:null};if((null===(s=n.retailers)||void 0===s?void 0:s.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const t of n.retailers)for(const e of t.fulfillments)e.type===r.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=n.items)||void 0===a?void 0:a.length)>0){this.store.remove("checkout.items");for(const t of n.items){const e=n.retailers.find(e=>e.id===t.retailerId),i=e.fulfillments.find(e=>e.id===t.fulfillmentId);c["checkout.items."+t.cartItemId]=this.buildCheckoutItemStore(t,e,i)}}this.store.batch(c)}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(n.CHECKOUT_FAILED,{message:t}),c}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:e,billingData:n,marketingPreferences:i,shippingAddressTwo:o,deliveryInstructions:r,deliveryTips:s,paymentMethodId:a,isGift:c}){var l,d,u,p,m,g,v,b,x,w,C,k,S,E,_,D,I,T,z,L,B,j,V,G,K,Y;const W=this.store.get("checkout"),Q=null!==(d=null===(l=W.paymentForm)||void 0===l?void 0:l.billingSameAsShipping)&&void 0!==d?d:!![],J=void 0!==c?c:W.isGift,$=e?!![]:null!==(p=null===(u=W.giftRecipientForm)||void 0===u?void 0:u.isValid)&&void 0!==p?p:![],tt=J&&$,et={cartId:W.cartId,acceptedAccountCreation:![],hasSubstitutionPolicy:![],hasAgeVerify:!![],shippingAddressTwo:o,billingSameAsShipping:Q,marketingPreferences:i||W.marketingPreferences,promoCode:(null===(m=W.promoCode)||void 0===m?void 0:m.code)||void 0,isGift:tt,giftCards:(null===(g=null==W?void 0:W.giftCards)||void 0===g?void 0:g.map(t=>t.code))||[],deliveryTips:s||Object.values(W.onDemandFulfillmentTipInfo||{}).map(t=>({fulfillmentId:t.fulfillmentId,tip:t.tip}))};a?et.payment=a:(null===(b=null===(v=W.paymentForm)||void 0===v?void 0:v.paymentMethod)||void 0===b?void 0:b.id)&&(et.payment=W.paymentForm.paymentMethod.id);const nt=r||W.deliveryInstructions;if(nt&&(et.deliveryInstructions=Object.values(W.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:nt}))),et.customer=t?{...t,id:(null==t?void 0:t.id)||void 0}:(null===(w=null===(x=null==W?void 0:W.customerForm)||void 0===x?void 0:x.data)||void 0===w?void 0:w.email)?{id:(null===(k=null===(C=W.customerForm)||void 0===C?void 0:C.data)||void 0===k?void 0:k.id)||void 0,firstName:null===(E=null===(S=W.customerForm)||void 0===S?void 0:S.data)||void 0===E?void 0:E.firstName,lastName:null===(D=null===(_=W.customerForm)||void 0===_?void 0:_.data)||void 0===D?void 0:D.lastName,email:null===(T=null===(I=W.customerForm)||void 0===I?void 0:I.data)||void 0===T?void 0:T.email,phone:null===(L=null===(z=W.customerForm)||void 0===z?void 0:z.data)||void 0===L?void 0:L.phone,birthDate:null===(j=null===(B=W.customerForm)||void 0===B?void 0:B.data)||void 0===j?void 0:j.birthDate,company:null===(G=null===(V=W.customerForm)||void 0===V?void 0:V.data)||void 0===G?void 0:G.company}:void 0,tt){const t=e||(null===(K=W.giftRecipientForm)||void 0===K?void 0:K.data);t&&(et.giftOptions={recipient:{name:(t.firstName||"")+" "+(t.lastName||""),email:t.email||"",phone:t.phone||""},message:t.message||""})}if(!Q)if(n)et.billingAddress={firstName:n.firstName,lastName:n.lastName,email:n.email,phone:n.phone,company:n.company,one:n.addressOne,two:n.addressTwo,city:n.city,state:n.state,zip:n.zipCode,country:"US"};else{const t=null===(Y=W.paymentForm)||void 0===Y?void 0:Y.data;et.billingAddress={firstName:null==t?void 0:t.firstName,lastName:null==t?void 0:t.lastName,email:null==t?void 0:t.email,phone:null==t?void 0:t.phone,company:null==t?void 0:t.company,one:null==t?void 0:t.addressOne,two:null==t?void 0:t.addressTwo,city:null==t?void 0:t.city,state:null==t?void 0:t.state,zip:null==t?void 0:t.zipCode,country:"US"}}return et}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 CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.commonCommands=CommonCommands.getInstance(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,e){try{this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+e),new SDKError("Item not found");const r=o.quantity+e;if(r<1)return this.removeItem(t,!![]);const s=this.buildItemUpdate(o,r),a=await this.api.updateCart({id:i,items:[s],location:this.getLocation()});this.syncItemsFromApiResponse(a,[t]),this.updateFulfillment(o.fulfillmentId,a),this.syncRetailersFromApiResponse(a),this.syncCartMetaFromApiResponse(a),this.pubSub.publishAction(e<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{cartId:i,itemId:o.id,quantity:r,previousQuantity:o.quantity});const c=splitCategoryPath(o.catPath),l={item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_size:o.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,quantity:Math.abs(e),price:centToDollar(o.unitPrice||0),item_image:o.mainImage,upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId};e<0?this.googleTagManager.removeFromCart(l):e>0&&this.googleTagManager.addToCart(l)}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to update item quantity",i),i}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,e){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;e||this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw new SDKError("Item not found");const r={itemId:o.id,fulfillmentId:o.fulfillmentId,retailerId:o.retailerId},s=this.buildItemUpdate(o,0),a=await this.api.updateCart({id:i,items:[s],location:this.getLocation()});this.syncItemsFromApiResponse(a,[]),this.cleanupAfterItemRemoval(r,a),this.syncCartMetaFromApiResponse(a),this.pubSub.publishAction(n.CART_ITEM_REMOVED,{cartId:i,itemId:o.id});const c=splitCategoryPath(o.catPath);this.googleTagManager.removeFromCart({item_id:o.liquidId,item_name:o.name,item_brand:o.brand,item_size:o.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,quantity:o.quantity,price:centToDollar(o.unitPrice||0),item_image:o.mainImage,upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId})}catch(i){throw this.store.set("cart.items."+t+".error",i.message),this.logger.error("Failed to remove item",i),i}}async updateItemEngraving(t,e){var i,o,r;try{const s=this.store.get("cart"),a=null===(i=s.items)||void 0===i?void 0:i[t];if(!a)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const c=this.getDetails(),l={id:a.id,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:e},d=await this.api.updateCart({id:s.id||"",items:[l],location:this.getLocation()});this.syncItemsFromApiResponse(d,[t]),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d);const u=this.getDetails();this.pubSub.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{cartId:u.cartId,itemId:a.id,engravingLines:e,previousEngravingLines:(null===(r=null===(o=a.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[]}),this.pubSub.publishAction(n.CART_UPDATED,{previous:c,current:u})}catch(s){throw this.store.set("cart.items."+t+".error",s.message),this.logger.error("Failed to update item engraving",s),s}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var e,i;try{this.store.set("cart.loading",!![]);const o=this.store.get("cart"),r=this.getDetails(),s=(null===(e=t.engravingLines)||void 0===e?void 0:e.filter(t=>""!==t.trim()))||[],a=s.length>0,c=Object.values(o.items||{}).find(e=>{var n,i,o,r,c;const l=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!l)return![];if(a){const t=(null===(i=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[];return s.join(",")===t.join(",")}return!(null===(c=null===(r=null===(o=e.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===c?void 0:c.length)}),l={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:c?t.quantity+c.quantity:t.quantity};a&&(l.engravingLines=s);const d=await this.api.updateCart({id:o.id||"",items:[l],location:this.getLocation()}),u=null===(i=Object.values(d.items))||void 0===i?void 0:i.find(t=>t.fulfillmentId===l.fulfillmentId&&t.partNumber===l.partNumber);if(!u)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(d,[]);const p=this.store.get("cart.fulfillments."+t.fulfillmentId);p?this.updateFulfillment(t.fulfillmentId,d):this.addNewFulfillmentAndRetailer(t.fulfillmentId,d),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d);const m=this.getDetails();this.pubSub.publishAction(n.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(n.CART_ITEM_ADDED,{cartId:m.cartId,itemId:u.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(n.CART_UPDATED,{previous:r,current:m});const g=splitCategoryPath(u.catPath);this.googleTagManager.addToCart({item_id:u.liquidId,item_name:u.name,item_brand:u.brand,item_size:u.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,quantity:u.quantity,price:centToDollar(u.unitPrice||0),item_image:u.mainImage,upc:u.upc,grouping_id:u.salsifyGrouping,product_id:u.liquidId})}catch(o){this.store.set("cart.error",o.message),this.logger.error("Failed to add item to cart",o)}finally{this.store.set("cart.loading",![])}}async addPresaleItem(t){var e;try{const n={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],location:this.getLocation()});await this.checkoutCommands.loadCheckout(i.id)}catch(n){throw this.store.set("cart.error",n.message),this.logger.error("Failed to add presale item to cart",n),n}}async handleGoToCheckout(){var t;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(o.CHECKOUT);const e=this.store.get("cart"),n=(null===(t=e.promoCode)||void 0===t?void 0:t.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(e.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],n)}catch(e){throw this.store.set("cart.error",e.message),this.logger.error("Failed to proceed to checkout",e),e}finally{this.store.set("cart.loading",![])}}async applyPromoCode(t){var e,i,o,r,s;if(!(null==t?void 0:t.trim()))throw new SDKError("Promo code is required");const a=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(a);const c=await this.api.updateCart({id:t,items:[],promoCode:a,location:this.getLocation()});this.store.set("cart.subtotal",c.subtotal),this.store.set("cart.events",transformEventsForCart(c.events||[]));const l=(null===(i=null===(e=c.promoCode)||void 0===e?void 0:e.code)||void 0===i?void 0:i.toLowerCase())===a.toLowerCase();l?(this.store.set("cart.promoCode",{code:a,discountAmount:(null===(o=c.promoCode)||void 0===o?void 0:o.discountAmount)||0}),this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{cartId:t,discountAmount:(null===(r=c.promoCode)||void 0===r?void 0:r.discountAmount)||0,newSubtotal:c.subtotal||0}),this.googleTagManager.promoCodeApplied(a,(null===(s=c.promoCode)||void 0===s?void 0:s.discountAmount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code does not exist"}),this.googleTagManager.promoCodeFailed(a,'Code "'+a+'" does not exist'))}catch(c){const t=(null==c?void 0:c.message)||"Failed to apply promo code. Please try again.";this.store.set("cart.error",t);const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:e,error:t}),this.googleTagManager.promoCodeFailed(a,t),this.logger.error("Failed to apply promo code",c),c}}async removePromoCode(){try{const t=this.store.get("cart.id"),e=await this.api.updateCart({id:t,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":e.subtotal,"cart.promoCode":null}),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{cartId:t,newSubtotal:e.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const e=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",e);const i=this.store.get("cart.promoCode"),o=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:o,error:e}),(null==i?void 0:i.code)&&this.googleTagManager.promoCodeFailed(i.code,e),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...v,rerender:!![]}),this.store.set("cart",{...g,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSub.publishAction(n.CART_RESET,!![])}getDetails(){var t;const e=this.store.get("cart"),n=this.store.get("address"),i={};for(const o in e.items||{}){const t=e.items[o];i[o]={id:t.id,variantId:t.variantId,liquidId:t.liquidId,salsifyGrouping:t.salsifyGrouping,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price,quantity:t.quantity,maxQuantity:t.maxQuantity,unitPrice:t.unitPrice,mainImage:t.mainImage,attributes:t.attributes}}return{cartId:e.id||"",promoCodeDiscount:(null===(t=e.promoCode)||void 0===t?void 0:t.discountAmount)||null,subtotal:e.subtotal,itemCount:e.itemsQuantity,items:i,retailers:e.retailers||{},location:n.id?{placesId:n.id,formattedAddress:n.formattedAddress,address:n.address,coordinates:n.coordinates}:null}}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=[]){const n=this.store.get("cart.items")||{},i=new Set(Object.keys(t.items));for(const r of Object.keys(n))i.has(r)||this.store.remove("cart.items."+r);const o={};for(const r of Object.values(t.items))0!==e.length&&!e.includes(r.id)&&n[r.id]||(o["cart.items."+r.id]=r);Object.keys(o).length>0&&this.store.batch(o)}syncCartMetaFromApiResponse(t){var e,n;const i={"cart.subtotal":t.subtotal,"cart.error":null,"cart.events":transformEventsForCart(t.events||[])},o=null===(e=null==t?void 0:t.promoCode)||void 0===e?void 0:e.code;if(o)i["cart.promoCode"]={code:o.toUpperCase(),discountAmount:(null===(n=t.promoCode)||void 0===n?void 0:n.discountAmount)||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(i["cart.promoCode"]=null)}this.store.batch(i)}syncRetailersFromApiResponse(t){var e;if((null===(e=Object.values(t.retailers))||void 0===e?void 0:e.length)>0){const e={};for(const n of Object.values(t.retailers))e["cart.retailers."+n.id]=n;this.store.batch(e)}}updateFulfillment(t,e){var n;const i=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.find(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t)}),o=null==i?void 0:i.fulfillments[t];o&&i&&this.store.set("cart.fulfillments."+t,o)}addNewFulfillmentAndRetailer(t,e){var n;const i=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.find(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t)}),o=null==i?void 0:i.fulfillments[t];if(o&&i){const e={["cart.fulfillments."+t]:o,["cart.retailers."+i.id]:i};this.store.batch(e)}}cleanupAfterItemRemoval(t,e){var n,i,o,r;const s=this.store.get("cart.fulfillments."+t.fulfillmentId),a=this.store.get("cart.retailers."+t.retailerId);if(!s||!a)return;const c=null===(n=Object.values(e.retailers))||void 0===n?void 0:n.some(e=>{var n;return null===(n=Object.keys(e.fulfillments))||void 0===n?void 0:n.some(e=>e===t.fulfillmentId)}),l=null===(i=Object.keys(e.retailers))||void 0===i?void 0:i.some(e=>e===t.retailerId);if(c){this.updateFulfillment(t.fulfillmentId,e);const n=null===(r=Object.keys(e.retailers))||void 0===r?void 0:r.find(e=>e===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,n)}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),l){const n=null===(o=Object.keys(e.retailers))||void 0===o?void 0:o.find(e=>e===t.retailerId);n&&this.store.set("cart.retailers."+t.retailerId,n)}else this.store.remove("cart.retailers."+t.retailerId)}}class ProductCommands extends BaseCommand{constructor(){super(),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=Object.values(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,e=null){var i,o;try{const r=this.store.get("products."+t);r.loading||this.store.set("products."+t+".loading",!![]);let s=null;if(e&&(s=e),e||(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(n.PRODUCT_LOADED,this.productDataForEventFromStore(t));const c=s.products[0],l=a.sizes[a.selectedSizeId||""],d=Boolean(this.getLocation()),u=a.selectedFulfillment,p=d&&(null==u?void 0:u.variant.price)?u.variant.price:a.noAvailabilityPrice,m=splitCategoryPath(c.catPath);this.googleTagManager.viewItem({item_id:null==l?void 0:l.id,item_name:c.name,item_brand:c.brand,item_size:null==l?void 0:l.size,item_category:m.category,item_category2:m.category2,item_category3:m.category3,price:centToDollar(p),item_type:c.type,item_subtype:c.subType,item_image:(null==l?void 0:l.image)||(null===(o=c.images)||void 0===o?void 0:o[0]),upc:null==l?void 0:l.upc,grouping_id:c.salsifyGrouping,product_id:null==l?void 0:l.id})}catch(r){this.store.set("products."+t+".error",r.message),this.logger.error("Failed to load product data for ID "+t,r)}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,e){var i,o,s;const a=this.store.get("products."+t);let c=a.selectedFulfillmentType;const l=a.sizes[e];let d=null,u=null;if(c!==r.SHIPPING||Object.values(l.shippingFulfillments).length)if(c!==r.ON_DEMAND||Object.values(l.onDemandFulfillments).length){const t=c===r.SHIPPING?l.shippingFulfillments:l.onDemandFulfillments,e=Object.values(t);d=e[0]||null,u=(null==d?void 0:d.id)||null}else{c=r.SHIPPING;const t=Object.values(l.shippingFulfillments);d=t[0]||null,u=(null==d?void 0:d.id)||null}else{c=r.ON_DEMAND;const t=Object.values(l.onDemandFulfillments);d=t[0]||null,u=(null==d?void 0:d.id)||null}const p=c===r.SHIPPING?l.shippingFulfillments:l.onDemandFulfillments,m=splitCategoryPath(a.catPath);this.googleTagManager.viewItem({item_id:null==l?void 0:l.id,item_name:a.name,item_brand:a.brand,item_size:null==l?void 0:l.size,item_category:m.category,item_category2:m.category2,item_category3:m.category3,price:centToDollar((null==d?void 0:d.variant.price)||a.noAvailabilityPrice),item_type:a.type,item_subtype:a.subType,item_image:(null==l?void 0:l.image)||(null===(i=a.images)||void 0===i?void 0:i[0]),upc:null==l?void 0:l.upc,grouping_id:a.salsifyGrouping,product_id:null==l?void 0:l.id});const g=Object.keys(l.shippingFulfillments).length>0,v=Object.keys(l.onDemandFulfillments).length>0;g||v||this.googleTagManager.productSizeNoAvailability({productId:null==l?void 0:l.id,productName:a.name,productBrand:a.brand,productCategory:m.category,productCategory2:m.category2,productCategory3:m.category3,productType:a.type,productSubtype:a.subType,productPrice:a.noAvailabilityPrice,sizeId:e,sizeName:null==l?void 0:l.size,upc:null==l?void 0:l.upc,groupingId:a.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:e,selectedSize:(null===(o=a.sizes[e])||void 0===o?void 0:o.size)||"",previousSizeId:a.selectedSizeId||"",previousSize:(null===(s=a.sizes[a.selectedSizeId])||void 0===s?void 0:s.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:e,["products."+t+".productHasAvailability"]:Object.keys(l.shippingFulfillments).length+Object.keys(l.onDemandFulfillments).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(p).length),["products."+t+".selectedFulfillmentType"]:c,["products."+t+".selectedFulfillment"]:d,["products."+t+".selectedFulfillmentId"]:u})}async selectFulfillment(t,e){var i;const o=this.store.get("products."+t),s=o.sizes[o.selectedSizeId],a=o.selectedFulfillmentType===r.SHIPPING?s.shippingFulfillments:s.onDemandFulfillments,c=a[e];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:e,selectedFulfillmentType:o.selectedFulfillmentType,previousFulfillmentId:o.selectedFulfillmentId||"",previousFulfillmentType:o.selectedFulfillmentType});const l=splitCategoryPath(o.catPath);this.googleTagManager.viewItem({item_id:null==s?void 0:s.id,item_name:o.name,item_brand:o.brand,item_size:null==s?void 0:s.size,item_category:l.category,item_category2:l.category2,item_category3:l.category3,price:centToDollar((null==c?void 0:c.variant.price)||o.noAvailabilityPrice),item_type:o.type,item_subtype:o.subType,item_image:(null==s?void 0:s.image)||(null===(i=o.images)||void 0===i?void 0:i[0]),upc:null==s?void 0:s.upc,grouping_id:o.salsifyGrouping,product_id:null==s?void 0:s.id}),this.store.batch({["products."+t+".selectedFulfillment"]:c,["products."+t+".selectedFulfillmentId"]:e,["products."+t+".quantity"]:1})}async updateQuantity(t,e){var i;const o=this.store.get("products."+t),r=o.quantity,s=r+e,a=1,c=(null===(i=null==o?void 0:o.selectedFulfillment)||void 0===i?void 0:i.variant.stock)||5,l=Math.max(a,Math.min(c,s));this.pubSub.publishAction(e<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:l,previousQuantity:r}),this.store.set("products."+t+".quantity",l)}async changeFulfillmentType(t,e){var i,o;const s=this.store.get("products."+t),a=s.sizes[s.selectedSizeId],c=e===r.SHIPPING?a.shippingFulfillments:a.onDemandFulfillments,l=Object.values(c);if(0===l.length){const t=splitCategoryPath(s.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==a?void 0:a.id,productName:s.name,productBrand:s.brand,productCategory:t.category,productCategory2:t.category2,productCategory3:t.category3,productType:s.type,productSubtype:s.subType,productPrice:s.noAvailabilityPrice,sizeId:null!==(i=s.selectedSizeId)&&void 0!==i?i:void 0,sizeName:null==a?void 0:a.size,fulfillmentType:e,upc:null==a?void 0:a.upc,groupingId:s.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+e+" fulfillments available for selected size"}),void 0}const d=l[0]||null,u=(null==d?void 0:d.id)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:e,selectedFulfillmentId:u,previousFulfillmentType:s.selectedFulfillmentType,previousFulfillmentId:s.selectedFulfillmentId,fulfillmentHasAvailability:l.length>0});const p=splitCategoryPath(s.catPath);this.googleTagManager.viewItem({item_id:null==a?void 0:a.id,item_name:s.name,item_brand:s.brand,item_size:null==a?void 0:a.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,price:centToDollar((null==d?void 0:d.variant.price)||s.noAvailabilityPrice),item_type:s.type,item_subtype:s.subType,item_image:(null==a?void 0:a.image)||(null===(o=s.images)||void 0===o?void 0:o[0]),upc:null==a?void 0:a.upc,grouping_id:s.salsifyGrouping,product_id:null==a?void 0:a.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:e,["products."+t+".selectedFulfillment"]:d,["products."+t+".selectedFulfillmentId"]:u,["products."+t+".fulfillmentHasAvailability"]:l.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}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(o.CART),await this.cartCommands.addItem(e),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const n=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(n.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:e.category,item_category2:e.category2,item_category3:e.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),item_image:t.mainImage,upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,e){try{this.store.set("products."+t+".updating",!![]),await this.cartCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(o.CHECKOUT),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.error("Error adding to cart",n),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const e=this.store.get("products."+t);if(!e)throw new Error('Product store not found for identifier "'+t+'"');const fulfillmentEventData=t=>t?Object.entries(t).reduce((t,[e,n])=>(t[e]={...n},t),{}):{},n=Object.entries(e.sizes||{}).reduce((t,[e,n])=>{const{loading:i,error:o,shippingFulfillments:r,onDemandFulfillments:s,...a}=n;return t[e]={...a,shippingFulfillments:fulfillmentEventData(r),onDemandFulfillments:fulfillmentEventData(s)},t},{});return{identifier:t,selectedSizeId:e.selectedSizeId||null,selectedFulfillmentType:e.selectedFulfillmentType,selectedFulfillmentId:e.selectedFulfillmentId||null,productHasAvailability:Boolean(e.productHasAvailability),fulfillmentHasAvailability:Boolean(e.fulfillmentHasAvailability),id:e.id,name:e.name,brand:e.brand,catPath:e.catPath,category:e.category,classification:e.classification,type:e.type,subType:e.subType,salsifyGrouping:e.salsifyGrouping,description:e.description,htmlDescription:e.htmlDescription,tastingNotes:e.tastingNotes,images:e.images||[],region:e.region,country:e.country,material:e.material,abv:e.abv,proof:e.proof,age:e.age,color:e.color,flavor:e.flavor,variety:e.variety,appellation:e.appellation,vintage:e.vintage,noAvailabilityPrice:e.noAvailabilityPrice,sizes:n}}findFirstAvailableSize(t){const e=Object.values(t);for(const n of e){const t=n.shippingFulfillments||{},e=n.onDemandFulfillments||{},i=Object.values(t).length,o=Object.values(e).length;if(i+o>0)return n.id}return null}loadProductStoreUpdate({products:[t,...e],retailers:n}){var i,o,s,a,c;try{const e=this.themeProvider.getConfigs("product"),l={id:t.id,brand:t.brand,category:t.category,catPath:t.catPath,classification:t.classification,type:t.type,subType:t.subType,salsifyGrouping:t.salsifyGrouping,name:t.name,description:t.description,htmlDescription:t.htmlDescription,images:t.images,region:t.region,country:t.country,material:t.material,abv:t.abv,proof:t.proof,age:t.age,color:t.color,flavor:t.flavor,variety:t.variety,appellation:t.appellation,vintage:t.vintage,tastingNotes:t.tastingNotes,noAvailabilityPrice:t.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:e.layout.enableShippingFulfillment?r.SHIPPING:r.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(t.sizes&&Object.values(t.sizes).length>0)for(const{shippingVariants:i,onDemandVariants:o,...r}of Object.values(t.sizes)){l.sizes[r.id]={...r,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const t of Object.values(i)){const e=n[t.retailerId];(null==e?void 0:e.shippingFulfillment)&&(l.sizes[r.id].shippingFulfillments[e.shippingFulfillment.id]={...e.shippingFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}for(const t of Object.values(o)){const e=n[t.retailerId];(null==e?void 0:e.onDemandFulfillment)&&(l.sizes[r.id].onDemandFulfillments[e.onDemandFulfillment.id]={...e.onDemandFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}}const d=Object.values(l.sizes),u=this.findFirstAvailableSize(l.sizes);l.selectedSizeId=u||(null===(i=d[0])||void 0===i?void 0:i.id)||"";const p=(null===(o=l.sizes[l.selectedSizeId])||void 0===o?void 0:o.shippingFulfillments)||{},m=(null===(s=l.sizes[l.selectedSizeId])||void 0===s?void 0:s.onDemandFulfillments)||{};l.productHasAvailability=Object.values(p).length+Object.values(m).length>0;const g=l.selectedFulfillmentType===r.SHIPPING?Object.values(p):Object.values(m);if(l.fulfillmentHasAvailability=g.length>0,l.selectedFulfillment=g[0]||null,l.selectedFulfillmentId=(null===(a=l.selectedFulfillment)||void 0===a?void 0:a.id)||null,!l.fulfillmentHasAvailability){const t=l.selectedFulfillmentType===r.SHIPPING?r.ON_DEMAND:r.SHIPPING,e=t===r.SHIPPING?Object.values(p):Object.values(m);e.length>0&&(l.selectedFulfillmentType=t,l.selectedFulfillment=e[0],l.selectedFulfillmentId=(null===(c=l.selectedFulfillment)||void 0===c?void 0:c.id)||null,l.fulfillmentHasAvailability=!![])}if(!l.productHasAvailability){const e=splitCategoryPath(t.catPath),n=l.sizes[l.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==n?void 0:n.id,productName:t.name,productBrand:t.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:t.type,productSubtype:t.subType,productPrice:t.noAvailabilityPrice,upc:null==n?void 0:n.upc,groupingId:t.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for any size"})}return l}catch(l){throw this.logger.error("Product data processing error",l),l}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(t){return!t||t.length<3?[]:await this.api.getAddressSuggestions(t)}async getAddressDetails(t){return await this.api.getAddressDetails(t)}async setSelectedAddress(t){try{this.store.batch({"address.id":t.id,"address.formattedAddress":t.formattedAddress,"address.address":t.address,"address.coordinates":t.coordinates});const e=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(e)),await this.cartCommands.resetCart(),await this.store.persist()}catch(e){throw this.googleTagManager.addressFailed({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==e?void 0:e.message)||"Failed to update downstream state after address change"}),e}this.googleTagManager.addressUpdated({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates}),this.pubSub.publishAction(n.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,e){try{const n=this.buildFormattedAddressString(t),i={id:"",formattedAddress:n,address:t,coordinates:e};await this.setSelectedAddress(i)}catch(i){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country},error:(null==i?void 0:i.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:t,coordinates:e,error:(null==i?void 0:i.message)||"Failed to set manual address"}),i}}async clearSelectedAddress(){this.store.set("address",p),this.pubSub.publishAction(n.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const t=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(t),this.store.clearLocalStorage()}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}buildFormattedAddressString(t){var e,n,i,o,r,s;const a=[],c=[];(null===(e=t.one)||void 0===e?void 0:e.trim())&&c.push(t.one.trim()),(null===(n=t.two)||void 0===n?void 0:n.trim())&&c.push(t.two.trim()),c.length>0&&a.push(c.join(" ")),(null===(i=t.city)||void 0===i?void 0:i.trim())&&a.push(t.city.trim());const l=[];return(null===(o=t.state)||void 0===o?void 0:o.trim())&&l.push(t.state.trim()),(null===(r=t.zip)||void 0===r?void 0:r.trim())&&l.push(t.zip.trim()),l.length>0&&a.push(l.join(" ")),(null===(s=t.country)||void 0===s?void 0:s.trim())&&a.push(t.country.trim()),a.join(", ")}}class ProductListCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}async getProductList(t){t.location=this.getLocation();const e=await this.api.catalogSearch(t);return e.products&&e.products.length>0&&this.trackViewItemList(e.products),e}async addToCart(t){try{this.uiCommands.openDrawer(o.CART),await this.cartCommands.addItem(t)}catch(e){throw this.logger.error("Error adding product to cart from product list",e),e}}async addPresaleToCart(t){try{await this.cartCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(o.CHECKOUT)}catch(e){throw this.logger.error("Error adding presale product to cart from product list",e),e}}trackViewItemList(t){if(0!==t.length)try{const e=t.map((t,e)=>({...this.convertProductToBaseItem(t),index:e+1}));this.googleTagManager.viewItemList(e,"product_list","Product List")}catch(e){this.logger.error("Error tracking view_item_list event",e)}}trackSelectItem(t){try{const e=this.convertProductToBaseItem(t);this.googleTagManager.selectItem(e,"product_list","Product List")}catch(e){this.logger.error("Error tracking select_item event",e)}}convertProductToBaseItem(t){var e,n;const i=null===(e=t.sizes)||void 0===e?void 0:e[0],o=null==i?void 0:i.shippingVariants[Object.keys(i.shippingVariants)[0]],r=splitCategoryPath(t.catPath);return{item_id:null==i?void 0:i.id,item_name:t.name,item_brand:t.brand,item_size:null==i?void 0:i.size,item_category:r.category,item_category2:r.category2,item_category3:r.category3,price:(null==o?void 0:o.price)?centToDollar(o.price):t.noAvailabilityPrice?centToDollar(t.noAvailabilityPrice):void 0,item_type:t.type,item_subtype:t.subType,item_image:(null==i?void 0:i.image)||(null===(n=t.images)||void 0===n?void 0:n[0]),upc:null==i?void 0:i.upc,grouping_id:t.salsifyGrouping,product_id:null==i?void 0:i.id,item_list_id:"product_list",item_list_name:"Product List"}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}const mt="lce-checkout-stripe-slot",ft={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},gt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},vt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};class ClientActionService{constructor(){this.allowedCustomerFields=new Set(Object.values(ft)),this.allowedBillingFields=new Set(Object.values(vt)),this.allowedGiftFields=new Set(Object.values(gt)),this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:t=>{if(!t||""===t.trim())throw new SDKError("A valid product identifier is required to retrieve product details.",!![]);try{return this.command.product.productDataForEventFromStore(t)}catch(e){throw this.logger.error('Unable to retrieve product details for identifier "'+t+'"',e),new SDKError('Product "'+t+'" has not been loaded yet.',!![])}}},this.addressActions={setAddressByPlacesId:async t=>{try{if(!t||""===t.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const e=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:e.address,coordinates:e.coordinates,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 SDKError("Both address and coordinates are required.",!![]);if(!(t.one&&t.city&&t.state&&t.zip))throw new SDKError("Address must include street, city, state, and zip code.",!![]);if("number"!=typeof e.latitude||"number"!=typeof e.longitude)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof e.latitude+", long: "+typeof e.longitude,!![]);if(e.latitude<-90||e.latitude>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+e.latitude,!![]);if(e.longitude<-180||e.longitude>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+e.longitude,!![]);await this.command.address.setAddressManually(t,e)}catch(n){throw this.logger.error("Error setting manual address:",n),n}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(o.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(o.CART)},addProduct:async(t,e)=>{var i,s;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;for(const e of t){if(!e.identifier||"string"!=typeof e.identifier)throw new SDKError("Product identifier is required and must be a string",!![]);if(e.fulfillmentType||(e.fulfillmentType=r.SHIPPING),e.quantity&&"number"==typeof e.quantity||(e.quantity=1),e.fulfillmentType!==r.SHIPPING&&e.fulfillmentType!==r.ON_DEMAND)throw new SDKError('Invalid fulfillment type "'+e.fulfillmentType+'" for product "'+e.identifier+'". Must be either "shipping" or "onDemand"',!![]);if(e.quantity<1)throw new SDKError('Quantity must be a number greater than 0 for product "'+e.identifier+'"',!![])}const a=this.getLocation();if(void 0===a)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=e?e:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(o.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;e===!![]&&this.command.ui.openDrawer(o.CART);const c=[...new Set(t.map(t=>t.identifier))],l=await this.api.getProductsData(c,a);if(!l||!l.products||0===l.products.length){this.logger.warn("No product data found for the provided identifiers");const t=this.store.get("cart.id");return this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{cartId:t,identifiers:[],error:"No products provided"}),void 0}for(const e of t){let t=null;for(let i=0;i<l.products.length;i++){const n=l.products[i];let o=![];const r=Object.values(n.sizes);for(let t=0;t<r.length;t++){const i=r[t];if(i.upc===e.identifier||i.id===e.identifier||n.salsifyGrouping===e.identifier){o=!![];break}}if(o){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=Object.values(t.sizes)[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(s=null===(i=null==n?void 0:n.attributes)||void 0===i?void 0:i.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 o=null;const a=e.fulfillmentType===r.SHIPPING?n.shippingVariants:n.onDemandVariants,c=Object.values(a);for(let e=0;e<c.length;e++)if(c[e]){o=c[e];break}if(!o){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 d=e.fulfillmentType===r.ON_DEMAND?o.onDemandFulfillmentId:o.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:d,partNumber:o.partNumber,quantity:e.quantity,identifier:e.identifier})}this.clearPendingCartOperation();const d=this.store.get("cart.id");this.pubSub.publishAction(n.CART_PRODUCT_ADD_SUCCESS,{cartId:d,itemsAdded:t.length,identifiers:c}),this.logger.info("Products added to cart successfully:",c)}catch(a){this.logger.error("Error adding products to cart:",a),this.clearPendingCartOperation();const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{cartId:e,identifiers:t.map(t=>t.identifier),error:a.message||"Failed to add products to cart"}),a}},applyPromoCode:async t=>{try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const e=t.trim().toUpperCase(),i=this.themeProvider.getConfigs("global"),o=i.layout.allowPromoCodes;if(!o)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const r=this.store.get("cart.promoCode");if(r&&r.code===e)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(e);const s=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{cartId:s.cartId,discountAmount:s.promoCodeDiscount||0,newSubtotal:s.subtotal}),this.logger.info("Promo code applied successfully")}catch(e){this.logger.error("Failed to apply promo code:",e);const t=this.store.get("cart.id");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code could not be applied"}),e}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),e=t.layout.allowPromoCodes;if(!e)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const i=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{cartId:i.cartId,newSubtotal:i.subtotal}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(n.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(o.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(o.CHECKOUT)},addProduct:async(t,e)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;e===!![]&&this.command.ui.openDrawer(o.CHECKOUT);const i=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout();const r=this.store.get("cart.id");this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:r,itemsAdded:t.length,identifiers:i}),this.logger.info("Products added to checkout successfully:",i)}catch(i){this.logger.error("Error adding products to checkout:",i);const e=this.store.get("cart.id");throw this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:e,identifiers:t.map(t=>t.identifier),error:i.message||"Failed to add products to checkout"}),i}},addPresaleProduct:async t=>{var e,i;try{if(!t||"object"!=typeof t||!t.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;if(t.fulfillmentType||(t.fulfillmentType=r.SHIPPING),t.quantity&&"number"==typeof t.quantity||(t.quantity=1),t.fulfillmentType!==r.SHIPPING&&t.fulfillmentType!==r.ON_DEMAND)throw new SDKError('Invalid fulfillment type "'+t.fulfillmentType+'" for presale product "'+t.identifier+'". Must be either "shipping" or "onDemand"',!![]);if(t.quantity<1)throw new SDKError('Quantity must be a number greater than 0 for presale product "'+t.identifier+'"',!![]);const s=this.getLocation();if(void 0===s)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(o.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const a=await this.api.getProductsData([t.identifier],s);if(!a||!a.products||0===a.products.length){this.logger.warn("No product data found for the provided presale identifier");const e=this.store.get("cart.id");return this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:e,identifiers:[t.identifier],error:"No product found",isPresale:!![]}),void 0}const c=a.products[0],l=Object.values(c.sizes)[0];if(!l){this.logger.warn("No sizes found for presale product: "+t.identifier);const e=this.store.get("cart.id");return this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:e,identifiers:[t.identifier],error:"No sizes found for product",isPresale:!![]}),void 0}if((null===(i=null===(e=null==l?void 0:l.attributes)||void 0===e?void 0:e.presale)||void 0===i?void 0:i.isActive)!==!![]){this.logger.warn("Product is not a presale item: "+t.identifier),this.store.set("checkout.error","Product is not available for presale");const e=this.store.get("cart.id");return this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:e,identifiers:[t.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0}let d=null;const u=t.fulfillmentType===r.SHIPPING?l.shippingVariants:l.onDemandVariants,p=Object.values(u);for(let t=0;t<p.length;t++)if(p[t]){d=p[t];break}if(!d){this.logger.warn("No supported variant found for presale product: "+t.identifier+" with fulfillment type: "+t.fulfillmentType),this.store.set("checkout.error","Presale product has no availability");const e=this.store.get("cart.id");return this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:e,identifiers:[t.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0}const m=t.fulfillmentType===r.ON_DEMAND?d.onDemandFulfillmentId:d.shippingFulfillmentId;await this.command.cart.addPresaleItem({fulfillmentId:m,partNumber:d.partNumber,quantity:t.quantity,engravingLines:[],identifier:t.identifier}),this.command.ui.openDrawer(o.CHECKOUT);const g=this.store.get("checkout"),v=g.cartId;this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:v,itemsAdded:1,identifiers:[t.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+t.identifier)}catch(s){this.logger.error("Error adding presale product to checkout:",s);const e=this.store.get("checkout"),i=e.cartId;throw this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:i,identifiers:[t.identifier],error:s.message||"Failed to add presale product to checkout",isPresale:!![]}),s}},applyPromoCode:async t=>{var e;try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const i=t.trim().toUpperCase(),o=this.themeProvider.getConfigs("global"),r=o.layout.allowPromoCodes;if(!r)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const s=this.store.get("checkout.promoCode");if(s&&s.code===i)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const a=this.store.get("checkout"),c=a.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{cartId:a.cartId,discountAmount:(null==c?void 0:c.discountAmount)||0,newTotal:(null===(e=null==a?void 0:a.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(i){this.logger.error("Failed to apply checkout promo code:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{cartId:t.cartId,error:"Promo code could not be applied"}),i}},removePromoCode:async()=>{var t;try{const e=this.themeProvider.getConfigs("global"),i=e.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const o=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{cartId:o.cartId,newTotal:(null===(t=null==o?void 0:o.amounts)||void 0===t?void 0:t.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(e){throw this.logger.error("Failed to remove checkout promo code:",e),e}},applyGiftCard:async t=>{var e;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{cartId:r.cartId,newTotal:(null===(e=null==r?void 0:r.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card applied successfully")}catch(i){this.logger.error("Failed to apply gift card:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be applied"}),i}},removeGiftCard:async t=>{var e;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{cartId:r.cartId,newTotal:(null===(e=null==r?void 0:r.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Gift card removed successfully")}catch(i){this.logger.error("Failed to remove gift card:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be removed"}),i}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:async(t,e)=>{await this.command.checkout.toggleMarketingPreferences(t,e)},updateCustomerInfo:t=>{const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateCustomerInfo called without valid params"),void 0;for(const[n,i]of Object.entries(t)){if(!this.allowedCustomerFields.has(n))continue;const t=this.normalizeCheckoutFieldValue(i);n===ft.addressTwo?e["checkout.shippingAddressTwo"]=t:e["checkout.customerForm.data."+n]=t}if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateCustomerInfo called without supported fields"),void 0;this.store.batch(e)},updateBillingInfo:t=>{const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateBillingInfo called without valid params"),void 0;for(const[n,i]of Object.entries(t))this.allowedBillingFields.has(n)&&(e["checkout.paymentForm.data."+n]=this.normalizeCheckoutFieldValue(i));if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateBillingInfo called without supported fields"),void 0;this.store.batch(e)},updateGiftInfo:t=>{const e={};if(!t||"object"!=typeof t)return this.logger.warn("actions.checkout.updateGiftInfo called without valid params"),void 0;for(const[n,i]of Object.entries(t)){if(!this.allowedGiftFields.has(n))continue;const t=this.normalizeCheckoutFieldValue(i);n===gt.addressTwo?e["checkout.shippingAddressTwo"]=t:e["checkout.giftRecipientForm.data."+n]=t}if(0===Object.keys(e).length)return this.logger.warn("actions.checkout.updateGiftInfo called without supported fields"),void 0;this.store.batch(e)},getDetails:()=>{var t,e,n;const i=this.store.get("checkout"),o=i.items||{},r={};for(const[s,a]of Object.entries(o))r[s]={liquidId:a.liquidId,variantId:a.variantId,cartItemId:s,retailerId:a.retailerId,fulfillmentId:a.fulfillmentId,salsifyGrouping:a.salsifyGrouping,name:a.name,catPath:a.catPath,volume:a.volume,uom:a.uom,proof:a.proof,abv:a.abv,containerType:a.containerType,container:a.container,size:a.size,pack:a.pack,packDesc:a.packDesc,mainImage:a.mainImage,brand:a.brand,partNumber:a.partNumber,upc:a.upc,sku:a.sku,price:a.price,unitPrice:a.unitPrice,quantity:a.quantity,unitTax:a.unitTax,bottleDeposits:a.bottleDeposits,attributes:a.attributes,retailerName:a.retailerName,expectationDetail:a.expectationDetail};return{cartId:i.cartId,isGift:i.isGift||![],billingSameAsShipping:i.paymentForm.billingSameAsShipping,marketingPreferences:{canEmail:(null===(t=i.marketingPreferences)||void 0===t?void 0:t.canEmail)||![],canSms:(null===(e=i.marketingPreferences)||void 0===e?void 0:e.canSms)||![]},hasPromoCode:!!(null===(n=i.promoCode)||void 0===n?void 0:n.code),hasGiftCards:Array.isArray(i.giftCards)&&i.giftCards.length>0,itemCount:Object.values(r||{}).reduce((t,e)=>t+(e.quantity||0),0),amounts:i.amounts,items:r}}},this.actions={product:this.productActions,address:this.addressActions,cart:this.cartActions,checkout:this.checkoutActions},this.store=StoreService.getInstance(),this.command=CommandService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get("ClientAction"),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}setupAddressUpdateListener(){const M=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+n.ADDRESS_UPDATED,M)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,e=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(t,e)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.latitude&&t.coordinates.longitude)return{coordinates:t.coordinates,address:t.address}}normalizeCheckoutFieldValue(t){return"string"==typeof t?t:null==t?"":String(t)}}const yt="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",bt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const t=LoggerFactory,e=t.instances;if(e)for(const[i,o]of e)this.interceptLoggerInstance(o,i);const n=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const e=n(t);return this.interceptLoggerInstance(e,t),e}}interceptLoggerInstance(t,e){if(t.l)return;const n=t.debug.bind(t),i=t.info.bind(t),o=t.warn.bind(t),r=t.error.bind(t),O=(t,n,i)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:n,data:i,context:e});t.debug=(t,e)=>{n(t,e),this.addLogEntry(O("debug",t,e))},t.info=(t,e)=>{i(t,e),this.addLogEntry(O("info",t,e))},t.warn=(t,e)=>{o(t,e),this.addLogEntry(O("warn",t,e))},t.error=(t,e)=>{r(t,e),this.addLogEntry(O("error",t,e))},t.l=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),e=t.publishAction.bind(t);t.publishAction=(t,n)=>{e(t,n),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:n,context:"PubSub"})};const n=t.publishForm.bind(t);t.publishForm=(t,e)=>{n(t,e),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+t,data:e,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),e=t.executeEvent.bind(t);t.executeEvent=(t,n,i)=>{e(t,n,i),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+n,data:i,context:"GTM."+t})}}addLogEntry(t){this.logs.push(t),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const t=this.logs.filter(t=>{switch(t.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",t.forEach(t=>{const e=this.createLogElement(t);this.logContainer.appendChild(e)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(bt);t&&t.remove(),this.panelElement=document.createElement(bt);const e=window.innerWidth<=768,n=window.innerWidth<=480;n?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):e?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const t=this.panelElement.attachShadow({mode:"closed"}),e=document.createElement("style");e.textContent=yt,t.appendChild(e),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const n=this.createHeader();this.panelContainer.appendChild(n);const i=this.createToggles();this.panelContainer.appendChild(i),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const o=this.createResizeHandle();this.panelContainer.appendChild(o),t.appendChild(this.panelContainer),this.setupShadowEventListeners(t)}createHeader(){const t=document.createElement("div");t.className="header",t.title="Drag to move panel";const e=document.createElement("div");e.className="icon",e.innerHTML="🔍",e.title="Elements Debug Console",e.style.cursor="help";const n=document.createElement("div");n.className="title-container";const i=document.createElement("div");i.className="title",i.textContent="Elements Debug Console";const o=document.createElement("div");o.className="subtitle",o.textContent="Live SDK logs, events & GTM tracking",n.appendChild(i),n.appendChild(o);const r=document.createElement("button");return r.className="minimize",r.innerHTML="−",r.title="Minimize debug panel",r.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(e),t.appendChild(n),t.appendChild(r),t}createToggles(){const t=document.createElement("div");t.className="toggles";const e=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];e.forEach(({key:e,label:n,description:i,color:o})=>{const r=document.createElement("label");r.className="toggle",r.title=i;const s=document.createElement("input");s.type="checkbox",s.checked="showLogs"!==e,s.addEventListener("change",t=>{const n=t.target;"showEvents"===e&&(this.showEvents=n.checked),"showGtmEvents"===e&&(this.showGtmEvents=n.checked),"showLogs"===e&&(this.showLogs=n.checked),this.renderLogs()});const a=document.createElement("span");a.textContent=n,a.style.color=o,r.appendChild(s),r.appendChild(a),t.appendChild(r)});const n=document.createElement("button");return n.className="clear-btn",n.innerHTML="🗑️",n.title="Clear all logs",n.addEventListener("click",()=>this.clearLogs()),t.appendChild(n),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let e=![],n=0,i=0,o=0,r=0;t.addEventListener("mousedown",t=>{e=!![],n=t.clientX,i=t.clientY,o=Number.parseInt(this.panelElement.style.width,10)||500,r=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",U),document.addEventListener("mouseup",H),t.preventDefault()});const U=t=>{if(!e||!this.panelElement)return;const s=t.clientX-n,a=t.clientY-i,c=window.innerWidth<=768,l=window.innerWidth<=480;let d,u,p,m;l?(d=280,u=window.innerWidth-20,p=200,m=.4*window.innerHeight):c?(d=300,u=window.innerWidth-30,p=200,m=.4*window.innerHeight):(d=300,u=800,p=200,m=600);const g=Math.max(d,Math.min(u,o+s)),v=Math.max(p,Math.min(m,r+a));this.panelElement.style.width=g+"px",this.panelElement.style.height=v+"px"},H=()=>{e=![],document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",H)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const e=t.querySelector(".header");if(e){let t=![],n=0,i=0,o=0,r=0;e.addEventListener("mousedown",e=>{if(e.target.classList.contains("minimize"))return;t=!![],n=e.clientX,i=e.clientY;const s=this.panelElement.getBoundingClientRect();o=s.left,r=s.top,document.addEventListener("mousemove",U),document.addEventListener("mouseup",H),e.preventDefault()});const U=e=>{if(!t||!this.panelElement)return;const s=e.clientX-n,a=e.clientY-i;this.panelElement.style.left=o+s+"px",this.panelElement.style.top=r+a+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},H=()=>{t=![],document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",H)}}}createFloatingButton(){const t=document.createElement("div");return t.className="floating-btn",t.innerHTML="⚙️",t.title="Open Elements Debug Console",t.style.display="none",t.addEventListener("click",()=>{this.toggleVisibility()}),t}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(t){const e=document.createElement("div");e.className="log-entry "+t.type+" "+t.level;const n=new Date(t.timestamp).toLocaleTimeString();return e.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+n+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(t.message)+"\n "+(t.context?'<div class="log-context">'+this.escapeHtml(t.context)+"</div>":"")+"\n "+(t.data?'<div class="log-data"><pre>'+this.formatJsonData(t.data)+"</pre></div>":"")+"\n </div>\n ",e}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(e){return String(t)}}escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.h()){const e=this.u(t);if(e)return this.m(t,e)}return this.cachedFingerprint||(this.cachedFingerprint=this.v()),this.m(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.C(),browser:this.k(),timezone:this.S()}}isLocalStorageWebApiAvailable(){return this.h()}m(t,e){return(t+"_"+e).toLowerCase()}h(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const t=window.localStorage,e="__localStorage_test_"+Date.now()+"__",n="test";t.setItem(e,n);const i=t.getItem(e);return i!==n?(this.isLocalStorageAvailable=![],![]):(t.removeItem(e),this.isLocalStorageAvailable=!![],!![])}catch(t){const n=t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name);if(n)try{const t=window.localStorage;return t&&t.length>0?(this._()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(e){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],t instanceof DOMException){const e={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},n=e[t.name]||"Storage error: "+t.name,i=this._()?"webview":"browser";console.warn("localStorage unavailable in "+i+": "+n)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}u(t){try{const e=this.clientConfig.get("localStorageKeyPrefix")+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);if(null==n?void 0:n.startsWith(e)){const t=n.substring(e.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(e){return null}}v(){const t=this.getFingerprintData(),e=Object.keys(t).sort().map(e=>e+":"+t[e]).join("|");return this.D(e)}C(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,i=this.P(),o=Math.round(100*(window.devicePixelRatio||1));return e+"|"+n+"|"+i+"|"+o}catch(t){return"24|24|srgb|100"}}P(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(et){}return"srgb"}k(){var t;try{const e=navigator,n=[],i=((null===(t=e.languages)||void 0===t?void 0:t[0])||e.language||"en").substring(0,2);n.push(i),n.push(e.hardwareConcurrency||4);const o=(e.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);n.push(o),n.push(e.cookieEnabled?"1":"0"),n.push(e.maxTouchPoints||0),n.push(e.deviceMemory||0),n.push(this.I()),n.push(this._()?"webview":"browser");const r=["bluetooth"in e?"1":"0","usb"in e?"1":"0","mediaDevices"in e?"1":"0","permissions"in e?"1":"0","credentials"in e?"1":"0","storage"in e?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return n.push(r.join("")),n.join("|")}catch(e){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}I(){try{const t=navigator.userAgent.toLowerCase();return t.includes("instagram")?"ig_webview":t.includes("fban")||t.includes("fbav")?"fb_webview":t.includes("tiktok")?"tiktok_webview":t.includes("linkedin")?"linkedin_webview":t.includes("snapchat")?"snapchat_webview":t.includes("twitter")?"twitter_webview":t.includes("line/")?"line_webview":t.includes("micromessenger")?"wechat_webview":t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}_(){try{const t=navigator.userAgent.toLowerCase(),e=navigator,n=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return n.some(e=>t.includes(e))?!![]:void 0===e.standalone||e.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}S(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}D(t){const e=16777619;let n=2166136261,i=2166136261,o=2166136261,r=2166136261;for(let s=0;s<t.length;s++){const a=t.charCodeAt(s);n^=a,n=Math.imul(n,e),i^=a<<1,i=Math.imul(i,e),o^=a<<2,o=Math.imul(o,e),r^=a<<3,r=Math.imul(r,e)}return n=Math.abs(n),i=Math.abs(i),o=Math.abs(o),r=Math.abs(r),n.toString(16)+i.toString(16)+o.toString(16)+r.toString(16)}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance();const t=this.clientConfig.get("env"),n=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:n,batchSize:t===e.PRODUCTION?5:10,batchInterval:t===e.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(t,e,n={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const i=Date.now();try{const o={eventId:"event_"+i,timestamp:i,level:t,message:e,context:n.context,error:n.error?this.buildErrorContext(n.error):void 0,component:n.component,data:n.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(o)}catch(o){this.handleInternalError(o)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const t=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:t||void 0}}buildBrowserContext(){return{userAgent:navigator.userAgent,deviceType:this.clientConfig.get("deviceType"),url:window.location.href,referrer:document.referrer||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}shouldCapture(t){switch(t){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(t){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(t),this.stats.totalEvents++,this.stats.eventsByLevel[t.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var t;if(0===this.eventQueue.length||!(null===(t=this.config)||void 0===t?void 0:t.endpoint))return;const e=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const n=this.createBatch(e);try{this.sendBatch(n),this.stats.batchesSent++}catch(i){this.stats.failedBatches++,this.handleInternalError(i),this.eventQueue.unshift(...e),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const e=Date.now();return{batchId:"batch_"+e,timestamp:e,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const e=new Blob([JSON.stringify(t)],{type:"text/plain"}),n=navigator.sendBeacon(this.config.endpoint,e);if(n)return}catch(e){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const e=new XMLHttpRequest;if(e.open("POST",this.config.endpoint,![]),e.setRequestHeader("Content-Type","text/plain"),e.send(JSON.stringify(t)),e.status<200||e.status>=300)throw new SDKError("XHR request failed with status: "+e.status)}catch(e){throw new SDKError("Both sendBeacon and XHR failed: "+e.message)}}truncateStackTrace(t){if(t)return t.split("\n").slice(0,10).join("\n")}handleInternalError(t){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",t)}shutdown(){var t;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(t=this.config)||void 0===t?void 0:t.endpoint))){const t=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(t),this.stats.batchesSent++}catch(e){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:e}){var n;this.T=Object.freeze(t),this.F=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.T[n];return null==i?(this.logger.warn('Parameter "'+n+'" not found in component params for path "'+t+'"'),e):String(i)})}connectedCallback(){var t,e;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.F.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component connectedCallback error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"connectedCallback")}}disconnectedCallback(){var t,e;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(n){this.logger.error("Component disconnectedCallback error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"disconnectedCallback")}}setup(){var t,e,n;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(e=this.beforeConnected)||void 0===e||e.call(this)}catch(i){this.logger.error("Component setup error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const e of this.unsubscribers)try{e()}catch(t){this.logger.error("Cleanup error during component destruction",t),t instanceof Error&&this.captureComponentError(t,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var t;if(!this.reactiveOptions.autoDestroy)return;let e=this.reactiveOptions.autoDestroyPath;if(!e&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(e=this.reactiveOptions.watchStorePaths[0]),!e)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const n=this.interpolatePath(e),i=this.store.watch(n,(t,e)=>{this.isDestroyed||void 0===t&&void 0!==e&&this.handleAutoDestroy(n)});this.unsubscribers.push(i)}handleAutoDestroy(t){var e;if(this.isDestroyed)return;null===(e=this.beforeAutoDestroy)||void 0===e?void 0: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.F.tagName,e),e instanceof Error&&this.captureComponentError(e,"auto-destroy")}}setupStoreWatchers(){var t;try{let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.T)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;const n=t.map(t=>t.path).join(", "),i="store:["+n+"]",o=null===(e=this.onStoreChanged)||void 0===e?void 0:e.call(this,t);o!==![]&&this.triggerRender(i)}catch(i){this.logger.error("Store watcher callback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"storeWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Store watchers setup error in "+((null===(t=this.F)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"setupStoreWatchers")}}setupNonRenderingWatchers(){var t;try{let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.T)return;t=this.interpolateStorePaths(t);const e=this.store.watchMany(t,t=>{var e,n;try{if(this.isDestroyed)return;null===(e=this.onStoreWatch)||void 0===e?void 0:e.call(this,t)}catch(i){this.logger.error("Non-rendering watcher callback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"nonRenderingWatcher")}});this.unsubscribers.push(e)}catch(e){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.F)||void 0===t?void 0:t.tagName)||"unknown"),e),e instanceof Error&&this.captureComponentError(e,"setupNonRenderingWatchers")}}triggerRender(t){this.lastRenderTrigger=t,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var t,e;if(!this.initialized||this.isDestroyed)return;const n=performance.now();this.renderCount++;try{const e=this.template();"string"==typeof e&&(this.container.innerHTML=e),e instanceof HTMLElement&&safeReplaceChildren(this.container,e),Array.isArray(e)&&safeReplaceChildren(this.container,...e);const o=performance.now()-n;this.logRenderInfo(o);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(i){this.logger.error("❌ afterRender hook error in "+this.F.tagName,i),i instanceof Error&&this.captureComponentError(i,"afterRender")}}catch(o){const t=performance.now()-n;this.logger.error("❌ Component render error in "+this.F.tagName,o),this.captureComponentError(o,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.F.type,message:o instanceof Error?o.message:String(o)}));try{null===(e=this.onError)||void 0===e?void 0:e.call(this,o,"render")}catch(r){this.logger.error("❌ onError hook error in "+this.F.tagName,r)}}}logRenderInfo(t){const e=this.F.type,n=this.F.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,{duration:t,threshold:16,componentType:e,tagName:n,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+n+":performance",component:{type:e,tagName:n,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.F.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,e,n){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.F.tagName+":"+e,component:{type:this.F.type,tagName:this.F.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this.F.useShadowDom}})}catch(i){}}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.T}get config(){return this.themeProvider.getComponentConfig(this.F.type)}get elementConfig(){return this.F}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:o.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,i;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!==(i=c.showLabel)&&void 0!==i?i:!![],d=[];if(l){const t=document.createElement("span");t.textContent="Delivers to:",d.push(t)}const u=document.createElement("button");u.type="button",u.textContent=r.formattedAddress||"Select an address";const p=r.formattedAddress?"Change delivery address, currently set to "+r.formattedAddress:"Select delivery address";return u.setAttribute("aria-label",p),u.addEventListener("click",async()=>{if(s)return this.commands.ui.openDrawer(o.ADDRESS_INPUT,{productId:a,isIndependentComponent:!![]}),void 0;!s&&a&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(o.ADDRESS_INPUT,{productId:a}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(a,o.ADDRESS_INPUT,{productId:a}))}),d.push(u),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 '},ChevronUpIcon=({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 10.4712C3.78862 10.7316 4.21073 10.7316 4.47108 10.4712L7.99967 6.94265L11.5283 10.4712C11.7886 10.7316 12.2107 10.7316 12.4711 10.4712C12.7314 10.2109 12.7314 9.78878 12.4711 9.52843L8.47108 5.52843C8.21073 5.26808 7.78862 5.26808 7.52827 5.52843L3.52827 9.52843C3.26792 9.78878 3.26792 10.2109 3.52827 10.4712Z" fill="#18181B"/>\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 '},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.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");e.value=n;const i=n.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const o=/^\d/.test(i);if(i.length<this.minSearchLength||!o)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(i)},300)},this.closeDrawer=async()=>{const 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(et){this.logger.error("Address edit cancellation failed",et)}},this.handleCheckAvailability=async()=>{if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const t=this.getStoreValue("address"),e=(null==t?void 0:t.coordinates.latitude)!==this.selectedAddress.coordinates.latitude||(null==t?void 0:t.coordinates.longitude)!==this.selectedAddress.coordinates.longitude;e&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(t){this.logger.error("Address selection and availability check failed",t),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async t=>{const e=t.currentTarget.dataset.suggestionId;if(e)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(e);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:e,address:t.address,coordinates:t.coordinates,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(n){this.logger.error("Address details retrieval failed",n),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=t=>{this.container.contains(t.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const t=this.getStoreValue("address");(null==t?void 0:t.formattedAddress)&&(this.selectedAddress=t)}async searchAddresses(t){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const e=await this.commands.address.searchAddresses(t);this.suggestions=e.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(e){this.logger.error("Address search operation failed",e),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const t=this.errorContainer.querySelector(".error-text");t&&(t.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const t=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(t),void 0}for(const t of this.suggestions){const e=this.createElement("li",{className:"suggestion-item"}),n=this.createElement("span",{textContent:t.description});e.appendChild(n),e.setAttribute("data-suggestion-id",t.id),e.setAttribute("role","option"),e.setAttribute("aria-label","Select address: "+t.description),e.setAttribute("tabindex","0"),e.addEventListener("click",this.handleSuggestionClick),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())}),this.suggestionsContainer.appendChild(e)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,e){const n=document.createElement(t);return e&&Object.assign(n,e),n}createErrorContainer(){const t=this.createElement("div",{className:"error-message"});t.style.display="none",t.setAttribute("role","alert"),t.setAttribute("aria-live","assertive"),t.setAttribute("aria-atomic","true");const e=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),n=this.createElement("span",{className:"error-text"});return t.appendChild(e),t.appendChild(n),t}createCheckButton(){const t=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return t.setAttribute("aria-label","Save and check address availability"),t.addEventListener("click",this.handleCheckAvailability),t}createCancelButton(){const t=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return t.setAttribute("aria-label","Cancel address selection"),t.addEventListener("click",this.handleCancel),t}template(){var t,e,n;const 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.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),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.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const 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"}),u=this.createCancelButton();d.appendChild(u);const p=this.createCheckButton();return d.appendChild(p),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({watchStorePaths:["cart.rerender"]})}template(){const t=[],e=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!e){const e=ComponentFactoryService.createElement({type:o.CART_HEADER});t.push(e)}const n=ComponentFactoryService.createElement({type:o.CART_BODY});t.push(n);const i=ComponentFactoryService.createElement({type:o.CART_FOOTER});return t.push(i),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=this.config.layout.drawerHeaderText,e=document.createElement("div");e.className="empty-cart-container";const n=document.createElement("h3");return n.className="empty-cart-content",n.textContent="Your "+t.toLowerCase()+" is empty",e.appendChild(n),e}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:o.CART_RETAILER,retailerId:t.id})}catch(e){return this.logger.error("Cart retailer component creation failed",e),document.createElement("div")}}getRetailerElementById(t){return this.container.querySelector('[data-retailer-id="'+t+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const t=this.createEmptyCartElement();this.container.appendChild(t),this.setupEmptyCartListeners()}addLoadingOverlay(){const t=this.getLoadingElement();if(!t){const t=this.createLoadingElement();this.container.appendChild(t)}}removeLoadingOverlay(){const t=this.getLoadingElement();t&&t.remove()}setupEmptyCartListeners(){const t=this.container.querySelector('[data-action="continue-shopping"]');t&&t.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(t,e){const n=this.createRetailerElement(e);n.setAttribute("data-retailer-id",t),this.container.appendChild(n)}removeRetailerElement(t){const e=this.getRetailerElementById(t);e&&e.remove()}updateRetailerElement(t,e){const n=this.getRetailerElementById(t);if(n){const 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.subtotal","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.subtotal")),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"));e&&this.updateSubtotalItemsCount(),n&&this.subtotalPrice&&(this.subtotalPrice.textContent=formatCentToDollarText(this.getStoreValue("cart.subtotal"))),(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?!![]:![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments");return Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}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":"")+"):")}async handleCheckout(t){return this.clientConfig.isBuilder()?(t.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(t.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const t=this.getConfigs("global"),e=this.getStoreValue("cart.subtotal"),n=[],i=document.createElement("div");i.className="cart-footer-header";const r=document.createElement("div");r.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",r.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(e),r.appendChild(this.subtotalPrice);const s=document.createElement("p");if(s.textContent="Taxes & fees will be calculated at checkout",s.className="taxes-fees-info",i.appendChild(r),i.appendChild(s),n.push(i),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:o.CART_PROMO_CODE});n.push(t)}const a=ComponentFactoryService.createElement({type:o.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(n.push(a),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleCheckout(t)}),this.checkoutButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleCheckout(t))}),n.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:o.POWERED_BY,context:"general"});n.push(t)}return 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}handleItemsUpdate(t,e){const n=new Set(t||[]),i=new Set(e||[]);for(const o of n)if(!i.has(o)){const t=this.container.querySelector('[data-item-id="'+o+'"]');t&&t.remove()}for(const r of i)if(!n.has(r)){const t=ComponentFactoryService.createElement({type:o.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+".itemIds"),n=this.container.querySelectorAll("[data-item-id]");for(const i of n)i.remove();for(const i of e){const t=ComponentFactoryService.createElement({type:o.CART_ITEM,itemId:i});this.container.appendChild(t)}}setupMinimumPurchaseAlert(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t),n=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(n&&n.remove(),null==e?void 0:e.hasUnmetMinimumPurchaseAmount){const t=ComponentFactoryService.createElement({type:o.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(e.minimumPurchaseAmount-e.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:e.subtotal,config:{showIcon:!![],alertType:"minimal"}});t.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(t)}}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.itemIds)||void 0===t?void 0:t.length)?n.itemIds.some(t=>this.getStoreValue("cart.items."+t+".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.itemIds)||[],o=(null==e?void 0:e.itemIds)||[],r=JSON.stringify(n)!==JSON.stringify(o);r&&(this.handleItemsUpdate(n,o),this.checkAndUpdateLoadingState());const s=(null==t?void 0:t.subtotal)!==(null==e?void 0:e.subtotal),a=this.hasFulfillmentDataChanged(t,e,["itemIds","updating"]);if(s&&!a&&this.setupMinimumPurchaseAlert(),!a)return![]}return![]}hasFulfillmentDataChanged(t,e,n=[]){if(!t)return!![];const i=["type","canEngrave"];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[]}}const xt={CT:"America/New_York",DE:"America/New_York",FL:"America/New_York",GA:"America/New_York",IN:"America/New_York",KY:"America/New_York",ME:"America/New_York",MD:"America/New_York",MA:"America/New_York",MI:"America/New_York",NH:"America/New_York",NJ:"America/New_York",NY:"America/New_York",NC:"America/New_York",OH:"America/New_York",PA:"America/New_York",RI:"America/New_York",SC:"America/New_York",TN:"America/New_York",VT:"America/New_York",VA:"America/New_York",WV:"America/New_York",AL:"America/Chicago",AR:"America/Chicago",IL:"America/Chicago",IA:"America/Chicago",KS:"America/Chicago",LA:"America/Chicago",MN:"America/Chicago",MS:"America/Chicago",MO:"America/Chicago",NE:"America/Chicago",ND:"America/Chicago",OK:"America/Chicago",SD:"America/Chicago",TX:"America/Chicago",WI:"America/Chicago",AZ:"America/Phoenix",CO:"America/Denver",ID:"America/Denver",MT:"America/Denver",NV:"America/Los_Angeles",NM:"America/Denver",UT:"America/Denver",WY:"America/Denver",CA:"America/Los_Angeles",OR:"America/Los_Angeles",WA:"America/Los_Angeles",AK:"America/Anchorage",HI:"Pacific/Honolulu"},wt="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=xt[e];return n||wt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return wt}}function getCurrentTimeInTimezone(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(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 i=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=i,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.setAttribute("aria-label","Close cart drawer"),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:[],u=null!=l?l:d,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 g=ComponentFactoryService.createElement({context:"cart",type:o.PROMO_CODE_TICKER,tickers:u});return[s,g]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.params.itemId}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}handleOpenEngravingForm(t,e){var n,i,r,s,a,c,l,d,u,p;this.commands.ui.openDrawer(o.ENGRAVING_FORM,{identifier:t,context:"cart",lines:(null===(i=null===(n=e.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[],maxLines:(null===(s=null===(r=e.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxLines)||1,maxCharsPerLine:(null===(c=null===(a=e.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.maxCharsPerLine)||16,fee:(null===(d=null===(l=e.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.fee)||0,location:null===(p=null===(u=e.attributes)||void 0===u?void 0:u.engraving)||void 0===p?void 0:p.location})}template(){var t,e,n,i,r,s,a,c;const l=this.params.itemId,d=this.getStoreValue("cart.items."+l),u=this.getConfigs("global"),p=this.getStoreValue("cart.fulfillments."+d.fulfillmentId),m=d.attributes.engraving.hasEngraving?"Ships in 10 days":null==p?void 0:p.expectation,g=document.createElement("article");g.className="cart-item";const v=document.createElement("div");v.className="item-image";const b=document.createElement("img");b.src=d.mainImage,b.alt=d.name,v.appendChild(b);const x=document.createElement("div");x.className="item-details";const w=document.createElement("div");w.className="item-header";const C=document.createElement("h3");C.className="item-title",C.textContent=d.name;const k=document.createElement("button");k.className="item-delete",k.innerHTML=TrashIcon({}),k.setAttribute("role","button"),k.setAttribute("tabindex","0"),k.setAttribute("aria-label","Remove "+d.name+" from cart"),k.setAttribute("aria-expanded","true"),k.addEventListener("click",async()=>{await this.commands.cart.removeItem(l)}),k.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(l))}),w.appendChild(C),w.appendChild(k);const S=document.createElement("div");S.className="item-specs",S.textContent=d.size+", "+d.container;const E=document.createElement("div");E.className="item-shipping-container";const _=document.createElement("div");if(_.className="item-shipping",_.textContent=m,E.appendChild(_),u.layout.enablePersonalization&&(null===(e=null===(t=null==d?void 0:d.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.isEngravable)&&(null===(i=null===(n=null==d?void 0:d.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.hasEngraving)===![]&&p.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=u.layout.personalizationText+" +"+formatCentToDollarText((null===(s=null===(r=d.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.fee)||0,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+d.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(l,d)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(l,d))}),E.appendChild(t)}x.appendChild(w),x.appendChild(S),x.appendChild(E),g.appendChild(v),g.appendChild(x);const D=[g],I=ComponentFactoryService.createElement({type:o.CART_ITEM_QUANTITY_PRICE,itemId:l});if((null===(c=null===(a=null==d?void 0:d.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:o.ENGRAVING_VIEW,identifier:l,context:"cart"});D.push(t)}return D.push(I),D}}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,e;const n=this.getItemStore();if(!n)return 0;const i=n.partNumber,o=n.fulfillmentId,r=this.getStoreValue("cart.items")||{},s=Object.values(r).filter(t=>t.partNumber===i&&t.fulfillmentId===o),a=s.reduce((t,e)=>t+e.quantity,0),c=this.getStoreValue("products."+n.upc)||this.getStoreValue("products."+n.salsifyGrouping);if(!c)return n.maxQuantity-a;const l=(null===(e=null===(t=null==c?void 0:c.sizes)||void 0===t?void 0:t[n.liquidId])||void 0===e?void 0:e.maxQuantityPerOrder)||0;return!l||l<=0?n.maxQuantity-a:l-a}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=Boolean(null==n?void 0:n.code),o=Boolean(null==t?void 0:t.code);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.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+(null==t?void 0:t.code)),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),this.container.appendChild(e),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const e=document.createElement("div");e.classList.add("promo-container"),e.appendChild(this.createPromoInput()),e.appendChild(this.createApplyButton()),t.appendChild(e),this.container.appendChild(t),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),e=t.length>=3&&t.length<=255,n=this.getStoreValue("cart.loading"),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:o.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const M=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(t),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(e){this.logger.error("Cart promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}};return this.applyButton.addEventListener("click",M),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),M())}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==t?void 0:t.code){const e=document.createElement("div");e.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const n=document.createElement("button");return n.type="button",n.classList.add("promo-remove-btn"),n.textContent="Remove",n.setAttribute("role","button"),n.setAttribute("aria-label","Remove promo code "+t.code),n.setAttribute("tabindex","0"),n.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),e.appendChild(this.promoCodePill),e.appendChild(n),e}const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");return n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),e}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:o.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 Object.keys(e))this.addFulfillmentElement(o)}setupSubtotalElement(){const t=this.getRetailerId(),e=this.container.querySelector("#retailer-subtotal-container");if(e){const n=ComponentFactoryService.createElement({type:o.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=Object.keys((null==t?void 0:t.fulfillments)||{}),o=Object.keys(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"),n=this.container.querySelector(".section-header-label");if(t&&e&&n){const h=()=>{const e=t.checked;n.setAttribute("aria-label",e?"Expand retailer section":"Collapse retailer section"),n.setAttribute("aria-expanded",e?"false":"true")};t.addEventListener("change",()=>{t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),h()}),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),h()}}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",a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.setAttribute("aria-label","Collapse retailer section"),a.setAttribute("aria-expanded","true");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 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")||0,n=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,i=this.getStoreValue("cart.items"),o=this.getRetailerItemCount(i,t),r=1===o?"item":"items",s=document.createElement("h3");s.className="retailer-subtotal-header",s.textContent="Subtotal ("+o+" "+r+"):";const a=document.createElement("span");return a.className="retailer-subtotal-amount",a.textContent=formatCentToDollarText(e+n),[s,a]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var t,e,n;const i=this.store.get("checkout.presale"),r=this.getConfigs("global"),s=this.clientConfig.get("promoTicker"),a=null!==(e=null===(t=null==r?void 0:r.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],c=null!=s?s:a,l=this.store.get("address"),d=hasActiveItems(c,null===(n=null==l?void 0:l.address)||void 0===n?void 0:n.state),u=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),p=document.createElement("div");p.classList.add("checkout-container"),u&&p.classList.add("no-header"),this.params.isIndependentComponent&&p.classList.add("independent");const m=ComponentFactoryService.createElement({type:o.CHECKOUT_INFORMATION});p.appendChild(m);const g=ComponentFactoryService.createElement({type:o.CHECKOUT_ORDER_SUMMARY});if(p.appendChild(g),!i&&(!c.length||!d)&&u)return[p];const v=document.createElement("div");if(v.classList.add("checkout-header-wrapper"),!u){const t=ComponentFactoryService.createElement({type:o.CHECKOUT_HEADER});v.appendChild(t)}if(c.length&&d&&!i){const t=ComponentFactoryService.createElement({context:"checkout",type:o.PROMO_CODE_TICKER,tickers:c});v.appendChild(t)}if(i){const t=ComponentFactoryService.createElement({type:o.CHECKOUT_PRESALE_COUNTDOWN});v.appendChild(t)}return[v,p]}}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.keys(i.onDemandFulfillmentTipInfo||{}).length>0,c=Object.values(i.items||{}),l=[],d=document.createElement("div");d.classList.add("checkout-amount-line");const u=document.createElement("span");u.textContent="Subtotal ("+c.length+" item"+(c.length>1?"s":"")+")",d.appendChild(u);const p=document.createElement("span");p.textContent=formatCentToDollarText(i.amounts.subtotal),d.appendChild(p),l.push(d);const m=document.createElement("div");m.classList.add("checkout-amount-line");const g=document.createElement("span");g.textContent="Shipping",m.appendChild(g);const v=document.createElement("span");v.textContent=formatCentToDollarText(i.amounts.shipping),m.appendChild(v),l.push(m);const b=document.createElement("div");b.classList.add("checkout-amount-line");const x=document.createElement("span");x.textContent="Delivery",b.appendChild(x);const w=document.createElement("span");if(w.textContent=formatCentToDollarText(i.amounts.delivery),b.appendChild(w),l.push(b),(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),l.push(t)}const C=document.createElement("div");C.classList.add("checkout-amount-line");const k=document.createElement("span");k.textContent="Taxes & Fees",C.appendChild(k);const S=document.createElement("span");if(S.textContent=formatCentToDollarText(i.amounts.tax+i.amounts.service+i.amounts.platform),C.appendChild(S),l.push(C),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.toUpperCase())+")",t.appendChild(e);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(i.amounts.discounts),t.appendChild(o),l.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),l.push(t)}if(a){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Tips",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.tip),t.appendChild(n),l.push(t)}const E=document.createElement("div");E.classList.add("checkout-separator"),l.push(E);const _=document.createElement("div");_.classList.add("checkout-amount-total");const D=document.createElement("span");D.textContent="Total",_.appendChild(D);const I=document.createElement("span");if(I.textContent=formatCentToDollarText(i.amounts.total),_.appendChild(I),l.push(_),i.presale){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),l.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),l.push(i)}return l}}class CheckoutBillingComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.paymentForm.billingSameAsShipping"]}),this.billingData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},addressOne:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},city:{isValid:![],value:""},state:{isValid:![],value:""},zipCode:{isValid:![],value:""}}}billingSameAsShippingToggle(){const t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"),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"),i.setAttribute("role","checkbox"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label","Billing same as shipping checkbox"),i.setAttribute("aria-checked",t?"true":"false"),t&&i.classList.add("checked"),i.innerHTML=CheckboxIcon({width:16,height:16}),e.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),e.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const 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}updateSaveButtonState(){const t=!Object.values(this.billingData).every(t=>t.isValid),e={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,addressOne:this.billingData.addressOne.value,addressTwo:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zipCode:this.billingData.zipCode.value};this.params.isFormValid(!t,e)}template(){const t=this.getStoreValue("checkout.paymentForm"),e=[],n=this.billingSameAsShippingToggle();if(e.push(n),t.billingSameAsShipping)return e;t.data&&(t.data.firstName&&(this.billingData.firstName={isValid:!![],value:t.data.firstName}),t.data.lastName&&(this.billingData.lastName={isValid:!![],value:t.data.lastName}),t.data.email&&(this.billingData.email={isValid:!![],value:t.data.email}),t.data.phone&&(this.billingData.phone={isValid:!![],value:t.data.phone}),t.data.company&&(this.billingData.company={isValid:!![],value:t.data.company}),t.data.addressOne&&(this.billingData.addressOne={isValid:!![],value:t.data.addressOne}),t.data.addressTwo&&(this.billingData.addressTwo={isValid:!![],value:t.data.addressTwo}),t.data.city&&(this.billingData.city={isValid:!![],value:t.data.city}),t.data.state&&(this.billingData.state={isValid:!![],value:t.data.state}),t.data.zipCode&&(this.billingData.zipCode={isValid:!![],value:t.data.zipCode})),this.updateSaveButtonState();const r=document.createElement("div");r.classList.add("section-title-container");const s=document.createElement("h3");s.textContent="Your billing info",s.classList.add("section-title"),r.appendChild(s);const a=document.createElement("p");a.textContent="Provide the info relevant to your payment method",a.classList.add("section-subtitle"),r.appendChild(a),e.push(r);const c=document.createElement("div");c.classList.add("section-form-container");const l=document.createElement("div");l.classList.add("checkout-two-col-container");const d=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:vt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:vt.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});d.setAttribute("aria-label","First name input"),l.appendChild(d);const u=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:vt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:vt.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});u.setAttribute("aria-label","Last name input"),l.appendChild(u),c.appendChild(l);const p=ComponentFactoryService.createElement({type:o.INPUT,inputType:"email",name:vt.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:vt.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});p.setAttribute("aria-label","Email input"),c.appendChild(p);const m=document.createElement("div");m.classList.add("checkout-two-col-container");const g=ComponentFactoryService.createElement({type:o.INPUT,inputType:"tel",name:vt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:vt.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});g.setAttribute("aria-label","Phone input"),m.appendChild(g);const v=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:vt.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:vt.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});v.setAttribute("aria-label","Company input"),m.appendChild(v),c.appendChild(m);const b=document.createElement("div");b.classList.add("checkout-two-col-container");const x=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:vt.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:vt.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});x.setAttribute("aria-label","Street address input"),b.appendChild(x);const w=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:vt.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:vt.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});w.setAttribute("aria-label","Apt, suite, etc. (optional) input"),b.appendChild(w),c.appendChild(b);const C=document.createElement("div");C.classList.add("checkout-three-col-container");const k=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:vt.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:vt.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});k.setAttribute("aria-label","City input"),C.appendChild(k);const S=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:vt.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:t=>t&&2===t.length&&/^[A-Z]{2}$/.test(t)?null:"State must be 2 uppercase characters"},onChange:async t=>{this.billingData.state.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:vt.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});S.setAttribute("aria-label","State input"),C.appendChild(S);const E=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:vt.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:vt.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return E.setAttribute("aria-label","Zip Code input"),C.appendChild(E),c.appendChild(C),e.push(c),e}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(t){const e=t.find(t=>"checkout.customerForm.isSaving"===t.path);e&&(e.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const t=this.store.get("checkout.customerForm.data");t.firstName&&(this.customerData.firstName={isValid:!![],value:t.firstName}),t.lastName&&(this.customerData.lastName={isValid:!![],value:t.lastName}),t.email&&(this.customerData.email={isValid:!![],value:t.email}),t.phone&&(this.customerData.phone={isValid:!![],value:t.phone}),t.company&&(this.customerData.company={isValid:!![],value:t.company}),t.birthDate&&(this.customerData.birthDate={isValid:!![],value:t.birthDate});const e=[],n=document.createElement("div");n.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Buyer Information",r.classList.add("section-title"),n.appendChild(r);const s=document.createElement("p");s.textContent="Buyer information is used to process your order and for delivery purposes.",s.classList.add("section-subtitle"),n.appendChild(s),e.push(n);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:o.INPUT,inputType:"text",name:ft.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});c.appendChild(l);const d=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:ft.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});c.appendChild(d),a.appendChild(c);const u=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:ft.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});a.appendChild(u);const p=ComponentFactoryService.createElement({type:o.INPUT,inputType:"email",name:ft.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});a.appendChild(p);const m=ComponentFactoryService.createElement({type:o.INPUT,inputType:"tel",name:ft.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});a.appendChild(m);const g=ComponentFactoryService.createElement({type:o.BIRTHDATE_INPUT,inputType:"date",name:ft.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return a.appendChild(g),e.push(a),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),e.push(this.saveButton),this.updateSaveButtonState(),e}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const t=[],e=this.getStoreValue("checkout.customerForm.data"),n=document.createElement("div");n.classList.add("checkout-summary-form-header");const i=document.createElement("h2");i.textContent="Buyer: "+e.firstName+" "+e.lastName,n.appendChild(i);const o=document.createElement("span");if(o.textContent="Edit",o.setAttribute("aria-label","Edit Buyer Information"),o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),o.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editCustomerForm())}),n.appendChild(o),t.push(n),e.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=e.company,t.push(n)}const r=document.createElement("p");r.classList.add("checkout-summary-form-line"),r.textContent=e.email,t.push(r);const s=document.createElement("p");s.classList.add("checkout-summary-form-line"),s.textContent=e.phone,t.push(s);const a=document.createElement("p");return a.classList.add("checkout-summary-form-line"),a.textContent=formatISODateToMMDDYYYY(e.birthDate),t.push(a),t}}const Ct=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],kt={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(t,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(Ct.includes(n)){const t=document.createElement(n),i=kt[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 CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,e,n,i,r,s;const a=[],c=this.getConfigs("configurations"),l=this.getConfigs("global"),d=this.getConfigs("checkout"),u=this.config.layout.exitUrl||window.location.host,p=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(e=null===(t=this.config.layout)||void 0===t?void 0:t.checkoutCompleted)||void 0===e?void 0:e.customLogo){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const e=document.createElement("img");e.src=null===(i=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===i?void 0:i.customLogo,e.alt=c.partnerName+" Logo",t.appendChild(e),a.push(t)}const m=document.createElement("div");m.classList.add("checkout-completed-section-container");const g=document.createElement("div");g.classList.add("checkout-completed-title-container");const v=document.createElement("div");v.classList.add("checkout-completed-title-section");const b=document.createElement("h3");b.innerHTML=(null===(s=null===(r=this.config.layout)||void 0===r?void 0:r.checkoutCompleted)||void 0===s?void 0:s.customText)||"Thank You for Your Order!",v.appendChild(b);const x=document.createElement("p");x.textContent="Your payment has been successfully processed.",v.appendChild(x),g.appendChild(v),m.appendChild(g);const w=document.createElement("div");w.classList.add("checkout-completed-sub-section");const C=document.createElement("div");C.classList.add("checkout-completed-line");const k=document.createElement("h3");k.textContent="Order Number",C.appendChild(k);const S=document.createElement("span");S.textContent=this.params.orderNumber,C.appendChild(S),w.appendChild(C);const E=document.createElement("div");E.classList.add("checkout-completed-line");const _=document.createElement("h3");_.textContent="Order Amount",E.appendChild(_);const D=document.createElement("span");D.textContent=""+formatCentToDollarText(this.params.orderTotal),E.appendChild(D),w.appendChild(E);const I=document.createElement("div");I.classList.add("checkout-completed-line");const T=document.createElement("h3");T.textContent="Payment Method",I.appendChild(T);const z=document.createElement("span");z.textContent="** "+this.params.cardLast4,I.appendChild(z),w.appendChild(I),m.appendChild(w);const L=document.createElement("div");L.classList.add("checkout-completed-sub-section");const B=document.createElement("p");B.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<br><br>A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.":"A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.",L.appendChild(B),m.appendChild(L),a.push(m);const j=document.createElement("div");j.classList.add("checkout-completed-section-container");const V=document.createElement("button");V.type="button";const G=document.createElement("span");G.textContent=p,V.setAttribute("tabindex","0"),V.setAttribute("role","button"),V.setAttribute("aria-label",p),V.appendChild(G);const K=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:l.theme.selectedTextColor}));V.appendChild(K),V.addEventListener("click",()=>{window.location.href=u}),V.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=u)}),j.appendChild(V),a.push(j);const Y=document.createElement("div");Y.classList.add("checkout-completed-section-container");const W=document.createElement("div");W.classList.add("checkout-completed-help-section"),Y.appendChild(W);const Q=document.createElement("p");Q.textContent="Questions about your order? Contact us at ";const J=document.createElement("a");J.href="mailto:"+c.supportEmail,J.textContent=c.supportEmail,Q.appendChild(J),W.appendChild(Q);const $=document.createElement("p"),tt=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if($.textContent="Order placed on "+tt,W.appendChild($),a.push(Y),d.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const e=document.createElement("div");e.classList.add("checkout-legal-message"),e.innerHTML=sanitizeHTML(d.layout.legalMessage.text);const n=document.createElement("div");n.classList.add("checkout-separator"),a.push(t),a.push(e),a.push(n)}if(l.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:o.POWERED_BY,context:"general"});a.push(t)}return a}}class CheckoutDeliverToComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift"],watchOnlyStorePaths:["checkout.customerForm.isSaving","checkout.giftRecipientForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},birthDate:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.giftData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},message:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.saveButtonText="Save Delivery Information"}onStoreWatch(t){const e=t.find(t=>"checkout.customerForm.isSaving"===t.path),n=t.find(t=>"checkout.giftRecipientForm.isSaving"===t.path);(null==e?void 0:e.value)||(null==n?void 0:n.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const t=this.getStoreValue("checkout.isGift")||![];let e;e=t?!(this.giftData.firstName.isValid&&this.giftData.lastName.isValid&&this.giftData.email.isValid&&this.giftData.phone.isValid&&this.giftData.message.isValid&&this.giftData.addressTwo.isValid):!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid),this.saveButton.disabled=e}template(){const t=this.getConfigs("global"),e=this.getStoreValue("checkout.isGift"),n=this.store.get("checkout.giftRecipientForm.data"),r=this.store.get("checkout.customerForm.data"),s=this.store.get("address.formattedAddress"),a=e?n:r,c=this.store.get("checkout.shippingAddressTwo"),l=this.store.get("checkout.deliveryInstructions");r.firstName&&(this.customerData.firstName={isValid:!![],value:r.firstName}),r.lastName&&(this.customerData.lastName={isValid:!![],value:r.lastName}),r.email&&(this.customerData.email={isValid:!![],value:r.email}),r.phone&&(this.customerData.phone={isValid:!![],value:r.phone}),r.company&&(this.customerData.company={isValid:!![],value:r.company}),r.birthDate&&(this.customerData.birthDate={isValid:!![],value:r.birthDate}),n.firstName&&(this.giftData.firstName={isValid:!![],value:n.firstName}),n.lastName&&(this.giftData.lastName={isValid:!![],value:n.lastName}),n.email&&(this.giftData.email={isValid:!![],value:n.email}),n.phone&&(this.giftData.phone={isValid:!![],value:n.phone}),n.message&&(this.giftData.message={isValid:!![],value:n.message}),c&&(this.customerData.addressTwo={isValid:!![],value:c},this.giftData.addressTwo={isValid:!![],value:c}),l&&(this.customerData.deliveryInstructions={isValid:!![],value:l},this.giftData.deliveryInstructions={isValid:!![],value:l});const d=Object.keys(this.store.get("checkout.onDemandFulfillmentTipInfo")||{}).length>0,u=[],p=document.createElement("div");p.classList.add("delivery-header-container");const m=document.createElement("div");m.classList.add("delivery-header-content");const g=document.createElement("div");g.classList.add("delivery-title-container");const v=document.createElement("h3");v.textContent="Deliver to",v.classList.add("delivery-title");const b=document.createElement("p");b.textContent="Package recipient must be 21+",b.classList.add("delivery-subtitle"),g.appendChild(v),g.appendChild(b),p.appendChild(g),u.push(p);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:o.INPUT,inputType:"text",name:e?gt.firstName:ft.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:a.firstName,onChange:t=>{e?(this.giftData.firstName.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:gt.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.firstName}))},onValidation:t=>{e?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});C.setAttribute("aria-label","First Name Input"),w.appendChild(C);const k=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:e?gt.lastName:ft.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:a.lastName,onChange:t=>{e?(this.giftData.lastName.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:gt.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.lastName}))},onValidation:t=>{e?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(k.setAttribute("aria-label","Last Name Input"),w.appendChild(k),x.appendChild(w),!e){const t=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:ft.company,label:"Company (optional)",autocomplete:!![],value:a.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),x.appendChild(t)}const S=ComponentFactoryService.createElement({type:o.INPUT,inputType:"email",name:e?gt.email:ft.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:a.email,onChange:t=>{e?(this.giftData.email.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:gt.email})):(this.customerData.email.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.email}))},onValidation:t=>{e?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});S.setAttribute("aria-label","Email Input"),x.appendChild(S);const E=ComponentFactoryService.createElement({type:o.INPUT,inputType:"tel",name:e?gt.phone:ft.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:a.phone,onChange:t=>{e?(this.giftData.phone.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:gt.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.phone}))},onValidation:t=>{e?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(E.setAttribute("aria-label","Phone Input"),x.appendChild(E),!e){const t=ComponentFactoryService.createElement({type:o.BIRTHDATE_INPUT,inputType:"date",name:ft.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:a.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),x.appendChild(t)}const _=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:s,disabled:!![],className:"disabled-input"});_.setAttribute("aria-label","Delivery Address Input"),x.appendChild(_);const D=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:e?gt.addressTwo:ft.addressTwo,label:"Apt, suite, etc. (optional)",value:c,onChange:t=>{e?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:gt.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:ft.addressTwo}))},onValidation:t=>{e?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(D.setAttribute("aria-label","Address Line 2 Input"),x.appendChild(D),e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const o=document.createElement("label");o.textContent="Gift Message*",o.setAttribute("for",gt.message);const r=document.createElement("textarea");r.name=gt.message,r.id=gt.message,r.rows=4,r.value=n.message||"",r.setAttribute("aria-label","Gift Message Textarea"),r.addEventListener("input",async t=>{const e=t.target.value;this.giftData.message.value=e,this.giftData.message.isValid=e.length>0,this.pubSub.publishForm(i.GIFT,{fieldName:gt.message}),this.updateSaveButtonState()});const s=document.createElement("p");s.textContent="Your gift message will be emailed to the recipient along with delivery details.",s.classList.add("textarea-message-disclaimer"),e.appendChild(o),e.appendChild(r),e.appendChild(s),x.appendChild(e)}if(d){const n=document.createElement("div");n.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Delivery Instructions",i.setAttribute("for","delivery_instructions");const o=document.createElement("textarea");o.id="delivery_instructions",o.name="delivery_instructions",o.rows=4,o.setAttribute("aria-label","Delivery Instructions Textarea"),o.value=l,o.addEventListener("input",async t=>{const n=t.target.value;e?(this.giftData.deliveryInstructions.value=n,this.giftData.deliveryInstructions.isValid=n.length>0):(this.customerData.deliveryInstructions.value=n,this.customerData.deliveryInstructions.isValid=n.length>0)});const r=document.createElement("p");r.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",r.classList.add("textarea-message-disclaimer"),n.appendChild(i),n.appendChild(o),n.appendChild(r),x.appendChild(n)}u.push(x),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const f=async()=>{e?await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}):await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:this.customerData.deliveryInstructions.value})};return this.saveButton.addEventListener("click",f),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await f())}),u.push(this.saveButton),this.updateSaveButtonState(),u}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const t=[],e=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm.data"),i=this.getStoreValue("checkout.giftRecipientForm.data"),o=this.getStoreValue("address"),r=this.getStoreValue("checkout.deliveryInstructions"),s=this.getStoreValue("checkout.shippingAddressTwo"),a=document.createElement("div");a.classList.add("checkout-summary-form-header");const c=document.createElement("h2");c.textContent=e?"Delivering to "+i.firstName+" "+i.lastName:"Delivering to "+n.firstName+" "+n.lastName,a.appendChild(c);const l=document.createElement("span");l.textContent="Edit",l.setAttribute("aria-label","Edit Delivery Information"),l.setAttribute("role","button"),l.setAttribute("tabindex","0");const O=async()=>{e?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(l.addEventListener("click",O),l.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await O())}),a.appendChild(l),t.push(a),!e&&n.company){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=n.company,t.push(e)}const d=document.createElement("p");d.classList.add("checkout-summary-form-line"),d.textContent=o.address.one+(s?", "+s:"")+", "+o.address.city+", "+o.address.state+", "+o.address.zip,t.push(d);const u=document.createElement("p");u.classList.add("checkout-summary-form-line"),u.textContent=e?i.email:n.email,t.push(u);const p=document.createElement("p");if(p.classList.add("checkout-summary-form-line"),p.textContent=e?i.phone:n.phone,t.push(p),!e&&n.birthDate){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=formatISODateToMMDDYYYY(n.birthDate),t.push(e)}if(e){const e=document.createElement("div");e.classList.add("checkout-summary-form-line-container");const n=document.createElement("span");n.classList.add("checkout-summary-form-line-container-label"),n.textContent="Gift Message:",e.appendChild(n);const o=document.createElement("span");o.classList.add("checkout-summary-form-line"),o.textContent=i.message||"No message provided.",e.appendChild(o),t.push(e)}if(r){const e=document.createElement("div");e.classList.add("checkout-summary-form-line-container");const n=document.createElement("span");n.classList.add("checkout-summary-form-line-container-label"),n.textContent="Delivery Instructions:",e.appendChild(n);const i=document.createElement("span");i.classList.add("checkout-summary-form-line"),i.textContent=r||"No instructions provided.",e.appendChild(i),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<=255,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:o.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.giftCardInput;n.setValue(e),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const M=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(e){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",M),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),M())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const t=[];return t.push(this.createGiftCardInput()),t.push(this.createApplyButton()),t}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.presale"),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(o.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),n.appendChild(t)}const i=document.createElement("h1");i.textContent=(null==e?void 0:e.layout.drawerHeaderText)||"Checkout",i.classList.add("checkout-header-title"),i.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,i,r]:[i,r]}}class CheckoutInformationComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift","checkout.customerForm.isEditing","checkout.giftRecipientForm.isEditing","checkout.paymentForm.isEditing"]})}onStoreWatch(){const t=this.getStoreValue("checkout.isGift"),e=this.getStoreValue("checkout.customerForm.isEditing"),n=this.getStoreValue("checkout.giftRecipientForm.isEditing"),i=this.getStoreValue("checkout.paymentForm.isEditing");t?(this.buyerForm.style.display=e?"block":"none",this.buyerSummary.style.display=e?"none":"block",this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block"):(this.deliveryToForm.style.display=e?"block":"none",this.deliverToSummary.style.display=e?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=i?"block":"none",this.paymentSummary.style.display=i?"none":"block"}template(){const t=[],e=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm"),i=this.getStoreValue("checkout.giftRecipientForm"),r=this.getStoreValue("checkout.paymentForm"),s=ComponentFactoryService.createElement({type:o.CHECKOUT_SEND_AS_GIFT});return t.push(s),this.deliveryToForm=ComponentFactoryService.createElement({type:o.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=e?i.isEditing?"block":"none":n.isEditing?"block":"none",t.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:o.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=e?i.isEditing?"none":"block":n.isEditing?"none":"block",t.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:o.CHECKOUT_BUYER}),this.buyerForm.style.display=e&&n.isEditing?"block":"none",t.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:o.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=e&&!n.isEditing?"block":"none",t.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:o.CHECKOUT_PAYMENT}),this.paymentForm.style.display=r.isEditing?"block":"none",t.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:o.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=r.isEditing?"none":"block",t.push(this.paymentSummary),t}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(t){var e,n,i,o;const r=t.find(t=>"checkout.items"===t.path);r&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const s=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(s){const t=s.oldValue,r=s.value;if(r.updating)return![];const a=(null==t?void 0:t.quantity)!==(null==r?void 0:r.quantity),c=(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],l=(null===(o=null===(i=null==r?void 0:r.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],d=JSON.stringify(c)!==JSON.stringify(l);(a||d)&&this.updateEngravingElement(r)}return![]}updateEngravingElement(t){var e,n;const i=this.getConfigs("global"),r=this.container.querySelector(".engraving-view-container");if(r&&r.remove(),(null===(n=null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]&&i.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:o.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),n=this.container.querySelector(".checkout-item-card-footer");n&&n.before(e)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const e=t.fulfillmentId;if(!e)return;if(!this.container)return;const n=this.container.querySelector(".checkout-item-card-header");if(n){const t=this.getStoreValue("cart.fulfillments."+e),i=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(i&&i.remove(),t.hasUnmetMinimumPurchaseAmount){const e=ComponentFactoryService.createElement({type:o.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(t.minimumPurchaseAmount-t.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:t.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","checkout-retailer-alert"),n.before(e)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),e=Object.keys(t.items).length,n=1===e;this.trashButton.disabled=n,n?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","item-loading-overlay");const e=document.createElement("div");e.className="cart-loading-spinner-container";const n=document.createElement("div");return n.className="cart-loading-spinner",n.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',e.appendChild(n),t.appendChild(e),t}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const t=this.createLoadingOverlay();this.container.appendChild(t),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const t=this.container.querySelector('[data-loading-id="item-loading-overlay"]');t&&(t.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const t=this.getStoreValue("checkout.items."+this.params.itemId);return t?t.updating===!![]:![]}checkAndUpdateLoadingState(){const t=this.isItemUpdating(),e=this.hasLoadingOverlay();t&&!e?this.showLoadingOverlay():!t&&e&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,e,n;const i=this.getConfigs("global"),r=this.getStoreValue("checkout.items."+this.params.itemId),s=null===(t=null==r?void 0:r.attributes)||void 0===t?void 0:t.presale,a=(null==s?void 0:s.isActive)&&(null==s?void 0:s.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(s.estimatedShipBy):"";if(!r)return[];const c=document.createElement("div");c.classList.add("checkout-item-card-header");const l=document.createElement("div");l.classList.add("checkout-item-image");const d=document.createElement("img");d.src=r.mainImage,d.alt=r.name,d.loading="lazy",l.appendChild(d),c.appendChild(l);const u=document.createElement("div");u.classList.add("checkout-item-details-container");const p=document.createElement("h4");p.classList.add("checkout-item-title"),p.textContent=r.name,u.appendChild(p);const m=document.createElement("div");m.classList.add("checkout-item-subtitle");const g=document.createElement("span");g.textContent=s.isActive?""+a:((null==r?void 0:r.expectationDetail)||"")+",",m.appendChild(g);const v=document.createElement("span");v.textContent="From "+((null==r?void 0:r.retailerName)||""),m.appendChild(v),u.appendChild(m),c.appendChild(u),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(r.cartItemId)}catch(n){this.logger.error("Checkout item removal failed",n)}}),c.appendChild(this.trashButton);const b=ComponentFactoryService.createElement({type:o.CHECKOUT_ITEM_QUANTITY,itemId:r.cartItemId}),x=[];if(x.push(c),i.layout.enablePersonalization&&(null===(n=null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:o.ENGRAVING_VIEW,identifier:r.cartItemId,context:"checkout"});x.push(t)}return x.push(b),x}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(t){const e=t.find(t=>"checkout.items"===t.path);if(e){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,e,n;const i=this.getStoreValue("checkout.items."+this.params.itemId);if(!i)return 0;const o=this.getStoreValue("products");if(!o)return 0;const r=i.partNumber,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.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.getStoreValue("checkout.items."+this.params.itemId);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",i)}}}template(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const e=this.calculateQuantityLimits(),n=document.createElement("div");n.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),n.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),n.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),n.appendChild(this.increaseButton),this.updateButtonStates(e);const i=document.createElement("span");if(i.classList.add("checkout-item-price-text"),i.textContent=formatCentToDollarText(t.price),t.quantity>1){const e=document.createElement("span");e.classList.add("checkout-item-price-each-text"),e.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",i.appendChild(e)}return[n,i]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(t){return ComponentFactoryService.createElement({type:o.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 Object.values(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(),![]):![]}handleToggle(){const t=this.container.querySelector(".checkout-items-toggler-button"),e=this.container.querySelector(".checkout-items-list");if(t&&e){const n=e.classList.contains("show");e.classList.toggle("show"),t.classList.toggle("expanded"),n?(t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label","Expand checkout items")):(t.setAttribute("aria-expanded","true"),t.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const t=this.container.querySelector(".checkout-items-toggler"),e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");if(t&&e&&n){const i=n.classList.contains("show");e.setAttribute("tabindex","0"),e.setAttribute("aria-expanded",i?"true":"false"),e.setAttribute("aria-label",i?"Collapse checkout items":"Expand checkout items"),t.addEventListener("click",()=>this.handleToggle()),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.items"),e=Object.values(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 CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const e=t.find(t=>"checkout.amounts"===t.path);if(e){const t=this.getStoreValue("checkout"),e=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&e>0)}}updateZeroAmountElement(t){const e=this.container.querySelector(".checkout-zero-amount-container");if(t&&!e){const t=document.createElement("div");t.classList.add("checkout-zero-amount-container"),t.textContent="Credit card required to complete order (even when fully covered by gift card)";const e=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");e&&e.after(t)}else!t&&e&&e.remove()}afterRender(){const t=this.getStoreValue("checkout.amounts");t&&this.updateZeroAmountElement(0===t.total)}handleEmailToggle(t){this.commands.checkout.toggleMarketingPreferences("canEmail"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const e=t.classList.contains("checked");t.setAttribute("aria-checked",e?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,e=this.config.layout.smsOptIn;if(!t.show&&!e.show)return null;const n=document.createElement("div");if(n.classList.add("checkout-marketing-opt-ins-container"),t.show){const e=document.createElement("div");let 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.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Email opt-in checkbox"),o.setAttribute("aria-checked",i?"true":"false"),o.addEventListener("click",()=>this.handleEmailToggle(o)),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(o))});const r=document.createElement("label");r.setAttribute("for","emailOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(t.text),r.addEventListener("click",t=>{const 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.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","SMS opt-in checkbox"),o.setAttribute("aria-checked",i?"true":"false"),o.addEventListener("click",()=>this.handleSmsToggle(o)),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(o))});const r=document.createElement("label");r.setAttribute("for","smsOptIn"),r.classList.add("checkbox-label"),r.innerHTML=sanitizeHTML(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"),i=this.getConfigs("checkout"),r=this.getConfigs("global"),s=i.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:o.CHECKOUT_ITEMS});e.push(d);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:o.CHECKOUT_PC_GC});e.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:o.CHECKOUT_TIPS});e.push(t),e.push(p)}const m=document.createElement("div");m.classList.add("section-title-container");const g=document.createElement("h3");g.textContent="100% Secure Payments",g.classList.add("disclaimer-header"),m.appendChild(g);const v=document.createElement("p");v.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",v.classList.add("disclaimer-description"),m.appendChild(v),e.push(m);const b=ComponentFactoryService.createElement({type:o.CHECKOUT_AMOUNTS});e.push(b);const x=ComponentFactoryService.createElement({type:o.CHECKOUT_PLACE_ORDER_BUTTON});e.push(x);const w=this.marketingOptInsContainer();if(w&&e.push(w),i.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(i.layout.legalMessage.text),e.push(t),e.push(n)}const C=document.createElement("div");if(C.classList.add("checkout-separator"),e.push(C),n.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:o.POWERED_BY,context:"checkout"});e.push(t)}return e}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.hardcodedPaymentElement=null,this.billingFormData=null,this.isValidBillingForm=![],this.isBillingSameAsShipping=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.savedCardInfo=null,this.showingStripeSummary=![],this.isSavingPayment=![]}onStoreWatch(t){for(const e of t)switch(e.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=e.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(e.value)}}handleBillingSameAsShippingChange(t){this.isBillingSameAsShipping=t,t&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var t;this.isBillingSameAsShipping=null!==(t=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==t?t:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let t=!![],e="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)e="Saving...",t=!![];else if(this.stripeFormStatus.hasError)e="Fix Errors and Retry",t=![];else if(this.showingStripeSummary&&this.savedCardInfo){const e=this.isBillingSameAsShipping||this.isValidBillingForm;t=!e}else{const e=this.stripeFormStatus.isFormComplete,n=this.isBillingSameAsShipping||this.isValidBillingForm;t=!(e&&n)}this.saveButton.disabled=t,this.saveButton.textContent=e,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let t="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?t=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(t="Please complete the billing address form"),t?(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(t){this.errorMessageElement&&(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===t&&(this.errorMessageElement.style.display="none")},5e3))}template(){const t=[],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");if(i.textContent="All transactions are secure and encrypted.",i.classList.add("section-subtitle"),e.appendChild(i),t.push(e),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const e=document.createElement("p");e.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(e),t.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:o.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:t=>{this.stripeFormStatus=t,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:t=>{this.savedCardInfo=t},onEditModeVisibilityChanged:t=>{this.showingStripeSummary=t,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(t,e)=>{const n={paymentSession:{confirmationTokenId:t,setupIntentId:e}};!this.isBillingSameAsShipping&&this.billingFormData&&(n.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(n)}}}),t.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),t.push(this.errorMessageElement);const r=ComponentFactoryService.createElement({type:o.CHECKOUT_BILLING,isFormValid:(t,e)=>{this.billingFormData=e,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return t.push(r),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleSaveButtonClick())}),t.push(this.saveButton),t}async handleSaveButtonClick(){var t;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(e){this.logger.error("Failed to save payment form in edit mode",e),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(n){this.logger.error("Failed to save payment form in beta mode",n),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(t=this.stripeHandlerElement)||void 0===t||t.submitStripeForm())}validatePrerequisites(){return this.isBillingSameAsShipping||this.isValidBillingForm?this.stripeFormStatus.isFormComplete?!![]:(this.showError("Please complete all required payment fields."),![]):(this.showError("Please complete the billing address form before saving."),![])}disconnected(){var t;this.isSavingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var t,e,n,i,o,r,s,a,c,l;const d=[],u=this.getStoreValue("checkout.paymentForm"),p=document.createElement("div");p.classList.add("checkout-summary-form-header");const m=document.createElement("h2");m.textContent="Paying with "+capitalizeFirstLetter(null!==(n=null===(e=null===(t=u.paymentMethod)||void 0===t?void 0:t.card)||void 0===e?void 0:e.brand)&&void 0!==n?n:"")+" "+(null===(o=null===(i=u.paymentMethod)||void 0===i?void 0:i.card)||void 0===o?void 0:o.last4),p.appendChild(m);const g=document.createElement("span");g.textContent="Edit",g.setAttribute("aria-label","Edit Payment Information"),g.setAttribute("role","button"),g.setAttribute("tabindex","0"),g.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),g.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editPaymentForm())}),p.appendChild(g),d.push(p);const v=document.createElement("p");return v.classList.add("checkout-summary-form-line"),v.textContent="Exp. "+(null===(s=null===(r=u.paymentMethod)||void 0===r?void 0:r.card)||void 0===s?void 0:s.expMonth)+"/"+(null===(l=null===(c=null===(a=u.paymentMethod)||void 0===a?void 0:a.card)||void 0===c?void 0:c.expYear)||void 0===l?void 0:l.slice(-2)),d.push(v),d}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.error","checkout.customerForm.isValid","checkout.giftRecipientForm.isValid","checkout.paymentForm.isValid"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreWatch(t){const e=t.some(t=>"checkout.loading"===t.path||"checkout.error"===t.path||"checkout.customerForm.isValid"===t.path||"checkout.giftRecipientForm.isValid"===t.path||"checkout.paymentForm.isValid"===t.path);e&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.loading")||![],e=this.store.get("checkout.error")||null;this.updateErrorDisplay(e);const n=this.determineButtonState({isCheckoutLoading:t,hasCheckoutError:!!e});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(n.state),this.placeOrderButton.disabled=n.disabled,this.placeOrderButton.textContent=n.text}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(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(e.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:t,hasCheckoutError:e}){const n=this.config.layout.placeOrderButtonText,i=this.store.get("checkout.presale");let o=![];if(!i){const t=this.getStoreValue("cart.fulfillments")||{};o=Object.values(t).some(t=>t.hasUnmetMinimumPurchaseAmount)}const r=this.store.get("checkout.isGift"),s=this.store.get("checkout.customerForm.isValid"),a=this.store.get("checkout.giftRecipientForm.isValid"),c=this.store.get("checkout.paymentForm.isValid");return o||r&&!a||!s||!c?{state:"disabled",text:n,disabled:!![]}:t?{state:"processing",text:"Placing Order...",disabled:!![]}:e?{state:"disabled",text:n,disabled:!![]}:{state:"ready",text:n,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const t=this.store.get("checkout.loading");if(t)return;await this.commands.checkout.checkoutComplete()}catch(t){this.logger.error("Error handling place order click",t)}}template(){const t=document.createElement("button");t.type="button",t.textContent=this.config.layout.placeOrderButtonText,t.classList.add("checkout-place-order-button"),t.disabled=!![],t.setAttribute("tabindex","0"),t.setAttribute("role","button"),t.setAttribute("aria-label","Place Order"),t.addEventListener("click",this.handlePlaceOrderClick.bind(this)),t.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handlePlaceOrderClick())});const e=document.createElement("div");e.classList.add("checkout-error-wrapper"),e.setAttribute("role","alert"),e.style.display="none";const n=document.createElement("div");n.classList.add("checkout-error");const i=document.createElement("span");i.classList.add("icon-error"),i.innerHTML=ErrorInfoIcon({});const r=document.createElement("span");r.classList.add("error-text"),n.appendChild(i),n.appendChild(r),e.appendChild(n);const s=ComponentFactoryService.createElement({type:o.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,s,t]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.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.presale"===t.path);if(null==n?void 0:n.value)return this.updateExpiresAt(n.value.expiresAt),!![];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.presale");(null==t?void 0:t.expiresAt)&&this.updateExpiresAt(t.expiresAt),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",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.clientConfig.isBuilder()||(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}}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 i=document.createElement("div");i.classList.add("checkout-completed-title-section");const r=document.createElement("div");r.classList.add("checkout-completed-title-section");const s=document.createElement("p");s.classList.add("presale-expired-title"),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),i.appendChild(r),n.appendChild(i);const c=document.createElement("div");c.classList.add("checkout-completed-help-section"),c.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available.",n.appendChild(c),t.push(n);const l=document.createElement("div");l.classList.add("checkout-completed-section-container");const d=document.createElement("button");d.setAttribute("aria-label","Continue shopping"),d.type="button";const u=document.createElement("span");u.textContent="Continue Shopping",d.setAttribute("tabindex","0"),d.setAttribute("role","button"),d.setAttribute("aria-label","Continue Shopping"),d.appendChild(u);const p=htmlStringToElement(ArrowRightIcon({width:16,height:16}));d.appendChild(p),d.addEventListener("click",()=>this.handleExit()),d.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),l.appendChild(d),t.push(l);const m=document.createElement("div");m.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",m.appendChild(g),m.appendChild(this.autoCloseElement),m.appendChild(v),t.push(m),e.layout.showPoweredBy){const e=document.createElement("div");e.classList.add("checkout-completed-powered-by-container");const n=ComponentFactoryService.createElement({type:o.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<=255,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:o.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const e=t.toUpperCase(),n=this.promoInput;n.setValue(e),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const M=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(e){this.logger.error("Checkout promo code application failed",{promoCode:t,error:e instanceof Error?e.message:String(e)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",M),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),M())}),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 CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const t=this.getStoreValue("checkout.isGift"),e=document.createElement("div");e.classList.add("gift-label-wrapper");const n=document.createElement("span");n.textContent="Send as Gift? (Free)",n.classList.add("gift-toggle-label"),e.appendChild(n);const i=document.createElement("span");i.textContent="With personalized note & gift receipt.",i.classList.add("gift-toggle-description"),e.appendChild(i);const o=document.createElement("div");o.classList.add("toggle-switch"),o.classList.toggle("active",t);const r=document.createElement("div");return r.classList.add("toggle-slider"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Toggle Gift Option"),o.setAttribute("role","switch"),o.setAttribute("aria-checked",t?"true":"false"),o.appendChild(r),o.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),o.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),[e,o]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this.O=null,this.N=null,this.R=null,this.M=![],this.L=![],this.B=![],this.j=null}async initialize({data:t}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.O=window.Stripe(t.publishableKey),this.N=this.O.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.R=this.N.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,this.M||await this.updateStripeFormStatus({isFormComplete:n,isProcessing:![],hasCompletedPayment:![],errorMessage:i,hasError:e})}),this.R.on("focus",async()=>{this.M||await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.B=![]}catch(t){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(t){const{stripeConfig:e}=t.detail;e&&(this.q=e,await this.refreshPaymentSession())}async handleSubmit(){var t,e;if(this.M)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.L)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.M=!![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.B&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const t=await this.createConfirmationTokenId(),e=this.q.clientSecret,n=e.split("_secret_")[0];this.B=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:t,setupIntentId:n},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(n){console.error("Payment submission error:",n),this.B=!![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==n?void 0:n.message)||"Payment processing failed. Please try again."}),((null===(t=null==n?void 0:n.message)||void 0===t?void 0:t.includes("expired"))||(null===(e=null==n?void 0:n.message)||void 0===e?void 0:e.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.M=![]}}async requestSessionRefresh(){return this.j||(this.j=new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",X),this.j=null,e(new Error("Session refresh timeout"))},1e4),X=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",X),this.j=null,t()};this.addEventListener("lce:s:refreshSession",X,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.j}async refreshPaymentSession(){try{this.N&&this.N.update({clientSecret:this.q.clientSecret}),this.B=![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(et){console.error("Failed to refresh payment session:",et),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.R&&this.R.clear(),this.L=![],this.B=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(et){console.error("Failed to reset form:",et)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.N)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.N.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const e={elements:this.N,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.O.createConfirmationToken(e);if(n)throw new SDKError(n.message||"Failed to create confirmation token");if(!i||!i.id)throw new SDKError("Invalid confirmation token received");return i.id}catch(t){if(t instanceof SDKError)throw t;throw new SDKError("Payment processing error: "+(t.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(t=>{console.error("Error during Stripe form disconnection cleanup:",t)})}async cleanupForm(){var t,e;try{this.j=null,this.R&&(this.R.unmount(),this.R=null),this.N&&(null===(e=(t=this.N).destroy)||void 0===e?void 0:e.call(t),this.N=null),this.O=null,this.M=![],this.L=![],this.B=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(n){console.warn("Error during Stripe form cleanup:",n)}}loadStripeJS(){return new Promise((t,e)=>{const n=document.querySelector('script[src*="stripe.com"]');if(n)return n.addEventListener("load",()=>t()),n.addEventListener("error",()=>e(new Error("Failed to load Stripe.js"))),void 0;const i=document.createElement("script");i.src="https://js.stripe.com/basil/stripe.js",i.async=!![],i.onload=()=>t(),i.onerror=()=>e(new Error("Failed to load Stripe.js")),document.head.appendChild(i)})}}class CheckoutStripeHandlerComponent extends BaseComponent{get hostClasses(){return["checkout-stripe-handler"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.paymentMethod","checkout.paymentForm.isEditing"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.isInEditMode=![],this.savedCardInfo=null,this.isChangingPayment=![],this.callbacks={}}beforeConnected(){this.callbacks=this.params.callbacks||{}}onStoreWatch(t){for(const e of t)switch(e.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(e.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(e.value)}}handleSavedCardChange(t){var e,n,i,o;(null===(e=null==t?void 0:t.card)||void 0===e?void 0:e.brand)&&(null===(n=null==t?void 0:t.card)||void 0===n?void 0:n.last4)?this.savedCardInfo={brand:t.card.brand,last4:t.card.last4}:this.savedCardInfo=null,null===(o=(i=this.callbacks).onSavedCardInfoChanged)||void 0===o||o.call(i,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(t){this.isInEditMode=t,this.updateDisplayState()}updateDisplayState(){var t,e,n,i,o,r;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(e=(t=this.callbacks).onEditModeVisibilityChanged)||void 0===e||e.call(t,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(i=(n=this.callbacks).onEditModeVisibilityChanged)||void 0===i||i.call(n,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(t=>{this.logger.error("Failed to create stripe form in updateDisplayState",t)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(r=(o=this.callbacks).onEditModeVisibilityChanged)||void 0===r||r.call(o,![]))}async afterRender(){var t,e,n,i;this.isInEditMode=null!==(t=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==t?t:![];const o=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(e=null==o?void 0:o.card)||void 0===e?void 0:e.brand)&&o.card.last4&&(this.savedCardInfo={brand:o.card.brand,last4:o.card.last4}),null===(i=(n=this.callbacks).onSavedCardInfoChanged)||void 0===i||i.call(n,this.savedCardInfo),this.updateDisplayState(),(this.isInEditMode&&!this.savedCardInfo||this.isChangingPayment)&&await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",t=>{var e,n;this.stripeFormStatus=t.detail.status,null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async t=>{var e,n,i,o,r;try{const{confirmationTokenId:i,setupIntentId:o}=t.detail;await(null===(n=(e=this.callbacks).onPaymentSessionConfirmed)||void 0===n?void 0:n.call(e,i,o)),this.isChangingPayment=![]}catch(s){this.logger.error("Failed to save payment form",s),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==s?void 0:s.message)||"Failed to save payment information. Please try again."},null===(o=(i=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(i,this.stripeFormStatus),null===(r=this.stripeFormElement)||void 0===r||r.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const e=await this.doStripeConfig();null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:e}}))}catch(e){this.logger.error("Failed to refresh payment session",e)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const t=document.createElement("span");t.classList.add("stripe-summary-text"),t.textContent=capitalizeFirstLetter(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const e=document.createElement("button");e.type="button",e.classList.add("change-payment-link"),e.textContent="Change",e.setAttribute("aria-label","Change Payment Method"),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.addEventListener("click",()=>this.handleChangePayment()),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(t,e),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var t,e;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(e=(t=this.callbacks).onStripeFormStatusChanged)||void 0===e||e.call(t,this.stripeFormStatus),this.updateDisplayState()}template(){const t=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",t.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const e=document.createElement("slot");return e.setAttribute("name",mt),this.stripeFormContainer.appendChild(e),t.push(this.stripeFormContainer),t}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,e=null;for(;t&&t!==document.body;){const n=t.hasAttribute("checkout"),i=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(o.LCE_ELEMENT),r=t.hasAttribute("drawer"),s=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(o.DRAWER),a="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||i&&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(){const t=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==t?void 0:t.key)&&(null==t?void 0:t.secret)||await this.commands.checkout.getPaymentSession();const e=this.store.get("checkout.paymentForm.paymentSession"),n=this.getConfigs("global");return{publishableKey:e.key,clientSecret:e.secret,appearance:{theme:"stripe",variables:{fontFamily:n.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:n.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===n.layout.inputFieldStyle?"none":"1px solid "+n.theme.accentColor,backgroundColor:"filled"===n.layout.inputFieldStyle?n.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t,e,n;if(this.isCreatingStripeForm)return this.logger.info("Stripe form creation already in progress, skipping"),void 0;if(this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment)return this.logger.info("In edit mode with saved card, skipping stripe form creation"),void 0;const i=this.findRootComponent();if(!i)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const r=i.querySelectorAll('[slot="'+mt+'"]');if(r.length>0)for(const o of r)o.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:o.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",mt),i.appendChild(this.stripeFormElement)}catch(s){this.logger.error("Stripe form element creation failed",s),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(t){const e=this.getStoreValue("checkout.updating")||![];if(!e)try{await this.commands.checkout.updateTips(t)}catch(n){this.logger.error("Checkout tips update failed",n)}}async handleFulfillmentTipInput(t,e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const 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",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",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 t=e.some(t=>t.tip>0);if(t)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(n){this.logger.error("Default tip initialization failed",n),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(i){this.logger.error("Default tip initialization failed during fallback",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:o.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return t}gcInputContainer(){const t=ComponentFactoryService.createElement({type:o.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}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,selectedSizeAttributes:i}){var o,s,a,c,l,d,u,p;const m=e===r.ON_DEMAND;let g=null;m&&t.hourStatus.openTime&&(null===(o=t.hourStatus)||void 0===o?void 0:o.closeTime)&&(g=t.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(s=t.hourStatus)||void 0===s?void 0:s.closeTime):"Opens at "+format24TimeTo12(null===(a=t.hourStatus)||void 0===a?void 0:a.openTime));const v=m&&t.hourStatus.isClosed?"closed":"",b=document.createElement("div");b.className="popup-retailer-card "+(n?"selected":"")+" "+v,b.setAttribute("data-fulfillment-id",t.id),b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.setAttribute("aria-pressed",n?"true":"false");const x=e===r.SHIPPING?"Shipping":"Same-day delivery";b.setAttribute("aria-label",x+" from "+t.retailerName+", "+formatCentToDollarText(null!==(c=t.variant.price)&&void 0!==c?c:0));const w=document.createElement("div");w.className="row";const C=document.createElement("span");C.className="name",C.textContent=t.retailerName,w.appendChild(C);const k=document.createElement("span");k.className="price",k.textContent=formatCentToDollarText(null!==(l=t.variant.price)&&void 0!==l?l:0),w.appendChild(k),b.appendChild(w);const S=document.createElement("div");S.className="row";const E=document.createElement("span");E.className="expectation",E.textContent=t.hourStatus.isClosed?g:(null===(d=null==i?void 0:i.presale)||void 0===d?void 0:d.isActive)?(null===(u=null==i?void 0:i.presale)||void 0===u?void 0:u.isActive)&&(null===(p=null==i?void 0:i.presale)||void 0===p?void 0:p.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==i?void 0:i.presale.estimatedShipBy):"":null==t?void 0:t.expectationText,S.appendChild(E);const _=document.createElement("span");if(_.className="fee",_.textContent=t.fee>0?formatCentToDollarText(t.fee):"Free Delivery",S.appendChild(_),b.appendChild(S),m){const e=document.createElement("div");e.className="row";const n=document.createElement("span");n.className="address",n.textContent=t.retailerAddressFormatted,e.appendChild(n),b.appendChild(e)}return b}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:e,shippingSelected:n,onDemandSelected:i,onTabClick:o,enableShippingFulfillment:s,enableOnDemandFulfillment:a}){const c=e.length>0,l=document.createElement("div");if(l.className="fulfillment-tabs-container",l.setAttribute("role","tablist"),l.setAttribute("aria-label","Delivery method options"),s){const e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",r.SHIPPING),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",n?"true":"false"),e.setAttribute("aria-label","Shipping, "+t.length+" options"),e.addEventListener("click",o),e.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.click())});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",r.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",i?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+e.length+" options"),c||t.setAttribute("aria-disabled","true"),t.addEventListener("click",o),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())});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"]}get hostAttributes(){return{role:"region","aria-live":"polite","aria-atomic":"false","aria-label":"Add to cart section"}}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment||!n.selectedSizeId)return 0;const i=n.selectedFulfillment.variant.partNumber,o=n.selectedFulfillment.id,r=null===(t=n.sizes[n.selectedSizeId])||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);return e.selectedFulfillment?e.selectedFulfillmentType===r.ON_DEMAND&&e.selectedFulfillment.hourStatus.isClosed:![]}isButtonLoading(){const t=this.getProductId();return this.getStoreValue("products."+t+".updating")}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),e=this.getAvailableQuantity(),n=t<e;return{currentQuantity:t,availableQuantity:e,canIncrease:n,canDecrease:t>1}}async handleAddToCart(){var t,e,n;const 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,{fulfillmentId:o.selectedFulfillment.id,partNumber:null===(e=o.selectedFulfillment)||void 0===e?void 0:e.variant.partNumber,quantity:o.quantity,identifier:i}):await this.commands.product.addToCart(i,{fulfillmentId:o.selectedFulfillment.id,partNumber:null===(n=o.selectedFulfillment)||void 0===n?void 0:n.variant.partNumber,quantity:o.quantity,identifier:i})}async handleQuantityChange(t){const e=this.getProductId();await this.commands.product.updateQuantity(e,t)}calculateTotalPrice(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=e.selectedFulfillment,i=n.variant.price*e.quantity;return{quantity:e.quantity,totalPrice:i}}createQuantityContainer(t){const e=this.calculateQuantityLimits(),n=document.createElement("div");return n.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!e.canDecrease).toString()),e.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=e.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+e.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!e.canIncrease).toString()),e.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),n.appendChild(this.qtyDecreaseButton),n.appendChild(this.quantityText),n.appendChild(this.qtyIncreaseButton),n}getSizeAttributes(){const t=this.getProductId(),e=this.getStoreValue("products."+t+".selectedSizeId"),n=this.getStoreValue("products."+t+".sizes."+e);return(null==n?void 0:n.attributes)||{}}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e)return![];if(!e.isActive)return![];if(e.canPurchaseOn){const t=new Date(e.canPurchaseOn),n=new Date;if(n.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:e}=this.calculateTotalPrice(),n=this.getSizeAttributes(),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;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;const a=o&&!r||0===i.availableQuantity||this.isFulfillmentClosed(),c=this.isButtonLoading(),l=this.config.layout.addToCartButtonShowTotalPrice?s+" for "+formatCentToDollarText(e):s;return this.addToCartButton.setAttribute("aria-label",l),this.addToCartButton.setAttribute("aria-busy",c.toString()),this.addToCartButton.setAttribute("aria-disabled",a.toString()),a&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),c&&(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=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer(this.config.layout.quantityCounterStyle);i.push(t)}const o=this.createAddToCartButton();return i.push(o),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");c.className="collapse-button",c.textContent=o,c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","Show more product information"),c.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,a.classList.toggle("collapsed"),c.textContent=this.isCollapsed?o:r,c.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),c.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return c.addEventListener("click",toggleContent),c.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[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("Failed to open product drawer",n),this.commands.product.closeProductDrawer(e)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay,e=this.config.layout.showOnlyMainImage?"only-main-image":"with-thumbnails";return["product-image-carousel",t,e]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedSizeId"]}),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){var e;const n=this.params.productId,i=t.find(t=>t.path==="products."+n+".selectedSizeId");if(null==i?void 0:i.value){const t=this.getStoreValue("products."+n),o=null===(e=null==t?void 0:t.sizes)||void 0===e?void 0:e[i.value],r=null==o?void 0:o.image;if(r){const t=this.params.images.indexOf(r);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+r+"')")}}}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=this.config.layout.showOnlyMainImage,i=document.createElement("div");if(i.className="main-image",i.title="Product main image",i.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",e&&!n){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)}i.appendChild(t)}if(this.mainImageElement=i,t.push(i),!n){const e=document.createElement("div");e.className="gallery-viewport";const n=document.createElement("div");n.className="gallery-container";for(let t=0;t<this.params.images.length;t++){const e=this.params.images[t],i=document.createElement("div");i.className="gallery-image-wrapper "+(0===t?"selected":"");const o=document.createElement("img");o.src=e,o.className="gallery-image",o.alt="Product thumbnail "+(t+1),o.loading="lazy",i.appendChild(o),n.appendChild(i)}e.appendChild(n),t.push(e)}return t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var e;const n=this.getProductId();if(!t.some(t=>t.path==="products."+n+".selectedFulfillmentType"))return;const i=this.getStoreValue("products."+n),o=this.getConfigs("global");this.addPersonalizationSpan&&(i.selectedFulfillmentType===r.SHIPPING&&o.layout.enablePersonalization&&i.productHasAvailability&&(null===(e=null==i?void 0:i.selectedFulfillment)||void 0===e?void 0:e.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),e=this.container.querySelectorAll("[select-size]");for(const n of e){const i=n.textContent||"",o=n.classList.contains("selected");n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.setAttribute("aria-label","Select "+i),n.setAttribute("aria-pressed",o?"true":"false"),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),n.addEventListener("click",async()=>{var i;const o=n.dataset.sizeId;if(!o)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,o);for(const t of e)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");n.classList.add("selected"),n.setAttribute("aria-pressed","true");const r=this.getStoreValue("products."+t),s=this.getConfigs("global");this.addPersonalizationSpan&&(s.layout.enablePersonalization&&r.productHasAvailability&&(null===(i=r.selectedFulfillment)||void 0===i?void 0:i.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,e){const n=document.createElement("div");n.className="size-container";const i=document.createElement("h3");i.className="size-label",i.textContent="Size",i.id="size-label",n.appendChild(i);const o=document.createElement("div");o.className="size-buttons-container",o.setAttribute("role","group"),o.setAttribute("aria-labelledby","size-label");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(){var t,e;const n=this.getProductId(),i=this.getStoreValue("products."+n),r=i.sizes[i.selectedSizeId],s=this.getConfigs("global"),a=[],c=document.createElement("div");c.className="price-personalization-container";const l=ComponentFactoryService.createElement({type:o.PRODUCT_PRICE,productId:n});if(c.appendChild(l),s.layout.enablePersonalization&&i.productHasAvailability&&(null===(t=null==i?void 0:i.selectedFulfillment)||void 0===t?void 0:t.variant.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var t,e,r,s,a,c,l,d;const u=i.sizes[i.selectedSizeId];await this.commands.product.openProductDrawer(n,o.ENGRAVING_FORM,{identifier:n,context:"product",lines:[],maxLines:(null===(e=null===(t=u.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.maxLines)||1,maxCharsPerLine:(null===(s=null===(r=u.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxCharsPerLine)||16,fee:(null===(c=null===(a=u.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.fee)||0,location:null===(d=null===(l=u.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),c.appendChild(this.addPersonalizationSpan)}a.push(c);const d=this.renderProductSizes(i.selectedSizeId,i.sizes);if(a.push(d),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:o.ADDRESS_DISPLAY,productId:n});a.push(t)}const u=ComponentFactoryService.createElement({type:o.PRODUCT_RETAILERS,productId:n});a.push(u);const p=ComponentFactoryService.createElement({type:o.PRODUCT_ADD_TO_CART_SECTION,productId:n});a.push(p);const m=null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.presale;if((null==m?void 0:m.isActive)===!![]&&(null==m?void 0:m.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==m?void 0:m.language)||""),a.push(t)}if(this.config.layout.showDescription&&(i.description.trim().length>0||i.htmlDescription.trim().length>0)){const t=ComponentFactoryService.createElement({type:o.PRODUCT_DESCRIPTION,productId:n});a.push(t)}return a}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:e,showDescription:n,showQuantityCounter:i,fulfillmentDisplay:o,showImages:r,showOnlyMainImage:s}=this.config.layout,a=document.createElement("div");a.classList.add("product-content-wrapper");const c=document.createElement("div");if(c.classList.add("skeleton-container"),e){const t=document.createElement("div");t.classList.add("wave","sc-title"),c.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),c.appendChild(t),c}const l=document.createElement("div");l.classList.add("wave","sc-price"),c.appendChild(l);const d=document.createElement("div");d.classList.add("sc-sizes");const u=document.createElement("div");u.classList.add("wave","sc-size-button"),d.appendChild(u);const p=document.createElement("div");p.classList.add("wave","sc-size-button"),d.appendChild(p);const m=document.createElement("div");m.classList.add("wave","sc-size-button"),d.appendChild(m);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),d.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),d.appendChild(v),c.appendChild(d);const b=document.createElement("div");b.classList.add("sc-row");const x=document.createElement("div");x.classList.add("wave","sc-price"),b.appendChild(x);const w=document.createElement("div");w.classList.add("wave","sc-personalization"),b.appendChild(w),c.appendChild(b);const C=document.createElement("div");C.classList.add("wave","sc-deliver-to"),c.appendChild(C);const k=document.createElement("div");k.classList.add("wave","sc-address"),c.appendChild(k);const S=document.createElement("div");S.classList.add("wave","sc-retailers",o),c.appendChild(S);const E=document.createElement("div");if(E.classList.add("sc-row"),i){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),E.appendChild(t)}const _=document.createElement("div");if(_.classList.add("wave","sc-add-to-cart"),E.appendChild(_),c.appendChild(E),n){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),c.appendChild(t);const e=document.createElement("div");e.classList.add("wave","sc-description-line"),c.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),c.appendChild(n);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),c.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-more"),c.appendChild(o)}const D=document.createElement("div");if(D.classList.add("product-content"),D.appendChild(c),a.appendChild(D),r){a.classList.add("has-images");const t=this.createImageSkeletons(s);a.prepend(t)}return a}createImageSkeletons(t){const e=document.createElement("div");e.classList.add("product-image-carousel","skeleton");const n=document.createElement("div");if(n.classList.add("wave","sc-main-image"),n.title="Product main image loading",!t){const t=document.createElement("div");t.classList.add("carousel-dots");for(let e=0;e<3;e++){const e=document.createElement("div");e.classList.add("wave","sc-carousel-dot"),t.appendChild(e)}n.appendChild(t)}if(e.appendChild(n),!t){const t=document.createElement("div");t.classList.add("gallery-viewport");const n=document.createElement("div");n.classList.add("gallery-container");for(let e=0;e<4;e++){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),n.appendChild(t)}t.appendChild(n),e.appendChild(t)}return e}}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:o.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(o.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,o.ADDRESS_INPUT,{productId:t})}),n}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t);let n=e.noAvailabilityPrice;return e.selectedFulfillment&&(n=e.selectedFulfillment.variant.price),formatCentToDollarText(n)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getConfigs("product"),i=[],r=this.getConfigs("configurations");if(!e.productHasAvailability||!r.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),i.push(t),i}const s="carousel"===n.layout.fulfillmentDisplay?o.PRODUCT_RETAILERS_CAROUSEL:o.PRODUCT_RETAILERS_POPUP,a=ComponentFactoryService.createElement({type:s,productId:t});return i.push(a),i}}class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const t=this.retailerCards.findIndex(t=>t.classList.contains("selected"));-1!==t&&this.scrollToIndex(t)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(t){const e=this.getProductId(),n=t.find(t=>t.path==="products."+e+".selectedFulfillmentId");(null==n?void 0:n.value)&&this.updateSelectedCard(n.value)}updateSelectedCard(t){for(const n of this.retailerCards)n.classList.remove("selected"),n.setAttribute("aria-pressed","false");const e=this.retailerCards.findIndex(e=>e.dataset.fulfillmentId===t);-1!==e&&(this.retailerCards[e].classList.add("selected"),this.retailerCards[e].setAttribute("aria-pressed","true"),this.scrollToIndex(e))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const e=this.retailerCards[t],n=this.listViewport.offsetWidth,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.id===n)return this.logger.info("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,selectedSizeAttributes:i}){var o,s,a,c,l,d,u,p;const m=e===r.ON_DEMAND;let g=null;m&&t.hourStatus.openTime&&(null===(o=t.hourStatus)||void 0===o?void 0:o.closeTime)&&(g=t.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(s=t.hourStatus)||void 0===s?void 0:s.closeTime):"Opens at "+format24TimeTo12(null===(a=t.hourStatus)||void 0===a?void 0:a.openTime));const v=m&&t.hourStatus&&t.hourStatus.isClosed?"closed":"",b=document.createElement("div");b.className="carousel-retailer-card "+(n?"selected":"")+" "+v,b.setAttribute("data-fulfillment-id",t.id),b.setAttribute("role","button"),b.setAttribute("tabindex","0"),b.setAttribute("aria-pressed",n?"true":"false");const x=e===r.SHIPPING?"Shipping":"Same-day delivery";b.setAttribute("aria-label",x+" from "+t.retailerName+", "+formatCentToDollarText(null!==(c=t.variant.price)&&void 0!==c?c:0));const w=document.createElement("div");w.className="retailer-header";const C=document.createElement("h3");if(C.className="name",C.textContent=t.retailerName,w.appendChild(C),m){const e=document.createElement("h3");e.className="address",e.textContent=t.retailerAddressFormatted,w.appendChild(e)}const k=document.createElement("div");k.className="retailer-body";const S=document.createElement("span");S.className="product-price",S.textContent=formatCentToDollarText(null!==(l=t.variant.price)&&void 0!==l?l:0);const E=document.createElement("span");E.className="shipping-price",E.textContent=t.fee>0?"+ "+formatCentToDollarText(t.fee):"FREE Delivery";const _=document.createElement("span");return _.className="expectation",_.textContent=t.hourStatus.isClosed?g:(null===(d=null==i?void 0:i.presale)||void 0===d?void 0:d.isActive)?(null===(u=null==i?void 0:i.presale)||void 0===u?void 0:u.isActive)&&(null===(p=null==i?void 0:i.presale)||void 0===p?void 0:p.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==i?void 0:i.presale.estimatedShipBy):"":null==t?void 0:t.expectationText,k.append(S,E,_),b.append(w,k),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,o=[];for(const r in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,r)&&o.push(n.shippingFulfillments[r]);const s=[];for(const r in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,r)&&s.push(n.onDemandFulfillments[r]);const a=e.selectedFulfillmentType===r.SHIPPING,c=e.selectedFulfillmentType===r.ON_DEMAND,l=a?o:s,d=renderFulfillmentTabsContainer({shippingFulfillments:o,onDemandFulfillments:s,shippingSelected:a,onDemandSelected:c,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===l.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[d,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 u of l){const t=this.generateRetailerCard({fulfillment:u,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:u.id===e.selectedFulfillmentId,selectedSizeAttributes:i}),n=e.selectedFulfillmentType===r.ON_DEMAND&&u.hourStatus.isClosed;n?t.setAttribute("aria-disabled","true"):(t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())})),this.listContainer.appendChild(t)}return this.listViewport.appendChild(this.listContainer),[d,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),i=(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),u=document.createElement("div");u.className="header";const p=document.createElement("span");p.className="header-label",p.textContent=e.selectedFulfillmentType===r.SHIPPING?"Shipping From:":"Delivering From:";const m=document.createElement("button");if(m.className="delivery-options",m.type="button",m.textContent="See Delivery Options ("+d+")",m.setAttribute("aria-label","View all "+d+" delivery options"),m.addEventListener("click",async()=>{0!==d&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(o.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,o.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.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[u,t]}const g=document.createElement("div");g.className="popup-fulfillment-list-container";const v=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:i});return g.appendChild(v),[u,g]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(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 h=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.id===n)return await h(),void 0;await this.commands.product.selectFulfillment(e,n),await h()}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,o=[];for(const r in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,r)&&o.push(n.shippingFulfillments[r]);const s=[];for(const r in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,r)&&s.push(n.onDemandFulfillments[r]);const a=e.selectedFulfillmentType===r.SHIPPING,c=e.selectedFulfillmentType===r.ON_DEMAND,l=a?o:s,d=document.createElement("h5");d.className="popup-retailers-section-title",d.textContent="Delivery Options";const u=renderFulfillmentTabsContainer({shippingFulfillments:o,onDemandFulfillments:s,shippingSelected:a,onDemandSelected:c,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!e.fulfillmentHasAvailability||0===l.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[d,u,t]}const p=document.createElement("div");p.className="popup-fulfillment-list-container";for(const r of l){const t=renderPopupRetailerCard({fulfillment:r,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:r.id===e.selectedFulfillmentId,selectedSizeAttributes:i});t.addEventListener("click",this.onRetailerCardClick.bind(this)),t.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),p.appendChild(t)}return[d,u,p]}}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)return ComponentFactoryService.createElement({type:o.PRODUCT_LOADING});if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:o.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:o.PRODUCT_LOADING});const i=n.sizes[n.selectedSizeId],r=document.createElement("div");r.classList.add("product-content-wrapper"),r.setAttribute("role","region"),r.setAttribute("aria-label",""+n.name);const s=document.createElement("div");if(s.classList.add("product-content"),s.setAttribute("role","region"),s.setAttribute("aria-label",""+n.name),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=n.name,this.titleElement=t,s.appendChild(t)}const a=ComponentFactoryService.createElement({type:o.PRODUCT_OPTIONS,productId:e});s.appendChild(a);const c=ComponentFactoryService.createElement({type:o.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:o.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:i.image,productId:e});return r.prepend(l),l.setAttribute("aria-label","Product images"),r}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}class ProductListCardComponent extends BaseComponent{get hostClasses(){return["product-list-card",this.params.variant,this.params.fillCard?"fill":""]}getAvailabilityData(){var t;const e=this.params.product,n=this.getStoreValue("address.address"),i={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==n?void 0:n.state)||"",isPresale:![],isPresaleActive:![]},o=e.sizes[0];if(!o)return i;const r=Object.values(o.shippingVariants)[0];if(!r)return i;i.upc=o.upc;const s=o.attributes||{};return i.isPresale=(null===(t=s.presale)||void 0===t?void 0:t.isActive)===!![],i.isPresaleActive=this.isPresaleActive(s),this.params.shippingFulfillment&&r.shippingFulfillmentId===this.params.shippingFulfillment.id&&r.stock>0?(i.hasAvailability=!![],i.fulfillmentId=this.params.shippingFulfillment.id,i.partNumber=r.partNumber):this.params.onDemandFulfillment&&r.onDemandFulfillmentId===this.params.onDemandFulfillment.id&&r.stock>0&&(i.hasAvailability=!![],i.fulfillmentId=this.params.onDemandFulfillment.id,i.partNumber=r.partNumber),i}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!![]}async handleAddToCart(t){if(!t.hasAvailability)return;const e=this.params.product.salsifyGrouping||this.params.product.id||"";t.isPresale&&t.isPresaleActive?await this.commands.productList.addPresaleToCart({fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:e}):await this.commands.productList.addToCart({fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:e})}template(){var t,e,n;const i=this.params.product,o=i.sizes[0],r=o?o.image:i.images[0],s=i.name,a=o?o.size:null,c=null!==(n=null===(e=null===(t=null==o?void 0:o.shippingVariants)||void 0===t?void 0:t[0])||void 0===e?void 0:e.price)&&void 0!==n?n:i.noAvailabilityPrice,l=this.getAvailabilityData();return this.createVariantStandard({image:r,name:s,size:a,price:c,availability:l})}generateProductUrl(){var t;if(!this.params.productUrl)return null;const e=this.params.product,n=null===(t=e.sizes)||void 0===t?void 0:t[0],i=this.params.productUrl;if(i.includes("{upc}")){const t=(null==n?void 0:n.upc)||"";return t?i.replace("{upc}",t):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(i.includes("{grouping}")){const t=e.salsifyGrouping||"";return t?i.replace("{grouping}",t):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(t){const{image:e,name:n,size:i,price:o,availability:r}=t,s=[],a=this.generateProductUrl(),c=document.createElement("div");c.className="plc__image-content";const l=document.createElement("div");l.className="plc__image-wrapper";const d=document.createElement("img");if(d.className="plc__image",d.src=e,d.alt=n,d.loading="lazy",l.appendChild(d),c.appendChild(l),a){const t=document.createElement("a");t.href=a,t.className="plc__image-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(c),s.push(t)}else s.push(c);const u=document.createElement("div");u.className="plc__content";const p=document.createElement("h3");if(p.className="plc__title",p.textContent=n,a){const t=document.createElement("a");t.href=a,t.className="plc__title-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(p),u.appendChild(t)}else u.appendChild(p);const m=document.createElement("div");m.className="plc__size-price-wrapper";const g=document.createElement("div");g.className="plc__price",g.textContent=formatCentToDollarText(o),m.appendChild(g);const v=document.createElement("div");v.className="plc__size",v.textContent=i||"",m.appendChild(v),u.appendChild(m),s.push(u);const b=document.createElement("button");return b.type="button",b.className="plc__button",b.disabled=!r.hasAvailability,r.isPresale?b.textContent="Pre Order":r.hasAvailability?b.textContent="Add to Cart":(b.textContent="Not Available In "+r.state.toUpperCase(),this.addHostClasses("not-available")),b.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleAddToCart(r)}),s.push(b),s}}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(t){const e=document.createElement("div");e.classList.add("slc__card");const n=document.createElement("div");n.className="slc__image-content";const i=document.createElement("div");i.className="slc__image-wrapper";const o=document.createElement("div");o.classList.add("wave","slc__image"),i.appendChild(o),n.appendChild(i);const r=document.createElement("div");r.className="slc__content";const s=document.createElement("div");s.className="slc__title-container";const a=document.createElement("div");a.classList.add("wave","slc__title","slc__title-line-1"),s.appendChild(a);const c=document.createElement("div");c.classList.add("wave","slc__title","slc__title-line-2"),s.appendChild(c),r.appendChild(s);const l=document.createElement("div");l.className="slc__size-price-wrapper";const d=document.createElement("div");d.classList.add("wave","slc__price"),l.appendChild(d);const u=document.createElement("div");u.classList.add("wave","slc__size"),l.appendChild(u),r.appendChild(l);const p=document.createElement("div");return p.classList.add("wave","slc__button"),e.appendChild(n),e.appendChild(r),e.appendChild(p),e}template(){const t=[],e=100/this.params.columns;this.container.style.setProperty("--card-width",e+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const n=this.params.rows*this.params.columns;for(let i=0;i<n;i++){const e=this.createSkeletonCard(i);t.push(e)}return t}}function createApplyFiltersButton(t){const e=document.createElement("div");e.className="product-list-filters-apply-container";const n=document.createElement("button");return n.className="product-list-filters-apply-btn",n.textContent="Apply Filters",n.addEventListener("click",()=>t()),e.appendChild(n),e}function createCheckboxItem(t){const{filter:e,state:n,item:i,onChange:o}=t,r=document.createElement("div");r.className="checkbox-filter-item";const s=document.createElement("input");s.type="checkbox",s.id=e.category+"-"+i.value,s.value=i.value.toString(),s.className="checkbox-filter-checkbox",s.checked=n.selectedValues.has(i.value.toString()),s.addEventListener("change",o);const a=document.createElement("label");a.htmlFor=s.id,a.className="checkbox-filter-item-label";const c=i.formattedValue||i.value.toString(),l=i.count||0,d=document.createElement("span");d.className="checkbox-filter-item-text",d.textContent=c;const u=document.createElement("span");return u.className="checkbox-filter-item-count",u.textContent="("+l+")",a.appendChild(d),a.appendChild(u),r.appendChild(s),r.appendChild(a),r}function handleCheckboxFilterSearch(t){const{filter:e,state:n,searchTerm:i,renderCheckboxItems:o}=t,r=i.toLowerCase().trim();n.filteredItems=r?e.values.filter(t=>{const e=(t.formattedValue||t.value.toString()).toLowerCase();return e.includes(r)}):[...e.values],o()}function createCheckboxFilterHeader(t){const{filter:e,state:n,onToggle:i}=t,o=document.createElement("div");o.className="checkbox-filter-header";const r=document.createElement("button");r.className="checkbox-filter-label",r.type="button";const s=document.createElement("span");s.textContent=formatFilterLabel(e.category);const a=document.createElement("span");return a.className="checkbox-filter-toggle-icon "+(n.isExpanded?"expanded":"collapsed"),a.innerHTML=n.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),n.iconElement=a,r.appendChild(s),r.appendChild(a),r.addEventListener("click",()=>i(e.category)),o.appendChild(r),o}function createCheckboxFilterSearchContainer(t){const{state:e,onSearch:n}=t,i=document.createElement("div");i.className="checkbox-filter-search-wrapper",e.searchInput=document.createElement("input"),e.searchInput.type="text",e.searchInput.className="checkbox-filter-search",e.searchInput.placeholder="Search";const o=document.createElement("span");return o.className="checkbox-filter-search-icon",o.innerHTML=SearchIcon({}),e.searchInput.addEventListener("input",t=>{const e=t.target;n(e.value)}),i.appendChild(e.searchInput),i.appendChild(o),i}function renderCheckboxItems(t){const{filter:e,state:n,onCheckboxChange:i}=t;if(n.checkboxList&&(n.checkboxList.innerHTML="",n.filteredItems.forEach(t=>{const o=createCheckboxItem({filter:e,state:n,item:t,onChange:()=>{const e=o.querySelector("input");i(t.value.toString(),e.checked)}});n.checkboxList.appendChild(o)}),0===n.filteredItems.length)){const t=document.createElement("div");t.className="checkbox-filter-no-results",t.textContent="No results found",n.checkboxList.appendChild(t)}}function updateFilterExpandState(t){t.contentElement&&(t.contentElement.className="checkbox-filter-content "+(t.isExpanded?"expanded":"collapsed")),t.iconElement&&(t.iconElement.className="checkbox-filter-toggle-icon "+(t.isExpanded?"expanded":"collapsed"),t.iconElement.innerHTML=t.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}))}function formatFilterLabel(t){return t.charAt(0).toUpperCase()+t.slice(1).replace(/_/g," ")}function createDeliveryOptionsFilter(t){const{currentFilters:e,deliveryCollapsed:n,isSameDayDeliveryDisabled:i,onDeliveryOptionsChange:o,onToggleCollapse:r}=t,s=[],a=document.createElement("div");a.className="product-list-filters-delivery-options";const c=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],l=document.createElement("div");l.className="product-list-filters-delivery-options-header",l.style.cursor="pointer";const d=document.createElement("h3");d.className="product-list-filters-delivery-options-label",d.textContent="Delivery Options";const u=document.createElement("div");u.className="product-list-filters-chevron",u.innerHTML=n?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),l.appendChild(d),l.appendChild(u),a.appendChild(l);const p=document.createElement("div");p.className="product-list-filters-delivery-options-list",n&&p.classList.add("collapsed");for(const m of c){const t=document.createElement("div");t.className="product-list-filters-delivery-option";const n=document.createElement("input");n.type="radio",n.id="delivery-"+m.value,n.name="delivery-options",n.value=m.value,n.className="product-list-filters-delivery-radio";const r="onDemand"===m.value&&i;n.disabled=r,n.checked=m.value===(null==e?void 0:e.deliveryOptions),n.addEventListener("change",t=>{const e=t.target;null==o?void 0:o(e.value)});const s=document.createElement("label");s.htmlFor="delivery-"+m.value,s.className="product-list-filters-delivery-radio-label "+(r?"disabled":""),s.textContent=m.label,t.appendChild(n),t.appendChild(s),p.appendChild(t)}return a.appendChild(p),l.addEventListener("click",()=>{r()}),s.push(a),{elements:s,chevronContainer:u,deliveryOptionsList:p}}function createPriceFilter(t){var e,n,i,o,r,s,a,c;const{priceConfig:l,currentFilters:d,priceCollapsed:u,onPriceChange:p,onToggleCollapse:m,DEFAULT_MIN:g,DEFAULT_MAX:v}=t,b=[],x=document.createElement("div");x.className="product-list-filters-price";const w=Number.parseInt(null!==(e=null==l?void 0:l.min)&&void 0!==e?e:g,10),C=Number.parseInt(null!==(n=null==l?void 0:l.max)&&void 0!==n?n:v,10),k=Number.parseInt(null!==(r=null!==(o=null===(i=null==d?void 0:d.price)||void 0===i?void 0:i.min)&&void 0!==o?o:null==l?void 0:l.min)&&void 0!==r?r:g,10),S=Number.parseInt(null!==(c=null!==(a=null===(s=null==d?void 0:d.price)||void 0===s?void 0:s.max)&&void 0!==a?a:null==l?void 0:l.max)&&void 0!==c?c:v,10),E=document.createElement("div");E.className="product-list-filters-price-header",E.style.cursor="pointer";const _=document.createElement("h3");_.className="product-list-filters-price-title",_.textContent="Price Range",E.appendChild(_);const D=document.createElement("div");D.className="product-list-filters-chevron",D.innerHTML=u?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),E.appendChild(D),x.appendChild(E);const I=document.createElement("div");I.className="product-list-filters-price-slider-container",u&&I.classList.add("collapsed");const T=document.createElement("div");T.className="product-list-filters-price-range-wrapper";const z=document.createElement("div");z.className="product-list-filters-price-track";const L=document.createElement("div");L.className="product-list-filters-price-track-active",z.appendChild(L),T.appendChild(z);const B=document.createElement("input");B.type="range",B.min=w.toString(),B.max=C.toString(),B.value=k.toString(),B.step="1",B.className="product-list-filters-price-range product-list-filters-price-range-min",T.appendChild(B);const j=document.createElement("input");j.type="range",j.min=w.toString(),j.max=C.toString(),j.value=S.toString(),j.step="1",j.className="product-list-filters-price-range product-list-filters-price-range-max",T.appendChild(j),I.appendChild(T);const V=document.createElement("div");V.className="product-list-filters-price-inputs-container";const G=document.createElement("div");G.className="product-list-filters-price-input-wrapper";const K=document.createElement("span");K.className="product-list-filters-price-input-prefix",K.textContent="$";const Y=document.createElement("input");Y.type="number",Y.min=w.toString(),Y.max=C.toString(),Y.value=k.toString(),Y.className="product-list-filters-price-input",Y.placeholder=w.toString(),G.appendChild(K),G.appendChild(Y);const W=document.createElement("span");W.className="product-list-filters-price-separator",W.textContent="to";const Q=document.createElement("div");Q.className="product-list-filters-price-input-wrapper";const J=document.createElement("span");J.className="product-list-filters-price-input-prefix",J.textContent="$";const $=document.createElement("input");$.type="number",$.min=w.toString(),$.max=C.toString(),$.value=S.toString(),$.className="product-list-filters-price-input",$.placeholder=C+"+",Q.appendChild(J),Q.appendChild($),V.appendChild(G),V.appendChild(W),V.appendChild(Q),I.appendChild(V),x.appendChild(I);const Z=()=>{const t=Number.parseInt(B.value,10),e=Number.parseInt(j.value,10),n=C-w,i=(t-w)/n*100,o=(e-w)/n*100;L.style.left=i+"%",L.style.width=o-i+"%"},R=(t,e)=>{B.value=t.toString(),j.value=e.toString(),Y.value=t.toString(),$.value=e.toString(),Z()};return B.addEventListener("input",()=>{let t=Number.parseInt(B.value,10);const e=Number.parseInt(j.value,10);t>e&&(t=e),R(t,e)}),B.addEventListener("change",()=>{const t=Number.parseInt(B.value,10),e=Number.parseInt(j.value,10);null==p?void 0:p(t.toString(),e.toString())}),j.addEventListener("input",()=>{const t=Number.parseInt(B.value,10);let e=Number.parseInt(j.value,10);e<t&&(e=t),R(t,e)}),j.addEventListener("change",()=>{const t=Number.parseInt(B.value,10),e=Number.parseInt(j.value,10);null==p?void 0:p(t.toString(),e.toString())}),Y.addEventListener("input",()=>{let t=Number.parseInt(Y.value,10)||w;const e=Number.parseInt($.value,10)||C;t=Math.max(w,Math.min(t,C)),t>e&&(t=e),R(t,e),null==p||p(t.toString(),e.toString())}),$.addEventListener("input",()=>{const t=Number.parseInt(Y.value,10)||w;let e=Number.parseInt($.value,10)||C;e=Math.max(w,Math.min(e,C)),e<t&&(e=t),R(t,e),null==p||p(t.toString(),e.toString())}),Z(),E.addEventListener("click",()=>{m()}),b.push(x),{elements:b,chevronContainer:D,sliderContainer:I}}class ProductListSearchComponent extends BaseComponent{constructor(){super(...arguments),this.ALLOWED_CHARACTERS=/[^a-zA-Z0-9\s\-_'.,&()]/g,this.MAX_LENGTH=100}get hostClasses(){return["product-list-search-container"]}template(){const t=[],e=document.createElement("div");e.className="product-list-search-box";const n=document.createElement("span");return n.className="product-list-search-icon",n.innerHTML=SearchIcon({}),n.setAttribute("aria-hidden","true"),this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="product-list-search-input",this.searchInput.placeholder="Search",this.searchInput.setAttribute("aria-label","Search products"),this.searchInput.setAttribute("maxlength",this.MAX_LENGTH.toString()),this.params.searchTerm&&(this.searchInput.value=this.sanitizeInput(this.params.searchTerm)),this.searchInput.addEventListener("input",t=>{const e=t.target,n=e.value,i=this.sanitizeInput(n);i!==n&&(e.value=i),this.updateClearButtonVisibility(i),this.params.handleInputChange&&this.params.handleInputChange(i)}),this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="product-list-search-clear-btn",this.clearButton.innerHTML=CloseIcon({}),this.clearButton.setAttribute("aria-label","Clear search"),this.clearButton.style.display=this.params.searchTerm?"flex":"none",this.clearButton.addEventListener("click",()=>{this.searchInput&&(this.searchInput.value="",this.searchInput.focus()),this.updateClearButtonVisibility(""),this.params.clearSearch&&this.params.clearSearch(),this.params.handleInputChange&&this.params.handleInputChange("")}),e.appendChild(n),e.appendChild(this.searchInput),e.appendChild(this.clearButton),t.push(e),t}sanitizeInput(t){if(!t)return"";let e=t.replace(this.ALLOWED_CHARACTERS,"");return e=e.trim(),e=e.replace(/\s+/g," "),e.length>this.MAX_LENGTH&&(e=e.substring(0,this.MAX_LENGTH)),e}updateClearButtonVisibility(t){this.clearButton&&(this.clearButton.style.display=t?"flex":"none")}}function createPersonalizedFilter(t){const{currentFilters:e,isPersonalizationDisabled:n,onPersonalizedChange:i}=t,o=[],r=document.createElement("div");r.className="product-list-filters-personalized";const s=document.createElement("label");s.className="product-list-filters-personalized-label",s.setAttribute("for","personalized-switch"),s.textContent="Personalized Bottles",r.appendChild(s);const a=document.createElement("div");a.classList.add("toggle-switch");const c=!!(null==e?void 0:e.personalized);c&&a.classList.add("active");const l=document.createElement("div");l.classList.add("toggle-slider"),a.id="personalized-switch",a.setAttribute("tabindex","0"),a.setAttribute("aria-label","Toggle Personalized Bottles"),a.setAttribute("role","switch"),a.setAttribute("aria-checked",c?"true":"false"),a.appendChild(l);const P=t=>{a.classList.toggle("active",t),a.setAttribute("aria-checked",t?"true":"false")},A=()=>{const t=a.classList.contains("active"),e=!t;P(e),null==i||i(e)};if(a.addEventListener("click",()=>{n||A()}),a.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),A())}),r.appendChild(a),n){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",r.appendChild(t)}return o.push(r),o}function createPreOrderFilter(t){const{currentFilters:e,isPreOrderDisabled:n,onPreOrderChange:i}=t,o=[],r=document.createElement("div");r.className="product-list-filters-pre-order";const s=document.createElement("label");s.className="product-list-filters-pre-order-label",s.setAttribute("for","pre-order-switch"),s.textContent="Pre-Order",r.appendChild(s);const a=document.createElement("div");a.classList.add("toggle-switch");const c=!!(null==e?void 0:e.preOrder);c&&a.classList.add("active"),n&&a.classList.add("disabled");const l=document.createElement("div");l.classList.add("toggle-slider"),a.id="pre-order-switch",a.setAttribute("tabindex",n?"-1":"0"),a.setAttribute("aria-label","Toggle Pre-Order"),a.setAttribute("role","switch"),a.setAttribute("aria-checked",c?"true":"false"),a.setAttribute("aria-disabled",n?"true":"false"),a.appendChild(l);const P=t=>{a.classList.toggle("active",t),a.setAttribute("aria-checked",t?"true":"false")},A=()=>{const t=a.classList.contains("active"),e=!t;P(e),null==i||i(e)};if(a.addEventListener("click",()=>{n||A()}),a.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),A())}),r.appendChild(a),n){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",r.appendChild(t)}return o.push(r),o}class ProductListFiltersComponent extends BaseComponent{constructor(){super(...arguments),this.priceCollapsed=![],this.deliveryCollapsed=![],this.checkboxFilterStates=new Map,this.DEFAULT_MIN="0",this.DEFAULT_MAX="1000"}get hostClasses(){const t=["product-list-filters-container"];return this.params.isDrawerMode&&t.push("drawer-mode"),t}isSameDayDeliveryDisabled(){var t,e;return!(!(null===(t=this.params.currentFilters)||void 0===t?void 0:t.personalized)&&!(null===(e=this.params.currentFilters)||void 0===e?void 0:e.preOrder))}isPersonalizationDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}isPreOrderDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}createPersonalizedFilterWrapper(){return createPersonalizedFilter({currentFilters:this.params.currentFilters,isPersonalizationDisabled:this.isPersonalizationDisabled(),onPersonalizedChange:this.params.onPersonalizedChange})}createPreOrderFilterWrapper(){return createPreOrderFilter({currentFilters:this.params.currentFilters,isPreOrderDisabled:this.isPreOrderDisabled(),onPreOrderChange:this.params.onPreOrderChange})}createDeliveryOptionsFilterWrapper(){const t=createDeliveryOptionsFilter({currentFilters:this.params.currentFilters,deliveryCollapsed:this.deliveryCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryDisabled(),onDeliveryOptionsChange:this.params.onDeliveryOptionsChange,onToggleCollapse:()=>this.toggleDeliveryCollapse()});return this.deliveryChevronContainer=t.chevronContainer,this.deliveryOptionsList=t.deliveryOptionsList,t.elements}toggleDeliveryCollapse(){this.deliveryCollapsed=!this.deliveryCollapsed,this.deliveryOptionsList&&this.deliveryOptionsList.classList.toggle("collapsed"),this.deliveryChevronContainer&&(this.deliveryChevronContainer.innerHTML=this.deliveryCollapsed?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}))}createPriceFilterWrapper(){const t=createPriceFilter({priceConfig:this.params.priceConfig,currentFilters:this.params.currentFilters,priceCollapsed:this.priceCollapsed,onPriceChange:this.params.onPriceChange,onToggleCollapse:()=>this.togglePriceCollapse(),DEFAULT_MIN:this.DEFAULT_MIN,DEFAULT_MAX:this.DEFAULT_MAX});return this.priceChevronContainer=t.chevronContainer,this.priceSliderContainer=t.sliderContainer,t.elements}togglePriceCollapse(){this.priceCollapsed=!this.priceCollapsed,this.priceSliderContainer&&this.priceSliderContainer.classList.toggle("collapsed"),this.priceChevronContainer&&(this.priceChevronContainer.innerHTML=this.priceCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}createCheckboxFilter(t){var e;const n=[];if(!this.checkboxFilterStates.has(t.category)){const n=null===(e=this.params.currentFilters)||void 0===e?void 0:e[t.category],i=Array.isArray(n)?new Set(n):new Set;this.checkboxFilterStates.set(t.category,{isExpanded:i.size>0,selectedValues:i,searchInput:null,checkboxList:null,filteredItems:[...t.values],contentElement:null,iconElement:null,hasUserInteraction:i.size>0})}const i=this.checkboxFilterStates.get(t.category),o=document.createElement("div");o.className="product-list-checkbox-filter",o.setAttribute("data-filter-category",t.category);const r=document.createElement("div");r.className="checkbox-filter-container";const s=createCheckboxFilterHeader({filter:t,state:i,onToggle:t=>this.toggleCheckboxFilter(t)});r.appendChild(s);const a=document.createElement("div");a.className="checkbox-filter-content "+(i.isExpanded?"expanded":"collapsed"),i.contentElement=a;const c=createCheckboxFilterSearchContainer({state:i,onSearch:e=>{handleCheckboxFilterSearch({filter:t,state:i,searchTerm:e,renderCheckboxItems:()=>this.renderCheckboxItemsWrapper(t,i)})}});return a.appendChild(c),i.checkboxList=document.createElement("div"),i.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsWrapper(t,i),a.appendChild(i.checkboxList),r.appendChild(a),o.appendChild(r),n.push(o),n}renderCheckboxItemsWrapper(t,e){renderCheckboxItems({filter:t,state:e,onCheckboxChange:(n,i)=>this.handleCheckboxChange(t.category,e,n,i)})}handleCheckboxChange(t,e,n,i){i?e.selectedValues.add(n):e.selectedValues.delete(n),e.hasUserInteraction=!![],e.isExpanded||(e.isExpanded=!![],updateFilterExpandState(e)),this.params.onCheckboxFilterChange&&this.params.onCheckboxFilterChange(t,Array.from(e.selectedValues))}toggleCheckboxFilter(t){const e=this.checkboxFilterStates.get(t);e&&(e.isExpanded=!e.isExpanded,e.hasUserInteraction=!![],updateFilterExpandState(e))}template(){var t;const e=[],n=document.createElement("div");n.className="product-list-filters-header",this.params.isDrawerMode&&n.classList.add("drawer-mode");const i=document.createElement("h3");if(i.className="product-list-filters-title",i.textContent="Filters",n.appendChild(i),this.params.isDrawerMode){const t=document.createElement("button");t.className="product-list-filters-close-btn",t.innerHTML=CloseIcon({}),t.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),n.appendChild(t)}return e.push(n),this.params.enablePersonalized&&e.push(...this.createPersonalizedFilterWrapper()),this.params.enablePreOrder&&e.push(...this.createPreOrderFilterWrapper()),this.params.enableDeliveryOptions&&e.push(...this.createDeliveryOptionsFilterWrapper()),this.params.priceConfig&&e.push(...this.createPriceFilterWrapper()),null===(t=this.params.sanitizedFilters)||void 0===t||t.forEach(t=>{e.push(...this.createCheckboxFilter(t))}),this.params.isDrawerMode&&e.push(createApplyFiltersButton(()=>{var t,e;null===(e=(t=this.params).onApplyFilters)||void 0===e?void 0:e.call(t),this.commands.ui.closeDrawer()})),e}}const FilterIcon=({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 24 24" class="filter-icon '+n+'" style="'+o+'" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M20 7h-9"></path>\n <path d="M14 17H5"></path>\n <circle cx="17" cy="17" r="3"></circle>\n <circle cx="7" cy="7" r="3"></circle>\n </svg>\n '};var St;(function(t){t.IDLE="idle",t.LOADING_INITIAL="loading_initial",t.LOADING_MORE="loading_more",t.ERROR="error"})(St||(St={}));class ProductListComponent extends BaseComponent{get hostClasses(){const t=["product-list"];return this.params.filters.length>0&&t.push("has-filters"),t}constructor(){super({watchOnlyStorePaths:["address"]}),this.products=[],this.retailers={},this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.filters=[],this.searchFilter={searchTerm:""},this.currentFilters={personalized:![],preOrder:![],deliveryOptions:"all",price:{min:"0",max:"1000"}},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.sentinelElement=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels=new Map,this.loadingState=St.IDLE,this.scrollObserver=null,this.initializationPromise=null,this.filterDebounceTimer=null,this.FILTER_DEBOUNCE_MS=500,this.filterButton=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise}disconnectedCallback(){super.disconnectedCallback(),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(St.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(St.IDLE)}catch(et){this.logger.error("Error initializing product list:",et),this.setLoadingState(St.ERROR),this.showErrorState("Failed to load products")}}template(){const t=[],e=document.createElement("div");e.className="product-list-search__control-container",e.appendChild(this.createSearchContainer()),t.push(e),this.params.filters.length>0&&(this.filterButton=this.createFilterButton(),t.push(this.filterButton));const n=document.createElement("div");return n.className="product-list-controls",this.params.filters.length>0&&n.appendChild(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),n.appendChild(this.cardsContainer),t.push(n),this.renderCurrentState(),t}setLoadingState(t){this.loadingState=t,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case St.LOADING_INITIAL:this.renderLoadingState();break;case St.ERROR:break;case St.IDLE:case St.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){var t,e;try{const n=this.buildApiParams(0),i=await this.commands.productList.getProductList(n);this.filters=(null===(t=i.navigation)||void 0===t?void 0:t.filters)||[],this.products=i.products||[],this.retailers=i.retailers||{},this.updatePagination(i.navigation),this.syncFiltersFromResponse((null===(e=i.navigation)||void 0===e?void 0:e.filters)||[]),this.updateFiltersComponent()}catch(n){throw this.products=[],this.retailers={},this.pagination.hasMorePages=![],n}}updateFiltersComponent(){if(!this.filtersContainer||0===this.params.filters.length)return;const t=this.filtersContainer.parentElement;if(!t)return;const e=this.filtersContainer;this.filtersContainer=this.createFiltersContainer(),t.replaceChild(this.filtersContainer,e)}async loadMoreProducts(){var t;if(this.loadingState!==St.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(St.LOADING_MORE);const e=this.pagination.currentPage+1,n=this.buildApiParams(e),i=await this.commands.productList.getProductList(n);this.filters=(null===(t=i.navigation)||void 0===t?void 0:t.filters)||[],i.products&&i.products.length>0?(this.products.push(...i.products),this.mergeRetailers(i.retailers||{}),this.updatePagination(i.navigation),this.appendNewProducts(i.products)):(this.pagination.hasMorePages=![],this.updatePagination(i.navigation)),this.setLoadingState(St.IDLE)}catch(e){this.logger.error("Error loading more products:",e),this.setLoadingState(St.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(t){for(const[e,n]of Object.entries(t))this.retailers[e]||(this.retailers[e]=n)}updatePagination(t){var e,n,i,o;t&&(this.pagination={currentPage:null!==(e=t.currentPage)&&void 0!==e?e:0,totalPages:null!==(n=t.totalPages)&&void 0!==n?n:0,hasMorePages:(null!==(i=t.currentPage)&&void 0!==i?i:0)<(null!==(o=t.totalPages)&&void 0!==o?o:1)-1})}buildApiParams(t){const e={page:t,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()};return this.searchFilter.searchTerm&&this.searchFilter.searchTerm.trim().length>0&&(e.search=this.searchFilter.searchTerm.trim()),e}buildFiltersFromState(){const t=[{key:"availability",values:"IN_STOCK"}];this.currentFilters.personalized&&t.push({key:"engraving",values:"YES"}),this.currentFilters.preOrder&&t.push({key:"presale",values:"YES"});const e="all"===this.currentFilters.deliveryOptions?["onDemand","shipping"]:[this.currentFilters.deliveryOptions];if(t.push({key:"fulfillment",values:e}),this.currentFilters.price){const e={};"0"!==this.currentFilters.price.min&&(e.min=this.currentFilters.price.min),"1000"!==this.currentFilters.price.max&&(e.max=this.currentFilters.price.max),Object.keys(e).length>0&&t.push({key:"price",values:e})}const n=Object.keys(this.currentFilters).filter(t=>!["personalized","preOrder","deliveryOptions","price"].includes(t));for(const i of n){const e=this.currentFilters[i];Array.isArray(e)&&e.length>0&&t.push({key:i,values:e})}return t}syncFiltersFromResponse(t){if(t)for(const e of t)switch(e.key){case"engraving":this.currentFilters.personalized="YES"===e.values;break;case"presale":this.currentFilters.preOrder="YES"===e.values;break;case"fulfillment":Array.isArray(e.values)&&(e.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":e.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(St.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(St.IDLE)}catch(et){this.logger.error("Error handling filter change:",et),this.setLoadingState(St.ERROR),this.showErrorState("Error updating filters")}}resetPagination(){this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]}}updateFiltersUI(){this.filtersContainer&&(this.updatePersonalizedSwitch(),this.updatePreOrderSwitch(),this.updateDeliveryOptions())}updatePersonalizedSwitch(){this.personalizedSwitch&&(this.personalizedSwitch.checked=this.currentFilters.personalized,this.personalizedSwitch.disabled=this.isPersonalizationDisabled())}updatePreOrderSwitch(){this.preOrderSwitch&&(this.preOrderSwitch.checked=this.currentFilters.preOrder,this.preOrderSwitch.disabled=this.isPreOrderDisabled())}updateDeliveryOptions(){0!==this.deliveryRadios.length&&this.deliveryRadios.forEach(t=>{const e="onDemand"===t.value&&this.isSameDayDeliveryDisabled();t.disabled=e,e&&"onDemand"===t.value||(t.checked=t.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(t,e)})}updateRadioLabel(t,e){const n=this.deliveryRadioLabels.get(t.id);n&&(n.className="product-list-filters-delivery-radio-label "+(e?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}createCardsContainer(){const t=document.createElement("div");t.className="product-list-cards__container";const e=100/this.params.columns;return t.style.setProperty("--card-width",e+"%"),t.style.setProperty("--columns",""+this.params.columns),t}getResponsiveColumns(){const t=window.innerWidth;return t<=639?1:t<=767?Math.min(this.params.columns,2):t<=1023?Math.min(this.params.columns,3):this.params.columns}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const t=ComponentFactoryService.createElement({type:o.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.getResponsiveColumns(),fillCard:this.params.fillCard,filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(t)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const t=this.createInfoElement("No products found");return this.cardsContainer.appendChild(t),void 0}for(const t of this.products){const e=this.createProductCard(t);e&&this.cardsContainer.appendChild(e)}}}appendNewProducts(t){if(this.cardsContainer&&0!==t.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const e of t){const t=this.createProductCard(e);t&&this.cardsContainer.appendChild(t)}this.sentinelElement?(this.cardsContainer.appendChild(this.sentinelElement),this.updateSentinel(),this.scrollObserver&&this.pagination.hasMorePages&&this.scrollObserver.observe(this.sentinelElement)):this.pagination.hasMorePages&&this.setupInfiniteScroll()}}createProductCard(t){try{const e=Object.values(t.sizes)[0];if(!e)return this.logger.warn("Product "+t.id+" has no sizes"),null;const n=Object.values(e.shippingVariants)[0];if(!n)return this.logger.warn("Product "+t.id+" has no variants"),null;const i=this.retailers[n.retailerId];return i?ComponentFactoryService.createElement({type:o.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:t,shippingFulfillment:i.shippingFulfillment,onDemandFulfillment:i.onDemandFulfillment,productUrl:this.params.productUrl}):(this.logger.warn("Retailer "+n.retailerId+" not found for product "+t.id),null)}catch(e){return this.logger.error("Error creating product card for product "+t.id+":",e),null}}filterSanitizedFilters(){if(!this.params.filters||0===this.params.filters.length)return[];const e={[t.BRANDS]:l.BRANDS,[t.CATEGORIES]:l.CATEGORIES,[t.FLAVOR]:l.FLAVOR,[t.REGION]:l.REGION,[t.VARIETY]:l.VARIETY,[t.VINTAGE]:l.VINTAGE,[t.COUNTRY]:l.COUNTRY,[t.APPELLATION]:l.APPELLATION,[t.MATERIALS]:l.MATERIALS,[t.SIZES]:l.SIZES};return this.filters.filter(t=>{const n=e[t.category];return n&&this.params.filters.includes(n)})}buildFiltersParams(t=![]){const X=async()=>{this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()};return{enablePersonalized:this.params.filters.includes(l.PERSONALIZATION),enablePreOrder:this.params.filters.includes(l.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(l.DELIVERY_OPTIONS),currentFilters:this.currentFilters,sanitizedFilters:this.filterSanitizedFilters(),priceConfig:this.params.filters.includes(l.PRICE)?{min:"0",max:"1000"}:void 0,onPersonalizedChange:async e=>{this.currentFilters.personalized=e,t||await this.onFilterChange()},onPreOrderChange:async e=>{this.currentFilters.preOrder=e,t||await this.onFilterChange()},onDeliveryOptionsChange:async e=>{this.currentFilters.deliveryOptions=e,"onDemand"===e&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),t||await this.onFilterChange()},onPriceChange:async(e,n)=>{this.currentFilters.price||(this.currentFilters.price={}),"0"!==e?this.currentFilters.price.min=e:delete this.currentFilters.price.min,"1000"!==n?this.currentFilters.price.max=n:delete this.currentFilters.price.max,t||(this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS))},onCheckboxFilterChange:async(e,n)=>{n.length>0?this.currentFilters[e]=n:delete this.currentFilters[e],t||await this.onFilterChange()},isDrawerMode:t,onApplyFilters:async()=>{await X()}}}createSearchContainer(){return this.searchContainer=ComponentFactoryService.createElement({type:o.PRODUCT_LIST_SEARCH,searchTerm:this.searchFilter.searchTerm,handleInputChange:async t=>{this.searchFilter.searchTerm=t,this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS)},clearSearch:async()=>{this.searchFilter.searchTerm="",this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()}}),this.searchContainer}createFiltersContainer(t={}){const{isDrawerMode:e=![]}=t;return this.filtersContainer=ComponentFactoryService.createElement({type:o.PRODUCT_LIST_FILTERS,...this.buildFiltersParams(e)}),this.storeFilterElementReferences(),this.filtersContainer}storeFilterElementReferences(){if(!this.filtersContainer)return;this.personalizedSwitch=this.filtersContainer.querySelector("#personalized-switch"),this.preOrderSwitch=this.filtersContainer.querySelector("#pre-order-switch");const t=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(t),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(t=>{var e;const n=null===(e=this.filtersContainer)||void 0===e?void 0:e.querySelector('label[for="'+t.id+'"]');n&&this.deliveryRadioLabels.set(t.id,n)})}openFiltersDrawer(){this.commands.ui.openDrawer(o.PRODUCT_LIST_FILTERS,this.buildFiltersParams(!![]))}createFilterButton(){const t=document.createElement("div");t.className="product-list-filter-container";const e=document.createElement("div");e.className="product-list-filter-icon",e.innerHTML=FilterIcon({}),e.addEventListener("click",()=>{this.openFiltersDrawer()});const n=document.createElement("span");return n.className="product-list-filter-text",n.textContent="Filter",t.appendChild(e),t.appendChild(n),t}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(t=>{const e=t[0];e.isIntersecting&&this.loadingState===St.IDLE&&this.pagination.hasMorePages&&void this.loadMoreProducts()},{root:null,rootMargin:"100px",threshold:.1}),this.scrollObserver.observe(this.sentinelElement))}createScrollSentinel(){const t=document.createElement("div");return t.className="product-list-scroll-sentinel",this.updateSentinelContent(t),t}updateSentinel(){this.sentinelElement&&this.updateSentinelContent(this.sentinelElement)}updateSentinelContent(t){let e;t.innerHTML="",e=this.loadingState===St.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),t.appendChild(e)}showSentinelError(t){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const e=this.createErrorElement(t);this.sentinelElement.appendChild(e)}createLoadingElement(t){const e=document.createElement("div");e.className="product-list-sentinel-container";const n=document.createElement("div");n.className="product-list-sentinel-spinner";const i=document.createElement("div");return i.className="product-list-sentinel-text",i.textContent=t,e.appendChild(n),e.appendChild(i),e}createErrorElement(t){const e=document.createElement("div");e.className="product-list-sentinel-error-container";const n=document.createElement("div");n.className="product-list-sentinel-error-icon",n.innerHTML="⚠";const i=document.createElement("div");return i.className="product-list-sentinel-error-text",i.textContent=t,e.appendChild(n),e.appendChild(i),e}createInfoElement(t,e=![]){const n=document.createElement("div");if(n.className="product-list-sentinel-info-container",!e&&t.includes("Scroll")){const t=document.createElement("div");t.className="product-list-sentinel-icon",t.innerHTML="↓",n.appendChild(t)}else if(e){const t=document.createElement("div");t.className="product-list-sentinel-divider",n.appendChild(t)}const i=document.createElement("div");return i.className=e?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",i.textContent=t,n.appendChild(i),n}showErrorState(t){if(!this.cardsContainer)return;this.clearCardsContainer();const e=this.createErrorElement(t);this.cardsContainer.appendChild(e)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}async onStoreWatch(t){const e=t.find(t=>"address"===t.path);if(e&&void 0!==e.value&&this.cardsContainer)try{this.resetPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(n){this.logger.error("Error reloading products after address change:",n),this.setLoadingState(St.ERROR),this.cardsContainer&&this.showErrorState("Failed to reload products")}}doCleanup(){this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),this.cleanupScrollObserver(),this.products=[],this.retailers={},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.filterButton=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels.clear(),this.initializationPromise=null}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,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(o.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.itemsQuantity")||0;t.textContent=e.toString(),t.style.visibility=e>0?"visible":"hidden",this.store.watch("cart.itemsQuantity",()=>{const e=this.getStoreValue("cart.itemsQuantity")||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",e),this.commands.ui.closeDrawer()}}animateContentSwap(t,e){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const n=this.contentContainer.firstElementChild;n.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{n.classList.add("fading")}),setTimeout(()=>{n.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(e),requestAnimationFrame(()=>{t.classList.add("visible"),setTimeout(()=>{t.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(t){if(!this.drawerElement)return;const e=["drawer"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.drawerElement.className=e.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",e),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["engraving-form"]}beforeConnected(){var t;if(this.engravingLines=this.params.lines,"product"===this.params.context){const e=this.store.get("products."+this.params.identifier);this.fulfillmentId=e.selectedFulfillmentId,this.partNumber=(null===(t=e.selectedFulfillment)||void 0===t?void 0:t.variant.partNumber)||null}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,e;if("product"===this.params.context){const n=this.store.get("products."+this.params.identifier),i=n.sizes[n.selectedSizeId],o=i.shippingFulfillments[this.fulfillmentId],r=o.variant.price,s=(null===(e=null===(t=null==i?void 0:i.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.fee)||0;return r+s}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier),e=t.unitPrice,n=t.attributes.engraving.fee||0;return e+n}return 0}productInformationSection(){const t=[];let e="",n="";if("product"===this.params.context){const i=this.store.get("products."+this.params.identifier);i.sizes[i.selectedSizeId].image?t.push(i.sizes[i.selectedSizeId].image):t.push(...i.images||[]),e=i.name,n=i.sizes[i.selectedSizeId].size}if("cart"===this.params.context){const i=this.store.get("cart.items."+this.params.identifier);i.mainImage&&t.push(i.mainImage),e=i.name,n=i.size}const i=document.createElement("div");if(i.className="product-info-section",t.length>0){const n=document.createElement("div");n.className="product-image-container";const o=document.createElement("img");o.src=t[0],o.alt=e,o.loading="lazy",o.className="product-image",n.appendChild(o),i.appendChild(n)}const o=document.createElement("div");o.className="product-details-container";const r=document.createElement("div");r.className="product-header";const s=document.createElement("h4");s.className="product-title",s.textContent=e,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),r.appendChild(s),r.appendChild(this.productPriceSpan),o.appendChild(r);const a=document.createElement("p");a.className="product-size-text",a.textContent=n,o.appendChild(a);const c=document.createElement("p");return c.className="engraving-fees-disclaimer",c.textContent="Personalization fees included in total, varies by retailer.",o.appendChild(c),i.appendChild(o),i}addToCartButtonText(t){if("product"!==this.params.context)return"Save";const e=this.getConfigs("product"),n=e.layout.addToCartButtonText;return e.layout.addToCartButtonShowTotalPrice?n+" - "+formatCentToDollarText(t):n}retailersSection(){var t,e,n,i,o,r,s;const a=this.store.get("products."+this.params.identifier),c=a.sizes[a.selectedSizeId],l=Object.values(c.shippingFulfillments).filter(t=>t.variant.isEngravable),d=document.createElement("div");d.className="fulfillment-section";const u=document.createElement("p");if(u.className="shipping-from-text",u.innerHTML="Shipping from: <b>"+(null===(t=a.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",d.appendChild(u),1===l.length)return d;const p=document.createElement("div");p.className="fulfillment-options-container",d.appendChild(p);const m=document.createElement("span");m.className="see-more-fulfillments",m.textContent="See More Delivery Options ("+l.length+")",m.setAttribute("role","button"),m.setAttribute("tabindex","0"),m.setAttribute("aria-label","See More Delivery Options ("+l.length+")"),m.setAttribute("aria-expanded","false");const y=()=>{const t=p.classList.contains("expanded");p.classList.toggle("expanded"),t?(m.textContent="See More Delivery Options ("+l.length+")",m.setAttribute("aria-label","See More Delivery Options ("+l.length+")"),m.setAttribute("aria-expanded","false")):(m.textContent="See Less Delivery Options",m.setAttribute("aria-label","See Less Delivery Options"),m.setAttribute("aria-expanded","true"))};m.addEventListener("click",y),m.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),d.appendChild(m);for(const g of l){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",g.id),g.id===(null===(e=a.selectedFulfillment)||void 0===e?void 0:e.id)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+g.retailerName+", "+formatCentToDollarText(g.variant.price+((null===(i=null===(n=a.sizes[a.selectedSizeId].attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.fee)||0))+", "+g.engravingExpectationText),t.setAttribute("aria-pressed",g.id===(null===(o=a.selectedFulfillment)||void 0===o?void 0:o.id)?"true":"false");const q=()=>{this.fulfillmentId=g.id,this.partNumber=g.variant.partNumber;const e=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(e),this.productPriceSpan.textContent=formatCentToDollarText(e);const n=p.querySelector(".fulfillment-option.selected");n&&(n.classList.remove("selected"),n.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),u.innerHTML="Shipping from: <b>"+g.retailerName+"</b>"};t.addEventListener("click",q),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),q())});const c=g.variant.price+((null===(s=null===(r=a.sizes[a.selectedSizeId].attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.fee)||0),l=document.createElement("div");l.className="option-row row-1",t.appendChild(l);const d=document.createElement("span");d.className="retailer-name",d.textContent=g.retailerName,l.appendChild(d);const m=document.createElement("span");m.className="fulfillment-price",m.textContent=formatCentToDollarText(c),l.appendChild(m),t.appendChild(l);const v=document.createElement("div");v.className="option-row row-2",t.appendChild(v);const b=document.createElement("span");b.className="estimated-time",b.textContent=""+g.engravingExpectationText,v.appendChild(b),t.appendChild(v),p.appendChild(t)}return d}engravingLinesSection(){var t;const{lines:e,maxLines:n,location:i,maxCharsPerLine:o}=this.params,r=document.createElement("div");r.className="engraving-section";const s=document.createElement("p");if(s.className="engraving-title",s.textContent="Personalize Your Bottle",r.appendChild(s),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-location-text",t.textContent="Your message will appear "+i.toLowerCase()+".",r.appendChild(t)}const a=Array.from({length:n},(t,n)=>{const i=n+1,r=document.createElement("div");r.className="engraving-input-wrapper",r.setAttribute("data-line-number",i.toString());const s=document.createElement("input");s.type="text",s.id="engraving-line-"+i,s.dataset.lineNumber=i.toString(),s.maxLength=o,s.value=e[n]||"",s.placeholder=i>1?"Line "+i+" (optional)":"Line "+i,s.className="engraving-input",s.autocomplete="off",s.setAttribute("aria-label",i>1?"Engraving line "+i+", optional, maximum "+o+" characters":"Engraving line "+i+", maximum "+o+" characters");const a=document.createElement("span");return a.className="engraving-char-count",a.textContent=s.value.length+"/"+o,a.setAttribute("aria-live","polite"),a.setAttribute("aria-atomic","true"),s.addEventListener("input",()=>{a.textContent=s.value.length+"/"+o,this.engravingLines[n]=s.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),r.appendChild(s),r.appendChild(a),r}),c=document.createElement("div");return c.className="engraving-inputs-container",c.append(...a),r.appendChild(c),r}actionButtonsSection(){const{identifier:t,context:e}=this.params,n=document.createElement("div");n.className="action-buttons-container";const i=document.createElement("button");i.type="button",i.className="cancel-action-button",i.textContent="Cancel",i.setAttribute("aria-label","Cancel personalization and close");const N=async()=>{"product"===e&&await this.commands.product.closeProductDrawer(t),"cart"===e&&this.commands.ui.openDrawer(o.CART)};i.addEventListener("click",N),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),N())}),n.appendChild(i),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===e?"Add personalized item to cart":"Update personalization and return to cart");const O=async()=>{const n=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);"product"===e&&this.fulfillmentId&&this.partNumber&&(await this.commands.product.addToCart(t,{fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:n,identifier:t}),await this.commands.product.closeProductDrawer(t)),"cart"===e&&(await this.commands.cart.updateItemEngraving(t,n),this.commands.ui.openDrawer(o.CART))};return this.addToCartButton.addEventListener("click",O),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),O())}),n.appendChild(this.addToCartButton),n}template(){const t=[],e=this.productInformationSection();if(t.push(e),"product"===this.params.context){const e=this.retailersSection();t.push(e)}const n=this.engravingLinesSection();t.push(n);const i=this.actionButtonsSection();t.push(i);const o=document.createElement("p");return o.className="engraving-disclaimer",o.innerHTML="Personalized orders require up to 10 business days to be processed and then shipped. Tracking information will be provided once processed. <b>Personalized bottle orders cannot be cancelled.</b>",t.push(o),t}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["engraving-view-container",t.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,i=(null==e?void 0:e.quantity)||1;return{quantity:i,fee:n,total:n*i}}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t),n=(null==e?void 0:e.attributes.engraving.fee)||0,i=(null==e?void 0:e.quantity)||1;return{quantity:i,fee:n,total:n*i}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const e=this.getStoreValue("cart.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+t);return(null==e?void 0:e.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,e,n,i,r,s,a,c,l,d,u,p,m,g,v,b,x,w,C,k;const S=this.params.identifier,E={identifier:S,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const o=this.getStoreValue("cart.items."+S);E.lines=(null===(e=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.lines)||[],E.maxLines=(null===(i=null===(n=null==o?void 0:o.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.maxLines)||1,E.maxCharsPerLine=(null===(s=null===(r=null==o?void 0:o.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxCharsPerLine)||16,E.fee=(null===(c=null===(a=null==o?void 0:o.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.fee)||0,E.location=(null===(d=null===(l=null==o?void 0:o.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+S);E.lines=(null===(p=null===(u=null==t?void 0:t.attributes)||void 0===u?void 0:u.engraving)||void 0===p?void 0:p.lines)||[],E.maxLines=(null===(g=null===(m=null==t?void 0:t.attributes)||void 0===m?void 0:m.engraving)||void 0===g?void 0:g.maxLines)||1,E.maxCharsPerLine=(null===(b=null===(v=null==t?void 0:t.attributes)||void 0===v?void 0:v.engraving)||void 0===b?void 0:b.maxCharsPerLine)||16,E.fee=(null===(w=null===(x=null==t?void 0:t.attributes)||void 0===x?void 0:x.engraving)||void 0===w?void 0:w.fee)||0,E.location=(null===(k=null===(C=null==t?void 0:t.attributes)||void 0===C?void 0:C.engraving)||void 0===k?void 0:k.location)||""}this.commands.ui.openDrawer(o.ENGRAVING_FORM,E)}async handleRemove(){const t=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(t,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(t)}template(){const t=this.engravingQuantityFee(),e=this.engravingLines();if(0===e.length)return"";const n=document.createElement("div");n.className="engraving-header";const i=document.createElement("h3");i.textContent="Personalization";const o=document.createElement("span");if(o.className="engraving-fee",1===t.quantity&&(o.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){o.textContent=formatCentToDollarText(t.total,![]);const e=document.createElement("span");e.className="engraving-fee-each",e.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",o.appendChild(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 e){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");c.type="button",c.classList.add("remove-button"),c.textContent="Remove",c.setAttribute("aria-label","Remove engraving");const P=async()=>{await this.handleRemove()};if(c.addEventListener("click",P),c.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await P())}),a.appendChild(c),"checkout"!==this.params.context){const t=document.createElement("button");t.type="button",t.classList.add("edit-button"),t.textContent="Edit",t.setAttribute("aria-label","Edit engraving"),t.addEventListener("click",this.handleEdit.bind(this)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEdit())}),a.appendChild(t)}return r.appendChild(s),r.appendChild(a),[n,r]}}class BirthdateInputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input","birthdate",t.layout.inputFieldStyle]}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.yearInput.value=t[0],this.monthInput.value=t[1],this.dayInput.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.padMonthOnBlur(),this.validateInput()}),this.dayInput.addEventListener("blur",()=>{this.padDayOnBlur(),this.validateInput()}),this.yearInput.addEventListener("blur",()=>{this.validateInput()});const t=[this.monthInput,this.dayInput,this.yearInput];for(const e of t)e.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){const t=Number.parseInt(n,10);t>=2&&t<=9&&(n="0"+n)}else if(2===n.length){const t=Number.parseInt(n,10);t>12?n="12":t<1&&"00"!==n&&(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){const t=Number.parseInt(n,10);t>=4&&t<=9&&(n="0"+n)}else if(2===n.length){const t=Number.parseInt(n,10);t>31?n="31":t<1&&"00"!==n&&(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}padMonthOnBlur(){const t=this.monthInput.value;if(1===t.length){const e=Number.parseInt(t,10);if(e>=0&&e<=9&&(this.monthInput.value="0"+t,this.params.onChange)){const t=this.getFormattedValue();this.params.onChange(t)}}}padDayOnBlur(){const t=this.dayInput.value;if(1===t.length){const e=Number.parseInt(t,10);if(e>=0&&e<=9&&(this.dayInput.value="0"+t,this.params.onChange)){const t=this.getFormattedValue();this.params.onChange(t)}}}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.scheduleValidation(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}isFieldsComplete(){const t=this.monthInput.value,e=this.dayInput.value,n=this.yearInput.value;return 2===t.length&&2===e.length&&4===n.length}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldsComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}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([]),!![];const r=2===t.length&&2===e.length&&4===n.length,s=t||e||n;if(o.required&&!s)i.push("Please enter a complete date (MM/DD/YYYY)");else if(s&&!r)i.push("Please enter a complete date (MM/DD/YYYY)");else if(r)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");this.showErrors(i);const a=0===i.length;return this.params.onValidation&&this.params.onValidation(a,i),a}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{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input",t.layout.inputFieldStyle]}handlePhoneKeydown(t){if("Backspace"===t.key){const 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])?)*$/;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}isFieldComplete(){var t,e,n;const i=this.inputElement.value.trim();if(!i)return![];switch(this.params.inputType){case"tel":return this.validateTel(i);case"date":return this.validateDate(i);case"email":return i.includes("@")&&(null===(t=i.split("@")[1])||void 0===t?void 0:t.includes("."));case"number":return!Number.isNaN(Number.parseFloat(i));default:return(null===(e=this.params.validation)||void 0===e?void 0:e.max)&&i.length>=this.params.validation.max||(null===(n=this.params.validation)||void 0===n?void 0:n.min)&&i.length>=this.params.validation.min?!![]:i.length>=3}}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"),!n.required&&!t.trim())return this.showErrors([]),!![];if(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}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}showErrors(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const e of t){const t=document.createElement("div");t.className="error-message",t.textContent=e,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===this.params.inputType&&this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const e=[];if(this.params.label){const n=document.createElement("label");n.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(n.textContent+="*"),n.setAttribute("for",this.params.name),e.push(n)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"===this.params.inputType&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",e.push(this.inputElement),e.push(this.errorContainer),e}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.U=null;const t=ClientConfigService.getInstance();this.V=this.attachShadow({mode:t.get("openShadowDom")?"open":"closed"})}initialize(t,e){if(this.A)return;if(!t||"string"!=typeof t)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(e&&e instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.V)throw new SDKError("LceElementComponent: Shadow DOM container is not available");e&&"function"==typeof e.rerender&&(this.U=t=>{e.rerender(t||"LceElementRerender")}),this.V.appendChild(e),this.applyBasicStyles();const n=ThemeProviderService.getInstance(),i=n.getStylesheet(t);this.applyThemeStyles(i),this.A=!![],this.V=null}rerender(t){this.U&&this.U(t)}applyBasicStyles(){const t="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n width: 100%;\n height: auto;\n }\n\n :host([drawer]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const e=new CSSStyleSheet;e.replaceSync(t),this.V.adoptedStyleSheets=[e,...this.V.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(et){this.createFallbackStylesheet(t)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const t=new CSSStyleSheet;return t.replaceSync("/* test */"),!![]}catch(t){return![]}}applyThemeStyles(t){t.forEach(t=>{"string"==typeof t?this.createFallbackStylesheet(t):this.V.adoptedStyleSheets=[...this.V.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const e=document.createElement("style");e.textContent=t,this.V&&this.V.appendChild(e)}}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.setAttribute("role","link"),n.setAttribute("aria-label","Read "+e),n}template(){const t=this.createPoweredBySection(),e=this.createDisclaimerSection();return[t,e]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const e=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!e||!this.applyButton||!this.currentActiveTicker)return;const n=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);n&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!n&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const e=this.store.get("cart.promoCode"),n=this.store.get("checkout.promoCode");return(null==e?void 0:e.code)===t||(null==n?void 0:n.code)===t}getActiveTickers(){var t;const e=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var n;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(n=null==e?void 0:e.address)||void 0===n?void 0:n.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const e=document.createElement("div");e.classList.add("promo-ticker__text-group");const n=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const 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",i.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(i.disabled=!![],i.textContent="APPLIED"),i.addEventListener("click",()=>this.handlePromoClick()),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=i,[e,i]}}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}}const Et=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&&Et.warn("Merging configurations with warnings:",i),n}const _t=new Map([["global.layout.enablePersonalization",[o.PRODUCT,o.CART,o.CHECKOUT,o.ENGRAVING_FORM,o.ENGRAVING_VIEW,o.PRODUCT_INTERACTIONS,o.CART_ITEM,o.CHECKOUT_ITEM]],["global.layout.personalizationText",[o.PRODUCT,o.CART,o.CHECKOUT,o.ENGRAVING_FORM,o.ENGRAVING_VIEW,o.CART_ITEM]],["global.layout.personalizationCardStyle",[o.PRODUCT,o.CART,o.CHECKOUT,o.ENGRAVING_FORM,o.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[o.CART,o.CART_PROMO_CODE,o.CART_FOOTER,o.CHECKOUT_ORDER_SUMMARY,o.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[o.CART,o.CHECKOUT,o.ADDRESS,o.INPUT,o.BIRTHDATE_INPUT,o.ADDRESS_INPUT,o.CHECKOUT_DELIVER_TO,o.CHECKOUT_BUYER,o.CHECKOUT_BILLING,o.CHECKOUT_PAYMENT,o.CART_PROMO_CODE]],["global.layout.showPoweredBy",[o.CART,o.CHECKOUT,o.CHECKOUT_COMPLETED,o.POWERED_BY,o.CART_FOOTER,o.CHECKOUT_ORDER_SUMMARY,o.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[o.POWERED_BY]],["product.layout.showImages",[o.PRODUCT,o.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[o.PRODUCT]],["product.layout.showDescription",[o.PRODUCT,o.PRODUCT_DESCRIPTION,o.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[o.PRODUCT,o.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[o.PRODUCT,o.PRODUCT_RETAILERS,o.PRODUCT_RETAILERS_CAROUSEL,o.PRODUCT_RETAILERS_POPUP,o.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[o.PRODUCT,o.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[o.PRODUCT,o.PRODUCT_IMAGE_CAROUSEL,o.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[o.PRODUCT,o.PRODUCT_RETAILERS,o.PRODUCT_RETAILERS_CAROUSEL,o.PRODUCT_RETAILERS_POPUP,o.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[o.PRODUCT,o.PRODUCT_RETAILERS,o.PRODUCT_RETAILERS_CAROUSEL,o.PRODUCT_RETAILERS_POPUP,o.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[o.PRODUCT,o.PRODUCT_ADD_TO_CART_SECTION,o.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[o.PRODUCT,o.PRODUCT_ADD_TO_CART_SECTION,o.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[o.PRODUCT,o.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[o.PRODUCT,o.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[o.CART,o.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[o.CART,o.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[o.CART,o.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[o.CART,o.CART_FOOTER]],["checkout.layout.emailOptIn",[o.CHECKOUT,o.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[o.CHECKOUT,o.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[o.CHECKOUT,o.CHECKOUT_GIFT_CARDS,o.CHECKOUT_ORDER_SUMMARY,o.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[o.CHECKOUT,o.CHECKOUT_ORDER_SUMMARY,o.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[o.CHECKOUT,o.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[o.CHECKOUT,o.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[o.CHECKOUT,o.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[o.CHECKOUT,o.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[o.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,e){const n=new Set;for(const i of Object.keys(e)){const e=_t.get(t+"."+i);if(e)for(const t of e)n.add(t)}return Array.from(n)}class ElementsBaseClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.injectedComponents=new Map,this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authClient=AuthClientService.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",et.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),this.logger.info("🔐 Starting authentication...");const t=await this.authClient.authenticate();if(!t)throw this.clientPrepared=![],new SDKError("Authentication failed. Please try again.",!![]);this.logger.info("✅ Authentication completed"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed"),this.logger.info("⚙️ Loading configurations...");let e=await this.apiClient.getAllConfigs();this.logger.info("✅ Configurations loaded"),this.clientConfig.set("partnerCode",e.configurations.partnerCode),this.clientConfig.set("partnerName",e.configurations.partnerName),this.logger.info("🔍 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.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),n=e.global.layout.showPoweredBy;e=deepMergeConfigs(e,t),e.global.layout.showPoweredBy=n}await this.themeProvider.initialize(e),this.logger.info("✅ Theme provider initialized"),this.logger.info("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.info("✅ Essential components registered"),this.logger.info("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(t){this.logger.error("Heavy initialization failed",t)}},0)}async initializeHeavyServices(){const t=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:t.partnerName,partnerCode:t.partnerCode,enablePartnerGTM:t.enablePartnerGTM,partnerGTMId:t.partnerGTMId||void 0,enableLiquidCommerceGTM:t.enableLiquidCommerceGTM,liquidCommerceGTMId:t.liquidCommerceGTMId}),this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t||"object"!=typeof t)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof t,!![]);const{type:e,containerId:n,...i}=t;if(!n||"string"!=typeof n)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof n?'"'+n+'"':n),!![]);if(!e)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const r=n.replace("#",""),s=document.getElementById(r);if(!s)return console.warn("Container with ID '"+r+"' not found"),null;s.innerHTML="";const a={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...i},c=ComponentFactoryService.createElement(a);return safeReplaceChildren(s,c),t.type===o.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(r,t.type,c)}async processInjectProduct(t){if(this.ensureAllComponentsRegistered(),0===t.length)throw new SDKError("At least one product is required. Received empty array.",!![]);t.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const e=t.slice(0,20),n=[],i=[];for(const o of e){if(!o||"object"!=typeof o){this.logger.warn("Invalid product parameter: must be an object");continue}if(!o.containerId||"string"!=typeof o.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+o.identifier+"'");continue}const t=o.containerId.replace("#","").trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+o.identifier+"'");continue}const e=document.getElementById(t);if(!e){this.logger.warn("Container with ID '"+t+"' not found for product '"+o.identifier+"'");continue}const i=n.every(e=>e.containerId!==t);if(!i){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!o.identifier||"string"!=typeof o.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+t+"'");continue}const r=n.every(t=>t.identifier!==o.identifier);r?n.push({containerId:t,identifier:o.identifier}):this.logger.warn("Duplicate product identifier '"+o.identifier+"' found, skipping")}for(const r of n){const t=ComponentFactoryService.createElement({type:o.PRODUCT,useShadowDom:!![],productId:r.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(r.containerId);e?(e.innerHTML="",e.appendChild(t),i.push(this.createInjectedComponentWrapper(r.containerId,o.PRODUCT,t)),await this.commands.product.createProductInstance(r.identifier,!![])):this.logger.warn("Product ("+r.identifier+") container with ID '"+r.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(n.map(t=>t.identifier)),i}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,o.CHECKOUT),void 0;if(!t)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(t.rows&&("number"!=typeof t.rows||t.rows<1||t.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+t.rows,!![]);if(t.columns&&("number"!=typeof t.columns||t.columns<1||t.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+t.columns,!![]);if(t.cardVariant&&!Object.values(c).includes(t.cardVariant))throw new SDKError('Invalid card variant "'+t.cardVariant+'". Valid options: '+Object.values(c).join(", "),!![]);if(t.filters&&!Array.isArray(t.filters))throw new SDKError("Filters must be an array. Received: "+typeof t.filters,!![]);if(t.filters&&t.filters.length>0){const e=Object.values(l);for(const n of t.filters)if(!e.includes(n))throw new SDKError('Invalid filter "'+n+'". Valid options: '+e.join(", "),!![])}if(t.productUrl&&"string"==typeof t.productUrl&&!t.productUrl.includes("{upc}")&&!t.productUrl.includes("{grouping}"))throw new SDKError('Product URL must include either {upc} or {grouping} placeholder. Received: "'+t.productUrl+'"',!![]);const e=document.getElementById(t.containerId.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list.',!![]);const n=ComponentFactoryService.createElement({type:o.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:t.cardVariant||c.STANDARD,fillCard:t.fillCard||![],rows:t.rows||4,columns:t.columns||4,filters:t.filters||[],productUrl:t.productUrl});safeReplaceChildren(e,n)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:o.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(t,e,n){const i={getType:()=>e,getElement:()=>document.getElementById(t),rerender:()=>{try{n&&"function"==typeof n.rerender?n.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+t+"' does not support rerender")}catch(e){this.logger.warn("Failed to rerender component in container '"+t+"'")}}};return this.injectedComponents.set(t,i),i}rerenderInjectedComponentsByType(t){for(const[e,n]of this.injectedComponents)n.getType()===t&&n.rerender()}isElementsEnabled(){var t;try{const e=this.themeProvider.getConfigs("configurations");return null!==(t=null==e?void 0:e.isElementsEnabled)&&void 0!==t?t:![]}catch(e){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",e),!![]}}injectDisabledElementsError(t,e){const n=document.getElementById(t.replace("#",""));if(!n)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let 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(o.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(o.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(o.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(o.CART,AddressInputComponent),ComponentFactoryService.registerComponent(o.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_SEARCH,ProductListSearchComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(o.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(o.INPUT,InputComponent),ComponentFactoryService.registerComponent(o.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(o.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(o.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(o.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(o.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(o.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(o.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(o.ALERT,AlertComponent),ComponentFactoryService.registerComponent(o.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(o.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(o.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(o.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(o.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(o.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(o.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(o.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(o.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(o.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(o.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(o.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(o.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(o.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(o.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(o.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(o.CART,CartComponent),ComponentFactoryService.registerComponent(o.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(o.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(o.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(o.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(o.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(o.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(o.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(o.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(o.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(o.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(o.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(t,e)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);this.ensureCartDrawerExists();const n=document.getElementById(t.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before adding the cart button.',!![]);const i=ComponentFactoryService.createElement({type:o.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});n.innerHTML="",safeReplaceChildren(n,i)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:o.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(e)},cartSubtotal:t=>{if(!t||"string"!=typeof t)throw new SDKError("Cart subtotal display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const e=document.getElementById(t.replace("#",""));if(!e)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart subtotal.',!![]);e.innerHTML="",e.classList.add("lce-cart-subtotal");const F=t=>{e.textContent=formatCentToDollarText(t)},n=this.store.get("cart.subtotal")||0;F(n),this.store.watch("cart.subtotal",()=>{const t=this.store.get("cart.subtotal")||0;F(t)})},cartItemsCount:(t,e)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);let n=!![];e&&"boolean"==typeof e.hideZero&&(n=e.hideZero);const i=document.getElementById(t.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart items count.',!![]);i.innerHTML="",i.classList.add("lce-cart-items-count");const N=t=>{i.textContent=t.toString(),0===t?(n&&(i.style.visibility="hidden"),i.classList.add("no-items")):(n&&(i.style.visibility="visible"),i.classList.remove("no-items"))},o=this.store.get("cart.itemsQuantity")||0;N(o),this.store.watch("cart.itemsQuantity",()=>{const t=this.store.get("cart.itemsQuantity")||0;N(t)})}}}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);if(!this.isElementsEnabled()){for(const e of t)this.injectDisabledElementsError(e.containerId,o.PRODUCT);return[]}return await this.processInjectProduct(t)}async injectAddressElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:o.ADDRESS,containerId:t,options:e}):(this.injectDisabledElementsError(t,o.ADDRESS),null)}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:o.CART,containerId:t}):(this.injectDisabledElementsError(t,o.CART),null)}async injectCheckoutElement(t){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:o.CHECKOUT,containerId:t}):(this.injectDisabledElementsError(t,o.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,e){try{SingletonManager.setContext({isBuilder:![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:e.env,isBuilder:![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:e.promoTicker,proxy:e.proxy,development:e.development});const o=i.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const r=await SingletonManager.getClient(o);if(!r.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const s={injectProductElement:r.injectProductElement.bind(r),injectAddressElement:r.injectAddressElement.bind(r),injectCartElement:r.injectCartElement.bind(r),injectCheckoutElement:r.injectCheckoutElement.bind(r),injectProductList:r.injectProductList.bind(r),ui:r.ui,actions:r.actions,getInjectedComponents:r.getInjectedComponents.bind(r)};window.elements=s;const a=PubSubService.getInstance();return a.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:i.get("version")}),s}catch(i){try{const t=LoggerFactory.get("ElementsClientInit");t.error("Elements Client Initialization failed",i)}catch(o){console.error("[LiquidCommerce Elements] Client initialization failed:",null==i?void 0:i.message)}try{const t=ClientConfigService.getInstance(),e=PubSubService.getInstance();e.publishAction(n.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==i?void 0:i.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(r){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}const Dt={CORE:{MAIN_SCRIPT:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode"},PROMO_TICKER:{CODE:"data-promo-code",TEXT:"data-promo-text",SEPARATOR:"data-promo-separator",ACTIVE_FROM:"data-promo-active-from",ACTIVE_UNTIL:"data-promo-active-until",CODE_PARAM:"data-promo-code-param"},PRODUCT:{PRODUCT:"data-product",CONTAINER:"data-container",PARAM:"data-product-param",FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",LCE_PRODUCT:"data-lce-product"},PRODUCT_LIST:{LIST:"data-liquid-commerce-elements-products-list",SCRIPT:"data-liquid-commerce-elements-products",CARD:"data-card",CARD_FILL:"data-card-fill",ROWS:"data-rows",COLUMNS:"data-columns",FILTERS:"data-filters",PRODUCT_URL:"data-product-url"},CART:{BUTTON:"data-cart-button",BADGE_BUTTON:"data-cart-badge-button",MOBILE_BUTTON:"data-cart-mobile-button",MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",BUTTON_HIDDEN:"data-cart-button-hidden",TOGGLE_BUTTON:"data-lce-cart-toggle-button",ITEMS_COUNT:"data-lce-cart-items-count"},DEVELOPMENT:"data-liquid-commerce-elements-development"};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function generateElementId({prefix:t,index:e}){const n=Math.random().toString(36).substring(2,7),i=void 0!==t?t:"",o=void 0!==e?e:"",r=i&&o?"-":"";return""+i+r+o+n}function pairsFromMainScript(t){const e=[];try{const i=t.getAttributeNames().filter(t=>t.substring(0,12)===Dt.PRODUCT.PRODUCT);for(const o of i)try{const n=o.match(/^data-product(-(.+))?$/),i=(null==n?void 0:n[2])?"-"+n[2]:"",r=""+Dt.PRODUCT.CONTAINER+i;if(t.hasAttribute(r)){const n=t.getAttribute(r),i=t.getAttribute(o);n&&i&&e.push({containerId:n,identifier:i})}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",i)}return e}function pairsFromProductsScript(){const t=[];try{const n=document.querySelectorAll("script["+Dt.PRODUCT_LIST.SCRIPT+"]");for(const i of n)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(e){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",n)}return t}function pairsFromAttributedElements(){const t=[];try{const n=document.querySelectorAll("div["+Dt.PRODUCT.LCE_PRODUCT+"]");let i=0;for(const o of n)try{const e=generateElementId({prefix:"lce-p",index:i});o.setAttribute("id",e);const n=o.getAttribute(Dt.PRODUCT.LCE_PRODUCT);e&&n&&t.push({containerId:e,identifier:n}),i+=1}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",e)}}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",n)}return t}async function addProductToCartViaQueryParam(t,e){try{const i=e.getAttribute(Dt.PRODUCT.PARAM),o=e.getAttribute(Dt.PRODUCT.FULFILLMENT_TYPE_PARAM);if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const s=new URLSearchParams(window.location.search),a=s.get(i);if(!a)return;let c=r.SHIPPING;if(o)if(startsWithLcePrefix(o)){const t=s.get(o);t!==r.ON_DEMAND&&t!==r.SHIPPING||(c=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+o+'" because it does not start with "lce_" prefix.');try{await t.actions.cart.addProduct([{identifier:a,fulfillmentType:c,quantity:1}],!![])}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",i)}}async function addPromoCodeToCartViaQueryParam(t,e){try{const i=e.getAttribute(Dt.PROMO_TICKER.CODE_PARAM);if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const o=new URLSearchParams(window.location.search),r=o.get(i);if(!r)return;try{await t.actions.cart.applyPromoCode(r)}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",i)}}async function setupCartButtonWithPosition(t,e,n,i){var o,r,s;try{const a=n.includes("mobile"),c=a?"mobile":"desktop",l=!a,d=e.getAttribute(n),u=e.getAttribute(i);if(!e.hasAttribute(n)&&!e.hasAttribute(i))return;if(l){if(e.hasAttribute(n)&&!d)return t.ui.floatingCartButton(![]),void 0;if(e.hasAttribute(i)&&!u)return t.ui.floatingCartButton(!![]),void 0}const p=d||u,m=!!u;if(!p)return l&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(m)),void 0;const g=["above","below","replace","inside"],v=p.match(/^(\w+):(.+)$/),b=v&&g.includes(v[1])?v[1]:"inside";let x=v?v[2]:p;/^[#.]/.test(x)||/\s/.test(x)||(x="#"+x);const w=document.querySelector(x);if(!w)return l&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+x+'" not found. Using floating button.'),t.ui.floatingCartButton(m)),void 0;const C=document.createElement("div");switch(C.classList.add("lce-cart-"+c+"-button-container"),C.id=generateElementId({prefix:"lce-cart-"+c+"-btn"}),b){case"above":null===(o=w.parentNode)||void 0===o?void 0:o.insertBefore(C,w);break;case"below":null===(r=w.parentNode)||void 0===r?void 0:r.insertBefore(C,w.nextSibling);break;case"replace":null===(s=w.parentNode)||void 0===s?void 0:s.replaceChild(C,w);break;default:w.appendChild(C)}t.ui.cartButton(C.id,m)}catch(a){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",a)}}async function setupCartButtons(t,e){e.hasAttribute(Dt.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(t,e,Dt.CART.BUTTON,Dt.CART.BADGE_BUTTON),await setupCartButtonWithPosition(t,e,Dt.CART.MOBILE_BUTTON,Dt.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(t){try{const e=document.querySelector("div["+Dt.PRODUCT_LIST.LIST+"]");if(!e)return;const n="lce-products-list-container";e.className="lce-products-list-container",e.id=n;const i=e.getAttribute(Dt.PRODUCT_LIST.CARD)||"standard",o=e.hasAttribute(Dt.PRODUCT_LIST.CARD_FILL),r=Number.parseInt(e.getAttribute(Dt.PRODUCT_LIST.ROWS)||"3",10)||3,s=Number.parseInt(e.getAttribute(Dt.PRODUCT_LIST.COLUMNS)||"4",10)||4,a=e.getAttribute(Dt.PRODUCT_LIST.FILTERS),c=e.getAttribute(Dt.PRODUCT_LIST.PRODUCT_URL)||void 0;let l=[];a&&(l=a.split(",").map(t=>t.trim()).filter(t=>t.length>0)),await t.injectProductList({containerId:n,rows:r,columns:s,cardVariant:i,fillCard:o,filters:l,productUrl:c})}catch(e){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",e)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async t=>{const e=t.detail;if(!e.data.isReady)return;const n=window.elements,i=document.querySelectorAll("["+Dt.CART.TOGGLE_BUTTON+"]");if(i.length>0)for(const r of i)r.addEventListener("click",async t=>{t.stopPropagation(),t.preventDefault(),n.actions.cart.toggleCart()});const o=document.querySelectorAll("["+Dt.CART.ITEMS_COUNT+"]");if(o.length>0){let t=0;for(const e of o){const i=e.getAttribute(Dt.CART.ITEMS_COUNT),o=!(i&&"keep-zero"===i),r=Boolean(null==e?void 0:e.id);let s;r?s=e.id:(s=generateElementId({prefix:"lce-cart-items-count",index:t}),e.id=s),n.ui.cartItemsCount(s,{hideZero:o}),t+=1}}})}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",et)}}function getDevelopmentConfigs(){const t=document.querySelector("script["+Dt.DEVELOPMENT+"]");if(t)try{return JSON.parse(t.textContent||"{}")}catch(e){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",e),void 0}}async function ElementsAutoInitialize(){var t,n,i,o,r,a;try{const a=document.querySelector("script["+Dt.CORE.MAIN_SCRIPT+"]");if(!a)return;const c=a.getAttribute(Dt.CORE.TOKEN),l=a.getAttribute(Dt.CORE.ENV)||e.PRODUCTION,d=a.getAttribute(Dt.CORE.DEBUG_MODE);if(!c)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const u=a.getAttribute(Dt.PROMO_TICKER.CODE),p=a.getAttribute(Dt.PROMO_TICKER.TEXT),m=null!==(t=a.getAttribute(Dt.PROMO_TICKER.SEPARATOR))&&void 0!==t?t:"•",g=null!==(n=a.getAttribute(Dt.PROMO_TICKER.ACTIVE_FROM))&&void 0!==n?n:void 0,v=null!==(i=a.getAttribute(Dt.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==i?i:void 0,b=pairsFromMainScript(a),x=pairsFromProductsScript(),w=pairsFromAttributedElements(),C=[...b,...x,...w],k=u&&p&&g&&v?{promoCode:u,text:p.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:m,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;let S=s.NONE;d&&l!==e.PRODUCTION&&(S=d),setupEventListeners();const E=await Elements(c,{env:l,debugMode:S,promoTicker:k?[k]:void 0,development:getDevelopmentConfigs()});if(!E)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);setupCartButtons(E,a),0!==C.length&&E.injectProductElement(C).catch(t=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",t)}),initializeProductsList(E),addProductToCartViaQueryParam(E,a),addPromoCodeToCartViaQueryParam(E,a)}catch(c){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(a=null==c?void 0:c.message)&&void 0!==a?a:String(c))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",et)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",et)}},50)}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",et)}}class ElementsBuilderClient extends ElementsBaseClient{async updateComponentGlobalConfigs(t){try{if(!t)throw new SDKError("Global configuration object is required.",!![]);if(this.themeProvider.updateComponentGlobalConfigs(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("global.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(e){throw this.logger.error("❌ Failed to update global theme configuration",e),new SDKError("Failed to update global configuration: "+e.message,!![])}}async updateProductComponent(t){try{if(!t)throw new SDKError("Product configuration object is required.",!![]);if(this.themeProvider.updateProductComponent(t),t.layout&&Object.keys(t.layout).length>0){await this.commands.product.rerenderAllProducts();for(const e of getComponentTypesForLayoutFields("product.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(e){throw this.logger.error("❌ Failed to update product component theme",e),new SDKError("Failed to update product configuration: "+e.message,!![])}}updateCartComponent(t){try{if(!t)throw new SDKError("Cart configuration object is required.",!![]);if(this.themeProvider.updateCartComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.cart.rerenderCart();for(const e of getComponentTypesForLayoutFields("cart.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(e){throw this.logger.error("❌ Failed to update cart component theme",e),new SDKError("Failed to update cart configuration: "+e.message,!![])}}updateCheckoutComponent(t){try{if(!t)throw new SDKError("Checkout configuration object is required.",!![]);if(this.themeProvider.updateCheckoutComponent(t),t.layout&&Object.keys(t.layout).length>0){this.commands.checkout.rerenderCheckout();for(const e of getComponentTypesForLayoutFields("checkout.layout",t.layout))this.rerenderInjectedComponentsByType(e)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(e){throw this.logger.error("❌ Failed to update checkout component theme",e),new SDKError("Failed to update checkout configuration: "+e.message,!![])}}updateAddressComponent(t){try{if(!t)throw new SDKError("Address configuration object 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 SDKError("Failed to update address configuration: "+e.message,!![])}}async injectElement(t){if(!t)throw new SDKError("Element injection requires container ID and type parameters.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(!t.type)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);return await this.processInjectElement(t)}async injectProductElement(t){if(!Array.isArray(t))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof t,!![]);return await this.processInjectProduct(t)}async injectAddressElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:o.ADDRESS,containerId:t,options:e})}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:o.CART,containerId:t})}async injectCheckoutElement(t,e){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const n=await this.processInjectElement({type:o.CHECKOUT,containerId:t});if(null==e?void 0:e.simulatePresale){const t=e.presaleExpiresInMinutes||15,n=new Date;n.setMinutes(n.getMinutes()+t),this.store.set("checkout.presale",{isLocked:!![],expiresAt:n.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+t+" minutes")}return n}}async function ElementsBuilder(t,e){try{SingletonManager.setContext({isBuilder:!![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:e.env,isBuilder:!![],debugMode:e.debugMode,customTheme:e.customTheme,promoTicker:e.promoTicker,proxy:void 0,development:void 0});const o=i.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const r=await SingletonManager.getClient(o);if(!r.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const s={updateComponentGlobalConfigs:r.updateComponentGlobalConfigs.bind(r),updateProductComponent:r.updateProductComponent.bind(r),updateAddressComponent:r.updateAddressComponent.bind(r),updateCartComponent:r.updateCartComponent.bind(r),updateCheckoutComponent:r.updateCheckoutComponent.bind(r),injectElement:r.injectElement.bind(r),injectProductElement:r.injectProductElement.bind(r),injectAddressElement:r.injectAddressElement.bind(r),injectCartElement:r.injectCartElement.bind(r),injectCheckoutElement:r.injectCheckoutElement.bind(r),injectProductList:r.injectProductList.bind(r),actions:r.actions};window.elementsBuilder=s;const a=PubSubService.getInstance();return a.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:i.get("version")}),s}catch(i){try{const t=LoggerFactory.get("ElementsBuilderClientInit");t.error("Elements Builder Client Initialization failed",i)}catch(o){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==i?void 0:i.message)}try{const t=ClientConfigService.getInstance(),e=PubSubService.getInstance();e.publishAction(n.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==i?void 0:i.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(r){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const t=window.onerror;window.onerror=(e,n,i,o,r)=>isSDKError(r,n)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:e,source:n,lineno:i,colno:o,error:r}),!![]):t?t(e,n,i,o,r):![];const e=window.onunhandledrejection;window.onunhandledrejection=t=>{if(t.reason&&isSDKError(t.reason))return console.error("[LiquidCommerce Elements] Unhandled SDK promise rejection:",t.reason),t.preventDefault(),void 0;e&&e.call(window,t)};try{initializeDOMPolyfills()}catch(Pt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Pt)}try{triggerElementsAutoInit()}catch(It){console.error("[LiquidCommerce Elements] Auto-initialization failed:",It)}}catch(Tt){console.error("[LiquidCommerce Elements] SDK initialization failed:",Tt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):(e="undefined"!=typeof globalThis?globalThis:e||self,n(e.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...e){for(;this.firstChild;)this.removeChild(this.firstChild);for(const n of e)"string"==typeof n?this.appendChild(document.createTextNode(n)):this.appendChild(n)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...e){const n=document.createDocumentFragment();for(const o of e)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o);this.insertBefore(n,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...e){const n=this.parentNode;if(!n)return;const o=document.createDocumentFragment();for(const l of e)"string"==typeof l?o.appendChild(document.createTextNode(l)):o.appendChild(l);n.replaceChild(o,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...e){const n=this.parentNode;if(!n)return;const o=document.createDocumentFragment();for(const l of e)"string"==typeof l?o.appendChild(document.createTextNode(l)):o.appendChild(l);n.insertBefore(o,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...e){const n=this.parentNode;if(!n)return;const o=document.createDocumentFragment();for(const l of e)"string"==typeof l?o.appendChild(document.createTextNode(l)):o.appendChild(l);n.insertBefore(o,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=e=>{const n={};for(const[o,l]of e)n[o]=l;return n})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(et){console.warn("DOM polyfills initialization failed:",et)}}function safeReplaceChildren(e,...n){try{if("replaceChildren"in e&&"function"==typeof e.replaceChildren)e.replaceChildren(...n);else{for(;e.firstChild;)e.removeChild(e.firstChild);for(const o of n)"string"==typeof o?e.appendChild(document.createTextNode(o)):e.appendChild(o)}}catch(o){console.error("replaceChildren operation failed:",o),1===n.length&&"string"==typeof n[0]&&(e.innerHTML=n[0])}}class SDKError extends Error{constructor(e,n=![]){super(e),this.name="SDKError",this.isSdk=!![],this.reThrow=n,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(e,n){if((null==e?void 0:e.isSdk)===!![])return e instanceof SDKError&&e.reThrow?![]:!![];if(!e||"object"!=typeof e)return n?isSDKSource(n):![];const o=String((null==e?void 0:e.message)||""),l=/liquidcommerce\s+elements/i.test(o),d=String((null==e?void 0:e.stack)||""),h=(null==e?void 0:e.source)||n||"",u=[/@[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/[./]*[/\\](?:core|modules|constants|enums|interfaces|utils|static)[/\\]/,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk[/\\]/i,/elements-sdk[/\\](?:src[/\\])?(?:core|modules)[/\\]/i,/chunk-[a-z0-9]+.*elements/i],p=[/\bElements\b(?!\w)/,/\bElementsBuilder\b/,/\bLiquidCommerceElements\b/,/BaseComponent/,/Elements(?:Base)?Client/,/(?:Auth|Store|Command|ApiClient|Telemetry|FingerPrint|GoogleTagManager|ClientConfig|ThemeProvider|ComponentFactory|PubSub|SingletonManager|DebugPanel)Service/,/(?:Cart|Product|Checkout|Address|ProductList|UI|Common)Commands/,/(?:Product|Cart|Checkout|Address|ProductList).*Component/],m=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],v=[/elements-sdk[/\\]/i,/modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,/core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,/@liquidcommerce[/\\]elements-sdk/i],y=isSDKSource(h),b=u.some(e=>e.test(d)),x=p.some(e=>e.test(d)),w=m.some(e=>e.test(d)),C=v.some(e=>e.test(d));return l||y||b||x||w||C}function isSDKSource(e){if(!e||"string"!=typeof e)return![];const n=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return n.some(n=>n.test(e))}const e={BRANDS:"brands",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",CATEGORIES:"categories",SIZES:"sizes",APPELLATION:"appellation",COUNTRY:"country",VINTAGE:"vintage",MATERIALS:"materials"},n={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},o={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},l={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},d={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",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},h={ON_DEMAND:"onDemand",SHIPPING:"shipping"},u={NONE:"none",CONSOLE:"console",PANEL:"panel"},p={[n.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[n.STAGING]:"https://staging-elements.liquidcommerce.us",[n.PRODUCTION]:"https://elements.liquidcommerce.us"},m={STANDARD:"standard"},v={PERSONALIZATION:"personalization",PRE_ORDER:"pre-order",DELIVERY_OPTIONS:"delivery-options",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},y={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"builder"===SingletonManager.currentContext?(SingletonManager.builderClientInstances||(SingletonManager.builderClientInstances=new Map),SingletonManager.builderClientInstances):(SingletonManager.regularClientInstances||(SingletonManager.regularClientInstances=new Map),SingletonManager.regularClientInstances)}constructor(){}static setContext({isBuilder:e}){SingletonManager.currentContext=e?"builder":"regular"}static setClientConstructor(e){SingletonManager.clientConstructor=e}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(e,n){const o=SingletonManager.getInstances();o.has(e)||o.set(e,n());const l=o.get(e);if(!l)throw new SDKError("ElementsSdk: Instance for class "+e+" could not be created.");return l}static async getClient(e){const n=[e.apiKey,e.env,e.isBuilder,e.debugMode].join("_"),o="LiquidCommerceElementsClient_"+n,l=SingletonManager.getInstances();if(l.has(o))return l.get(o);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const d=new SingletonManager.clientConstructor(e);return await d.prepare(),l.set(o,d),d}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const b="lce",x={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},w={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:h.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},C={id:"",subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},k={token:"",cartId:"",loading:![],updating:![],error:null,warning:[],presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddressTwo:"",promoCode:null,giftCards:[],orderNumber:null,items:{},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:![],onDemandFulfillmentTipInfo:{},tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},S={drawer:{isOpen:![],contentConfig:null}},_={products:{},cart:C,address:x,checkout:k,ui:S};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(e,n={}){this.validateInputs(e,n),this.config=Object.freeze(this.buildConfiguration(e,n))}getConfigs(){return{...this.config}}get(e){return this.config[e]}set(e,n){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[e]:n})}isDevelopment(){return this.get("env")===n.DEVELOPMENT}isStaging(){return this.get("env")===n.STAGING}isProduction(){return this.get("env")===n.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const e=this.get("debugMode");return e===u.CONSOLE||e===u.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===u.PANEL}debuggingDisabled(){const e=this.get("debugMode");return e===u.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}getProxyConfig(){return this.get("proxy")}validateInputs(e,o){if(!(null==e?void 0:e.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(o.env&&!Object.values(n).includes(o.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+o.env+'". Using default environment.'),o.env=void 0),void 0!==o.isBuilder&&"boolean"!=typeof o.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),o.isBuilder=void 0),void 0===o.debugMode||Object.values(u).includes(o.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+o.debugMode+'". Must be one of: '+Object.values(u).join(", ")+". Using default value."),o.debugMode=void 0),o.promoTicker&&"object"!=typeof o.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),o.promoTicker=void 0),o.promoTicker)if(Array.isArray(o.promoTicker)){const e=o.promoTicker.filter((e,n)=>{if("string"!=typeof e.promoCode||!e.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(e.text)||0===e.text.length||!e.text.every(e=>"string"==typeof e&&e.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof e.separator||!e.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!e.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom is required. Skipping this promo."),![];const o="string"==typeof e.activeFrom?new Date(e.activeFrom):e.activeFrom;if(!(o instanceof Date)||Number.isNaN(o.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!e.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil is required. Skipping this promo."),![];const l="string"==typeof e.activeUntil?new Date(e.activeUntil):e.activeUntil;return l instanceof Date&&!Number.isNaN(l.getTime())?o>=l?(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});o.promoTicker=e.length>0?e:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),o.promoTicker=void 0;o.proxy&&("object"!=typeof o.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),o.proxy=void 0):o.proxy.baseUrl&&"string"==typeof o.proxy.baseUrl?o.proxy.headers&&"object"!=typeof o.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),o.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),o.proxy=void 0))}buildConfiguration(e,o){var l,d,h,m;const v=o.env||n.PRODUCTION;let y=p[v];const x=v===n.PRODUCTION,w=o.isBuilder||![],C=b+(x?"":"_"+v)+(w?"builder":"");return(null===(l=o.development)||void 0===l?void 0:l.customApiUrl)&&(y=o.development.customApiUrl),{apiKey:e.trim(),env:v,isBuilder:w,debugMode:o.debugMode||u.NONE,baseUrl:y,partnerCode:void 0,partnerName:void 0,customTheme:o.customTheme||null,proxy:o.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:C,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:o.promoTicker||null,paymentMethodId:(null===(d=o.development)||void 0===d?void 0:d.paymentMethodId)||void 0,openShadowDom:x?![]:(null===(h=o.development)||void 0===h?void 0:h.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(m=o.development)||void 0===m?void 0:m.customApiUrl)}}detectDeviceType(){var e,n;if("undefined"==typeof navigator)return"desktop";const o=navigator.userAgent.toLowerCase(),l="ontouchstart"in window||navigator.maxTouchPoints>0,d=(null===(e=window.screen)||void 0===e?void 0:e.width)||0,h=(null===(n=window.screen)||void 0===n?void 0:n.height)||0,u=Math.max(d,h),p=[/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/],m=[/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 p.some(e=>e.test(o))?"tablet":m.some(e=>e.test(o))||l&&u<768?"mobile":l&&u>=768&&u<=1200||l&&/macintosh/i.test(o)&&navigator.maxTouchPoints>1||/android/i.test(o)&&l&&u>=768||/windows nt/i.test(o)&&l&&u>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(o),"desktop")}}class LoggerService{constructor(e){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.telemetryService=null,this.context=e}static getInstance(e){return SingletonManager.getClassInstance("LoggerService_"+e,()=>new LoggerService(e))}setEnableLogging(e){this.enableLogging=e}setTelemetryService(e){this.telemetryService=e}getPrefix(e){if(!this.enableLogging)return[];const n=(new Date).toISOString().slice(11,23);return["%c["+n+"%c "+this.prefix+"%c "+this.context+"%c]","color: "+this.colors[e],"color: "+this.colors.prefix+"; font-weight: bold","color: "+this.colors[e],"color: "+this.colors[e]]}debug(e,n){if(this.sendToTelemetry("debug",e,void 0,n),!this.enableLogging)return;const[o,...l]=this.getPrefix("debug");void 0!==n?console.debug(o,...l,e,n):console.debug(o,...l,e)}info(e,n){if(!this.enableLogging)return;const[o,...l]=this.getPrefix("info");void 0!==n?console.info(o,...l,e,n):console.info(o,...l,e)}warn(e,n){if(this.sendToTelemetry("warn",e,void 0,n),!this.enableLogging)return;const[o,...l]=this.getPrefix("warn");void 0!==n?console.warn(o,...l,e,n):console.warn(o,...l,e)}error(e,n){const o=n instanceof Error,l=o?n:void 0,d=!o&&n?n:void 0;if(this.sendToTelemetry("error",e,l,d),!this.enableLogging)return;const[h,...u]=this.getPrefix("error");void 0!==n?console.error(h,...u,e,n):console.error(h,...u,e)}sendToTelemetry(e,n,o,l){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(e,n,{context:this.context,error:o,data:l})}catch(d){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(e){const n=this.getInstances();if(!n.has(e)){const o=LoggerService.getInstance(e);o.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&o.setTelemetryService(this.telemetryService),n.set(e,o)}return n.get(e)}static setEnableLogging(e){this.enableLoggingGlobally=e;const n=this.getInstances();for(const[,o]of n)o.setEnableLogging(e)}static setTelemetryService(e){this.telemetryService=e;const n=this.getInstances();for(const[,o]of n)o.setTelemetryService(e)}}function componentError({componentType:e,message:n}){const o=document.createElement("div");o.className=e;const l=o.attachShadow({mode:"closed"}),d=document.createElement("style");d.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 h=document.createElement("div"),u=document.createElement("h3");u.textContent="Component </"+e+">";const p=document.createElement("p");return p.textContent=n,h.appendChild(d),h.appendChild(u),h.appendChild(p),l.appendChild(h),o}function productionComponentError({title:e,message:n,componentType:o}){const l=document.createElement("div");l.setAttribute("data-component-type",o);const d=l.attachShadow({mode:"closed"}),h=document.createElement("style");h.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 u=document.createElement("div"),p=document.createElement("h2");p.textContent=e;const m=document.createElement("p");return m.textContent=n,u.appendChild(h),u.appendChild(p),u.appendChild(m),d.appendChild(u),l}LoggerFactory.instances=null,LoggerFactory.enableLoggingGlobally=![],LoggerFactory.telemetryService=null;class ComponentFactoryService{static get logger(){return ComponentFactoryService.t||(ComponentFactoryService.t=LoggerFactory.get("ComponentFactory")),ComponentFactoryService.t}static get clientConfig(){return ComponentFactoryService.i||(ComponentFactoryService.i=ClientConfigService.getInstance()),ComponentFactoryService.i}static getComponentRegistry(){return ComponentFactoryService.componentRegistry||(ComponentFactoryService.componentRegistry=new Map),ComponentFactoryService.componentRegistry}static registerComponent(e,n){ComponentFactoryService.getComponentRegistry().set(e,n)}static createElement(e){try{const n=ComponentFactoryService.getComponentRegistry().get(e.type);if(!n)throw new SDKError("Component type ["+e.type+"] is not registered");const o=ComponentFactoryService.getComponentTagName(e.type);window.customElements.get(o)||window.customElements.define(o,n);const l=document.createElement(o);if(l.initialize){const{type:n,useShadowDom:d,wrapInLceElement:h,...u}=e,p={type:n,tagName:o,useShadowDom:d&&h!==!![]};l.initialize({data:u,config:p})}if(e.wrapInLceElement){const n=ComponentFactoryService.getComponentRegistry().get(d.LCE_ELEMENT),o=ComponentFactoryService.getComponentTagName(d.LCE_ELEMENT);window.customElements.get(o)||window.customElements.define(o,n);const h=document.createElement(o);return h.initialize(e.type,l),h}return l}catch(n){return ComponentFactoryService.logger.error("Failed to create component </"+e.type+">",n),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:e.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:e.type}):componentError({componentType:e.type,message:(null==n?void 0:n.message)||n})}}static componentError({componentType:e,message:n}){return ComponentFactoryService.logger.error("Component type "+e+" failed to load: "+n),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:e.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:e}):componentError({componentType:e,message:n})}static getComponentTagName(e){const n={[d.DRAWER]:"drawer-lc",[d.INPUT]:"input-lc",[d.BIRTHDATE_INPUT]:"birthdate-input-lc",[d.ENGRAVING_FORM]:"engraving-form-lc",[d.ENGRAVING_VIEW]:"engraving-view-lc",[d.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[d.POWERED_BY]:"powered-by-lc",[d.LCE_ELEMENT]:"lce-element",[d.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[d.ALERT]:"alert-lc",[d.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[d.ADDRESS]:"address-lc",[d.ADDRESS_INPUT]:"address-input-lc",[d.ADDRESS_DISPLAY]:"address-display-lc",[d.PRODUCT]:"product-lc",[d.PRODUCT_OPTIONS]:"product-options-lc",[d.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[d.PRODUCT_INTERACTIONS]:"product-interactions-lc",[d.PRODUCT_DESCRIPTION]:"product-description-lc",[d.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[d.PRODUCT_RETAILERS]:"product-retailers-lc",[d.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[d.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[d.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[d.PRODUCT_PRICE]:"product-price-lc",[d.PRODUCT_DRAWER]:"product-drawer-lc",[d.PRODUCT_LOADING]:"product-loading-lc",[d.PRODUCT_LIST]:"product-list-lc",[d.PRODUCT_LIST_CARD]:"product-list-card-lc",[d.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[d.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[d.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[d.CART]:"cart-lc",[d.CART_RETAILER]:"cart-retailer-lc",[d.CART_ITEM]:"cart-item-lc",[d.CART_FOOTER]:"cart-footer-lc",[d.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[d.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[d.CART_PROMO_CODE]:"cart-promo-code-lc",[d.CART_HEADER]:"cart-header-lc",[d.CART_BODY]:"cart-body-lc",[d.CART_FULFILLMENT]:"cart-fulfillment-lc",[d.CHECKOUT]:"checkout-lc",[d.CHECKOUT_INFORMATION]:"checkout-information-lc",[d.CHECKOUT_PAYMENT]:"checkout-payment-lc",[d.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[d.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[d.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[d.CHECKOUT_BILLING]:"checkout-billing-lc",[d.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[d.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[d.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[d.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[d.CHECKOUT_ITEMS]:"checkout-items-lc",[d.CHECKOUT_COMPLETED]:"checkout-completed-lc",[d.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[d.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[d.CHECKOUT_BUYER]:"checkout-buyer-lc",[d.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[d.CHECKOUT_TIPS]:"checkout-tips-lc",[d.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[d.CHECKOUT_ITEM]:"checkout-item-lc",[d.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[d.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[d.CHECKOUT_HEADER]:"checkout-header-lc",[d.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[d.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[d.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return n[e]||e.toLowerCase()+"-lc"}}ComponentFactoryService.t=null,ComponentFactoryService.i=null,ComponentFactoryService.componentRegistry=null;class PubSubService{constructor(){this.clientReadyEvent=null,this.eventPrefix="lce",this.logger=LoggerFactory.get("PubSub"),this.setupClientReadyBuffering()}static getInstance(){return SingletonManager.getClassInstance("PubSubService",()=>new PubSubService)}publishAction(e,n){this.publishSpecific("actions."+e,n)}publishForm(e,n){this.publishSpecific("forms."+e,n)}publishSpecific(e,n){const[o,l]=e.includes(".")?e.split(".",2):["actions",e];let d=l.split("_")[0];["product","cart","address","checkout"].includes(d)||(d="other");const h=Date.now(),u={eventId:"evt_"+h+"_"+Math.random().toString(36).slice(2,9),namespace:o,event:l,originalEvent:e,actionNamespace:"actions"===o?d:void 0,timestamp:h},p={data:n,metadata:u};this.dispatchNativeEvents(e,p)}dispatchNativeEvents(e,n){const[o]=e.split(".",2);try{"actions.client_ready"===e&&(this.clientReadyEvent=n);const l=new CustomEvent(this.eventPrefix+":"+e,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(l);const d=new CustomEvent(this.eventPrefix+":"+o,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(d)}catch(l){this.logger.error("Error dispatching native events for "+e,l)}}setupClientReadyBuffering(){const e=window.addEventListener,n=this.eventPrefix+":actions.client_ready";window.addEventListener=(o,l,d)=>{if(o!==n)return e.call(window,o,l,d);if(!this.clientReadyEvent)return e.call(window,o,l,d);try{const e=new CustomEvent(n,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof l?l(e):l&&"function"==typeof l.handleEvent&&l.handleEvent(e)}catch(h){this.logger.error("Error replaying CLIENT_READY event",h)}return e.call(window,o,l,d)}}}function centToDollar(e){return e/100}function formatCentToDollarText(e,n=!![]){const o=Math.floor(e/100),l=e%100;let d="$"+o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(n||l>0)&&(d+=".",d+=l<10?"0"+l:l.toString()),d}function htmlStringToElement(e){const n=document.createElement("template");return n.innerHTML=e.trim(),n.content.firstElementChild}function format24TimeTo12(e){const n=e.match(/^(\d{1,2}):(\d{2})$/);if(!n)throw new SDKError("Invalid time format: "+e);const o=Number.parseInt(n[1],10),l=Number.parseInt(n[2],10);if(o<0||o>23||l<0||l>59)throw new SDKError("Invalid time values: "+e);const d=o>=12?"PM":"AM",h=o%12||12;return h+":"+l.toString().padStart(2,"0")+" "+d}function formatISODateToMMDDYYYY(e){if(!e)return"";try{const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const o=(n.getMonth()+1).toString().padStart(2,"0"),l=n.getDate().toString().padStart(2,"0"),d=n.getFullYear().toString();return o+"/"+l+"/"+d}catch(n){return""}}function capitalizeFirstLetter(e){return e?e.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.substring(1)).join(" "):e}function splitCategoryPath(e){const n=(null==e?void 0:e.split(" > ").map(e=>capitalizeFirstLetter(e.trim())))||[];return{category:n[0]||"",category2:n[1]||"",category3:n[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(e){this.client=e}async getAllConfigs(){try{const e=await this.client.get("/configs");return e.data}catch(e){throw this.logger.error("Error fetching configs",e),new SDKError("Failed to fetch all configs: "+(null==e?void 0:e.message))}}async setPersistedStore(e,n){try{if(!e)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!n||0===Object.keys(n).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+e,{body:n})}catch(o){this.logger.error("Error setting persisted store",o)}}async getPersistedStore(e){try{if(!e)return this.logger.error("User device ID is required to get persisted store"),null;const n=await this.client.get("/configs/store/"+e);return n.data}catch(n){return this.logger.error("Error fetching persisted store",n),null}}async deletePersistedStore(e){try{if(!e)return this.logger.error("User device ID is required to delete persisted store"),void 0;await this.client.post("/configs/store/"+e+"/delete")}catch(n){this.logger.error("Error deleting persisted store",n)}}async getAddressSuggestions(e){try{if(!e||0===e.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const n=await this.client.post("/address/autocomplete",{body:{input:e}});return n.data}catch(n){return this.logger.error("Error fetching address suggestions",n),[]}}async getAddressDetails(e){try{if(!e||0===e.trim().length)throw this.logger.error("Address ID is required to fetch address details"),new SDKError("Address ID is required to fetch address details");const n=await this.client.post("/address/details",{body:{id:e}});return n.data}catch(n){throw this.logger.error("Error fetching address details",n),new SDKError("Failed to fetch address details: "+(null==n?void 0:n.message))}}async getProductsData(e,n){try{if(0===e.length)return this.logger.error("No product identifiers provided"),null;const o={identifiers:e,location:n},l=await this.client.post("/product/availability",{body:o});return l.data}catch(o){return this.logger.error("Error fetching product data",o),null}}async catalogSearch(e){var n;try{const n=await this.client.post("/product/search",{body:e});return n.data}catch(o){return this.logger.error("Error fetching catalog search data:",null!==(n=null==o?void 0:o.message)&&void 0!==n?n:o),{products:[],retailers:{},navigation:{currentPage:1,totalPages:0,totalCount:0,filters:[]}}}}async getCartData(e){try{const n=await this.client.post("/cart/get",{body:{id:e||void 0}});return n.data}catch(n){throw this.logger.error("Error fetching cart data",n),new SDKError("Failed to fetch cart data: "+n.message)}}async updateCart(e){try{const n=await this.client.post("/cart/update",{body:e});return n.data}catch(n){throw this.logger.error("Error updating cart",n),new SDKError("Failed to update cart: "+(null==n?void 0:n.message))}}async prepareCheckout(e){var n;try{const n=await this.client.post("/checkout/prepare",{body:e});return n.data}catch(o){throw this.logger.error("Error fetching prepare checkout data:",null!==(n=null==o?void 0:o.message)&&void 0!==n?n:o),new SDKError("Failed to fetch prepare checkout data: "+(null==o?void 0:o.message))}}async getPaymentSession(e){var n;try{const n=await this.client.post("/checkout/payment/session",{body:e});return n.data}catch(o){throw this.logger.error("Error fetching payment session:",null!==(n=null==o?void 0:o.message)&&void 0!==n?n:o),new SDKError("Failed to get payment session: "+(null==o?void 0:o.message))}}async confirmPaymentSession(e,n){try{const o=await this.client.post("/checkout/payment/confirm",{body:{confirmationTokenId:e,setupIntentId:n}});return o.data}catch(o){throw this.logger.error("Error confirming payment session",o),new SDKError("Failed to confirm payment session: "+(null==o?void 0:o.message))}}async checkoutComplete(e){var n;try{const n=await this.client.post("/checkout/complete",{body:e});return n.data}catch(o){if(this.logger.error("Error completing checkout:",null!==(n=null==o?void 0:o.message)&&void 0!==n?n:o),null==o?void 0:o.error)throw new SDKError("Failed to complete checkout: "+(null==o?void 0:o.message));throw o}}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(e,n)=>e||n&&n.status>=500&&n.status<600?!![]:![],this.xhrFetch=(e,n)=>new Promise((o,l)=>{const d=new XMLHttpRequest;d.open(n.method||"GET",e);for(const[e,h]of Object.entries(n.headers))d.setRequestHeader(e,h);d.onload=()=>{const e={ok:d.status>=200&&d.status<300,status:d.status,statusText:d.statusText,headers:d.getAllResponseHeaders().split("\r\n").reduce((e,n)=>{const[o,l]=n.split(": ");return o&&l&&(e[o]=l),e},{}),o:d.responseText,json:()=>Promise.resolve(JSON.parse(d.responseText)),text:()=>Promise.resolve(d.responseText)};o(e)},d.onerror=()=>{l(new TypeError("Network request failed"))},d.ontimeout=()=>{l(new TypeError("Network request timed out"))},d.timeout=3e4,d.send(n.body)}),this.fetchImpl=this.getFetchImplementation()}async request(e){var n,o,l;const{url:d,options:h,retryConfig:u}=e,p=null!==(n=null==u?void 0:u.maxRetries)&&void 0!==n?n:3,m=null!==(o=null==u?void 0:u.retryDelay)&&void 0!==o?o:1e3,v=null!==(l=null==u?void 0:u.shouldRetry)&&void 0!==l?l:this.defaultShouldRetry;let y;const b=Date.now();for(let w=0;w<=p;w++){let e=Date.now();try{e=Date.now();const n=await this.fetchImpl(d,h),o=Date.now()-e;if(n.ok)return n;if(await this.logFailedResponse(d,h,n,o,w,p),w<p&&v(null,n)){await this.delay(m*2**w);continue}return n}catch(x){const n=Date.now()-e;if(y=x,this.logNetworkError(d,h,x,n,w,p),w<p&&v(x,void 0)){await this.delay(m*2**w);continue}throw this.enhanceError(x,d,h,Date.now()-b)}}throw this.enhanceError(y,d,h,Date.now()-b)}async logFailedResponse(e,n,o,l,d,h){const u=d<h;let p,m;try{o.o||(o.o=await o.text());try{p=JSON.parse(o.o)}catch(v){p=o.o}}catch(y){p="[Unable to read response body]"}if(n.body)try{m=JSON.parse(n.body)}catch(b){m=n.body}this.logger.error("HTTP request failed",{method:n.method,url:e,status:o.status,statusText:o.statusText,duration:l+"ms",attempt:d+1+"/"+(h+1),willRetry:u,requestHeaders:n.headers,requestBody:m,responseHeaders:o.headers,responseBody:p})}logNetworkError(e,n,o,l,d,h){var u;const p=d<h;this.logger.error("Network request failed",{method:n.method,url:e,error:(null==o?void 0:o.message)||"Unknown error",errorType:(null===(u=null==o?void 0:o.constructor)||void 0===u?void 0:u.name)||typeof o,duration:l+"ms",attempt:d+1+"/"+(h+1),willRetry:p,possibleCauses:this.diagnosePossibleCauses(o)})}diagnosePossibleCauses(e){var n,o,l,d,h;const u=[];return((null===(n=null==e?void 0:e.message)||void 0===n?void 0:n.includes("timeout"))||(null===(o=null==e?void 0:e.message)||void 0===o?void 0:o.includes("timed out")))&&u.push("Request timeout - server took too long to respond"),((null===(l=null==e?void 0:e.message)||void 0===l?void 0:l.includes("Failed to fetch"))||(null===(d=null==e?void 0:e.message)||void 0===d?void 0:d.includes("Network request failed")))&&(u.push("Network connectivity issue"),u.push("CORS policy blocking the request"),u.push("Server is not responding"),u.push("Request was blocked by browser or firewall")),(null===(h=null==e?void 0:e.message)||void 0===h?void 0:h.includes("aborted"))&&u.push("Request was aborted"),0===u.length&&u.push("Unknown network error"),u}enhanceError(e,n,o,l){const d=new Error((null==e?void 0:e.message)||"Network request failed - no response from server");return d.url=n,d.method=o.method,d.totalDuration=l+"ms",d.isNetworkError=!![],d.originalError=e,d.possibleCauses=this.diagnosePossibleCauses(e),d}delay(e){return new Promise(n=>setTimeout(n,e))}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):window.fetch?this.fetchAdapter(window.fetch):this.xhrFetch}fetchAdapter(e){return async(n,o)=>{var l;const d=await e(n,o);let h;if("function"==typeof(null===(l=d.headers)||void 0===l?void 0:l.entries))h=Object.fromEntries(d.headers.entries());else{h={};for(const[e,n]of d.headers)h[e]=n}const u={ok:d.ok,status:d.status,statusText:d.statusText,headers:h,json:async()=>(u.o||(u.o=await d.text()),JSON.parse(u.o)),text:async()=>(u.o||(u.o=await d.text()),u.o)};return u}}}class AuthClientService{constructor(e){this.accessToken=null,this.tokenExpiration=null,this.authPromise=null,this.refreshPromise=null,this.shouldRetryNonAuth=(e,n)=>e?!![]:n&&this.isAuthError(n)?![]:n&&n.status>=500&&n.status<600,this.apiKey=e.apiKey,this.baseUrl=e.baseUrl,this.env=e.env,this.httpClient=new HttpClientService,this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(e){return SingletonManager.getClassInstance("AuthService",()=>new AuthClientService(e))}async authenticateAndGetConfigs(){var e,n,o,l,d,h,u,p,m;try{this.logger.info("Authenticating and fetching configurations in single request");const v=await this.request("/auth/authenticate",{method:"GET"},!![]);return(null===(n=null===(e=null==v?void 0:v.data)||void 0===e?void 0:e.auth)||void 0===n?void 0:n.accessToken)&&(null===(l=null===(o=null==v?void 0:v.data)||void 0===o?void 0:o.auth)||void 0===l?void 0:l.expiration)?(null===(m=null==v?void 0:v.data)||void 0===m?void 0:m.configs)?(this.accessToken=v.data.auth.accessToken,this.tokenExpiration=v.data.auth.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Successfully authenticated and retrieved configurations"),{success:!![],configs:v.data.configs}):(this.logger.error("Combined auth response missing configs data",{response:null==v?void 0:v.data}),{success:![]}):(this.logger.error("Combined auth response missing required auth fields",{hasToken:!!(null===(h=null===(d=null==v?void 0:v.data)||void 0===d?void 0:d.auth)||void 0===h?void 0:h.accessToken),hasExp:!!(null===(p=null===(u=null==v?void 0:v.data)||void 0===u?void 0:u.auth)||void 0===p?void 0:p.expiration),response:null==v?void 0:v.data}),{success:![]})}catch(v){return this.logger.error("Failed to authenticate and get configs from combined endpoint",{error:(null==v?void 0:v.message)||v,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),{success:![]}}}async authenticate(){if(this.authPromise)return this.authPromise;this.authPromise=this.performAuthentication();try{return await this.authPromise}finally{this.authPromise=null}}async refreshToken(){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async get(e,n){return this.request(e,{method:"GET",headers:null==n?void 0:n.headers})}async post(e,n){return this.request(e,{method:"POST",body:null==n?void 0:n.body,headers:null==n?void 0:n.headers})}async performAuthentication(){var e,n,o,l;try{const d=await this.request("/auth",{method:"GET"},!![]);return(null===(e=null==d?void 0:d.data)||void 0===e?void 0:e.accessToken)&&(null===(n=null==d?void 0:d.data)||void 0===n?void 0:n.expiration)?(this.accessToken=d.data.accessToken,this.tokenExpiration=d.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,!![]):(this.logger.error("Authentication response missing required fields",{hasToken:!!(null===(o=null==d?void 0:d.data)||void 0===o?void 0:o.accessToken),hasExp:!!(null===(l=null==d?void 0:d.data)||void 0===l?void 0:l.expiration),response:null==d?void 0:d.data}),![])}catch(d){return this.logger.error("Failed to obtain access token from authentication endpoint",{error:(null==d?void 0:d.message)||d,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),![]}}async performTokenRefresh(){var e,n,o,l;try{this.logger.info("Attempting to refresh access token");const d=await this.request("/auth/refresh",{method:"POST"},![],!![]);return(null===(e=null==d?void 0:d.data)||void 0===e?void 0:e.accessToken)&&(null===(n=null==d?void 0:d.data)||void 0===n?void 0:n.expiration)?(this.accessToken=d.data.accessToken,this.tokenExpiration=d.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Access token refreshed successfully"),!![]):(this.logger.error("Token refresh response missing required fields",{hasToken:!!(null===(o=null==d?void 0:d.data)||void 0===o?void 0:o.accessToken),hasExp:!!(null===(l=null==d?void 0:d.data)||void 0===l?void 0:l.expiration),response:null==d?void 0:d.data}),![])}catch(d){return this.logger.warn("Failed to refresh access token, will fall back to full authentication",{error:(null==d?void 0:d.message)||d,status:null==d?void 0:d.status,endpoint:"/auth/refresh"}),![]}}async request(e,n,o=![],l=![]){if(!o&&(!this.accessToken||this.isTokenExpired())){let e=this.accessToken?await this.refreshToken():![];if(e||(this.logger.info("Token refresh failed or unavailable, attempting full authentication"),e=await this.authenticate()),!e)throw{status:401,message:"Authentication failed - unable to obtain valid access token",isAuthError:!![]}}const d=this.buildUrl(e),h=this.buildHeaders(n.headers,o),u=await this.httpClient.request({url:d,options:{method:n.method,headers:h,body:n.body?JSON.stringify(n.body):void 0},retryConfig:{maxRetries:AuthClientService.MAX_RETRIES,retryDelay:AuthClientService.RETRY_DELAY_MS,shouldRetry:this.shouldRetryNonAuth}});return u.ok?this.handleSuccessResponse(u,e,n.method):!this.isAuthError(u)||o||l?this.handleErrorResponse(u):this.handleAuthError(u,e,n)}async handleSuccessResponse(e,n,o){try{return await e.json()}catch(l){const d=await e.text().catch(()=>"Success");return this.logger.error("Response returned 2xx status but body is not valid JSON",{path:n,method:o,status:e.status,responsePreview:d.substring(0,1e3),error:null==l?void 0:l.message}),{message:d}}}async handleAuthError(e,n,o){this.logger.warn("Access token rejected with "+e.status+", attempting to obtain new token and retry request",{status:e.status,path:n,method:o.method});let l=await this.refreshToken();return l||(this.logger.info("Token refresh failed after auth error, attempting full authentication"),this.clearToken(),l=await this.authenticate()),l?this.request(n,o,![],!![]):(this.logger.error("Unable to obtain new access token after receiving auth error, request cannot be retried",{status:e.status,path:n,method:o.method}),this.handleErrorResponse(e))}async handleErrorResponse(e){let n;try{n=await e.json()}catch(o){const l=await e.text().catch(()=>"HTTP error status: "+e.status);n={message:l||"Unknown error"}}throw{...n,status:e.status,message:(null==n?void 0:n.message)||"Request failed"}}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}clearToken(){this.accessToken=null,this.tokenExpiration=null}buildUrl(e){const n=this.clientConfig.getProxyConfig();return new URL("api"+e,n?n.baseUrl:this.baseUrl).toString()}buildHeaders(e,n=![]){const o={"Content-Type":"application/json","X-Liquid-Api-Env":this.env,"X-Liquid-Api-Sdk":window.location.href,"X-Liquid-Sdk-Version":this.clientConfig.get("version")||"unknown","X-Liquid-Timestamp":Date.now().toString(),"X-Liquid-UD-ID":this.clientConfig.get("userDeviceId")||"unknown",...this.getProxyHeaders(),...e};return n?o["X-Liquid-Api-Key"]=this.apiKey:o.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(o["X-Liquid-Api-Builder"]="true"),o}getProxyHeaders(){const e=this.clientConfig.getProxyConfig();return e?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...e.headers}:{}}isAuthError(e){return 401===e.status||403===e.status}}AuthClientService.TOKEN_EXPIRATION_BUFFER_MS=6e5,AuthClientService.MAX_RETRIES=2,AuthClientService.RETRY_DELAY_MS=1e3;const D="@liquidcommerce/elements-sdk",I="LiquidCommerce Elements SDK",A="UNLICENSED",O="LiquidCommerce Team",z="2.6.4",N="https://docs.liquidcommerce.co/elements-sdk",M={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},L={url:"https://github.com/liquidcommerce/elements-sdk/issues"},B="./dist/index.esm.js",j="./umd/elements.js",q="./dist/types/index.d.ts",U="pnpm@10.0.0",G={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},H=["dist","umd","docs","README.md","LICENSE"],Y={access:"public",registry:"https://registry.npmjs.org/"},W="module",Q=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],Z={build:"rollup -c","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build:dev",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},X=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],J={"@biomejs/biome":"2.3.8","@commitlint/cli":"^20.2.0","@commitlint/config-conventional":"^20.2.0","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.2","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.10.2","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.53.3","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},$={node:">=22"},tt={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},et={name:D,description:I,license:A,author:O,version:z,homepage:N,repository:M,bugs:L,module:B,browser:j,types:q,packageManager:U,exports:G,files:H,publishConfig:Y,type:W,sideEffects:Q,scripts:Z,keywords:X,devDependencies:J,engines:$,pnpm:tt};class GoogleTagManagerService{constructor(){this.enablePartnerGTM=![],this.enableLiquidCommerceGTM=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(e=>{if("loading"!==document.readyState)return e(),void 0;document.addEventListener("DOMContentLoaded",()=>e())})}isGTMAlreadyLoaded(){return"function"==="object".gtag?!![]:Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]')).length>0}isContainerLoaded(e){const n=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return n.some(n=>{const o=n.src;return o.includes("id="+e)})}isContainerInitialized(e){return window.dataLayer&&Array.isArray(window.dataLayer)&&this.isContainerLoaded(e)?window.dataLayer.some(e=>e&&"object"==typeof e&&("gtm.start"in e||"gtm.js"===e.event)):![]}async loadGTMScript(e){try{if(this.isContainerInitialized(e))return{success:!![],usingExistingGTM:!![],message:"Container "+e+" already loaded"};if(this.isContainerLoaded(e)){const n=await this.waitForContainerInit(e,1e4);return n?{success:!![],usingExistingGTM:!![],message:"Container "+e+" initialized"}:this.checkFallbackGTM(e)}return await this.injectGTMScript(e),{success:!![],usingExistingGTM:![],message:"Container "+e+" loaded successfully"}}catch(n){return this.checkFallbackGTM(e)}}waitForContainerInit(e,n){return new Promise(o=>{let l;const d=setInterval(()=>{this.isContainerInitialized(e)&&(clearInterval(d),clearTimeout(l),o(!![]))},100);l=setTimeout(()=>{clearInterval(d),o(![])},n)})}injectGTMScript(e){return new Promise((n,o)=>{const l=document.createElement("script");l.src="https://www.googletagmanager.com/gtm.js?id="+e,l.async=!![],l.crossOrigin="anonymous";let d=![];const h=setTimeout(()=>{d||(d=!![],this.isContainerInitialized(e)?n():o(new Error("GTM script timeout")))},15e3);l.onload=()=>{d||setTimeout(()=>{d||(d=!![],clearTimeout(h),this.isContainerInitialized(e)||window.dataLayer&&Array.isArray(window.dataLayer)?n():o(new Error("GTM script loaded but failed to initialize")))},500)},l.onerror=()=>{setTimeout(()=>{d||(d=!![],clearTimeout(h),this.isContainerLoaded(e)&&this.isContainerInitialized(e)?n():o(new Error("GTM script failed to load")))},100)},document.head.appendChild(l)})}checkFallbackGTM(e){if(this.isGTMAlreadyLoaded()&&window.dataLayer&&Array.isArray(window.dataLayer)){if(this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId))return{success:!![],usingExistingGTM:!![],message:"Using partner GTM container"};const e=window.dataLayer.some(e=>e&&"object"==typeof e&&("gtm.start"in e||"gtm.js"===e.event));if(e)return{success:!![],usingExistingGTM:!![],message:"Using existing GTM container"}}return window.dataLayer&&Array.isArray(window.dataLayer)?{success:!![],usingExistingGTM:!![],message:"Using basic dataLayer for event tracking"}:{success:![],usingExistingGTM:![],message:"Failed to load container "+e+" and no fallback available"}}processEventQueue(){const e=Date.now(),n=this.eventQueue.filter(n=>e-n.timestamp<3e4);for(const l of n)try{const e={event:l.eventName,...l.eventData};window.dataLayer.push(e)}catch(o){this.logger.error("Error processing queued event "+l.methodName,o)}this.eventQueue=[],n.length>0&&this.logger.info("Processed "+n.length+" queued GTM events")}getSendToTargets(){const e=[];return this.enableLiquidCommerceGTM&&this.liquidCommerceGTMId&&this.isContainerInitialized(this.liquidCommerceGTMId)&&e.push(this.liquidCommerceGTMId),this.enablePartnerGTM&&this.partnerGTMId&&this.isContainerInitialized(this.partnerGTMId)&&e.push(this.partnerGTMId),e}async initialize(e){try{if(this.isInitialized)return Promise.resolve();if(this.isInitializing&&this.initializationPromise)return this.initializationPromise;if(0,this.clientConfigService.isBuilder())return;this.isInitializing=!![],this.initializationPromise=this.doInitialize(e),await this.initializationPromise}catch(n){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",n)}}async doInitialize(e){if(!(null==e?void 0:e.partnerName)||!(null==e?void 0:e.liquidCommerceGTMId))return;if(!e.enableLiquidCommerceGTM&&!e.enablePartnerGTM)return this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,void 0;await this.waitForDOMReady(),this.partnerName=e.partnerName,this.partnerCode=e.partnerCode,this.partnerGTMId=e.partnerGTMId,this.liquidCommerceGTMId=e.liquidCommerceGTMId,this.enablePartnerGTM=e.enablePartnerGTM,this.enableLiquidCommerceGTM=e.enableLiquidCommerceGTM,window.dataLayer||(window.dataLayer=[]),window.gtag||(window.gtag=(...e)=>window.dataLayer.push(e));const n=e.enableLiquidCommerceGTM?await this.loadGTMScript(e.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!n.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+n.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(n.message),this.processEventQueue()}executeEvent(e,n,o){try{if(this.clientConfigService.isBuilder())return;const l=this.getSendToTargets(),d={...o,...l.length>0&&{send_to:l},tenant_name:this.partnerName,tenant_code:this.partnerCode,tenant_source:et.description+" v"+et.version};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:e,eventName:n,eventData:d,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const h={event:n,...d};window.dataLayer.push(h)}catch(l){this.logger.error("GTM "+e+" error",l)}}calculateValue(e){const n=e.reduce((e,n)=>e+(n.price||0)*(n.quantity||1),0);return Number.parseFloat(n.toFixed(2))}viewItem(e){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}viewItemList(e,n,o){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:n,item_list_name:o,items:e})}selectItem(e,n,o){this.executeEvent("selectItem","select_item",{item_list_id:n,item_list_name:o,items:[e]})}addToCart(e){this.executeEvent("addToCart","add_to_cart",{currency:this.currency,value:this.calculateValue([e]),quantity:e.quantity||1,items:[e]})}viewCart(e){this.executeEvent("viewCart","view_cart",{currency:this.currency,value:this.calculateValue(e),items:e})}removeFromCart(e){this.executeEvent("removeFromCart","remove_from_cart",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}beginCheckout(e,n){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(e),coupon:n,items:e})}addShippingInfo(e,n){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(e),coupon:n,items:e})}addPaymentInfo(e,n,o){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(e),payment_type:n,coupon:o,items:e})}purchase(e){this.executeEvent("purchase","purchase",{transaction_id:e.transaction_id,value:e.value,currency:this.currency,tax:e.tax,shipping:e.shipping,coupon:e.coupon,items:e.items,subtotal:e.subtotal,total:e.total_before_discounts,discounts:e.discounts,gift_cards:e.gift_cards,net_total:e.net_total})}promoCodeAttempt(e){this.executeEvent("promoCodeAttempt","promo_code_attempt",{promo_code:e})}promoCodeApplied(e,n){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:e,discount_amount:n})}promoCodeFailed(e,n){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:e,reason:n})}giftCardAttempt(e){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:e})}giftCardApplied(e,n){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:e,applied_amount:n})}giftCardFailed(e,n){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:e,reason:n})}addressUpdated(e){this.executeEvent("addressUpdated","address_updated",{address_id:e.googlePlacesId,formatted_address:e.formattedAddress,address:e.address,coordinates:e.coordinates})}addressFailed(e){this.executeEvent("addressFailed","address_failed",{address_id:e.googlePlacesId,formatted_address:e.formattedAddress,address:e.address,address_error_message:e.error})}productNoAvailability(e){this.executeEvent("productNoAvailability","product_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}productSizeNoAvailability(e){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,size_id:e.sizeId,size_name:e.sizeName,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}productFulfillmentNoAvailability(e){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:e.productId,product_name:e.productName,product_brand:e.productBrand,product_category:e.productCategory,product_category2:e.productCategory2,product_category3:e.productCategory3,product_type:e.productType,product_subtype:e.productSubtype,product_price:e.productPrice,size_id:e.sizeId,size_name:e.sizeName,fulfillment_type:e.fulfillmentType,upc:e.upc,grouping_id:e.groupingId,address:e.address,availability_reason:e.reason})}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:e,payload:n,next:o})=>{const l=performance.now();try{const d=o(),h=performance.now()-l;return this.logger.info("🏪 Store "+e+" ✓ "+h.toFixed(3)+"ms",n),d}catch(d){const o=performance.now()-l;throw this.logger.error("🏪 Store "+e+" ✗ "+o.toFixed(3)+"ms",{payload:n,error:d}),d}},this.performanceMiddleware=({action:e,next:n})=>{const o=performance.now(),l=n(),d=performance.now()-o;return d>16&&this.logger.warn('⚠️ Slow store operation "'+e+'": '+d.toFixed(2)+"ms"),l},this.state=_,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:e,isLocalStorageAvailable:n,persistedStore:o}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+e,this.isLocalStorageAvailable=n,n?await this.loadPersistedState():o&&await this.loadFromDBPersistence(o),this.logger.info("Store service initialized successfully",{userDeviceId:e,isLocalStorageAvailable:n,hasPersistedState:null!==o,localStorageKey:this.localStorageKey})}get(e){if(!e)return{...this.state};const n=e.split(".");let o=this.state;for(const l of n){if(null==o)return;o=o[l]}return void 0!==o?Array.isArray(o)?[...o]:"object"==typeof o&&null!==o?{...o}:o:void 0}set(e,n){return this.runWithMiddleware("set",{path:e,value:n},()=>{const o=this.get(e);return this.state=this.immutableSet(this.state,e,n),this.notifyListeners(e,n,o),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(e,n){const o=this.get(e),l=n(o);return this.set(e,l)}remove(e){return this.runWithMiddleware("remove",{path:e},()=>{const n=this.get(e);if(void 0===n)return this.logger.warn('No value found at path "'+e+'" to remove.'),![];const o=e.split(".");let l=this.state;const d=o.pop();for(const h of o){if(void 0===l[h])return this.logger.warn('Path "'+e+'" does not exist in the state.'),![];l=l[h]}if(Array.isArray(l))l=l.filter((e,n)=>n!==Number.parseInt(d,10));else{if("object"!=typeof l||null===l)return this.logger.warn('Cannot remove property "'+d+'" from non-object type at path "'+e+'".'),![];{const{[d]:e,...n}=l;l=n}}return this.state=this.immutableSet(this.state,o.join("."),l),this.notifyListeners(e,void 0,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(e){return this.runWithMiddleware("batch",{updates:e},()=>{const n=[];if("function"==typeof e){const o=e(this.state);for(const[e,l]of Object.entries(o)){const o=this.get(e);n.push({path:e,oldValue:o,newValue:l,timestamp:Date.now()}),this.state=this.immutableSet(this.state,e,l)}}else for(const[o,l]of Object.entries(e)){const e=this.get(o);n.push({path:o,oldValue:e,newValue:l,timestamp:Date.now()}),this.state=this.immutableSet(this.state,o,l)}for(const{path:e,oldValue:o,newValue:l}of n)this.notifyListeners(e,l,o);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(e,n){const o=e;return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(n),()=>{var e;null===(e=this.listeners.get(o))||void 0===e?void 0:e.delete(n)}}watchMany(e,n){const o=[];let l;const d=e.map(e=>this.watch(e,(d,h)=>{o.push({path:e,value:d,oldValue:h}),clearTimeout(l),l=setTimeout(()=>{o.length>0&&(n([...o]),o.length=0)},0)}));return()=>{for(const e of d)e()}}createProductInstance(e){const n="products."+e,o=this.get(n);return o?!![]:this.set(n,w)}removeProductInstance(e){const n=this.get("products"),{[e]:o,...l}=n;return this.set("products",l)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(e,n,o){let l=0;const R=()=>{if(l>=this.middleware.length)return o();const d=this.middleware[l++];return d({action:e,payload:n,state:this.getState(),next:R})};return R()}immutableSet(e,n,o){const l=n.split(".");if(1===l.length){if(Array.isArray(e)){const n=[...e];return n[l[0]]=o,n}return{...e,[l[0]]:o}}const[d,...h]=l,u=e[d],p=Array.isArray(u)?[]:{};if(Array.isArray(e)){const n=[...e];return n[d]=this.immutableSet(u||p,h.join("."),o),n}return{...e,[d]:this.immutableSet(u||p,h.join("."),o)}}notifyListeners(e,n,o){const l=this.listeners.get(e);if(l)for(const p of l)try{p(n,o)}catch(h){this.logger.error('Error in store listener for path "'+e+'"',h)}const d=e.split(".");for(let p=d.length-1;p>0;p--){const e=d.slice(0,p).join("."),n=this.listeners.get(e);if(n){const l=this.get(e),h=d.slice(p).join("."),m=this.immutableSet(l,h,o);for(const o of n)try{o(l,m)}catch(u){this.logger.error('Error in store listener for parent path "'+e+'"',u)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var e;const n=this.get("address.id")||"",o=this.get("cart.id");if(!n&&!o)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:n,cartId:o}),void 0;try{const l=null!==(e=this.clientConfig.get("userDeviceId"))&&void 0!==e?e:"not_defined";await this.api.setPersistedStore(l,{p:n,c:o}),this.logger.info("Session data persisted to DB",{userDeviceId:l,addressId:n,cartId:o})}catch(l){this.logger.error("Failed to persist session data to DB",l)}}clearLocalStorage(){if(!this.isLocalStorageAvailable||!this.localStorageKey)return this.logger.info("localStorage not available or key not set, skipping clear"),void 0;try{localStorage.removeItem(this.localStorageKey),this.logger.info("localStorage entry completely removed",{key:this.localStorageKey})}catch(et){this.logger.error("Failed to clear localStorage entry",et)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let e="";if(this.clientConfig.debuggingDisabled()){const n=this.get("address.id")||"",o=this.get("cart.id");(n||o)&&(e=n+":"+o)}else e=this.getState();e&&localStorage.setItem(this.localStorageKey,"string"!=typeof e?JSON.stringify(e):e)}catch(e){this.logger.error("Failed to persist store state",e)}}async loadPersistedState(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{const n=localStorage.getItem(this.localStorageKey);if(!n)return;try{const e=JSON.parse(n);for(const[n,o]of Object.entries(e))this.set(n,o);return}catch(e){if(n.includes(":")){const[e,o]=n.split(":");if(void 0!==e){const n=await this.getAddressDataFromId(e);this.set("address",n)}return void 0!==o&&this.set("cart.id",o||""),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:n})}}catch(n){this.logger.error("Failed to load persisted state",n),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(e){try{if(void 0!==e.p){const n=await this.getAddressDataFromId(e.p);this.set("address",n)}void 0!==e.c&&this.set("cart.id",e.c||""),this.logger.info("Session data loaded from DB persistence",{addressId:e.p,cartId:e.c})}catch(n){this.logger.error("Failed to load session data from DB persistence",n)}}async getAddressDataFromId(e){if(!e||""===e.trim())return x;try{const n=await this.api.getAddressDetails(e);return n&&0!==Object.keys(n).length?{id:e,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:{latitude:n.coordinates.latitude,longitude:n.coordinates.longitude}}:{...x,id:e}}catch(n){return{...x,id:e}}}}const nt=[d.PRODUCT,d.PRODUCT_IMAGE_CAROUSEL,d.PRODUCT_OPTIONS,d.PRODUCT_INTERACTIONS,d.PRODUCT_DESCRIPTION,d.PRODUCT_RETAILERS,d.PRODUCT_RETAILERS_CAROUSEL,d.PRODUCT_RETAILERS_POPUP,d.PRODUCT_RETAILERS_POPUP_LIST,d.PRODUCT_PRICE,d.PRODUCT_ADD_TO_CART_SECTION,d.PRODUCT_DRAWER,d.PRODUCT_LOADING,d.ENGRAVING_FORM,d.ENGRAVING_VIEW,d.PRODUCT_LIST,d.PRODUCT_LIST_CARD,d.PRODUCT_LIST_CARD_LOADING,d.PRODUCT_LIST_FILTERS],it=[d.ADDRESS_INPUT,d.ADDRESS_DISPLAY],ot=[d.CART,d.CART_RETAILER,d.CART_ITEM,d.CART_FOOTER,d.CART_ITEM_QUANTITY_PRICE,d.CART_RETAILER_SUBTOTAL,d.CART_PROMO_CODE,d.CART_HEADER,d.CART_BODY,d.CART_FULFILLMENT,d.BUTTONS_CART_OPEN],rt=[d.CHECKOUT,d.CHECKOUT_INFORMATION,d.CHECKOUT_STRIPE_HANDLER,d.CHECKOUT_STRIPE_FORM,d.CHECKOUT_PAYMENT,d.CHECKOUT_BILLING,d.CHECKOUT_ORDER_SUMMARY,d.CHECKOUT_PROMO_CODE,d.CHECKOUT_GIFT_CARDS,d.CHECKOUT_AMOUNTS,d.CHECKOUT_ITEMS,d.CHECKOUT_COMPLETED,d.CHECKOUT_DELIVER_TO,d.CHECKOUT_DELIVER_TO_SUMMARY,d.CHECKOUT_BUYER,d.CHECKOUT_TIPS,d.CHECKOUT_PC_GC,d.CHECKOUT_ITEM,d.CHECKOUT_ITEM_QUANTITY,d.CHECKOUT_PLACE_ORDER_BUTTON,d.CHECKOUT_HEADER,d.CHECKOUT_PRESALE_COUNTDOWN,d.CHECKOUT_PRESALE_EXPIRED,d.CHECKOUT_SEND_AS_GIFT];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(e,n="swap"){if(!e||0===e.length)return;const o=[...this.defaultFontFamilies,...e],l=o.map(e=>{const n=encodeURIComponent(e.name);return"family="+n+":wght@"+e.weights.join(";")}).join("&"),d="display="+n;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+l+"&"+d,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(e,n="swap"){const o=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(e,n),o&&o.remove()}injectGoogleFontsResourceHints(){const e=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),n=document.querySelector('link[href="https://fonts.gstatic.com"][rel="preconnect"]');if(!e){const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.googleapis.com",document.head.appendChild(e)}if(!n){const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.gstatic.com",e.crossOrigin="",document.head.appendChild(e)}}injectGoogleFontsLink(){if(!this.googleFontsUrl)return;const e=document.createElement("link");e.rel="stylesheet",e.href=this.googleFontsUrl,e.setAttribute(this.fontsLinkAttribute,""),document.head.appendChild(e)}}const getProductListStyles=()=>"\n .product-list {\n width: 100%;\n display: flex;\n align-items: center;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-search__control-container {\n max-width: 500px;\n width: 100%;\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-icon:hover svg {\n cursor: pointer;\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n }\n\n /* Filters in Drawer */\n .product-list-filters-drawer-content {\n padding: 20px;\n overflow-y: auto;\n max-height: 100%;\n }\n\n .product-list-filters-drawer-content .product-list-filters-container {\n position: static;\n width: 100%;\n top: 0;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n /* Filters Container */\n .product-list-filters-container {\n width: 20%;\n height: fit-content;\n position: sticky;\n top: 24px;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 24px 24px;\n position: static;\n height: 100%;\n overflow-y: auto;\n padding-bottom: 80px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #e5e7eb);\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-personalized,\n .product-list-filters-pre-order {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .product-list-filters-personalized > *:not(:last-child),\n .product-list-filters-pre-order > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-personalized-label,\n .product-list-filters-pre-order-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-delivery-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-delivery-options-header:hover .product-list-filters-delivery-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-personalized:hover .product-list-filters-personalized-label, \n .product-list-filters-pre-order:hover .product-list-filters-pre-order-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n }\n\n .product-list-filters-delivery-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-delivery-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-delivery-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-delivery-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-delivery-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-delivery-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-delivery-option {\n display: flex;\n align-items: center;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n \n .product-list-filters-delivery-option > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-list-filters-delivery-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-delivery-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-delivery-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:focus,\n .product-list-filters-delivery-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-delivery-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-delivery-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:disabled + .product-list-filters-delivery-radio-label {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+y.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.18s ease-out;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Inputs */\n .product-list-filters-delivery-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n /* Price Range Slider */\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n /* Range Slider */\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--default-text-color, #111827);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n /* Text Inputs Container */\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n /* Checkbox Filter Header */\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-toggle-icon.collapsed {\n transform: rotate(0deg);\n }\n\n .checkbox-filter-toggle-icon.expanded {\n transform: rotate(0deg);\n }\n\n /* Checkbox Filter Content */\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n /* Search Input */\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n /* Checkbox List */\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n /* Custom Scrollbar */\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n /* Checkbox Items */\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 12px 24px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n background-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n /* No Results */\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n cursor: pointer;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Product List Card Styles */\n .product-list-card.standard {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #f3f4f6);\n border-radius: var(--card-border-radius, 0.375rem);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.fill {\n background-color: #ffffff;\n }\n\n .product-list-card.standard.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card.standard.not-available:hover {\n cursor: not-allowed;\n }\n\n .product-list-card.standard .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n padding-bottom: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .product-list-card.standard .plc__content {\n width: 100%;\n padding: 0 10px;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .product-list-card.standard .plc__content .plc__title {\n width: 100%;\n height: 4.6875rem;\n font-size: 1.125rem;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n margin-bottom: 10px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n line-height: 1.38;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n .product-list-card.standard .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__image-link:hover {\n text-decoration: none;\n }\n\n .product-list-card.standard .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .product-list-card.standard .plc__title-link .plc__title {\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n font-family: var(--paragraph-font-family, Poppins);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 1rem;\n font-weight: 600;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: auto;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n padding: 0.5rem 0.375rem;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #3b82f6);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n \n .product-list-sentinel-container > *:not(:last-child) {\n margin-top: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-sentinel-error-container > *:not(:last-child) {\n margin-top: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Responsive Styles */\n\n /* Mobile and Tablet - Below 1024px */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n /* Hide filters in main product list on mobile */\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n /* Show filters in drawer on mobile */\n .product-list-filters-drawer-wrapper .product-list-filters-container {\n display: block;\n position: static;\n width: 100%;\n padding: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n /* Mobile - 1 column (up to 639px) */\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card.standard {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n /* Small tablets - 2 columns (640px to 767px) */\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card.standard {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n /* Tablets - 3 columns (768px to 1023px) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card.standard {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n /* Desktop - Use configured columns (1024px and up) */\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card.standard {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+y.ADDRESS_SUGGESTIONS+";\n list-style: none;\n overflow-y: auto;\n padding: 4px 0;\n align-self: stretch;\n border-radius: 0 0 6px 6px;\n border-right: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n border-left: 1px solid var(--accent-color, #E4E4E7);\n background: var(--drawer-background-color, #FAFAFA);\n }\n\n .address-input-container .suggestions-list.show {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n .address-input-container .suggestions-list.hide {\n display: none;\n }\n\n .address-input-container .suggestions-list.show {\n display: block;\n }\n\n .address-input-container .suggestion-item {\n display: flex;\n padding: 6px 8px;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n text-align: left;\n }\n\n .address-input-container .suggestion-item > span {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n flex: 1 0 0;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .address-input-container .suggestion-item:hover {\n border-radius: 2px;\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--default-text-color-50, #E4E4E7);\n }\n\n .address-input-container .suggestion-item.no-suggestions {\n color: var(--warning-color, #6B7280);\n text-align: center;\n cursor: default;\n }\n\n .address-input-container .suggestion-item.no-suggestions:hover {\n background-color: transparent;\n }\n\n .address-input-container .error-message {\n display: flex;\n align-items: center;\n padding: 12px;\n border: 1px solid var(--error-color, #B91C1C);\n border-radius: var(--card-border-radius, 6px);\n color: var(--error-color, #B91C1C);\n font-size: 14px;\n position: relative;\n z-index: "+y.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: "+y.ADDRESS_ACTIONS+";\n }\n\n .address-input-container .action-buttons > button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n transition: all 0.2s ease;\n width: 50%;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .address-input-container .action-buttons > button:not(:first-child) {\n margin-left: 8px;\n }\n\n .address-input-container .action-buttons .secondary-button {\n color: var(--default-text-color, #18181B);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .action-buttons .primary-button {\n color: var(--selected-text-color, #18181B);\n background-color: var(--primary-color, #E4E4E7);\n border: 1px solid transparent;\n }\n\n .privacy-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 400;\n color: var(--default-text-color, #18181B);\n text-align: left;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .address-input-container .suggestion-item > span {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .address-display-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .address-display-container > span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .address-display-container > button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n text-align: left;\n }\n",getCartStyles=()=>"\n .cart-container {\n display: flex;\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n }\n\n .cart-container.no-header .cart-body {\n padding: 0 0 16px 0;\n }\n\n .cart-container.no-header .cart-footer {\n padding: 16px 0 0 0;\n }\n\n .cart-header {\n width: 100%;\n display: flex;\n flex-direction: column;\n position: sticky;\n top: 0;\n background-color: var(--drawer-background-color, #FFFFFF);\n z-index: "+y.CART_HEADER+";\n }\n\n .cart-header-content {\n width: 100%;\n height: 48px;\n display: flex;\n align-items: center;\n align-self: stretch;\n justify-content: space-between;\n padding: 16px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .cart-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-header-close-btn {\n font-size: 1.4rem;\n font-weight: 300;\n border: none;\n background: none;\n }\n\n .cart-header-close-btn:hover {\n cursor: pointer;\n }\n\n .cart-body {\n position: relative;\n flex: 1;\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-self: stretch;\n }\n\n .cart-body > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .empty-cart-container {\n display: flex;\n align-self: center;\n margin: auto;\n }\n\n .retailer-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .section-header-label {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n }\n\n .cart-fulfillment-subtotal {\n color: var(--default-text-color, #18181B);\n }\n\n .section-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .cart-retailer-header {\n display: flex;\n flex-direction: column;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-info {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .retailer-body-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n flex-direction: column;\n max-height: 2000px;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .retailer-subtotal-container {\n display: flex;\n padding: 16px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailer-subtotal-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-subtotal-amount {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailer-fulfillment-container {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n max-height: 2000px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .retailer-fulfillment-container > .cart-item-container {\n margin-top: 16px;\n }\n\n .cart-item-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item-container > *:not(:first-child) {\n margin-top: 12px;\n }\n\n .cart-item {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .cart-item > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .item-image {\n display: flex;\n width: 56px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .item-details {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-details > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .quantity-price {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .item-title {\n font-weight: 500;\n font-size: 0.95rem;\n word-break: break-word;\n margin: 0;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-specs {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-shipping-container {\n width: 100%;\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n }\n\n .cart-add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .item-shipping {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .item-quantity {\n display: flex;\n width: 106px;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .quantity-btn-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n background: none;\n cursor: pointer;\n }\n\n .item-quantity.outlined .quantity-btn-decrease {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .quantity-btn-decrease:disabled,\n .quantity-btn-increase:disabled,\n .quantity-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .quantity-value {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .item-quantity.outlined .quantity-value {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .item-price-container {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n align-content: center;\n flex: 1 0 0;\n flex-wrap: wrap;\n }\n\n .item-price-container > *:not(:first-child) {\n margin-left: 6px;\n }\n\n .item-price {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n }\n\n .item-price-per-unit {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .item-header {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n align-self: stretch;\n }\n\n .cart-footer {\n margin-top: auto;\n display: flex;\n min-height: 146px;\n padding: 16px;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n align-self: stretch;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n flex-shrink: 0;\n }\n\n .cart-footer > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .cart-footer-header {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n }\n\n .cart-footer-header > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .cart-footer-header .cart-footer-items-price {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n }\n\n .cart-footer-header .subtotal-text {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .subtotal-price {\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 14px;\n }\n\n .cart-footer-header .taxes-fees-info {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n max-width: 85%;\n }\n\n .promo-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n width: 100%;\n border-radius: var(--button-border-radius, 6px);\n }\n\n .promo-input.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .promo-input.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .checkout-button {\n display: flex;\n position: relative;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border: none;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #F1F5F9);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+y.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: "+y.CART_LOADING+";\n }\n\n /* Modern browsers with backdrop-filter support */\n @supports (backdrop-filter: blur(1px)) {\n .cart-loading-backdrop {\n background-color: var(--drawer-background-color-30, #E4E4E7);\n backdrop-filter: blur(1px);\n }\n }\n\n .cart-loading-spinner-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .cart-loading-spinner {\n margin-bottom: 16px;\n }\n\n .cart-spinner {\n animation: cart-spinner-rotate 2s linear infinite;\n color: var(--primary-color, #1D4ED8);\n }\n\n .cart-spinner-path {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: 0;\n stroke-linecap: round;\n animation: cart-spinner-dash 1.5s ease-in-out infinite;\n }\n\n @keyframes cart-spinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n @keyframes cart-spinner-dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n }\n\n /*PROMO CODE */\n .promo-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-self: stretch;\n flex: 1;\n }\n\n .promo-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .promo-container-wrapper {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-code-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-input-wrapper {\n flex: 1;\n }\n\n /* Style the InputComponent container */\n .promo-input-wrapper .custom-input {\n margin: 0;\n width: 100%;\n }\n\n /* Hide label in promo context since we have placeholder */\n .promo-input-wrapper .custom-input label {\n display: none;\n }\n\n /* Style the actual input inside the InputComponent */\n .promo-input-wrapper .promo-input {\n width: 100%;\n padding: 12px 16px;\n border: 1px solid #ddd;\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n box-sizing: border-box;\n }\n\n .promo-input-wrapper .promo-input:focus {\n outline: none;\n border-color: var(--primary-color, #1D4ED8);\n }\n\n .promo-input-wrapper .promo-input:disabled {\n background-color: #f8f9fa;\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n .promo-input-wrapper .promo-input.input-error {\n border-color: #dc3545; }\n\n /* Error container styling from InputComponent */\n .promo-input-wrapper .error-container {\n margin-top: 4px;\n min-height: 20px;\n }\n\n .promo-input-wrapper .error-message {\n color: #dc3545;\n font-size: 12px;\n margin: 2px 0;\n display: block;\n }\n\n /* Apply button styling */\n .apply-button {\n display: flex;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .apply-button:hover:not(:disabled) {\n opacity: 0.9;\n }\n\n .apply-button:disabled {\n cursor: not-allowed;\n opacity: 0.7;\n }\n\n /* Applied promo code display - matches the design */\n .promo-applied-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n align-items: center;\n flex: 1;\n }\n\n .promo-code-pill {\n display: flex;\n height: var(--height-h-9, 36px);\n padding: 4px 12px;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px\n }\n\n .promo-remove-btn {\n background: none;\n border: none;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.2s ease;\n text-decoration: underline;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n }\n\n .error-banner {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px) 0 0 var(--card-border-radius, 6px);\n }\n\n .error-banner > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .close-btn {\n border: none;\n font-size: 16px;\n cursor: pointer;\n color: #fff;\n border-radius: 0 var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0;\n padding: 8px 16px;\n\n background: var(--error-color, #DC2626);\n }\n\n /* Mobile responsive */\n .promo-code-pill {\n align-self: flex-start;\n }\n\n .promo-remove-btn {\n align-self: flex-end;\n padding: 4px 8px;\n }\n }\n\n /* Optional: Add loading indicator styles if needed */\n .promo-input-wrapper.loading::after {\n content: '';\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+y.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 padding-top: 24px;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-delivery-information,\n .checkout-buyer-information,\n .checkout-billing-form {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-delivery-information > *:not(:first-child),\n .checkout-buyer-information > *:not(:first-child),\n .checkout-billing-form > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-billing-form {\n margin-top: 24px;\n }\n\n .checkout-payment-form {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .checkout-payment-form > *:not(:last-child) {\n margin-bottom: 24px;\n }\n\n .delivery-header-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .delivery-title-container {\n display: flex;\n min-width: 200px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .delivery-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .section-title-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .section-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .delivery-title-container > .delivery-title,\n .section-title-container > .section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .delivery-title-container > .delivery-subtitle,\n .section-title-container > .section-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-self: stretch;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .gift-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .gift-toggle-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .gift-label-wrapper {\n display: flex;\n flex-direction: column;\n min-width: 200px;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .gift-toggle-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n z-index: "+y.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .checkout-tips-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tips-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-tip-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-distribution-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-distribution-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-tips-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list.show {\n display: flex;\n }\n\n .checkout-tip-distribution-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-fulfillment-input-wrapper {\n display: flex;\n align-items: center;\n }\n\n .checkout-tip-fulfillment-input-wrapper > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-tip-remove-button {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .checkout-tip-distribution-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-sub-header {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-tip-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-tip-config-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-config-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-tip-selection-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-selection-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-tip-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-tip-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-tip-button > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-tip-input-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-input-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-sections-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-sections-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-pc-gc-sub-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-pc-gc-sub-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-pc-gc-applied {\n display: flex;\n width: 100%;\n flex-direction: row;\n align-self: stretch;\n display: flex;\n padding: 0px 12px;\n justify-content: space-between;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-pc-gc-applied span {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .checkout-pc-gc-applied button {\n display: flex;\n height: 36px;\n padding: 8px 0px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+y.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-send-to-subtitle,\n .checkout-your-info-subtitle,\n .checkout-billing-subtitle,\n .checkout-payment-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-summary-section {\n min-width: 320px;\n max-width: 400px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-summary-section > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-disclaimer-title,\n .checkout-summary-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-disclaimer-subtitle,\n .checkout-summary-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-promo-code-container,\n .checkout-gift-cards-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-promo-code-container > *:not(:first-child),\n .checkout-gift-cards-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .input-promo-code-container,\n .input-gift-card-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n }\n\n .input-promo-code-container > *:not(:first-child),\n .input-gift-card-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .input-promo-code-container .apply-button,\n .input-gift-card-container .apply-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-self: flex-start;\n align-items: center;\n\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .input-promo-code-container .apply-button.disabled,\n .input-gift-card-container .apply-button.disabled {\n background: var(--primary-color-50, #1D4ED8);\n }\n\n .checkout-amounts-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-amounts-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-amount-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-amount-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-total {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n\n }\n\n .checkout-amount-total span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-separator {\n width: 100%;\n height: 1px;\n margin: 0px;\n background: var(--accent-color, #E4E4E7);\n }\n\n .checkout-place-order-button-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-place-order-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n font-family: var(--paragraph-font-family, Poppins);\n align-self: stretch;\n font-weight: 600;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n transition: all 0.2s ease;\n cursor: pointer;\n position: relative;\n }\n\n .checkout-place-order-button-container .alert-container, .checkout-place-order-button-container .alert-wrapper {\n margin-bottom: 24px;\n }\n\n .checkout-place-order-button.ready {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-place-order-button.ready:hover {\n filter: brightness(0.9);\n transform: translateY(-1px);\n }\n\n .checkout-place-order-button.ready:active {\n transform: translateY(0);\n }\n\n /* States when things are missing/wrong - use your opacity variants */\n .checkout-place-order-button.form-invalid,\n .checkout-place-order-button.payment-incomplete,\n .checkout-place-order-button.payment-error {\n background: var(--primary-color-70);\n color: var(--selected-text-color);\n }\n\n .checkout-place-order-button.form-invalid:hover,\n .checkout-place-order-button.payment-incomplete:hover,\n .checkout-place-order-button.payment-error:hover {\n background: var(--primary-color-70);\n }\n\n /* Processing state - keep full primary color to show confidence */\n .checkout-place-order-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .checkout-place-order-button.processing::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+y.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-align: center;\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child, .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+y.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: 600;\n line-height: 100%;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-button > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-header-button-close {\n display: flex;\n height: 36px;\n width: 36px;\n padding: 2px 4px;\n justify-content: center;\n align-items: center;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-title {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-presale-countdown-container {\n display: flex;\n min-width: 320px;\n padding: 12px 24px 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n\n &.is-scrolled {\n box-shadow: 0px 6px 10px -2px var(--primary-color-30);\n }\n\n &.time-warning {\n box-shadow: 0px 6px 10px -2px var(--error-color-30, #FDE68A);\n }\n }\n\n .checkout-presale-countdown {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: 0;\n overflow: hidden;\n }\n\n .checkout-presale-countdown.time-warning {\n background: var(--error-color-30, #FDE68A);\n border: 1px solid var(--error-color, #E4E4E7);\n }\n\n .checkout-presale-countdown.time-warning {\n background: transparent;\n border: none;\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-bar {\n background: var(--error-color-70, #FDE68A);\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-fill {\n background: var(--error-color, #EF4444);\n }\n\n .checkout-presale-text-container {\n display: flex;\n padding: 0px 0px 6px;\n justify-content: flex-end;\n align-self: stretch;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-presale-progress-bar {\n display: flex;\n height: 6px;\n align-items: center;\n align-self: stretch;\n border-radius: 40px;\n background: var(--primary-color-50, #E4E4E7);\n position: relative;\n overflow: hidden;\n }\n\n .checkout-presale-progress-fill {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n z-index: "+y.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--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: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 8px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+y.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 500;\n }\n\n .engraving-view-container .engraving-body {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-view-container .engraving-lines {\n display: flex;\n min-width: 136px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .engraving-view-container .engraving-lines .engraving-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-transform: uppercase;\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-lines .engraving-line:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-actions {\n display: flex;\n align-items: center;\n }\n\n .engraving-view-container .engraving-actions .edit-button {\n margin-left: 16px;\n }\n\n .engraving-view-container .engraving-actions button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n',getImageCarouselStyle=()=>"\n .product-image-carousel {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n max-width: 100%;\n height: auto;\n min-height: 350px;\n overflow: hidden;\n }\n\n .product-image-carousel.popup {\n max-height: 474px;\n }\n\n .product-image-carousel.carousel {\n max-height: 594px;\n }\n\n .main-image {\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n border-radius: var(--card-border-radius, 6px);\n overflow: hidden;\n flex: 1;\n background-image: var(--bg-image, none);\n background-position: center center;\n background-size: contain;\n background-repeat: no-repeat;\n }\n\n .carousel-dots {\n position: absolute;\n bottom: 16px;\n left: 50%;\n transform: translateX(-50%);\n z-index: "+y.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(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+y.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .add-to-cart-container .add-to-cart-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .add-to-cart-container .add-to-cart-button.disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .product-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-title.hide {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .main-product-price {\n display: inline-block;\n width: fit-content;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 30px;\n font-style: normal;\n font-weight: 600;\n line-height: 36px;\n }\n\n .product-presale-notice {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n text-align: left;\n }\n\n .product-description {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-description > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .product-description .title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .product-description .content {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n align-self: stretch;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .product-description .content.collapsed {\n /* Modern browsers with line-clamp support */\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n\n /* Fallback for older browsers */\n max-height: 4.5em; /* 3 lines * 1.5 line-height */\n line-height: 1.5;\n word-wrap: break-word;\n\n /* Additional fallback properties */\n text-overflow: ellipsis;\n white-space: normal;\n }\n\n /* Fallback for browsers without line-clamp support */\n @supports not (-webkit-line-clamp: 3) {\n .product-description .content.collapsed {\n display: block;\n max-height: 4.5em;\n overflow: hidden;\n position: relative;\n }\n\n .product-description .content.collapsed::after {\n content: '...';\n position: absolute;\n right: 0;\n bottom: 0;\n background: linear-gradient(to right, transparent, var(--default-background-color, white) 50%);\n padding-left: 20px;\n }\n }\n\n .product-description .collapse-button {\n border-radius: var(--button-border-radius, 6px);\n cursor: pointer;\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+y.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-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: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n 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 }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+y.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: "+y.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: "+y.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: "+y.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n .sc-main-image {\n width: 100%;\n height: 350px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n flex: 1;\n }\n\n .sc-carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background-color: #c4d1e0;\n margin-right: 10px;\n }\n\n .sc-carousel-dot:last-child {\n margin-right: 0;\n }\n\n .sc-gallery-thumbnail {\n width: 60px;\n height: 60px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-main-image::before { animation-delay: 1.5s; }\n .sc-carousel-dot::before { animation-delay: 1.6s; }\n .sc-gallery-thumbnail::before { animation-delay: 1.7s; }\n\n @media (min-width: 480px) {\n .sc-carousel-dot {\n width: 8px;\n height: 8px;\n margin-right: 8px;\n }\n }\n\n @media (min-width: 769px) {\n .sc-gallery-thumbnail {\n width: 80px;\n height: 80px;\n }\n\n .sc-main-image {\n height: 474px;\n }\n }\n\n @keyframes wave {\n 0% {\n left: -100%;\n }\n 100% {\n left: 100%;\n }\n }\n",getProductListCardLoadingStyles=()=>"\n .product-list-card-loading__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n pointer-events: none;\n background-color: transparent;\n border: none;\n border-radius: var(--card-border-radius, 0.375rem);\n overflow: hidden;\n cursor: default;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n }\n\n .slc__card .wave {\n background-color: #c4d1e0;\n position: relative;\n overflow: hidden;\n }\n\n .slc__card .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+y.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const st={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",linkTextColor:"--link-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},at={backgroundColor:"--product-background-color"},ct={backgroundColor:"--cart-background-color"},lt={backgroundColor:"--address-background-color"},dt={backgroundColor:"--checkout-background-color"},ht={global:st,product:at,cart:ct,address:lt,checkout:dt};function getCSSVariableMapping(e){return ht[e]||{}}class CssVariableProcessorService{constructor(){this.opacityLevels=[{suffix:"30",value:.3},{suffix:"50",value:.5},{suffix:"70",value:.7},{suffix:"90",value:.9}],this.logger=LoggerFactory.get("CssVariableProcessor")}extractVariablesFromTheme(e,n){const o={},l=getCSSVariableMapping(n);for(const[d,h]of Object.entries(l)){const n=this.getValueByPath(e,d);void 0!==n&&this.isCSSValue(n)&&(o[h]=n,this.isColorVariable(h,n)&&this.generateOpacityVariants(o,h,n))}return o}extractVariablesFromPartialTheme(e,n){const o={},l=getCSSVariableMapping(n);for(const[d,h]of Object.entries(l))if(this.hasValueAtPath(e,d)){const n=this.getValueByPath(e,d);void 0!==n&&this.isCSSValue(n)&&(o[h]=n,this.isColorVariable(h,n)&&this.generateOpacityVariants(o,h,n))}return o}generateCSSVariablesString(e){return Object.entries(e).map(([e,n])=>" "+e+": "+n+";").join("\n")}updateCSSVariablesInStylesheet(e,n){if(0!==Object.keys(n).length)try{const o=this.findOrCreateRule(e);for(const[e,l]of Object.entries(n))o.style.setProperty(e,String(l))}catch(o){this.logger.warn("Failed to update CSS variables")}}getValueByPath(e,n){return n.split(".").reduce((e,n)=>e&&void 0!==e[n]?e[n]:void 0,e)}hasValueAtPath(e,n){const o=n.split(".");let l=e;for(const d of o){if(null==l||!(d in l))return![];l=l[d]}return!![]}findOrCreateRule(e){const n=":host";for(const l of Array.from(e.cssRules))if(l instanceof CSSStyleRule&&l.selectorText===n)return l;const o=e.insertRule(n+" {}");return e.cssRules[o]}isCSSValue(e){if("string"==typeof e){if(""===e.trim())return![];if(/^(#[0-9a-f]{3,8}|rgb|rgba|hsl|hsla|\d+px|\d+%|\d+rem|\d+em|auto|none|inherit|initial|unset|rounded|squared)/.test(e.toLowerCase()))return!![];if(/^[a-zA-Z0-9\s\-'"]+$/.test(e))return!![];if(/^[a-z-]+$/.test(e))return!![]}return"number"==typeof e}generateOpacityVariants(e,n,o){for(const l of this.opacityLevels){const d=n+"-"+l.suffix,h=this.addOpacityToHexColor(o,l.value);h&&(e[d]=h)}}isColorVariable(e,n){if("string"!=typeof n)return![];const o=e.toLowerCase().includes("color"),l=/^#[0-9a-f]{3,8}$/i.test(n);return o&&l}addOpacityToHexColor(e,n){if(!e.startsWith("#"))return null;let o=e.slice(1);if(3===o.length&&(o=o.split("").map(e=>e+e).join("")),6!==o.length)return null;const l=Math.round(255*n),d=l.toString(16).padStart(2,"0");return"#"+o+d}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(e){return this.styleSheets.get(e)}generateSpecificStylesheet(e,n){const o=this.cssProcessor.extractVariablesFromTheme(n,e),l=this.cssProcessor.generateCSSVariablesString(o),d=this.getStylesheetStyles(e).join("\n\n"),h=0===l.length?"":":host { "+l+" }",u=("\n "+h+"\n\n "+d+"\n ").trim();this.createStylesheet(e,u)}createStylesheet(e,n){try{if(this.isCSSStyleSheetSupported()){const o=new CSSStyleSheet;o.replaceSync(n),this.styleSheets.set(e,o)}else this.styleSheets.set(e,n)}catch(et){this.styleSheets.set(e,n)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const e=new CSSStyleSheet;return e.replaceSync("/* test */"),!![]}catch(e){return![]}}updateVariablesInStylesheet(e,n,o){const l=this.styleSheets.get(e);if(l&&"string"!=typeof l){const e=this.cssProcessor.extractVariablesFromPartialTheme(n,o);this.cssProcessor.updateCSSVariablesInStylesheet(l,e)}}getStylesheetStyles(e){switch(e){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles(),getProductListStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(e){this.data=e,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme)}updateComponentGlobalConfigs(e){var n,o;const l=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),e),this.data.global.layout.showPoweredBy=l,((null===(n=e.theme)||void 0===n?void 0:n.headingFont)||(null===(o=e.theme)||void 0===o?void 0:o.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",e.theme,"global")}updateProductComponent(e){this.data.product=this.deepMerge(this.getConfigs("product"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",e.theme,"product")}updateAddressComponent(e){this.data.address=this.deepMerge(this.getConfigs("address"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",e.theme,"address")}updateCartComponent(e){this.data.cart=this.deepMerge(this.getConfigs("cart"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",e.theme,"cart")}updateCheckoutComponent(e){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",e.theme,"checkout")}getConfigs(e){return"all"===e?this.data:this.data[e]}getComponentConfig(e){return-1!==nt.indexOf(e)?this.getConfigs("product"):-1!==it.indexOf(e)?this.getConfigs("address"):-1!==ot.indexOf(e)?this.getConfigs("cart"):-1!==rt.indexOf(e)?this.getConfigs("checkout"):void 0}getStylesheet(e){const n=this.getBaseStylesheets();if(e===d.DRAWER){const e=[...n],o=this.stylesheetGenerator.getStylesheet("product"),l=this.stylesheetGenerator.getStylesheet("cart"),d=this.stylesheetGenerator.getStylesheet("checkout"),h=this.stylesheetGenerator.getStylesheet("address");return o&&e.push(o),l&&e.push(l),d&&e.push(d),h&&e.push(h),e}let o;if(it.includes(e)||e===d.ADDRESS)o="address";else if(nt.includes(e)||e===d.PRODUCT)o="product";else if(ot.includes(e)||e===d.CART)o="cart";else{if(!rt.includes(e)&&e!==d.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+e+", returning base stylesheets only."),n;o="checkout"}const l=this.stylesheetGenerator.getStylesheet(o);return l?[...n,l]:n}getBaseStylesheets(){const e=[],n=this.stylesheetGenerator.getStylesheet("global"),o=this.stylesheetGenerator.getStylesheet("ui");return n&&e.push(n),o&&e.push(o),e}deepMerge(e,n){const o={...e};for(const l in n)null!==n[l]&&void 0!==n[l]&&("object"!=typeof n[l]||Array.isArray(n[l])||"object"!=typeof e[l]||Array.isArray(e[l])?o[l]=n[l]:o[l]=this.deepMerge(e[l],n[l]));return o}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const e=this.store.get("address");if(e.address.one&&e.coordinates.longitude&&e.coordinates.latitude)return{coordinates:e.coordinates,address:e.address}}}const includeCartEvents=(e,n)=>e.filter(e=>n.includes(e.type)),excludeCartEvents=(e,n)=>e.filter(e=>!n.includes(e.type)),eventsForCart=e=>excludeCartEvents(e,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=e=>{const n=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],o=includeCartEvents(e,n);return o.length>0},includeCheckoutEvents=(e,n)=>e.filter(e=>n.includes(e.type)),eventsForCheckout=e=>includeCheckoutEvents(e,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=e=>includeCheckoutEvents(e,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=e=>includeCheckoutEvents(e,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=e=>{const n=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return e.some(e=>n.includes(e.type))},ut={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"},pt={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=e=>e.map(e=>({type:e.type,message:e.message,level:ut[e.type]||"error"})),transformCheckoutEventsRaw=e=>e.map(e=>({type:e.type,message:e.message,level:pt[e.type]||"error"})),transformEventsForCart=e=>{const n=eventsForCart(e);return transformCartEventsRaw(n)},transformEventsForCheckout=e=>{const n=eventsForCheckout(e);return transformCheckoutEventsRaw(n)},transformPromoCodeCheckoutEvents=e=>{const n=promoCodeCheckoutEvents(e);return transformCheckoutEventsRaw(n)},transformGiftCardCheckoutEvents=e=>{const n=giftCardCheckoutEvents(e);return transformCheckoutEventsRaw(n)};class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(e,n=![]){var l,d,h,u,p;const m=this.store.get("cart");for(const o of Object.keys(m.items||{}))this.store.remove("cart.items."+o);for(const o of Object.keys(m.retailers||{}))this.store.remove("cart.retailers."+o);for(const o of Object.keys(m.fulfillments||{}))this.store.remove("cart.fulfillments."+o);const v={"cart.id":e.id,"cart.error":null,"cart.subtotal":e.subtotal,"cart.events":[],"cart.promoCode":(null===(l=e.promoCode)||void 0===l?void 0:l.code)?{code:e.promoCode.code.toUpperCase(),discountAmount:e.promoCode.discountAmount||0,error:null}:null};if((null===(d=Object.values(e.items))||void 0===d?void 0:d.length)>0)for(const o of Object.values(e.items))v["cart.items."+o.id]=o;if((null===(h=Object.values(e.retailers))||void 0===h?void 0:h.length)>0)for(const o of Object.values(e.retailers))if(v["cart.retailers."+o.id]=o,(null===(u=Object.values(o.fulfillments))||void 0===u?void 0:u.length)>0)for(const e of Object.values(o.fulfillments))v["cart.fulfillments."+e.id]=e;if((null===(p=e.events)||void 0===p?void 0:p.length)>0&&(v["cart.events"]=transformEventsForCart(e.events||[])),this.store.batch(v),n){const e=this.store.get("cart"),n=this.buildCartLoadedEventData(e);this.pubSub.publishAction(o.CART_LOADED,n)}}buildCartLoadedEventData(e){var n,o;const l=this.store.get("address"),d={};for(const h of Object.keys(e.items||{})){const n=e.items[h];d[h]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,salsifyGrouping:n.salsifyGrouping,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price,quantity:n.quantity,maxQuantity:n.maxQuantity,unitPrice:n.unitPrice,mainImage:n.mainImage,attributes:n.attributes}}return{cartId:e.id,promoCodeDiscount:null!==(o=null===(n=e.promoCode)||void 0===n?void 0:n.discountAmount)&&void 0!==o?o:null,subtotal:e.subtotal,itemCount:e.itemsQuantity,items:d,retailers:e.retailers||{},location:(null==l?void 0:l.id)&&l.coordinates&&l.address?{placesId:l.id,formattedAddress:l.formattedAddress,address:l.address,coordinates:l.coordinates}:null}}async loadCart(){try{this.store.set("cart.loading",!![]);const e=this.store.get("cart"),n=await this.api.getCartData(e.id);this.syncCartFromResponse(n,!![]),n.id!==e.id&&await this.store.persist()}catch(e){const n=(null==e?void 0:e.message)||"Failed to load cart";this.store.set("cart.error",n);const l=this.store.get("cart.id");this.pubSub.publishAction(o.CART_FAILED,{cartId:l,message:n}),this.logger.error("Load cart failed",e)}finally{this.store.set("cart.loading",![])}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(e,n){const l={type:e,data:n||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:l}),e===d.CART&&this.pubSub.publishAction(o.CART_OPENED,!![]),e===d.CHECKOUT&&this.pubSub.publishAction(o.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const e=this.store.get("ui.drawer.contentConfig");(null==e?void 0:e.type)===d.CART&&this.pubSub.publishAction(o.CART_CLOSED,!![]),(null==e?void 0:e.type)===d.CHECKOUT&&this.pubSub.publishAction(o.CHECKOUT_CLOSED,!![])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(e){var n,l,d,u,p,m,v,y,b,x,w,C;try{this.store.set("checkout.loading",!![]);const k=e||this.store.get("cart.id"),S=this.store.get("cart");if(0===(null===(n=Object.values(S.items||{}))||void 0===n?void 0:n.length)&&!e)return;const _=this.themeProvider.getConfigs("checkout"),D={canEmail:_.layout.emailOptIn.checked,canSms:_.layout.smsOptIn.checked};if(!k)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const I={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.presale":null,"checkout.updating":![]},A=await this.api.prepareCheckout({cartId:k,marketingPreferences:D});if((null===(l=A.retailers)||void 0===l?void 0:l.length)>0)for(const e of A.retailers)for(const n of e.fulfillments)n.type===h.ON_DEMAND&&(I["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:e.id,retailerName:e.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal});if((null===(d=A.items)||void 0===d?void 0:d.length)>0){this.store.remove("checkout.items");for(const e of A.items){const n=A.retailers.find(n=>n.id===e.retailerId),o=n.fulfillments.find(n=>n.id===e.fulfillmentId);I["checkout.items."+e.cartItemId]=this.buildCheckoutItemStore(e,n,o)}}A.isPresaleLocked&&A.presaleExpiresAt&&(I["checkout.presale"]={isLocked:A.isPresaleLocked,expiresAt:A.presaleExpiresAt}),I["checkout.token"]=A.token,I["checkout.cartId"]=A.cartId,I["checkout.isGift"]=A.isGift,I["checkout.giftRecipientForm.data"]={firstName:((null===(p=null===(u=A.giftOptions)||void 0===u?void 0:u.recipient)||void 0===p?void 0:p.name)||"").split(" ")[0],lastName:((null===(v=null===(m=A.giftOptions)||void 0===m?void 0:m.recipient)||void 0===v?void 0:v.name)||"").split(" ")[1],email:(null===(b=null===(y=A.giftOptions)||void 0===y?void 0:y.recipient)||void 0===b?void 0:b.email)||"",phone:(null===(w=null===(x=A.giftOptions)||void 0===x?void 0:x.recipient)||void 0===w?void 0:w.phone)||"",message:(null===(C=A.giftOptions)||void 0===C?void 0:C.message)||""},I["checkout.paymentForm.billingSameAsShipping"]=A.billingSameAsShipping,I["checkout.marketingPreferences"]=A.marketingPreferences,I["checkout.giftCards"]=A.giftCards.map(e=>({code:e.code,discountAmount:e.applied})),I["checkout.promoCode"]=A.promoCode.value?{code:A.promoCode.value,discountAmount:A.promoCode.discount}:null,I["checkout.amounts"]=A.amounts,I["checkout.events"]=A.events||[],this.store.batch(I),this.pubSub.publishAction(o.CHECKOUT_LOADED,{cartId:A.cartId})}catch(k){this.store.set("checkout.error",k.message),this.pubSub.publishAction(o.CHECKOUT_FAILED,{message:k.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(e){const n=this.store.get("checkout.isGift"),l=null!=e?e:!n,d={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":l,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":d}),this.pubSub.publishAction(o.CHECKOUT_IS_GIFT_TOGGLED,{isActive:l})}async toggleBillingSameAsShipping(e){const n=this.store.get("checkout.paymentForm.billingSameAsShipping"),l=null!=e?e:!n;this.store.set("checkout.paymentForm.billingSameAsShipping",l),this.pubSub.publishAction(o.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:l})}async toggleMarketingPreferences(e,n){const l=this.store.get("checkout.marketingPreferences."+e),d=null!=n?n:!l,h=this.store.get("checkout.marketingPreferences"),u=this.dataForCheckoutPrepare({marketingPreferences:{...h,[e]:d}}),p=await this.api.prepareCheckout(u);this.store.set("checkout.marketingPreferences",p.marketingPreferences),this.pubSub.publishAction(o.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:e,isActive:d})}async getPaymentSession(){try{const e=this.store.get("cart.id"),n=await this.api.getPaymentSession({cartId:e});this.store.batch({"checkout.paymentForm.paymentSession":{key:n.key,secret:n.secret},"checkout.paymentForm.paymentMethod":null})}catch(e){throw this.store.batch({"checkout.error":e.message,"checkout.loading":![]}),e}}async confirmPaymentSession(e,n){var o,l,d,h;try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"2035"}};const u=await this.api.confirmPaymentSession(e,n);return u&&u.id&&u.card&&u.card.brand&&u.card.last4&&u.card.expMonth&&u.card.expYear?{id:u.id,card:{brand:null===(o=u.card)||void 0===o?void 0:o.brand,last4:null===(l=u.card)||void 0===l?void 0:l.last4.toString(),expMonth:null===(d=u.card)||void 0===d?void 0:d.expMonth.toString(),expYear:null===(h=u.card)||void 0===h?void 0:h.expYear.toString()}}:(this.store.set("checkout.error","Invalid payment method information received."),null)}catch(u){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(e){var n;try{this.googleTagManager.promoCodeAttempt(e);const l=this.dataForCheckoutPrepare({}),d=await this.api.prepareCheckout({...l,promoCode:e}),h=0!==d.amounts.discounts,u=null===(n=transformPromoCodeCheckoutEvents(d.events||[]))||void 0===n?void 0:n[0];if(!h){this.store.set("checkout.promoCodeError",u?u.message:'Code "'+e+'" does not exist');const n=this.store.get("checkout.cartId");return this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_FAILED,{cartId:n,error:(null==u?void 0:u.message)||'Code "'+e+'" does not exist'}),this.googleTagManager.promoCodeFailed(e,(null==u?void 0:u.message)||"not_applied"),void 0}const p=this.store.get("checkout.cartId");this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_APPLIED,{cartId:p,discountAmount:d.amounts.discounts,newTotal:d.amounts.total}),this.googleTagManager.promoCodeApplied(e,d.amounts.discounts),await this.partialLoadCheckout({response:d})}catch(l){const n=(null==l?void 0:l.message)||"Failed to apply promo code. Please try again.";this.store.set("checkout.error",n);const d=this.store.get("checkout.cartId");throw this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_FAILED,{cartId:d,error:n}),this.googleTagManager.promoCodeFailed(e,n),l}}async removePromoCode(){var e,n;try{const l=this.dataForCheckoutPrepare({}),d=(null===(n=null===(e=this.store.get("checkout"))||void 0===e?void 0:e.promoCode)||void 0===n?void 0:n.code)||"",h=await this.api.prepareCheckout({...l,promoCode:""});if(0!==h.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;const u=this.store.get("checkout.cartId");this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_REMOVED,{cartId:u,newTotal:h.amounts.total}),this.googleTagManager.promoCodeApplied(d,0),await this.partialLoadCheckout({response:h})}catch(l){const e=(null==l?void 0:l.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",e);const n=this.store.get("checkout.promoCode.code")||"",d=this.store.get("checkout.cartId");throw this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_FAILED,{cartId:d,error:e}),n&&this.googleTagManager.promoCodeFailed(n,e),l}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(et){const n=et.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",n),et}}async applyGiftCard(e){var n;const l=e.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(l);const e=this.dataForCheckoutPrepare({}),d=e.giftCards||[],h=await this.api.prepareCheckout({...e,giftCards:[...d,l]}),u=null===(n=transformGiftCardCheckoutEvents(h.events||[]))||void 0===n?void 0:n[0],p=hasAnyRetailerGiftCardRestriction(h.events||[]);if(u&&(this.store.set("checkout.giftCardError",u.message),!p))return;const m=h.giftCards.find(e=>e.code.toLowerCase()===l.toLowerCase());if(!m){this.store.set("checkout.giftCardError","Gift card could not be applied");const e=this.store.get("checkout.cartId");return this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_FAILED,{cartId:e,error:(null==u?void 0:u.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(l,(null==u?void 0:u.message)||"not_applied"),void 0}const v=this.store.get("checkout.cartId");this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_APPLIED,{cartId:v,newTotal:h.amounts.total}),this.googleTagManager.giftCardApplied(l,m.applied),await this.partialLoadCheckout({response:h})}catch(d){const e=(null==d?void 0:d.message)||"Failed to apply gift card. Please try again.";this.store.set("checkout.error",e);const n=this.store.get("checkout.cartId");throw this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_FAILED,{cartId:n,error:e}),this.googleTagManager.giftCardFailed(l,e),d}}async removeGiftCard(e){var n;const l=e.trim().toUpperCase();try{const e=this.dataForCheckoutPrepare({}),d=(null===(n=e.giftCards)||void 0===n?void 0:n.filter(e=>e.toLowerCase()!==l.toLowerCase()))||[],h=await this.api.prepareCheckout({...e,giftCards:d}),u=h.giftCards.find(e=>e.code.toLowerCase()===l.toLowerCase());if(u)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+l),void 0;const p=this.store.get("checkout.cartId");this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_REMOVED,{cartId:p,newTotal:h.amounts.total}),this.googleTagManager.giftCardApplied(l,0),await this.partialLoadCheckout({response:h})}catch(d){const e=(null==d?void 0:d.message)||"Failed to remove gift card. Please try again.";this.store.set("checkout.error",e);const n=this.store.get("checkout.cartId");throw this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_FAILED,{cartId:n,error:e}),this.googleTagManager.giftCardFailed(l,e),d}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(et){throw this.store.set("checkout.error",(null==et?void 0:et.message)||"Failed to clear gift card error. Please try again."),et}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(d.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(e,n){var l,d,h;try{this.store.set("checkout.items."+e+".updating",!![]);const u=this.store.get("checkout.cartId"),p=this.store.get("checkout.items."+e);if(!p)throw new SDKError("Item not found");const m=p.quantity,v=p.quantity+n;if(v<1)return this.removeItem(e,!![]);const y={id:p.cartItemId,fulfillmentId:p.fulfillmentId,partNumber:p.partNumber,quantity:v},b=(null===(h=null===(d=null===(l=p.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.lines)||void 0===h?void 0:h.filter(e=>""!==e.trim()))||[];b.length>0&&(y.engravingLines=b);const x=await this.api.updateCart({id:u,items:[y],location:this.getLocation()});this.pubSub.publishAction(n>0?o.CHECKOUT_ITEM_QUANTITY_INCREASE:o.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartId:u,cartItemId:p.cartItemId,quantity:v,previousQuantity:m});const w=splitCategoryPath(p.catPath),C={item_id:p.liquidId,item_name:p.name,item_brand:p.brand,item_size:p.size,item_category:w.category,item_category2:w.category2,item_category3:w.category3,quantity:Math.abs(n),price:centToDollar(p.unitPrice||0),item_image:p.mainImage,upc:p.upc,grouping_id:p.salsifyGrouping,product_id:p.liquidId};n<0?this.googleTagManager.removeFromCart(C):n>0&&this.googleTagManager.addToCart(C),await this.partialLoadCheckout({cartResponse:x})}catch(u){throw this.store.set("checkout.items."+e+".error",u.message),u}finally{this.store.set("checkout.items."+e+".updating",![])}}async removeItemEngraving(e){var n,l,d;try{const h=this.store.get("checkout.items."+e);if(!h)throw new SDKError("Item not found in checkout");if(!(null===(n=h.attributes)||void 0===n?void 0:n.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:e}),void 0;const u=(null===(d=null===(l=h.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.lines)||[],p={id:h.cartItemId,fulfillmentId:h.fulfillmentId,partNumber:h.partNumber,quantity:h.quantity,engravingLines:[]},m=this.store.get("checkout.cartId"),v=await this.api.updateCart({id:m,items:[p],location:this.getLocation()});this.pubSub.publishAction(o.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartId:m,cartItemId:h.cartItemId,engravingLines:[],previousEngravingLines:u}),await this.partialLoadCheckout({cartResponse:v})}catch(h){throw this.store.set("checkout.items."+e+".error",h.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:e,error:h.message}),h}}async removeItem(e,n){var l,d,h;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;n||this.store.set("checkout.items."+e+".updating",!![]);const u=this.store.get("checkout.cartId"),p=this.store.get("checkout.items."+e);if(!p)throw new SDKError("Item not found");const m={id:p.cartItemId,fulfillmentId:p.fulfillmentId,partNumber:p.partNumber,quantity:0},v=(null===(h=null===(d=null===(l=p.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.lines)||void 0===h?void 0:h.filter(e=>""!==e.trim()))||[];v.length>0&&(m.engravingLines=v);const y=await this.api.updateCart({id:u,items:[m],location:this.getLocation()});this.store.remove("checkout.items."+e),this.pubSub.publishAction(o.CHECKOUT_ITEM_REMOVED,{cartId:u,cartItemId:p.cartItemId}),await this.partialLoadCheckout({cartResponse:y})}catch(u){throw this.store.set("checkout.items."+e+".error",u.message),u}}async updateTips(e){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",e);const n=this.store.get("checkout.onDemandFulfillmentTipInfo"),l=Object.values(n||{}).map(n=>{const o=Math.round(n.subtotal*e/100);return{fulfillmentId:n.fulfillmentId,tip:o}}),d=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:l}));this.updateStoreFromCheckoutResponse(d),this.pubSub.publishAction(o.CHECKOUT_TIP_UPDATED,{deliveryTips:l})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to update tips. Please try again."),n}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(e,n){try{this.store.set("checkout.updating",!![]);const l=this.store.get("checkout.onDemandFulfillmentTipInfo"),d=Object.values(l||{}).map(o=>({fulfillmentId:o.fulfillmentId,tip:o.fulfillmentId===e?n:o.tip})),h=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:d}));this.updateStoreFromCheckoutResponse(h),this.pubSub.publishAction(o.CHECKOUT_TIP_UPDATED,{deliveryTips:d})}catch(l){throw this.store.set("checkout.error",(null==l?void 0:l.message)||"Failed to update fulfillment tip. Please try again."),l}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(e){try{this.store.set("checkout.updating",!![]);const n=this.store.get("checkout.onDemandFulfillmentTipInfo"),l=Object.values(n||{}).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===e?0:n.tip})),d=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:l}));this.updateStoreFromCheckoutResponse(d),this.pubSub.publishAction(o.CHECKOUT_TIP_UPDATED,{deliveryTips:l})}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",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:e,deliveryInstructions:n,customerData:l}){var d,h,u,p,m,v,y,b,x;try{this.store.set("checkout.customerForm.isSaving",!![]);const w=this.store.get("checkout.customerForm.data"),C=this.store.get("checkout.isGift"),k=this.dataForCheckoutPrepare({shippingAddressTwo:e,deliveryInstructions:n||void 0,customer:{...w,...l},isGift:C}),S=await this.api.prepareCheckout(k),_={id:(null===(d=S.customer)||void 0===d?void 0:d.id)||"",firstName:(null===(h=S.customer)||void 0===h?void 0:h.firstName)||"",lastName:(null===(u=S.customer)||void 0===u?void 0:u.lastName)||"",email:(null===(p=S.customer)||void 0===p?void 0:p.email)||"",phone:(null===(m=S.customer)||void 0===m?void 0:m.phone)||"",birthDate:(null===(y=null===(v=S.customer)||void 0===v?void 0:v.birthDate)||void 0===y?void 0:y.slice(0,10))||"",company:(null===(b=S.customer)||void 0===b?void 0:b.company)||""};this.store.batch({"checkout.customerForm.data":_,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddressTwo":S.shippingAddress.two,"checkout.deliveryInstructions":n}),this.pubSub.publishAction(o.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,!![]);const D=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(D.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],(null===(x=D.promoCode)||void 0===x?void 0:x.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:e,deliveryInstructions:n,...l}){var d,h,u,p,m,v;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const y=this.dataForCheckoutPrepare({shippingAddressTwo:e,deliveryInstructions:n||void 0,isGift:!![],giftRecipient:l}),b=await this.api.prepareCheckout(y),x={firstName:(null==l?void 0:l.firstName)||"",lastName:(null==l?void 0:l.lastName)||"",email:(null===(h=null===(d=b.giftOptions)||void 0===d?void 0:d.recipient)||void 0===h?void 0:h.email)||"",phone:(null===(p=null===(u=b.giftOptions)||void 0===u?void 0:u.recipient)||void 0===p?void 0:p.phone)||"",message:(null===(m=b.giftOptions)||void 0===m?void 0:m.message)||""};this.store.batch({"checkout.giftRecipientForm.data":x,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddressTwo":b.shippingAddress.two,"checkout.deliveryInstructions":n}),this.pubSub.publishAction(o.CHECKOUT_GIFT_INFORMATION_UPDATED,!![]);const w=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(w.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],(null===(v=w.promoCode)||void 0===v?void 0:v.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:e,paymentSession:n}){var l,d,h;try{this.store.set("checkout.paymentForm.isSaving",!![]);const u=this.store.get("checkout"),p={},m=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let v=null,y=null;if(m||n){const e=await this.confirmPaymentSession((null==n?void 0:n.confirmationTokenId)||"",(null==n?void 0:n.setupIntentId)||"");if(!e)throw new Error("Failed to confirm payment method");v=e.card,y=e.id}const b=this.dataForCheckoutPrepare({billingData:e,paymentMethodId:y||void 0}),x=await this.api.prepareCheckout(b);x.payment&&v&&(p["checkout.paymentForm.paymentMethod"]={id:x.payment,card:v}),e&&x.billingAddress&&(p["checkout.paymentForm.data"]={firstName:x.billingAddress.firstName||"",lastName:x.billingAddress.lastName||"",email:x.billingAddress.email||"",phone:x.billingAddress.phone||"",company:x.billingAddress.company||"",addressOne:x.billingAddress.one||"",addressTwo:x.billingAddress.two||"",city:x.billingAddress.city||"",state:x.billingAddress.state||"",zipCode:x.billingAddress.zip||""},this.pubSub.publishAction(o.CHECKOUT_BILLING_INFORMATION_UPDATED,!![])),p["checkout.paymentForm.isEditing"]=![],p["checkout.paymentForm.isValid"]=!![],this.store.batch(p);const w=p["checkout.paymentForm.paymentMethod"]||(null===(l=u.paymentForm)||void 0===l?void 0:l.paymentMethod),C=(null===(d=null==w?void 0:w.card)||void 0===d?void 0:d.brand)?w.card.brand+" ****"+w.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(u.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}}),C,(null===(h=u.promoCode)||void 0===h?void 0:h.code)||void 0)}catch(u){throw this.logger.error("Failed to save payment form",u),this.store.set("checkout.error",u.message),u}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var e,n,l,h,u,p;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(o.CHECKOUT_SUBMIT_STARTED,{started:!![]});const m=this.store.get("checkout"),v=await this.api.checkoutComplete({token:m.token}),y=v.legacyOrderNumber||v.referenceId||"N/A";m.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(d.CHECKOUT_COMPLETED,{orderNumber:y,orderTotal:m.amounts.total,cardLast4:null===(l=null===(n=null===(e=null==m?void 0:m.paymentForm)||void 0===e?void 0:e.paymentMethod)||void 0===n?void 0:n.card)||void 0===l?void 0:l.last4,customerEmail:m.customerForm.data.email,giftRecipientEmail:(null===(u=null===(h=null==m?void 0:m.giftRecipientForm)||void 0===h?void 0:h.data)||void 0===u?void 0:u.email)||null}),this.pubSub.publishAction(o.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:y,orderTotal:m.amounts.total}),this.googleTagManager.purchase({transaction_id:y,tax:centToDollar(m.amounts.tax||0),shipping:centToDollar(m.amounts.shipping||0),coupon:(null===(p=m.promoCode)||void 0===p?void 0:p.code)||void 0,items:[...Object.values(m.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],value:centToDollar(m.amounts.total),subtotal:centToDollar(m.amounts.subtotal),total_before_discounts:centToDollar(m.amounts.subtotal+m.amounts.tax+m.amounts.shipping+m.amounts.delivery+m.amounts.platform+m.amounts.service),discounts:centToDollar(m.amounts.discounts),gift_cards:centToDollar(m.amounts.giftCards||0),net_total:centToDollar(m.amounts.total)})}catch(m){const e=(null==m?void 0:m.message)||"Checkout complete failed";this.store.batch({"checkout.error":e}),this.pubSub.publishAction(o.CHECKOUT_SUBMIT_FAILED,{message:e})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(e){var n;const o={"checkout.amounts":e.amounts,"checkout.warning":e.warning,"checkout.events":transformEventsForCheckout(e.events||[]),"checkout.error":null};if((null===(n=e.retailers)||void 0===n?void 0:n.length)>0)for(const l of e.retailers)for(const e of l.fulfillments)e.type===h.ON_DEMAND&&(o["checkout.onDemandFulfillmentTipInfo."+e.id]={retailerId:l.id,retailerName:l.name,fulfillmentId:e.id,tip:e.tip,subtotal:e.subtotal});this.store.batch(o)}async partialLoadCheckout(e){var n,l,d,u,p;try{let o;if(this.store.set("checkout.updating",!![]),(null==e?void 0:e.cartResponse)?this.commonCommands.syncCartFromResponse(e.cartResponse):await this.commonCommands.loadCart(),null==e?void 0:e.response)o=e.response;else{const l=null!==(n=null==e?void 0:e.cartId)&&void 0!==n?n:this.store.get("checkout.cartId");if(!l)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const d=this.dataForCheckoutPrepare({});o=await this.api.prepareCheckout({...d,cartId:l})}const m={"checkout.token":o.token,"checkout.events":transformEventsForCheckout(o.events||[]),"checkout.amounts":o.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":o.giftCards.map(e=>({code:e.code,discountAmount:e.applied})),"checkout.promoCode":(null===(d=null===(l=null==o?void 0:o.promoCode)||void 0===l?void 0:l.value)||void 0===d?void 0:d.trim())?{code:o.promoCode.value,discountAmount:o.promoCode.discount}:null};if((null===(u=o.retailers)||void 0===u?void 0:u.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const e of o.retailers)for(const n of e.fulfillments)n.type===h.ON_DEMAND&&(m["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:e.id,retailerName:e.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal})}if((null===(p=o.items)||void 0===p?void 0:p.length)>0){this.store.remove("checkout.items");for(const e of o.items){const n=o.retailers.find(n=>n.id===e.retailerId),l=n.fulfillments.find(n=>n.id===e.fulfillmentId);m["checkout.items."+e.cartItemId]=this.buildCheckoutItemStore(e,n,l)}}this.store.batch(m)}catch(m){const e=(null==m?void 0:m.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",e),this.pubSub.publishAction(o.CHECKOUT_FAILED,{message:e}),m}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:e,giftRecipient:n,billingData:o,marketingPreferences:l,shippingAddressTwo:d,deliveryInstructions:h,deliveryTips:u,paymentMethodId:p,isGift:m}){var v,y,b,x,w,C,k,S,_,D,I,A,O,z,N,M,L,B,j,q,U,G,H,Y,W,Q;const Z=this.store.get("checkout"),X=null!==(y=null===(v=Z.paymentForm)||void 0===v?void 0:v.billingSameAsShipping)&&void 0!==y?y:!![],J=void 0!==m?m:Z.isGift,$=n?!![]:null!==(x=null===(b=Z.giftRecipientForm)||void 0===b?void 0:b.isValid)&&void 0!==x?x:![],tt=J&&$,et={cartId:Z.cartId,acceptedAccountCreation:![],hasSubstitutionPolicy:![],hasAgeVerify:!![],shippingAddressTwo:d,billingSameAsShipping:X,marketingPreferences:l||Z.marketingPreferences,promoCode:(null===(w=Z.promoCode)||void 0===w?void 0:w.code)||void 0,isGift:tt,giftCards:(null===(C=null==Z?void 0:Z.giftCards)||void 0===C?void 0:C.map(e=>e.code))||[],deliveryTips:u||Object.values(Z.onDemandFulfillmentTipInfo||{}).map(e=>({fulfillmentId:e.fulfillmentId,tip:e.tip}))};p?et.payment=p:(null===(S=null===(k=Z.paymentForm)||void 0===k?void 0:k.paymentMethod)||void 0===S?void 0:S.id)&&(et.payment=Z.paymentForm.paymentMethod.id);const nt=h||Z.deliveryInstructions;if(nt&&(et.deliveryInstructions=Object.values(Z.items||{}).map(e=>({fulfillmentId:e.fulfillmentId,instructions:nt}))),et.customer=e?{...e,id:(null==e?void 0:e.id)||void 0}:(null===(D=null===(_=null==Z?void 0:Z.customerForm)||void 0===_?void 0:_.data)||void 0===D?void 0:D.email)?{id:(null===(A=null===(I=Z.customerForm)||void 0===I?void 0:I.data)||void 0===A?void 0:A.id)||void 0,firstName:null===(z=null===(O=Z.customerForm)||void 0===O?void 0:O.data)||void 0===z?void 0:z.firstName,lastName:null===(M=null===(N=Z.customerForm)||void 0===N?void 0:N.data)||void 0===M?void 0:M.lastName,email:null===(B=null===(L=Z.customerForm)||void 0===L?void 0:L.data)||void 0===B?void 0:B.email,phone:null===(q=null===(j=Z.customerForm)||void 0===j?void 0:j.data)||void 0===q?void 0:q.phone,birthDate:null===(G=null===(U=Z.customerForm)||void 0===U?void 0:U.data)||void 0===G?void 0:G.birthDate,company:null===(Y=null===(H=Z.customerForm)||void 0===H?void 0:H.data)||void 0===Y?void 0:Y.company}:void 0,tt){const e=n||(null===(W=Z.giftRecipientForm)||void 0===W?void 0:W.data);e&&(et.giftOptions={recipient:{name:(e.firstName||"")+" "+(e.lastName||""),email:e.email||"",phone:e.phone||""},message:e.message||""})}if(!X)if(o)et.billingAddress={firstName:o.firstName,lastName:o.lastName,email:o.email,phone:o.phone,company:o.company,one:o.addressOne,two:o.addressTwo,city:o.city,state:o.state,zip:o.zipCode,country:"US"};else{const e=null===(Q=Z.paymentForm)||void 0===Q?void 0:Q.data;et.billingAddress={firstName:null==e?void 0:e.firstName,lastName:null==e?void 0:e.lastName,email:null==e?void 0:e.email,phone:null==e?void 0:e.phone,company:null==e?void 0:e.company,one:null==e?void 0:e.addressOne,two:null==e?void 0:e.addressTwo,city:null==e?void 0:e.city,state:null==e?void 0:e.state,zip:null==e?void 0:e.zipCode,country:"US"}}return et}buildCheckoutItemStore(e,n,o){return{liquidId:e.liquidId,variantId:e.variantId,cartItemId:e.cartItemId,retailerId:e.retailerId,fulfillmentId:e.fulfillmentId,salsifyGrouping:e.salsifyGrouping,name:e.name,catPath:e.catPath,volume:e.volume,uom:e.uom,proof:e.proof,abv:e.abv,containerType:e.containerType,container:e.container,size:e.size,pack:e.pack,packDesc:e.packDesc,mainImage:e.mainImage,brand:e.brand,partNumber:e.partNumber,upc:e.upc,sku:e.sku,price:e.price,unitPrice:e.unitPrice,quantity:e.quantity,unitTax:e.unitTax,bottleDeposits:e.bottleDeposits,attributes:e.attributes,retailerName:n.name,expectationDetail:o.expectation.detail,loading:![],updating:![],error:null}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.commonCommands=CommonCommands.getInstance(),this.store.watch("cart.shouldReset",async e=>{e===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(e,n){try{this.store.set("cart.items."+e+".updating",!![]);const l=this.store.get("cart.id"),d=this.store.get("cart.items."+e);if(!d)throw this.logger.error("Cart item not found: "+e+" - cannot update quantity by "+n),new SDKError("Item not found");const h=d.quantity+n;if(h<1)return this.removeItem(e,!![]);const u=this.buildItemUpdate(d,h),p=await this.api.updateCart({id:l,items:[u],location:this.getLocation()});this.syncItemsFromApiResponse(p,[e]),this.updateFulfillment(d.fulfillmentId,p),this.syncRetailersFromApiResponse(p),this.syncCartMetaFromApiResponse(p),this.pubSub.publishAction(n<0?o.CART_ITEM_QUANTITY_DECREASE:o.CART_ITEM_QUANTITY_INCREASE,{cartId:l,itemId:d.id,quantity:h,previousQuantity:d.quantity});const m=splitCategoryPath(d.catPath),v={item_id:d.liquidId,item_name:d.name,item_brand:d.brand,item_size:d.size,item_category:m.category,item_category2:m.category2,item_category3:m.category3,quantity:Math.abs(n),price:centToDollar(d.unitPrice||0),item_image:d.mainImage,upc:d.upc,grouping_id:d.salsifyGrouping,product_id:d.liquidId};n<0?this.googleTagManager.removeFromCart(v):n>0&&this.googleTagManager.addToCart(v)}catch(l){throw this.store.set("cart.items."+e+".error",l.message),this.logger.error("Failed to update item quantity",l),l}finally{this.store.set("cart.items."+e+".updating",![])}}async removeItem(e,n){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;n||this.store.set("cart.items."+e+".updating",!![]);const l=this.store.get("cart.id"),d=this.store.get("cart.items."+e);if(!d)throw new SDKError("Item not found");const h=this.buildItemUpdate(d,0),u=await this.api.updateCart({id:l,items:[h],location:this.getLocation()}),p={itemId:d.id,fulfillmentId:d.fulfillmentId,retailerId:d.retailerId};this.syncItemsFromApiResponse(u,[]),this.cleanupAfterItemRemoval(p,u),this.syncCartMetaFromApiResponse(u),this.pubSub.publishAction(o.CART_ITEM_REMOVED,{cartId:l,itemId:d.id});const m=splitCategoryPath(d.catPath);this.googleTagManager.removeFromCart({item_id:d.liquidId,item_name:d.name,item_brand:d.brand,item_size:d.size,item_category:m.category,item_category2:m.category2,item_category3:m.category3,quantity:d.quantity,price:centToDollar(d.unitPrice||0),item_image:d.mainImage,upc:d.upc,grouping_id:d.salsifyGrouping,product_id:d.liquidId})}catch(l){throw this.store.set("cart.items."+e+".error",l.message),this.logger.error("Failed to remove item",l),l}}async updateItemEngraving(e,n){var l,d,h;try{const u=this.store.get("cart"),p=null===(l=u.items)||void 0===l?void 0:l[e];if(!p)throw new SDKError("Item not found");this.store.set("cart.items."+e+".updating",!![]);const m=this.getDetails(),v={id:p.id,fulfillmentId:p.fulfillmentId,partNumber:p.partNumber,quantity:p.quantity,engravingLines:n},y=await this.api.updateCart({id:u.id||"",items:[v],location:this.getLocation()});this.syncItemsFromApiResponse(y,[e]),this.syncRetailersFromApiResponse(y),this.syncCartMetaFromApiResponse(y);const b=this.getDetails();this.pubSub.publishAction(o.CART_ITEM_ENGRAVING_UPDATED,{cartId:b.cartId,itemId:p.id,engravingLines:n,previousEngravingLines:(null===(h=null===(d=p.attributes)||void 0===d?void 0:d.engraving)||void 0===h?void 0:h.lines)||[]}),this.pubSub.publishAction(o.CART_UPDATED,{previous:m,current:b})}catch(u){throw this.store.set("cart.items."+e+".error",u.message),this.logger.error("Failed to update item engraving",u),u}finally{this.store.set("cart.items."+e+".updating",![])}}async addItem(e){var n,l;try{this.store.set("cart.loading",!![]);const d=this.store.get("cart"),h=this.getDetails(),u=(null===(n=e.engravingLines)||void 0===n?void 0:n.filter(e=>""!==e.trim()))||[],p=u.length>0,m=Object.values(d.items||{}).find(n=>{var o,l,d,h,m;const v=n.fulfillmentId===e.fulfillmentId&&n.partNumber===e.partNumber;if(!v)return![];if(p){const e=(null===(l=null===(o=n.attributes)||void 0===o?void 0:o.engraving)||void 0===l?void 0:l.lines)||[];return u.join(",")===e.join(",")}return!(null===(m=null===(h=null===(d=n.attributes)||void 0===d?void 0:d.engraving)||void 0===h?void 0:h.lines)||void 0===m?void 0:m.length)}),v={fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:m?e.quantity+m.quantity:e.quantity};p&&(v.engravingLines=u);const y=await this.api.updateCart({id:d.id||"",items:[v],location:this.getLocation()}),b=null===(l=Object.values(y.items))||void 0===l?void 0:l.find(e=>e.fulfillmentId===v.fulfillmentId&&e.partNumber===v.partNumber);if(!b)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(y,[]);const x=this.store.get("cart.fulfillments."+e.fulfillmentId);x?this.updateFulfillment(e.fulfillmentId,y):this.addNewFulfillmentAndRetailer(e.fulfillmentId,y),this.syncRetailersFromApiResponse(y),this.syncCartMetaFromApiResponse(y);const w=this.getDetails();this.pubSub.publishAction(o.PRODUCT_ADD_TO_CART,{...e}),this.pubSub.publishAction(o.CART_ITEM_ADDED,{cartId:w.cartId,itemId:b.id,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,engravingLines:e.engravingLines}),this.pubSub.publishAction(o.CART_UPDATED,{previous:h,current:w});const C=splitCategoryPath(b.catPath);this.googleTagManager.addToCart({item_id:b.liquidId,item_name:b.name,item_brand:b.brand,item_size:b.size,item_category:C.category,item_category2:C.category2,item_category3:C.category3,quantity:b.quantity,price:centToDollar(b.unitPrice||0),item_image:b.mainImage,upc:b.upc,grouping_id:b.salsifyGrouping,product_id:b.liquidId})}catch(d){this.store.set("cart.error",d.message),this.logger.error("Failed to add item to cart",d)}finally{this.store.set("cart.loading",![])}}async addPresaleItem(e){var n;try{const o={fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity};(null==e?void 0:e.engravingLines)&&(null===(n=null==e?void 0:e.engravingLines)||void 0===n?void 0:n.length)>0&&(o.engravingLines=e.engravingLines);const l=await this.api.updateCart({id:"",items:[o],location:this.getLocation()});await this.checkoutCommands.loadCheckout(l.id)}catch(o){throw this.store.set("cart.error",o.message),this.logger.error("Failed to add presale item to cart",o),o}}async handleGoToCheckout(){var e;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(d.CHECKOUT);const n=this.store.get("cart"),o=(null===(e=n.promoCode)||void 0===e?void 0:e.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(n.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],o)}catch(n){throw this.store.set("cart.error",n.message),this.logger.error("Failed to proceed to checkout",n),n}finally{this.store.set("cart.loading",![])}}async applyPromoCode(e){var n,l,d,h,u;if(!(null==e?void 0:e.trim()))throw new SDKError("Promo code is required");const p=e.trim().toUpperCase();try{const e=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(p);const m=await this.api.updateCart({id:e,items:[],promoCode:p,location:this.getLocation()});this.store.set("cart.subtotal",m.subtotal),this.store.set("cart.events",transformEventsForCart(m.events||[]));const v=(null===(l=null===(n=m.promoCode)||void 0===n?void 0:n.code)||void 0===l?void 0:l.toLowerCase())===p.toLowerCase();v?(this.store.set("cart.promoCode",{code:p,discountAmount:(null===(d=m.promoCode)||void 0===d?void 0:d.discountAmount)||0}),this.pubSub.publishAction(o.CART_PROMO_CODE_APPLIED,{cartId:e,discountAmount:(null===(h=m.promoCode)||void 0===h?void 0:h.discountAmount)||0,newSubtotal:m.subtotal||0}),this.googleTagManager.promoCodeApplied(p,(null===(u=m.promoCode)||void 0===u?void 0:u.discountAmount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(o.CART_PROMO_CODE_FAILED,{cartId:e,error:"Promo code does not exist"}),this.googleTagManager.promoCodeFailed(p,'Code "'+p+'" does not exist'))}catch(m){const e=(null==m?void 0:m.message)||"Failed to apply promo code. Please try again.";this.store.set("cart.error",e);const n=this.store.get("cart.id");throw this.pubSub.publishAction(o.CART_PROMO_CODE_FAILED,{cartId:n,error:e}),this.googleTagManager.promoCodeFailed(p,e),this.logger.error("Failed to apply promo code",m),m}}async removePromoCode(){try{const e=this.store.get("cart.id"),n=await this.api.updateCart({id:e,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":n.subtotal,"cart.promoCode":null}),this.pubSub.publishAction(o.CART_PROMO_CODE_REMOVED,{cartId:e,newSubtotal:n.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(e){const n=(null==e?void 0:e.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",n);const l=this.store.get("cart.promoCode"),d=this.store.get("cart.id");throw this.pubSub.publishAction(o.CART_PROMO_CODE_FAILED,{cartId:d,error:n}),(null==l?void 0:l.code)&&this.googleTagManager.promoCodeFailed(l.code,n),this.logger.error("Failed to remove promo code",e),e}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...k,rerender:!![]}),this.store.set("cart",{...C,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSub.publishAction(o.CART_RESET,!![])}getDetails(){var e;const n=this.store.get("cart"),o=this.store.get("address"),l={};for(const d in n.items||{}){const e=n.items[d];l[d]={id:e.id,variantId:e.variantId,liquidId:e.liquidId,salsifyGrouping:e.salsifyGrouping,retailerId:e.retailerId,partNumber:e.partNumber,fulfillmentId:e.fulfillmentId,upc:e.upc,sku:e.sku,catPath:e.catPath,volume:e.volume,uom:e.uom,pack:e.pack,packDesc:e.packDesc,container:e.container,containerType:e.containerType,name:e.name,brand:e.brand,size:e.size,price:e.price,quantity:e.quantity,maxQuantity:e.maxQuantity,unitPrice:e.unitPrice,mainImage:e.mainImage,attributes:e.attributes}}return{cartId:n.id||"",promoCodeDiscount:(null===(e=n.promoCode)||void 0===e?void 0:e.discountAmount)||null,subtotal:n.subtotal,itemCount:n.itemsQuantity,items:l,retailers:n.retailers||{},location:o.id?{placesId:o.id,formattedAddress:o.formattedAddress,address:o.address,coordinates:o.coordinates}:null}}buildItemUpdate(e,n){var o,l,d;const h={id:e.id,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:n},u=(null===(d=null===(l=null===(o=e.attributes)||void 0===o?void 0:o.engraving)||void 0===l?void 0:l.lines)||void 0===d?void 0:d.filter(e=>""!==e.trim()))||[];return u.length>0&&(h.engravingLines=u),h}syncItemsFromApiResponse(e,n=[]){const o=this.store.get("cart.items")||{},l=new Set(Object.keys(e.items));for(const h of Object.keys(o))l.has(h)||this.store.remove("cart.items."+h);const d={};for(const h of Object.values(e.items))0!==n.length&&!n.includes(h.id)&&o[h.id]||(d["cart.items."+h.id]=h);Object.keys(d).length>0&&this.store.batch(d)}syncCartMetaFromApiResponse(e){var n,o;const l={"cart.subtotal":e.subtotal,"cart.error":null,"cart.events":transformEventsForCart(e.events||[])},d=null===(n=null==e?void 0:e.promoCode)||void 0===n?void 0:n.code;if(d)l["cart.promoCode"]={code:d.toUpperCase(),discountAmount:(null===(o=e.promoCode)||void 0===o?void 0:o.discountAmount)||0};else{const e=this.store.get("cart.promoCode");(null==e?void 0:e.code)&&(l["cart.promoCode"]=null)}this.store.batch(l)}syncRetailersFromApiResponse(e){var n,o;const l=this.store.get("cart.retailers")||{},d=this.store.get("cart.fulfillments")||{},h=new Set(Object.keys(e.retailers)),u=new Set;for(const p of Object.values(e.retailers))if(p.fulfillments)for(const e of Object.keys(p.fulfillments))u.add(e);for(const p of Object.keys(l))h.has(p)||this.store.remove("cart.retailers."+p);for(const p of Object.keys(d))u.has(p)||this.store.remove("cart.fulfillments."+p);if((null===(n=Object.values(e.retailers))||void 0===n?void 0:n.length)>0){const n={};for(const l of Object.values(e.retailers))if(n["cart.retailers."+l.id]=l,(null===(o=Object.values(l.fulfillments))||void 0===o?void 0:o.length)>0)for(const e of Object.values(l.fulfillments))n["cart.fulfillments."+e.id]=e;this.store.batch(n)}}updateFulfillment(e,n){var o;const l=null===(o=Object.values(n.retailers))||void 0===o?void 0:o.find(n=>{var o;return null===(o=Object.keys(n.fulfillments))||void 0===o?void 0:o.some(n=>n===e)}),d=null==l?void 0:l.fulfillments[e];d&&l&&this.store.set("cart.fulfillments."+e,d)}addNewFulfillmentAndRetailer(e,n){var o;const l=null===(o=Object.values(n.retailers))||void 0===o?void 0:o.find(n=>{var o;return null===(o=Object.keys(n.fulfillments))||void 0===o?void 0:o.some(n=>n===e)}),d=null==l?void 0:l.fulfillments[e];if(d&&l){const n={["cart.fulfillments."+e]:d,["cart.retailers."+l.id]:l};this.store.batch(n)}}cleanupAfterItemRemoval(e,n){var o,l;const d=null===(o=Object.values(n.retailers))||void 0===o?void 0:o.some(n=>{var o;return null===(o=Object.keys(n.fulfillments))||void 0===o?void 0:o.some(n=>n===e.fulfillmentId)}),h=null===(l=Object.keys(n.retailers))||void 0===l?void 0:l.some(n=>n===e.retailerId);if(d){this.updateFulfillment(e.fulfillmentId,n);const o=n.retailers[e.retailerId];o&&this.store.set("cart.retailers."+e.retailerId,o)}else if(this.store.remove("cart.fulfillments."+e.fulfillmentId),h){const o=n.retailers[e.retailerId];o&&this.store.set("cart.retailers."+e.retailerId,o)}else this.store.remove("cart.retailers."+e.retailerId)}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(e,n=![]){this.store.createProductInstance(e),n&&this.store.set("products."+e+".loading",!![])}async loadMultipleProducts(e){var n;if(!Array.isArray(e)||0===e.length)return this.logger.warn("No product IDs provided for loading multiple products."),void 0;this.store.batch(e.reduce((e,n)=>(e["products."+n+".loading"]=!![],e["products."+n+".error"]=null,e),{}));const o=await this.api.getProductsData(e,this.getLocation());if(!o||!o.products||0===o.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(e.reduce((e,n)=>(e["products."+n+".loading"]=![],e["products."+n+".error"]=!![],e),{})),void 0;const l=[];for(const h of o.products){const d=Object.values(h.sizes).filter(n=>e.some(e=>e===(n.upc||n.id||h.salsifyGrouping))),u=e.find(e=>d.some(n=>e===n.upc||e===n.id)||e===h.salsifyGrouping),p=u||(null===(n=null==d?void 0:d[0])||void 0===n?void 0:n.upc);await this.loadProduct(p,{products:[h],retailers:o.retailers}),l.push(p)}const d=e.filter(e=>-1===l.indexOf(e));this.store.batch(d.reduce((e,n)=>(e["products."+n+".loading"]=![],e["products."+n+".error"]="Product data not found",e),{}))}async loadProduct(e,n=null){var l,d;try{const h=this.store.get("products."+e);h.loading||this.store.set("products."+e+".loading",!![]);let u=null;if(n&&(u=n),n||(u=await this.api.getProductsData([e],this.getLocation())),!u||!(null===(l=null==u?void 0:u.products)||void 0===l?void 0:l[0]))return this.store.set("products."+e+".error","Product data not found"),void 0;const p=this.loadProductStoreUpdate(u);if(!p)return this.store.set("products."+e+".error","Failed to process product data"),void 0;this.store.set("products."+e,{...p,identifier:e}),this.pubSub.publishAction(o.PRODUCT_LOADED,this.productDataForEventFromStore(e));const m=u.products[0],v=p.sizes[p.selectedSizeId||""],y=Boolean(this.getLocation()),b=p.selectedFulfillment,x=y&&(null==b?void 0:b.variant.price)?b.variant.price:p.noAvailabilityPrice,w=splitCategoryPath(m.catPath);this.googleTagManager.viewItem({item_id:null==v?void 0:v.id,item_name:m.name,item_brand:m.brand,item_size:null==v?void 0:v.size,item_category:w.category,item_category2:w.category2,item_category3:w.category3,price:centToDollar(x),item_type:m.type,item_subtype:m.subType,item_image:(null==v?void 0:v.image)||(null===(d=m.images)||void 0===d?void 0:d[0]),upc:null==v?void 0:v.upc,grouping_id:m.salsifyGrouping,product_id:null==v?void 0:v.id})}catch(h){this.store.set("products."+e+".error",h.message),this.logger.error("Failed to load product data for ID "+e,h)}finally{this.store.set("products."+e+".loading",![])}}async selectSize(e,n){var l,d,u;const p=this.store.get("products."+e);let m=p.selectedFulfillmentType;const v=p.sizes[n];let y=null,b=null;if(m!==h.SHIPPING||Object.values(v.shippingFulfillments).length)if(m!==h.ON_DEMAND||Object.values(v.onDemandFulfillments).length){const e=m===h.SHIPPING?v.shippingFulfillments:v.onDemandFulfillments,n=Object.values(e);y=n[0]||null,b=(null==y?void 0:y.id)||null}else{m=h.SHIPPING;const e=Object.values(v.shippingFulfillments);y=e[0]||null,b=(null==y?void 0:y.id)||null}else{m=h.ON_DEMAND;const e=Object.values(v.onDemandFulfillments);y=e[0]||null,b=(null==y?void 0:y.id)||null}const x=m===h.SHIPPING?v.shippingFulfillments:v.onDemandFulfillments,w=splitCategoryPath(p.catPath);this.googleTagManager.viewItem({item_id:null==v?void 0:v.id,item_name:p.name,item_brand:p.brand,item_size:null==v?void 0:v.size,item_category:w.category,item_category2:w.category2,item_category3:w.category3,price:centToDollar((null==y?void 0:y.variant.price)||p.noAvailabilityPrice),item_type:p.type,item_subtype:p.subType,item_image:(null==v?void 0:v.image)||(null===(l=p.images)||void 0===l?void 0:l[0]),upc:null==v?void 0:v.upc,grouping_id:p.salsifyGrouping,product_id:null==v?void 0:v.id});const C=Object.keys(v.shippingFulfillments).length>0,k=Object.keys(v.onDemandFulfillments).length>0;C||k||this.googleTagManager.productSizeNoAvailability({productId:null==v?void 0:v.id,productName:p.name,productBrand:p.brand,productCategory:w.category,productCategory2:w.category2,productCategory3:w.category3,productType:p.type,productSubtype:p.subType,productPrice:p.noAvailabilityPrice,sizeId:n,sizeName:null==v?void 0:v.size,upc:null==v?void 0:v.upc,groupingId:p.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(o.PRODUCT_SIZE_CHANGED,{identifier:e,selectedSizeId:n,selectedSize:(null===(d=p.sizes[n])||void 0===d?void 0:d.size)||"",previousSizeId:p.selectedSizeId||"",previousSize:(null===(u=p.sizes[p.selectedSizeId])||void 0===u?void 0:u.size)||""}),this.store.batch({["products."+e+".selectedSizeId"]:n,["products."+e+".productHasAvailability"]:Object.keys(v.shippingFulfillments).length+Object.keys(v.onDemandFulfillments).length>0,["products."+e+".fulfillmentHasAvailability"]:Boolean(Object.keys(x).length),["products."+e+".selectedFulfillmentType"]:m,["products."+e+".selectedFulfillment"]:y,["products."+e+".selectedFulfillmentId"]:b})}async selectFulfillment(e,n){var l;const d=this.store.get("products."+e),u=d.sizes[d.selectedSizeId],p=d.selectedFulfillmentType===h.SHIPPING?u.shippingFulfillments:u.onDemandFulfillments,m=p[n];this.pubSub.publishAction(o.PRODUCT_FULFILLMENT_CHANGED,{identifier:e,selectedFulfillmentId:n,selectedFulfillmentType:d.selectedFulfillmentType,previousFulfillmentId:d.selectedFulfillmentId||"",previousFulfillmentType:d.selectedFulfillmentType});const v=splitCategoryPath(d.catPath);this.googleTagManager.viewItem({item_id:null==u?void 0:u.id,item_name:d.name,item_brand:d.brand,item_size:null==u?void 0:u.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar((null==m?void 0:m.variant.price)||d.noAvailabilityPrice),item_type:d.type,item_subtype:d.subType,item_image:(null==u?void 0:u.image)||(null===(l=d.images)||void 0===l?void 0:l[0]),upc:null==u?void 0:u.upc,grouping_id:d.salsifyGrouping,product_id:null==u?void 0:u.id}),this.store.batch({["products."+e+".selectedFulfillment"]:m,["products."+e+".selectedFulfillmentId"]:n,["products."+e+".quantity"]:1})}async updateQuantity(e,n){var l;const d=this.store.get("products."+e),h=d.quantity,u=h+n,p=1,m=(null===(l=null==d?void 0:d.selectedFulfillment)||void 0===l?void 0:l.variant.stock)||5,v=Math.max(p,Math.min(m,u));this.pubSub.publishAction(n<0?o.PRODUCT_QUANTITY_DECREASE:o.PRODUCT_QUANTITY_INCREASE,{identifier:e,quantity:v,previousQuantity:h}),this.store.set("products."+e+".quantity",v)}async changeFulfillmentType(e,n){var l,d;const u=this.store.get("products."+e),p=u.sizes[u.selectedSizeId],m=n===h.SHIPPING?p.shippingFulfillments:p.onDemandFulfillments,v=Object.values(m);if(0===v.length){const e=splitCategoryPath(u.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==p?void 0:p.id,productName:u.name,productBrand:u.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:u.type,productSubtype:u.subType,productPrice:u.noAvailabilityPrice,sizeId:null!==(l=u.selectedSizeId)&&void 0!==l?l:void 0,sizeName:null==p?void 0:p.size,fulfillmentType:n,upc:null==p?void 0:p.upc,groupingId:u.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+n+" fulfillments available for selected size"}),void 0}const y=v[0]||null,b=(null==y?void 0:y.id)||null;this.pubSub.publishAction(o.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:e,selectedFulfillmentType:n,selectedFulfillmentId:b,previousFulfillmentType:u.selectedFulfillmentType,previousFulfillmentId:u.selectedFulfillmentId,fulfillmentHasAvailability:v.length>0});const x=splitCategoryPath(u.catPath);this.googleTagManager.viewItem({item_id:null==p?void 0:p.id,item_name:u.name,item_brand:u.brand,item_size:null==p?void 0:p.size,item_category:x.category,item_category2:x.category2,item_category3:x.category3,price:centToDollar((null==y?void 0:y.variant.price)||u.noAvailabilityPrice),item_type:u.type,item_subtype:u.subType,item_image:(null==p?void 0:p.image)||(null===(d=u.images)||void 0===d?void 0:d[0]),upc:null==p?void 0:p.upc,grouping_id:u.salsifyGrouping,product_id:null==p?void 0:p.id}),this.store.batch({["products."+e+".selectedFulfillmentType"]:n,["products."+e+".selectedFulfillment"]:y,["products."+e+".selectedFulfillmentId"]:b,["products."+e+".fulfillmentHasAvailability"]:v.length>0})}async removeProduct(e){this.store.removeProductInstance(e)}async openProductDrawer(e,n,o){const l={type:n,data:o||{}};this.store.batch({["products."+e+".drawer.isOpen"]:!![],["products."+e+".drawer.contentConfig"]:l})}async closeProductDrawer(e){this.store.set("products."+e+".drawer.isOpen",![])}async rerenderAllProducts(){const e=this.store.getProductInstances(),n=Object.keys(e);for(const o of n)this.store.set("products."+o+".rerender",!![])}async addToCart(e,n){try{this.store.set("products."+e+".updating",!![]),this.uiCommands.openDrawer(d.CART),await this.cartCommands.addItem(n),this.store.batch({["products."+e+".quantity"]:1,["products."+e+".updating"]:![]});const o=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(o.items||{}).map(e=>{const n=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})])}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+e+".updating",![])}}async addPresaleToCart(e,n){try{this.store.set("products."+e+".updating",!![]),await this.cartCommands.addPresaleItem(n),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(d.CHECKOUT),this.store.batch({["products."+e+".quantity"]:1,["products."+e+".updating"]:![]})}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+e+".updating",![])}}productDataForEventFromStore(e){const n=this.store.get("products."+e);if(!n)throw new Error('Product store not found for identifier "'+e+'"');const fulfillmentEventData=e=>e?Object.entries(e).reduce((e,[n,o])=>(e[n]={...o},e),{}):{},o=Object.entries(n.sizes||{}).reduce((e,[n,o])=>{const{loading:l,error:d,shippingFulfillments:h,onDemandFulfillments:u,...p}=o;return e[n]={...p,shippingFulfillments:fulfillmentEventData(h),onDemandFulfillments:fulfillmentEventData(u)},e},{});return{identifier:e,selectedSizeId:n.selectedSizeId||null,selectedFulfillmentType:n.selectedFulfillmentType,selectedFulfillmentId:n.selectedFulfillmentId||null,productHasAvailability:Boolean(n.productHasAvailability),fulfillmentHasAvailability:Boolean(n.fulfillmentHasAvailability),id:n.id,name:n.name,brand:n.brand,catPath:n.catPath,category:n.category,classification:n.classification,type:n.type,subType:n.subType,salsifyGrouping:n.salsifyGrouping,description:n.description,htmlDescription:n.htmlDescription,tastingNotes:n.tastingNotes,images:n.images||[],region:n.region,country:n.country,material:n.material,abv:n.abv,proof:n.proof,age:n.age,color:n.color,flavor:n.flavor,variety:n.variety,appellation:n.appellation,vintage:n.vintage,noAvailabilityPrice:n.noAvailabilityPrice,sizes:o}}findFirstAvailableSize(e){const n=Object.values(e);for(const o of n){const e=o.shippingFulfillments||{},n=o.onDemandFulfillments||{},l=Object.values(e).length,d=Object.values(n).length;if(l+d>0)return o.id}return null}loadProductStoreUpdate({products:[e,...n],retailers:o}){var l,d,u,p,m;try{const n=this.themeProvider.getConfigs("product"),v={id:e.id,brand:e.brand,category:e.category,catPath:e.catPath,classification:e.classification,type:e.type,subType:e.subType,salsifyGrouping:e.salsifyGrouping,name:e.name,description:e.description,htmlDescription:e.htmlDescription,images:e.images,region:e.region,country:e.country,material:e.material,abv:e.abv,proof:e.proof,age:e.age,color:e.color,flavor:e.flavor,variety:e.variety,appellation:e.appellation,vintage:e.vintage,tastingNotes:e.tastingNotes,noAvailabilityPrice:e.noAvailabilityPrice,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:n.layout.enableShippingFulfillment?h.SHIPPING:h.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(e.sizes&&Object.values(e.sizes).length>0)for(const{shippingVariants:l,onDemandVariants:d,...h}of Object.values(e.sizes)){v.sizes[h.id]={...h,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const e of Object.values(l)){const n=o[e.retailerId];(null==n?void 0:n.shippingFulfillment)&&(v.sizes[h.id].shippingFulfillments[n.shippingFulfillment.id]={...n.shippingFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:e})}for(const e of Object.values(d)){const n=o[e.retailerId];(null==n?void 0:n.onDemandFulfillment)&&(v.sizes[h.id].onDemandFulfillments[n.onDemandFulfillment.id]={...n.onDemandFulfillment,retailerName:n.name,retailerAddress:n.address,retailerAddressFormatted:n.addressFormatted,variant:e})}}const y=Object.values(v.sizes),b=this.findFirstAvailableSize(v.sizes);v.selectedSizeId=b||(null===(l=y[0])||void 0===l?void 0:l.id)||"";const x=(null===(d=v.sizes[v.selectedSizeId])||void 0===d?void 0:d.shippingFulfillments)||{},w=(null===(u=v.sizes[v.selectedSizeId])||void 0===u?void 0:u.onDemandFulfillments)||{};v.productHasAvailability=Object.values(x).length+Object.values(w).length>0;const C=v.selectedFulfillmentType===h.SHIPPING?Object.values(x):Object.values(w);if(v.fulfillmentHasAvailability=C.length>0,v.selectedFulfillment=C[0]||null,v.selectedFulfillmentId=(null===(p=v.selectedFulfillment)||void 0===p?void 0:p.id)||null,!v.fulfillmentHasAvailability){const e=v.selectedFulfillmentType===h.SHIPPING?h.ON_DEMAND:h.SHIPPING,n=e===h.SHIPPING?Object.values(x):Object.values(w);n.length>0&&(v.selectedFulfillmentType=e,v.selectedFulfillment=n[0],v.selectedFulfillmentId=(null===(m=v.selectedFulfillment)||void 0===m?void 0:m.id)||null,v.fulfillmentHasAvailability=!![])}if(!v.productHasAvailability){const n=splitCategoryPath(e.catPath),o=v.sizes[v.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==o?void 0:o.id,productName:e.name,productBrand:e.brand,productCategory:n.category,productCategory2:n.category2,productCategory3:n.category3,productType:e.type,productSubtype:e.subType,productPrice:e.noAvailabilityPrice,upc:null==o?void 0:o.upc,groupingId:e.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for any size"})}return v}catch(v){throw this.logger.error("Product data processing error",v),v}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(e){return!e||e.length<3?[]:await this.api.getAddressSuggestions(e)}async getAddressDetails(e){return await this.api.getAddressDetails(e)}async setSelectedAddress(e){try{this.store.batch({"address.id":e.id,"address.formattedAddress":e.formattedAddress,"address.address":e.address,"address.coordinates":e.coordinates});const n=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(n)),await this.cartCommands.resetCart(),await this.store.persist()}catch(n){throw this.googleTagManager.addressFailed({googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country||""},error:(null==n?void 0:n.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(o.ADDRESS_FAILED,{googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates,error:(null==n?void 0:n.message)||"Failed to update downstream state after address change"}),n}this.googleTagManager.addressUpdated({googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country},coordinates:e.coordinates}),this.pubSub.publishAction(o.ADDRESS_UPDATED,{googlePlacesId:e.id,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country},coordinates:e.coordinates,formattedAddress:e.formattedAddress})}async setAddressManually(e,n){try{const o=this.buildFormattedAddressString(e),l={id:"",formattedAddress:o,address:e,coordinates:n};await this.setSelectedAddress(l)}catch(l){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(e),address:{one:e.one,two:e.two,city:e.city,state:e.state,zip:e.zip,country:e.country},error:(null==l?void 0:l.message)||"Failed to set manual address"}),this.pubSub.publishAction(o.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(e),address:e,coordinates:n,error:(null==l?void 0:l.message)||"Failed to set manual address"}),l}}async clearSelectedAddress(){this.store.set("address",x),this.pubSub.publishAction(o.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const e=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(e),this.store.clearLocalStorage()}getDetails(){const e=this.store.get("address");return e.id?{id:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates}:null}buildFormattedAddressString(e){var n,o,l,d,h,u;const p=[],m=[];(null===(n=e.one)||void 0===n?void 0:n.trim())&&m.push(e.one.trim()),(null===(o=e.two)||void 0===o?void 0:o.trim())&&m.push(e.two.trim()),m.length>0&&p.push(m.join(" ")),(null===(l=e.city)||void 0===l?void 0:l.trim())&&p.push(e.city.trim());const v=[];return(null===(d=e.state)||void 0===d?void 0:d.trim())&&v.push(e.state.trim()),(null===(h=e.zip)||void 0===h?void 0:h.trim())&&v.push(e.zip.trim()),v.length>0&&p.push(v.join(" ")),(null===(u=e.country)||void 0===u?void 0:u.trim())&&p.push(e.country.trim()),p.join(", ")}}class ProductListCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}async getProductList(e){e.location=this.getLocation();const n=await this.api.catalogSearch(e);return n.products&&n.products.length>0&&this.trackViewItemList(n.products),n}async addToCart(e){try{this.uiCommands.openDrawer(d.CART),await this.cartCommands.addItem(e)}catch(n){throw this.logger.error("Error adding product to cart from product list",n),n}}async addPresaleToCart(e){try{await this.cartCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(d.CHECKOUT)}catch(n){throw this.logger.error("Error adding presale product to cart from product list",n),n}}trackViewItemList(e){if(0!==e.length)try{const n=e.map((e,n)=>({...this.convertProductToBaseItem(e),index:n+1}));this.googleTagManager.viewItemList(n,"product_list","Product List")}catch(n){this.logger.error("Error tracking view_item_list event",n)}}trackSelectItem(e){try{const n=this.convertProductToBaseItem(e);this.googleTagManager.selectItem(n,"product_list","Product List")}catch(n){this.logger.error("Error tracking select_item event",n)}}convertProductToBaseItem(e){var n,o;const l=null===(n=e.sizes)||void 0===n?void 0:n[0],d=null==l?void 0:l.shippingVariants[Object.keys(l.shippingVariants)[0]],h=splitCategoryPath(e.catPath);return{item_id:null==l?void 0:l.id,item_name:e.name,item_brand:e.brand,item_size:null==l?void 0:l.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,price:(null==d?void 0:d.price)?centToDollar(d.price):e.noAvailabilityPrice?centToDollar(e.noAvailabilityPrice):void 0,item_type:e.type,item_subtype:e.subType,item_image:(null==l?void 0:l.image)||(null===(o=e.images)||void 0===o?void 0:o[0]),upc:null==l?void 0:l.upc,grouping_id:e.salsifyGrouping,product_id:null==l?void 0:l.id,item_list_id:"product_list",item_list_name:"Product List"}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}const mt="lce-checkout-stripe-slot",ft={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},gt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},vt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};class ClientActionService{constructor(){this.allowedCustomerFields=new Set(Object.values(ft)),this.allowedBillingFields=new Set(Object.values(vt)),this.allowedGiftFields=new Set(Object.values(gt)),this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:e=>{if(!e||""===e.trim())throw new SDKError("A valid product identifier is required to retrieve product details.",!![]);try{return this.command.product.productDataForEventFromStore(e)}catch(n){throw this.logger.error('Unable to retrieve product details for identifier "'+e+'"',n),new SDKError('Product "'+e+'" has not been loaded yet.',!![])}}},this.addressActions={setAddressByPlacesId:async e=>{try{if(!e||""===e.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const n=await this.command.address.getAddressDetails(e);await this.command.address.setSelectedAddress({id:e,address:n.address,coordinates:n.coordinates,formattedAddress:n.formattedAddress})}catch(n){throw this.logger.error("Error setting address by placesId:",n),n}},setAddressManually:async(e,n)=>{try{if(!e||!n)throw new SDKError("Both address and coordinates are required.",!![]);if(!(e.one&&e.city&&e.state&&e.zip))throw new SDKError("Address must include street, city, state, and zip code.",!![]);if("number"!=typeof n.latitude||"number"!=typeof n.longitude)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof n.latitude+", long: "+typeof n.longitude,!![]);if(n.latitude<-90||n.latitude>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+n.latitude,!![]);if(n.longitude<-180||n.longitude>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+n.longitude,!![]);await this.command.address.setAddressManually(e,n)}catch(o){throw this.logger.error("Error setting manual address:",o),o}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(d.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(d.CART)},addProduct:async(e,n)=>{var l,u;try{if(!e||0===e.length)return this.logger.warn("No products provided to add to cart"),void 0;for(const n of e){if(!n.identifier||"string"!=typeof n.identifier)throw new SDKError("Product identifier is required and must be a string",!![]);if(n.fulfillmentType||(n.fulfillmentType=h.SHIPPING),n.quantity&&"number"==typeof n.quantity||(n.quantity=1),n.fulfillmentType!==h.SHIPPING&&n.fulfillmentType!==h.ON_DEMAND)throw new SDKError('Invalid fulfillment type "'+n.fulfillmentType+'" for product "'+n.identifier+'". Must be either "shipping" or "onDemand"',!![]);if(n.quantity<1)throw new SDKError('Quantity must be a number greater than 0 for product "'+n.identifier+'"',!![])}const p=this.getLocation();if(void 0===p)return this.pendingCartParams=e,this.pendingCartOpenFlag=null!=n?n:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(d.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;n===!![]&&this.command.ui.openDrawer(d.CART);const m=[...new Set(e.map(e=>e.identifier))],v=await this.api.getProductsData(m,p);if(!v||!v.products||0===v.products.length){this.logger.warn("No product data found for the provided identifiers");const e=this.store.get("cart.id");return this.pubSub.publishAction(o.CART_PRODUCT_ADD_FAILED,{cartId:e,identifiers:[],error:"No products provided"}),void 0}for(const n of e){let e=null;for(let l=0;l<v.products.length;l++){const o=v.products[l];let d=![];const h=Object.values(o.sizes);for(let e=0;e<h.length;e++){const l=h[e];if(l.upc===n.identifier||l.id===n.identifier||o.salsifyGrouping===n.identifier){d=!![];break}}if(d){e=o;break}}if(!e){this.logger.warn("No product found for identifier: "+n.identifier);continue}const o=Object.values(e.sizes)[0];if(!o){this.logger.warn("No sizes found for product: "+n.identifier);continue}if((null===(u=null===(l=null==o?void 0:o.attributes)||void 0===l?void 0:l.presale)||void 0===u?void 0:u.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+n.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let d=null;const p=n.fulfillmentType===h.SHIPPING?o.shippingVariants:o.onDemandVariants,m=Object.values(p);for(let n=0;n<m.length;n++)if(m[n]){d=m[n];break}if(!d){this.logger.warn("No supported variant found for product: "+n.identifier+" with fulfillment type: "+n.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const y=n.fulfillmentType===h.ON_DEMAND?d.onDemandFulfillmentId:d.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:y,partNumber:d.partNumber,quantity:n.quantity,identifier:n.identifier})}this.clearPendingCartOperation();const y=this.store.get("cart.id");this.pubSub.publishAction(o.CART_PRODUCT_ADD_SUCCESS,{cartId:y,itemsAdded:e.length,identifiers:m}),this.logger.info("Products added to cart successfully:",m)}catch(p){this.logger.error("Error adding products to cart:",p),this.clearPendingCartOperation();const n=this.store.get("cart.id");throw this.pubSub.publishAction(o.CART_PRODUCT_ADD_FAILED,{cartId:n,identifiers:e.map(e=>e.identifier),error:p.message||"Failed to add products to cart"}),p}},applyPromoCode:async e=>{try{if(!e||""===e.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const n=e.trim().toUpperCase(),l=this.themeProvider.getConfigs("global"),d=l.layout.allowPromoCodes;if(!d)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const h=this.store.get("cart.promoCode");if(h&&h.code===n)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(n);const u=this.command.cart.getDetails();this.pubSub.publishAction(o.CART_PROMO_CODE_APPLIED,{cartId:u.cartId,discountAmount:u.promoCodeDiscount||0,newSubtotal:u.subtotal}),this.logger.info("Promo code applied successfully")}catch(n){this.logger.error("Failed to apply promo code:",n);const e=this.store.get("cart.id");throw this.pubSub.publishAction(o.CART_PROMO_CODE_FAILED,{cartId:e,error:"Promo code could not be applied"}),n}},removePromoCode:async()=>{try{const e=this.themeProvider.getConfigs("global"),n=e.layout.allowPromoCodes;if(!n)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const l=this.command.cart.getDetails();this.pubSub.publishAction(o.CART_PROMO_CODE_REMOVED,{cartId:l.cartId,newSubtotal:l.subtotal}),this.logger.info("Promo code removed successfully")}catch(e){throw this.logger.error("Failed to remove promo code:",e),e}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(o.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(d.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(d.CHECKOUT)},addProduct:async(e,n)=>{try{if(!e||0===e.length)return this.logger.warn("No products provided to add to checkout"),void 0;n===!![]&&this.command.ui.openDrawer(d.CHECKOUT);const l=e.map(e=>e.identifier);await this.cartActions.addProduct(e),await this.command.checkout.loadCheckout();const h=this.store.get("cart.id");this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:h,itemsAdded:e.length,identifiers:l}),this.logger.info("Products added to checkout successfully:",l)}catch(l){this.logger.error("Error adding products to checkout:",l);const n=this.store.get("cart.id");throw this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:n,identifiers:e.map(e=>e.identifier),error:l.message||"Failed to add products to checkout"}),l}},addPresaleProduct:async e=>{var n,l;try{if(!e||"object"!=typeof e||!e.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;if(e.fulfillmentType||(e.fulfillmentType=h.SHIPPING),e.quantity&&"number"==typeof e.quantity||(e.quantity=1),e.fulfillmentType!==h.SHIPPING&&e.fulfillmentType!==h.ON_DEMAND)throw new SDKError('Invalid fulfillment type "'+e.fulfillmentType+'" for presale product "'+e.identifier+'". Must be either "shipping" or "onDemand"',!![]);if(e.quantity<1)throw new SDKError('Quantity must be a number greater than 0 for presale product "'+e.identifier+'"',!![]);const u=this.getLocation();if(void 0===u)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(d.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const p=await this.api.getProductsData([e.identifier],u);if(!p||!p.products||0===p.products.length){this.logger.warn("No product data found for the provided presale identifier");const n=this.store.get("cart.id");return this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:n,identifiers:[e.identifier],error:"No product found",isPresale:!![]}),void 0}const m=p.products[0],v=Object.values(m.sizes)[0];if(!v){this.logger.warn("No sizes found for presale product: "+e.identifier);const n=this.store.get("cart.id");return this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:n,identifiers:[e.identifier],error:"No sizes found for product",isPresale:!![]}),void 0}if((null===(l=null===(n=null==v?void 0:v.attributes)||void 0===n?void 0:n.presale)||void 0===l?void 0:l.isActive)!==!![]){this.logger.warn("Product is not a presale item: "+e.identifier),this.store.set("checkout.error","Product is not available for presale");const n=this.store.get("cart.id");return this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:n,identifiers:[e.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0}let y=null;const b=e.fulfillmentType===h.SHIPPING?v.shippingVariants:v.onDemandVariants,x=Object.values(b);for(let e=0;e<x.length;e++)if(x[e]){y=x[e];break}if(!y){this.logger.warn("No supported variant found for presale product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("checkout.error","Presale product has no availability");const n=this.store.get("cart.id");return this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:n,identifiers:[e.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0}const w=e.fulfillmentType===h.ON_DEMAND?y.onDemandFulfillmentId:y.shippingFulfillmentId;await this.command.cart.addPresaleItem({fulfillmentId:w,partNumber:y.partNumber,quantity:e.quantity,engravingLines:[],identifier:e.identifier}),this.command.ui.openDrawer(d.CHECKOUT);const C=this.store.get("checkout"),k=C.cartId;this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:k,itemsAdded:1,identifiers:[e.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+e.identifier)}catch(u){this.logger.error("Error adding presale product to checkout:",u);const n=this.store.get("checkout"),l=n.cartId;throw this.pubSub.publishAction(o.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:l,identifiers:[e.identifier],error:u.message||"Failed to add presale product to checkout",isPresale:!![]}),u}},applyPromoCode:async e=>{var n;try{if(!e||""===e.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const l=e.trim().toUpperCase(),d=this.themeProvider.getConfigs("global"),h=d.layout.allowPromoCodes;if(!h)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const u=this.store.get("checkout.promoCode");if(u&&u.code===l)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(e);const p=this.store.get("checkout"),m=p.promoCode;this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_APPLIED,{cartId:p.cartId,discountAmount:(null==m?void 0:m.discountAmount)||0,newTotal:(null===(n=null==p?void 0:p.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(l){this.logger.error("Failed to apply checkout promo code:",l);const e=this.store.get("checkout");throw this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_FAILED,{cartId:e.cartId,error:"Promo code could not be applied"}),l}},removePromoCode:async()=>{var e;try{const n=this.themeProvider.getConfigs("global"),l=n.layout.allowPromoCodes;if(!l)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const d=this.store.get("checkout");this.pubSub.publishAction(o.CHECKOUT_PROMO_CODE_REMOVED,{cartId:d.cartId,newTotal:(null===(e=null==d?void 0:d.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(n){throw this.logger.error("Failed to remove checkout promo code:",n),n}},applyGiftCard:async e=>{var n;try{const l=this.themeProvider.getConfigs("checkout"),d=l.layout.allowGiftCards;if(!d)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(e);const h=this.store.get("checkout");this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_APPLIED,{cartId:h.cartId,newTotal:(null===(n=null==h?void 0:h.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card applied successfully")}catch(l){this.logger.error("Failed to apply gift card:",l);const e=this.store.get("checkout");throw this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_FAILED,{cartId:e.cartId,error:"Gift card could not be applied"}),l}},removeGiftCard:async e=>{var n;try{const l=this.themeProvider.getConfigs("checkout"),d=l.layout.allowGiftCards;if(!d)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(e);const h=this.store.get("checkout");this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_REMOVED,{cartId:h.cartId,newTotal:(null===(n=null==h?void 0:h.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card removed successfully")}catch(l){this.logger.error("Failed to remove gift card:",l);const e=this.store.get("checkout");throw this.pubSub.publishAction(o.CHECKOUT_GIFT_CARD_FAILED,{cartId:e.cartId,error:"Gift card could not be removed"}),l}},toggleIsGift:async e=>{await this.command.checkout.toggleIsGift(e)},toggleBillingSameAsShipping:async e=>{await this.command.checkout.toggleBillingSameAsShipping(e)},toggleMarketingPreferences:async(e,n)=>{await this.command.checkout.toggleMarketingPreferences(e,n)},updateCustomerInfo:e=>{const n={};if(!e||"object"!=typeof e)return this.logger.warn("actions.checkout.updateCustomerInfo called without valid params"),void 0;for(const[o,l]of Object.entries(e)){if(!this.allowedCustomerFields.has(o))continue;const e=this.normalizeCheckoutFieldValue(l);o===ft.addressTwo?n["checkout.shippingAddressTwo"]=e:n["checkout.customerForm.data."+o]=e}if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateCustomerInfo called without supported fields"),void 0;this.store.batch(n)},updateBillingInfo:e=>{const n={};if(!e||"object"!=typeof e)return this.logger.warn("actions.checkout.updateBillingInfo called without valid params"),void 0;for(const[o,l]of Object.entries(e))this.allowedBillingFields.has(o)&&(n["checkout.paymentForm.data."+o]=this.normalizeCheckoutFieldValue(l));if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateBillingInfo called without supported fields"),void 0;this.store.batch(n)},updateGiftInfo:e=>{const n={};if(!e||"object"!=typeof e)return this.logger.warn("actions.checkout.updateGiftInfo called without valid params"),void 0;for(const[o,l]of Object.entries(e)){if(!this.allowedGiftFields.has(o))continue;const e=this.normalizeCheckoutFieldValue(l);o===gt.addressTwo?n["checkout.shippingAddressTwo"]=e:n["checkout.giftRecipientForm.data."+o]=e}if(0===Object.keys(n).length)return this.logger.warn("actions.checkout.updateGiftInfo called without supported fields"),void 0;this.store.batch(n)},getDetails:()=>{var e,n,o;const l=this.store.get("checkout"),d=l.items||{},h={};for(const[u,p]of Object.entries(d))h[u]={liquidId:p.liquidId,variantId:p.variantId,cartItemId:u,retailerId:p.retailerId,fulfillmentId:p.fulfillmentId,salsifyGrouping:p.salsifyGrouping,name:p.name,catPath:p.catPath,volume:p.volume,uom:p.uom,proof:p.proof,abv:p.abv,containerType:p.containerType,container:p.container,size:p.size,pack:p.pack,packDesc:p.packDesc,mainImage:p.mainImage,brand:p.brand,partNumber:p.partNumber,upc:p.upc,sku:p.sku,price:p.price,unitPrice:p.unitPrice,quantity:p.quantity,unitTax:p.unitTax,bottleDeposits:p.bottleDeposits,attributes:p.attributes,retailerName:p.retailerName,expectationDetail:p.expectationDetail};return{cartId:l.cartId,isGift:l.isGift||![],billingSameAsShipping:l.paymentForm.billingSameAsShipping,marketingPreferences:{canEmail:(null===(e=l.marketingPreferences)||void 0===e?void 0:e.canEmail)||![],canSms:(null===(n=l.marketingPreferences)||void 0===n?void 0:n.canSms)||![]},hasPromoCode:!!(null===(o=l.promoCode)||void 0===o?void 0:o.code),hasGiftCards:Array.isArray(l.giftCards)&&l.giftCards.length>0,itemCount:Object.values(h||{}).reduce((e,n)=>e+(n.quantity||0),0),amounts:l.amounts,items:h}}},this.actions={product:this.productActions,address:this.addressActions,cart:this.cartActions,checkout:this.checkoutActions},this.store=StoreService.getInstance(),this.command=CommandService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get("ClientAction"),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}setupAddressUpdateListener(){const V=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+o.ADDRESS_UPDATED,V)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const e=this.pendingCartParams,n=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(e,n)}catch(e){this.logger.error("Failed to retry cart operation after address update",e)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const e=this.store.get("address");if(e.address.one&&e.coordinates.latitude&&e.coordinates.longitude)return{coordinates:e.coordinates,address:e.address}}normalizeCheckoutFieldValue(e){return"string"==typeof e?e:null==e?"":String(e)}}const yt="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n flex: 1;\n margin: 0 12px;\n }\n \n .title-container > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggles > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n \n .toggle > *:not(:last-child) {\n margin-right: 6px;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n \n .log-entry > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-width: 50px;\n }\n \n .log-meta > *:not(:first-child) {\n margin-top: 2px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n flex-wrap: wrap;\n }\n \n .toggles > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n }\n \n .toggles > *:not(:first-child) {\n margin-right: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n }\n \n .log-entry > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",bt="lce-debug-panel";class DebugPanelService{constructor(){this.panelElement=null,this.panelContainer=null,this.floatingButton=null,this.logContainer=null,this.logs=[],this.isVisible=![],this.showEvents=!![],this.showGtmEvents=!![],this.showLogs=![]}static getInstance(){return SingletonManager.getClassInstance("DebugPanelService",()=>new DebugPanelService)}initialize(){this.createPanel(),this.interceptLoggerService(),this.interceptPubSubEvents(),this.interceptGtmEvents()}toggleVisibility(){if(!this.panelElement)return this.createPanel(),void 0;this.isVisible=!this.isVisible,this.isVisible?this.showPanelContent():this.hidePanelContent()}destroy(){this.panelElement&&(this.panelElement.remove(),this.panelElement=null),this.panelContainer=null,this.floatingButton=null,this.logs=[],this.isVisible=![]}interceptLoggerService(){const e=LoggerFactory,n=e.instances;if(n)for(const[l,d]of n)this.interceptLoggerInstance(d,l);const o=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=e=>{const n=o(e);return this.interceptLoggerInstance(n,e),n}}interceptLoggerInstance(e,n){if(e.l)return;const o=e.debug.bind(e),l=e.info.bind(e),d=e.warn.bind(e),h=e.error.bind(e),i=(e,o,l)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:e,message:o,data:l,context:n});e.debug=(e,n)=>{o(e,n),this.addLogEntry(i("debug",e,n))},e.info=(e,n)=>{l(e,n),this.addLogEntry(i("info",e,n))},e.warn=(e,n)=>{d(e,n),this.addLogEntry(i("warn",e,n))},e.error=(e,n)=>{h(e,n),this.addLogEntry(i("error",e,n))},e.l=!![]}interceptPubSubEvents(){const e=PubSubService.getInstance(),n=e.publishAction.bind(e);e.publishAction=(e,o)=>{n(e,o),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+e,data:o,context:"PubSub"})};const o=e.publishForm.bind(e);e.publishForm=(e,n)=>{o(e,n),this.addLogEntry({id:"event_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Form Event: "+e,data:n,context:"PubSub"})}}interceptGtmEvents(){const e=GoogleTagManagerService.getInstance(),n=e.executeEvent.bind(e);e.executeEvent=(e,o,l)=>{n(e,o,l),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+o,data:l,context:"GTM."+e})}}addLogEntry(e){this.logs.push(e),this.logs.length>100&&(this.logs=this.logs.slice(-100)),this.renderLogs()}renderLogs(){if(!this.logContainer)return;const e=this.logs.filter(e=>{switch(e.type){case"event":return this.showEvents;case"gtm":return this.showGtmEvents;case"logger":return this.showLogs;default:return!![]}});this.logContainer.innerHTML="",e.forEach(e=>{const n=this.createLogElement(e);this.logContainer.appendChild(n)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const e=document.querySelector(bt);e&&e.remove(),this.panelElement=document.createElement(bt);const n=window.innerWidth<=768,o=window.innerWidth<=480;o?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):n?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const e=this.panelElement.attachShadow({mode:"closed"}),n=document.createElement("style");n.textContent=yt,e.appendChild(n),this.floatingButton=this.createFloatingButton(),e.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const o=this.createHeader();this.panelContainer.appendChild(o);const l=this.createToggles();this.panelContainer.appendChild(l),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const d=this.createResizeHandle();this.panelContainer.appendChild(d),e.appendChild(this.panelContainer),this.setupShadowEventListeners(e)}createHeader(){const e=document.createElement("div");e.className="header",e.title="Drag to move panel";const n=document.createElement("div");n.className="icon",n.innerHTML="🔍",n.title="Elements Debug Console",n.style.cursor="help";const o=document.createElement("div");o.className="title-container";const l=document.createElement("div");l.className="title",l.textContent="Elements Debug Console";const d=document.createElement("div");d.className="subtitle",d.textContent="Live SDK logs, events & GTM tracking",o.appendChild(l),o.appendChild(d);const h=document.createElement("button");return h.className="minimize",h.innerHTML="−",h.title="Minimize debug panel",h.addEventListener("click",()=>this.toggleVisibility()),e.appendChild(n),e.appendChild(o),e.appendChild(h),e}createToggles(){const e=document.createElement("div");e.className="toggles";const n=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];n.forEach(({key:n,label:o,description:l,color:d})=>{const h=document.createElement("label");h.className="toggle",h.title=l;const u=document.createElement("input");u.type="checkbox",u.checked="showLogs"!==n,u.addEventListener("change",e=>{const o=e.target;"showEvents"===n&&(this.showEvents=o.checked),"showGtmEvents"===n&&(this.showGtmEvents=o.checked),"showLogs"===n&&(this.showLogs=o.checked),this.renderLogs()});const p=document.createElement("span");p.textContent=o,p.style.color=d,h.appendChild(u),h.appendChild(p),e.appendChild(h)});const o=document.createElement("button");return o.className="clear-btn",o.innerHTML="🗑️",o.title="Clear all logs",o.addEventListener("click",()=>this.clearLogs()),e.appendChild(o),e}createResizeHandle(){const e=document.createElement("div");e.className="resize-handle",e.title="Drag to resize panel",e.style.cursor="nw-resize";let n=![],o=0,l=0,d=0,h=0;e.addEventListener("mousedown",e=>{n=!![],o=e.clientX,l=e.clientY,d=Number.parseInt(this.panelElement.style.width,10)||500,h=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",P),document.addEventListener("mouseup",c),e.preventDefault()});const P=e=>{if(!n||!this.panelElement)return;const u=e.clientX-o,p=e.clientY-l,m=window.innerWidth<=768,v=window.innerWidth<=480;let y,b,x,w;v?(y=280,b=window.innerWidth-20,x=200,w=.4*window.innerHeight):m?(y=300,b=window.innerWidth-30,x=200,w=.4*window.innerHeight):(y=300,b=800,x=200,w=600);const C=Math.max(y,Math.min(b,d+u)),k=Math.max(x,Math.min(w,h+p));this.panelElement.style.width=C+"px",this.panelElement.style.height=k+"px"},c=()=>{n=![],document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",c)};return e}setupShadowEventListeners(e){if(!this.panelElement)return;const n=e.querySelector(".header");if(n){let e=![],o=0,l=0,d=0,h=0;n.addEventListener("mousedown",n=>{if(n.target.classList.contains("minimize"))return;e=!![],o=n.clientX,l=n.clientY;const u=this.panelElement.getBoundingClientRect();d=u.left,h=u.top,document.addEventListener("mousemove",P),document.addEventListener("mouseup",c),n.preventDefault()});const P=n=>{if(!e||!this.panelElement)return;const u=n.clientX-o,p=n.clientY-l;this.panelElement.style.left=d+u+"px",this.panelElement.style.top=h+p+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},c=()=>{e=![],document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",c)}}}createFloatingButton(){const e=document.createElement("div");return e.className="floating-btn",e.innerHTML="⚙️",e.title="Open Elements Debug Console",e.style.display="none",e.addEventListener("click",()=>{this.toggleVisibility()}),e}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(e){const n=document.createElement("div");n.className="log-entry "+e.type+" "+e.level;const o=new Date(e.timestamp).toLocaleTimeString();return n.innerHTML='\n <div class="log-meta">\n <div class="log-type '+e.type+'">'+e.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+o+'</div>\n </div>\n <div class="log-message">\n '+this.escapeHtml(e.message)+"\n "+(e.context?'<div class="log-context">'+this.escapeHtml(e.context)+"</div>":"")+"\n "+(e.data?'<div class="log-data"><pre>'+this.formatJsonData(e.data)+"</pre></div>":"")+"\n </div>\n ",n}formatJsonData(e){try{return"object"==typeof e&&null!==e?JSON.stringify(e,null,2):String(e)}catch(n){return String(e)}}escapeHtml(e){const n=document.createElement("div");return n.textContent=e,n.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(e){if(this.h()){const n=this.u(e);if(n)return this.m(e,n)}return this.cachedFingerprint||(this.cachedFingerprint=this.v()),this.m(e,this.cachedFingerprint)}getFingerprintData(){return{screen:this.C(),browser:this.k(),timezone:this.S()}}isLocalStorageWebApiAvailable(){return this.h()}m(e,n){return(e+"_"+n).toLowerCase()}h(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const e=window.localStorage,n="__localStorage_test_"+Date.now()+"__",o="test";e.setItem(n,o);const l=e.getItem(n);return l!==o?(this.isLocalStorageAvailable=![],![]):(e.removeItem(n),this.isLocalStorageAvailable=!![],!![])}catch(e){const o=e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name);if(o)try{const e=window.localStorage;return e&&e.length>0?(this._()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(n){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],e instanceof DOMException){const n={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},o=n[e.name]||"Storage error: "+e.name,l=this._()?"webview":"browser";console.warn("localStorage unavailable in "+l+": "+o)}else console.warn("localStorage unavailable:",e.message||"Unknown error");return![]}}u(e){try{const n=this.clientConfig.get("localStorageKeyPrefix")+"_"+e.toLowerCase()+"_";for(let e=0;e<localStorage.length;e++){const o=localStorage.key(e);if(null==o?void 0:o.startsWith(n)){const e=o.substring(n.length);if(e&&/^[a-f0-9]+$/.test(e))return e}}return null}catch(n){return null}}v(){const e=this.getFingerprintData(),n=Object.keys(e).sort().map(n=>n+":"+e[n]).join("|");return this.D(n)}C(){try{const e=screen,n=e.colorDepth||24,o=e.pixelDepth||n,l=this.P(),d=Math.round(100*(window.devicePixelRatio||1));return n+"|"+o+"|"+l+"|"+d}catch(e){return"24|24|srgb|100"}}P(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(et){}return"srgb"}k(){var e;try{const n=navigator,o=[],l=((null===(e=n.languages)||void 0===e?void 0:e[0])||n.language||"en").substring(0,2);o.push(l),o.push(n.hardwareConcurrency||4);const d=(n.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);o.push(d),o.push(n.cookieEnabled?"1":"0"),o.push(n.maxTouchPoints||0),o.push(n.deviceMemory||0),o.push(this.I()),o.push(this._()?"webview":"browser");const h=["bluetooth"in n?"1":"0","usb"in n?"1":"0","mediaDevices"in n?"1":"0","permissions"in n?"1":"0","credentials"in n?"1":"0","storage"in n?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return o.push(h.join("")),o.join("|")}catch(n){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}I(){try{const e=navigator.userAgent.toLowerCase();return e.includes("instagram")?"ig_webview":e.includes("fban")||e.includes("fbav")?"fb_webview":e.includes("tiktok")?"tiktok_webview":e.includes("linkedin")?"linkedin_webview":e.includes("snapchat")?"snapchat_webview":e.includes("twitter")?"twitter_webview":e.includes("line/")?"line_webview":e.includes("micromessenger")?"wechat_webview":e.includes("firefox")?"gecko":e.includes("edg/")?"edge":e.includes("opr/")||e.includes("opera")?"opera":e.includes("chrome")&&!e.includes("edg")?"blink":e.includes("safari")&&!e.includes("chrome")?"webkit":"unknown"}catch(e){return"unknown"}}_(){try{const e=navigator.userAgent.toLowerCase(),n=navigator,o=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return o.some(n=>e.includes(n))?!![]:void 0===n.standalone||n.standalone?window.self!==window.top?!![]:![]:!![]}catch(e){return![]}}S(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return e.replace(/\//g,"_").substring(0,30)}catch(e){return"UTC"}}D(e){const n=16777619;let o=2166136261,l=2166136261,d=2166136261,h=2166136261;for(let u=0;u<e.length;u++){const p=e.charCodeAt(u);o^=p,o=Math.imul(o,n),l^=p<<1,l=Math.imul(l,n),d^=p<<2,d=Math.imul(d,n),h^=p<<3,h=Math.imul(h,n)}return o=Math.abs(o),l=Math.abs(l),d=Math.abs(d),h=Math.abs(h),o.toString(16)+l.toString(16)+d.toString(16)+h.toString(16)}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance();const e=this.clientConfig.get("env"),o=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:o,batchSize:e===n.PRODUCTION?5:10,batchInterval:e===n.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(e,n,o={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(e))return;const l=Date.now();try{const d={eventId:"event_"+l,timestamp:l,level:e,message:n,context:o.context,error:o.error?this.buildErrorContext(o.error):void 0,component:o.component,data:o.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(d)}catch(d){this.handleInternalError(d)}}buildErrorContext(e){return{name:e.name,message:e.message,stack:this.truncateStackTrace(e.stack),code:e.code}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){const e=this.store.get("address.formattedAddress");return{deviceId:this.clientConfig.get("userDeviceId")||"not_defined",isLocalStorageAvailable:this.clientConfig.get("isLocalStorageAvailable")||![],selectedAddress:e||void 0}}buildBrowserContext(){return{userAgent:navigator.userAgent,deviceType:this.clientConfig.get("deviceType"),url:window.location.href,referrer:document.referrer||void 0,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone}}shouldCapture(e){switch(e){case"debug":case"log":case"info":return this.config.includeDebugLogs;case"warn":return this.config.includeWarnings;case"error":case"fatal":return this.config.includeErrors;default:return![]}}addToQueue(e){this.eventQueue.length>=this.config.maxQueueSize&&(this.eventQueue.shift(),this.stats.droppedEvents++),this.eventQueue.push(e),this.stats.totalEvents++,this.stats.eventsByLevel[e.level]++,this.stats.queuedEvents=this.eventQueue.length,this.eventQueue.length>=this.config.batchSize&&this.flushQueue()}startBatchTimer(){this.batchTimer&&clearInterval(this.batchTimer),this.batchTimer=setInterval(()=>{this.eventQueue.length>0&&this.flushQueue()},this.config.batchInterval)}flushQueue(){var e;if(0===this.eventQueue.length||!(null===(e=this.config)||void 0===e?void 0:e.endpoint))return;const n=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const o=this.createBatch(n);try{this.sendBatch(o),this.stats.batchesSent++}catch(l){this.stats.failedBatches++,this.handleInternalError(l),this.eventQueue.unshift(...n),this.stats.queuedEvents=this.eventQueue.length}}createBatch(e){const n=Date.now();return{batchId:"batch_"+n,timestamp:n,events:e}}sendBatch(e){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const n=new Blob([JSON.stringify(e)],{type:"text/plain"}),o=navigator.sendBeacon(this.config.endpoint,n);if(o)return}catch(n){return this.sendBatchViaXHR(e),void 0}this.sendBatchViaXHR(e)}sendBatchViaXHR(e){try{const n=new XMLHttpRequest;if(n.open("POST",this.config.endpoint,![]),n.setRequestHeader("Content-Type","text/plain"),n.send(JSON.stringify(e)),n.status<200||n.status>=300)throw new SDKError("XHR request failed with status: "+n.status)}catch(n){throw new SDKError("Both sendBeacon and XHR failed: "+n.message)}}truncateStackTrace(e){if(e)return e.split("\n").slice(0,10).join("\n")}handleInternalError(e){this.clientConfig.isProduction()&&!this.clientConfig.isDebuggingEnabled()||console.error("[LiquidCommerce Elements][Telemetry Internal Error]",e)}shutdown(){var e;if(!this.isShuttingDown&&(this.isShuttingDown=!![],this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=null),this.eventQueue.length>0&&(null===(e=this.config)||void 0===e?void 0:e.endpoint))){const e=this.createBatch(this.eventQueue);this.eventQueue=[];try{this.sendBatch(e),this.stats.batchesSent++}catch(n){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(e={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...e}}initialize({data:e,config:n}){var o;this.T=Object.freeze(e),this.F=Object.freeze({type:n.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(o=null==n?void 0:n.useShadowDom)&&void 0!==o?o:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(e){return e.map(e=>this.interpolatePath(e))}interpolatePath(e){if("string"!=typeof e)return e;const n=/\{([^}]+)}/g;return e.replace(n,(n,o)=>{const l=this.T[o];return null==l?(this.logger.warn('Parameter "'+o+'" not found in component params for path "'+e+'"'),n):String(l)})}connectedCallback(){var e,n;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.F.useShadowDom?this.attachShadow({mode:this.clientConfig.get("openShadowDom")?"open":"closed"}):this,this.setup(),this.triggerRender("connected"),null===(e=this.connected)||void 0===e||e.call(this)}catch(o){this.logger.error("Component connectedCallback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"connectedCallback")}}disconnectedCallback(){var e,n;try{this.cleanup(),null===(e=this.disconnected)||void 0===e||e.call(this)}catch(o){this.logger.error("Component disconnectedCallback error in "+((null===(n=this.F)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"disconnectedCallback")}}setup(){var e,n,o;try{this.updateHostClasses(),this.updateHostAttributes(),null===(e=this.beforeSetupStoreWatchers)||void 0===e||e.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(n=this.beforeConnected)||void 0===n||n.call(this)}catch(l){this.logger.error("Component setup error in "+((null===(o=this.F)||void 0===o?void 0:o.tagName)||"unknown"),l),l instanceof Error&&this.captureComponentError(l,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const n of this.unsubscribers)try{n()}catch(e){this.logger.error("Cleanup error during component destruction",e),e instanceof Error&&this.captureComponentError(e,"cleanup")}this.unsubscribers=[]}setupAutoDestroy(){var e;if(!this.reactiveOptions.autoDestroy)return;let n=this.reactiveOptions.autoDestroyPath;if(!n&&(null===(e=this.reactiveOptions.watchStorePaths)||void 0===e?void 0:e.length)&&(n=this.reactiveOptions.watchStorePaths[0]),!n)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const o=this.interpolatePath(n),l=this.store.watch(o,(e,n)=>{this.isDestroyed||void 0===e&&void 0!==n&&this.handleAutoDestroy(o)});this.unsubscribers.push(l)}handleAutoDestroy(e){var n;if(this.isDestroyed)return;null===(n=this.beforeAutoDestroy)||void 0===n?void 0:n.call(this,e);const o=this.reactiveOptions.autoDestroyDelay||0;o>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},o):this.destroyComponent()}destroyComponent(){var e;if(!this.isDestroyed)try{null===(e=this.onAutoDestroy)||void 0===e?void 0:e.call(this),this.remove()}catch(n){this.logger.error("Error during auto-destroy of "+this.F.tagName,n),n instanceof Error&&this.captureComponentError(n,"auto-destroy")}}setupStoreWatchers(){var e;try{let e=this.reactiveOptions.watchStorePaths;if(!(null==e?void 0:e.length)||!this.T)return;e=this.interpolateStorePaths(e);const n=this.store.watchMany(e,e=>{var n,o;try{if(this.isDestroyed)return;const o=e.map(e=>e.path).join(", "),l="store:["+o+"]",d=null===(n=this.onStoreChanged)||void 0===n?void 0:n.call(this,e);d!==![]&&this.triggerRender(l)}catch(l){this.logger.error("Store watcher callback error in "+((null===(o=this.F)||void 0===o?void 0:o.tagName)||"unknown"),l),l instanceof Error&&this.captureComponentError(l,"storeWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Store watchers setup error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupStoreWatchers")}}setupNonRenderingWatchers(){var e;try{let e=this.reactiveOptions.watchOnlyStorePaths;if(!(null==e?void 0:e.length)||!this.T)return;e=this.interpolateStorePaths(e);const n=this.store.watchMany(e,e=>{var n,o;try{if(this.isDestroyed)return;null===(n=this.onStoreWatch)||void 0===n?void 0:n.call(this,e)}catch(l){this.logger.error("Non-rendering watcher callback error in "+((null===(o=this.F)||void 0===o?void 0:o.tagName)||"unknown"),l),l instanceof Error&&this.captureComponentError(l,"nonRenderingWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Non-rendering watchers setup error in "+((null===(e=this.F)||void 0===e?void 0:e.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupNonRenderingWatchers")}}triggerRender(e){this.lastRenderTrigger=e,this.scheduleRender()}scheduleRender(){this.renderScheduled||this.isDestroyed||(this.renderScheduled=!![],this.renderTimeout=requestAnimationFrame(()=>{this.render(),this.renderScheduled=![]}))}render(){var e,n;if(!this.initialized||this.isDestroyed)return;const o=performance.now();this.renderCount++;try{const n=this.template();"string"==typeof n&&(this.container.innerHTML=n),n instanceof HTMLElement&&safeReplaceChildren(this.container,n),Array.isArray(n)&&safeReplaceChildren(this.container,...n);const d=performance.now()-o;this.logRenderInfo(d);try{null===(e=this.afterRender)||void 0===e?void 0:e.call(this)}catch(l){this.logger.error("❌ afterRender hook error in "+this.F.tagName,l),l instanceof Error&&this.captureComponentError(l,"afterRender")}}catch(d){const e=performance.now()-o;this.logger.error("❌ Component render error in "+this.F.tagName,d),this.captureComponentError(d,"render",e),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.F.type,message:d instanceof Error?d.message:String(d)}));try{null===(n=this.onError)||void 0===n?void 0:n.call(this,d,"render")}catch(h){this.logger.error("❌ onError hook error in "+this.F.tagName,h)}}}logRenderInfo(e){const n=this.F.type,o=this.F.tagName,l=e>16?"🐌":e>8?"⚡":"🚀";this.logger.debug("Rendered "+l+" "+n+" </"+o+"> | #"+this.renderCount+" | "+e.toFixed(2)+"ms | "+this.lastRenderTrigger),e>16&&(this.logger.warn("⚠️ Slow render in "+n+"("+o+"): "+e.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:e,threshold:16,componentType:n,tagName:o,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+e.toFixed(2)+"ms",{context:"Component:"+o+":performance",component:{type:n,tagName:o,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:e,useShadowDom:this.F.useShadowDom}}))}rerender(e){this.triggerRender(e?"manual:rerender:"+e:"manual:rerender()")}captureComponentError(e,n,o){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",e.message,{context:"Component:"+this.F.tagName+":"+n,component:{type:this.F.type,tagName:this.F.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:o,useShadowDom:this.F.useShadowDom}})}catch(l){}}updateHostClasses(){const e=this.hostClasses;if(e.length>0){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());n.length>0&&this.classList.add(...n)}}addHostClasses(...e){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());n.length>0&&this.classList.add(...n)}removeHostClasses(...e){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());n.length>0&&this.classList.remove(...n)}toggleHostClasses(...e){const n=e.filter(e=>e&&"string"==typeof e&&e.trim());for(const o of n)this.classList.toggle(o)}addHostAttribute(e,n){e&&"string"==typeof e&&n&&"string"==typeof n&&(this.setAttribute(e,String(n)),this.hostAttributes[e]=String(n))}removeHostAttribute(e){e&&"string"==typeof e&&(this.removeAttribute(e),delete this.hostAttributes[e])}updateHostAttributes(){const e=this.hostAttributes;for(const[n,o]of Object.entries(e))n&&"string"==typeof n&&o&&"string"==typeof o&&this.setAttribute(n,String(o))}get params(){return this.T}get config(){return this.themeProvider.getComponentConfig(this.F.type)}get elementConfig(){return this.F}getConfigs(e){return this.themeProvider.getConfigs(e)}getStoreValue(e){return this.store.get(e)}setStoreValue(e,n){return this.store.set(e,n)}watchStore(e,n){const o=this.store.watch(e,n);return this.unsubscribers.push(o),o}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var e;const n=null!==(e=this.params.options)&&void 0!==e?e:{};return ComponentFactoryService.createElement({type:d.ADDRESS_DISPLAY,isIndependentComponent:!![],options:n})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var e,n,o,l;const h=this.getStoreValue("address"),u=null!==(e=this.params.isIndependentComponent)&&void 0!==e?e:![],p=null!==(n=this.params.productId)&&void 0!==n?n:"",m=null!==(o=this.params.options)&&void 0!==o?o:{},v=null!==(l=m.showLabel)&&void 0!==l?l:!![],y=[];if(v){const e=document.createElement("span");e.textContent="Delivers to:",y.push(e)}const b=document.createElement("button");b.type="button",b.textContent=h.formattedAddress||"Select an address";const x=h.formattedAddress?"Change delivery address, currently set to "+h.formattedAddress:"Select delivery address";return b.setAttribute("aria-label",x),b.addEventListener("click",async()=>{if(u)return this.commands.ui.openDrawer(d.ADDRESS_INPUT,{productId:p,isIndependentComponent:!![]}),void 0;!u&&p&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(d.ADDRESS_INPUT,{productId:p}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(p,d.ADDRESS_INPUT,{productId:p}))}),y.push(b),y}}const ArrowRightIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="arrow-right-icon '+o+'" style="'+d+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:e=24,height:n=24,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 489 489" class="bag-icon '+o+'" style="'+d+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckboxIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="checkbox-icon '+o+'" style="'+d+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="'+o+'" style="'+d+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="chevron-left-icon '+o+'" style="'+d+'" 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 '},ChevronUpIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="'+o+'" style="'+d+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 10.4712C3.78862 10.7316 4.21073 10.7316 4.47108 10.4712L7.99967 6.94265L11.5283 10.4712C11.7886 10.7316 12.2107 10.7316 12.4711 10.4712C12.7314 10.2109 12.7314 9.78878 12.4711 9.52843L8.47108 5.52843C8.21073 5.26808 7.78862 5.26808 7.52827 5.52843L3.52827 9.52843C3.26792 9.78878 3.26792 10.2109 3.52827 10.4712Z" fill="#18181B"/>\n </svg>\n '},CloseIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="close-icon '+o+'" style="'+d+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="error-info-icon '+o+'" style="'+d+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="info-icon '+o+'" style="'+d+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="search-icon '+o+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+d+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="success-icon '+o+'" style="'+d+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="trash-icon '+o+'" style="'+d+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 16 16" class="warning-icon '+o+'" style="'+d+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var e;return null!==(e=this.params.isIndependentComponent)&&void 0!==e?e:![]},this.handleInputChange=e=>{const n=e.target,o=n.value.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");n.value=o;const l=o.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const d=/^\d/.test(l);if(l.length<this.minSearchLength||!d)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(l)},300)},this.closeDrawer=async()=>{const e=this.params.productId,n=this.clientConfig.isMobile(),o=this.isIndependentComponent();(n||o)&&this.commands.ui.closeDrawer(),!n&&e&&await this.commands.product.closeProductDrawer(e)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(et){this.logger.error("Address edit cancellation failed",et)}},this.handleCheckAvailability=async()=>{if(!this.selectedAddress)return this.error="Please select a valid address first",this.updateErrorDisplay(),this.showSuggestions(),void 0;try{this.error=null,this.updateErrorDisplay();const e=this.getStoreValue("address"),n=(null==e?void 0:e.coordinates.latitude)!==this.selectedAddress.coordinates.latitude||(null==e?void 0:e.coordinates.longitude)!==this.selectedAddress.coordinates.longitude;n&&await this.commands.address.setSelectedAddress(this.selectedAddress),await this.closeDrawer()}catch(e){this.logger.error("Address selection and availability check failed",e),this.error="Failed to update address. Please try again.",this.updateErrorDisplay()}},this.handleSuggestionClick=async e=>{const n=e.currentTarget.dataset.suggestionId;if(n)try{this.error=null,this.updateErrorDisplay();const e=await this.commands.address.getAddressDetails(n);if(0===Object.keys(e).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:n,address:e.address,coordinates:e.coordinates,formattedAddress:e.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(o){this.logger.error("Address details retrieval failed",o),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=e=>{this.container.contains(e.target)||this.hideSuggestions()}}get hostClasses(){return["address-input-container"]}beforeConnected(){const e=this.getStoreValue("address");(null==e?void 0:e.formattedAddress)&&(this.selectedAddress=e)}async searchAddresses(e){try{this.error=null,this.updateErrorDisplay(),this.showSuggestions();const n=await this.commands.address.searchAddresses(e);this.suggestions=n.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(n){this.logger.error("Address search operation failed",n),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const e=this.errorContainer.querySelector(".error-text");e&&(e.textContent=this.error)}updateSuggestionsDisplay(){if(this.suggestionsContainer){if(this.suggestionsContainer.innerHTML="",0===this.suggestions.length){const e=this.createElement("li",{className:"suggestion-item no-suggestions",textContent:"No matching address found."});return this.suggestionsContainer.appendChild(e),void 0}for(const e of this.suggestions){const n=this.createElement("li",{className:"suggestion-item"}),o=this.createElement("span",{textContent:e.description});n.appendChild(o),n.setAttribute("data-suggestion-id",e.id),n.setAttribute("role","option"),n.setAttribute("aria-label","Select address: "+e.description),n.setAttribute("tabindex","0"),n.addEventListener("click",this.handleSuggestionClick),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.click())}),this.suggestionsContainer.appendChild(n)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(e,n){const o=document.createElement(e);return n&&Object.assign(o,n),o}createErrorContainer(){const e=this.createElement("div",{className:"error-message"});e.style.display="none",e.setAttribute("role","alert"),e.setAttribute("aria-live","assertive"),e.setAttribute("aria-atomic","true");const n=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),o=this.createElement("span",{className:"error-text"});return e.appendChild(n),e.appendChild(o),e}createCheckButton(){const e=this.createElement("button",{type:"button",className:"primary-button",textContent:"Save"});return e.setAttribute("aria-label","Save and check address availability"),e.addEventListener("click",this.handleCheckAvailability),e}createCancelButton(){const e=this.createElement("button",{type:"button",className:"secondary-button",textContent:"Cancel"});return e.setAttribute("aria-label","Cancel address selection"),e.addEventListener("click",this.handleCancel),e}template(){var e,n,o;const l=this.getConfigs("global"),d=null!==(e=this.params.options)&&void 0!==e?e:{},h=null!==(n=d.showLabel)&&void 0!==n?n:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),h){const e=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(e)}const u=this.createElement("div",{className:"input-wrapper "+l.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(o=this.selectedAddress)||void 0===o?void 0:o.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),u.appendChild(this.inputElement);const p=this.createElement("span");p.className="input-icon",p.innerHTML=SearchIcon({width:16,height:16,className:""}),u.appendChild(p),this.inputContainer.appendChild(u),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const m=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),v=[this.inputContainer,m,this.errorContainer],y=this.createElement("div",{className:"action-buttons"}),b=this.createCancelButton();y.appendChild(b);const x=this.createCheckButton();return y.appendChild(x),v.push(y),document.addEventListener("click",this.handleDocumentClick),v}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const e=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&e.push("cart-no-header"),this.params.isIndependentComponent&&e.push("independent"),e}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const e=[],n=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!n){const n=ComponentFactoryService.createElement({type:d.CART_HEADER});e.push(n)}const o=ComponentFactoryService.createElement({type:d.CART_BODY});e.push(o);const l=ComponentFactoryService.createElement({type:d.CART_FOOTER});return e.push(l),e}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const e=this.config.layout.drawerHeaderText,n=document.createElement("div");n.className="empty-cart-container";const o=document.createElement("h3");return o.className="empty-cart-content",o.textContent="Your "+e.toLowerCase()+" is empty",n.appendChild(o),n}createLoadingElement(){const e=document.createElement("div");return e.setAttribute("data-component-type","cart-body-loading"),e.innerHTML=this.loadingTemplate(),e}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n </div>\n </div>\n </div>\n '}createRetailerElement(e){try{return ComponentFactoryService.createElement({type:d.CART_RETAILER,retailerId:e.id})}catch(n){return this.logger.error("Cart retailer component creation failed",n),document.createElement("div")}}getRetailerElementById(e){return this.container.querySelector('[data-retailer-id="'+e+'"]')}getLoadingElement(){return this.container.querySelector('[data-component-type="cart-body-loading"]')}showEmptyCartState(){this.container.innerHTML="";const e=this.createEmptyCartElement();this.container.appendChild(e),this.setupEmptyCartListeners()}addLoadingOverlay(){const e=this.getLoadingElement();if(!e){const e=this.createLoadingElement();this.container.appendChild(e)}}removeLoadingOverlay(){const e=this.getLoadingElement();e&&e.remove()}setupEmptyCartListeners(){const e=this.container.querySelector('[data-action="continue-shopping"]');e&&e.addEventListener("click",()=>{this.commands.ui.closeDrawer()})}addRetailerElement(e,n){const o=this.createRetailerElement(n);o.setAttribute("data-retailer-id",e),this.container.appendChild(o)}removeRetailerElement(e){const n=this.getRetailerElementById(e);n&&n.remove()}updateRetailerElement(e,n){const o=this.getRetailerElementById(e);if(o){const l=this.createRetailerElement(n);l.setAttribute("data-retailer-id",e),o.replaceWith(l)}}hasRetailerDataChanged(e,n){return e?![]:!![]}getValidRetailers(e){if(!e)return{};const n={};for(const[o,l]of Object.entries(e))l&&"object"==typeof l&&l.id&&(n[o]=l);return n}getValidRetailerIds(e){const n=this.getValidRetailers(e);return new Set(Object.keys(n))}onStoreChanged(e){const n=e.find(e=>"cart.retailers"===e.path),o=e.find(e=>"cart.loading"===e.path);if(n){const e=this.getValidRetailers(n.oldValue),o=this.getValidRetailers(n.value),l=this.getValidRetailerIds(n.oldValue),d=this.getValidRetailerIds(n.value),h=l.size,u=d.size,p=this.getValidRetailers(this.getStoreValue("cart.retailers")),m=Object.keys(p).length;if(u>0&&0===m)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===h&&u>0){this.container.innerHTML="";for(const[e,n]of Object.entries(o))this.addRetailerElement(e,n)}else if(h>0&&0===u)this.showEmptyCartState();else if(u>0){for(const e of l)d.has(e)||this.removeRetailerElement(e);for(const n of d){const d=o[n],h=e[n];l.has(n)?this.hasRetailerDataChanged(h,d)&&this.updateRetailerElement(n,d):this.addRetailerElement(n,d)}}else 0===h&&0===u&&this.showEmptyCartState()}if(o){const e=o.value,n=o.oldValue;e!==n&&(e?this.addLoadingOverlay():this.removeLoadingOverlay())}return o||n,![]}afterRender(){this.setupEmptyCartListeners();const e=this.getStoreValue("cart.loading");e&&this.addLoadingOverlay()}template(){const e=this.getStoreValue("cart.retailers")||{},n=Object.values(e);if(0===n.length)return this.createEmptyCartElement();const o=[];for(const l of n){const e=this.createRetailerElement(l);e.setAttribute("data-retailer-id",l.id),o.push(e)}return o}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.subtotal","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(e){const n=e.some(e=>e.path.includes("cart.items")),o=e.some(e=>e.path.includes("cart.subtotal")),l=e.some(e=>e.path.includes("cart.fulfillments")),d=e.some(e=>"cart.loading"===e.path),h=e.some(e=>e.path.includes("cart.retailers"));n&&this.updateSubtotalItemsCount(),o&&this.subtotalPrice&&(this.subtotalPrice.textContent=formatCentToDollarText(this.getStoreValue("cart.subtotal"))),(l||o||d||n||h)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const e=this.getStoreValue("cart.loading");if(e)return!![];const n=this.getStoreValue("cart.items")||{},o=Object.values(n).some(e=>e.updating);if(o)return!![];const l=this.getStoreValue("cart.fulfillments")||{},d=Object.values(l).some(e=>e.updating);if(d)return!![];const h=this.getStoreValue("cart.retailers")||{},u=Object.values(h).some(e=>e.updating);return u?!![]:![]}shouldDisableCheckout(){const e=this.getStoreValue("cart.fulfillments");return Object.values(e).some(e=>e.hasUnmetMinimumPurchaseAmount)}updateCheckoutButtonState(){const e=this.getStoreValue("cart.items")||{},n=Object.keys(e).length>0;if(this.checkoutButton){const e=this.isAnythingLoading(),o=this.shouldDisableCheckout(),l=e||o||!n;this.checkoutButton.disabled=l,this.checkoutButton.classList.toggle("checkout-btn-disabled",l),this.checkoutButton.classList.toggle("loading",e)}}updateSubtotalItemsCount(){const e=this.getStoreValue("cart.items"),n=Object.values(e).reduce((e,n)=>e+n.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+n+" item"+(1!==n?"s":"")+"):")}async handleCheckout(e){return this.clientConfig.isBuilder()?(e.preventDefault(),this.logger.info("Cart Go To Checkout Button Is Disabled In Builder Mode"),void 0):this.isAnythingLoading()||this.shouldDisableCheckout()?(e.preventDefault(),void 0):(await this.commands.cart.handleGoToCheckout(),void 0)}template(){const e=this.getConfigs("global"),n=this.getStoreValue("cart.subtotal"),o=[],l=document.createElement("div");l.className="cart-footer-header";const h=document.createElement("div");h.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",h.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(n),h.appendChild(this.subtotalPrice);const u=document.createElement("p");if(u.textContent="Taxes & fees will be calculated at checkout",u.className="taxes-fees-info",l.appendChild(h),l.appendChild(u),o.push(l),e.layout.allowPromoCodes){const e=ComponentFactoryService.createElement({type:d.CART_PROMO_CODE});o.push(e)}const p=ComponentFactoryService.createElement({type:d.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(o.push(p),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleCheckout(e)}),this.checkoutButton.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.handleCheckout(e))}),o.push(this.checkoutButton),e.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:d.POWERED_BY,context:"general"});o.push(e)}return o}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}handleItemsUpdate(e,n){const o=new Set(e||[]),l=new Set(n||[]);for(const d of o)if(!l.has(d)){const e=this.container.querySelector('[data-item-id="'+d+'"]');e&&e.remove()}for(const h of l)if(!o.has(h)){const e=ComponentFactoryService.createElement({type:d.CART_ITEM,itemId:h});e.setAttribute("data-item-id",h),this.container.appendChild(e)}}setupItemElements(){const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e+".itemIds"),o=this.container.querySelectorAll("[data-item-id]");for(const l of o)l.remove();for(const l of n){const e=ComponentFactoryService.createElement({type:d.CART_ITEM,itemId:l});this.container.appendChild(e)}}setupMinimumPurchaseAlert(){const e=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+e),o=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(o&&o.remove(),null==n?void 0:n.hasUnmetMinimumPurchaseAmount){const e=ComponentFactoryService.createElement({type:d.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(n.minimumPurchaseAmount-n.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:n.subtotal,config:{showIcon:!![],alertType:"minimal"}});e.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(e)}}createLoadingOverlay(){const e=document.createElement("div");e.className="cart-loading-backdrop",e.setAttribute("data-loading-id","fulfillment-loading-overlay");const n=document.createElement("div");n.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(o),e.appendChild(n),e}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const e=this.createLoadingOverlay();this.container.appendChild(e),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const e=this.container.querySelector('[data-loading-id="fulfillment-loading-overlay"]');e&&(e.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isAnyItemUpdating(){var e;const n=this.getFulfillmentId(),o=this.getStoreValue("cart.fulfillments."+n);return(null===(e=null==o?void 0:o.itemIds)||void 0===e?void 0:e.length)?o.itemIds.some(e=>this.getStoreValue("cart.items."+e+".updating")):![]}checkAndUpdateLoadingState(){const e=this.isAnyItemUpdating(),n=this.hasLoadingOverlay();e&&!n?this.showLoadingOverlay():!e&&n&&this.hideLoadingOverlay()}onStoreChanged(e){const n=this.getFulfillmentId(),o="cart.fulfillments."+n,l=e.find(e=>e.path===o),d=e.filter(e=>"cart.items"===e.path||e.path.startsWith("cart.items."));if(d.length>0&&this.checkAndUpdateLoadingState(),l){const e=l.oldValue,n=l.value,o=(null==e?void 0:e.itemIds)||[],d=(null==n?void 0:n.itemIds)||[],h=JSON.stringify(o)!==JSON.stringify(d);h&&(this.handleItemsUpdate(o,d),this.checkAndUpdateLoadingState());const u=(null==e?void 0:e.subtotal)!==(null==n?void 0:n.subtotal),p=this.hasFulfillmentDataChanged(e,n,["itemIds","updating"]);if(u&&!p&&this.setupMinimumPurchaseAlert(),!p)return![]}return![]}hasFulfillmentDataChanged(e,n,o=[]){if(!e)return!![];const l=["type","canEngrave"];for(const d of l)if(!o.includes(d)&&e[d]!==n[d])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const xt={CT:"America/New_York",DE:"America/New_York",FL:"America/New_York",GA:"America/New_York",IN:"America/New_York",KY:"America/New_York",ME:"America/New_York",MD:"America/New_York",MA:"America/New_York",MI:"America/New_York",NH:"America/New_York",NJ:"America/New_York",NY:"America/New_York",NC:"America/New_York",OH:"America/New_York",PA:"America/New_York",RI:"America/New_York",SC:"America/New_York",TN:"America/New_York",VT:"America/New_York",VA:"America/New_York",WV:"America/New_York",AL:"America/Chicago",AR:"America/Chicago",IL:"America/Chicago",IA:"America/Chicago",KS:"America/Chicago",LA:"America/Chicago",MN:"America/Chicago",MS:"America/Chicago",MO:"America/Chicago",NE:"America/Chicago",ND:"America/Chicago",OK:"America/Chicago",SD:"America/Chicago",TX:"America/Chicago",WI:"America/Chicago",AZ:"America/Phoenix",CO:"America/Denver",ID:"America/Denver",MT:"America/Denver",NV:"America/Los_Angeles",NM:"America/Denver",UT:"America/Denver",WY:"America/Denver",CA:"America/Los_Angeles",OR:"America/Los_Angeles",WA:"America/Los_Angeles",AK:"America/Anchorage",HI:"Pacific/Honolulu"},wt="America/New_York";function detectUserTimezone(e){try{if(e){const n=e.toUpperCase(),o=xt[n];return o||wt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){return wt}}function getCurrentTimeInTimezone(e){try{const n=new Date,o=n.getTime(),l=6e4*n.getTimezoneOffset(),d=new Date(o+l),h=new Date(d.toLocaleString("en-US",{timeZone:e})),u=d.getTime()-h.getTime();return new Date(o+u)}catch(n){return new Date}}function getCurrentTimeInUserTimezone(e){const n=detectUserTimezone(e);return getCurrentTimeInTimezone(n)}function isDateTimeInRange(e){const{startDate:n,endDate:o,addressState:l}=e;try{const e=getCurrentTimeInUserTimezone(l),d=!n||e>=new Date(n),h=!o||e<=new Date(o);return d&&h}catch(d){return![]}}function filterActiveItems(e,n){return e.filter(e=>isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:n}))}function hasActiveItems(e,n){return filterActiveItems(e,n).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var e,n,o;const l=this.config.layout.drawerHeaderText,h=this.getConfigs("global"),u=document.createElement("div");u.className="cart-header-content";const p=document.createElement("h2");p.className="cart-title",p.textContent=l,u.appendChild(p);const m=document.createElement("button");m.type="button",m.className="cart-header-close-btn",m.innerHTML=CloseIcon({width:16,height:16}),m.setAttribute("aria-label","Close cart drawer"),m.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),u.appendChild(m);const v=this.clientConfig.get("promoTicker"),y=null!==(n=null===(e=null==h?void 0:h.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==n?n:[],b=null!=v?v:y,x=this.store.get("address"),w=hasActiveItems(b,null===(o=null==x?void 0:x.address)||void 0===o?void 0:o.state);if(!b.length||!w)return[u];const C=ComponentFactoryService.createElement({context:"cart",type:d.PROMO_CODE_TICKER,tickers:b});return[u,C]}}class CartItemComponent extends BaseComponent{get hostClasses(){return["cart-item-container"]}get hostAttributes(){return{"data-item-id":this.params.itemId}}constructor(){super({watchStorePaths:["cart.items.{itemId}"],autoDestroy:!![],autoDestroyPath:"cart.items.{itemId}"})}handleOpenEngravingForm(e,n){var o,l,h,u,p,m,v,y,b,x;this.commands.ui.openDrawer(d.ENGRAVING_FORM,{identifier:e,context:"cart",lines:(null===(l=null===(o=n.attributes)||void 0===o?void 0:o.engraving)||void 0===l?void 0:l.lines)||[],maxLines:(null===(u=null===(h=n.attributes)||void 0===h?void 0:h.engraving)||void 0===u?void 0:u.maxLines)||1,maxCharsPerLine:(null===(m=null===(p=n.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.maxCharsPerLine)||16,fee:(null===(y=null===(v=n.attributes)||void 0===v?void 0:v.engraving)||void 0===y?void 0:y.fee)||0,location:null===(x=null===(b=n.attributes)||void 0===b?void 0:b.engraving)||void 0===x?void 0:x.location})}template(){var e,n,o,l,h,u,p,m;const v=this.params.itemId,y=this.getStoreValue("cart.items."+v),b=this.getConfigs("global"),x=this.getStoreValue("cart.fulfillments."+y.fulfillmentId),w=y.attributes.engraving.hasEngraving?"Ships in 10 days":null==x?void 0:x.expectation,C=document.createElement("article");C.className="cart-item";const k=document.createElement("div");k.className="item-image";const S=document.createElement("img");S.src=y.mainImage,S.alt=y.name,k.appendChild(S);const _=document.createElement("div");_.className="item-details";const D=document.createElement("div");D.className="item-header";const I=document.createElement("h3");I.className="item-title",I.textContent=y.name;const A=document.createElement("button");A.className="item-delete",A.innerHTML=TrashIcon({}),A.setAttribute("role","button"),A.setAttribute("tabindex","0"),A.setAttribute("aria-label","Remove "+y.name+" from cart"),A.setAttribute("aria-expanded","true"),A.addEventListener("click",async()=>{await this.commands.cart.removeItem(v)}),A.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.commands.cart.removeItem(v))}),D.appendChild(I),D.appendChild(A);const O=document.createElement("div");O.className="item-specs",O.textContent=y.size+", "+y.container;const z=document.createElement("div");z.className="item-shipping-container";const N=document.createElement("div");if(N.className="item-shipping",N.textContent=w,z.appendChild(N),b.layout.enablePersonalization&&(null===(n=null===(e=null==y?void 0:y.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.isEngravable)&&(null===(l=null===(o=null==y?void 0:y.attributes)||void 0===o?void 0:o.engraving)||void 0===l?void 0:l.hasEngraving)===![]&&x.canEngrave){const e=document.createElement("span");e.className="cart-add-personalization-span",e.textContent=b.layout.personalizationText+" +"+formatCentToDollarText((null===(u=null===(h=y.attributes)||void 0===h?void 0:h.engraving)||void 0===u?void 0:u.fee)||0,![]),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Add personalization to "+y.name),e.addEventListener("click",()=>this.handleOpenEngravingForm(v,y)),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleOpenEngravingForm(v,y))}),z.appendChild(e)}_.appendChild(D),_.appendChild(O),_.appendChild(z),C.appendChild(k),C.appendChild(_);const M=[C],L=ComponentFactoryService.createElement({type:d.CART_ITEM_QUANTITY_PRICE,itemId:v});if((null===(m=null===(p=null==y?void 0:y.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.hasEngraving)===!![]){const e=ComponentFactoryService.createElement({type:d.ENGRAVING_VIEW,identifier:v,context:"cart"});M.push(e)}return M.push(L),M}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(e){const n=e.find(e=>"cart.items"===e.path);if(n){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getItemStore(){const e=this.params.itemId,n=this.getStoreValue("cart.items."+e);return n||null}calculateQuantityLimits(){const e=this.getItemStore();if(!e)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const n=e.quantity,o=this.getAvailableQuantity(),l=o>0;return{currentQuantity:n,availableQuantity:o,canIncrease:l,canDecrease:!![]}}getAvailableQuantity(){var e,n;const o=this.getItemStore();if(!o)return 0;const l=o.partNumber,d=o.fulfillmentId,h=this.getStoreValue("cart.items")||{},u=Object.values(h).filter(e=>e.partNumber===l&&e.fulfillmentId===d),p=u.reduce((e,n)=>e+n.quantity,0),m=this.getStoreValue("products."+o.upc)||this.getStoreValue("products."+o.salsifyGrouping);if(!m)return o.maxQuantity-p;const v=(null===(n=null===(e=null==m?void 0:m.sizes)||void 0===e?void 0:e[o.liquidId])||void 0===n?void 0:n.maxQuantityPerOrder)||0;return!v||v<=0?o.maxQuantity-p:v-p}updateButtonStates(e){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!e.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!e.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=e.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+e.currentQuantity))}async handleQuantityChange(e){const n=this.calculateQuantityLimits();e>0&&!n.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,e)}createQuantityContainer(){const e=this.calculateQuantityLimits(),n=this.getItemStore();if(!n)return document.createElement("div");const o=document.createElement("div");return o.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(-1)}),this.quantitySpan=document.createElement("span"),this.quantitySpan.className="quantity-value",this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-btn-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(1)}),this.updateButtonStates(e),o.appendChild(this.qtyDecreaseButton),o.appendChild(this.quantitySpan),o.appendChild(this.qtyIncreaseButton),o}createPriceContainer(){const e=this.getItemStore();if(!e)return document.createElement("div");const n=document.createElement("div");n.className="item-price-container";const o=document.createElement("span");if(o.className="item-price",o.textContent=formatCentToDollarText(e.price),n.appendChild(o),e.quantity>1){const o=document.createElement("span");o.className="item-price-per-unit",o.textContent="("+formatCentToDollarText(e.unitPrice)+" ea)",n.appendChild(o)}return n}template(){const e=[];if(this.config.layout.showQuantityCounter){const n=this.createQuantityContainer();e.push(n)}const n=this.createPriceContainer();return e.push(n),e}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(e){const n=e.find(e=>"cart.promoCode"===e.path);if(n){const{value:e,oldValue:o}=n,l=Boolean(null==o?void 0:o.code),d=Boolean(null==e?void 0:e.code);if(!l&&d)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(l&&!d)return this.container.innerHTML="",this.createInputContainer(),void 0;if(d&&this.promoCodePill&&e.discountAmount!==(null==o?void 0:o.discountAmount))return this.promoCodePill.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")",void 0}}createAppliedContainer(e){const n=document.createElement("div");n.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==e?void 0:e.code)+" (- "+formatCentToDollarText((null==e?void 0:e.discountAmount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("promo-remove-btn"),o.textContent="Remove",o.setAttribute("role","button"),o.setAttribute("aria-label","Remove promo code "+(null==e?void 0:e.code)),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||this.commands.cart.removePromoCode()}),n.appendChild(this.promoCodePill),n.appendChild(o),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){const e=document.createElement("div");e.classList.add("promo-code-container");const n=document.createElement("div");n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),e.appendChild(n),this.container.appendChild(e),this.promoCodePill=null}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const e=this.promoInput.getValue().replace(/[^a-zA-Z0-9]/g,"").trim(),n=e.length>=3&&e.length<=255,o=this.getStoreValue("cart.loading"),l=this.getStoreValue("cart.promoCode"),d=this.getStoreValue("cart.events")||[],h=hasCartAnyPromoCodeEvents(d);this.applyButton.disabled=!n||o||Boolean(null==l?void 0:l.discountAmount)||this.isApplying||h}createPromoInput(){const e=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+e.layout.inputFieldStyle,validation:{min:3,max:255},onChange:e=>{const n=e.toUpperCase(),o=this.promoInput;o.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const V=async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(e),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(n){this.logger.error("Cart promo code application failed",{promoCode:e,error:n instanceof Error?n.message:String(n)})}};return this.applyButton.addEventListener("click",V),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),V())}),this.applyButton}template(){const e=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==e?void 0:e.code){const n=document.createElement("div");n.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("promo-remove-btn"),o.textContent="Remove",o.setAttribute("role","button"),o.setAttribute("aria-label","Remove promo code "+e.code),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||this.commands.cart.removePromoCode()}),n.appendChild(this.promoCodePill),n.appendChild(o),n}const n=document.createElement("div");n.classList.add("promo-code-container");const o=document.createElement("div");return o.classList.add("promo-container"),o.appendChild(this.createPromoInput()),o.appendChild(this.createApplyButton()),n.appendChild(o),n}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(e){return ComponentFactoryService.createElement({type:d.CART_FULFILLMENT,fulfillmentId:e})}getFulfillmentElementById(e){return this.container.querySelector('[data-fulfillment-id="'+e+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const e=this.getFulfillmentContainer();if(e)return{parent:e.parentElement,nextSibling:e.nextElementSibling};const n=this.container.querySelectorAll("[data-fulfillment-id]");if(n.length>0){const e=n[n.length-1];return{parent:e.parentElement,nextSibling:e.nextElementSibling}}return null}addFulfillmentElement(e){const n=this.getFulfillmentInsertionPoint();if(n){const o=this.createFulfillmentElement(e);o.setAttribute("data-fulfillment-id",e);const l=this.getFulfillmentContainer();l&&l.remove(),n.nextSibling?n.parent.insertBefore(o,n.nextSibling):n.parent.appendChild(o)}}removeFulfillmentElement(e){const n=this.getFulfillmentElementById(e);if(n){const e=n.parentElement,o=n.nextElementSibling;n.remove();const l=this.container.querySelectorAll("[data-fulfillment-id]");if(0===l.length){const n=document.createElement("div");n.id="retailer-fulfillment-container",o?e.insertBefore(n,o):e.appendChild(n)}}}handleFulfillmentsUpdate(e,n){const o=new Set(e||[]),l=new Set(n||[]);for(const d of o)l.has(d)||this.removeFulfillmentElement(d);for(const d of l)o.has(d)||this.addFulfillmentElement(d)}setupFulfillmentElements(){const e=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+e+".fulfillments")||[],o=this.container.querySelectorAll("[data-fulfillment-id]");for(const d of o)d.remove();let l=this.getFulfillmentContainer();if(!l){const e=this.container.querySelector(".retailer-body-container"),n=this.container.querySelector("#retailer-subtotal-container");l=document.createElement("div"),l.id="retailer-fulfillment-container",e&&n&&e.insertBefore(l,n)}for(const d of Object.keys(n))this.addFulfillmentElement(d)}setupSubtotalElement(){const e=this.getRetailerId(),n=this.container.querySelector("#retailer-subtotal-container");if(n){const o=ComponentFactoryService.createElement({type:d.CART_RETAILER_SUBTOTAL,retailerId:e});n.replaceWith(o)}}onStoreChanged(e){const n=this.getRetailerId(),o="cart.retailers."+n,l=e.find(e=>e.path===o);if(l){const e=l.oldValue,n=l.value,o=Object.keys((null==e?void 0:e.fulfillments)||{}),d=Object.keys(n.fulfillments||{});JSON.stringify(o)!==JSON.stringify(d)&&this.handleFulfillmentsUpdate(o,d)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const e=this.container.querySelector(".section-toggle"),n=this.container.querySelector(".retailer-section"),o=this.container.querySelector(".section-header-label");if(e&&n&&o){const F=()=>{const n=e.checked;o.setAttribute("aria-label",n?"Expand retailer section":"Collapse retailer section"),o.setAttribute("aria-expanded",n?"false":"true")};e.addEventListener("change",()=>{e.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),F()}),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.click())}),e.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),F()}}template(){const e=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+e),o=document.createElement("section");o.className="retailer-section";const l=document.createElement("div");l.className="cart-retailer-header";const d=document.createElement("div");d.className="retailer-info";const h=document.createElement("h2");h.className="section-title",h.textContent=n.name,d.appendChild(h);const u=document.createElement("input");u.type="checkbox",u.id=n.id,u.className="section-toggle",d.appendChild(u);const p=document.createElement("label");p.htmlFor=n.id,p.className="section-header-label",p.setAttribute("role","button"),p.setAttribute("tabindex","0"),p.setAttribute("aria-label","Collapse retailer section"),p.setAttribute("aria-expanded","true");const m=document.createElement("span");m.className="chevron",m.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),p.appendChild(m),d.appendChild(p),l.appendChild(d),o.appendChild(l);const v=document.createElement("div");v.className="retailer-body-container";const y=document.createElement("div");y.id="retailer-fulfillment-container",v.appendChild(y);const b=document.createElement("div");return b.id="retailer-subtotal-container",v.appendChild(b),o.appendChild(v),o}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(e,n){const o=Object.values(e||{}).filter(e=>e.retailerId===n);let l=0;for(const d of o)l+=d.quantity;return l}template(){const e=this.params.retailerId,n=this.getStoreValue("cart.retailers."+e+".subtotal")||0,o=this.getStoreValue("cart.retailers."+e+".engravingFee")||0,l=this.getStoreValue("cart.items"),d=this.getRetailerItemCount(l,e),h=1===d?"item":"items",u=document.createElement("h3");u.className="retailer-subtotal-header",u.textContent="Subtotal ("+d+" "+h+"):";const p=document.createElement("span");return p.className="retailer-subtotal-amount",p.textContent=formatCentToDollarText(n+o),[u,p]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var e,n,o;const l=this.store.get("checkout.presale"),h=this.getConfigs("global"),u=this.clientConfig.get("promoTicker"),p=null!==(n=null===(e=null==h?void 0:h.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==n?n:[],m=null!=u?u:p,v=this.store.get("address"),y=hasActiveItems(m,null===(o=null==v?void 0:v.address)||void 0===o?void 0:o.state),b=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),x=document.createElement("div");x.classList.add("checkout-container"),b&&x.classList.add("no-header"),this.params.isIndependentComponent&&x.classList.add("independent");const w=ComponentFactoryService.createElement({type:d.CHECKOUT_INFORMATION});x.appendChild(w);const C=ComponentFactoryService.createElement({type:d.CHECKOUT_ORDER_SUMMARY});if(x.appendChild(C),!l&&(!m.length||!y)&&b)return[x];const k=document.createElement("div");if(k.classList.add("checkout-header-wrapper"),!b){const e=ComponentFactoryService.createElement({type:d.CHECKOUT_HEADER});k.appendChild(e)}if(m.length&&y&&!l){const e=ComponentFactoryService.createElement({context:"checkout",type:d.PROMO_CODE_TICKER,tickers:m});k.appendChild(e)}if(l){const e=ComponentFactoryService.createElement({type:d.CHECKOUT_PRESALE_COUNTDOWN});k.appendChild(e)}return[k,x]}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var e,n,o;const l=this.getStoreValue("checkout"),d=Boolean(l.promoCode),h=Boolean(null===(e=l.giftCards)||void 0===e?void 0:e.length),u=this.getConfigs("global"),p=Object.keys(l.onDemandFulfillmentTipInfo||{}).length>0,m=Object.values(l.items||{}),v=[],y=document.createElement("div");y.classList.add("checkout-amount-line");const b=document.createElement("span");b.textContent="Subtotal ("+m.length+" item"+(m.length>1?"s":"")+")",y.appendChild(b);const x=document.createElement("span");x.textContent=formatCentToDollarText(l.amounts.subtotal),y.appendChild(x),v.push(y);const w=document.createElement("div");w.classList.add("checkout-amount-line");const C=document.createElement("span");C.textContent="Shipping",w.appendChild(C);const k=document.createElement("span");k.textContent=formatCentToDollarText(l.amounts.shipping),w.appendChild(k),v.push(w);const S=document.createElement("div");S.classList.add("checkout-amount-line");const _=document.createElement("span");_.textContent="Delivery",S.appendChild(_);const D=document.createElement("span");if(D.textContent=formatCentToDollarText(l.amounts.delivery),S.appendChild(D),v.push(S),(null===(n=null==l?void 0:l.amounts)||void 0===n?void 0:n.engraving)>0){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Engraving",e.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(l.amounts.engraving),e.appendChild(o),v.push(e)}const I=document.createElement("div");I.classList.add("checkout-amount-line");const A=document.createElement("span");A.textContent="Taxes & Fees",I.appendChild(A);const O=document.createElement("span");if(O.textContent=formatCentToDollarText(l.amounts.tax+l.amounts.service+l.amounts.platform),I.appendChild(O),v.push(I),d){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Promo Code ("+(null===(o=l.promoCode)||void 0===o?void 0:o.code.toUpperCase())+")",e.appendChild(n);const d=document.createElement("span");d.textContent="-"+formatCentToDollarText(l.amounts.discounts),e.appendChild(d),v.push(e)}if(h){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Gift Cards Applied",e.appendChild(n);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(l.amounts.giftCards),e.appendChild(o),v.push(e)}if(p){const e=document.createElement("div");e.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Tips",e.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(l.amounts.tip),e.appendChild(o),v.push(e)}const z=document.createElement("div");z.classList.add("checkout-separator"),v.push(z);const N=document.createElement("div");N.classList.add("checkout-amount-total");const M=document.createElement("span");M.textContent="Total",N.appendChild(M);const L=document.createElement("span");if(L.textContent=formatCentToDollarText(l.amounts.total),N.appendChild(L),v.push(N),l.presale){const e=document.createElement("div");e.classList.add("checkout-amount-due");const n=document.createElement("span");n.textContent="Amount due today",e.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(0),e.appendChild(o),v.push(e);const l=document.createElement("div");l.classList.add("checkout-presale-locked-message");const d=htmlStringToElement(InfoIcon({color:u.theme.defaultTextColor}));l.appendChild(d);const h=document.createElement("p");h.textContent="Pre-ordered items will be charged when shipped.",l.appendChild(h),v.push(l)}return v}}class CheckoutBillingComponent extends BaseComponent{get hostClasses(){return["checkout-billing-form"]}constructor(){super({watchStorePaths:["checkout.paymentForm.billingSameAsShipping"]}),this.billingData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},addressOne:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},city:{isValid:![],value:""},state:{isValid:![],value:""},zipCode:{isValid:![],value:""}}}billingSameAsShippingToggle(){const e=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"),n=document.createElement("div");n.classList.add("checkout-billing-same-as-shipping-toggle-container");const o=document.createElement("div");o.classList.add("checkout-checkbox-container");const l=document.createElement("span");l.id="billingSameAsShipping",l.classList.add("checkout-checkbox-visual"),l.setAttribute("role","checkbox"),l.setAttribute("tabindex","0"),l.setAttribute("aria-label","Billing same as shipping checkbox"),l.setAttribute("aria-checked",e?"true":"false"),e&&l.classList.add("checked"),l.innerHTML=CheckboxIcon({width:16,height:16}),n.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),n.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const d=document.createElement("label");return d.textContent="Billing address same as shipping address",d.setAttribute("for","billingSameAsShipping"),d.classList.add("billing-checkbox-label"),o.appendChild(l),o.appendChild(d),n.appendChild(o),n}updateSaveButtonState(){const e=!Object.values(this.billingData).every(e=>e.isValid),n={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,addressOne:this.billingData.addressOne.value,addressTwo:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zipCode:this.billingData.zipCode.value};this.params.isFormValid(!e,n)}template(){const e=this.getStoreValue("checkout.paymentForm"),n=[],o=this.billingSameAsShippingToggle();if(n.push(o),e.billingSameAsShipping)return n;e.data&&(e.data.firstName&&(this.billingData.firstName={isValid:!![],value:e.data.firstName}),e.data.lastName&&(this.billingData.lastName={isValid:!![],value:e.data.lastName}),e.data.email&&(this.billingData.email={isValid:!![],value:e.data.email}),e.data.phone&&(this.billingData.phone={isValid:!![],value:e.data.phone}),e.data.company&&(this.billingData.company={isValid:!![],value:e.data.company}),e.data.addressOne&&(this.billingData.addressOne={isValid:!![],value:e.data.addressOne}),e.data.addressTwo&&(this.billingData.addressTwo={isValid:!![],value:e.data.addressTwo}),e.data.city&&(this.billingData.city={isValid:!![],value:e.data.city}),e.data.state&&(this.billingData.state={isValid:!![],value:e.data.state}),e.data.zipCode&&(this.billingData.zipCode={isValid:!![],value:e.data.zipCode})),this.updateSaveButtonState();const h=document.createElement("div");h.classList.add("section-title-container");const u=document.createElement("h3");u.textContent="Your billing info",u.classList.add("section-title"),h.appendChild(u);const p=document.createElement("p");p.textContent="Provide the info relevant to your payment method",p.classList.add("section-subtitle"),h.appendChild(p),n.push(h);const m=document.createElement("div");m.classList.add("section-form-container");const v=document.createElement("div");v.classList.add("checkout-two-col-container");const y=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:vt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.firstName.value=e,this.pubSub.publishForm(l.BILLING,{fieldName:vt.firstName})},onValidation:e=>{this.billingData.firstName.isValid=e,this.updateSaveButtonState()}});y.setAttribute("aria-label","First name input"),v.appendChild(y);const b=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:vt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.lastName.value=e,this.pubSub.publishForm(l.BILLING,{fieldName:vt.lastName})},onValidation:e=>{this.billingData.lastName.isValid=e,this.updateSaveButtonState()}});b.setAttribute("aria-label","Last name input"),v.appendChild(b),m.appendChild(v);const x=ComponentFactoryService.createElement({type:d.INPUT,inputType:"email",name:vt.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.email.value=e,this.pubSub.publishForm(l.BILLING,{fieldName:vt.email})},onValidation:e=>{this.billingData.email.isValid=e,this.updateSaveButtonState()}});x.setAttribute("aria-label","Email input"),m.appendChild(x);const w=document.createElement("div");w.classList.add("checkout-two-col-container");const C=ComponentFactoryService.createElement({type:d.INPUT,inputType:"tel",name:vt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.phone.value=e,this.pubSub.publishForm(l.BILLING,{fieldName:vt.phone})},onValidation:e=>{this.billingData.phone.isValid=e,this.updateSaveButtonState()}});C.setAttribute("aria-label","Phone input"),w.appendChild(C);const k=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:vt.company,label:"Company (optional)",autocomplete:!![],onChange:async e=>{this.billingData.company.value=e,this.pubSub.publishForm(l.BILLING,{fieldName:vt.company})},onValidation:e=>{this.billingData.company.isValid=e,this.updateSaveButtonState()}});k.setAttribute("aria-label","Company input"),w.appendChild(k),m.appendChild(w);const S=document.createElement("div");S.classList.add("checkout-two-col-container");const _=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:vt.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.addressOne.value=e,this.pubSub.publishForm(l.BILLING,{fieldName:vt.addressOne})},onValidation:e=>{this.billingData.addressOne.isValid=e,this.updateSaveButtonState()}});_.setAttribute("aria-label","Street address input"),S.appendChild(_);const D=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:vt.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async e=>{this.billingData.addressTwo.value=e,this.pubSub.publishForm(l.BILLING,{fieldName:vt.addressTwo})},onValidation:e=>{this.billingData.addressTwo.isValid=e,this.updateSaveButtonState()}});D.setAttribute("aria-label","Apt, suite, etc. (optional) input"),S.appendChild(D),m.appendChild(S);const I=document.createElement("div");I.classList.add("checkout-three-col-container");const A=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:vt.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.city.value=e,this.pubSub.publishForm(l.BILLING,{fieldName:vt.city})},onValidation:e=>{this.billingData.city.isValid=e,this.updateSaveButtonState()}});A.setAttribute("aria-label","City input"),I.appendChild(A);const O=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:vt.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:e=>e&&2===e.length&&/^[A-Z]{2}$/.test(e)?null:"State must be 2 uppercase characters"},onChange:async e=>{this.billingData.state.value=e,this.pubSub.publishForm(l.BILLING,{fieldName:vt.state})},onValidation:e=>{this.billingData.state.isValid=e,this.updateSaveButtonState()}});O.setAttribute("aria-label","State input"),I.appendChild(O);const z=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:vt.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.zipCode.value=e,this.pubSub.publishForm(l.BILLING,{fieldName:vt.zipCode})},onValidation:e=>{this.billingData.zipCode.isValid=e,this.updateSaveButtonState()}});return z.setAttribute("aria-label","Zip Code input"),I.appendChild(z),m.appendChild(I),n.push(m),n}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(e){const n=e.find(e=>"checkout.customerForm.isSaving"===e.path);n&&(n.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const e=this.store.get("checkout.customerForm.data");e.firstName&&(this.customerData.firstName={isValid:!![],value:e.firstName}),e.lastName&&(this.customerData.lastName={isValid:!![],value:e.lastName}),e.email&&(this.customerData.email={isValid:!![],value:e.email}),e.phone&&(this.customerData.phone={isValid:!![],value:e.phone}),e.company&&(this.customerData.company={isValid:!![],value:e.company}),e.birthDate&&(this.customerData.birthDate={isValid:!![],value:e.birthDate});const n=[],o=document.createElement("div");o.classList.add("section-title-container");const h=document.createElement("h3");h.textContent="Buyer Information",h.classList.add("section-title"),o.appendChild(h);const u=document.createElement("p");u.textContent="Buyer information is used to process your order and for delivery purposes.",u.classList.add("section-subtitle"),o.appendChild(u),n.push(o);const p=document.createElement("div");p.classList.add("section-form-container");const m=document.createElement("div");m.classList.add("checkout-two-col-container");const v=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:ft.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:e.firstName,onChange:async e=>{this.customerData.firstName.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.firstName})},onValidation:e=>{this.customerData.firstName.isValid=e,this.updateSaveButtonState()}});m.appendChild(v);const y=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:ft.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:e.lastName,onChange:async e=>{this.customerData.lastName.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.lastName})},onValidation:e=>{this.customerData.lastName.isValid=e,this.updateSaveButtonState()}});m.appendChild(y),p.appendChild(m);const b=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:ft.company,label:"Company (optional)",autocomplete:!![],value:e.company,onChange:async e=>{this.customerData.company.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.company})},onValidation:e=>{this.customerData.company.isValid=e,this.updateSaveButtonState()}});p.appendChild(b);const x=ComponentFactoryService.createElement({type:d.INPUT,inputType:"email",name:ft.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:e.email,onChange:async e=>{this.customerData.email.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.email})},onValidation:e=>{this.customerData.email.isValid=e,this.updateSaveButtonState()}});p.appendChild(x);const w=ComponentFactoryService.createElement({type:d.INPUT,inputType:"tel",name:ft.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:e.phone,onChange:async e=>{this.customerData.phone.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.phone})},onValidation:e=>{this.customerData.phone.isValid=e,this.updateSaveButtonState()}});p.appendChild(w);const C=ComponentFactoryService.createElement({type:d.BIRTHDATE_INPUT,inputType:"date",name:ft.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:e.birthDate,onChange:async e=>{this.customerData.birthDate.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.birthDate})},onValidation:e=>{this.customerData.birthDate.isValid=e,this.updateSaveButtonState()}});return p.appendChild(C),n.push(p),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),n.push(this.saveButton),this.updateSaveButtonState(),n}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const e=[],n=this.getStoreValue("checkout.customerForm.data"),o=document.createElement("div");o.classList.add("checkout-summary-form-header");const l=document.createElement("h2");l.textContent="Buyer: "+n.firstName+" "+n.lastName,o.appendChild(l);const d=document.createElement("span");if(d.textContent="Edit",d.setAttribute("aria-label","Edit Buyer Information"),d.setAttribute("role","button"),d.setAttribute("tabindex","0"),d.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),d.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.editCustomerForm())}),o.appendChild(d),e.push(o),n.company){const o=document.createElement("p");o.classList.add("checkout-summary-form-line"),o.textContent=n.company,e.push(o)}const h=document.createElement("p");h.classList.add("checkout-summary-form-line"),h.textContent=n.email,e.push(h);const u=document.createElement("p");u.classList.add("checkout-summary-form-line"),u.textContent=n.phone,e.push(u);const p=document.createElement("p");return p.classList.add("checkout-summary-form-line"),p.textContent=formatISODateToMMDDYYYY(n.birthDate),e.push(p),e}}const Ct=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],kt={a:["href","title","target","rel"],img:["src","alt","width","height","title"],blockquote:["cite"],div:["class"],span:["class"],p:["class"],strong:["class"],em:["class"],code:["class"],pre:["class"],h1:["class"],h2:["class"],h3:["class"],h4:["class"],h5:["class"],h6:["class"],ul:["class"],ol:["class"],li:["class"]};function sanitizeAttributeValue(e,n){return"href"===e?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(n)?n:null:"src"===e?/^https?:\/\/[^\s<>"']+$/i.test(n)?n:null:"class"===e?n.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():n.replace(/[<>"']/g,"").trim()}function cleanNode(e){if(e.nodeType===Node.TEXT_NODE){const n=e.textContent||"",o=n.replace(/<[^>]*>/g,"");if(o.trim()){const e=document.createTextNode(o);return e}return null}if(e.nodeType===Node.ELEMENT_NODE){const n=e,o=n.tagName.toLowerCase();if(Ct.includes(o)){const e=document.createElement(o),l=kt[o]||[];for(const o of Array.from(n.attributes)){const n=o.name.toLowerCase();if(l.includes(n)){const l=sanitizeAttributeValue(n,o.value);null!==l&&e.setAttribute(n,l)}}"a"===o&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"));for(const o of Array.from(n.childNodes)){const n=cleanNode(o);n&&e.appendChild(n)}return e}const l=document.createDocumentFragment();for(const e of Array.from(n.childNodes)){const n=cleanNode(e);n&&l.appendChild(n)}return l.childNodes.length>0?l:null}return null}function sanitizeHTML(e){if(!e||"string"!=typeof e)return"";try{const n=new DOMParser,o=n.parseFromString(e,"text/html"),l=o.querySelector("parsererror");if(l)return console.warn("HTML parsing error detected"),"";const d=document.createDocumentFragment();for(const e of Array.from(o.body.childNodes)){const n=cleanNode(e);n&&d.appendChild(n)}const h=document.createElement("div");return h.appendChild(d),h.innerHTML}catch(n){return console.error("HTML sanitization error:",n),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var e,n,o,l,h,u;const p=[],m=this.getConfigs("configurations"),v=this.getConfigs("global"),y=this.getConfigs("checkout"),b=this.config.layout.exitUrl||window.location.host,x=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(n=null===(e=this.config.layout)||void 0===e?void 0:e.checkoutCompleted)||void 0===n?void 0:n.customLogo){const e=document.createElement("div");e.classList.add("checkout-completed-header-container");const n=document.createElement("img");n.src=null===(l=null===(o=this.config.layout)||void 0===o?void 0:o.checkoutCompleted)||void 0===l?void 0:l.customLogo,n.alt=m.partnerName+" Logo",e.appendChild(n),p.push(e)}const w=document.createElement("div");w.classList.add("checkout-completed-section-container");const C=document.createElement("div");C.classList.add("checkout-completed-title-container");const k=document.createElement("div");k.classList.add("checkout-completed-title-section");const S=document.createElement("h3");S.innerHTML=(null===(u=null===(h=this.config.layout)||void 0===h?void 0:h.checkoutCompleted)||void 0===u?void 0:u.customText)||"Thank You for Your Order!",k.appendChild(S);const _=document.createElement("p");_.textContent="Your payment has been successfully processed.",k.appendChild(_),C.appendChild(k),w.appendChild(C);const D=document.createElement("div");D.classList.add("checkout-completed-sub-section");const I=document.createElement("div");I.classList.add("checkout-completed-line");const A=document.createElement("h3");A.textContent="Order Number",I.appendChild(A);const O=document.createElement("span");O.textContent=this.params.orderNumber,I.appendChild(O),D.appendChild(I);const z=document.createElement("div");z.classList.add("checkout-completed-line");const N=document.createElement("h3");N.textContent="Order Amount",z.appendChild(N);const M=document.createElement("span");M.textContent=""+formatCentToDollarText(this.params.orderTotal),z.appendChild(M),D.appendChild(z);const L=document.createElement("div");L.classList.add("checkout-completed-line");const B=document.createElement("h3");B.textContent="Payment Method",L.appendChild(B);const j=document.createElement("span");j.textContent="** "+this.params.cardLast4,L.appendChild(j),D.appendChild(L),w.appendChild(D);const q=document.createElement("div");q.classList.add("checkout-completed-sub-section");const U=document.createElement("p");U.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<br><br>A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.":"A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.",q.appendChild(U),w.appendChild(q),p.push(w);const G=document.createElement("div");G.classList.add("checkout-completed-section-container");const H=document.createElement("button");H.type="button";const Y=document.createElement("span");Y.textContent=x,H.setAttribute("tabindex","0"),H.setAttribute("role","button"),H.setAttribute("aria-label",x),H.appendChild(Y);const W=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:v.theme.selectedTextColor}));H.appendChild(W),H.addEventListener("click",()=>{window.location.href=b}),H.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),window.location.href=b)}),G.appendChild(H),p.push(G);const Q=document.createElement("div");Q.classList.add("checkout-completed-section-container");const Z=document.createElement("div");Z.classList.add("checkout-completed-help-section"),Q.appendChild(Z);const X=document.createElement("p");X.textContent="Questions about your order? Contact us at ";const J=document.createElement("a");J.href="mailto:"+m.supportEmail,J.textContent=m.supportEmail,X.appendChild(J),Z.appendChild(X);const $=document.createElement("p"),tt=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if($.textContent="Order placed on "+tt,Z.appendChild($),p.push(Q),y.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(y.layout.legalMessage.text);const o=document.createElement("div");o.classList.add("checkout-separator"),p.push(e),p.push(n),p.push(o)}if(v.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:d.POWERED_BY,context:"general"});p.push(e)}return p}}class CheckoutDeliverToComponent extends BaseComponent{get hostClasses(){return["checkout-delivery-information"]}constructor(){super({watchStorePaths:["checkout.isGift"],watchOnlyStorePaths:["checkout.customerForm.isSaving","checkout.giftRecipientForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},company:{isValid:!![],value:""},birthDate:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.giftData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},message:{isValid:![],value:""},addressTwo:{isValid:!![],value:""},deliveryInstructions:{isValid:!![],value:""}},this.saveButtonText="Save Delivery Information"}onStoreWatch(e){const n=e.find(e=>"checkout.customerForm.isSaving"===e.path),o=e.find(e=>"checkout.giftRecipientForm.isSaving"===e.path);(null==n?void 0:n.value)||(null==o?void 0:o.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const e=this.getStoreValue("checkout.isGift")||![];let n;n=e?!(this.giftData.firstName.isValid&&this.giftData.lastName.isValid&&this.giftData.email.isValid&&this.giftData.phone.isValid&&this.giftData.message.isValid&&this.giftData.addressTwo.isValid):!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid),this.saveButton.disabled=n}template(){const e=this.getConfigs("global"),n=this.getStoreValue("checkout.isGift"),o=this.store.get("checkout.giftRecipientForm.data"),h=this.store.get("checkout.customerForm.data"),u=this.store.get("address.formattedAddress"),p=n?o:h,m=this.store.get("checkout.shippingAddressTwo"),v=this.store.get("checkout.deliveryInstructions");h.firstName&&(this.customerData.firstName={isValid:!![],value:h.firstName}),h.lastName&&(this.customerData.lastName={isValid:!![],value:h.lastName}),h.email&&(this.customerData.email={isValid:!![],value:h.email}),h.phone&&(this.customerData.phone={isValid:!![],value:h.phone}),h.company&&(this.customerData.company={isValid:!![],value:h.company}),h.birthDate&&(this.customerData.birthDate={isValid:!![],value:h.birthDate}),o.firstName&&(this.giftData.firstName={isValid:!![],value:o.firstName}),o.lastName&&(this.giftData.lastName={isValid:!![],value:o.lastName}),o.email&&(this.giftData.email={isValid:!![],value:o.email}),o.phone&&(this.giftData.phone={isValid:!![],value:o.phone}),o.message&&(this.giftData.message={isValid:!![],value:o.message}),m&&(this.customerData.addressTwo={isValid:!![],value:m},this.giftData.addressTwo={isValid:!![],value:m}),v&&(this.customerData.deliveryInstructions={isValid:!![],value:v},this.giftData.deliveryInstructions={isValid:!![],value:v});const y=Object.keys(this.store.get("checkout.onDemandFulfillmentTipInfo")||{}).length>0,b=[],x=document.createElement("div");x.classList.add("delivery-header-container");const w=document.createElement("div");w.classList.add("delivery-header-content");const C=document.createElement("div");C.classList.add("delivery-title-container");const k=document.createElement("h3");k.textContent="Deliver to",k.classList.add("delivery-title");const S=document.createElement("p");S.textContent="Package recipient must be 21+",S.classList.add("delivery-subtitle"),C.appendChild(k),C.appendChild(S),x.appendChild(C),b.push(x);const _=document.createElement("div");_.classList.add("section-form-container");const D=document.createElement("div");D.classList.add("checkout-two-col-container");const I=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:n?gt.firstName:ft.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:p.firstName,onChange:e=>{n?(this.giftData.firstName.value=e,this.pubSub.publishForm(l.GIFT,{fieldName:gt.firstName})):(this.customerData.firstName.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.firstName}))},onValidation:e=>{n?this.giftData.firstName.isValid=e:this.customerData.firstName.isValid=e,this.updateSaveButtonState()}});I.setAttribute("aria-label","First Name Input"),D.appendChild(I);const A=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:n?gt.lastName:ft.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:p.lastName,onChange:e=>{n?(this.giftData.lastName.value=e,this.pubSub.publishForm(l.GIFT,{fieldName:gt.lastName})):(this.customerData.lastName.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.lastName}))},onValidation:e=>{n?this.giftData.lastName.isValid=e:this.customerData.lastName.isValid=e,this.updateSaveButtonState()}});if(A.setAttribute("aria-label","Last Name Input"),D.appendChild(A),_.appendChild(D),!n){const e=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:ft.company,label:"Company (optional)",autocomplete:!![],value:p.company,onChange:async e=>{this.customerData.company.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.company})},onValidation:e=>{this.customerData.company.isValid=e,this.updateSaveButtonState()}});e.setAttribute("aria-label","Company Input"),_.appendChild(e)}const O=ComponentFactoryService.createElement({type:d.INPUT,inputType:"email",name:n?gt.email:ft.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:p.email,onChange:e=>{n?(this.giftData.email.value=e,this.pubSub.publishForm(l.GIFT,{fieldName:gt.email})):(this.customerData.email.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.email}))},onValidation:e=>{n?this.giftData.email.isValid=e:this.customerData.email.isValid=e,this.updateSaveButtonState()}});O.setAttribute("aria-label","Email Input"),_.appendChild(O);const z=ComponentFactoryService.createElement({type:d.INPUT,inputType:"tel",name:n?gt.phone:ft.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:p.phone,onChange:e=>{n?(this.giftData.phone.value=e,this.pubSub.publishForm(l.GIFT,{fieldName:gt.phone})):(this.customerData.phone.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.phone}))},onValidation:e=>{n?this.giftData.phone.isValid=e:this.customerData.phone.isValid=e,this.updateSaveButtonState()}});if(z.setAttribute("aria-label","Phone Input"),_.appendChild(z),!n){const e=ComponentFactoryService.createElement({type:d.BIRTHDATE_INPUT,inputType:"date",name:ft.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:p.birthDate,onChange:async e=>{this.customerData.birthDate.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.birthDate})},onValidation:e=>{this.customerData.birthDate.isValid=e,this.updateSaveButtonState()}});e.setAttribute("aria-label","Birthdate Input"),_.appendChild(e)}const N=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:u,disabled:!![],className:"disabled-input"});N.setAttribute("aria-label","Delivery Address Input"),_.appendChild(N);const M=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:n?gt.addressTwo:ft.addressTwo,label:"Apt, suite, etc. (optional)",value:m,onChange:e=>{n?(this.giftData.addressTwo.value=e,this.pubSub.publishForm(l.GIFT,{fieldName:gt.addressTwo})):(this.customerData.addressTwo.value=e,this.pubSub.publishForm(l.CUSTOMER,{fieldName:ft.addressTwo}))},onValidation:e=>{n?this.giftData.addressTwo.isValid=e:this.customerData.addressTwo.isValid=e,this.updateSaveButtonState()}});if(M.setAttribute("aria-label","Address Line 2 Input"),_.appendChild(M),n){const n=document.createElement("div");n.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const d=document.createElement("label");d.textContent="Gift Message*",d.setAttribute("for",gt.message);const h=document.createElement("textarea");h.name=gt.message,h.id=gt.message,h.rows=4,h.value=o.message||"",h.setAttribute("aria-label","Gift Message Textarea"),h.addEventListener("input",async e=>{const n=e.target.value;this.giftData.message.value=n,this.giftData.message.isValid=n.length>0,this.pubSub.publishForm(l.GIFT,{fieldName:gt.message}),this.updateSaveButtonState()});const u=document.createElement("p");u.textContent="Your gift message will be emailed to the recipient along with delivery details.",u.classList.add("textarea-message-disclaimer"),n.appendChild(d),n.appendChild(h),n.appendChild(u),_.appendChild(n)}if(y){const o=document.createElement("div");o.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const l=document.createElement("label");l.textContent="Delivery Instructions",l.setAttribute("for","delivery_instructions");const d=document.createElement("textarea");d.id="delivery_instructions",d.name="delivery_instructions",d.rows=4,d.setAttribute("aria-label","Delivery Instructions Textarea"),d.value=v,d.addEventListener("input",async e=>{const o=e.target.value;n?(this.giftData.deliveryInstructions.value=o,this.giftData.deliveryInstructions.isValid=o.length>0):(this.customerData.deliveryInstructions.value=o,this.customerData.deliveryInstructions.isValid=o.length>0)});const h=document.createElement("p");h.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",h.classList.add("textarea-message-disclaimer"),o.appendChild(l),o.appendChild(d),o.appendChild(h),_.appendChild(o)}b.push(_),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const s=async()=>{n?await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}):await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:this.customerData.deliveryInstructions.value})};return this.saveButton.addEventListener("click",s),this.saveButton.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await s())}),b.push(this.saveButton),this.updateSaveButtonState(),b}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const e=[],n=this.getStoreValue("checkout.isGift"),o=this.getStoreValue("checkout.customerForm.data"),l=this.getStoreValue("checkout.giftRecipientForm.data"),d=this.getStoreValue("address"),h=this.getStoreValue("checkout.deliveryInstructions"),u=this.getStoreValue("checkout.shippingAddressTwo"),p=document.createElement("div");p.classList.add("checkout-summary-form-header");const m=document.createElement("h2");m.textContent=n?"Delivering to "+l.firstName+" "+l.lastName:"Delivering to "+o.firstName+" "+o.lastName,p.appendChild(m);const v=document.createElement("span");v.textContent="Edit",v.setAttribute("aria-label","Edit Delivery Information"),v.setAttribute("role","button"),v.setAttribute("tabindex","0");const i=async()=>{n?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(v.addEventListener("click",i),v.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await i())}),p.appendChild(v),e.push(p),!n&&o.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=o.company,e.push(n)}const y=document.createElement("p");y.classList.add("checkout-summary-form-line"),y.textContent=d.address.one+(u?", "+u:"")+", "+d.address.city+", "+d.address.state+", "+d.address.zip,e.push(y);const b=document.createElement("p");b.classList.add("checkout-summary-form-line"),b.textContent=n?l.email:o.email,e.push(b);const x=document.createElement("p");if(x.classList.add("checkout-summary-form-line"),x.textContent=n?l.phone:o.phone,e.push(x),!n&&o.birthDate){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=formatISODateToMMDDYYYY(o.birthDate),e.push(n)}if(n){const n=document.createElement("div");n.classList.add("checkout-summary-form-line-container");const o=document.createElement("span");o.classList.add("checkout-summary-form-line-container-label"),o.textContent="Gift Message:",n.appendChild(o);const d=document.createElement("span");d.classList.add("checkout-summary-form-line"),d.textContent=l.message||"No message provided.",n.appendChild(d),e.push(n)}if(h){const n=document.createElement("div");n.classList.add("checkout-summary-form-line-container");const o=document.createElement("span");o.classList.add("checkout-summary-form-line-container-label"),o.textContent="Delivery Instructions:",n.appendChild(o);const l=document.createElement("span");l.classList.add("checkout-summary-form-line"),l.textContent=h||"No instructions provided.",n.appendChild(l),e.push(n)}return e}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(e){var n;const o=e.find(e=>"checkout.giftCards"===e.path),l=e.find(e=>"checkout.loading"===e.path);o&&o.value.length>((null===(n=o.oldValue)||void 0===n?void 0:n.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),l&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const e=this.giftCardInput.getValue().trim(),n=e.length>=3&&e.length<=255,o=this.getStoreValue("checkout.loading"),l=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!n||o||Boolean(l)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:e=>{const n=e.toUpperCase(),o=this.giftCardInput;o.setValue(n),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const V=async()=>{const e=this.giftCardInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(e)}catch(n){this.logger.error("Checkout gift card application failed",{giftCardCode:e,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",V),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),V())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const e=[];return e.push(this.createGiftCardInput()),e.push(this.createApplyButton()),e}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const e=this.store.get("checkout.presale"),n=this.getConfigs("checkout");let o=null;if(!e){o=document.createElement("button"),o.classList.add("checkout-header-button"),o.setAttribute("aria-label","Back to Cart"),o.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(d.CART)});const e=document.createElement("span");e.innerHTML=ChevronLeftIcon({}),o.appendChild(e)}const l=document.createElement("h1");l.textContent=(null==n?void 0:n.layout.drawerHeaderText)||"Checkout",l.classList.add("checkout-header-title"),l.setAttribute("aria-label","Checkout Page");const h=document.createElement("button");return h.innerHTML=CloseIcon({width:16,height:16}),h.classList.add("checkout-header-button-close"),h.setAttribute("aria-label","Close Checkout"),h.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),o?[o,l,h]:[l,h]}}class CheckoutInformationComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift","checkout.customerForm.isEditing","checkout.giftRecipientForm.isEditing","checkout.paymentForm.isEditing"]})}onStoreWatch(){const e=this.getStoreValue("checkout.isGift"),n=this.getStoreValue("checkout.customerForm.isEditing"),o=this.getStoreValue("checkout.giftRecipientForm.isEditing"),l=this.getStoreValue("checkout.paymentForm.isEditing");e?(this.buyerForm.style.display=n?"block":"none",this.buyerSummary.style.display=n?"none":"block",this.deliveryToForm.style.display=o?"block":"none",this.deliverToSummary.style.display=o?"none":"block"):(this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=l?"block":"none",this.paymentSummary.style.display=l?"none":"block"}template(){const e=[],n=this.getStoreValue("checkout.isGift"),o=this.getStoreValue("checkout.customerForm"),l=this.getStoreValue("checkout.giftRecipientForm"),h=this.getStoreValue("checkout.paymentForm"),u=ComponentFactoryService.createElement({type:d.CHECKOUT_SEND_AS_GIFT});return e.push(u),this.deliveryToForm=ComponentFactoryService.createElement({type:d.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=n?l.isEditing?"block":"none":o.isEditing?"block":"none",e.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:d.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=n?l.isEditing?"none":"block":o.isEditing?"none":"block",e.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:d.CHECKOUT_BUYER}),this.buyerForm.style.display=n&&o.isEditing?"block":"none",e.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:d.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=n&&!o.isEditing?"block":"none",e.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:d.CHECKOUT_PAYMENT}),this.paymentForm.style.display=h.isEditing?"block":"none",e.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:d.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=h.isEditing?"none":"block",e.push(this.paymentSummary),e}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(e){var n,o,l,d;const h=e.find(e=>"checkout.items"===e.path);h&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const u=e.find(e=>e.path==="checkout.items."+this.params.itemId);if(u){const e=u.oldValue,h=u.value;if(h.updating)return![];const p=(null==e?void 0:e.quantity)!==(null==h?void 0:h.quantity),m=(null===(o=null===(n=null==e?void 0:e.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.lines)||[],v=(null===(d=null===(l=null==h?void 0:h.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.lines)||[],y=JSON.stringify(m)!==JSON.stringify(v);(p||y)&&this.updateEngravingElement(h)}return![]}updateEngravingElement(e){var n,o;const l=this.getConfigs("global"),h=this.container.querySelector(".engraving-view-container");if(h&&h.remove(),(null===(o=null===(n=null==e?void 0:e.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.hasEngraving)===!![]&&l.layout.enablePersonalization){const n=ComponentFactoryService.createElement({type:d.ENGRAVING_VIEW,identifier:e.cartItemId,context:"checkout"}),o=this.container.querySelector(".checkout-item-card-footer");o&&o.before(n)}}setupMinimumPurchaseAlert(){const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return;const n=e.fulfillmentId;if(!n)return;if(!this.container)return;const o=this.container.querySelector(".checkout-item-card-header");if(o){const e=this.getStoreValue("cart.fulfillments."+n),l=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(l&&l.remove(),e.hasUnmetMinimumPurchaseAmount){const n=ComponentFactoryService.createElement({type:d.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(e.minimumPurchaseAmount-e.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:e.subtotal,config:{showIcon:!![],alertType:"minimal"}});n.setAttribute("data-component-type","checkout-retailer-alert"),o.before(n)}}}updateTrashButtonState(){if(!this.trashButton)return;const e=this.getStoreValue("checkout"),n=Object.keys(e.items).length,o=1===n;this.trashButton.disabled=o,o?this.trashButton.classList.add("action-disabled"):this.trashButton.classList.remove("action-disabled")}createLoadingOverlay(){const e=document.createElement("div");e.className="cart-loading-backdrop",e.setAttribute("data-loading-id","item-loading-overlay");const n=document.createElement("div");n.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(o),e.appendChild(n),e}hasLoadingOverlay(){return!!this.container.querySelector('[data-loading-id="item-loading-overlay"]')}showLoadingOverlay(){if(this.hasLoadingOverlay())return;const e=this.createLoadingOverlay();this.container.appendChild(e),this.container instanceof HTMLElement&&(this.container.style.position="relative")}hideLoadingOverlay(){const e=this.container.querySelector('[data-loading-id="item-loading-overlay"]');e&&(e.remove(),this.container instanceof HTMLElement&&(this.container.style.position=""))}isItemUpdating(){const e=this.getStoreValue("checkout.items."+this.params.itemId);return e?e.updating===!![]:![]}checkAndUpdateLoadingState(){const e=this.isItemUpdating(),n=this.hasLoadingOverlay();e&&!n?this.showLoadingOverlay():!e&&n&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var e,n,o;const l=this.getConfigs("global"),h=this.getStoreValue("checkout.items."+this.params.itemId),u=null===(e=null==h?void 0:h.attributes)||void 0===e?void 0:e.presale,p=(null==u?void 0:u.isActive)&&(null==u?void 0:u.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(u.estimatedShipBy):"";if(!h)return[];const m=document.createElement("div");m.classList.add("checkout-item-card-header");const v=document.createElement("div");v.classList.add("checkout-item-image");const y=document.createElement("img");y.src=h.mainImage,y.alt=h.name,y.loading="lazy",v.appendChild(y),m.appendChild(v);const b=document.createElement("div");b.classList.add("checkout-item-details-container");const x=document.createElement("h4");x.classList.add("checkout-item-title"),x.textContent=h.name,b.appendChild(x);const w=document.createElement("div");w.classList.add("checkout-item-subtitle");const C=document.createElement("span");C.textContent=u.isActive?""+p:((null==h?void 0:h.expectationDetail)||"")+",",w.appendChild(C);const k=document.createElement("span");k.textContent="From "+((null==h?void 0:h.retailerName)||""),w.appendChild(k),b.appendChild(w),m.appendChild(b),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async e=>{var n;if(e.preventDefault(),e.stopPropagation(),!(null===(n=this.trashButton)||void 0===n?void 0:n.disabled))try{await this.commands.checkout.removeItem(h.cartItemId)}catch(o){this.logger.error("Checkout item removal failed",o)}}),m.appendChild(this.trashButton);const S=ComponentFactoryService.createElement({type:d.CHECKOUT_ITEM_QUANTITY,itemId:h.cartItemId}),_=[];if(_.push(m),l.layout.enablePersonalization&&(null===(o=null===(n=null==h?void 0:h.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.hasEngraving)===!![]){const e=ComponentFactoryService.createElement({type:d.ENGRAVING_VIEW,identifier:h.cartItemId,context:"checkout"});_.push(e)}return _.push(S),_}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(e){const n=e.find(e=>"checkout.items"===e.path);if(n){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getAvailableQuantity(){var e,n,o;const l=this.getStoreValue("checkout.items."+this.params.itemId);if(!l)return 0;const d=this.getStoreValue("products");if(!d)return 0;const h=l.partNumber,u=l.fulfillmentId,p=null===(o=null===(n=null===(e=Object.values(d).find(e=>e.sizes[l.liquidId]))||void 0===e?void 0:e.sizes)||void 0===n?void 0:n[l.liquidId])||void 0===o?void 0:o.maxQuantityPerOrder;if(!p)return 0;const m=this.getStoreValue("checkout.items")||{},v=Object.values(m).filter(e=>e.partNumber===h&&e.fulfillmentId===u),y=v.reduce((e,n)=>e+n.quantity,0);return p-y}calculateQuantityLimits(){var e;const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const o=this.getStoreValue("checkout"),l=1===(null===(e=Object.values(o.items))||void 0===e?void 0:e.length),d=n.quantity,h=this.getAvailableQuantity(),u=h>0,p=!(l&&1===d);return{currentQuantity:d,availableQuantity:h,isTheOnlyItem:l,canIncrease:u,canDecrease:p}}updateButtonStates(e){this.decreaseButton&&(this.decreaseButton.disabled=!e.canDecrease,this.decreaseButton.classList.toggle("disabled",!e.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!e.canIncrease,this.increaseButton.classList.toggle("disabled",!e.canIncrease),e.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=e.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+e.currentQuantity))}async handleQuantityChange(e){const n=this.calculateQuantityLimits(),o=this.params.itemId;if((!(e<0)||n.canDecrease)&&(!(e>0)||n.canIncrease)){if(!o)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:e}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(o,e)}catch(l){this.logger.error("Checkout item quantity change operation failed",l)}}}template(){const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const n=this.calculateQuantityLimits(),o=document.createElement("div");o.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(-1)}),o.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),o.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await this.handleQuantityChange(1)}),o.appendChild(this.increaseButton),this.updateButtonStates(n);const l=document.createElement("span");if(l.classList.add("checkout-item-price-text"),l.textContent=formatCentToDollarText(e.price),e.quantity>1){const n=document.createElement("span");n.classList.add("checkout-item-price-each-text"),n.textContent=" ("+formatCentToDollarText(e.unitPrice)+" ea)",l.appendChild(n)}return[o,l]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(e){return ComponentFactoryService.createElement({type:d.CHECKOUT_ITEM,itemId:e})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const e=this.getStoreValue("checkout.items")||{},n=new Map;for(const o of Object.values(e))o&&o.cartItemId&&n.set(o.cartItemId,o);return n}syncItemsWithStore(){const e=this.getItemsListContainer();if(!e)return;const n=this.getCurrentItemsMap(),o=e.querySelectorAll("[data-item-id]"),l=new Set;for(const d of o){const e=d.getAttribute("data-item-id");e&&l.add(e)}for(const d of o){const e=d.getAttribute("data-item-id");e&&!n.has(e)&&d.remove()}for(const[d]of n)if(!l.has(d)){const n=this.createItemElement(d);n.setAttribute("data-item-id",d),e.appendChild(n)}this.updateItemCount()}updateItemCount(){const e=this.getTogglerLabel();if(!e)return;const n=this.getCurrentItemsMap(),o=n.size;e.textContent=o+" item"+(1!==o?"s":"")}onStoreChanged(e){let n;for(let o=0;o<e.length;o++){const l=e[o];if("checkout"===l.path||"checkout.items"===l.path||"checkout.items."===l.path.substring(0,15)){n=l;break}}return n?(this.syncItemsWithStore(),![]):![]}handleToggle(){const e=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");if(e&&n){const o=n.classList.contains("show");n.classList.toggle("show"),e.classList.toggle("expanded"),o?(e.setAttribute("aria-expanded","false"),e.setAttribute("aria-label","Expand checkout items")):(e.setAttribute("aria-expanded","true"),e.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const e=this.container.querySelector(".checkout-items-toggler"),n=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".checkout-items-list");if(e&&n&&o){const l=o.classList.contains("show");n.setAttribute("tabindex","0"),n.setAttribute("aria-expanded",l?"true":"false"),n.setAttribute("aria-label",l?"Collapse checkout items":"Expand checkout items"),e.addEventListener("click",()=>this.handleToggle()),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const e=this.getStoreValue("checkout.items"),n=Object.values(e||{}),o=document.createElement("div");o.classList.add("checkout-items-toggler");const l=document.createElement("span");l.classList.add("checkout-items-toggler-label"),l.textContent=n.length+" item"+(1!==n.length?"s":""),o.appendChild(l);const d=document.createElement("button");d.type="button",d.classList.add("checkout-items-toggler-button"),d.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),o.appendChild(d);const h=document.createElement("div");h.classList.add("checkout-items-list","show");for(const u of n){const e=this.createItemElement(u.cartItemId);e.setAttribute("data-item-id",u.cartItemId),h.appendChild(e)}return[o,h]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(e){const n=e.find(e=>"checkout.amounts"===e.path);if(n){const e=this.getStoreValue("checkout"),n=Object.values(e.items||{}).length;this.updateZeroAmountElement(0===e.amounts.total&&n>0)}}updateZeroAmountElement(e){const n=this.container.querySelector(".checkout-zero-amount-container");if(e&&!n){const e=document.createElement("div");e.classList.add("checkout-zero-amount-container"),e.textContent="Credit card required to complete order (even when fully covered by gift card)";const n=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");n&&n.after(e)}else!e&&n&&n.remove()}afterRender(){const e=this.getStoreValue("checkout.amounts");e&&this.updateZeroAmountElement(0===e.total)}handleEmailToggle(e){this.commands.checkout.toggleMarketingPreferences("canEmail"),e.classList.toggle("checked");const n=e.classList.contains("checked");e.setAttribute("aria-checked",n?"true":"false")}handleSmsToggle(e){this.commands.checkout.toggleMarketingPreferences("canSms"),e.classList.toggle("checked");const n=e.classList.contains("checked");e.setAttribute("aria-checked",n?"true":"false")}marketingOptInsContainer(){const e=this.config.layout.emailOptIn,n=this.config.layout.smsOptIn;if(!e.show&&!n.show)return null;const o=document.createElement("div");if(o.classList.add("checkout-marketing-opt-ins-container"),e.show){const n=document.createElement("div");let l;n.classList.add("checkout-checkbox-container"),l=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canEmail");const d=document.createElement("span");d.id="emailOptIn",d.classList.add("checkout-checkbox-visual"),l&&d.classList.add("checked"),d.innerHTML=CheckboxIcon({width:16,height:16}),d.setAttribute("role","checkbox"),d.setAttribute("tabindex","0"),d.setAttribute("aria-label","Email opt-in checkbox"),d.setAttribute("aria-checked",l?"true":"false"),d.addEventListener("click",()=>this.handleEmailToggle(d)),d.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleEmailToggle(d))});const h=document.createElement("label");h.setAttribute("for","emailOptIn"),h.classList.add("checkbox-label"),h.innerHTML=sanitizeHTML(e.text),h.addEventListener("click",e=>{const n=e.target,o="A"===n.tagName||n.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canEmail"),d.classList.toggle("checked"))}),n.appendChild(d),n.appendChild(h),o.appendChild(n)}if(n.show){const e=document.createElement("div");let l;e.classList.add("checkout-checkbox-container"),l=this.clientConfig.isBuilder()?n.checked:this.store.get("checkout.marketingPreferences.canSms");const d=document.createElement("span");d.classList.add("checkout-checkbox-visual"),d.id="smsOptIn",l&&d.classList.add("checked"),d.innerHTML=CheckboxIcon({width:16,height:16}),d.setAttribute("role","checkbox"),d.setAttribute("tabindex","0"),d.setAttribute("aria-label","SMS opt-in checkbox"),d.setAttribute("aria-checked",l?"true":"false"),d.addEventListener("click",()=>this.handleSmsToggle(d)),d.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleSmsToggle(d))});const h=document.createElement("label");h.setAttribute("for","smsOptIn"),h.classList.add("checkbox-label"),h.innerHTML=sanitizeHTML(n.text),h.addEventListener("click",e=>{const n=e.target,o="A"===n.tagName||n.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canSms"),d.classList.toggle("checked"))}),e.appendChild(d),e.appendChild(h),o.appendChild(e)}return o}hasOnDemandOrder(){const e=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(e).length>0}template(){var e;const n=[],o=this.getConfigs("global"),l=this.getConfigs("checkout"),h=this.getConfigs("global"),u=l.layout.allowGiftCards,p=null===(e=null==h?void 0:h.layout)||void 0===e?void 0:e.allowPromoCodes,m=document.createElement("div");m.classList.add("section-title-container");const v=document.createElement("h3");v.textContent="Order Summary",v.classList.add("section-title"),m.appendChild(v),n.push(m);const y=ComponentFactoryService.createElement({type:d.CHECKOUT_ITEMS});n.push(y);const b=document.createElement("div");b.classList.add("checkout-separator");const x=document.createElement("div");if(x.classList.add("checkout-separator"),n.push(b),u||p){const e=ComponentFactoryService.createElement({type:d.CHECKOUT_PC_GC});n.push(e)}if(this.hasOnDemandOrder()){const e=ComponentFactoryService.createElement({type:d.CHECKOUT_TIPS});n.push(e),n.push(x)}const w=document.createElement("div");w.classList.add("section-title-container");const C=document.createElement("h3");C.textContent="100% Secure Payments",C.classList.add("disclaimer-header"),w.appendChild(C);const k=document.createElement("p");k.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",k.classList.add("disclaimer-description"),w.appendChild(k),n.push(w);const S=ComponentFactoryService.createElement({type:d.CHECKOUT_AMOUNTS});n.push(S);const _=ComponentFactoryService.createElement({type:d.CHECKOUT_PLACE_ORDER_BUTTON});n.push(_);const D=this.marketingOptInsContainer();if(D&&n.push(D),l.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const o=document.createElement("div");o.classList.add("checkout-legal-message"),o.innerHTML=sanitizeHTML(l.layout.legalMessage.text),n.push(e),n.push(o)}const I=document.createElement("div");if(I.classList.add("checkout-separator"),n.push(I),o.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:d.POWERED_BY,context:"checkout"});n.push(e)}return n}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.hardcodedPaymentElement=null,this.billingFormData=null,this.isValidBillingForm=![],this.isBillingSameAsShipping=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.savedCardInfo=null,this.showingStripeSummary=![],this.isSavingPayment=![]}onStoreWatch(e){for(const n of e)switch(n.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=n.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(n.value)}}handleBillingSameAsShippingChange(e){this.isBillingSameAsShipping=e,e&&(this.billingFormData=null,this.isValidBillingForm=![]),this.updateSaveButtonState(),this.updateErrorMessage()}async afterRender(){var e;this.isBillingSameAsShipping=null!==(e=this.getStoreValue("checkout.paymentForm.billingSameAsShipping"))&&void 0!==e?e:!![],this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let e=!![],n="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)n="Saving...",e=!![];else if(this.stripeFormStatus.hasError)n="Fix Errors and Retry",e=![];else if(this.showingStripeSummary&&this.savedCardInfo){const n=this.isBillingSameAsShipping||this.isValidBillingForm;e=!n}else{const n=this.stripeFormStatus.isFormComplete,o=this.isBillingSameAsShipping||this.isValidBillingForm;e=!(n&&o)}this.saveButton.disabled=e,this.saveButton.textContent=n,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let e="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?e=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(e="Please complete the billing address form"),e?(this.errorMessageElement.textContent=e,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(e){this.errorMessageElement&&(this.errorMessageElement.textContent=e,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===e&&(this.errorMessageElement.style.display="none")},5e3))}template(){const e=[],n=document.createElement("div");n.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Payment",o.classList.add("section-title"),n.appendChild(o);const l=document.createElement("p");if(l.textContent="All transactions are secure and encrypted.",l.classList.add("section-subtitle"),n.appendChild(l),e.push(n),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const n=document.createElement("p");n.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(n),e.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:d.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:e=>{this.stripeFormStatus=e,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:e=>{this.savedCardInfo=e},onEditModeVisibilityChanged:e=>{this.showingStripeSummary=e,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(e,n)=>{const o={paymentSession:{confirmationTokenId:e,setupIntentId:n}};!this.isBillingSameAsShipping&&this.billingFormData&&(o.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(o)}}}),e.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),e.push(this.errorMessageElement);const h=ComponentFactoryService.createElement({type:d.CHECKOUT_BILLING,isFormValid:(e,n)=>{this.billingFormData=n,this.isValidBillingForm=e,this.updateSaveButtonState(),this.updateErrorMessage()}});return e.push(h),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),this.saveButton.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.handleSaveButtonClick())}),e.push(this.saveButton),e}async handleSaveButtonClick(){var e;if(!this.isSavingPayment&&!this.stripeFormStatus.isProcessing)if(this.showingStripeSummary&&this.savedCardInfo)try{const e={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(e.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(e)}catch(n){this.logger.error("Failed to save payment form in edit mode",n),this.showError("Failed to save payment information.")}else if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))try{const e={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(e.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(e)}catch(o){this.logger.error("Failed to save payment form in beta mode",o),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(e=this.stripeHandlerElement)||void 0===e||e.submitStripeForm())}validatePrerequisites(){return this.isBillingSameAsShipping||this.isValidBillingForm?this.stripeFormStatus.isFormComplete?!![]:(this.showError("Please complete all required payment fields."),![]):(this.showError("Please complete the billing address form before saving."),![])}disconnected(){var e;this.isSavingPayment=![],null===(e=super.disconnected)||void 0===e||e.call(this)}}class CheckoutPaymentSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.paymentForm"]})}template(){var e,n,o,l,d,h,u,p,m,v;const y=[],b=this.getStoreValue("checkout.paymentForm"),x=document.createElement("div");x.classList.add("checkout-summary-form-header");const w=document.createElement("h2");w.textContent="Paying with "+capitalizeFirstLetter(null!==(o=null===(n=null===(e=b.paymentMethod)||void 0===e?void 0:e.card)||void 0===n?void 0:n.brand)&&void 0!==o?o:"")+" "+(null===(d=null===(l=b.paymentMethod)||void 0===l?void 0:l.card)||void 0===d?void 0:d.last4),x.appendChild(w);const C=document.createElement("span");C.textContent="Edit",C.setAttribute("aria-label","Edit Payment Information"),C.setAttribute("role","button"),C.setAttribute("tabindex","0"),C.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),C.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.editPaymentForm())}),x.appendChild(C),y.push(x);const k=document.createElement("p");return k.classList.add("checkout-summary-form-line"),k.textContent="Exp. "+(null===(u=null===(h=b.paymentMethod)||void 0===h?void 0:h.card)||void 0===u?void 0:u.expMonth)+"/"+(null===(v=null===(m=null===(p=b.paymentMethod)||void 0===p?void 0:p.card)||void 0===m?void 0:m.expYear)||void 0===v?void 0:v.slice(-2)),y.push(k),y}}class CheckoutPlaceOrderButtonComponent extends BaseComponent{get hostClasses(){return["checkout-place-order-button-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.error","checkout.customerForm.isValid","checkout.giftRecipientForm.isValid","checkout.paymentForm.isValid"]}),this.errorTimeoutId=null}afterRender(){this.placeOrderButton=this.container.querySelector(".checkout-place-order-button"),this.errorContainer=this.container.querySelector(".checkout-error-wrapper"),this.updateButtonState()}disconnected(){this.clearErrorTimeout()}onStoreWatch(e){const n=e.some(e=>"checkout.loading"===e.path||"checkout.error"===e.path||"checkout.customerForm.isValid"===e.path||"checkout.giftRecipientForm.isValid"===e.path||"checkout.paymentForm.isValid"===e.path);n&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const e=this.store.get("checkout.loading")||![],n=this.store.get("checkout.error")||null;this.updateErrorDisplay(n);const o=this.determineButtonState({isCheckoutLoading:e,hasCheckoutError:!!n});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(o.state),this.placeOrderButton.disabled=o.disabled,this.placeOrderButton.textContent=o.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(e){if(!this.errorContainer)return;const n=this.errorContainer.querySelector(".error-text");n&&(this.clearErrorTimeout(),e?(n.textContent=e,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(n.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:e,hasCheckoutError:n}){const o=this.config.layout.placeOrderButtonText,l=this.store.get("checkout.presale");let d=![];if(!l){const e=this.getStoreValue("cart.fulfillments")||{};d=Object.values(e).some(e=>e.hasUnmetMinimumPurchaseAmount)}const h=this.store.get("checkout.isGift"),u=this.store.get("checkout.customerForm.isValid"),p=this.store.get("checkout.giftRecipientForm.isValid"),m=this.store.get("checkout.paymentForm.isValid");return d||h&&!p||!u||!m?{state:"disabled",text:o,disabled:!![]}:e?{state:"processing",text:"Placing Order...",disabled:!![]}:n?{state:"disabled",text:o,disabled:!![]}:{state:"ready",text:o,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const e=this.store.get("checkout.loading");if(e)return;await this.commands.checkout.checkoutComplete()}catch(e){this.logger.error("Error handling place order click",e)}}template(){const e=document.createElement("button");e.type="button",e.textContent=this.config.layout.placeOrderButtonText,e.classList.add("checkout-place-order-button"),e.disabled=!![],e.setAttribute("tabindex","0"),e.setAttribute("role","button"),e.setAttribute("aria-label","Place Order"),e.addEventListener("click",this.handlePlaceOrderClick.bind(this)),e.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.handlePlaceOrderClick())});const n=document.createElement("div");n.classList.add("checkout-error-wrapper"),n.setAttribute("role","alert"),n.style.display="none";const o=document.createElement("div");o.classList.add("checkout-error");const l=document.createElement("span");l.classList.add("icon-error"),l.innerHTML=ErrorInfoIcon({});const h=document.createElement("span");h.classList.add("error-text"),o.appendChild(l),o.appendChild(h),n.appendChild(o);const u=ComponentFactoryService.createElement({type:d.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[n,u,e]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(e){var n;const o=e.find(e=>"checkout.presale"===e.path);if(null==o?void 0:o.value)return this.updateExpiresAt(o.value.expiresAt),!![];const l=e.find(e=>"ui.drawer"===e.path);return(null===(n=null==l?void 0:l.value)||void 0===n?void 0:n.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const e=this.store.get("checkout.presale");(null==e?void 0:e.expiresAt)&&this.updateExpiresAt(e.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var e,n;const o=[".drawer-content"];for(const d of o){const n=null===(e=this.rootElement)||void 0===e?void 0:e.closest(d);if(n&&this.isScrollable(n))return n}let l=null===(n=this.rootElement)||void 0===n?void 0:n.parentElement;for(;l&&l!==document.body;){if(this.isScrollable(l))return l;l=l.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var e,n;if(!this.scrollContainer)return;const o=this.scrollContainer.scrollTop,l=70,d=10;!this.isCurrentlyScrolled&&o>l?(this.isCurrentlyScrolled=!![],null===(e=this.rootElement)||void 0===e||e.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&o<d&&(this.isCurrentlyScrolled=![],null===(n=this.rootElement)||void 0===n||n.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(e){const n=window.getComputedStyle(e),o=n.overflowY;return e.scrollHeight>=e.clientHeight&&("auto"===o||"scroll"===o||"overlay"===o)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(e){this.stopCountdown();try{if(this.expiresAt=new Date(e),Number.isNaN(this.expiresAt.getTime()))return this.logger.error("Invalid presale expiration date",{expiresAtString:e}),this.handleExpire(),void 0;if(this.expiresAt<=new Date)return this.handleExpire(),void 0;const n=new Date,o=Math.floor((this.expiresAt.getTime()-n.getTime())/1e3);o<this.totalDuration&&(this.totalDuration=Math.max(o,240)),this.startCountdown()}catch(n){this.logger.error("Failed to parse presale expiration date",n),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const e=new Date,n=Math.max(0,this.expiresAt.getTime()-e.getTime()),o=n/1e3,l=this.totalDuration-o,d=Math.max(0,Math.min(100,l/this.totalDuration*100)),h=o<60;if(h!==this.isUnderOneMinute){this.isUnderOneMinute=h;const e=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==e||e.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==e||e.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}const u=this.rootElement.querySelector("[data-timer]");u&&(u.textContent=this.formatTime(n));const p=this.rootElement.querySelector("[data-progress-fill]");p&&(p.style.width=d+"%"),0===n&&this.handleExpire()}formatTime(e){const n=Math.floor(e/1e3),o=Math.floor(n/60),l=n%60,d=Math.floor(e%1e3/10);return o.toString().padStart(2,"0")+":"+l.toString().padStart(2,"0")+":"+d.toString().padStart(2,"0")}handleExpire(){this.clientConfig.isBuilder()||(this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer())}template(){const e=document.createElement("div");e.classList.add("checkout-presale-countdown"),this.rootElement=e;const n=document.createElement("div");n.classList.add("checkout-presale-text-container");const o=document.createElement("div");o.classList.add("checkout-presale-heading");const l=document.createElement("h2");l.textContent="LIMITED PRE-ORDER:";const d=document.createElement("div");d.classList.add("checkout-presale-timer"),d.setAttribute("data-timer",""),d.textContent="00:00:00",o.appendChild(l),o.appendChild(d);const h=document.createElement("p");h.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",h.classList.add("checkout-presale-subtitle"),n.appendChild(o),n.appendChild(h);const u=document.createElement("div");u.className="checkout-presale-progress-bar",u.setAttribute("data-progress","");const p=document.createElement("div");return p.className="checkout-presale-progress-fill",p.setAttribute("data-progress-fill",""),p.style.width="0%",u.appendChild(p),e.appendChild(n),e.appendChild(u),e}}class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const e=[],n=this.getConfigs("global"),o=document.createElement("div");o.classList.add("checkout-completed-section-container");const l=document.createElement("div");l.classList.add("checkout-completed-title-section");const h=document.createElement("div");h.classList.add("checkout-completed-title-section");const u=document.createElement("p");u.classList.add("presale-expired-title"),u.textContent="Session Expired",h.appendChild(u);const p=document.createElement("p");p.textContent="Your reservation time has ended. The item has been released for other customers.",h.appendChild(p),l.appendChild(h),o.appendChild(l);const m=document.createElement("div");m.classList.add("checkout-completed-help-section"),m.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.",o.appendChild(m),e.push(o);const v=document.createElement("div");v.classList.add("checkout-completed-section-container");const y=document.createElement("button");y.setAttribute("aria-label","Continue shopping"),y.type="button";const b=document.createElement("span");b.textContent="Continue Shopping",y.setAttribute("tabindex","0"),y.setAttribute("role","button"),y.setAttribute("aria-label","Continue Shopping"),y.appendChild(b);const x=htmlStringToElement(ArrowRightIcon({width:16,height:16}));y.appendChild(x),y.addEventListener("click",()=>this.handleExit()),y.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleExit())}),v.appendChild(y),e.push(v);const w=document.createElement("div");w.classList.add("checkout-completed-section-container");const C=document.createElement("p");C.classList.add("checkout-completed-auto-close-text"),C.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 k=document.createElement("span");if(k.classList.add("checkout-completed-auto-close-text"),k.textContent="seconds",w.appendChild(C),w.appendChild(this.autoCloseElement),w.appendChild(k),e.push(w),n.layout.showPoweredBy){const n=document.createElement("div");n.classList.add("checkout-completed-powered-by-container");const o=ComponentFactoryService.createElement({type:d.POWERED_BY,context:"checkout"});n.appendChild(o),e.push(n)}return e}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(e){const n=e.find(e=>"checkout.promoCode"===e.path),o=e.find(e=>"checkout.loading"===e.path);if(n){const{value:e,oldValue:o}=n,l=Boolean(o),d=Boolean(e);if(!l&&d)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(l&&!d)return this.container.innerHTML="",this.createInputContainer(),void 0;d&&this.promoCodeText&&e.discountAmount!==(null==o?void 0:o.discountAmount)&&(this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")")}o&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const e=this.promoInput.getValue().trim(),n=e.length>=3&&e.length<=255,o=this.getStoreValue("checkout.loading"),l=this.getStoreValue("checkout.promoCode"),d=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!n||o||Boolean(l)||Boolean(d)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:d.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:e=>{const n=e.toUpperCase(),o=this.promoInput;o.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const V=async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(e)}catch(n){this.logger.error("Checkout promo code application failed",{promoCode:e,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",V),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),V())}),this.applyButton}createAppliedContainer(e){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==e?void 0:e.code)+" (- "+formatCentToDollarText((null==e?void 0:e.discountAmount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(o),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const e=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,e){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(o),n}const n=[];return n.push(this.createPromoInput()),n.push(this.createApplyButton()),n}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const e=this.getStoreValue("checkout.isGift"),n=document.createElement("div");n.classList.add("gift-label-wrapper");const o=document.createElement("span");o.textContent="Send as Gift? (Free)",o.classList.add("gift-toggle-label"),n.appendChild(o);const l=document.createElement("span");l.textContent="With personalized note & gift receipt.",l.classList.add("gift-toggle-description"),n.appendChild(l);const d=document.createElement("div");d.classList.add("toggle-switch"),d.classList.toggle("active",e);const h=document.createElement("div");return h.classList.add("toggle-slider"),d.setAttribute("tabindex","0"),d.setAttribute("aria-label","Toggle Gift Option"),d.setAttribute("role","switch"),d.setAttribute("aria-checked",e?"true":"false"),d.appendChild(h),d.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),d.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.toggleIsGift())}),[n,d]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this.O=null,this.N=null,this.R=null,this.M=![],this.L=![],this.B=![],this.j=null}async initialize({data:e}){if(this.A)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=e.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.A=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const e=this.q;this.O=window.Stripe(e.publishableKey),this.N=this.O.elements({clientSecret:e.clientSecret,appearance:e.appearance}),this.R=this.N.create("payment",e.elementOptions),this.R.mount(this),this.R.on("change",async e=>{const n=!!e.error,o=e.complete,l=n?e.error.message:null;this.L=o,this.M||await this.updateStripeFormStatus({isFormComplete:o,isProcessing:![],hasCompletedPayment:![],errorMessage:l,hasError:n})}),this.R.on("focus",async()=>{this.M||await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.B=![]}catch(e){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),e}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(e){const{stripeConfig:n}=e.detail;n&&(this.q=n,await this.refreshPaymentSession())}async handleSubmit(){var e,n;if(this.M)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.L)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.M=!![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.B&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const e=await this.createConfirmationTokenId(),n=this.q.clientSecret,o=n.split("_secret_")[0];this.B=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:e,setupIntentId:o},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(o){console.error("Payment submission error:",o),this.B=!![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==o?void 0:o.message)||"Payment processing failed. Please try again."}),((null===(e=null==o?void 0:o.message)||void 0===e?void 0:e.includes("expired"))||(null===(n=null==o?void 0:o.message)||void 0===n?void 0:n.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.M=![]}}async requestSessionRefresh(){return this.j||(this.j=new Promise((e,n)=>{const o=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",T),this.j=null,n(new Error("Session refresh timeout"))},1e4),T=()=>{clearTimeout(o),this.removeEventListener("lce:s:refreshSession",T),this.j=null,e()};this.addEventListener("lce:s:refreshSession",T,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.j}async refreshPaymentSession(){try{this.N&&this.N.update({clientSecret:this.q.clientSecret}),this.B=![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(et){console.error("Failed to refresh payment session:",et),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.R&&this.R.clear(),this.L=![],this.B=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(et){console.error("Failed to reset form:",et)}}async updateStripeFormStatus(e){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:e},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.N)throw new SDKError("Payment elements not initialized");try{const{error:e}=await this.N.submit();if(e)throw new SDKError(e.message||"Failed to submit payment information");const n={elements:this.N,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:o,confirmationToken:l}=await this.O.createConfirmationToken(n);if(o)throw new SDKError(o.message||"Failed to create confirmation token");if(!l||!l.id)throw new SDKError("Invalid confirmation token received");return l.id}catch(e){if(e instanceof SDKError)throw e;throw new SDKError("Payment processing error: "+(e.message||"Unknown error"))}}async disconnected(){await this.cleanupForm()}disconnectedCallback(){this.cleanupForm().catch(e=>{console.error("Error during Stripe form disconnection cleanup:",e)})}async cleanupForm(){var e,n;try{this.j=null,this.R&&(this.R.unmount(),this.R=null),this.N&&(null===(n=(e=this.N).destroy)||void 0===n?void 0:n.call(e),this.N=null),this.O=null,this.M=![],this.L=![],this.B=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(o){console.warn("Error during Stripe form cleanup:",o)}}loadStripeJS(){return new Promise((e,n)=>{const o=document.querySelector('script[src*="stripe.com"]');if(o)return o.addEventListener("load",()=>e()),o.addEventListener("error",()=>n(new Error("Failed to load Stripe.js"))),void 0;const l=document.createElement("script");l.src="https://js.stripe.com/basil/stripe.js",l.async=!![],l.onload=()=>e(),l.onerror=()=>n(new Error("Failed to load Stripe.js")),document.head.appendChild(l)})}}class CheckoutStripeHandlerComponent extends BaseComponent{get hostClasses(){return["checkout-stripe-handler"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.paymentMethod","checkout.paymentForm.isEditing"]}),this.stripeFormElement=null,this.rootComponent=null,this.isCreatingStripeForm=![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},this.isInEditMode=![],this.savedCardInfo=null,this.isChangingPayment=![],this.callbacks={}}beforeConnected(){this.callbacks=this.params.callbacks||{}}onStoreWatch(e){for(const n of e)switch(n.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(n.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(n.value)}}handleSavedCardChange(e){var n,o,l,d;(null===(n=null==e?void 0:e.card)||void 0===n?void 0:n.brand)&&(null===(o=null==e?void 0:e.card)||void 0===o?void 0:o.last4)?this.savedCardInfo={brand:e.card.brand,last4:e.card.last4}:this.savedCardInfo=null,null===(d=(l=this.callbacks).onSavedCardInfoChanged)||void 0===d||d.call(l,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(e){this.isInEditMode=e,this.updateDisplayState()}updateDisplayState(){var e,n,o,l,d,h;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(n=(e=this.callbacks).onEditModeVisibilityChanged)||void 0===n||n.call(e,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(l=(o=this.callbacks).onEditModeVisibilityChanged)||void 0===l||l.call(o,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(e=>{this.logger.error("Failed to create stripe form in updateDisplayState",e)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(h=(d=this.callbacks).onEditModeVisibilityChanged)||void 0===h||h.call(d,![]))}async afterRender(){var e,n,o,l;this.isInEditMode=null!==(e=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==e?e:![];const d=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(n=null==d?void 0:d.card)||void 0===n?void 0:n.brand)&&d.card.last4&&(this.savedCardInfo={brand:d.card.brand,last4:d.card.last4}),null===(l=(o=this.callbacks).onSavedCardInfoChanged)||void 0===l||l.call(o,this.savedCardInfo),this.updateDisplayState(),(this.isInEditMode&&!this.savedCardInfo||this.isChangingPayment)&&await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",e=>{var n,o;this.stripeFormStatus=e.detail.status,null===(o=(n=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(n,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async e=>{var n,o,l,d,h;try{const{confirmationTokenId:l,setupIntentId:d}=e.detail;await(null===(o=(n=this.callbacks).onPaymentSessionConfirmed)||void 0===o?void 0:o.call(n,l,d)),this.isChangingPayment=![]}catch(u){this.logger.error("Failed to save payment form",u),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==u?void 0:u.message)||"Failed to save payment information. Please try again."},null===(d=(l=this.callbacks).onStripeFormStatusChanged)||void 0===d||d.call(l,this.stripeFormStatus),null===(h=this.stripeFormElement)||void 0===h||h.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var e;try{const n=await this.doStripeConfig();null===(e=this.stripeFormElement)||void 0===e?void 0:e.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:n}}))}catch(n){this.logger.error("Failed to refresh payment session",n)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const e=document.createElement("span");e.classList.add("stripe-summary-text"),e.textContent=capitalizeFirstLetter(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const n=document.createElement("button");n.type="button",n.classList.add("change-payment-link"),n.textContent="Change",n.setAttribute("aria-label","Change Payment Method"),n.setAttribute("role","button"),n.setAttribute("tabindex","0"),n.addEventListener("click",()=>this.handleChangePayment()),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(e,n),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var e,n;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(n=(e=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(e,this.stripeFormStatus),this.updateDisplayState()}template(){const e=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",e.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const n=document.createElement("slot");return n.setAttribute("name",mt),this.stripeFormContainer.appendChild(n),e.push(this.stripeFormContainer),e}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let e=this,n=null;for(;e&&e!==document.body;){const o=e.hasAttribute("checkout"),l=e.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(d.LCE_ELEMENT),h=e.hasAttribute("drawer"),u=(null==n?void 0:n.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(d.DRAWER),p="checkout"===(null==n?void 0:n.getAttribute("data-target"));if(o||l&&h&&u&&p)return this.rootComponent=e,e;n=e,e=e.parentElement||e.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){const e=this.store.get("checkout.paymentForm.paymentSession");!this.isChangingPayment&&(null==e?void 0:e.key)&&(null==e?void 0:e.secret)||await this.commands.checkout.getPaymentSession();const n=this.store.get("checkout.paymentForm.paymentSession"),o=this.getConfigs("global");return{publishableKey:n.key,clientSecret:n.secret,appearance:{theme:"stripe",variables:{fontFamily:o.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:o.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===o.layout.inputFieldStyle?"none":"1px solid "+o.theme.accentColor,backgroundColor:"filled"===o.layout.inputFieldStyle?o.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var e,n,o;if(this.isCreatingStripeForm)return this.logger.info("Stripe form creation already in progress, skipping"),void 0;if(this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment)return this.logger.info("In edit mode with saved card, skipping stripe form creation"),void 0;const l=this.findRootComponent();if(!l)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(e=this.stripeFormElement)||void 0===e?void 0:e.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const h=l.querySelectorAll('[slot="'+mt+'"]');if(h.length>0)for(const d of h)d.remove();this.isCreatingStripeForm=!![];try{const e=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:d.CHECKOUT_STRIPE_FORM,stripeConfig:e}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",mt),l.appendChild(this.stripeFormElement)}catch(u){this.logger.error("Stripe form element creation failed",u),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(o=(n=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(n,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var e;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(e=super.disconnected)||void 0===e||e.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const e=this.getStoreValue("checkout.tipSelection");return null!=e?e:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(e){const n=this.getStoreValue("checkout.updating")||![];if(!n)try{await this.commands.checkout.updateTips(e)}catch(o){this.logger.error("Checkout tips update failed",o)}}async handleFulfillmentTipInput(e,n){const o=this.getStoreValue("checkout.updating")||![];if(o)return;const l=this.getOnDemandFulfillmentTipInfo();if(!l[e])return;const d=Math.round(100*n);try{await this.commands.checkout.updateFulfillmentTip(e,d)}catch(h){this.logger.error("Checkout fulfillment tip update failed",h)}}async removeTipFromFulfillment(e){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const o=this.getOnDemandFulfillmentTipInfo();if(o[e])try{await this.commands.checkout.removeFulfillmentTip(e)}catch(l){this.logger.error("Checkout fulfillment tip removal failed",l)}}createTipSelectionButtons(){const e=document.createElement("div");e.classList.add("checkout-tip-selection-container");const n=[10,18,20],o=this.getStoreValue("checkout.updating")||![],l=this.getTipSelection();for(const d of n){const n=document.createElement("button");n.type="button",n.textContent=d+"%",n.classList.add("checkout-tip-button"),n.disabled=o,l===d&&n.classList.add("selected"),n.addEventListener("click",()=>this.handlePercentageSelect(d)),e.appendChild(n)}return e}setupToggler(){const e=this.container.querySelector(".checkout-tip-distribution-header"),n=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".retailers-tips-list");e&&n&&o&&e.addEventListener("click",()=>{const e=o.classList.contains("show");o.classList.toggle("show"),e?(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-label","Expand tips section")):(n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse tips section")),n.classList.toggle("expanded")})}createTipDistribution(){const e=document.createElement("section");e.classList.add("checkout-tip-distribution-container");const n=this.getFulfillmentTipInfoArray();if(0===n.length)return e;const o=document.createElement("div");o.classList.add("checkout-tip-distribution-header");const l=document.createElement("h3");l.textContent="View Tip Distribution",l.classList.add("checkout-sub-header"),o.appendChild(l);const d=document.createElement("button");d.type="button",d.classList.add("checkout-items-toggler-button"),d.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),o.appendChild(d),e.appendChild(o);const h=document.createElement("div");h.classList.add("retailers-tips-list","show");for(const u of n){const e=document.createElement("div");e.classList.add("checkout-tip-distribution-item");const n=document.createElement("h4");n.textContent=u.retailerName,n.classList.add("checkout-sub-header"),e.appendChild(n);const o=document.createElement("div");o.classList.add("checkout-tip-fulfillment-input-wrapper");const l=document.createElement("div");l.classList.add("dollar-input-container");const d=document.createElement("span");d.classList.add("dollar-sign"),d.textContent="$";const p=document.createElement("input");let m;p.type="number",p.id="tip-input-"+u.fulfillmentId,p.name="tip-"+u.fulfillmentId,p.min="0",p.step="0.01",p.placeholder="0.00",p.classList.add("dollar-input"),p.value=u.tip>0?(u.tip/100).toFixed(2):"",p.disabled=this.getStoreValue("checkout.updating")||![],p.addEventListener("wheel",e=>{e.preventDefault()}),p.addEventListener("keydown",e=>{"-"!==e.key&&"+"!==e.key||e.preventDefault()}),p.addEventListener("keydown",e=>{"ArrowUp"!==e.key&&"ArrowDown"!==e.key||e.preventDefault()}),p.addEventListener("paste",e=>{e.preventDefault()}),p.addEventListener("contextmenu",e=>{e.preventDefault()}),p.addEventListener("input",e=>{const n=e.target;let o=n.value;if(Number.parseFloat(o)<0&&(n.value=Math.abs(Number.parseFloat(o)).toString(),o=n.value),o.includes(".")){const e=o.split(".");e.length>1&&e[1].length>2&&(n.value=e[0]+"."+e[1].substring(0,2))}}),p.addEventListener("input",e=>{const n=e.target,o=Number.parseFloat(n.value)||0;m&&clearTimeout(m),m=setTimeout(()=>{this.handleFulfillmentTipInput(u.fulfillmentId,o)},500)}),l.appendChild(d),l.appendChild(p),o.appendChild(l);const v=document.createElement("button");v.type="button",v.textContent="Remove",v.classList.add("checkout-tip-remove-button"),v.disabled=this.getStoreValue("checkout.updating")||![],v.addEventListener("click",()=>this.removeTipFromFulfillment(u.fulfillmentId)),o.appendChild(v),e.appendChild(o),h.appendChild(e)}return e.appendChild(h),e}async initializeDefaultTip(){if(this.isInitialized)return;const e=this.getStoreValue("checkout.tipSelection"),n=this.getFulfillmentTipInfoArray();if(e&&n.length>0){const e=n.some(e=>e.tip>0);if(e)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(o){this.logger.error("Default tip initialization failed",o),this.isInitialized=![]}}if(null==e)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(l){this.logger.error("Default tip initialization failed during fallback",l),this.isInitialized=![]}}template(){const e=[],n=this.getFulfillmentTipInfoArray();if(0===n.length)return e;n.length>0&&this.initializeDefaultTip();const o=document.createElement("section");o.classList.add("checkout-tip-container");const l=document.createElement("h3");l.classList.add("checkout-sub-header"),l.textContent="Add a tip",o.appendChild(l);const d=document.createElement("div");d.classList.add("checkout-tip-config-container");const h=this.createTipSelectionButtons();d.appendChild(h),o.appendChild(d);const u=document.createElement("p");u.classList.add("checkout-tip-disclaimer"),u.textContent="Tips will be split proportionally between retailers.",o.appendChild(u);const p=this.createTipDistribution();return e.push(o,p),e}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(e){var n,o;const l=e.find(e=>"checkout.giftCardError"===e.path),d=e.find(e=>"checkout.promoCodeError"===e.path),h=e.find(e=>"checkout.giftCards"===e.path);if(h&&this.updateAppliedGiftCards(h.value),l){const e=this.container.querySelector(".input-gift-card-container");if(e){const o=e.nextElementSibling;if((null===(n=null==o?void 0:o.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==o?void 0:o.remove()),l.value){const n=this.createErrorElement(l.value);e.after(n)}const d=e.querySelector(".apply-button");d&&(d.disabled=Boolean(l.value))}}if(d){const e=this.container.querySelector(".input-promo-code-container");if(e){const n=e.nextElementSibling;if((null===(o=null==n?void 0:n.classList)||void 0===o?void 0:o.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),d.value){const n=this.createErrorElement(d.value);e.after(n)}const l=e.querySelector(".apply-button");l&&(l.disabled=Boolean(d.value))}}}updateAppliedGiftCards(e){const n=e&&e.length>0;if(!n)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",e.forEach(e=>{const n=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(n)})}createAppliedGiftCardElement(e){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),n.setAttribute("data-gift-card-code",e.code);const o=document.createElement("span");o.textContent=e.code+" (- "+formatCentToDollarText(e.discountAmount)+")",n.appendChild(o);const l=document.createElement("button");return l.type="button",l.textContent="Remove",l.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(e.code)}),n.appendChild(l),n}pcInputContainer(){const e=ComponentFactoryService.createElement({type:d.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return e}gcInputContainer(){const e=ComponentFactoryService.createElement({type:d.CHECKOUT_GIFT_CARDS});return e}inputContainer(){var e;const n=this.getConfigs("checkout"),o=this.getConfigs("global"),l=n.layout.allowGiftCards,d=null===(e=null==o?void 0:o.layout)||void 0===e?void 0:e.allowPromoCodes,h=document.createElement("div");h.classList.add("checkout-pc-gc-sub-container");const u=this.pcInputContainer(),p=this.gcInputContainer();d&&h.appendChild(u);const m=this.getStoreValue("checkout.promoCodeError");if(m){const e=this.createErrorElement(m);e.classList.add("promo-code-error-wrapper"),h.appendChild(e)}l&&h.appendChild(p);const v=this.getStoreValue("checkout.giftCardError");if(v){const e=this.createErrorElement(v);h.appendChild(e)}return h}createErrorElement(e){const n=document.createElement("div");n.classList.add("error-banner-checkout");const o=document.createElement("div");o.innerHTML=ErrorInfoIcon({});const l=document.createElement("p");return l.textContent=e.toString(),n.appendChild(o),n.appendChild(l),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),n.remove()},3e3),n}template(){const e=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const n=[];return n.push(this.inputContainer()),e&&e.length>0&&(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),e.forEach(e=>{const n=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(n)}),n.push(this.appliedGiftCardsContainer)),n}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:e,selectedFulfillmentType:n,isSelected:o,selectedSizeAttributes:l}){var d,u,p,m,v,y,b,x;const w=n===h.ON_DEMAND;let C=null;w&&e.hourStatus.openTime&&(null===(d=e.hourStatus)||void 0===d?void 0:d.closeTime)&&(C=e.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(u=e.hourStatus)||void 0===u?void 0:u.closeTime):"Opens at "+format24TimeTo12(null===(p=e.hourStatus)||void 0===p?void 0:p.openTime));const k=w&&e.hourStatus.isClosed?"closed":"",S=document.createElement("div");S.className="popup-retailer-card "+(o?"selected":"")+" "+k,S.setAttribute("data-fulfillment-id",e.id),S.setAttribute("role","button"),S.setAttribute("tabindex","0"),S.setAttribute("aria-pressed",o?"true":"false");const _=n===h.SHIPPING?"Shipping":"Same-day delivery";S.setAttribute("aria-label",_+" from "+e.retailerName+", "+formatCentToDollarText(null!==(m=e.variant.price)&&void 0!==m?m:0));const D=document.createElement("div");D.className="row";const I=document.createElement("span");I.className="name",I.textContent=e.retailerName,D.appendChild(I);const A=document.createElement("span");A.className="price",A.textContent=formatCentToDollarText(null!==(v=e.variant.price)&&void 0!==v?v:0),D.appendChild(A),S.appendChild(D);const O=document.createElement("div");O.className="row";const z=document.createElement("span");z.className="expectation",z.textContent=e.hourStatus.isClosed?C:(null===(y=null==l?void 0:l.presale)||void 0===y?void 0:y.isActive)?(null===(b=null==l?void 0:l.presale)||void 0===b?void 0:b.isActive)&&(null===(x=null==l?void 0:l.presale)||void 0===x?void 0:x.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==l?void 0:l.presale.estimatedShipBy):"":null==e?void 0:e.expectationText,O.appendChild(z);const N=document.createElement("span");if(N.className="fee",N.textContent=e.fee>0?formatCentToDollarText(e.fee):"Free Delivery",O.appendChild(N),S.appendChild(O),w){const n=document.createElement("div");n.className="row";const o=document.createElement("span");o.className="address",o.textContent=e.retailerAddressFormatted,n.appendChild(o),S.appendChild(n)}return S}function renderFulfillmentTabsContainer({shippingFulfillments:e,onDemandFulfillments:n,shippingSelected:o,onDemandSelected:l,onTabClick:d,enableShippingFulfillment:u,enableOnDemandFulfillment:p}){const m=n.length>0,v=document.createElement("div");if(v.className="fulfillment-tabs-container",v.setAttribute("role","tablist"),v.setAttribute("aria-label","Delivery method options"),u){const n=document.createElement("div");n.className="fulfillment-tab "+(o?"selected":""),n.setAttribute("data-fulfillment-type",h.SHIPPING),n.setAttribute("role","tab"),n.setAttribute("tabindex","0"),n.setAttribute("aria-selected",o?"true":"false"),n.setAttribute("aria-label","Shipping, "+e.length+" options"),n.addEventListener("click",d),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n.click())});const l=document.createElement("span");l.className="fulfillment-tab-label "+(o?"selected":""),l.textContent="Shipping ("+e.length+")",n.appendChild(l),v.appendChild(n)}if(p){const e=document.createElement("div");e.className="fulfillment-tab "+(l?"selected":"")+" "+(m?"":"disabled"),e.setAttribute("data-fulfillment-type",h.ON_DEMAND),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",l?"true":"false"),e.setAttribute("aria-label","Same-day delivery, "+n.length+" options"),m||e.setAttribute("aria-disabled","true"),e.addEventListener("click",d),e.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.click())});const o=document.createElement("span");o.className="fulfillment-tab-label "+(l?"selected":""),o.textContent="Same-Day Delivery ("+n.length+")",e.appendChild(o),v.appendChild(e)}return v}class ProductAddToCartSectionComponent extends BaseComponent{get hostClasses(){return["add-to-cart-container"]}get hostAttributes(){return{role:"region","aria-live":"polite","aria-atomic":"false","aria-label":"Add to cart section"}}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var e;const n=this.getProductId(),o=this.getStoreValue("products."+n);if(!o.selectedFulfillment||!o.selectedSizeId)return 0;const l=o.selectedFulfillment.variant.partNumber,d=o.selectedFulfillment.id,h=null===(e=o.sizes[o.selectedSizeId])||void 0===e?void 0:e.maxQuantityPerOrder;if(!h)return 0;const u=this.getStoreValue("cart.items")||{},p=Object.values(u).filter(e=>e.partNumber===l&&e.fulfillmentId===d),m=p.reduce((e,n)=>e+n.quantity,0);return h-m}isFulfillmentClosed(){const e=this.getProductId(),n=this.getStoreValue("products."+e);return n.selectedFulfillment?n.selectedFulfillmentType===h.ON_DEMAND&&n.selectedFulfillment.hourStatus.isClosed:![]}isButtonLoading(){const e=this.getProductId();return this.getStoreValue("products."+e+".updating")}calculateQuantityLimits(){const{quantity:e}=this.calculateTotalPrice(),n=this.getAvailableQuantity(),o=e<n;return{currentQuantity:e,availableQuantity:n,canIncrease:o,canDecrease:e>1}}async handleAddToCart(){var e,n,o;const l=this.getProductId(),d=this.getStoreValue("products."+l);if(!d.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:l,selectedSizeId:d.selectedSizeId}),void 0;const h=this.getSizeAttributes(),u=(null===(e=null==h?void 0:h.presale)||void 0===e?void 0:e.isActive)===!![],p=this.isPresaleActive(h);u&&p?await this.commands.product.addPresaleToCart(l,{fulfillmentId:d.selectedFulfillment.id,partNumber:null===(n=d.selectedFulfillment)||void 0===n?void 0:n.variant.partNumber,quantity:d.quantity,identifier:l}):await this.commands.product.addToCart(l,{fulfillmentId:d.selectedFulfillment.id,partNumber:null===(o=d.selectedFulfillment)||void 0===o?void 0:o.variant.partNumber,quantity:d.quantity,identifier:l})}async handleQuantityChange(e){const n=this.getProductId();await this.commands.product.updateQuantity(n,e)}calculateTotalPrice(){const e=this.getProductId(),n=this.getStoreValue("products."+e),o=n.selectedFulfillment,l=o.variant.price*n.quantity;return{quantity:n.quantity,totalPrice:l}}createQuantityContainer(e){const n=this.calculateQuantityLimits(),o=document.createElement("div");return o.className="quantity-container "+e,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!n.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!n.canDecrease).toString()),n.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=n.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+n.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!n.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!n.canIncrease).toString()),n.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleQuantityChange(1)}),o.appendChild(this.qtyDecreaseButton),o.appendChild(this.quantityText),o.appendChild(this.qtyIncreaseButton),o}getSizeAttributes(){const e=this.getProductId(),n=this.getStoreValue("products."+e+".selectedSizeId"),o=this.getStoreValue("products."+e+".sizes."+n);return(null==o?void 0:o.attributes)||{}}isPresaleActive(e){const n=null==e?void 0:e.presale;if(!n)return![];if(!n.isActive)return![];if(n.canPurchaseOn){const e=new Date(n.canPurchaseOn),o=new Date;if(o.getTime()<e.getTime())return![]}return!![]}createAddToCartButton(){var e;const{totalPrice:n}=this.calculateTotalPrice(),o=this.getSizeAttributes(),l=this.calculateQuantityLimits(),d=(null===(e=null==o?void 0:o.presale)||void 0===e?void 0:e.isActive)===!![],h=this.isPresaleActive(o),u=d?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?u+" - "+formatCentToDollarText(n):u;const p=d&&!h||0===l.availableQuantity||this.isFulfillmentClosed(),m=this.isButtonLoading(),v=this.config.layout.addToCartButtonShowTotalPrice?u+" for "+formatCentToDollarText(n):u;return this.addToCartButton.setAttribute("aria-label",v),this.addToCartButton.setAttribute("aria-busy",m.toString()),this.addToCartButton.setAttribute("aria-disabled",p.toString()),p&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),m&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async e=>{if(e.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const e=this.getProductId(),n=this.getStoreValue("products."+e+".fulfillmentHasAvailability"),o=this.getConfigs("configurations");if(!n||!o.isElementsEnabled)return[];const l=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer(this.config.layout.quantityCounterStyle);l.push(e)}const d=this.createAddToCartButton();return l.push(d),l}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const e=this.params.productId,n=this.getStoreValue("products."+e+".description"),o=this.getStoreValue("products."+e+".htmlDescription"),l="About this product:",d="See More",h="See Less",u=document.createElement("h3");u.className="title",u.textContent=l;const p=document.createElement("div");p.className="content collapsed",p.innerHTML=""===(null==o?void 0:o.trim())?n:sanitizeHTML(o);const m=document.createElement("span");m.className="collapse-button",m.textContent=d,m.setAttribute("role","button"),m.setAttribute("tabindex","0"),m.setAttribute("aria-label","Show more product information"),m.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,p.classList.toggle("collapsed"),m.textContent=this.isCollapsed?d:h,m.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),m.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return m.addEventListener("click",toggleContent),m.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),toggleContent())}),[u,p,m]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(e){var n;const o=e.find(e=>e.path==="products."+this.getProductId()+".drawer");if(!o)return![];const l=o.value,d=l.isOpen,h=null===(n=l.contentConfig)||void 0===n?void 0:n.type,u=h!==this.currentContentType;return d&&!this.isOpen?(this.currentContentType=h,this.openWithContent(l),![]):d&&this.isOpen&&!u?![]:d&&this.isOpen&&u?(this.currentContentType=h,this.openWithContent(l),![]):!d&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:e}){const n=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!e)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:n}),void 0;const{type:o,data:l}=e||{},d=ComponentFactoryService.createElement({type:o,...l});this.contentContainer&&this.contentContainer.appendChild(d),this.open()}catch(o){this.logger.error("Failed to open product drawer",o),this.commands.product.closeProductDrawer(n)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const e=document.createElement("div");return e.classList.add("product-drawer-content"),this.contentContainer=e,e}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const e=this.config.layout.fulfillmentDisplay,n=this.config.layout.showOnlyMainImage?"only-main-image":"with-thumbnails";return["product-image-carousel",e,n]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedSizeId"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(e){var n;const o=this.params.productId,l=e.find(e=>e.path==="products."+o+".selectedSizeId");if(null==l?void 0:l.value){const e=this.getStoreValue("products."+o),d=null===(n=null==e?void 0:e.sizes)||void 0===n?void 0:n[l.value],h=null==d?void 0:d.image;if(h){const e=this.params.images.indexOf(h);-1!==e?this.selectImage(e):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+h+"')")}}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let n=0;n<this.thumbnails.length;n++){const e=this.thumbnails[n];e.addEventListener("click",()=>{this.hasMoved||this.selectImage(n)})}const e=this.container.querySelectorAll(".carousel-dot");for(let n=0;n<e.length;n++){const o=e[n];o.addEventListener("click",()=>this.selectImage(n))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(e){var n,o;if(e<0||e>=this.params.images.length)return;this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+this.params.images[e]+"')",this.mainImageElement.title="Product image "+(e+1)),null===(n=this.thumbnails[this.currentImageIndex])||void 0===n||n.classList.remove("selected"),null===(o=this.thumbnails[e])||void 0===o||o.classList.add("selected");const l=this.container.querySelectorAll(".carousel-dot");for(let d=0;d<l.length;d++){const n=l[d];n.classList.toggle("active",d===e)}this.currentImageIndex=e,this.galleryViewport&&this.scrollToIndex(e)}scrollToIndex(e){if(!this.galleryViewport||!this.thumbnails[e])return;const n=this.thumbnails[e],o=this.galleryViewport.offsetWidth,l=n.offsetLeft+n.offsetWidth/2,d=o/2,h=d-l,u=0,p=-(this.galleryContainer.scrollWidth-o);this.translateX=Math.max(p,Math.min(u,h)),this.updateTransform(!![])}setupMainImageSwipe(){var e,n;let o=0,l=0;null===(e=this.mainImageElement)||void 0===e?void 0:e.addEventListener("touchstart",e=>{o=e.touches[0].clientX,l=e.touches[0].clientY},{passive:!![]}),null===(n=this.mainImageElement)||void 0===n||n.addEventListener("touchend",e=>{const n=e.changedTouches[0].clientX-o,d=e.changedTouches[0].clientY-l;Math.abs(n)>Math.abs(d)&&Math.abs(n)>50&&(n>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const e of this.galleryContainer.querySelectorAll("img"))e.addEventListener("dragstart",e=>e.preventDefault())}}handleDragStart(e){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in e?e.touches[0].clientX:e.clientX,this.currentTranslateX=this.translateX,this.galleryContainer&&(this.galleryContainer.style.cursor="grabbing")}handleDragMove(e){if(!this.isDragging||!this.galleryViewport)return;"touchmove"===e.type&&e.preventDefault();const n="touches"in e?e.touches[0].clientX:e.clientX,o=n-this.startX;Math.abs(o)>5&&(this.hasMoved=!![]);const l=this.currentTranslateX+o,d=0,h=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(h,Math.min(d,l)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(e){this.galleryContainer&&(this.galleryContainer.style.transition=e?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const e=[],n=this.params.images.length>1,o=this.config.layout.showOnlyMainImage,l=document.createElement("div");if(l.className="main-image",l.title="Product main image",l.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",n&&!o){const e=document.createElement("div");e.className="carousel-dots";for(let n=0;n<this.params.images.length;n++){const o=document.createElement("button");o.type="button",o.className="carousel-dot "+(0===n?"active":""),o.setAttribute("data-index",n.toString()),e.appendChild(o)}l.appendChild(e)}if(this.mainImageElement=l,e.push(l),!o){const n=document.createElement("div");n.className="gallery-viewport";const o=document.createElement("div");o.className="gallery-container";for(let e=0;e<this.params.images.length;e++){const n=this.params.images[e],l=document.createElement("div");l.className="gallery-image-wrapper "+(0===e?"selected":"");const d=document.createElement("img");d.src=n,d.className="gallery-image",d.alt="Product thumbnail "+(e+1),d.loading="lazy",l.appendChild(d),o.appendChild(l)}n.appendChild(o),e.push(n)}return e}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(e){var n;const o=this.getProductId();if(!e.some(e=>e.path==="products."+o+".selectedFulfillmentType"))return;const l=this.getStoreValue("products."+o),d=this.getConfigs("global");this.addPersonalizationSpan&&(l.selectedFulfillmentType===h.SHIPPING&&d.layout.enablePersonalization&&l.productHasAvailability&&(null===(n=null==l?void 0:l.selectedFulfillment)||void 0===n?void 0:n.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const e=this.getProductId(),n=this.container.querySelectorAll("[select-size]");for(const o of n){const l=o.textContent||"",d=o.classList.contains("selected");o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Select "+l),o.setAttribute("aria-pressed",d?"true":"false"),o.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),o.click())}),o.addEventListener("click",async()=>{var l;const d=o.dataset.sizeId;if(!d)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:e,buttonElement:o.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(e,d);for(const e of n)e.classList.remove("selected"),e.setAttribute("aria-pressed","false");o.classList.add("selected"),o.setAttribute("aria-pressed","true");const h=this.getStoreValue("products."+e),u=this.getConfigs("global");this.addPersonalizationSpan&&(u.layout.enablePersonalization&&h.productHasAvailability&&(null===(l=h.selectedFulfillment)||void 0===l?void 0:l.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(e,n){const o=document.createElement("div");o.className="size-container";const l=document.createElement("h3");l.className="size-label",l.textContent="Size",l.id="size-label",o.appendChild(l);const d=document.createElement("div");d.className="size-buttons-container",d.setAttribute("role","group"),d.setAttribute("aria-labelledby","size-label");for(const h of Object.values(n)){const n=document.createElement("span");n.setAttribute("data-size-id",h.id),n.setAttribute("select-size",""),n.className="size-button "+(h.id===e?"selected":"");const o=h.packDesc?" ("+h.packDesc+")":"";n.textContent=""+h.size+o,d.appendChild(n)}return o.appendChild(d),o}hasIndependentAddressComponent(){var e;return(null===(e=null===document||void 0===document?void 0:document.querySelectorAll("lce-element[address]"))||void 0===e?void 0:e.length)>0}template(){var e,n;const o=this.getProductId(),l=this.getStoreValue("products."+o),h=l.sizes[l.selectedSizeId],u=this.getConfigs("global"),p=[],m=document.createElement("div");m.className="price-personalization-container";const v=ComponentFactoryService.createElement({type:d.PRODUCT_PRICE,productId:o});if(m.appendChild(v),u.layout.enablePersonalization&&l.productHasAvailability&&(null===(e=null==l?void 0:l.selectedFulfillment)||void 0===e?void 0:e.variant.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var e,n,h,u,p,m,v,y;const b=l.sizes[l.selectedSizeId];await this.commands.product.openProductDrawer(o,d.ENGRAVING_FORM,{identifier:o,context:"product",lines:[],maxLines:(null===(n=null===(e=b.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.maxLines)||1,maxCharsPerLine:(null===(u=null===(h=b.attributes)||void 0===h?void 0:h.engraving)||void 0===u?void 0:u.maxCharsPerLine)||16,fee:(null===(m=null===(p=b.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.fee)||0,location:null===(y=null===(v=b.attributes)||void 0===v?void 0:v.engraving)||void 0===y?void 0:y.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await addPersonalization())}),m.appendChild(this.addPersonalizationSpan)}p.push(m);const y=this.renderProductSizes(l.selectedSizeId,l.sizes);if(p.push(y),!this.hasIndependentAddressComponent()){const e=ComponentFactoryService.createElement({type:d.ADDRESS_DISPLAY,productId:o});p.push(e)}const b=ComponentFactoryService.createElement({type:d.PRODUCT_RETAILERS,productId:o});p.push(b);const x=ComponentFactoryService.createElement({type:d.PRODUCT_ADD_TO_CART_SECTION,productId:o});p.push(x);const w=null===(n=null==h?void 0:h.attributes)||void 0===n?void 0:n.presale;if((null==w?void 0:w.isActive)===!![]&&(null==w?void 0:w.language)){const e=document.createElement("div");e.className="product-presale-notice",e.innerHTML=sanitizeHTML((null==w?void 0:w.language)||""),p.push(e)}if(this.config.layout.showDescription&&(l.description.trim().length>0||l.htmlDescription.trim().length>0)){const e=ComponentFactoryService.createElement({type:d.PRODUCT_DESCRIPTION,productId:o});p.push(e)}return p}}class ProductLoadingComponent extends BaseComponent{template(){const e=Boolean(this.getStoreValue("address")),{showTitle:n,showDescription:o,showQuantityCounter:l,fulfillmentDisplay:d,showImages:h,showOnlyMainImage:u}=this.config.layout,p=document.createElement("div");p.classList.add("product-content-wrapper");const m=document.createElement("div");if(m.classList.add("skeleton-container"),n){const e=document.createElement("div");e.classList.add("wave","sc-title"),m.appendChild(e)}if(!e){const e=document.createElement("div");return e.classList.add("wave","sc-add-to-cart"),m.appendChild(e),m}const v=document.createElement("div");v.classList.add("wave","sc-price"),m.appendChild(v);const y=document.createElement("div");y.classList.add("sc-sizes");const b=document.createElement("div");b.classList.add("wave","sc-size-button"),y.appendChild(b);const x=document.createElement("div");x.classList.add("wave","sc-size-button"),y.appendChild(x);const w=document.createElement("div");w.classList.add("wave","sc-size-button"),y.appendChild(w);const C=document.createElement("div");C.classList.add("wave","sc-size-button"),y.appendChild(C);const k=document.createElement("div");k.classList.add("wave","sc-size-button"),y.appendChild(k),m.appendChild(y);const S=document.createElement("div");S.classList.add("sc-row");const _=document.createElement("div");_.classList.add("wave","sc-price"),S.appendChild(_);const D=document.createElement("div");D.classList.add("wave","sc-personalization"),S.appendChild(D),m.appendChild(S);const I=document.createElement("div");I.classList.add("wave","sc-deliver-to"),m.appendChild(I);const A=document.createElement("div");A.classList.add("wave","sc-address"),m.appendChild(A);const O=document.createElement("div");O.classList.add("wave","sc-retailers",d),m.appendChild(O);const z=document.createElement("div");if(z.classList.add("sc-row"),l){const e=document.createElement("div");e.classList.add("wave","sc-quantity"),z.appendChild(e)}const N=document.createElement("div");if(N.classList.add("wave","sc-add-to-cart"),z.appendChild(N),m.appendChild(z),o){const e=document.createElement("div");e.classList.add("wave","sc-description-title"),m.appendChild(e);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),m.appendChild(n);const o=document.createElement("div");o.classList.add("wave","sc-description-line"),m.appendChild(o);const l=document.createElement("div");l.classList.add("wave","sc-description-line"),m.appendChild(l);const d=document.createElement("div");d.classList.add("wave","sc-description-more"),m.appendChild(d)}const M=document.createElement("div");if(M.classList.add("product-content"),M.appendChild(m),p.appendChild(M),h){p.classList.add("has-images");const e=this.createImageSkeletons(u);p.prepend(e)}return p}createImageSkeletons(e){const n=document.createElement("div");n.classList.add("product-image-carousel","skeleton");const o=document.createElement("div");if(o.classList.add("wave","sc-main-image"),o.title="Product main image loading",!e){const e=document.createElement("div");e.classList.add("carousel-dots");for(let n=0;n<3;n++){const n=document.createElement("div");n.classList.add("wave","sc-carousel-dot"),e.appendChild(n)}o.appendChild(e)}if(n.appendChild(o),!e){const e=document.createElement("div");e.classList.add("gallery-viewport");const o=document.createElement("div");o.classList.add("gallery-container");for(let n=0;n<4;n++){const e=document.createElement("div");e.classList.add("gallery-image-wrapper");const n=document.createElement("div");n.classList.add("wave","sc-gallery-thumbnail"),e.appendChild(n),o.appendChild(e)}e.appendChild(o),n.appendChild(e)}return n}}class ProductOptionsComponent extends BaseComponent{get hostClasses(){return["product-options"]}constructor(){super({watchStorePaths:["address"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen"]})}getProductId(){return this.params.productId}onStoreWatch(e){const n=this.getProductId(),o=e.find(e=>e.path==="products."+n+".drawer.isOpen");if(o){const e=o.value===!![];e&&this.addHostClasses("hide-content"),e||this.removeHostClasses("hide-content")}}template(){const e=this.getProductId(),n=this.getStoreValue("address.formattedAddress");if(n)return ComponentFactoryService.createElement({type:d.PRODUCT_INTERACTIONS,productId:this.getProductId()});const o=document.createElement("button");return o.type="button",o.className="product-options-open-address-button",o.textContent=this.config.layout.buyNowButtonText,o.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(d.ADDRESS_INPUT,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,d.ADDRESS_INPUT,{productId:e})}),o}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const e=this.getProductId(),n=this.getStoreValue("products."+e);let o=n.noAvailabilityPrice;return n.selectedFulfillment&&(o=n.selectedFulfillment.variant.price),formatCentToDollarText(o)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const e=this.getProductId(),n=this.getStoreValue("products."+e),o=this.getConfigs("product"),l=[],h=this.getConfigs("configurations");if(!n.productHasAvailability||!h.isElementsEnabled){const e=document.createElement("p");return e.className="product-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),l.push(e),l}const u="carousel"===o.layout.fulfillmentDisplay?d.PRODUCT_RETAILERS_CAROUSEL:d.PRODUCT_RETAILERS_POPUP,p=ComponentFactoryService.createElement({type:u,productId:e});return l.push(p),l}}class ProductRetailersCarouselComponent extends BaseComponent{get hostClasses(){return["retailers-container","carousel"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.fulfillmentHasAvailability"],watchOnlyStorePaths:["products.{productId}.selectedFulfillmentId"]}),this.listViewport=null,this.listContainer=null,this.retailerCards=[],this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupDrag();const e=this.retailerCards.findIndex(e=>e.classList.contains("selected"));-1!==e&&this.scrollToIndex(e)}cacheElements(){this.retailerCards=Array.from(this.container.querySelectorAll(".carousel-retailer-card"))}getProductId(){return this.params.productId}onStoreWatch(e){const n=this.getProductId(),o=e.find(e=>e.path==="products."+n+".selectedFulfillmentId");(null==o?void 0:o.value)&&this.updateSelectedCard(o.value)}updateSelectedCard(e){for(const o of this.retailerCards)o.classList.remove("selected"),o.setAttribute("aria-pressed","false");const n=this.retailerCards.findIndex(n=>n.dataset.fulfillmentId===e);-1!==n&&(this.retailerCards[n].classList.add("selected"),this.retailerCards[n].setAttribute("aria-pressed","true"),this.scrollToIndex(n))}scrollToIndex(e){if(!this.listViewport||!this.retailerCards[e])return;const n=this.retailerCards[e],o=this.listViewport.offsetWidth,l=n.offsetLeft+n.offsetWidth/2,d=o/2,h=d-l,u=0,p=-(this.listContainer.scrollWidth-o);this.translateX=Math.max(p,Math.min(u,h)),this.updateTransform(!![])}setupDrag(){this.listContainer&&(this.listContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.listContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this)))}handleDragStart(e){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in e?e.touches[0].clientX:e.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(e){if(!this.isDragging||!this.listViewport)return;"touchmove"===e.type&&e.preventDefault();const n="touches"in e?e.touches[0].clientX:e.clientX,o=n-this.startX;Math.abs(o)>5&&(this.hasMoved=!![]);const l=this.currentTranslateX+o,d=0,h=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(h,Math.min(d,l)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(e){this.listContainer&&(this.listContainer.style.transition=e?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(e){const n=this.getProductId(),o=e.currentTarget.dataset.fulfillmentType;if(!o)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:n,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(n,o)}async onRetailerCardClick(e){if(this.hasMoved)return;const n=this.getProductId(),o=e.currentTarget.dataset.fulfillmentId;if(!o)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:n,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;const l=this.getStoreValue("products."+n+".selectedFulfillment");if(l&&l.id===o)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:n,fulfillmentId:o}),void 0;await this.commands.product.selectFulfillment(n,o)}generateRetailerCard({fulfillment:e,selectedFulfillmentType:n,isSelected:o,selectedSizeAttributes:l}){var d,u,p,m,v,y,b,x;const w=n===h.ON_DEMAND;let C=null;w&&e.hourStatus.openTime&&(null===(d=e.hourStatus)||void 0===d?void 0:d.closeTime)&&(C=e.hourStatus.isOpen?"Closes at "+format24TimeTo12(null===(u=e.hourStatus)||void 0===u?void 0:u.closeTime):"Opens at "+format24TimeTo12(null===(p=e.hourStatus)||void 0===p?void 0:p.openTime));const k=w&&e.hourStatus&&e.hourStatus.isClosed?"closed":"",S=document.createElement("div");S.className="carousel-retailer-card "+(o?"selected":"")+" "+k,S.setAttribute("data-fulfillment-id",e.id),S.setAttribute("role","button"),S.setAttribute("tabindex","0"),S.setAttribute("aria-pressed",o?"true":"false");const _=n===h.SHIPPING?"Shipping":"Same-day delivery";S.setAttribute("aria-label",_+" from "+e.retailerName+", "+formatCentToDollarText(null!==(m=e.variant.price)&&void 0!==m?m:0));const D=document.createElement("div");D.className="retailer-header";const I=document.createElement("h3");if(I.className="name",I.textContent=e.retailerName,D.appendChild(I),w){const n=document.createElement("h3");n.className="address",n.textContent=e.retailerAddressFormatted,D.appendChild(n)}const A=document.createElement("div");A.className="retailer-body";const O=document.createElement("span");O.className="product-price",O.textContent=formatCentToDollarText(null!==(v=e.variant.price)&&void 0!==v?v:0);const z=document.createElement("span");z.className="shipping-price",z.textContent=e.fee>0?"+ "+formatCentToDollarText(e.fee):"FREE Delivery";const N=document.createElement("span");return N.className="expectation",N.textContent=e.hourStatus.isClosed?C:(null===(y=null==l?void 0:l.presale)||void 0===y?void 0:y.isActive)?(null===(b=null==l?void 0:l.presale)||void 0===b?void 0:b.isActive)&&(null===(x=null==l?void 0:l.presale)||void 0===x?void 0:x.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==l?void 0:l.presale.estimatedShipBy):"":null==e?void 0:e.expectationText,A.append(O,z,N),S.append(D,A),S}template(){const e=this.getProductId(),n=this.getStoreValue("products."+e),o=this.getStoreValue("products."+e+".sizes."+n.selectedSizeId),l=(null==o?void 0:o.attributes)||null,d=[];for(const h in o.shippingFulfillments)Object.prototype.hasOwnProperty.call(o.shippingFulfillments,h)&&d.push(o.shippingFulfillments[h]);const u=[];for(const h in o.onDemandFulfillments)Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,h)&&u.push(o.onDemandFulfillments[h]);const p=n.selectedFulfillmentType===h.SHIPPING,m=n.selectedFulfillmentType===h.ON_DEMAND,v=p?d:u,y=renderFulfillmentTabsContainer({shippingFulfillments:d,onDemandFulfillments:u,shippingSelected:p,onDemandSelected:m,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!n.fulfillmentHasAvailability||0===v.length){const e=document.createElement("p");return e.className="product-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[y,e]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const b of v){const e=this.generateRetailerCard({fulfillment:b,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:b.id===n.selectedFulfillmentId,selectedSizeAttributes:l}),o=n.selectedFulfillmentType===h.ON_DEMAND&&b.hourStatus.isClosed;o?e.setAttribute("aria-disabled","true"):(e.addEventListener("click",this.onRetailerCardClick.bind(this)),e.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.click())})),this.listContainer.appendChild(e)}return this.listViewport.appendChild(this.listContainer),[y,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const e=this.getProductId(),n=this.getStoreValue("products."+e),o=this.getStoreValue("products."+e+".sizes."+n.selectedSizeId),l=(null==o?void 0:o.attributes)||null,u=this.config.layout.enableShippingFulfillment,p=this.config.layout.enableOnDemandFulfillment,m=Object.values(o.shippingFulfillments),v=Object.values(o.onDemandFulfillments),y=(u?m.length:0)+(p?v.length:0),b=document.createElement("div");b.className="header";const x=document.createElement("span");x.className="header-label",x.textContent=n.selectedFulfillmentType===h.SHIPPING?"Shipping From:":"Delivering From:";const w=document.createElement("button");if(w.className="delivery-options",w.type="button",w.textContent="See Delivery Options ("+y+")",w.setAttribute("aria-label","View all "+y+" delivery options"),w.addEventListener("click",async()=>{0!==y&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(d.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,d.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}))}),b.appendChild(x),b.appendChild(w),!n.fulfillmentHasAvailability){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[b,e]}const C=document.createElement("div");C.className="popup-fulfillment-list-container";const k=renderPopupRetailerCard({fulfillment:n.selectedFulfillment,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:l});return C.appendChild(k),[b,C]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(e){const n=this.getProductId(),o=e.currentTarget.dataset.fulfillmentType;if(!o)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:n,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(n,o)}async onRetailerCardClick(e){const n=this.getProductId(),o=e.currentTarget.dataset.fulfillmentId;if(!o)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:n,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;const F=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(n),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},l=this.getStoreValue("products."+n+".selectedFulfillment");if(l&&l.id===o)return await F(),void 0;await this.commands.product.selectFulfillment(n,o),await F()}template(){const e=this.getProductId(),n=this.getStoreValue("products."+e),o=this.getStoreValue("products."+e+".sizes."+n.selectedSizeId),l=(null==o?void 0:o.attributes)||null,d=[];for(const h in o.shippingFulfillments)Object.prototype.hasOwnProperty.call(o.shippingFulfillments,h)&&d.push(o.shippingFulfillments[h]);const u=[];for(const h in o.onDemandFulfillments)Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,h)&&u.push(o.onDemandFulfillments[h]);const p=n.selectedFulfillmentType===h.SHIPPING,m=n.selectedFulfillmentType===h.ON_DEMAND,v=p?d:u,y=document.createElement("h5");y.className="popup-retailers-section-title",y.textContent="Delivery Options";const b=renderFulfillmentTabsContainer({shippingFulfillments:d,onDemandFulfillments:u,shippingSelected:p,onDemandSelected:m,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!n.fulfillmentHasAvailability||0===v.length){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[y,b,e]}const x=document.createElement("div");x.className="popup-fulfillment-list-container";for(const h of v){const e=renderPopupRetailerCard({fulfillment:h,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:h.id===n.selectedFulfillmentId,selectedSizeAttributes:l});e.addEventListener("click",this.onRetailerCardClick.bind(this)),e.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e.click())}),x.appendChild(e)}return[y,b,x]}}class ProductComponent extends BaseComponent{constructor(){super({watchStorePaths:["products.{productId}.loading","products.{productId}.error"],watchOnlyStorePaths:["products.{productId}.drawer.isOpen","products.{productId}.rerender"]}),this.titleElement=null}getProductId(){return this.params.productId}onStoreWatch(e){const n=this.getProductId(),o=e.find(e=>e.path==="products."+n+".drawer.isOpen"),l=e.find(e=>e.path==="products."+n+".rerender");o&&this.titleElement&&this.titleElement.classList.toggle("hide",o.value),(null==l?void 0:l.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var e;const n=this.getProductId(),o=this.getStoreValue("products."+n);if(!o)return ComponentFactoryService.createElement({type:d.PRODUCT_LOADING});if(o.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:d.PRODUCT});if(o.loading)return ComponentFactoryService.createElement({type:d.PRODUCT_LOADING});const l=o.sizes[o.selectedSizeId],h=document.createElement("div");h.classList.add("product-content-wrapper"),h.setAttribute("role","region"),h.setAttribute("aria-label",""+o.name);const u=document.createElement("div");if(u.classList.add("product-content"),u.setAttribute("role","region"),u.setAttribute("aria-label",""+o.name),this.config.layout.showTitle){const e=document.createElement("h1");e.classList.add("product-title"),e.textContent=o.name,this.titleElement=e,u.appendChild(e)}const p=ComponentFactoryService.createElement({type:d.PRODUCT_OPTIONS,productId:n});u.appendChild(p);const m=ComponentFactoryService.createElement({type:d.PRODUCT_DRAWER,productId:n});if(u.appendChild(m),h.appendChild(u),!this.config.layout.showImages||!(null===(e=o.images)||void 0===e?void 0:e.length))return h;h.classList.add("has-images");const v=ComponentFactoryService.createElement({type:d.PRODUCT_IMAGE_CAROUSEL,images:o.images,mainImage:l.image,productId:n});return h.prepend(v),v.setAttribute("aria-label","Product images"),h}async disconnected(){const e=this.getProductId();e&&await this.commands.product.removeProduct(e)}}class ProductListCardComponent extends BaseComponent{get hostClasses(){return["product-list-card",this.params.variant,this.params.fillCard?"fill":""]}getAvailabilityData(){var e;const n=this.params.product,o=this.getStoreValue("address.address"),l={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==o?void 0:o.state)||"",isPresale:![],isPresaleActive:![]},d=n.sizes[0];if(!d)return l;const h=Object.values(d.shippingVariants)[0];if(!h)return l;l.upc=d.upc;const u=d.attributes||{};return l.isPresale=(null===(e=u.presale)||void 0===e?void 0:e.isActive)===!![],l.isPresaleActive=this.isPresaleActive(u),this.params.shippingFulfillment&&h.shippingFulfillmentId===this.params.shippingFulfillment.id&&h.stock>0?(l.hasAvailability=!![],l.fulfillmentId=this.params.shippingFulfillment.id,l.partNumber=h.partNumber):this.params.onDemandFulfillment&&h.onDemandFulfillmentId===this.params.onDemandFulfillment.id&&h.stock>0&&(l.hasAvailability=!![],l.fulfillmentId=this.params.onDemandFulfillment.id,l.partNumber=h.partNumber),l}isPresaleActive(e){const n=null==e?void 0:e.presale;if(!n)return![];if(!n.isActive)return![];if(n.canPurchaseOn){const e=new Date(n.canPurchaseOn),o=new Date;if(o.getTime()<e.getTime())return![]}return!![]}async handleAddToCart(e){if(!e.hasAvailability)return;const n=this.params.product.salsifyGrouping||this.params.product.id||"";e.isPresale&&e.isPresaleActive?await this.commands.productList.addPresaleToCart({fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,identifier:n}):await this.commands.productList.addToCart({fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,identifier:n})}template(){var e,n,o;const l=this.params.product,d=l.sizes[0],h=d?d.image:l.images[0],u=l.name,p=d?d.size:null,m=null!==(o=null===(n=null===(e=null==d?void 0:d.shippingVariants)||void 0===e?void 0:e[0])||void 0===n?void 0:n.price)&&void 0!==o?o:l.noAvailabilityPrice,v=this.getAvailabilityData();return this.createVariantStandard({image:h,name:u,size:p,price:m,availability:v})}generateProductUrl(){var e;if(!this.params.productUrl)return null;const n=this.params.product,o=null===(e=n.sizes)||void 0===e?void 0:e[0],l=this.params.productUrl;if(l.includes("{upc}")){const e=(null==o?void 0:o.upc)||"";return e?l.replace("{upc}",e):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(l.includes("{grouping}")){const e=n.salsifyGrouping||"";return e?l.replace("{grouping}",e):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(e){const{image:n,name:o,size:l,price:d,availability:h}=e,u=[],p=this.generateProductUrl(),m=document.createElement("div");m.className="plc__image-content";const v=document.createElement("div");v.className="plc__image-wrapper";const y=document.createElement("img");if(y.className="plc__image",y.src=n,y.alt=o,y.loading="lazy",v.appendChild(y),m.appendChild(v),p){const e=document.createElement("a");e.href=p,e.className="plc__image-link",e.target="_blank",e.rel="noopener noreferrer",e.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),e.appendChild(m),u.push(e)}else u.push(m);const b=document.createElement("div");b.className="plc__content";const x=document.createElement("h3");if(x.className="plc__title",x.textContent=o,p){const e=document.createElement("a");e.href=p,e.className="plc__title-link",e.target="_blank",e.rel="noopener noreferrer",e.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),e.appendChild(x),b.appendChild(e)}else b.appendChild(x);const w=document.createElement("div");w.className="plc__size-price-wrapper";const C=document.createElement("div");C.className="plc__price",C.textContent=formatCentToDollarText(d),w.appendChild(C);const k=document.createElement("div");k.className="plc__size",k.textContent=l||"",w.appendChild(k),b.appendChild(w),u.push(b);const S=document.createElement("button");return S.type="button",S.className="plc__button",S.disabled=!h.hasAvailability,h.isPresale?S.textContent="Pre Order":h.hasAvailability?S.textContent="Add to Cart":(S.textContent="Not Available In "+h.state.toUpperCase(),this.addHostClasses("not-available")),S.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await this.handleAddToCart(h)}),u.push(S),u}}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(e){const n=document.createElement("div");n.classList.add("slc__card");const o=document.createElement("div");o.className="slc__image-content";const l=document.createElement("div");l.className="slc__image-wrapper";const d=document.createElement("div");d.classList.add("wave","slc__image"),l.appendChild(d),o.appendChild(l);const h=document.createElement("div");h.className="slc__content";const u=document.createElement("div");u.className="slc__title-container";const p=document.createElement("div");p.classList.add("wave","slc__title","slc__title-line-1"),u.appendChild(p);const m=document.createElement("div");m.classList.add("wave","slc__title","slc__title-line-2"),u.appendChild(m),h.appendChild(u);const v=document.createElement("div");v.className="slc__size-price-wrapper";const y=document.createElement("div");y.classList.add("wave","slc__price"),v.appendChild(y);const b=document.createElement("div");b.classList.add("wave","slc__size"),v.appendChild(b),h.appendChild(v);const x=document.createElement("div");return x.classList.add("wave","slc__button"),n.appendChild(o),n.appendChild(h),n.appendChild(x),n}template(){const e=[],n=100/this.params.columns;this.container.style.setProperty("--card-width",n+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const o=this.params.rows*this.params.columns;for(let l=0;l<o;l++){const n=this.createSkeletonCard(l);e.push(n)}return e}}function createApplyFiltersButton(e){const n=document.createElement("div");n.className="product-list-filters-apply-container";const o=document.createElement("button");return o.className="product-list-filters-apply-btn",o.textContent="Apply Filters",o.addEventListener("click",()=>e()),n.appendChild(o),n}function createCheckboxItem(e){const{filter:n,state:o,item:l,onChange:d}=e,h=document.createElement("div");h.className="checkbox-filter-item";const u=document.createElement("input");u.type="checkbox",u.id=n.category+"-"+l.value,u.value=l.value.toString(),u.className="checkbox-filter-checkbox",u.checked=o.selectedValues.has(l.value.toString()),u.addEventListener("change",d);const p=document.createElement("label");p.htmlFor=u.id,p.className="checkbox-filter-item-label";const m=l.formattedValue||l.value.toString(),v=l.count||0,y=document.createElement("span");y.className="checkbox-filter-item-text",y.textContent=m;const b=document.createElement("span");return b.className="checkbox-filter-item-count",b.textContent="("+v+")",p.appendChild(y),p.appendChild(b),h.appendChild(u),h.appendChild(p),h}function handleCheckboxFilterSearch(e){const{filter:n,state:o,searchTerm:l,renderCheckboxItems:d}=e,h=l.toLowerCase().trim();o.filteredItems=h?n.values.filter(e=>{const n=(e.formattedValue||e.value.toString()).toLowerCase();return n.includes(h)}):[...n.values],d()}function createCheckboxFilterHeader(e){const{filter:n,state:o,onToggle:l}=e,d=document.createElement("div");d.className="checkbox-filter-header";const h=document.createElement("button");h.className="checkbox-filter-label",h.type="button";const u=document.createElement("span");u.textContent=formatFilterLabel(n.category);const p=document.createElement("span");return p.className="checkbox-filter-toggle-icon "+(o.isExpanded?"expanded":"collapsed"),p.innerHTML=o.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),o.iconElement=p,h.appendChild(u),h.appendChild(p),h.addEventListener("click",()=>l(n.category)),d.appendChild(h),d}function createCheckboxFilterSearchContainer(e){const{state:n,onSearch:o}=e,l=document.createElement("div");l.className="checkbox-filter-search-wrapper",n.searchInput=document.createElement("input"),n.searchInput.type="text",n.searchInput.className="checkbox-filter-search",n.searchInput.placeholder="Search";const d=document.createElement("span");return d.className="checkbox-filter-search-icon",d.innerHTML=SearchIcon({}),n.searchInput.addEventListener("input",e=>{const n=e.target;o(n.value)}),l.appendChild(n.searchInput),l.appendChild(d),l}function renderCheckboxItems(e){const{filter:n,state:o,onCheckboxChange:l}=e;if(o.checkboxList&&(o.checkboxList.innerHTML="",o.filteredItems.forEach(e=>{const d=createCheckboxItem({filter:n,state:o,item:e,onChange:()=>{const n=d.querySelector("input");l(e.value.toString(),n.checked)}});o.checkboxList.appendChild(d)}),0===o.filteredItems.length)){const e=document.createElement("div");e.className="checkbox-filter-no-results",e.textContent="No results found",o.checkboxList.appendChild(e)}}function updateFilterExpandState(e){e.contentElement&&(e.contentElement.className="checkbox-filter-content "+(e.isExpanded?"expanded":"collapsed")),e.iconElement&&(e.iconElement.className="checkbox-filter-toggle-icon "+(e.isExpanded?"expanded":"collapsed"),e.iconElement.innerHTML=e.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}))}function formatFilterLabel(e){return e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g," ")}function createDeliveryOptionsFilter(e){const{currentFilters:n,deliveryCollapsed:o,isSameDayDeliveryDisabled:l,onDeliveryOptionsChange:d,onToggleCollapse:h}=e,u=[],p=document.createElement("div");p.className="product-list-filters-delivery-options";const m=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],v=document.createElement("div");v.className="product-list-filters-delivery-options-header",v.style.cursor="pointer";const y=document.createElement("h3");y.className="product-list-filters-delivery-options-label",y.textContent="Delivery Options";const b=document.createElement("div");b.className="product-list-filters-chevron",b.innerHTML=o?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),v.appendChild(y),v.appendChild(b),p.appendChild(v);const x=document.createElement("div");x.className="product-list-filters-delivery-options-list",o&&x.classList.add("collapsed");for(const w of m){const e=document.createElement("div");e.className="product-list-filters-delivery-option";const o=document.createElement("input");o.type="radio",o.id="delivery-"+w.value,o.name="delivery-options",o.value=w.value,o.className="product-list-filters-delivery-radio";const h="onDemand"===w.value&&l;o.disabled=h,o.checked=w.value===(null==n?void 0:n.deliveryOptions),o.addEventListener("change",e=>{const n=e.target;null==d?void 0:d(n.value)});const u=document.createElement("label");u.htmlFor="delivery-"+w.value,u.className="product-list-filters-delivery-radio-label "+(h?"disabled":""),u.textContent=w.label,e.appendChild(o),e.appendChild(u),x.appendChild(e)}return p.appendChild(x),v.addEventListener("click",()=>{h()}),u.push(p),{elements:u,chevronContainer:b,deliveryOptionsList:x}}function createPriceFilter(e){var n,o,l,d,h,u,p,m;const{priceConfig:v,currentFilters:y,priceCollapsed:b,onPriceChange:x,onToggleCollapse:w,DEFAULT_MIN:C,DEFAULT_MAX:k}=e,S=[],_=document.createElement("div");_.className="product-list-filters-price";const D=Number.parseInt(null!==(n=null==v?void 0:v.min)&&void 0!==n?n:C,10),I=Number.parseInt(null!==(o=null==v?void 0:v.max)&&void 0!==o?o:k,10),A=Number.parseInt(null!==(h=null!==(d=null===(l=null==y?void 0:y.price)||void 0===l?void 0:l.min)&&void 0!==d?d:null==v?void 0:v.min)&&void 0!==h?h:C,10),O=Number.parseInt(null!==(m=null!==(p=null===(u=null==y?void 0:y.price)||void 0===u?void 0:u.max)&&void 0!==p?p:null==v?void 0:v.max)&&void 0!==m?m:k,10),z=document.createElement("div");z.className="product-list-filters-price-header",z.style.cursor="pointer";const N=document.createElement("h3");N.className="product-list-filters-price-title",N.textContent="Price Range",z.appendChild(N);const M=document.createElement("div");M.className="product-list-filters-chevron",M.innerHTML=b?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),z.appendChild(M),_.appendChild(z);const L=document.createElement("div");L.className="product-list-filters-price-slider-container",b&&L.classList.add("collapsed");const B=document.createElement("div");B.className="product-list-filters-price-range-wrapper";const j=document.createElement("div");j.className="product-list-filters-price-track";const q=document.createElement("div");q.className="product-list-filters-price-track-active",j.appendChild(q),B.appendChild(j);const U=document.createElement("input");U.type="range",U.min=D.toString(),U.max=I.toString(),U.value=A.toString(),U.step="1",U.className="product-list-filters-price-range product-list-filters-price-range-min",B.appendChild(U);const G=document.createElement("input");G.type="range",G.min=D.toString(),G.max=I.toString(),G.value=O.toString(),G.step="1",G.className="product-list-filters-price-range product-list-filters-price-range-max",B.appendChild(G),L.appendChild(B);const H=document.createElement("div");H.className="product-list-filters-price-inputs-container";const Y=document.createElement("div");Y.className="product-list-filters-price-input-wrapper";const W=document.createElement("span");W.className="product-list-filters-price-input-prefix",W.textContent="$";const Q=document.createElement("input");Q.type="number",Q.min=D.toString(),Q.max=I.toString(),Q.value=A.toString(),Q.className="product-list-filters-price-input",Q.placeholder=D.toString(),Y.appendChild(W),Y.appendChild(Q);const Z=document.createElement("span");Z.className="product-list-filters-price-separator",Z.textContent="to";const X=document.createElement("div");X.className="product-list-filters-price-input-wrapper";const J=document.createElement("span");J.className="product-list-filters-price-input-prefix",J.textContent="$";const $=document.createElement("input");$.type="number",$.min=D.toString(),$.max=I.toString(),$.value=O.toString(),$.className="product-list-filters-price-input",$.placeholder=I+"+",X.appendChild(J),X.appendChild($),H.appendChild(Y),H.appendChild(Z),H.appendChild(X),L.appendChild(H),_.appendChild(L);const t=()=>{const e=Number.parseInt(U.value,10),n=Number.parseInt(G.value,10),o=I-D,l=(e-D)/o*100,d=(n-D)/o*100;q.style.left=l+"%",q.style.width=d-l+"%"},K=(e,n)=>{U.value=e.toString(),G.value=n.toString(),Q.value=e.toString(),$.value=n.toString(),t()};return U.addEventListener("input",()=>{let e=Number.parseInt(U.value,10);const n=Number.parseInt(G.value,10);e>n&&(e=n),K(e,n)}),U.addEventListener("change",()=>{const e=Number.parseInt(U.value,10),n=Number.parseInt(G.value,10);null==x?void 0:x(e.toString(),n.toString())}),G.addEventListener("input",()=>{const e=Number.parseInt(U.value,10);let n=Number.parseInt(G.value,10);n<e&&(n=e),K(e,n)}),G.addEventListener("change",()=>{const e=Number.parseInt(U.value,10),n=Number.parseInt(G.value,10);null==x?void 0:x(e.toString(),n.toString())}),Q.addEventListener("input",()=>{let e=Number.parseInt(Q.value,10)||D;const n=Number.parseInt($.value,10)||I;e=Math.max(D,Math.min(e,I)),e>n&&(e=n),K(e,n),null==x||x(e.toString(),n.toString())}),$.addEventListener("input",()=>{const e=Number.parseInt(Q.value,10)||D;let n=Number.parseInt($.value,10)||I;n=Math.max(D,Math.min(n,I)),n<e&&(n=e),K(e,n),null==x||x(e.toString(),n.toString())}),t(),z.addEventListener("click",()=>{w()}),S.push(_),{elements:S,chevronContainer:M,sliderContainer:L}}class ProductListSearchComponent extends BaseComponent{constructor(){super(...arguments),this.ALLOWED_CHARACTERS=/[^a-zA-Z0-9\s\-_'.,&()]/g,this.MAX_LENGTH=100}get hostClasses(){return["product-list-search-container"]}template(){const e=[],n=document.createElement("div");n.className="product-list-search-box";const o=document.createElement("span");return o.className="product-list-search-icon",o.innerHTML=SearchIcon({}),o.setAttribute("aria-hidden","true"),this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="product-list-search-input",this.searchInput.placeholder="Search",this.searchInput.setAttribute("aria-label","Search products"),this.searchInput.setAttribute("maxlength",this.MAX_LENGTH.toString()),this.params.searchTerm&&(this.searchInput.value=this.sanitizeInput(this.params.searchTerm)),this.searchInput.addEventListener("input",e=>{const n=e.target,o=n.value,l=this.sanitizeInput(o);l!==o&&(n.value=l),this.updateClearButtonVisibility(l),this.params.handleInputChange&&this.params.handleInputChange(l)}),this.clearButton=document.createElement("button"),this.clearButton.type="button",this.clearButton.className="product-list-search-clear-btn",this.clearButton.innerHTML=CloseIcon({}),this.clearButton.setAttribute("aria-label","Clear search"),this.clearButton.style.display=this.params.searchTerm?"flex":"none",this.clearButton.addEventListener("click",()=>{this.searchInput&&(this.searchInput.value="",this.searchInput.focus()),this.updateClearButtonVisibility(""),this.params.clearSearch&&this.params.clearSearch(),this.params.handleInputChange&&this.params.handleInputChange("")}),n.appendChild(o),n.appendChild(this.searchInput),n.appendChild(this.clearButton),e.push(n),e}sanitizeInput(e){if(!e)return"";let n=e.replace(this.ALLOWED_CHARACTERS,"");return n=n.trim(),n=n.replace(/\s+/g," "),n.length>this.MAX_LENGTH&&(n=n.substring(0,this.MAX_LENGTH)),n}updateClearButtonVisibility(e){this.clearButton&&(this.clearButton.style.display=e?"flex":"none")}}function createPersonalizedFilter(e){const{currentFilters:n,isPersonalizationDisabled:o,onPersonalizedChange:l}=e,d=[],h=document.createElement("div");h.className="product-list-filters-personalized";const u=document.createElement("label");u.className="product-list-filters-personalized-label",u.setAttribute("for","personalized-switch"),u.textContent="Personalized Bottles",h.appendChild(u);const p=document.createElement("div");p.classList.add("toggle-switch");const m=!!(null==n?void 0:n.personalized);m&&p.classList.add("active");const v=document.createElement("div");v.classList.add("toggle-slider"),p.id="personalized-switch",p.setAttribute("tabindex","0"),p.setAttribute("aria-label","Toggle Personalized Bottles"),p.setAttribute("role","switch"),p.setAttribute("aria-checked",m?"true":"false"),p.appendChild(v);const f=e=>{p.classList.toggle("active",e),p.setAttribute("aria-checked",e?"true":"false")},a=()=>{const e=p.classList.contains("active"),n=!e;f(n),null==l||l(n)};if(p.addEventListener("click",()=>{o||a()}),p.addEventListener("keydown",e=>{o||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a())}),h.appendChild(p),o){const e=document.createElement("div");e.className="product-list-filters-warning",e.textContent="(Not Available With Same-Day Delivery)",h.appendChild(e)}return d.push(h),d}function createPreOrderFilter(e){const{currentFilters:n,isPreOrderDisabled:o,onPreOrderChange:l}=e,d=[],h=document.createElement("div");h.className="product-list-filters-pre-order";const u=document.createElement("label");u.className="product-list-filters-pre-order-label",u.setAttribute("for","pre-order-switch"),u.textContent="Pre-Order",h.appendChild(u);const p=document.createElement("div");p.classList.add("toggle-switch");const m=!!(null==n?void 0:n.preOrder);m&&p.classList.add("active"),o&&p.classList.add("disabled");const v=document.createElement("div");v.classList.add("toggle-slider"),p.id="pre-order-switch",p.setAttribute("tabindex",o?"-1":"0"),p.setAttribute("aria-label","Toggle Pre-Order"),p.setAttribute("role","switch"),p.setAttribute("aria-checked",m?"true":"false"),p.setAttribute("aria-disabled",o?"true":"false"),p.appendChild(v);const f=e=>{p.classList.toggle("active",e),p.setAttribute("aria-checked",e?"true":"false")},a=()=>{const e=p.classList.contains("active"),n=!e;f(n),null==l||l(n)};if(p.addEventListener("click",()=>{o||a()}),p.addEventListener("keydown",e=>{o||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),a())}),h.appendChild(p),o){const e=document.createElement("div");e.className="product-list-filters-warning",e.textContent="(Not Available With Same-Day Delivery)",h.appendChild(e)}return d.push(h),d}class ProductListFiltersComponent extends BaseComponent{constructor(){super(...arguments),this.priceCollapsed=![],this.deliveryCollapsed=![],this.checkboxFilterStates=new Map,this.DEFAULT_MIN="0",this.DEFAULT_MAX="1000"}get hostClasses(){const e=["product-list-filters-container"];return this.params.isDrawerMode&&e.push("drawer-mode"),e}isSameDayDeliveryDisabled(){var e,n;return!(!(null===(e=this.params.currentFilters)||void 0===e?void 0:e.personalized)&&!(null===(n=this.params.currentFilters)||void 0===n?void 0:n.preOrder))}isPersonalizationDisabled(){var e;return"onDemand"===(null===(e=this.params.currentFilters)||void 0===e?void 0:e.deliveryOptions)}isPreOrderDisabled(){var e;return"onDemand"===(null===(e=this.params.currentFilters)||void 0===e?void 0:e.deliveryOptions)}createPersonalizedFilterWrapper(){return createPersonalizedFilter({currentFilters:this.params.currentFilters,isPersonalizationDisabled:this.isPersonalizationDisabled(),onPersonalizedChange:this.params.onPersonalizedChange})}createPreOrderFilterWrapper(){return createPreOrderFilter({currentFilters:this.params.currentFilters,isPreOrderDisabled:this.isPreOrderDisabled(),onPreOrderChange:this.params.onPreOrderChange})}createDeliveryOptionsFilterWrapper(){const e=createDeliveryOptionsFilter({currentFilters:this.params.currentFilters,deliveryCollapsed:this.deliveryCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryDisabled(),onDeliveryOptionsChange:this.params.onDeliveryOptionsChange,onToggleCollapse:()=>this.toggleDeliveryCollapse()});return this.deliveryChevronContainer=e.chevronContainer,this.deliveryOptionsList=e.deliveryOptionsList,e.elements}toggleDeliveryCollapse(){this.deliveryCollapsed=!this.deliveryCollapsed,this.deliveryOptionsList&&this.deliveryOptionsList.classList.toggle("collapsed"),this.deliveryChevronContainer&&(this.deliveryChevronContainer.innerHTML=this.deliveryCollapsed?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}))}createPriceFilterWrapper(){const e=createPriceFilter({priceConfig:this.params.priceConfig,currentFilters:this.params.currentFilters,priceCollapsed:this.priceCollapsed,onPriceChange:this.params.onPriceChange,onToggleCollapse:()=>this.togglePriceCollapse(),DEFAULT_MIN:this.DEFAULT_MIN,DEFAULT_MAX:this.DEFAULT_MAX});return this.priceChevronContainer=e.chevronContainer,this.priceSliderContainer=e.sliderContainer,e.elements}togglePriceCollapse(){this.priceCollapsed=!this.priceCollapsed,this.priceSliderContainer&&this.priceSliderContainer.classList.toggle("collapsed"),this.priceChevronContainer&&(this.priceChevronContainer.innerHTML=this.priceCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}createCheckboxFilter(e){var n;const o=[];if(!this.checkboxFilterStates.has(e.category)){const o=null===(n=this.params.currentFilters)||void 0===n?void 0:n[e.category],l=Array.isArray(o)?new Set(o):new Set;this.checkboxFilterStates.set(e.category,{isExpanded:l.size>0,selectedValues:l,searchInput:null,checkboxList:null,filteredItems:[...e.values],contentElement:null,iconElement:null,hasUserInteraction:l.size>0})}const l=this.checkboxFilterStates.get(e.category),d=document.createElement("div");d.className="product-list-checkbox-filter",d.setAttribute("data-filter-category",e.category);const h=document.createElement("div");h.className="checkbox-filter-container";const u=createCheckboxFilterHeader({filter:e,state:l,onToggle:e=>this.toggleCheckboxFilter(e)});h.appendChild(u);const p=document.createElement("div");p.className="checkbox-filter-content "+(l.isExpanded?"expanded":"collapsed"),l.contentElement=p;const m=createCheckboxFilterSearchContainer({state:l,onSearch:n=>{handleCheckboxFilterSearch({filter:e,state:l,searchTerm:n,renderCheckboxItems:()=>this.renderCheckboxItemsWrapper(e,l)})}});return p.appendChild(m),l.checkboxList=document.createElement("div"),l.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsWrapper(e,l),p.appendChild(l.checkboxList),h.appendChild(p),d.appendChild(h),o.push(d),o}renderCheckboxItemsWrapper(e,n){renderCheckboxItems({filter:e,state:n,onCheckboxChange:(o,l)=>this.handleCheckboxChange(e.category,n,o,l)})}handleCheckboxChange(e,n,o,l){l?n.selectedValues.add(o):n.selectedValues.delete(o),n.hasUserInteraction=!![],n.isExpanded||(n.isExpanded=!![],updateFilterExpandState(n)),this.params.onCheckboxFilterChange&&this.params.onCheckboxFilterChange(e,Array.from(n.selectedValues))}toggleCheckboxFilter(e){const n=this.checkboxFilterStates.get(e);n&&(n.isExpanded=!n.isExpanded,n.hasUserInteraction=!![],updateFilterExpandState(n))}template(){var e;const n=[],o=document.createElement("div");o.className="product-list-filters-header",this.params.isDrawerMode&&o.classList.add("drawer-mode");const l=document.createElement("h3");if(l.className="product-list-filters-title",l.textContent="Filters",o.appendChild(l),this.params.isDrawerMode){const e=document.createElement("button");e.className="product-list-filters-close-btn",e.innerHTML=CloseIcon({}),e.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),o.appendChild(e)}return n.push(o),this.params.enablePersonalized&&n.push(...this.createPersonalizedFilterWrapper()),this.params.enablePreOrder&&n.push(...this.createPreOrderFilterWrapper()),this.params.enableDeliveryOptions&&n.push(...this.createDeliveryOptionsFilterWrapper()),this.params.priceConfig&&n.push(...this.createPriceFilterWrapper()),null===(e=this.params.sanitizedFilters)||void 0===e||e.forEach(e=>{n.push(...this.createCheckboxFilter(e))}),this.params.isDrawerMode&&n.push(createApplyFiltersButton(()=>{var e,n;null===(n=(e=this.params).onApplyFilters)||void 0===n?void 0:n.call(e),this.commands.ui.closeDrawer()})),n}}const FilterIcon=({width:e=16,height:n=16,className:o="",color:l=null})=>{const d=l?"--icon-color: "+l:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+n+'" viewBox="0 0 24 24" class="filter-icon '+o+'" style="'+d+'" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M20 7h-9"></path>\n <path d="M14 17H5"></path>\n <circle cx="17" cy="17" r="3"></circle>\n <circle cx="7" cy="7" r="3"></circle>\n </svg>\n '};var St;(function(e){e.IDLE="idle",e.LOADING_INITIAL="loading_initial",e.LOADING_MORE="loading_more",e.ERROR="error"})(St||(St={}));class ProductListComponent extends BaseComponent{get hostClasses(){const e=["product-list"];return this.params.filters.length>0&&e.push("has-filters"),e}constructor(){super({watchOnlyStorePaths:["address"]}),this.products=[],this.retailers={},this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.filters=[],this.searchFilter={searchTerm:""},this.currentFilters={personalized:![],preOrder:![],deliveryOptions:"all",price:{min:"0",max:"1000"}},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.sentinelElement=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels=new Map,this.loadingState=St.IDLE,this.scrollObserver=null,this.initializationPromise=null,this.filterDebounceTimer=null,this.FILTER_DEBOUNCE_MS=500,this.filterButton=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise}disconnectedCallback(){super.disconnectedCallback(),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(St.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(St.IDLE)}catch(et){this.logger.error("Error initializing product list:",et),this.setLoadingState(St.ERROR),this.showErrorState("Failed to load products")}}template(){const e=[],n=document.createElement("div");n.className="product-list-search__control-container",n.appendChild(this.createSearchContainer()),e.push(n),this.params.filters.length>0&&(this.filterButton=this.createFilterButton(),e.push(this.filterButton));const o=document.createElement("div");return o.className="product-list-controls",this.params.filters.length>0&&o.appendChild(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),o.appendChild(this.cardsContainer),e.push(o),this.renderCurrentState(),e}setLoadingState(e){this.loadingState=e,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case St.LOADING_INITIAL:this.renderLoadingState();break;case St.ERROR:break;case St.IDLE:case St.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){var e,n;try{const o=this.buildApiParams(0),l=await this.commands.productList.getProductList(o);this.filters=(null===(e=l.navigation)||void 0===e?void 0:e.filters)||[],this.products=l.products||[],this.retailers=l.retailers||{},this.updatePagination(l.navigation),this.syncFiltersFromResponse((null===(n=l.navigation)||void 0===n?void 0:n.filters)||[]),this.updateFiltersComponent()}catch(o){throw this.products=[],this.retailers={},this.pagination.hasMorePages=![],o}}updateFiltersComponent(){if(!this.filtersContainer||0===this.params.filters.length)return;const e=this.filtersContainer.parentElement;if(!e)return;const n=this.filtersContainer;this.filtersContainer=this.createFiltersContainer(),e.replaceChild(this.filtersContainer,n)}async loadMoreProducts(){var e;if(this.loadingState!==St.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(St.LOADING_MORE);const n=this.pagination.currentPage+1,o=this.buildApiParams(n),l=await this.commands.productList.getProductList(o);this.filters=(null===(e=l.navigation)||void 0===e?void 0:e.filters)||[],l.products&&l.products.length>0?(this.products.push(...l.products),this.mergeRetailers(l.retailers||{}),this.updatePagination(l.navigation),this.appendNewProducts(l.products)):(this.pagination.hasMorePages=![],this.updatePagination(l.navigation)),this.setLoadingState(St.IDLE)}catch(n){this.logger.error("Error loading more products:",n),this.setLoadingState(St.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(e){for(const[n,o]of Object.entries(e))this.retailers[n]||(this.retailers[n]=o)}updatePagination(e){var n,o,l,d;e&&(this.pagination={currentPage:null!==(n=e.currentPage)&&void 0!==n?n:0,totalPages:null!==(o=e.totalPages)&&void 0!==o?o:0,hasMorePages:(null!==(l=e.currentPage)&&void 0!==l?l:0)<(null!==(d=e.totalPages)&&void 0!==d?d:1)-1})}buildApiParams(e){const n={page:e,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()};return this.searchFilter.searchTerm&&this.searchFilter.searchTerm.trim().length>0&&(n.search=this.searchFilter.searchTerm.trim()),n}buildFiltersFromState(){const e=[{key:"availability",values:"IN_STOCK"}];this.currentFilters.personalized&&e.push({key:"engraving",values:"YES"}),this.currentFilters.preOrder&&e.push({key:"presale",values:"YES"});const n="all"===this.currentFilters.deliveryOptions?["onDemand","shipping"]:[this.currentFilters.deliveryOptions];if(e.push({key:"fulfillment",values:n}),this.currentFilters.price){const n={};"0"!==this.currentFilters.price.min&&(n.min=this.currentFilters.price.min),"1000"!==this.currentFilters.price.max&&(n.max=this.currentFilters.price.max),Object.keys(n).length>0&&e.push({key:"price",values:n})}const o=Object.keys(this.currentFilters).filter(e=>!["personalized","preOrder","deliveryOptions","price"].includes(e));for(const l of o){const n=this.currentFilters[l];Array.isArray(n)&&n.length>0&&e.push({key:l,values:n})}return e}syncFiltersFromResponse(e){if(e)for(const n of e)switch(n.key){case"engraving":this.currentFilters.personalized="YES"===n.values;break;case"presale":this.currentFilters.preOrder="YES"===n.values;break;case"fulfillment":Array.isArray(n.values)&&(n.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":n.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(St.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(St.IDLE)}catch(et){this.logger.error("Error handling filter change:",et),this.setLoadingState(St.ERROR),this.showErrorState("Error updating filters")}}resetPagination(){this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]}}updateFiltersUI(){this.filtersContainer&&(this.updatePersonalizedSwitch(),this.updatePreOrderSwitch(),this.updateDeliveryOptions())}updatePersonalizedSwitch(){this.personalizedSwitch&&(this.personalizedSwitch.checked=this.currentFilters.personalized,this.personalizedSwitch.disabled=this.isPersonalizationDisabled())}updatePreOrderSwitch(){this.preOrderSwitch&&(this.preOrderSwitch.checked=this.currentFilters.preOrder,this.preOrderSwitch.disabled=this.isPreOrderDisabled())}updateDeliveryOptions(){0!==this.deliveryRadios.length&&this.deliveryRadios.forEach(e=>{const n="onDemand"===e.value&&this.isSameDayDeliveryDisabled();e.disabled=n,n&&"onDemand"===e.value||(e.checked=e.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(e,n)})}updateRadioLabel(e,n){const o=this.deliveryRadioLabels.get(e.id);o&&(o.className="product-list-filters-delivery-radio-label "+(n?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}createCardsContainer(){const e=document.createElement("div");e.className="product-list-cards__container";const n=100/this.params.columns;return e.style.setProperty("--card-width",n+"%"),e.style.setProperty("--columns",""+this.params.columns),e}getResponsiveColumns(){const e=window.innerWidth;return e<=639?1:e<=767?Math.min(this.params.columns,2):e<=1023?Math.min(this.params.columns,3):this.params.columns}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const e=ComponentFactoryService.createElement({type:d.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.getResponsiveColumns(),fillCard:this.params.fillCard,filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(e)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const e=this.createInfoElement("No products found");return this.cardsContainer.appendChild(e),void 0}for(const e of this.products){const n=this.createProductCard(e);n&&this.cardsContainer.appendChild(n)}}}appendNewProducts(e){if(this.cardsContainer&&0!==e.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const n of e){const e=this.createProductCard(n);e&&this.cardsContainer.appendChild(e)}this.sentinelElement?(this.cardsContainer.appendChild(this.sentinelElement),this.updateSentinel(),this.scrollObserver&&this.pagination.hasMorePages&&this.scrollObserver.observe(this.sentinelElement)):this.pagination.hasMorePages&&this.setupInfiniteScroll()}}createProductCard(e){try{const n=Object.values(e.sizes)[0];if(!n)return this.logger.warn("Product "+e.id+" has no sizes"),null;const o=Object.values(n.shippingVariants)[0];if(!o)return this.logger.warn("Product "+e.id+" has no variants"),null;const l=this.retailers[o.retailerId];return l?ComponentFactoryService.createElement({type:d.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:e,shippingFulfillment:l.shippingFulfillment,onDemandFulfillment:l.onDemandFulfillment,productUrl:this.params.productUrl}):(this.logger.warn("Retailer "+o.retailerId+" not found for product "+e.id),null)}catch(n){return this.logger.error("Error creating product card for product "+e.id+":",n),null}}filterSanitizedFilters(){if(!this.params.filters||0===this.params.filters.length)return[];const n={[e.BRANDS]:v.BRANDS,[e.CATEGORIES]:v.CATEGORIES,[e.FLAVOR]:v.FLAVOR,[e.REGION]:v.REGION,[e.VARIETY]:v.VARIETY,[e.VINTAGE]:v.VINTAGE,[e.COUNTRY]:v.COUNTRY,[e.APPELLATION]:v.APPELLATION,[e.MATERIALS]:v.MATERIALS,[e.SIZES]:v.SIZES};return this.filters.filter(e=>{const o=n[e.category];return o&&this.params.filters.includes(o)})}buildFiltersParams(e=![]){const T=async()=>{this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()};return{enablePersonalized:this.params.filters.includes(v.PERSONALIZATION),enablePreOrder:this.params.filters.includes(v.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(v.DELIVERY_OPTIONS),currentFilters:this.currentFilters,sanitizedFilters:this.filterSanitizedFilters(),priceConfig:this.params.filters.includes(v.PRICE)?{min:"0",max:"1000"}:void 0,onPersonalizedChange:async n=>{this.currentFilters.personalized=n,e||await this.onFilterChange()},onPreOrderChange:async n=>{this.currentFilters.preOrder=n,e||await this.onFilterChange()},onDeliveryOptionsChange:async n=>{this.currentFilters.deliveryOptions=n,"onDemand"===n&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),e||await this.onFilterChange()},onPriceChange:async(n,o)=>{this.currentFilters.price||(this.currentFilters.price={}),"0"!==n?this.currentFilters.price.min=n:delete this.currentFilters.price.min,"1000"!==o?this.currentFilters.price.max=o:delete this.currentFilters.price.max,e||(this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS))},onCheckboxFilterChange:async(n,o)=>{o.length>0?this.currentFilters[n]=o:delete this.currentFilters[n],e||await this.onFilterChange()},isDrawerMode:e,onApplyFilters:async()=>{await T()}}}createSearchContainer(){return this.searchContainer=ComponentFactoryService.createElement({type:d.PRODUCT_LIST_SEARCH,searchTerm:this.searchFilter.searchTerm,handleInputChange:async e=>{this.searchFilter.searchTerm=e,this.filterDebounceTimer&&clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=setTimeout(async()=>{await this.onFilterChange()},this.FILTER_DEBOUNCE_MS)},clearSearch:async()=>{this.searchFilter.searchTerm="",this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),await this.onFilterChange()}}),this.searchContainer}createFiltersContainer(e={}){const{isDrawerMode:n=![]}=e;return this.filtersContainer=ComponentFactoryService.createElement({type:d.PRODUCT_LIST_FILTERS,...this.buildFiltersParams(n)}),this.storeFilterElementReferences(),this.filtersContainer}storeFilterElementReferences(){if(!this.filtersContainer)return;this.personalizedSwitch=this.filtersContainer.querySelector("#personalized-switch"),this.preOrderSwitch=this.filtersContainer.querySelector("#pre-order-switch");const e=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(e),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(e=>{var n;const o=null===(n=this.filtersContainer)||void 0===n?void 0:n.querySelector('label[for="'+e.id+'"]');o&&this.deliveryRadioLabels.set(e.id,o)})}openFiltersDrawer(){this.commands.ui.openDrawer(d.PRODUCT_LIST_FILTERS,this.buildFiltersParams(!![]))}createFilterButton(){const e=document.createElement("div");e.className="product-list-filter-container";const n=document.createElement("div");n.className="product-list-filter-icon",n.innerHTML=FilterIcon({}),n.addEventListener("click",()=>{this.openFiltersDrawer()});const o=document.createElement("span");return o.className="product-list-filter-text",o.textContent="Filter",e.appendChild(n),e.appendChild(o),e}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(e=>{const n=e[0];n.isIntersecting&&this.loadingState===St.IDLE&&this.pagination.hasMorePages&&void this.loadMoreProducts()},{root:null,rootMargin:"100px",threshold:.1}),this.scrollObserver.observe(this.sentinelElement))}createScrollSentinel(){const e=document.createElement("div");return e.className="product-list-scroll-sentinel",this.updateSentinelContent(e),e}updateSentinel(){this.sentinelElement&&this.updateSentinelContent(this.sentinelElement)}updateSentinelContent(e){let n;e.innerHTML="",n=this.loadingState===St.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),e.appendChild(n)}showSentinelError(e){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const n=this.createErrorElement(e);this.sentinelElement.appendChild(n)}createLoadingElement(e){const n=document.createElement("div");n.className="product-list-sentinel-container";const o=document.createElement("div");o.className="product-list-sentinel-spinner";const l=document.createElement("div");return l.className="product-list-sentinel-text",l.textContent=e,n.appendChild(o),n.appendChild(l),n}createErrorElement(e){const n=document.createElement("div");n.className="product-list-sentinel-error-container";const o=document.createElement("div");o.className="product-list-sentinel-error-icon",o.innerHTML="⚠";const l=document.createElement("div");return l.className="product-list-sentinel-error-text",l.textContent=e,n.appendChild(o),n.appendChild(l),n}createInfoElement(e,n=![]){const o=document.createElement("div");if(o.className="product-list-sentinel-info-container",!n&&e.includes("Scroll")){const e=document.createElement("div");e.className="product-list-sentinel-icon",e.innerHTML="↓",o.appendChild(e)}else if(n){const e=document.createElement("div");e.className="product-list-sentinel-divider",o.appendChild(e)}const l=document.createElement("div");return l.className=n?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",l.textContent=e,o.appendChild(l),o}showErrorState(e){if(!this.cardsContainer)return;this.clearCardsContainer();const n=this.createErrorElement(e);this.cardsContainer.appendChild(n)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}async onStoreWatch(e){const n=e.find(e=>"address"===e.path);if(n&&void 0!==n.value&&this.cardsContainer)try{this.resetPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(o){this.logger.error("Error reloading products after address change:",o),this.setLoadingState(St.ERROR),this.cardsContainer&&this.showErrorState("Failed to reload products")}}doCleanup(){this.filterDebounceTimer&&(clearTimeout(this.filterDebounceTimer),this.filterDebounceTimer=null),this.cleanupScrollObserver(),this.products=[],this.retailers={},this.cardsContainer=null,this.filtersContainer=null,this.searchContainer=null,this.filterButton=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels.clear(),this.initializationPromise=null}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(e){e.length>0&&this.updateAlert()}getErrorMessages(){var e,n;const o=null!==(e=this.params.fromEvents)&&void 0!==e?e:![],l=null!==(n=this.params.showFirstEvent)&&void 0!==n?n:!![];if(o){const e=this.store.get(this.params.errorStorePath)||[],n=e.filter(e=>null==e?void 0:e.message).map(e=>({message:e.message,level:e.level||"error",type:e.type}));return l?n.slice(0,1):n}const d=this.store.get(this.params.errorStorePath);return d?[{message:d,level:"error"}]:[]}createErrorElement(e){const n=document.createElement("div");n.classList.add("alert-container","alert-"+e.level);const o=document.createElement("span");o.classList.add("alert-icon"),o.innerHTML=ErrorInfoIcon({className:e.level+"-icon"});const l=document.createElement("span");return l.classList.add("alert-text"),l.textContent=e.message,n.appendChild(o),n.appendChild(l),n}scheduleHide(){var e;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const n=null!==(e=this.params.autoHideDelay)&&void 0!==e?e:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},n)}hideAllErrors(){var e;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.elements=[];const n=null!==(e=this.params.fromEvents)&&void 0!==e?e:![];n?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const e=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.elements=[],0===e.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=e.map(e=>this.createErrorElement(e)),this.elements.forEach(e=>{this.container.appendChild(e)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const e=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(d.CART)});const n=document.createElement("span");if(n.className="lce-cart-button-icon",n.innerHTML=BagIcon({color:e.theme.primaryColor}),this.params.showItemsCount){const e=document.createElement("span");return e.className="lce-cart-button-badge",e.style.visibility="hidden",[n,e]}return[n]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const e=this.container.querySelector(".lce-cart-button-badge");if(!e)return;const n=this.getStoreValue("cart.itemsQuantity")||0;e.textContent=n.toString(),e.style.visibility=n>0?"visible":"hidden",this.store.watch("cart.itemsQuantity",()=>{const n=this.getStoreValue("cart.itemsQuantity")||0;e.textContent=n.toString(),e.style.visibility=n>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(e){var n;const o=e.find(e=>"ui.drawer"===e.path);if(!o)return![];const l=o.value,d=l.isOpen,h=null===(n=l.contentConfig)||void 0===n?void 0:n.type,u=h!==this.currentContentType;return d&&!this.isOpen?(this.currentContentType=h,this.openWithContent(l),![]):d&&this.isOpen&&!u?![]:d&&this.isOpen&&u?(this.currentContentType=h,this.openWithContent(l),![]):!d&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:e}){try{if(!e)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:n,data:o}=e||{};let l;l=this.isElementsEnabled()?ComponentFactoryService.createElement({type:n,...o}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({message:"Elements is not enabled.",componentType:n}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(l,n):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(l),this.updateDrawerContentTypeClass(n),this.open()),this.addHostAttribute("data-target",n.toString().toLowerCase())}catch(n){this.logger.error("Drawer content loading failed",n),this.commands.ui.closeDrawer()}}animateContentSwap(e,n){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const o=this.contentContainer.firstElementChild;o.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{o.classList.add("fading")}),setTimeout(()=>{o.remove(),e.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(e),this.updateDrawerContentTypeClass(n),requestAnimationFrame(()=>{e.classList.add("visible"),setTimeout(()=>{e.classList.remove("drawer-content-fade-in","visible"),this.isTransitioning=![]},150)})},150)}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleBackdropClick(){this.commands.ui.closeDrawer()}handleKeydown(e){this.isOpen&&"Escape"===e.key&&this.commands.ui.closeDrawer()}updateDrawerContentTypeClass(e){if(!this.drawerElement)return;const n=["drawer"];this.isOpen&&n.push("open"),n.push(e.toString().toLowerCase()),this.drawerElement.className=n.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var e;try{const n=this.themeProvider.getConfigs("configurations");return null!==(e=null==n?void 0:n.isElementsEnabled)&&void 0!==e?e:![]}catch(n){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",n),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["engraving-form"]}beforeConnected(){var e;if(this.engravingLines=this.params.lines,"product"===this.params.context){const n=this.store.get("products."+this.params.identifier);this.fulfillmentId=n.selectedFulfillmentId,this.partNumber=(null===(e=n.selectedFulfillment)||void 0===e?void 0:e.variant.partNumber)||null}if("cart"===this.params.context){const e=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=e.fulfillmentId,this.partNumber=e.partNumber}}calculateTotalPrice(){var e,n;if("product"===this.params.context){const o=this.store.get("products."+this.params.identifier),l=o.sizes[o.selectedSizeId],d=l.shippingFulfillments[this.fulfillmentId],h=d.variant.price,u=(null===(n=null===(e=null==l?void 0:l.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.fee)||0;return h+u}if("cart"===this.params.context){const e=this.store.get("cart.items."+this.params.identifier),n=e.unitPrice,o=e.attributes.engraving.fee||0;return n+o}return 0}productInformationSection(){const e=[];let n="",o="";if("product"===this.params.context){const l=this.store.get("products."+this.params.identifier);l.sizes[l.selectedSizeId].image?e.push(l.sizes[l.selectedSizeId].image):e.push(...l.images||[]),n=l.name,o=l.sizes[l.selectedSizeId].size}if("cart"===this.params.context){const l=this.store.get("cart.items."+this.params.identifier);l.mainImage&&e.push(l.mainImage),n=l.name,o=l.size}const l=document.createElement("div");if(l.className="product-info-section",e.length>0){const o=document.createElement("div");o.className="product-image-container";const d=document.createElement("img");d.src=e[0],d.alt=n,d.loading="lazy",d.className="product-image",o.appendChild(d),l.appendChild(o)}const d=document.createElement("div");d.className="product-details-container";const h=document.createElement("div");h.className="product-header";const u=document.createElement("h4");u.className="product-title",u.textContent=n,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),h.appendChild(u),h.appendChild(this.productPriceSpan),d.appendChild(h);const p=document.createElement("p");p.className="product-size-text",p.textContent=o,d.appendChild(p);const m=document.createElement("p");return m.className="engraving-fees-disclaimer",m.textContent="Personalization fees included in total, varies by retailer.",d.appendChild(m),l.appendChild(d),l}addToCartButtonText(e){if("product"!==this.params.context)return"Save";const n=this.getConfigs("product"),o=n.layout.addToCartButtonText;return n.layout.addToCartButtonShowTotalPrice?o+" - "+formatCentToDollarText(e):o}retailersSection(){var e,n,o,l,d,h,u;const p=this.store.get("products."+this.params.identifier),m=p.sizes[p.selectedSizeId],v=Object.values(m.shippingFulfillments).filter(e=>e.variant.isEngravable),y=document.createElement("div");y.className="fulfillment-section";const b=document.createElement("p");if(b.className="shipping-from-text",b.innerHTML="Shipping from: <b>"+(null===(e=p.selectedFulfillment)||void 0===e?void 0:e.retailerName)+"</b>",y.appendChild(b),1===v.length)return y;const x=document.createElement("div");x.className="fulfillment-options-container",y.appendChild(x);const w=document.createElement("span");w.className="see-more-fulfillments",w.textContent="See More Delivery Options ("+v.length+")",w.setAttribute("role","button"),w.setAttribute("tabindex","0"),w.setAttribute("aria-label","See More Delivery Options ("+v.length+")"),w.setAttribute("aria-expanded","false");const g=()=>{const e=x.classList.contains("expanded");x.classList.toggle("expanded"),e?(w.textContent="See More Delivery Options ("+v.length+")",w.setAttribute("aria-label","See More Delivery Options ("+v.length+")"),w.setAttribute("aria-expanded","false")):(w.textContent="See Less Delivery Options",w.setAttribute("aria-label","See Less Delivery Options"),w.setAttribute("aria-expanded","true"))};w.addEventListener("click",g),w.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),g())}),y.appendChild(w);for(const C of v){const e=document.createElement("div");e.className="fulfillment-option",e.setAttribute("data-fulfillment-id",C.id),C.id===(null===(n=p.selectedFulfillment)||void 0===n?void 0:n.id)&&e.classList.add("selected"),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select delivery from "+C.retailerName+", "+formatCentToDollarText(C.variant.price+((null===(l=null===(o=p.sizes[p.selectedSizeId].attributes)||void 0===o?void 0:o.engraving)||void 0===l?void 0:l.fee)||0))+", "+C.engravingExpectationText),e.setAttribute("aria-pressed",C.id===(null===(d=p.selectedFulfillment)||void 0===d?void 0:d.id)?"true":"false");const r=()=>{this.fulfillmentId=C.id,this.partNumber=C.variant.partNumber;const n=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(n),this.productPriceSpan.textContent=formatCentToDollarText(n);const o=x.querySelector(".fulfillment-option.selected");o&&(o.classList.remove("selected"),o.setAttribute("aria-pressed","false")),e.classList.add("selected"),e.setAttribute("aria-pressed","true"),b.innerHTML="Shipping from: <b>"+C.retailerName+"</b>"};e.addEventListener("click",r),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r())});const m=C.variant.price+((null===(u=null===(h=p.sizes[p.selectedSizeId].attributes)||void 0===h?void 0:h.engraving)||void 0===u?void 0:u.fee)||0),v=document.createElement("div");v.className="option-row row-1",e.appendChild(v);const y=document.createElement("span");y.className="retailer-name",y.textContent=C.retailerName,v.appendChild(y);const w=document.createElement("span");w.className="fulfillment-price",w.textContent=formatCentToDollarText(m),v.appendChild(w),e.appendChild(v);const k=document.createElement("div");k.className="option-row row-2",e.appendChild(k);const S=document.createElement("span");S.className="estimated-time",S.textContent=""+C.engravingExpectationText,k.appendChild(S),e.appendChild(k),x.appendChild(e)}return y}engravingLinesSection(){var e;const{lines:n,maxLines:o,location:l,maxCharsPerLine:d}=this.params,h=document.createElement("div");h.className="engraving-section";const u=document.createElement("p");if(u.className="engraving-title",u.textContent="Personalize Your Bottle",h.appendChild(u),l&&(null===(e=null==l?void 0:l.trim())||void 0===e?void 0:e.length)>0){const e=document.createElement("p");e.className="engraving-location-text",e.textContent="Your message will appear "+l.toLowerCase()+".",h.appendChild(e)}const p=Array.from({length:o},(e,o)=>{const l=o+1,h=document.createElement("div");h.className="engraving-input-wrapper",h.setAttribute("data-line-number",l.toString());const u=document.createElement("input");u.type="text",u.id="engraving-line-"+l,u.dataset.lineNumber=l.toString(),u.maxLength=d,u.value=n[o]||"",u.placeholder=l>1?"Line "+l+" (optional)":"Line "+l,u.className="engraving-input",u.autocomplete="off",u.setAttribute("aria-label",l>1?"Engraving line "+l+", optional, maximum "+d+" characters":"Engraving line "+l+", maximum "+d+" characters");const p=document.createElement("span");return p.className="engraving-char-count",p.textContent=u.value.length+"/"+d,p.setAttribute("aria-live","polite"),p.setAttribute("aria-atomic","true"),u.addEventListener("input",()=>{p.textContent=u.value.length+"/"+d,this.engravingLines[o]=u.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),h.appendChild(u),h.appendChild(p),h}),m=document.createElement("div");return m.className="engraving-inputs-container",m.append(...p),h.appendChild(m),h}actionButtonsSection(){const{identifier:e,context:n}=this.params,o=document.createElement("div");o.className="action-buttons-container";const l=document.createElement("button");l.type="button",l.className="cancel-action-button",l.textContent="Cancel",l.setAttribute("aria-label","Cancel personalization and close");const R=async()=>{"product"===n&&await this.commands.product.closeProductDrawer(e),"cart"===n&&this.commands.ui.openDrawer(d.CART)};l.addEventListener("click",R),l.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),R())}),o.appendChild(l),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===n?"Add personalized item to cart":"Update personalization and return to cart");const i=async()=>{const o=this.engravingLines.map(e=>e.trim().toUpperCase()).filter(e=>e&&e.length>0);"product"===n&&this.fulfillmentId&&this.partNumber&&(await this.commands.product.addToCart(e,{fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:o,identifier:e}),await this.commands.product.closeProductDrawer(e)),"cart"===n&&(await this.commands.cart.updateItemEngraving(e,o),this.commands.ui.openDrawer(d.CART))};return this.addToCartButton.addEventListener("click",i),this.addToCartButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i())}),o.appendChild(this.addToCartButton),o}template(){const e=[],n=this.productInformationSection();if(e.push(n),"product"===this.params.context){const n=this.retailersSection();e.push(n)}const o=this.engravingLinesSection();e.push(o);const l=this.actionButtonsSection();e.push(l);const d=document.createElement("p");return d.className="engraving-disclaimer",d.innerHTML="Personalized orders require up to 10 business days to be processed and then shipped. Tracking information will be provided once processed. <b>Personalized bottle orders cannot be cancelled.</b>",e.push(d),e}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const e=this.getConfigs("global");return["engraving-view-container",e.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const e=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+e),o=(null==n?void 0:n.attributes.engraving.fee)||0,l=(null==n?void 0:n.quantity)||1;return{quantity:l,fee:o,total:o*l}}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+e),o=(null==n?void 0:n.attributes.engraving.fee)||0,l=(null==n?void 0:n.quantity)||1;return{quantity:l,fee:o,total:o*l}}return{quantity:0,fee:0,total:0}}engravingLines(){const e=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+e);return(null==n?void 0:n.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+e);return(null==n?void 0:n.attributes.engraving.lines)||[]}return[]}handleEdit(){var e,n,o,l,h,u,p,m,v,y,b,x,w,C,k,S,_,D,I,A;const O=this.params.identifier,z={identifier:O,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const d=this.getStoreValue("cart.items."+O);z.lines=(null===(n=null===(e=null==d?void 0:d.attributes)||void 0===e?void 0:e.engraving)||void 0===n?void 0:n.lines)||[],z.maxLines=(null===(l=null===(o=null==d?void 0:d.attributes)||void 0===o?void 0:o.engraving)||void 0===l?void 0:l.maxLines)||1,z.maxCharsPerLine=(null===(u=null===(h=null==d?void 0:d.attributes)||void 0===h?void 0:h.engraving)||void 0===u?void 0:u.maxCharsPerLine)||16,z.fee=(null===(m=null===(p=null==d?void 0:d.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.fee)||0,z.location=(null===(y=null===(v=null==d?void 0:d.attributes)||void 0===v?void 0:v.engraving)||void 0===y?void 0:y.location)||""}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+O);z.lines=(null===(x=null===(b=null==e?void 0:e.attributes)||void 0===b?void 0:b.engraving)||void 0===x?void 0:x.lines)||[],z.maxLines=(null===(C=null===(w=null==e?void 0:e.attributes)||void 0===w?void 0:w.engraving)||void 0===C?void 0:C.maxLines)||1,z.maxCharsPerLine=(null===(S=null===(k=null==e?void 0:e.attributes)||void 0===k?void 0:k.engraving)||void 0===S?void 0:S.maxCharsPerLine)||16,z.fee=(null===(D=null===(_=null==e?void 0:e.attributes)||void 0===_?void 0:_.engraving)||void 0===D?void 0:D.fee)||0,z.location=(null===(A=null===(I=null==e?void 0:e.attributes)||void 0===I?void 0:I.engraving)||void 0===A?void 0:A.location)||""}this.commands.ui.openDrawer(d.ENGRAVING_FORM,z)}async handleRemove(){const e=this.params.identifier;"cart"===this.params.context&&await this.commands.cart.updateItemEngraving(e,[]),"checkout"===this.params.context&&await this.commands.checkout.removeItemEngraving(e)}template(){const e=this.engravingQuantityFee(),n=this.engravingLines();if(0===n.length)return"";const o=document.createElement("div");o.className="engraving-header";const l=document.createElement("h3");l.textContent="Personalization";const d=document.createElement("span");if(d.className="engraving-fee",1===e.quantity&&(d.textContent=formatCentToDollarText(e.total,![])),e.quantity>1){d.textContent=formatCentToDollarText(e.total,![]);const n=document.createElement("span");n.className="engraving-fee-each",n.textContent=" ("+formatCentToDollarText(e.fee,![])+" ea)",d.appendChild(n)}o.appendChild(l),o.appendChild(d);const h=document.createElement("div");h.className="engraving-body";const u=document.createElement("div");u.className="engraving-lines";for(const v of n){const e=document.createElement("span");e.className="engraving-line",e.textContent=v,u.appendChild(e)}const p=document.createElement("div");p.className="engraving-actions";const m=document.createElement("button");m.type="button",m.classList.add("remove-button"),m.textContent="Remove",m.setAttribute("aria-label","Remove engraving");const f=async()=>{await this.handleRemove()};if(m.addEventListener("click",f),m.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await f())}),p.appendChild(m),"checkout"!==this.params.context){const e=document.createElement("button");e.type="button",e.classList.add("edit-button"),e.textContent="Edit",e.setAttribute("aria-label","Edit engraving"),e.addEventListener("click",this.handleEdit.bind(this)),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleEdit())}),p.appendChild(e)}return h.appendChild(u),h.appendChild(p),[o,h]}}class BirthdateInputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const e=this.getConfigs("global");return["custom-input","birthdate",e.layout.inputFieldStyle]}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const e=this.params.value.split("-");3===e.length&&(this.yearInput.value=e[0],this.monthInput.value=e[1],this.dayInput.value=e[2])}}setupEventListeners(){this.monthInput.addEventListener("input",e=>{this.formatMonth(e),this.handleNavigation(e,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",e=>{this.formatDay(e),this.handleNavigation(e,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",e=>{this.formatYear(e),this.handleChange()}),this.monthInput.addEventListener("blur",()=>{this.padMonthOnBlur(),this.validateInput()}),this.dayInput.addEventListener("blur",()=>{this.padDayOnBlur(),this.validateInput()}),this.yearInput.addEventListener("blur",()=>{this.validateInput()});const e=[this.monthInput,this.dayInput,this.yearInput];for(const n of e)n.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",e=>{"Backspace"===e.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",e=>{"Backspace"===e.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(e){const n=e.target;let o=n.value.replace(/\D/g,"");if(o.length>2&&(o=o.substring(0,2)),1===o.length){const e=Number.parseInt(o,10);e>=2&&e<=9&&(o="0"+o)}else if(2===o.length){const e=Number.parseInt(o,10);e>12?o="12":e<1&&"00"!==o&&(o="01")}n.value=o}formatDay(e){const n=e.target;let o=n.value.replace(/\D/g,"");if(o.length>2&&(o=o.substring(0,2)),1===o.length){const e=Number.parseInt(o,10);e>=4&&e<=9&&(o="0"+o)}else if(2===o.length){const e=Number.parseInt(o,10);e>31?o="31":e<1&&"00"!==o&&(o="01")}n.value=o}formatYear(e){const n=e.target;let o=n.value.replace(/\D/g,"");o.length>4&&(o=o.substring(0,4)),n.value=o}padMonthOnBlur(){const e=this.monthInput.value;if(1===e.length){const n=Number.parseInt(e,10);if(n>=0&&n<=9&&(this.monthInput.value="0"+e,this.params.onChange)){const e=this.getFormattedValue();this.params.onChange(e)}}}padDayOnBlur(){const e=this.dayInput.value;if(1===e.length){const n=Number.parseInt(e,10);if(n>=0&&n<=9&&(this.dayInput.value="0"+e,this.params.onChange)){const e=this.getFormattedValue();this.params.onChange(e)}}}handleNavigation(e,n){const o=e.target,l=o===this.yearInput?4:2;o.value.length===l&&n&&n.focus()}handleChange(){if(this.clearErrors(),this.scheduleValidation(),this.params.onChange){const e=this.getFormattedValue();this.params.onChange(e)}}isFieldsComplete(){const e=this.monthInput.value,n=this.dayInput.value,o=this.yearInput.value;return 2===e.length&&2===n.length&&4===o.length}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldsComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}getFormattedValue(){const e=this.monthInput.value.padStart(2,"0"),n=this.dayInput.value.padStart(2,"0"),o=this.yearInput.value;return e&&n&&o&&4===o.length?o+"-"+e+"-"+n:""}validateDate(e,n,o){if(!e||!n||!o||4!==o.length)return![];const l=Number.parseInt(e,10),d=Number.parseInt(n,10),h=Number.parseInt(o,10);if(l<1||l>12||d<1||d>31||h<1e3)return![];const u=new Date(h,l-1,d);return u.getFullYear()===h&&u.getMonth()===l-1&&u.getDate()===d}calculateAge(e){const n=new Date;let o=n.getFullYear()-e.getFullYear();const l=n.getMonth()-e.getMonth();return(l<0||0===l&&n.getDate()<e.getDate())&&o--,o}validateInput(){const e=this.monthInput.value,n=this.dayInput.value,o=this.yearInput.value,l=[],d=this.params.validation;if(!d)return this.showErrors([]),!![];const h=2===e.length&&2===n.length&&4===o.length,u=e||n||o;if(d.required&&!u)l.push("Please enter a complete date (MM/DD/YYYY)");else if(u&&!h)l.push("Please enter a complete date (MM/DD/YYYY)");else if(h)if(this.validateDate(e,n,o)){const h=Number.parseInt(e,10),u=Number.parseInt(n,10),p=Number.parseInt(o,10),m=new Date(p,h-1,u);if(void 0!==d.minYear&&p<d.minYear&&l.push("Year must be "+d.minYear+" or later"),void 0!==d.maxYear&&p>d.maxYear&&l.push("Year must be "+d.maxYear+" or earlier"),void 0!==d.minAge||void 0!==d.maxAge){const e=this.calculateAge(m);void 0!==d.minAge&&e<d.minAge&&l.push("Must be at least "+d.minAge+" years old"),void 0!==d.maxAge&&e>d.maxAge&&l.push("Must be no more than "+d.maxAge+" years old")}if(d.customValidator){const e=d.customValidator(this.getFormattedValue());e&&l.push(e)}}else l.push("Please enter a valid date");this.showErrors(l);const p=0===l.length;return this.params.onValidation&&this.params.onValidation(p,l),p}showErrors(e){this.errorContainer.innerHTML="";const n=[this.monthInput,this.dayInput,this.yearInput];if(e.length>0){this.errorContainer.classList.add("show");for(const e of n)e.classList.add("input-error");for(const n of e){const e=document.createElement("div");e.className="error-message",e.textContent=n,this.errorContainer.appendChild(e)}}else for(const o of n)o.classList.remove("input-error")}clearErrors(){const e=[this.monthInput,this.dayInput,this.yearInput],n=e.some(e=>e.classList.contains("input-error"));if(n){for(const n of e)n.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(e){if(e){const n=e.split("/");3===n.length&&(this.monthInput.value=n[0],this.dayInput.value=n[1],this.yearInput.value=n[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var e;const n=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(e=this.params.validation)||void 0===e?void 0:e.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name+"-month"),n.push(o)}const o=document.createElement("div");o.className="date-input-container";const l=document.createElement("input");l.type="text",l.placeholder="MM",l.name=this.params.name+"-month",l.id=this.params.name+"-month",l.maxLength=2,l.className="date-field month-field",l.setAttribute("data-field","month"),l.inputMode="numeric";const d=document.createElement("span");d.className="date-separator",d.textContent="/";const h=document.createElement("input");h.type="text",h.placeholder="DD",h.name=this.params.name+"-day",h.id=this.params.name+"-day",h.maxLength=2,h.className="date-field day-field",h.setAttribute("data-field","day"),h.inputMode="numeric";const u=document.createElement("span");u.className="date-separator",u.textContent="/";const p=document.createElement("input");p.type="text",p.placeholder="YYYY",p.name=this.params.name+"-year",p.id=this.params.name+"-year",p.maxLength=4,p.className="date-field year-field",p.setAttribute("data-field","year"),p.inputMode="numeric",this.params.disabled&&(l.disabled=!![],h.disabled=!![],p.disabled=!![]),this.params.className&&(o.className+=" "+this.params.className),o.appendChild(l),o.appendChild(d),o.appendChild(h),o.appendChild(u),o.appendChild(p);const m=document.createElement("div");return m.className="error-container",n.push(o),n.push(m),n}}class InputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const e=this.getConfigs("global");return["custom-input",e.layout.inputFieldStyle]}handlePhoneKeydown(e){if("Backspace"===e.key){const n=e.target,o=n.selectionStart||0,l=n.value;o>0&&/\D/.test(l[o-1])&&setTimeout(()=>{const e=Math.max(0,o-2);n.setSelectionRange(e,e)},0)}}formatPhoneNumber(e){const n=e.target;let o=n.value.replace(/\D/g,"");o.length>10&&(o=o.substring(0,10)),o.length>=6?o="("+o.substring(0,3)+") "+o.substring(3,6)+"-"+o.substring(6):o.length>=3&&(o="("+o.substring(0,3)+") "+o.substring(3)),n.value=o}formatDate(e){const n=e.target;let o=n.value.replace(/\D/g,"");o.length>8&&(o=o.substring(0,8)),o.length>=5?o=o.substring(0,2)+"/"+o.substring(2,4)+"/"+o.substring(4):o.length>=3&&(o=o.substring(0,2)+"/"+o.substring(2)),n.value=o}validateEmail(e){const n=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return n.test(e)}validateTel(e){const n=/^\(\d{3}\) \d{3}-\d{4}$/;return n.test(e)}validateDate(e){const n=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!n.test(e))return![];const[o,l,d]=e.split("/").map(Number),h=new Date(d,o-1,l);return h.getFullYear()===d&&h.getMonth()===o-1&&h.getDate()===l}isFieldComplete(){var e,n,o;const l=this.inputElement.value.trim();if(!l)return![];switch(this.params.inputType){case"tel":return this.validateTel(l);case"date":return this.validateDate(l);case"email":return l.includes("@")&&(null===(e=l.split("@")[1])||void 0===e?void 0:e.includes("."));case"number":return!Number.isNaN(Number.parseFloat(l));default:return(null===(n=this.params.validation)||void 0===n?void 0:n.max)&&l.length>=this.params.validation.max||(null===(o=this.params.validation)||void 0===o?void 0:o.min)&&l.length>=this.params.validation.min?!![]:l.length>=3}}validateInput(){const e=this.inputElement.value,n=[],o=this.params.validation;if(!o)return this.showErrors([]),!![];if(o.required&&!e.trim()&&n.push("This field is required"),!o.required&&!e.trim())return this.showErrors([]),!![];if(e.trim()){if("email"!==this.params.inputType||this.validateEmail(e)||n.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(e)||n.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(e)||n.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const l=Number.parseFloat(e);Number.isNaN(l)?e.trim()&&n.push("Please enter a valid number"):(void 0!==o.min&&l<o.min&&n.push("Value must be at least "+o.min),void 0!==o.max&&l>o.max&&n.push("Value must be no more than "+o.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==o.min&&e.length<o.min&&n.push("Must be at least "+o.min+" characters"),void 0!==o.max&&e.length>o.max&&n.push("Must be no more than "+o.max+" characters")),o.pattern){const l=new RegExp(o.pattern);l.test(e)||n.push("Invalid format")}if(o.customValidator){const l=o.customValidator(e);l&&n.push(l)}}this.showErrors(n);const l=0===n.length;return this.params.onValidation&&this.params.onValidation(l,n),l}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}showErrors(e){if(this.errorContainer.innerHTML="",e.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const n of e){const e=document.createElement("div");e.className="error-message",e.textContent=n,this.errorContainer.appendChild(e)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(e){this.inputElement.value=e,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===this.params.inputType&&this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var e;const n=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(e=this.params.validation)||void 0===e?void 0:e.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name),n.push(o)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"===this.params.inputType&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",e=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(e.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",n.push(this.inputElement),n.push(this.errorContainer),n}}class LceElementComponent extends HTMLElement{constructor(){super(),this.A=![],this.U=null;const e=ClientConfigService.getInstance();this.V=this.attachShadow({mode:e.get("openShadowDom")?"open":"closed"})}initialize(e,n){if(this.A)return;if(!e||"string"!=typeof e)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(n&&n instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(e.toLowerCase(),""),!this.V)throw new SDKError("LceElementComponent: Shadow DOM container is not available");n&&"function"==typeof n.rerender&&(this.U=e=>{n.rerender(e||"LceElementRerender")}),this.V.appendChild(n),this.applyBasicStyles();const o=ThemeProviderService.getInstance(),l=o.getStylesheet(e);this.applyThemeStyles(l),this.A=!![],this.V=null}rerender(e){this.U&&this.U(e)}applyBasicStyles(){const e="\n :host {\n display: block;\n contain: layout style paint;\n isolation: isolate;\n width: 100%;\n height: auto;\n }\n\n :host([drawer]),\n :host([address]),\n :host([buttons-cart-open]) {\n contain: none;\n isolation: auto;\n }\n ";try{if(this.isCSSStyleSheetSupported()){const n=new CSSStyleSheet;n.replaceSync(e),this.V.adoptedStyleSheets=[n,...this.V.adoptedStyleSheets]}else this.createFallbackStylesheet(e)}catch(et){this.createFallbackStylesheet(e)}}isCSSStyleSheetSupported(){try{if("undefined"==typeof CSSStyleSheet)return![];if("function"!=typeof CSSStyleSheet.prototype.replaceSync)return![];const e=new CSSStyleSheet;return e.replaceSync("/* test */"),!![]}catch(e){return![]}}applyThemeStyles(e){e.forEach(e=>{"string"==typeof e?this.createFallbackStylesheet(e):this.V.adoptedStyleSheets=[...this.V.adoptedStyleSheets,e]})}createFallbackStylesheet(e){const n=document.createElement("style");n.textContent=e,this.V&&this.V.appendChild(n)}}class PoweredByComponent extends BaseComponent{get hostClasses(){return["powered-by-container",this.params.context,this.getConfigs("global").layout.poweredByMode]}createPoweredBySection(){const e=document.createElement("div");e.className="pb-title-container";const n=document.createElement("span");n.className="pb-text",n.textContent="Powered by",e.appendChild(n);const o=document.createElement("span");o.className="pb-lc",o.textContent="LiquidCommerce",e.appendChild(o);const l=document.createElement("span");return l.className="pb-dot",l.textContent=".",e.appendChild(l),e}createDisclaimerSection(){const e=document.createElement("div");e.className="pb-disclaimer-container";const n=this.getDisclaimerConfig();return n.parts.forEach(n=>{"text"===n.type?e.appendChild(document.createTextNode(n.content)):"link"===n.type&&e.appendChild(this.createLink(n.href,n.text))}),e}getDisclaimerConfig(){return"checkout"===this.params.context?{parts:[{type:"text",content:"All orders are fulfilled by LiquidCommerce, which is owned and operated by ReserveBar Holdings Corp., an independent third party that facilitates transactions between customers and licensed retailers. By placing an order, you agree to "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"LiquidCommerce's Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms and Conditions of Sale"},{type:"text",content:"."}]}:{parts:[{type:"text",content:"LiquidCommerce is owned & operated by ReserveBar. See our "},{type:"link",href:"https://www.reservebar.com/privacy-policy.html",text:"Privacy Policy"},{type:"text",content:" and "},{type:"link",href:"https://www.reservebar.com/terms-conditions",text:"Terms & Conditions"},{type:"text",content:"."}]}}createLink(e,n){const o=document.createElement("a");return o.href=e,o.target="_blank",o.rel="noopener noreferrer",o.className="pb-link",o.textContent=n,o.setAttribute("role","link"),o.setAttribute("aria-label","Read "+n),o}template(){const e=this.createPoweredBySection(),n=this.createDisclaimerSection();return[e,n]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(e){const n=e.find(e=>"cart.promoCode"===e.path||"checkout.promoCode"===e.path);if(!n||!this.applyButton||!this.currentActiveTicker)return;const o=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);o&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!o&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(e){const n=this.store.get("cart.promoCode"),o=this.store.get("checkout.promoCode");return(null==n?void 0:n.code)===e||(null==o?void 0:o.code)===e}getActiveTickers(){var e;const n=this.store.get("address");return null===(e=this.params.tickers)||void 0===e?void 0:e.filter(e=>{var o;return isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:null===(o=null==n?void 0:n.address)||void 0===o?void 0:o.state})})}selectCurrentTicker(e){return 0===e.length?null:e[0]}generateTextContent(e){const n=document.createElement("div");n.classList.add("promo-ticker__text-group");const o=e.text.map(e=>e.trim()).map(e=>e.substring(0,50)).filter(e=>""!==e.trim()).slice(0,5);for(const l of o){const o=l.trim();if(!o)continue;const d=document.createElement("span");d.classList.add("promo-ticker__text-item"),d.textContent=o,n.appendChild(d);const h=document.createElement("span");h.classList.add("promo-ticker__separator"),h.textContent=e.separator,n.appendChild(h)}return n}async handlePromoClick(){var e;(null===(e=this.currentActiveTicker)||void 0===e?void 0:e.promoCode)&&("cart"===this.params.context&&await this.commands.cart.applyPromoCode(this.currentActiveTicker.promoCode),"checkout"===this.params.context&&await this.commands.checkout.applyPromoCode(this.currentActiveTicker.promoCode))}template(){const e=this.getActiveTickers();if(this.currentActiveTicker=this.selectCurrentTicker(e),!this.currentActiveTicker)return[];this.promoCodeApplied=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);const n=document.createElement("div");n.classList.add("promo-ticker__content");const o=document.createElement("div");o.classList.add("promo-ticker__track");for(let d=0;d<5;d++)o.appendChild(this.generateTextContent(this.currentActiveTicker));n.appendChild(o);const l=document.createElement("button");return l.type="button",l.classList.add("promo-ticker__cta"),l.textContent="APPLY",l.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(l.disabled=!![],l.textContent="APPLIED"),l.addEventListener("click",()=>this.handlePromoClick()),l.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handlePromoClick())}),this.applyButton=l,[n,l]}}class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const e=this.config||{};if(e.showIcon===![])return null;const n={warning:"warning",success:"success",info:"info"},o={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},l=n[this.params.messageType]||"warning",d=document.createElement("div");return d.className="alert-icon alert-icon-"+this.params.messageType,d.appendChild(htmlStringToElement(o[l]({width:16,height:16,className:"alert-icon-svg"}))),d}template(){var e;const n=[],o=this.getIconElement();o&&n.push(o);const l=document.createElement("span");if(l.className="alert-message",l.textContent=this.params.message,n.push(l),"detailed"===(null===(e=this.config)||void 0===e?void 0:e.alertType)&&this.params.currentTotal){const e=document.createElement("div");e.className="alert-details";const o=document.createElement("small");o.className="alert-details-text",o.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),e.appendChild(o),n.push(e)}return n}}const Et=LoggerFactory.get("ElementsClientHelper"),isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),getType=e=>null===e?"null":Array.isArray(e)?"array":typeof e;function deepMergeConfigs(e,n){if(!e||!n)return e;const o={...e},l=[];for(const d in n){const h=n[d],u=o[d];if(!(d in e)){l.push('Property "'+d+'" does not exist in target schema, skipping merge.');continue}const p=getType(h),m=getType(u);p===m?isObject(h)&&isObject(u)?o[d]=deepMergeConfigs(u,h):o[d]=h:l.push('Type mismatch for key "'+d+'": source is '+p+", target is "+m+". Skipping merge.")}return l.length>0&&Et.warn("Merging configurations with warnings:",l),o}const _t=new Map([["global.layout.enablePersonalization",[d.PRODUCT,d.CART,d.CHECKOUT,d.ENGRAVING_FORM,d.ENGRAVING_VIEW,d.PRODUCT_INTERACTIONS,d.CART_ITEM,d.CHECKOUT_ITEM]],["global.layout.personalizationText",[d.PRODUCT,d.CART,d.CHECKOUT,d.ENGRAVING_FORM,d.ENGRAVING_VIEW,d.CART_ITEM]],["global.layout.personalizationCardStyle",[d.PRODUCT,d.CART,d.CHECKOUT,d.ENGRAVING_FORM,d.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[d.CART,d.CART_PROMO_CODE,d.CART_FOOTER,d.CHECKOUT_ORDER_SUMMARY,d.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[d.CART,d.CHECKOUT,d.ADDRESS,d.INPUT,d.BIRTHDATE_INPUT,d.ADDRESS_INPUT,d.CHECKOUT_DELIVER_TO,d.CHECKOUT_BUYER,d.CHECKOUT_BILLING,d.CHECKOUT_PAYMENT,d.CART_PROMO_CODE]],["global.layout.showPoweredBy",[d.CART,d.CHECKOUT,d.CHECKOUT_COMPLETED,d.POWERED_BY,d.CART_FOOTER,d.CHECKOUT_ORDER_SUMMARY,d.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[d.POWERED_BY]],["product.layout.showImages",[d.PRODUCT,d.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[d.PRODUCT]],["product.layout.showDescription",[d.PRODUCT,d.PRODUCT_DESCRIPTION,d.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[d.PRODUCT,d.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[d.PRODUCT,d.PRODUCT_RETAILERS,d.PRODUCT_RETAILERS_CAROUSEL,d.PRODUCT_RETAILERS_POPUP,d.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[d.PRODUCT,d.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[d.PRODUCT,d.PRODUCT_IMAGE_CAROUSEL,d.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[d.PRODUCT,d.PRODUCT_RETAILERS,d.PRODUCT_RETAILERS_CAROUSEL,d.PRODUCT_RETAILERS_POPUP,d.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[d.PRODUCT,d.PRODUCT_RETAILERS,d.PRODUCT_RETAILERS_CAROUSEL,d.PRODUCT_RETAILERS_POPUP,d.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[d.PRODUCT,d.PRODUCT_ADD_TO_CART_SECTION,d.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[d.PRODUCT,d.PRODUCT_ADD_TO_CART_SECTION,d.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[d.PRODUCT,d.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[d.PRODUCT,d.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[d.CART,d.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[d.CART,d.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[d.CART,d.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[d.CART,d.CART_FOOTER]],["checkout.layout.emailOptIn",[d.CHECKOUT,d.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[d.CHECKOUT,d.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[d.CHECKOUT,d.CHECKOUT_GIFT_CARDS,d.CHECKOUT_ORDER_SUMMARY,d.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[d.CHECKOUT,d.CHECKOUT_ORDER_SUMMARY,d.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[d.CHECKOUT,d.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[d.CHECKOUT,d.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[d.CHECKOUT,d.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[d.CHECKOUT,d.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[d.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(e,n){const o=new Set;for(const l of Object.keys(n)){const n=_t.get(e+"."+l);if(n)for(const e of n)o.add(e)}return Array.from(o)}class ElementsBaseClient{constructor(e){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.injectedComponents=new Map,this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.apiClient=ApiClientService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.fingerPrintService=FingerPrintService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientAction=ClientActionService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.debugPanel=DebugPanelService.getInstance(),this.logger=LoggerFactory.get("Client"),this.authClient=AuthClientService.getInstance({apiKey:e.apiKey,env:e.env,baseUrl:e.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(e){throw this.logger.error("Failed to prepare client",e),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),e}}async prepareEssentialServices(){this.clientConfig.set("version",et.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),this.logger.info("🔐 Starting authentication and loading configurations...");const{success:e,configs:n}=await this.authClient.authenticateAndGetConfigs();if(!e||!n)throw this.clientPrepared=![],new SDKError("Authentication failed. Please try again.",!![]);this.logger.info("✅ Authentication completed and configurations loaded"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authClient),this.logger.info("✅ API client setup completed");let o=n;this.clientConfig.set("partnerCode",o.configurations.partnerCode),this.clientConfig.set("partnerName",o.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const l=await this.fingerPrintService.getId(o.configurations.partnerCode),d=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",l),this.clientConfig.set("isLocalStorageAvailable",d);const h=d?null:await this.apiClient.getPersistedStore(l);if(await this.store.initialize({userDeviceId:l,isLocalStorageAvailable:d,persistedStore:h}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const e=this.clientConfig.get("customTheme"),n=o.global.layout.showPoweredBy;o=deepMergeConfigs(o,e),o.global.layout.showPoweredBy=n}await this.themeProvider.initialize(o),this.logger.info("✅ Theme provider initialized"),this.logger.info("📦 Registering essential components..."),this.registerEssentialComponents(),this.logger.info("✅ Essential components registered"),this.logger.info("🎯 Essential services preparation completed")}deferHeavyInitialization(){setTimeout(async()=>{try{await this.initializeHeavyServices()}catch(e){this.logger.error("Heavy initialization failed",e)}},0)}async initializeHeavyServices(){const e=this.themeProvider.getConfigs("configurations");await this.googleTagManager.initialize({partnerName:e.partnerName,partnerCode:e.partnerCode,enablePartnerGTM:e.enablePartnerGTM,partnerGTMId:e.partnerGTMId||void 0,enableLiquidCommerceGTM:e.enableLiquidCommerceGTM,liquidCommerceGTMId:e.liquidCommerceGTMId}),this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(e){if(this.ensureAllComponentsRegistered(),!e||"object"!=typeof e)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof e,!![]);const{type:n,containerId:o,...l}=e;if(!o||"string"!=typeof o)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof o?'"'+o+'"':o),!![]);if(!n)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const h=o.replace("#",""),u=document.getElementById(h);if(!u)return console.warn("Container with ID '"+h+"' not found"),null;u.innerHTML="";const p={type:e.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...l},m=ComponentFactoryService.createElement(p);return safeReplaceChildren(u,m),e.type===d.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(h,e.type,m)}async processInjectProduct(e){if(this.ensureAllComponentsRegistered(),0===e.length)throw new SDKError("At least one product is required. Received empty array.",!![]);e.length>20&&this.logger.warn("You can only inject up to 20 products at a time, limiting to 20 products");const n=e.slice(0,20),o=[],l=[];for(const d of n){if(!d||"object"!=typeof d){this.logger.warn("Invalid product parameter: must be an object");continue}if(!d.containerId||"string"!=typeof d.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+d.identifier+"'");continue}const e=d.containerId.replace("#","").trim();if(!e){this.logger.warn("Container ID is required for product with ID '"+d.identifier+"'");continue}const n=document.getElementById(e);if(!n){this.logger.warn("Container with ID '"+e+"' not found for product '"+d.identifier+"'");continue}const l=o.every(n=>n.containerId!==e);if(!l){this.logger.warn("Duplicate container ID '"+e+"' found, skipping");continue}if(!d.identifier||"string"!=typeof d.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+e+"'");continue}const h=o.every(e=>e.identifier!==d.identifier);h?o.push({containerId:e,identifier:d.identifier}):this.logger.warn("Duplicate product identifier '"+d.identifier+"' found, skipping")}for(const h of o){const e=ComponentFactoryService.createElement({type:d.PRODUCT,useShadowDom:!![],productId:h.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),n=document.getElementById(h.containerId);n?(n.innerHTML="",n.appendChild(e),l.push(this.createInjectedComponentWrapper(h.containerId,d.PRODUCT,e)),await this.commands.product.createProductInstance(h.identifier,!![])):this.logger.warn("Product ("+h.identifier+") container with ID '"+h.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(o.map(e=>e.identifier)),l}async injectProductList(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e.containerId,d.CHECKOUT),void 0;if(!e)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!e.containerId||"string"!=typeof e.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof e.containerId?'"'+e.containerId+'"':e.containerId),!![]);if(e.rows&&("number"!=typeof e.rows||e.rows<1||e.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+e.rows,!![]);if(e.columns&&("number"!=typeof e.columns||e.columns<1||e.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+e.columns,!![]);if(e.cardVariant&&!Object.values(m).includes(e.cardVariant))throw new SDKError('Invalid card variant "'+e.cardVariant+'". Valid options: '+Object.values(m).join(", "),!![]);if(e.filters&&!Array.isArray(e.filters))throw new SDKError("Filters must be an array. Received: "+typeof e.filters,!![]);if(e.filters&&e.filters.length>0){const n=Object.values(v);for(const o of e.filters)if(!n.includes(o))throw new SDKError('Invalid filter "'+o+'". Valid options: '+n.join(", "),!![])}if(e.productUrl&&"string"==typeof e.productUrl&&!e.productUrl.includes("{upc}")&&!e.productUrl.includes("{grouping}"))throw new SDKError('Product URL must include either {upc} or {grouping} placeholder. Received: "'+e.productUrl+'"',!![]);const n=document.getElementById(e.containerId.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+e.containerId+'". Make sure the element exists before adding the product list.',!![]);const o=ComponentFactoryService.createElement({type:d.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:e.cardVariant||m.STANDARD,fillCard:e.fillCard||![],rows:e.rows||4,columns:e.columns||4,filters:e.filters||[],productUrl:e.productUrl});safeReplaceChildren(n,o)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const e=ComponentFactoryService.createElement({type:d.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(e),this.cartDrawerCreated=!![]}catch(e){this.logger.warn("Failed to create cart drawer:",e)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(e,n,o){const l={getType:()=>n,getElement:()=>document.getElementById(e),rerender:()=>{try{o&&"function"==typeof o.rerender?o.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+e+"' does not support rerender")}catch(n){this.logger.warn("Failed to rerender component in container '"+e+"'")}}};return this.injectedComponents.set(e,l),l}rerenderInjectedComponentsByType(e){for(const[n,o]of this.injectedComponents)o.getType()===e&&o.rerender()}isElementsEnabled(){var e;try{const n=this.themeProvider.getConfigs("configurations");return null!==(e=null==n?void 0:n.isElementsEnabled)&&void 0!==e?e:![]}catch(n){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",n),!![]}}injectDisabledElementsError(e,n){const o=document.getElementById(e.replace("#",""));if(!o)return this.logger.warn("Container with ID '"+e+"' not found for disabled elements error"),void 0;let l;l=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({message:"Elements is not enabled.",componentType:n}),o.innerHTML="",safeReplaceChildren(o,l)}registerEssentialComponents(){ComponentFactoryService.registerComponent(d.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(d.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(d.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(d.CART,AddressInputComponent),ComponentFactoryService.registerComponent(d.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LIST_SEARCH,ProductListSearchComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(d.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(d.INPUT,InputComponent),ComponentFactoryService.registerComponent(d.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(d.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(d.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(d.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(d.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(d.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(d.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(d.ALERT,AlertComponent),ComponentFactoryService.registerComponent(d.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(d.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(d.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(d.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(d.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(d.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(d.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(d.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(d.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(d.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(d.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(d.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(d.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(d.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(d.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(d.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(d.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(d.CART,CartComponent),ComponentFactoryService.registerComponent(d.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(d.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(d.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(d.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(d.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(d.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(d.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(d.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(d.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(d.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(d.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(d.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(e,n)=>{if(!e||"string"!=typeof e)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);this.ensureCartDrawerExists();const o=document.getElementById(e.replace("#",""));if(!o)throw new SDKError('Cannot find element with ID "'+e+'". Make sure the element exists before adding the cart button.',!![]);const l=ComponentFactoryService.createElement({type:d.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:n});o.innerHTML="",safeReplaceChildren(o,l)},floatingCartButton:e=>{this.ensureCartDrawerExists();const n=ComponentFactoryService.createElement({type:d.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:e});document.body.appendChild(n)},cartSubtotal:e=>{if(!e||"string"!=typeof e)throw new SDKError("Cart subtotal display requires a valid element ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);const n=document.getElementById(e.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+e+'". Make sure the element exists before displaying cart subtotal.',!![]);n.innerHTML="",n.classList.add("lce-cart-subtotal");const E=e=>{n.textContent=formatCentToDollarText(e)},o=this.store.get("cart.subtotal")||0;E(o),this.store.watch("cart.subtotal",()=>{const e=this.store.get("cart.subtotal")||0;E(e)})},cartItemsCount:(e,n)=>{if(!e||"string"!=typeof e)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);let o=!![];n&&"boolean"==typeof n.hideZero&&(o=n.hideZero);const l=document.getElementById(e.replace("#",""));if(!l)throw new SDKError('Cannot find element with ID "'+e+'". Make sure the element exists before displaying cart items count.',!![]);l.innerHTML="",l.classList.add("lce-cart-items-count");const R=e=>{l.textContent=e.toString(),0===e?(o&&(l.style.visibility="hidden"),l.classList.add("no-items")):(o&&(l.style.visibility="visible"),l.classList.remove("no-items"))},d=this.store.get("cart.itemsQuantity")||0;R(d),this.store.watch("cart.itemsQuantity",()=>{const e=this.store.get("cart.itemsQuantity")||0;R(e)})}}}async injectProductElement(e){if(!Array.isArray(e))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof e,!![]);if(!this.isElementsEnabled()){for(const n of e)this.injectDisabledElementsError(n.containerId,d.PRODUCT);return[]}return await this.processInjectProduct(e)}async injectAddressElement(e,n){if(!e||"string"!=typeof e)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:d.ADDRESS,containerId:e,options:n}):(this.injectDisabledElementsError(e,d.ADDRESS),null)}async injectCartElement(e){if(!e||"string"!=typeof e)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:d.CART,containerId:e}):(this.injectDisabledElementsError(e,d.CART),null)}async injectCheckoutElement(e){if(!e||"string"!=typeof e)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:d.CHECKOUT,containerId:e}):(this.injectDisabledElementsError(e,d.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(e,n){try{SingletonManager.setContext({isBuilder:![]});const l=ClientConfigService.getInstance();l.initialize(e,{env:n.env,isBuilder:![],debugMode:n.debugMode,customTheme:n.customTheme,promoTicker:n.promoTicker,proxy:n.proxy,development:n.development});const d=l.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const h=await SingletonManager.getClient(d);if(!h.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const u={injectProductElement:h.injectProductElement.bind(h),injectAddressElement:h.injectAddressElement.bind(h),injectCartElement:h.injectCartElement.bind(h),injectCheckoutElement:h.injectCheckoutElement.bind(h),injectProductList:h.injectProductList.bind(h),ui:h.ui,actions:h.actions,getInjectedComponents:h.getInjectedComponents.bind(h)};window.elements=u;const p=PubSubService.getInstance();return p.publishAction(o.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:l.get("version")}),u}catch(l){try{const e=LoggerFactory.get("ElementsClientInit");e.error("Elements Client Initialization failed",l)}catch(d){console.error("[LiquidCommerce Elements] Client initialization failed:",null==l?void 0:l.message)}try{const e=ClientConfigService.getInstance(),n=PubSubService.getInstance();n.publishAction(o.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==l?void 0:l.message),timestamp:Date.now(),version:e.get("version")||"unknown"})}catch(h){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}const Dt={CORE:{MAIN_SCRIPT:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode"},PROMO_TICKER:{CODE:"data-promo-code",TEXT:"data-promo-text",SEPARATOR:"data-promo-separator",ACTIVE_FROM:"data-promo-active-from",ACTIVE_UNTIL:"data-promo-active-until",CODE_PARAM:"data-promo-code-param"},PRODUCT:{PRODUCT:"data-product",CONTAINER:"data-container",PARAM:"data-product-param",FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",LCE_PRODUCT:"data-lce-product"},PRODUCT_LIST:{LIST:"data-liquid-commerce-elements-products-list",SCRIPT:"data-liquid-commerce-elements-products",CARD:"data-card",CARD_FILL:"data-card-fill",ROWS:"data-rows",COLUMNS:"data-columns",FILTERS:"data-filters",PRODUCT_URL:"data-product-url"},CART:{BUTTON:"data-cart-button",BADGE_BUTTON:"data-cart-badge-button",MOBILE_BUTTON:"data-cart-mobile-button",MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",BUTTON_HIDDEN:"data-cart-button-hidden",TOGGLE_BUTTON:"data-lce-cart-toggle-button",ITEMS_COUNT:"data-lce-cart-items-count"},DEVELOPMENT:"data-liquid-commerce-elements-development"};function startsWithLcePrefix(e){return null!==e&&"lce_"===e.substring(0,4)}function generateElementId({prefix:e,index:n}){const o=Math.random().toString(36).substring(2,7),l=void 0!==e?e:"",d=void 0!==n?n:"",h=l&&d?"-":"";return""+l+h+d+o}function pairsFromMainScript(e){const n=[];try{const l=e.getAttributeNames().filter(e=>e.substring(0,12)===Dt.PRODUCT.PRODUCT);for(const d of l)try{const o=d.match(/^data-product(-(.+))?$/),l=(null==o?void 0:o[2])?"-"+o[2]:"",h=""+Dt.PRODUCT.CONTAINER+l;if(e.hasAttribute(h)){const o=e.getAttribute(h),l=e.getAttribute(d);o&&l&&n.push({containerId:o,identifier:l})}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",o)}}catch(l){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",l)}return n}function pairsFromProductsScript(){const e=[];try{const o=document.querySelectorAll("script["+Dt.PRODUCT_LIST.SCRIPT+"]");for(const l of o)try{const n=JSON.parse(l.textContent||"[]");if(!Array.isArray(n))continue;for(const o of n)o.containerId&&o.identifier&&e.push({containerId:o.containerId,identifier:o.identifier})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",n)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",o)}return e}function pairsFromAttributedElements(){const e=[];try{const o=document.querySelectorAll("div["+Dt.PRODUCT.LCE_PRODUCT+"]");let l=0;for(const d of o)try{const n=generateElementId({prefix:"lce-p",index:l});d.setAttribute("id",n);const o=d.getAttribute(Dt.PRODUCT.LCE_PRODUCT);n&&o&&e.push({containerId:n,identifier:o}),l+=1}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",n)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",o)}return e}async function addProductToCartViaQueryParam(e,n){try{const l=n.getAttribute(Dt.PRODUCT.PARAM),d=n.getAttribute(Dt.PRODUCT.FULFILLMENT_TYPE_PARAM);if(!l)return;if(!startsWithLcePrefix(l))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+l+'" because it does not start with "lce_" prefix.'),void 0;const u=new URLSearchParams(window.location.search),p=u.get(l);if(!p)return;let m=h.SHIPPING;if(d)if(startsWithLcePrefix(d)){const e=u.get(d);e!==h.ON_DEMAND&&e!==h.SHIPPING||(m=e)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+d+'" because it does not start with "lce_" prefix.');try{await e.actions.cart.addProduct([{identifier:p,fulfillmentType:m,quantity:1}],!![])}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",o)}}catch(l){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",l)}}async function addPromoCodeToCartViaQueryParam(e,n){try{const l=n.getAttribute(Dt.PROMO_TICKER.CODE_PARAM);if(!l)return;if(!startsWithLcePrefix(l))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+l+'" because it does not start with "lce_" prefix.'),void 0;const d=new URLSearchParams(window.location.search),h=d.get(l);if(!h)return;try{await e.actions.cart.applyPromoCode(h)}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",o)}}catch(l){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",l)}}async function setupCartButtonWithPosition(e,n,o,l){var d,h,u;try{const p=o.includes("mobile"),m=p?"mobile":"desktop",v=!p,y=n.getAttribute(o),b=n.getAttribute(l);if(!n.hasAttribute(o)&&!n.hasAttribute(l))return;if(v){if(n.hasAttribute(o)&&!y)return e.ui.floatingCartButton(![]),void 0;if(n.hasAttribute(l)&&!b)return e.ui.floatingCartButton(!![]),void 0}const x=y||b,w=!!b;if(!x)return v&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),e.ui.floatingCartButton(w)),void 0;const C=["above","below","replace","inside"],k=x.match(/^(\w+):(.+)$/),S=k&&C.includes(k[1])?k[1]:"inside";let _=k?k[2]:x;/^[#.]/.test(_)||/\s/.test(_)||(_="#"+_);const D=document.querySelector(_);if(!D)return v&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+_+'" not found. Using floating button.'),e.ui.floatingCartButton(w)),void 0;const I=document.createElement("div");switch(I.classList.add("lce-cart-"+m+"-button-container"),I.id=generateElementId({prefix:"lce-cart-"+m+"-btn"}),S){case"above":null===(d=D.parentNode)||void 0===d?void 0:d.insertBefore(I,D);break;case"below":null===(h=D.parentNode)||void 0===h?void 0:h.insertBefore(I,D.nextSibling);break;case"replace":null===(u=D.parentNode)||void 0===u?void 0:u.replaceChild(I,D);break;default:D.appendChild(I)}e.ui.cartButton(I.id,w)}catch(p){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",p)}}async function setupCartButtons(e,n){n.hasAttribute(Dt.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(e,n,Dt.CART.BUTTON,Dt.CART.BADGE_BUTTON),await setupCartButtonWithPosition(e,n,Dt.CART.MOBILE_BUTTON,Dt.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(e){try{const n=document.querySelector("div["+Dt.PRODUCT_LIST.LIST+"]");if(!n)return;const o="lce-products-list-container";n.className="lce-products-list-container",n.id=o;const l=n.getAttribute(Dt.PRODUCT_LIST.CARD)||"standard",d=n.hasAttribute(Dt.PRODUCT_LIST.CARD_FILL),h=Number.parseInt(n.getAttribute(Dt.PRODUCT_LIST.ROWS)||"3",10)||3,u=Number.parseInt(n.getAttribute(Dt.PRODUCT_LIST.COLUMNS)||"4",10)||4,p=n.getAttribute(Dt.PRODUCT_LIST.FILTERS),m=n.getAttribute(Dt.PRODUCT_LIST.PRODUCT_URL)||void 0;let v=[];p&&(v=p.split(",").map(e=>e.trim()).filter(e=>e.length>0)),await e.injectProductList({containerId:o,rows:h,columns:u,cardVariant:l,fillCard:d,filters:v,productUrl:m})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",n)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async e=>{const n=e.detail;if(!n.data.isReady)return;const o=window.elements,l=document.querySelectorAll("["+Dt.CART.TOGGLE_BUTTON+"]");if(l.length>0)for(const h of l)h.addEventListener("click",async e=>{e.stopPropagation(),e.preventDefault(),o.actions.cart.toggleCart()});const d=document.querySelectorAll("["+Dt.CART.ITEMS_COUNT+"]");if(d.length>0){let e=0;for(const n of d){const l=n.getAttribute(Dt.CART.ITEMS_COUNT),d=!(l&&"keep-zero"===l),h=Boolean(null==n?void 0:n.id);let u;h?u=n.id:(u=generateElementId({prefix:"lce-cart-items-count",index:e}),n.id=u),o.ui.cartItemsCount(u,{hideZero:d}),e+=1}}})}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",et)}}function getDevelopmentConfigs(){const e=document.querySelector("script["+Dt.DEVELOPMENT+"]");if(e)try{return JSON.parse(e.textContent||"{}")}catch(n){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",n),void 0}}async function ElementsAutoInitialize(){var e,o,l,d,h,p;try{const p=document.querySelector("script["+Dt.CORE.MAIN_SCRIPT+"]");if(!p)return;const m=p.getAttribute(Dt.CORE.TOKEN),v=p.getAttribute(Dt.CORE.ENV)||n.PRODUCTION,y=p.getAttribute(Dt.CORE.DEBUG_MODE);if(!m)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const b=p.getAttribute(Dt.PROMO_TICKER.CODE),x=p.getAttribute(Dt.PROMO_TICKER.TEXT),w=null!==(e=p.getAttribute(Dt.PROMO_TICKER.SEPARATOR))&&void 0!==e?e:"•",C=null!==(o=p.getAttribute(Dt.PROMO_TICKER.ACTIVE_FROM))&&void 0!==o?o:void 0,k=null!==(l=p.getAttribute(Dt.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==l?l:void 0,S=pairsFromMainScript(p),_=pairsFromProductsScript(),D=pairsFromAttributedElements(),I=[...S,..._,...D],A=b&&x&&C&&k?{promoCode:b,text:x.split("|").map(e=>e.trim()).filter(e=>e.length>0),separator:w,activeFrom:null===(d=new Date(C))||void 0===d?void 0:d.toISOString(),activeUntil:null===(h=new Date(k))||void 0===h?void 0:h.toISOString()}:void 0;let O=u.NONE;y&&v!==n.PRODUCTION&&(O=y),setupEventListeners();const z=await Elements(m,{env:v,debugMode:O,promoTicker:A?[A]:void 0,development:getDevelopmentConfigs()});if(!z)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);setupCartButtons(z,p),0!==I.length&&z.injectProductElement(I).catch(e=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",e)}),initializeProductsList(z),addProductToCartViaQueryParam(z,p),addPromoCodeToCartViaQueryParam(z,p)}catch(m){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(p=null==m?void 0:m.message)&&void 0!==p?p:String(m))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",et)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",et)}},50)}catch(et){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",et)}}class ElementsBuilderClient extends ElementsBaseClient{async updateComponentGlobalConfigs(e){try{if(!e)throw new SDKError("Global configuration object is required.",!![]);if(this.themeProvider.updateComponentGlobalConfigs(e),e.layout&&Object.keys(e.layout).length>0){await this.commands.product.rerenderAllProducts(),this.commands.cart.rerenderCart(),this.commands.checkout.rerenderCheckout();for(const n of getComponentTypesForLayoutFields("global.layout",e.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(n){throw this.logger.error("❌ Failed to update global theme configuration",n),new SDKError("Failed to update global configuration: "+n.message,!![])}}async updateProductComponent(e){try{if(!e)throw new SDKError("Product configuration object is required.",!![]);if(this.themeProvider.updateProductComponent(e),e.layout&&Object.keys(e.layout).length>0){await this.commands.product.rerenderAllProducts();for(const n of getComponentTypesForLayoutFields("product.layout",e.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(n){throw this.logger.error("❌ Failed to update product component theme",n),new SDKError("Failed to update product configuration: "+n.message,!![])}}updateCartComponent(e){try{if(!e)throw new SDKError("Cart configuration object is required.",!![]);if(this.themeProvider.updateCartComponent(e),e.layout&&Object.keys(e.layout).length>0){this.commands.cart.rerenderCart();for(const n of getComponentTypesForLayoutFields("cart.layout",e.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(n){throw this.logger.error("❌ Failed to update cart component theme",n),new SDKError("Failed to update cart configuration: "+n.message,!![])}}updateCheckoutComponent(e){try{if(!e)throw new SDKError("Checkout configuration object is required.",!![]);if(this.themeProvider.updateCheckoutComponent(e),e.layout&&Object.keys(e.layout).length>0){this.commands.checkout.rerenderCheckout();for(const n of getComponentTypesForLayoutFields("checkout.layout",e.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(n){throw this.logger.error("❌ Failed to update checkout component theme",n),new SDKError("Failed to update checkout configuration: "+n.message,!![])}}updateAddressComponent(e){try{if(!e)throw new SDKError("Address configuration object is required.",!![]);this.themeProvider.updateAddressComponent(e),this.logger.info("✅ Address component theme updated - changes applied to address elements")}catch(n){throw this.logger.error("❌ Failed to update address component theme",n),new SDKError("Failed to update address configuration: "+n.message,!![])}}async injectElement(e){if(!e)throw new SDKError("Element injection requires container ID and type parameters.",!![]);if(!e.containerId||"string"!=typeof e.containerId)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof e.containerId?'"'+e.containerId+'"':e.containerId),!![]);if(!e.type)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);return await this.processInjectElement(e)}async injectProductElement(e){if(!Array.isArray(e))throw new SDKError("Product injection requires an array of product parameters. Received: "+typeof e,!![]);return await this.processInjectProduct(e)}async injectAddressElement(e,n){if(!e||"string"!=typeof e)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return await this.processInjectElement({type:d.ADDRESS,containerId:e,options:n})}async injectCartElement(e){if(!e||"string"!=typeof e)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);return await this.processInjectElement({type:d.CART,containerId:e})}async injectCheckoutElement(e,n){if(!e||"string"!=typeof e)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);const o=await this.processInjectElement({type:d.CHECKOUT,containerId:e});if(null==n?void 0:n.simulatePresale){const e=n.presaleExpiresInMinutes||15,o=new Date;o.setMinutes(o.getMinutes()+e),this.store.set("checkout.presale",{isLocked:!![],expiresAt:o.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+e+" minutes")}return o}}async function ElementsBuilder(e,n){try{SingletonManager.setContext({isBuilder:!![]});const l=ClientConfigService.getInstance();l.initialize(e,{env:n.env,isBuilder:!![],debugMode:n.debugMode,customTheme:n.customTheme,promoTicker:n.promoTicker,proxy:void 0,development:void 0});const d=l.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const h=await SingletonManager.getClient(d);if(!h.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const u={updateComponentGlobalConfigs:h.updateComponentGlobalConfigs.bind(h),updateProductComponent:h.updateProductComponent.bind(h),updateAddressComponent:h.updateAddressComponent.bind(h),updateCartComponent:h.updateCartComponent.bind(h),updateCheckoutComponent:h.updateCheckoutComponent.bind(h),injectElement:h.injectElement.bind(h),injectProductElement:h.injectProductElement.bind(h),injectAddressElement:h.injectAddressElement.bind(h),injectCartElement:h.injectCartElement.bind(h),injectCheckoutElement:h.injectCheckoutElement.bind(h),injectProductList:h.injectProductList.bind(h),actions:h.actions};window.elementsBuilder=u;const p=PubSubService.getInstance();return p.publishAction(o.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:l.get("version")}),u}catch(l){try{const e=LoggerFactory.get("ElementsBuilderClientInit");e.error("Elements Builder Client Initialization failed",l)}catch(d){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==l?void 0:l.message)}try{const e=ClientConfigService.getInstance(),n=PubSubService.getInstance();n.publishAction(o.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==l?void 0:l.message),timestamp:Date.now(),version:e.get("version")||"unknown"})}catch(h){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const e=window.onerror;window.onerror=(n,o,l,d,h)=>isSDKError(h,o)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:n,source:o,lineno:l,colno:d,error:h}),!![]):e?e(n,o,l,d,h):![];const n=window.onunhandledrejection;window.onunhandledrejection=e=>{if(e.reason&&isSDKError(e.reason))return console.error("[LiquidCommerce Elements] Unhandled SDK promise rejection:",e.reason),e.preventDefault(),void 0;n&&n.call(window,e)};try{initializeDOMPolyfills()}catch(Pt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Pt)}try{triggerElementsAutoInit()}catch(It){console.error("[LiquidCommerce Elements] Auto-initialization failed:",It)}}catch(Tt){console.error("[LiquidCommerce Elements] SDK initialization failed:",Tt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|