@liquidcommerce/elements-sdk 2.6.0-beta.31 → 2.6.0-beta.32

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.
Files changed (32) hide show
  1. package/dist/index.checkout.esm.js +16000 -0
  2. package/dist/index.esm.js +11428 -11205
  3. package/dist/types/auto-initialize/checkout.d.ts +2 -0
  4. package/dist/types/auto-initialize/shared-utils.d.ts +19 -0
  5. package/dist/types/clients/checkout.d.ts +23 -0
  6. package/dist/types/core/client/actions/base-action.service.d.ts +15 -0
  7. package/dist/types/core/client/actions/client-address-action.service.d.ts +18 -0
  8. package/dist/types/core/client/actions/client-cart-action.service.d.ts +37 -0
  9. package/dist/types/core/client/actions/client-checkout-action.service.d.ts +48 -0
  10. package/dist/types/core/client/actions/client-product-action.service.d.ts +12 -0
  11. package/dist/types/core/client/client-action.service.d.ts +6 -73
  12. package/dist/types/core/client/client-config.service.d.ts +3 -4
  13. package/dist/types/core/store/interfaces/core.interface.d.ts +3 -1
  14. package/dist/types/core/store/interfaces/metadata.interface.d.ts +11 -0
  15. package/dist/types/core/store/store.constant.d.ts +2 -0
  16. package/dist/types/index.checkout.d.ts +7 -0
  17. package/dist/types/index.checkout.umd.d.ts +4 -0
  18. package/dist/types/index.d.ts +2 -2
  19. package/dist/types/interfaces/api/checkout.interface.d.ts +2 -1
  20. package/dist/types/interfaces/configs/checkout.interface.d.ts +1 -0
  21. package/dist/types/interfaces/core.interface.d.ts +17 -7
  22. package/dist/types/modules/checkout/checkout.commands.d.ts +6 -2
  23. package/dist/types/modules/checkout/checkout.component.d.ts +3 -0
  24. package/dist/types/modules/checkout/components/checkout-header.component.d.ts +1 -0
  25. package/package.json +14 -4
  26. package/umd/elements-checkout.js +1 -0
  27. package/umd/elements.js +1 -1
  28. /package/dist/types/{auto-initialize.d.ts → auto-initialize/main.d.ts} +0 -0
  29. /package/dist/types/{elements-base-client.d.ts → clients/base.d.ts} +0 -0
  30. /package/dist/types/{elements-builder-client.d.ts → clients/builder.d.ts} +0 -0
  31. /package/dist/types/{elements-client-helper.d.ts → clients/helpers.d.ts} +0 -0
  32. /package/dist/types/{elements-client.d.ts → clients/main.d.ts} +0 -0
package/umd/elements.js CHANGED
@@ -1 +1 @@
1
- (function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):(e="undefined"!=typeof globalThis?globalThis:e||self,i(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 i of e)"string"==typeof i?this.appendChild(document.createTextNode(i)):this.appendChild(i)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...e){const i=document.createDocumentFragment();for(const r of e)"string"==typeof r?i.appendChild(document.createTextNode(r)):i.appendChild(r);this.insertBefore(i,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...e){const i=this.parentNode;if(!i)return;const r=document.createDocumentFragment();for(const s of e)"string"==typeof s?r.appendChild(document.createTextNode(s)):r.appendChild(s);i.replaceChild(r,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...e){const i=this.parentNode;if(!i)return;const r=document.createDocumentFragment();for(const s of e)"string"==typeof s?r.appendChild(document.createTextNode(s)):r.appendChild(s);i.insertBefore(r,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...e){const i=this.parentNode;if(!i)return;const r=document.createDocumentFragment();for(const s of e)"string"==typeof s?r.appendChild(document.createTextNode(s)):r.appendChild(s);i.insertBefore(r,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=e=>{const i={};for(const[r,s]of e)i[r]=s;return i})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(yt){console.warn("DOM polyfills initialization failed:",yt)}}function safeReplaceChildren(e,...i){try{if("replaceChildren"in e&&"function"==typeof e.replaceChildren)e.replaceChildren(...i);else{for(;e.firstChild;)e.removeChild(e.firstChild);for(const r of i)"string"==typeof r?e.appendChild(document.createTextNode(r)):e.appendChild(r)}}catch(r){console.error("replaceChildren operation failed:",r),1===i.length&&"string"==typeof i[0]&&(e.innerHTML=i[0])}}class SDKError extends Error{constructor(e,i=![]){super(e),this.name="SDKError",this.isSdk=!![],this.reThrow=i,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(e,i){if((null==e?void 0:e.isSdk)===!![])return e instanceof SDKError&&e.reThrow?![]:!![];if(!e||"object"!=typeof e)return i?isSDKSource(i):![];const r=String((null==e?void 0:e.message)||""),s=/liquidcommerce\s+elements/i.test(r),c=String((null==e?void 0:e.stack)||""),d=(null==e?void 0:e.source)||i||"",h=[/@[/\\](?: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],u=[/\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/],g=[/(?: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],b=isSDKSource(d),x=h.some(e=>e.test(c)),k=u.some(e=>e.test(c)),E=g.some(e=>e.test(c)),_=v.some(e=>e.test(c));return s||b||x||k||E||_}function isSDKSource(e){if(!e||"string"!=typeof e)return![];const i=[/\/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 i.some(i=>i.test(e))}const e={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},i={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",INTERNAL_CART_TO_CHECKOUT:"internal_cart_to_checkout",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},r={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},s={DRAWER:"drawer",INPUT:"input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",MODAL:"modal",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",PRODUCT_LIST_RETAILERS:"product-list-retailers",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},c={ON_DEMAND:"onDemand",SHIPPING:"shipping"},d={NONE:"none",CONSOLE:"console",PANEL:"panel"},h={PROMO_CODE:"promo-code"},u={GENERIC:"generic",PROMO_CODE:"promo-code",GIFT_CARD:"gift-card"},g={SUCCESS:"success",WARNING:"warning",ERROR:"error"},v={[e.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[e.STAGING]:"https://staging-elements.liquidcommerce.us",[e.PRODUCTION]:"https://elements.liquidcommerce.us"},b={ENGRAVING:"engraving",PRESALE:"presale",FULFILLMENT:"fulfillment",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},x={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040,MODAL:2147483640};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,i){const r=SingletonManager.getInstances();r.has(e)||r.set(e,i());const s=r.get(e);if(!s)throw new SDKError("ElementsSdk: Instance for class "+e+" could not be created.");return s}static async getClient(e){const i=[e.apiKey,e.env,e.isBuilder,e.debugMode].join("_"),r="LiquidCommerceElementsClient_"+i,s=SingletonManager.getInstances();if(s.has(r))return s.get(r);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const c=new SingletonManager.clientConstructor(e);return await c.prepare(),s.set(r,c),c}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const k="lce",E={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},_={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:c.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},F={id:"",subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},D={token:"",cartId:"",loading:![],updating:![],error:null,presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddress:{formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},promoCode:null,giftCards:[],orderNumber:null,itemsQuantity:0,items:{},fulfillments:{},retailers:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,engraving:0,giftCards:0,tip:0,service:0,platform:0,tax:0},rerender:![],tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},T={drawer:{isOpen:![],contentConfig:null},modal:{isOpen:![],contentConfig:null}},A={products:[],retailers:{},filters:[],pagination:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]},appliedFilters:{},searchTerm:"",gridConfig:void 0,userProducts:{},loading:![]},O={products:{},cart:F,address:E,checkout:D,ui:T,productsList:A};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(e,i={}){this.validateInputs(e,i),this.config=Object.freeze(this.buildConfiguration(e,i))}getConfigs(){return{...this.config}}get(e){return this.config[e]}set(e,i){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[e]:i})}isDevelopment(){return this.get("env")===e.DEVELOPMENT}isStaging(){return this.get("env")===e.STAGING}isProduction(){return this.get("env")===e.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const e=this.get("debugMode");return e===d.CONSOLE||e===d.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===d.PANEL}debuggingDisabled(){const e=this.get("debugMode");return e===d.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}getProxyConfig(){return this.get("proxy")}validateInputs(i,r){if(!(null==i?void 0:i.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(r.env&&!Object.values(e).includes(r.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+r.env+'". Using default environment.'),r.env=void 0),void 0!==r.isBuilder&&"boolean"!=typeof r.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),r.isBuilder=void 0),void 0===r.debugMode||Object.values(d).includes(r.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+r.debugMode+'". Must be one of: '+Object.values(d).join(", ")+". Using default value."),r.debugMode=void 0),r.promoTicker&&"object"!=typeof r.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),r.promoTicker=void 0),void 0!==r.checkoutUrl&&("string"!=typeof r.checkoutUrl?(console.warn("[LiquidCommerce Elements] checkoutUrl must be a string. Ignoring checkoutUrl configuration."),r.checkoutUrl=void 0):r.checkoutUrl&&!r.checkoutUrl.includes("{id}")&&console.warn('[LiquidCommerce Elements] checkoutUrl does not include "{id}" placeholder and will not include cart IDs.')),r.promoTicker)if(Array.isArray(r.promoTicker)){const e=r.promoTicker.filter((e,i)=>{if("string"!=typeof e.promoCode||!e.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(e.text)||0===e.text.length||!e.text.every(e=>"string"==typeof e&&e.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof e.separator||!e.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!e.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom is required. Skipping this promo."),![];const r="string"==typeof e.activeFrom?new Date(e.activeFrom):e.activeFrom;if(!(r instanceof Date)||Number.isNaN(r.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!e.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeUntil is required. Skipping this promo."),![];const s="string"==typeof e.activeUntil?new Date(e.activeUntil):e.activeUntil;return s instanceof Date&&!Number.isNaN(s.getTime())?r>=s?(console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+i+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});r.promoTicker=e.length>0?e:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),r.promoTicker=void 0;r.proxy&&("object"!=typeof r.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),r.proxy=void 0):r.proxy.baseUrl&&"string"==typeof r.proxy.baseUrl?r.proxy.headers&&"object"!=typeof r.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),r.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),r.proxy=void 0))}buildConfiguration(i,r){var s,c,h,u,g;const b=r.env||e.PRODUCTION;let x=v[b];const E=b===e.PRODUCTION,_=r.isBuilder||![],F=k+(E?"":"_"+b)+(_?"builder":"");return(null===(s=r.development)||void 0===s?void 0:s.customApiUrl)&&(x=r.development.customApiUrl),{apiKey:i.trim(),env:b,isBuilder:_,debugMode:r.debugMode||d.NONE,baseUrl:x,partnerCode:void 0,partnerName:void 0,customTheme:r.customTheme||null,proxy:r.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:F,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:r.promoTicker||null,paymentMethodId:(null===(c=r.development)||void 0===c?void 0:c.paymentMethodId)||void 0,openShadowDom:E?![]:(null===(h=r.development)||void 0===h?void 0:h.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(u=r.development)||void 0===u?void 0:u.customApiUrl),checkoutUrl:(null===(g=r.checkoutUrl)||void 0===g?void 0:g.trim())?r.checkoutUrl.trim():null}}detectDeviceType(){var e,i;if("undefined"==typeof navigator)return"desktop";const r=navigator.userAgent.toLowerCase(),s="ontouchstart"in window||navigator.maxTouchPoints>0,c=(null===(e=window.screen)||void 0===e?void 0:e.width)||0,d=(null===(i=window.screen)||void 0===i?void 0:i.height)||0,h=Math.max(c,d),u=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],g=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return u.some(e=>e.test(r))?"tablet":g.some(e=>e.test(r))||s&&h<768?"mobile":s&&h>=768&&h<=1200||s&&/macintosh/i.test(r)&&navigator.maxTouchPoints>1||/android/i.test(r)&&s&&h>=768||/windows nt/i.test(r)&&s&&h>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(r),"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 i=(new Date).toISOString().slice(11,23);return["%c["+i+"%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,i){if(this.sendToTelemetry("debug",e,void 0,i),!this.enableLogging)return;const[r,...s]=this.getPrefix("debug");void 0!==i?console.debug(r,...s,e,i):console.debug(r,...s,e)}info(e,i){if(!this.enableLogging)return;const[r,...s]=this.getPrefix("info");void 0!==i?console.info(r,...s,e,i):console.info(r,...s,e)}warn(e,i){if(this.sendToTelemetry("warn",e,void 0,i),!this.enableLogging)return;const[r,...s]=this.getPrefix("warn");void 0!==i?console.warn(r,...s,e,i):console.warn(r,...s,e)}error(e,i){const r=i instanceof Error;let s=r?i:void 0,c=!r&&i?i:void 0;if(c&&c.error instanceof Error){s=c.error;const{error:e,...i}=c;c=Object.keys(i).length>0?i:void 0}if(this.sendToTelemetry("error",e,s,c),!this.enableLogging)return;const[d,...h]=this.getPrefix("error");if(console.group(d+" "+e,...h),s){console.log("Type:",s.name||"Error"),console.log("Message:",s.message),s.stack&&console.log("Stack:",s.stack),s.cause&&console.log("Caused by:",s.cause);const e=Object.keys(s).filter(e=>!["name","message","stack","cause"].includes(e));if(e.length>0){const i={};for(const r of e)i[r]=s[r];console.log("Additional:",i)}}c&&Object.keys(c).length>0&&console.log("Context:",c),console.groupEnd()}sendToTelemetry(e,i,r,s){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(e,i,{context:this.context,error:r,data:s})}catch(c){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(e){const i=this.getInstances();if(!i.has(e)){const r=LoggerService.getInstance(e);r.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&r.setTelemetryService(this.telemetryService),i.set(e,r)}return i.get(e)}static setEnableLogging(e){this.enableLoggingGlobally=e;const i=this.getInstances();for(const[,r]of i)r.setEnableLogging(e)}static setTelemetryService(e){this.telemetryService=e;const i=this.getInstances();for(const[,r]of i)r.setTelemetryService(e)}}function componentError({componentType:e,message:i}){const r=document.createElement("div");r.className=e;const s=r.attachShadow({mode:"closed"}),c=document.createElement("style");c.textContent='\n div {\n padding: 10px;\n background-color: #f0f4f8;\n border-radius: 6px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: #d63031;\n line-height: 1.4;\n margin-bottom: 5px;\n }\n\n p {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n color: #18181B;\n line-height: 1.5;\n max-width: 350px;\n }\n ';const d=document.createElement("div"),h=document.createElement("h3");h.textContent="Component </"+e+">";const u=document.createElement("p");return u.textContent=i,d.appendChild(c),d.appendChild(h),d.appendChild(u),s.appendChild(d),r}function productionComponentError({title:e,message:i,componentType:r}){const s=document.createElement("div");s.setAttribute("data-component-type",r);const c=s.attachShadow({mode:"closed"}),d=document.createElement("style");d.textContent="\n div {\n padding: 20px;\n background-color: #f0f4f8;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: Poppins, sans-serif;\n max-width: 512px;\n display: block;\n }\n\n h2 {\n color: #18181B;\n margin: 0 0 8px 0;\n font-size: 18px;\n font-style: normal;\n font-weight: 600;\n line-height: 18px;\n text-transform: lowercase;\n }\n\n h2::first-letter {\n text-transform: uppercase;\n }\n\n p {\n color: #18181B;\n font-size: 14px;\n font-style: italic;\n font-weight: 400;\n line-height: 20px;\n margin: 0;\n }\n ";const h=document.createElement("div"),u=document.createElement("h2");u.textContent=e;const g=document.createElement("p");return g.textContent=i,h.appendChild(d),h.appendChild(u),h.appendChild(g),c.appendChild(h),s}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,i){ComponentFactoryService.getComponentRegistry().set(e,i)}static createElement(e){try{const i=ComponentFactoryService.getComponentRegistry().get(e.type);if(!i)throw new SDKError("Component type ["+e.type+"] is not registered");const r=ComponentFactoryService.getComponentTagName(e.type);window.customElements.get(r)||window.customElements.define(r,i);const c=document.createElement(r);if(c.initialize){const{type:i,useShadowDom:s,wrapInLceElement:d,...h}=e,u={type:i,tagName:r,useShadowDom:s&&d!==!![]};c.initialize({data:h,config:u})}if(e.wrapInLceElement){const i=ComponentFactoryService.getComponentRegistry().get(s.LCE_ELEMENT),r=ComponentFactoryService.getComponentTagName(s.LCE_ELEMENT);window.customElements.get(r)||window.customElements.define(r,i);const d=document.createElement(r);return d.initialize(e.type,c),d}return c}catch(i){return ComponentFactoryService.logger.error("Failed to create component </"+e.type+">",i),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==i?void 0:i.message)||i})}}static componentError({componentType:e,message:i}){return ComponentFactoryService.logger.error("Component type "+e+" failed to load: "+i),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:i})}static getComponentTagName(e){const i={[s.DRAWER]:"drawer-lc",[s.INPUT]:"input-lc",[s.ENGRAVING_FORM]:"engraving-form-lc",[s.ENGRAVING_VIEW]:"engraving-view-lc",[s.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[s.POWERED_BY]:"powered-by-lc",[s.LCE_ELEMENT]:"lce-element",[s.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[s.ALERT]:"alert-lc",[s.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[s.MODAL]:"modal-lc",[s.ADDRESS]:"address-lc",[s.ADDRESS_INPUT]:"address-input-lc",[s.ADDRESS_DISPLAY]:"address-display-lc",[s.PRODUCT]:"product-lc",[s.PRODUCT_OPTIONS]:"product-options-lc",[s.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[s.PRODUCT_INTERACTIONS]:"product-interactions-lc",[s.PRODUCT_DESCRIPTION]:"product-description-lc",[s.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[s.PRODUCT_RETAILERS]:"product-retailers-lc",[s.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[s.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[s.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[s.PRODUCT_PRICE]:"product-price-lc",[s.PRODUCT_DRAWER]:"product-drawer-lc",[s.PRODUCT_LOADING]:"product-loading-lc",[s.PRODUCT_LIST]:"product-list-lc",[s.PRODUCT_LIST_CARD]:"product-list-card-lc",[s.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[s.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[s.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[s.PRODUCT_LIST_RETAILERS]:"product-list-retailers-lc",[s.CART]:"cart-lc",[s.CART_RETAILER]:"cart-retailer-lc",[s.CART_ITEM]:"cart-item-lc",[s.CART_FOOTER]:"cart-footer-lc",[s.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[s.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[s.CART_PROMO_CODE]:"cart-promo-code-lc",[s.CART_HEADER]:"cart-header-lc",[s.CART_BODY]:"cart-body-lc",[s.CART_FULFILLMENT]:"cart-fulfillment-lc",[s.CHECKOUT]:"checkout-lc",[s.CHECKOUT_INFORMATION]:"checkout-information-lc",[s.CHECKOUT_PAYMENT]:"checkout-payment-lc",[s.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[s.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[s.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[s.CHECKOUT_BILLING]:"checkout-billing-lc",[s.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[s.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[s.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[s.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[s.CHECKOUT_ITEMS]:"checkout-items-lc",[s.CHECKOUT_COMPLETED]:"checkout-completed-lc",[s.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[s.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[s.CHECKOUT_BUYER]:"checkout-buyer-lc",[s.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[s.CHECKOUT_TIPS]:"checkout-tips-lc",[s.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[s.CHECKOUT_ITEM]:"checkout-item-lc",[s.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[s.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[s.CHECKOUT_HEADER]:"checkout-header-lc",[s.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[s.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[s.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return i[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,i){this.publishSpecific("actions."+e,i)}publishForm(e,i){this.publishSpecific("forms."+e,i)}publishSpecific(e,i){const[r,s]=e.includes(".")?e.split(".",2):["actions",e];let c=s.split("_")[0];["product","cart","address","checkout"].includes(c)||(c="other");const d=Date.now(),h={eventId:"evt_"+d+"_"+Math.random().toString(36).slice(2,9),namespace:r,event:s,originalEvent:e,actionNamespace:"actions"===r?c:void 0,timestamp:d},u={data:i,metadata:h};this.dispatchNativeEvents(e,u)}dispatchNativeEvents(e,i){const[r]=e.split(".",2);try{"actions.client_ready"===e&&(this.clientReadyEvent=i);const s=new CustomEvent(this.eventPrefix+":"+e,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(s);const c=new CustomEvent(this.eventPrefix+":"+r,{detail:i,bubbles:!![],cancelable:!![]});window.dispatchEvent(c)}catch(s){this.logger.error("Error dispatching native events for "+e,s)}}setupClientReadyBuffering(){try{const e=window.addEventListener,i=this.eventPrefix+":actions.client_ready";window.addEventListener=(r,s,c)=>{if(r!==i)return e.call(window,r,s,c);if(!this.clientReadyEvent)return e.call(window,r,s,c);try{const e=new CustomEvent(i,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof s?s(e):s&&"function"==typeof s.handleEvent&&s.handleEvent(e)}catch(d){this.logger.error("Error replaying CLIENT_READY event",d)}return e.call(window,r,s,c)}}catch(yt){this.logger.error("Error setting up CLIENT_READY buffering",yt)}}}function centToDollar(e){return e/100}function formatCentToDollarText(e,i=!![]){const r=Math.floor(e/100),s=e%100;let c="$"+r.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(i||s>0)&&(c+=".",c+=s<10?"0"+s:s.toString()),c}function htmlStringToElement(e){const i=document.createElement("template");return i.innerHTML=e.trim(),i.content.firstElementChild}function formatISODateToMMDDYYYY(e){if(!e)return"";try{const i=new Date(e);if(Number.isNaN(i.getTime()))return"";const r=(i.getMonth()+1).toString().padStart(2,"0"),s=i.getDate().toString().padStart(2,"0"),c=i.getFullYear().toString();return r+"/"+s+"/"+c}catch(i){return""}}function capitalizeFirstLetter(e){return e?e.toLowerCase().split(" ").map(e=>e.charAt(0).toUpperCase()+e.substring(1)).join(" "):e}function splitCategoryPath(e){const i=(null==e?void 0:e.split(" > ").map(e=>capitalizeFirstLetter(e.trim())))||[];return{category:i[0]||"",category2:i[1]||"",category3:i[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 setPersistedStore(e,i){try{if(!e)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!i||0===Object.keys(i).length)return this.logger.error("No data provided to set persisted store"),void 0;await this.client.post("/configs/store/"+e,{body:i})}catch(r){this.logger.error("Error setting persisted store",r)}}async getPersistedStore(e){try{if(!e)return this.logger.error("User device ID is required to get persisted store"),null;const i=await this.client.get("/configs/store/"+e);return i.data}catch(i){return this.logger.error("Error fetching persisted store",i),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(i){this.logger.error("Error deleting persisted store",i)}}async getAddressSuggestions(e){try{if(!e||0===e.trim().length)return this.logger.error("Input is required to fetch address suggestions"),[];const i=await this.client.post("/address/autocomplete",{body:{input:e}});return i.data}catch(i){return this.logger.error("Error fetching address suggestions",i),[]}}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 i=await this.client.post("/address/details",{body:{id:e}});return i.data}catch(i){throw this.logger.error("Error fetching address details",i),new SDKError("Failed to fetch address details: "+(null==i?void 0:i.message))}}async getProductsData(e,i){try{if(0===e.length)return this.logger.error("No product identifiers provided"),null;const r={identifiers:e,location:i},s=await this.client.post("/product/availability",{body:r});return s.data}catch(r){return this.logger.error("Error fetching product data",r),null}}async catalogSearch(e){try{const i=await this.client.post("/product/search",{body:e});return i.data}catch(i){return this.logger.error("Error fetching catalog search data",i),{products:[],retailers:{},navigation:{currentPage:1,totalPages:0,totalCount:0,filters:[]}}}}async getCartData(e){try{const i=await this.client.post("/cart/get",{body:{id:e||void 0}});return i.data}catch(i){throw this.logger.error("Error fetching cart data",i),new SDKError("Failed to fetch cart data: "+i.message)}}async updateCart(e){try{const i=await this.client.post("/cart/update",{body:e});return i.data}catch(i){throw this.logger.error("Error updating cart",i),new SDKError("Failed to update cart: "+(null==i?void 0:i.message))}}async prepareCheckout(e){try{const i=await this.client.post("/checkout/prepare",{body:e});return i.data}catch(i){throw this.logger.error("Error fetching prepare checkout data",i),new SDKError("Failed to fetch prepare checkout data: "+(null==i?void 0:i.message))}}async updateCheckoutItems(e){try{const i=await this.client.post("/checkout/items",{body:e});return i.data}catch(i){throw this.logger.error("Error updating checkout items",i),new SDKError("Failed to update checkout items: "+(null==i?void 0:i.message))}}async getPaymentSession(e){try{const i=await this.client.post("/checkout/payment/session",{body:{cartId:e}});return i.data}catch(i){throw this.logger.error("Error fetching payment session",i),new SDKError("Failed to get payment session: "+(null==i?void 0:i.message))}}async confirmPaymentSession(e){try{const i=await this.client.post("/checkout/payment/confirm",{body:e});return i.data}catch(i){throw this.logger.error("Error confirming payment session",i),new SDKError("Failed to confirm payment session: "+(null==i?void 0:i.message))}}async checkoutComplete(e){try{const i=await this.client.post("/checkout/complete",{body:{token:e}});return i.data}catch(i){if(this.logger.error("Error completing checkout",i),null==i?void 0:i.error)throw new SDKError("Failed to complete checkout: "+(null==i?void 0:i.message));throw i}}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:e,payload:i,next:r})=>{const s=performance.now();try{const c=r(),d=performance.now()-s;return this.logger.info("🏪 Store "+e+" ✓ "+d.toFixed(3)+"ms",i),c}catch(c){const r=performance.now()-s;throw this.logger.error("🏪 Store "+e+" ✗ "+r.toFixed(3)+"ms",{payload:i,error:c}),c}},this.performanceMiddleware=({action:e,next:i})=>{const r=performance.now(),s=i(),c=performance.now()-r;return c>16&&this.logger.warn('⚠️ Slow store operation "'+e+'": '+c.toFixed(2)+"ms"),s},this.state=O,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:i,persistedStore:r}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+e,this.isLocalStorageAvailable=i,i?await this.loadPersistedState():r&&await this.loadFromDBPersistence(r),this.logger.info("Store service initialized successfully",{userDeviceId:e,isLocalStorageAvailable:i,hasPersistedState:null!==r,localStorageKey:this.localStorageKey})}get(e){if(!e)return{...this.state};const i=e.split(".");let r=this.state;for(const s of i){if(null==r)return;r=r[s]}return void 0!==r?Array.isArray(r)?[...r]:"object"==typeof r&&null!==r?{...r}:r:void 0}set(e,i){return this.runWithMiddleware("set",{path:e,value:i},()=>{const r=this.get(e);return this.state=this.immutableSet(this.state,e,i),this.notifyListeners(e,i,r),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(e,i){const r=this.get(e),s=i(r);return this.set(e,s)}remove(e){return this.runWithMiddleware("remove",{path:e},()=>{const i=this.get(e);if(void 0===i)return this.logger.warn('No value found at path "'+e+'" to remove.'),![];const r=e.split(".");let s=this.state;const c=r.pop();for(const d of r){if(void 0===s[d])return this.logger.warn('Path "'+e+'" does not exist in the state.'),![];s=s[d]}if(Array.isArray(s))s=s.filter((e,i)=>i!==Number.parseInt(c,10));else{if("object"!=typeof s||null===s)return this.logger.warn('Cannot remove property "'+c+'" from non-object type at path "'+e+'".'),![];{const{[c]:e,...i}=s;s=i}}return this.state=this.immutableSet(this.state,r.join("."),s),this.notifyListeners(e,void 0,i),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(e){return this.runWithMiddleware("batch",{updates:e},()=>{const i=[];if("function"==typeof e){const r=e(this.state);for(const[e,s]of Object.entries(r)){const r=this.get(e);i.push({path:e,oldValue:r,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,e,s)}}else for(const[r,s]of Object.entries(e)){const e=this.get(r);i.push({path:r,oldValue:e,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,r,s)}for(const{path:e,oldValue:r,newValue:s}of i)this.notifyListeners(e,s,r);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(e,i){const r=e;return this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(i),()=>{var e;null===(e=this.listeners.get(r))||void 0===e?void 0:e.delete(i)}}watchMany(e,i){const r=[];let s;const c=e.map(e=>this.watch(e,(c,d)=>{r.push({path:e,value:c,oldValue:d}),clearTimeout(s),s=setTimeout(()=>{r.length>0&&(i([...r]),r.length=0)},0)}));return()=>{for(const e of c)e()}}createProductInstance(e){const i="products."+e,r=this.get(i);return r?!![]:this.set(i,_)}removeProductInstance(e){const i=this.get("products"),{[e]:r,...s}=i;return this.set("products",s)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(e,i,r){let s=0;const p=()=>{if(s>=this.middleware.length)return r();const c=this.middleware[s++];return c({action:e,payload:i,state:this.getState(),next:p})};return p()}immutableSet(e,i,r){const s=i.split(".");if(1===s.length){if(Array.isArray(e)){const i=[...e];return i[s[0]]=r,i}return{...e,[s[0]]:r}}const[c,...d]=s,h=e[c],u=Array.isArray(h)?[]:{};if(Array.isArray(e)){const i=[...e];return i[c]=this.immutableSet(h||u,d.join("."),r),i}return{...e,[c]:this.immutableSet(h||u,d.join("."),r)}}notifyListeners(e,i,r){const s=this.listeners.get(e);if(s)for(const u of s)try{u(i,r)}catch(d){this.logger.error('Error in store listener for path "'+e+'"',d)}const c=e.split(".");for(let u=c.length-1;u>0;u--){const e=c.slice(0,u).join("."),i=this.listeners.get(e);if(i){const s=this.get(e),d=c.slice(u).join("."),g=this.immutableSet(s,d,r);for(const r of i)try{r(s,g)}catch(h){this.logger.error('Error in store listener for parent path "'+e+'"',h)}}}}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 i=this.get("address.id")||"",r=this.get("cart.id");if(!i&&!r)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:i,cartId:r}),void 0;try{const s=null!==(e=this.clientConfig.get("userDeviceId"))&&void 0!==e?e:"not_defined";await this.api.setPersistedStore(s,{p:i,c:r}),this.logger.info("Session data persisted to DB",{userDeviceId:s,addressId:i,cartId:r})}catch(s){this.logger.error("Failed to persist session data to DB",s)}}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(yt){this.logger.error("Failed to clear localStorage entry",yt)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let e="";if(this.clientConfig.debuggingDisabled()){const i=this.get("address.id")||"",r=this.get("cart.id");(i||r)&&(e=i+":"+r)}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 i=localStorage.getItem(this.localStorageKey);if(!i)return;try{const e=JSON.parse(i);for(const[i,r]of Object.entries(e))this.set(i,r);return}catch(e){if(i.includes(":")){const[e,r]=i.split(":");if(void 0!==e){const i=await this.getAddressDataFromId(e);this.set("address",i)}return void 0!==r&&this.set("cart.id",r||""),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:i})}}catch(i){this.logger.error("Failed to load persisted state",i),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(e){try{if(void 0!==e.p){const i=await this.getAddressDataFromId(e.p);this.set("address",i)}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(i){this.logger.error("Failed to load session data from DB persistence",i)}}async getAddressDataFromId(e){if(!e||""===e.trim())return E;try{const i=await this.api.getAddressDetails(e);return i&&0!==Object.keys(i).length?{id:e,formattedAddress:i.formattedAddress,address:{one:i.address.one,two:i.address.two,city:i.address.city,state:i.address.state,zip:i.address.zip,country:i.address.country||""},coordinates:{latitude:i.coordinates.latitude,longitude:i.coordinates.longitude}}:{...E,id:e}}catch(i){return{...E,id:e}}}}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 i=this.clientConfig.get("env"),r=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:r,batchSize:i===e.PRODUCTION?5:10,batchInterval:i===e.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(e,i,r={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(e))return;const s=Date.now();try{const c={eventId:"event_"+s,timestamp:s,level:e,message:i,context:r.context,error:r.error?this.buildErrorContext(r.error):void 0,component:r.component,data:r.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(c)}catch(c){this.handleInternalError(c)}}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 i=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const r=this.createBatch(i);try{this.sendBatch(r),this.stats.batchesSent++}catch(s){this.stats.failedBatches++,this.handleInternalError(s),this.eventQueue.unshift(...i),this.stats.queuedEvents=this.eventQueue.length}}createBatch(e){const i=Date.now();return{batchId:"batch_"+i,timestamp:i,events:e}}sendBatch(e){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const i=new Blob([JSON.stringify(e)],{type:"text/plain"}),r=navigator.sendBeacon(this.config.endpoint,i);if(r)return}catch(i){return this.sendBatchViaXHR(e),void 0}this.sendBatchViaXHR(e)}sendBatchViaXHR(e){try{const i=new XMLHttpRequest;if(i.open("POST",this.config.endpoint,![]),i.setRequestHeader("Content-Type","text/plain"),i.send(JSON.stringify(e)),i.status<200||i.status>=300)throw new SDKError("XHR request failed with status: "+i.status)}catch(i){throw new SDKError("Both sendBeacon and XHR failed: "+i.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(i){this.stats.failedBatches++}}}}const z=[s.PRODUCT,s.PRODUCT_IMAGE_CAROUSEL,s.PRODUCT_OPTIONS,s.PRODUCT_INTERACTIONS,s.PRODUCT_DESCRIPTION,s.PRODUCT_RETAILERS,s.PRODUCT_RETAILERS_CAROUSEL,s.PRODUCT_RETAILERS_POPUP,s.PRODUCT_RETAILERS_POPUP_LIST,s.PRODUCT_PRICE,s.PRODUCT_ADD_TO_CART_SECTION,s.PRODUCT_DRAWER,s.PRODUCT_LOADING,s.ENGRAVING_FORM,s.ENGRAVING_VIEW],L=[s.ADDRESS_INPUT,s.ADDRESS_DISPLAY],R=[s.CART,s.CART_RETAILER,s.CART_ITEM,s.CART_FOOTER,s.CART_ITEM_QUANTITY_PRICE,s.CART_RETAILER_SUBTOTAL,s.CART_PROMO_CODE,s.CART_HEADER,s.CART_BODY,s.CART_FULFILLMENT,s.BUTTONS_CART_OPEN],M=[s.CHECKOUT,s.CHECKOUT_INFORMATION,s.CHECKOUT_STRIPE_HANDLER,s.CHECKOUT_STRIPE_FORM,s.CHECKOUT_PAYMENT,s.CHECKOUT_BILLING,s.CHECKOUT_ORDER_SUMMARY,s.CHECKOUT_PROMO_CODE,s.CHECKOUT_GIFT_CARDS,s.CHECKOUT_AMOUNTS,s.CHECKOUT_ITEMS,s.CHECKOUT_COMPLETED,s.CHECKOUT_DELIVER_TO,s.CHECKOUT_DELIVER_TO_SUMMARY,s.CHECKOUT_BUYER,s.CHECKOUT_TIPS,s.CHECKOUT_PC_GC,s.CHECKOUT_ITEM,s.CHECKOUT_ITEM_QUANTITY,s.CHECKOUT_PLACE_ORDER_BUTTON,s.CHECKOUT_HEADER,s.CHECKOUT_PRESALE_COUNTDOWN,s.CHECKOUT_PRESALE_EXPIRED,s.CHECKOUT_SEND_AS_GIFT],j=[s.PRODUCT_LIST,s.PRODUCT_LIST_CARD,s.PRODUCT_LIST_CARD_LOADING,s.PRODUCT_LIST_FILTERS,s.PRODUCT_LIST_SEARCH];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(e,i="swap"){if(!e||0===e.length)return;const r=[...this.defaultFontFamilies,...e],s=r.map(e=>{const i=encodeURIComponent(e.name);return"family="+i+":wght@"+e.weights.join(";")}).join("&"),c="display="+i;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+s+"&"+c,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(e,i="swap"){const r=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(e,i),r&&r.remove()}injectGoogleFontsResourceHints(){const e=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),i=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(!i){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 /* Filter button host - shown only on mobile when NOT in drawer */\n .product-list-filter-button-host {\n display: none;\n }\n\n /* Mobile: show button on page, but hide it in drawer */\n @media (max-width: 1023px) {\n /* Show button on the page */\n .product-list-filter-button-host {\n display: flex;\n }\n \n /* Hide filter content on the page (sidebar) */\n .product-list-filters-content-wrapper {\n display: none !important;\n }\n \n /* But in drawer mode, hide button and show content */\n .drawer-mode .product-list-filter-button-host,\n .product-list-filters-container.drawer-mode .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper.drawer-mode,\n .product-list-filters-container.drawer-mode .product-list-filters-content-wrapper {\n display: block !important;\n padding: 0px 16px;\n }\n }\n\n /* Desktop: always hide button, show filter content */\n @media (min-width: 1024px) {\n .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper {\n display: block !important;\n }\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n cursor: default;\n }\n\n .product-list-filter-icon {\n display: flex;\n align-items: center;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 0px;\n }\n\n .product-list-filters-container {\n width: 16.6%;\n min-width: 200px;\n max-height: calc(100vh - 48px);\n height: fit-content;\n position: sticky;\n overflow-y: auto;\n overflow-x: hidden;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 80px 24px;\n position: static;\n max-height: none;\n height: 100%;\n overflow-y: visible;\n }\n\n\n\n .product-list-filters-engraving,\n .product-list-filters-presale,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-engraving,\n .product-list-filters-presale {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n }\n\n .product-list-filters-engraving-label,\n .product-list-filters-presale-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-fulfillment-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-fulfillment-options-header:hover .product-list-filters-fulfillment-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-engraving:hover .product-list-filters-engraving-label, \n .product-list-filters-presale:hover .product-list-filters-presale-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filters-fulfillment-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-fulfillment-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-fulfillment-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-fulfillment-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-fulfillment-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-fulfillment-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-fulfillment-option {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n\n .product-list-filters-fulfillment-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-fulfillment-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-fulfillment-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-fulfillment-radio:focus,\n .product-list-filters-fulfillment-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-fulfillment-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-fulfillment-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+x.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Filters */\n .product-list-filters-fulfillment-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price:last-child {\n border-bottom: none;\n padding-bottom: 0px 16px;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 16px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n z-index: 999;\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Product List Card Styles */\n .product-list-card {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-height: 400px;\n height: 100%;\n padding: 8px;\n border: 1px solid var(--base-accent, #E4E4E7);\n background: var(--base-background, #FAFAFA);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .product-list-card.sharp {\n border-radius: 0px;\n }\n\n .product-list-card.card {\n background: var(--base-background, #FAFAFA);\n border: 1px solid var(--base-accent, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .product-list-card.ghost {\n background: transparent;\n border: none;\n box-shadow: none;\n }\n\n .product-list-card.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n position: relative;\n }\n\n .product-list-card .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-card .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n /* Pre-Order Badge Styles */\n .plc__presale-badge {\n position: absolute;\n top: 16px;\n left: 16px;\n padding: 4px 12px;\n background-color: #18181B;\n color: #FFFFFF;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n z-index: 10;\n text-transform: capitalize;\n letter-spacing: 0.5px;\n }\n\n .plc__presale-badge.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__presale-badge.sharp {\n border-radius: 0px;\n }\n\n .plc__content {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 16px;\n align-self: stretch;\n padding-top: 16px;\n }\n\n .plc__badges-wrapper {\n display: flex;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n gap: 8px;\n line-height: 14px;\n }\n\n .plc__badge-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 400;\n }\n\n .plc__content .plc__title {\n width: 100%;\n font-size: 24px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n line-height: 24px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n word-wrap: break-word;\n word-break: break-word;\n height: 70px;\n }\n\n .plc__price-personalization-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .plc__price {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 24px;\n }\n\n .plc__personalize {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .plc__dropdown-size-wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0;\n align-items: flex-start;\n border: 1px solid var(--base-accent, #E4E4E7);\n background: var(--base-background, #FAFAFA);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n transition: all 0.3s ease;\n overflow: visible;\n position: relative;\n }\n\n .plc__dropdown-size-wrapper.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__dropdown-size-wrapper.sharp {\n border-radius: 0px;\n }\n\n .plc__dropdown-default-size-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n background: none;\n border: none;\n padding: 4px 8px;\n cursor: pointer;\n transition: opacity 0.2s ease;\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__dropdown-size-wrapper.expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .plc__dropdown-size-text {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-weight: 400;\n }\n\n .plc__dropdown-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .plc__dropdown-chevron svg {\n display: block;\n }\n\n .plc__dropdown-check {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .plc__dropdown-check svg {\n display: block;\n }\n\n .plc__sizes-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 0;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease;\n background: var(--base-background, #FFFFFF);\n border: 1px solid var(--base-accent, #E4E4E7);\n border-top: none;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n z-index: 1000;\n }\n\n .plc__sizes-list.rounded {\n border-bottom-left-radius: var(--border-radius-rounded, 6px);\n border-bottom-right-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__sizes-list.sharp {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .plc__dropdown-size-wrapper.expanded .plc__sizes-list {\n max-height: 200px;\n opacity: 1;\n overflow-y: auto;\n }\n\n .plc__size-option {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 4px 8px;\n background: var(--base-background, #FFFFFF);\n border: none;\n cursor: pointer;\n transition: all 0.2s ease;\n }\n\n .plc__size-option:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .plc__size-option:hover .plc__size-option-text {\n color: var(--selected-text-color, #ffffff);\n }\n\n .plc__size-option:hover .plc__size-option-check svg {\n color: var(--selected-text-color, #ffffff);\n }\n\n .plc__size-option-text {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-weight: 400;\n transition: color 0.2s ease;\n }\n\n .plc__size-option-check {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: color 0.2s ease;\n width: 12px;\n }\n\n .plc__size-option-check svg {\n display: block;\n }\n\n .plc__fulfillment-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n align-self: stretch;\n }\n\n .plc__fulfillment-text {\n color: var(--base-foreground, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n word-wrap: break-word;\n word-break: break-word;\n height: 48px;\n }\n\n .plc__fulfillment-delivery {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .plc__add-to-cart-wrapper {\n display: flex;\n align-items: center;\n align-content: flex-start;\n gap: 8px;\n align-self: stretch;\n flex-wrap: nowrap;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text {\n display: flex;\n min-width: 32px;\n height: 36px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n user-select: none;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text.ghost {\n border: none;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase {\n display: flex;\n width: 32px;\n height: 36px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n background: transparent;\n border: 1px solid var(--accent-color, #E4E4E7);\n transition: background-color 0.15s ease, opacity 0.15s ease;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease {\n border-right: 1px solid var(--accent-color, #E4E4E7); \n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase {\n border-left: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.disabled,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.rounded {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.rounded {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n \n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.sharp {\n border-radius: 0px;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.sharp {\n border-radius: 0px;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.ghost,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.ghost {\n border: none;\n }\n\n .product-list-card .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n height: 36px;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n font-family: var(--paragraph-font-family, Poppins);\n padding: 0 0.75rem;\n border: none;\n cursor: pointer;\n transition-property: background-color, transform;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button.rounded {\n border-radius: var(--button-border-radius, 6px);\n }\n\n .plc__button.sharp {\n border-radius: 0px;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .plc__button:active {\n transform: translateY(1px);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Product List Card Drawer */\n .product-list-card {\n position: relative;\n overflow: visible;\n }\n\n .product-list-card-drawer-container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--drawer-background-color, #ffffff);\n z-index: 100;\n transform: translateX(100%);\n transition: transform 0.3s ease;\n overflow: hidden;\n border-radius: var(--border-radius-rounded, 6px);\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n }\n\n .product-list-card-drawer-container.open {\n transform: translateX(0);\n }\n\n .product-list-card-drawer-content {\n width: 100%;\n height: 100%;\n overflow-y: auto;\n padding: 16px;\n position: relative;\n }\n\n\n /* Retailers Popup Styles */\n .retailers-popup-wrapper {\n padding: 16px;\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .retailers-popup-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 16px;\n }\n\n .retailers-popup-title {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n line-height: 24px;\n margin: 0;\n }\n\n .retailers-popup-close {\n background: none;\n border: none;\n cursor: pointer;\n color: #6B7280;\n padding: 4px;\n }\n\n .retailers-popup-no-data {\n padding: 24px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .popup-fulfillment-list-container {\n margin-top: 16px;\n max-height: 445px;\n overflow-y: auto;\n }\n\n /* Prevent background scroll when dialog is active */\n body:has(dialog[open]) {\n overflow: hidden;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Filters Chips */\n .product-list-filters-chips-container {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-chips-container:empty {\n display: none;\n padding: 0;\n border-bottom: none;\n }\n\n .product-list-filters-clear-all {\n display: inline-flex;\n align-items: center;\n padding: 8px 0px 0px;\n background: none;\n border: none;\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 700;\n color: var(--primary-color, #3b82f6);\n text-decoration: underline;\n cursor: pointer;\n text-transform: uppercase;\n }\n\n .product-list-filters-clear-all:hover {\n color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-clear-all:focus {\n outline: none;\n }\n\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 4px 12px;\n background-color: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 400;\n color: var(--default-text-color, #374151);\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n\n .chip-text {\n line-height: 1.2;\n user-select: none;\n }\n\n .chip-close {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--default-text-color-70, #9ca3af);\n transition: color 0.2s ease;\n flex-shrink: 0;\n }\n\n .chip-close:hover {\n color: var(--default-text-color, #374151);\n }\n\n .chip-close:focus {\n outline: none;\n }\n\n .chip-close svg {\n display: block;\n width: 16px;\n height: 16px;\n }\n\n /* Responsive Styles */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+x.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: "+x.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: "+x.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: "+x.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: "+x.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: "+x.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: "+x.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: "+x.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: "+x.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: "+x.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n line-height: 100%;\n }\n\n .checkout-completed-help-section a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section {\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child,\n .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+x.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: "+x.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--default-text-color, #18181B);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 5px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+x.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: "+x.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n width: 60px;\n height: 60px;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n opacity: 0.5;\n overflow: hidden;\n }\n\n .gallery-image {\n display: block;\n object-fit: cover;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n height: 100%;\n margin: 0 auto;\n max-width: 100%;\n max-height: 100%;\n }\n\n .gallery-image-wrapper.selected {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image-wrapper {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+x.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: "+x.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n max-height: 418px;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+x.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: "+x.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: "+x.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: "+x.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: "+x.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getModalStyles(){return"\n /* Modal dialog */\n .modal {\n position: fixed;\n border: none;\n padding: 0;\n margin: auto;\n background: transparent;\n max-width: 90vw;\n max-height: 90vh;\n z-index: "+x.MODAL+";\n overflow: visible;\n }\n\n .modal::backdrop {\n background-color: rgba(0, 0, 0, 0.5);\n backdrop-filter: blur(2px);\n animation: modal-backdrop-fade-in 150ms ease-out;\n }\n\n @keyframes modal-backdrop-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n /* Modal content */\n .modal-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow: hidden;\n background: var(--drawer-background-color, #FAFAFA);\n border-radius: var(--border-radius-rounded, 6px);\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n }\n\n /* Specific modal sizes based on content type */\n .modal.product-list-retailers {\n width: 512px;\n height: 576px;\n }\n "}function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const N={"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"},B={backgroundColor:"--product-background-color"},q={backgroundColor:"--cart-background-color"},U={backgroundColor:"--address-background-color"},V={backgroundColor:"--checkout-background-color"},G={backgroundColor:"--product-list-background-color"},H={global:N,product:B,cart:q,address:U,checkout:V,productList:G};function getCSSVariableMapping(e){return H[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,i){const r={},s=getCSSVariableMapping(i);for(const[c,d]of Object.entries(s)){const i=this.getValueByPath(e,c);void 0!==i&&this.isCSSValue(i)&&(r[d]=i,this.isColorVariable(d,i)&&this.generateOpacityVariants(r,d,i))}return r}extractVariablesFromPartialTheme(e,i){const r={},s=getCSSVariableMapping(i);for(const[c,d]of Object.entries(s))if(this.hasValueAtPath(e,c)){const i=this.getValueByPath(e,c);void 0!==i&&this.isCSSValue(i)&&(r[d]=i,this.isColorVariable(d,i)&&this.generateOpacityVariants(r,d,i))}return r}generateCSSVariablesString(e){return Object.entries(e).map(([e,i])=>" "+e+": "+i+";").join("\n")}updateCSSVariablesInStylesheet(e,i){if(0!==Object.keys(i).length)try{const r=this.findOrCreateRule(e);for(const[e,s]of Object.entries(i))r.style.setProperty(e,String(s))}catch(r){this.logger.warn("Failed to update CSS variables")}}getValueByPath(e,i){return i.split(".").reduce((e,i)=>e&&void 0!==e[i]?e[i]:void 0,e)}hasValueAtPath(e,i){const r=i.split(".");let s=e;for(const c of r){if(null==s||!(c in s))return![];s=s[c]}return!![]}findOrCreateRule(e){const i=":host";for(const s of Array.from(e.cssRules))if(s instanceof CSSStyleRule&&s.selectorText===i)return s;const r=e.insertRule(i+" {}");return e.cssRules[r]}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,i,r){for(const s of this.opacityLevels){const c=i+"-"+s.suffix,d=this.addOpacityToHexColor(r,s.value);d&&(e[c]=d)}}isColorVariable(e,i){if("string"!=typeof i)return![];const r=e.toLowerCase().includes("color"),s=/^#[0-9a-f]{3,8}$/i.test(i);return r&&s}addOpacityToHexColor(e,i){if(!e.startsWith("#"))return null;let r=e.slice(1);if(3===r.length&&(r=r.split("").map(e=>e+e).join("")),6!==r.length)return null;const s=Math.round(255*i),c=s.toString(16).padStart(2,"0");return"#"+r+c}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(e){return this.styleSheets.get(e)}generateSpecificStylesheet(e,i){const r=this.cssProcessor.extractVariablesFromTheme(i,e),s=this.cssProcessor.generateCSSVariablesString(r),c=this.getStylesheetStyles(e).join("\n\n"),d=0===s.length?"":":host { "+s+" }",h=("\n "+d+"\n\n "+c+"\n ").trim();this.createStylesheet(e,h)}createStylesheet(e,i){try{if(this.isCSSStyleSheetSupported()){const r=new CSSStyleSheet;r.replaceSync(i),this.styleSheets.set(e,r)}else this.styleSheets.set(e,i)}catch(yt){this.styleSheets.set(e,i)}}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,i,r){const s=this.styleSheets.get(e);if(s&&"string"!=typeof s){const e=this.cssProcessor.extractVariablesFromPartialTheme(i,r);this.cssProcessor.updateCSSVariablesInStylesheet(s,e)}}getStylesheetStyles(e){switch(e){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles(),getModalStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];case"product-list":return[getProductListStyles(),getProductRetailersStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(e){this.data=e,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme),this.stylesheetGenerator.generateSpecificStylesheet("product-list",this.data.productList.theme)}updateComponentGlobalConfigs(e){var i,r;const s=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),e),this.data.global.layout.showPoweredBy=s,((null===(i=e.theme)||void 0===i?void 0:i.headingFont)||(null===(r=e.theme)||void 0===r?void 0:r.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",e.theme,"global")}updateProductComponent(e){this.data.product=this.deepMerge(this.getConfigs("product"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",e.theme,"product")}updateAddressComponent(e){this.data.address=this.deepMerge(this.getConfigs("address"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",e.theme,"address")}updateCartComponent(e){this.data.cart=this.deepMerge(this.getConfigs("cart"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",e.theme,"cart")}updateCheckoutComponent(e){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",e.theme,"checkout")}updateProductListComponent(e){this.data.productList=this.deepMerge(this.getConfigs("productList"),e),e.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product-list",e.theme,"product-list")}getConfigs(e){return"all"===e?this.data:this.data[e]}getComponentConfig(e){return-1!==z.indexOf(e)?this.getConfigs("product"):-1!==L.indexOf(e)?this.getConfigs("address"):-1!==R.indexOf(e)?this.getConfigs("cart"):-1!==M.indexOf(e)?this.getConfigs("checkout"):-1!==j.indexOf(e)?this.getConfigs("productList"):void 0}getStylesheet(e){const i=this.getBaseStylesheets();if(e===s.DRAWER||e===s.MODAL){const e=[...i],r=this.stylesheetGenerator.getStylesheet("product"),s=this.stylesheetGenerator.getStylesheet("cart"),c=this.stylesheetGenerator.getStylesheet("checkout"),d=this.stylesheetGenerator.getStylesheet("address"),h=this.stylesheetGenerator.getStylesheet("product-list");return r&&e.push(r),s&&e.push(s),c&&e.push(c),d&&e.push(d),h&&e.push(h),e}let r;if(L.includes(e)||e===s.ADDRESS)r="address";else if(z.includes(e)||e===s.PRODUCT)r="product";else if(R.includes(e)||e===s.CART)r="cart";else if(M.includes(e)||e===s.CHECKOUT)r="checkout";else{if(!j.includes(e)&&e!==s.PRODUCT_LIST)return this.logger.warn("No stylesheets found for component type: "+e+", returning base stylesheets only."),i;r="product-list"}const c=this.stylesheetGenerator.getStylesheet(r);return c?[...i,c]:i}getBaseStylesheets(){const e=[],i=this.stylesheetGenerator.getStylesheet("global"),r=this.stylesheetGenerator.getStylesheet("ui");return i&&e.push(i),r&&e.push(r),e}deepMerge(e,i){const r={...e};for(const s in i)null!==i[s]&&void 0!==i[s]&&("object"!=typeof i[s]||Array.isArray(i[s])||"object"!=typeof e[s]||Array.isArray(e[s])?r[s]=i[s]:r[s]=this.deepMerge(e[s],i[s]));return r}}const Y="@liquidcommerce/elements-sdk",W="LiquidCommerce Elements SDK",X="UNLICENSED",$="LiquidCommerce Team",tt="2.6.0-beta.31",et="https://docs.liquidcommerce.co/elements-sdk",nt={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},it={url:"https://github.com/liquidcommerce/elements-sdk/issues"},ot="./dist/index.esm.js",rt="./umd/elements.js",st="./dist/types/index.d.ts",at="pnpm@10.0.0",ct={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},lt=["dist","umd","docs","README.md","LICENSE"],dt={access:"public",registry:"https://registry.npmjs.org/"},ht="module",ut=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],pt={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"},mt=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],ft={"@biomejs/biome":"2.3.11","@commitlint/cli":"^20.3.1","@commitlint/config-conventional":"^20.3.1","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.3","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^25.0.8","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.55.1","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"},gt={node:">=22"},vt={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},yt={name:Y,description:W,license:X,author:$,version:tt,homepage:et,repository:nt,bugs:it,module:ot,browser:rt,types:st,packageManager:at,exports:ct,files:lt,publishConfig:dt,type:ht,sideEffects:ut,scripts:pt,keywords:mt,devDependencies:ft,engines:gt,pnpm:vt};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 i=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return i.some(i=>{const r=i.src;return r.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 i=await this.waitForContainerInit(e,1e4);return i?{success:!![],usingExistingGTM:!![],message:"Container "+e+" initialized"}:this.checkFallbackGTM(e)}return await this.injectGTMScript(e),{success:!![],usingExistingGTM:![],message:"Container "+e+" loaded successfully"}}catch(i){return this.checkFallbackGTM(e)}}waitForContainerInit(e,i){return new Promise(r=>{let s;const c=setInterval(()=>{this.isContainerInitialized(e)&&(clearInterval(c),clearTimeout(s),r(!![]))},100);s=setTimeout(()=>{clearInterval(c),r(![])},i)})}injectGTMScript(e){return new Promise((i,r)=>{const s=document.createElement("script");s.src="https://www.googletagmanager.com/gtm.js?id="+e,s.async=!![],s.crossOrigin="anonymous";let c=![];const d=setTimeout(()=>{c||(c=!![],this.isContainerInitialized(e)?i():r(new Error("GTM script timeout")))},15e3);s.onload=()=>{c||setTimeout(()=>{c||(c=!![],clearTimeout(d),this.isContainerInitialized(e)||window.dataLayer&&Array.isArray(window.dataLayer)?i():r(new Error("GTM script loaded but failed to initialize")))},500)},s.onerror=()=>{setTimeout(()=>{c||(c=!![],clearTimeout(d),this.isContainerLoaded(e)&&this.isContainerInitialized(e)?i():r(new Error("GTM script failed to load")))},100)},document.head.appendChild(s)})}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(),i=this.eventQueue.filter(i=>e-i.timestamp<3e4);for(const s of i)try{const e={event:s.eventName,...s.eventData};window.dataLayer.push(e)}catch(r){this.logger.error("Error processing queued event "+s.methodName,r)}this.eventQueue=[],i.length>0&&this.logger.info("Processed "+i.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(i){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",i)}}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 i=e.enableLiquidCommerceGTM?await this.loadGTMScript(e.liquidCommerceGTMId):{success:!![],message:"Using partner GTM only"};if(!i.success)throw this.isInitializing=![],this.initializationPromise=void 0,new SDKError("GTM initialization failed: "+i.message);this.isInitialized=!![],this.isInitializing=![],this.initializationPromise=void 0,this.logger.info(i.message),this.processEventQueue()}executeEvent(e,i,r){try{if(this.clientConfigService.isBuilder())return;const s=this.getSendToTargets(),c={...r,...s.length>0&&{send_to:s},tenant_name:this.partnerName,tenant_code:this.partnerCode,tenant_source:yt.description+" v"+yt.version};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:e,eventName:i,eventData:c,timestamp:Date.now()}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return;const d={event:i,...c};window.dataLayer.push(d)}catch(s){this.logger.error("GTM "+e+" error",s)}}calculateValue(e){const i=e.reduce((e,i)=>e+(i.price||0)*(i.quantity||1),0);return Number.parseFloat(i.toFixed(2))}viewItem(e){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([e]),items:[e]})}viewItemList(e,i,r){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:i,item_list_name:r,items:e})}selectItem(e,i,r){this.executeEvent("selectItem","select_item",{item_list_id:i,item_list_name:r,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,i){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(e),coupon:i,items:e})}addShippingInfo(e,i){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(e),coupon:i,items:e})}addPaymentInfo(e,i,r){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(e),payment_type:i,coupon:r,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,i){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:e,discount_amount:i})}promoCodeFailed(e,i){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:e,reason:i})}giftCardAttempt(e){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:e})}giftCardApplied(e,i){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:e,applied_amount:i})}giftCardFailed(e,i){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:e,reason:i})}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 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}}}class CartCommands extends BaseCommand{constructor(){super(),this.store.watch("cart.shouldReset",async e=>{e===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(e,r){try{this.store.set("cart.items."+e+".updating",!![]);const s=this.store.get("cart.id"),c=this.store.get("cart.items."+e);if(!c)throw this.logger.error("Cart item not found: "+e+" - cannot update quantity by "+r),new SDKError("Item not found");const d=c.quantity+r;if(d<1)return this.removeItem(e,!![]);const h=this.buildItemUpdate(c,d),u=await this.api.updateCart({id:s,items:[h],location:this.getLocation()});this.syncItemsFromApiResponse(u,[e]),this.updateFulfillment(c.fulfillmentId,u),this.syncRetailersFromApiResponse(u),this.syncCartMetaFromApiResponse(u),this.pubSub.publishAction(r<0?i.CART_ITEM_QUANTITY_DECREASE:i.CART_ITEM_QUANTITY_INCREASE,{cartId:s,itemId:c.id,quantity:d,previousQuantity:c.quantity});const g=splitCategoryPath(c.catPath),v={item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,quantity:Math.abs(r),price:centToDollar(c.unitPrice||0),item_image:c.mainImage,upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId};r<0?this.googleTagManager.removeFromCart(v):r>0&&this.googleTagManager.addToCart(v)}catch(s){throw this.store.set("cart.items."+e+".error",s.message),this.logger.error("Failed to update item quantity",s),s}finally{this.store.set("cart.items."+e+".updating",![])}}async removeItem(e,r){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;r||this.store.set("cart.items."+e+".updating",!![]);const s=this.store.get("cart.id"),c=this.store.get("cart.items."+e);if(!c)throw new SDKError("Item not found");const d=this.buildItemUpdate(c,0),h=await this.api.updateCart({id:s,items:[d],location:this.getLocation()}),u={itemId:c.id,fulfillmentId:c.fulfillmentId,retailerId:c.retailerId};this.syncItemsFromApiResponse(h,[]),this.cleanupAfterItemRemoval(u,h),this.syncCartMetaFromApiResponse(h),this.pubSub.publishAction(i.CART_ITEM_REMOVED,{cartId:s,itemId:c.id});const g=splitCategoryPath(c.catPath);this.googleTagManager.removeFromCart({item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:g.category,item_category2:g.category2,item_category3:g.category3,quantity:c.quantity,price:centToDollar(c.unitPrice||0),item_image:c.mainImage,upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId})}catch(s){throw this.store.set("cart.items."+e+".error",s.message),this.logger.error("Failed to remove item",s),s}}async updateItemEngraving(e,r){var s,c,d;try{const h=this.store.get("cart"),u=null===(s=h.items)||void 0===s?void 0:s[e];if(!u)throw new SDKError("Item not found");this.store.set("cart.items."+e+".updating",!![]);const g=this.getDetails(),v={id:u.id,fulfillmentId:u.fulfillmentId,partNumber:u.partNumber,quantity:u.quantity,engravingLines:r},b=await this.api.updateCart({id:h.id||"",items:[v],location:this.getLocation()});this.syncItemsFromApiResponse(b,[e]),this.syncRetailersFromApiResponse(b),this.syncCartMetaFromApiResponse(b);const x=this.getDetails();this.pubSub.publishAction(i.CART_ITEM_ENGRAVING_UPDATED,{cartId:x.cartId,itemId:u.id,engravingLines:r,previousEngravingLines:(null===(d=null===(c=u.attributes)||void 0===c?void 0:c.engraving)||void 0===d?void 0:d.lines)||[]}),this.pubSub.publishAction(i.CART_UPDATED,{previous:g,current:x})}catch(h){throw this.store.set("cart.items."+e+".error",h.message),this.logger.error("Failed to update item engraving",h),h}finally{this.store.set("cart.items."+e+".updating",![])}}async addItem(e){var r,s;try{this.store.set("cart.loading",!![]);const c=this.store.get("cart"),d=this.getDetails(),h=(null===(r=e.engravingLines)||void 0===r?void 0:r.filter(e=>""!==e.trim()))||[],u=h.length>0,g=Object.values(c.items||{}).find(i=>{var r,s,c,d,g;const v=i.fulfillmentId===e.fulfillmentId&&i.partNumber===e.partNumber;if(!v)return![];if(u){const e=(null===(s=null===(r=i.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[];return h.join(",")===e.join(",")}return!(null===(g=null===(d=null===(c=i.attributes)||void 0===c?void 0:c.engraving)||void 0===d?void 0:d.lines)||void 0===g?void 0:g.length)}),v={fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:g?e.quantity+g.quantity:e.quantity};u&&(v.engravingLines=h);const b=await this.api.updateCart({id:c.id||"",items:[v],location:this.getLocation()}),x=null===(s=Object.values(b.items))||void 0===s?void 0:s.find(e=>e.fulfillmentId===v.fulfillmentId&&e.partNumber===v.partNumber);if(!x)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(b,[]);const k=this.store.get("cart.fulfillments."+e.fulfillmentId);k?this.updateFulfillment(e.fulfillmentId,b):this.addNewFulfillmentAndRetailer(e.fulfillmentId,b),this.syncRetailersFromApiResponse(b),this.syncCartMetaFromApiResponse(b);const E=this.getDetails();this.pubSub.publishAction(i.PRODUCT_ADD_TO_CART,{...e}),this.pubSub.publishAction(i.CART_ITEM_ADDED,{cartId:E.cartId,itemId:x.id,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,engravingLines:e.engravingLines}),this.pubSub.publishAction(i.CART_UPDATED,{previous:d,current:E});const _=splitCategoryPath(x.catPath);this.googleTagManager.addToCart({item_id:x.liquidId,item_name:x.name,item_brand:x.brand,item_size:x.size,item_category:_.category,item_category2:_.category2,item_category3:_.category3,quantity:x.quantity,price:centToDollar(x.unitPrice||0),item_image:x.mainImage,upc:x.upc,grouping_id:x.salsifyGrouping,product_id:x.liquidId})}catch(c){this.store.set("cart.error",c.message),this.logger.error("Failed to add item to cart",c)}finally{this.store.set("cart.loading",![])}}async handleGoToCheckout(){try{this.store.set("cart.loading",!![]);const e=this.store.get("cart"),r=this.clientConfig.get("checkoutUrl");if(r){this.trackBeginCheckout(e);const i=this.resolveCheckoutRedirectUrl(r);return window.location.assign(i),void 0}this.pubSub.publishAction(i.INTERNAL_CART_TO_CHECKOUT,{}),this.trackBeginCheckout(e)}catch(e){throw this.store.set("cart.error",e.message),this.logger.error("Failed to proceed to checkout",e),e}finally{this.store.set("cart.loading",![])}}trackBeginCheckout(e){var i;const r=(null===(i=e.promoCode)||void 0===i?void 0:i.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(e.items||{}).map(e=>{const i=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:i.category,item_category2:i.category2,item_category3:i.category3,quantity:e.quantity,price:centToDollar(e.unitPrice||0),item_image:e.mainImage,upc:e.upc,grouping_id:e.salsifyGrouping,product_id:e.liquidId}})],r)}resolveCheckoutRedirectUrl(e){if(!e.includes("{id}"))return e;const i=this.store.get("cart.id")||this.store.get("checkout.cartId")||"";return i?e.split("{id}").join(encodeURIComponent(i)):(this.logger.warn('Checkout redirect URL contains "{id}" placeholder but no cart ID was found. Removing placeholder.'),e.split("{id}").join(""))}async applyPromoCode(e){var r,s,c,d,h;if(!(null==e?void 0:e.trim()))throw new SDKError("Promo code is required");const u=e.trim().toUpperCase();try{const e=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(u);const g=await this.api.updateCart({id:e,items:[],promoCode:u,location:this.getLocation()});this.store.batch({"cart.subtotal":g.subtotal,"cart.itemsQuantity":g.itemsQuantity,"cart.events":g.events});const v=(null===(s=null===(r=g.promoCode)||void 0===r?void 0:r.code)||void 0===s?void 0:s.toLowerCase())===u.toLowerCase();v?(this.store.set("cart.promoCode",{code:u,discount:(null===(c=g.promoCode)||void 0===c?void 0:c.discount)||0}),this.pubSub.publishAction(i.CART_PROMO_CODE_APPLIED,{cartId:e,discount:(null===(d=g.promoCode)||void 0===d?void 0:d.discount)||0,newSubtotal:g.subtotal||0}),this.googleTagManager.promoCodeApplied(u,(null===(h=g.promoCode)||void 0===h?void 0:h.discount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(i.CART_PROMO_CODE_FAILED,{cartId:e,error:"Promo code does not exist"}),this.googleTagManager.promoCodeFailed(u,'Code "'+u+'" does not exist'))}catch(g){const e=(null==g?void 0:g.message)||"Failed to apply promo code. Please try again.";this.store.set("cart.error",e);const r=this.store.get("cart.id");throw this.pubSub.publishAction(i.CART_PROMO_CODE_FAILED,{cartId:r,error:e}),this.googleTagManager.promoCodeFailed(u,e),this.logger.error("Failed to apply promo code",g),g}}async removePromoCode(){try{const e=this.store.get("cart.id"),r=await this.api.updateCart({id:e,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":r.subtotal,"cart.itemsQuantity":r.itemsQuantity,"cart.promoCode":null}),this.pubSub.publishAction(i.CART_PROMO_CODE_REMOVED,{cartId:e,newSubtotal:r.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(e){const r=(null==e?void 0:e.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",r);const s=this.store.get("cart.promoCode"),c=this.store.get("cart.id");throw this.pubSub.publishAction(i.CART_PROMO_CODE_FAILED,{cartId:c,error:r}),(null==s?void 0:s.code)&&this.googleTagManager.promoCodeFailed(s.code,r),this.logger.error("Failed to remove promo code",e),e}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){try{this.store.set("cart",{...F,rerender:!![]}),this.store.set("cart.loading",!![]);const e=this.store.get("cart"),r=await this.api.getCartData(e.id);this.syncCartState(r,!![]),r.id!==e.id&&await this.store.persist(),this.pubSub.publishAction(i.CART_RESET,!![])}catch(e){const r=(null==e?void 0:e.message)||"Failed to reset cart";this.store.set("cart.error",r);const s=this.store.get("cart.id");throw this.pubSub.publishAction(i.CART_FAILED,{cartId:s,message:r}),this.logger.error("Reset cart failed",e),e}finally{this.store.set("cart.loading",![])}}getDetails(){var e;const i=this.store.get("cart"),r=this.store.get("address"),s={};for(const c in i.items||{}){const e=i.items[c];s[c]={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:i.id||"",promoCodeDiscount:(null===(e=i.promoCode)||void 0===e?void 0:e.discount)||null,subtotal:i.subtotal,itemCount:i.itemsQuantity,items:s,retailers:i.retailers||{},location:r.id?{placesId:r.id,formattedAddress:r.formattedAddress,address:r.address,coordinates:r.coordinates}:null}}buildItemUpdate(e,i){var r,s,c;const d={id:e.id,fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:i},h=(null===(c=null===(s=null===(r=e.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||void 0===c?void 0:c.filter(e=>""!==e.trim()))||[];return h.length>0&&(d.engravingLines=h),d}syncItemsFromApiResponse(e,i=[]){const r=this.store.get("cart.items")||{},s=new Set(Object.keys(e.items));for(const d of Object.keys(r))s.has(d)||this.store.remove("cart.items."+d);const c={};for(const d of Object.values(e.items))0!==i.length&&!i.includes(d.id)&&r[d.id]||(c["cart.items."+d.id]=d);Object.keys(c).length>0&&this.store.batch(c)}syncCartMetaFromApiResponse(e){var i,r;const s={"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.error":null,"cart.events":e.events},c=null===(i=null==e?void 0:e.promoCode)||void 0===i?void 0:i.code;if(c)s["cart.promoCode"]={code:c.toUpperCase(),discount:(null===(r=e.promoCode)||void 0===r?void 0:r.discount)||0};else{const e=this.store.get("cart.promoCode");(null==e?void 0:e.code)&&(s["cart.promoCode"]=null)}this.store.batch(s)}syncRetailersFromApiResponse(e){var i,r;const s=this.store.get("cart.retailers")||{},c=this.store.get("cart.fulfillments")||{},d=new Set(Object.keys(e.retailers)),h=new Set;for(const u of Object.values(e.retailers))if(u.fulfillments)for(const e of Object.keys(u.fulfillments))h.add(e);for(const u of Object.keys(s))d.has(u)||this.store.remove("cart.retailers."+u);for(const u of Object.keys(c))h.has(u)||this.store.remove("cart.fulfillments."+u);if((null===(i=Object.values(e.retailers))||void 0===i?void 0:i.length)>0){const i={};for(const s of Object.values(e.retailers))if(i["cart.retailers."+s.id]=s,(null===(r=Object.values(s.fulfillments))||void 0===r?void 0:r.length)>0)for(const e of Object.values(s.fulfillments))i["cart.fulfillments."+e.id]=e;this.store.batch(i)}}updateFulfillment(e,i){var r;const s=null===(r=Object.values(i.retailers))||void 0===r?void 0:r.find(i=>{var r;return null===(r=Object.keys(i.fulfillments))||void 0===r?void 0:r.some(i=>i===e)}),c=null==s?void 0:s.fulfillments[e];c&&s&&this.store.set("cart.fulfillments."+e,c)}addNewFulfillmentAndRetailer(e,i){var r;const s=null===(r=Object.values(i.retailers))||void 0===r?void 0:r.find(i=>{var r;return null===(r=Object.keys(i.fulfillments))||void 0===r?void 0:r.some(i=>i===e)}),c=null==s?void 0:s.fulfillments[e];if(c&&s){const i={["cart.fulfillments."+e]:c,["cart.retailers."+s.id]:s};this.store.batch(i)}}cleanupAfterItemRemoval(e,i){var r,s;const c=null===(r=Object.values(i.retailers))||void 0===r?void 0:r.some(i=>{var r;return null===(r=Object.keys(i.fulfillments))||void 0===r?void 0:r.some(i=>i===e.fulfillmentId)}),d=null===(s=Object.keys(i.retailers))||void 0===s?void 0:s.some(i=>i===e.retailerId);if(c){this.updateFulfillment(e.fulfillmentId,i);const r=i.retailers[e.retailerId];r&&this.store.set("cart.retailers."+e.retailerId,r)}else if(this.store.remove("cart.fulfillments."+e.fulfillmentId),d){const r=i.retailers[e.retailerId];r&&this.store.set("cart.retailers."+e.retailerId,r)}else this.store.remove("cart.retailers."+e.retailerId)}syncCartState(e,r=![]){var s,c,d,h,u;const g=this.store.get("cart");for(const i of Object.keys(g.items||{}))this.store.remove("cart.items."+i);for(const i of Object.keys(g.retailers||{}))this.store.remove("cart.retailers."+i);for(const i of Object.keys(g.fulfillments||{}))this.store.remove("cart.fulfillments."+i);const v={"cart.id":e.id,"cart.error":null,"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(s=e.promoCode)||void 0===s?void 0:s.code)?{...e.promoCode,error:null}:null};if((null===(c=Object.values(e.items))||void 0===c?void 0:c.length)>0)for(const i of Object.values(e.items))v["cart.items."+i.id]=i;if((null===(d=Object.values(e.retailers))||void 0===d?void 0:d.length)>0)for(const i of Object.values(e.retailers))if(v["cart.retailers."+i.id]=i,(null===(h=Object.values(i.fulfillments))||void 0===h?void 0:h.length)>0)for(const e of Object.values(i.fulfillments))v["cart.fulfillments."+e.id]=e;if((null===(u=e.events)||void 0===u?void 0:u.length)>0&&(v["cart.events"]=e.events),this.store.batch(v),r){const e=this.store.get("cart"),r=this.buildCartLoadedEventData(e);this.pubSub.publishAction(i.CART_LOADED,r)}}buildCartLoadedEventData(e){var i,r;const s=this.store.get("address"),c={};for(const d of Object.keys(e.items||{})){const i=e.items[d];c[d]={id:i.id,variantId:i.variantId,liquidId:i.liquidId,salsifyGrouping:i.salsifyGrouping,retailerId:i.retailerId,partNumber:i.partNumber,fulfillmentId:i.fulfillmentId,upc:i.upc,sku:i.sku,catPath:i.catPath,volume:i.volume,uom:i.uom,pack:i.pack,packDesc:i.packDesc,container:i.container,containerType:i.containerType,name:i.name,brand:i.brand,size:i.size,price:i.price,quantity:i.quantity,maxQuantity:i.maxQuantity,unitPrice:i.unitPrice,mainImage:i.mainImage,attributes:i.attributes}}return{cartId:e.id,promoCodeDiscount:null!==(r=null===(i=e.promoCode)||void 0===i?void 0:i.discount)&&void 0!==r?r:null,subtotal:e.subtotal,itemCount:e.itemsQuantity,items:c,retailers:e.retailers||{},location:(null==s?void 0:s.id)&&s.coordinates&&s.address?{placesId:s.id,formattedAddress:s.formattedAddress,address:s.address,coordinates:s.coordinates}:null}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(e,r){const c={type:e,data:r||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:c}),e===s.CART&&this.pubSub.publishAction(i.CART_OPENED,!![]),e===s.CHECKOUT&&this.pubSub.publishAction(i.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const e=this.store.get("ui.drawer.contentConfig");(null==e?void 0:e.type)===s.CART&&this.pubSub.publishAction(i.CART_CLOSED,!![]),(null==e?void 0:e.type)===s.CHECKOUT&&this.pubSub.publishAction(i.CHECKOUT_CLOSED,!![])}openModal(e,i){const r={type:e,data:i||{}};this.store.set("ui.modal",{isOpen:!![],contentConfig:r})}closeModal(){this.store.set("ui.modal.isOpen",![]),this.store.set("ui.modal.contentConfig",null)}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),window.addEventListener("lce:actions."+i.INTERNAL_CART_TO_CHECKOUT,async()=>{await this.loadCheckout({}),this.uiCommands.openDrawer(s.CHECKOUT)}),window.addEventListener("lce:actions."+i.CART_RESET,()=>{this.store.set("checkout",{...D,rerender:!![]})})}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async addPresaleItem(e){try{const i={fulfillmentId:e.fulfillmentId,partNumber:e.partNumber,quantity:e.quantity,engravingLines:e.engravingLines},r=await this.api.updateCart({id:"",items:[i],location:this.getLocation()});await this.loadCheckout({customCartId:r.id,isForPresale:!![]})}catch(i){throw this.store.set("checkout.error",i.message),this.logger.error("Failed to add presale item to checkout",i),i}}async loadCheckout(e){var r;try{this.store.set("checkout.loading",!![]);const s=void 0!==e.customCartId?e.customCartId:this.store.get("cart.id"),c=this.store.get("cart");if(0===(null===(r=Object.values(c.items||{}))||void 0===r?void 0:r.length)&&!e.customCartId)return;const d=this.themeProvider.getConfigs("checkout"),h={canEmail:d.layout.emailOptIn.checked,canSms:d.layout.smsOptIn.checked};if(!s)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const u=await this.api.prepareCheckout({cartId:s,marketingPreferences:h});if(e.isForPresale===!![]&&0===Object.values(u.items).length)return this.openPresaleExpiredDrawer("items_unavailable"),void 0;const g={"checkout.cartId":u.cartId,"checkout.isGift":u.isGift,"checkout.marketingPreferences":u.marketingPreferences,"checkout.customerForm":D.customerForm,"checkout.giftRecipientForm":D.giftRecipientForm,"checkout.paymentForm":D.paymentForm,"checkout.paymentForm.billingSameAsShipping":u.billingSameAsShipping,"checkout.shippingAddress":u.shippingAddress,"checkout.presale":u.presale,"checkout.giftRecipientForm.data":u.giftOptions,"checkout.updating":![],"checkout.itemsQuantity":u.itemsQuantity};this.store.batch(g),this.syncCheckoutState(u),this.pubSub.publishAction(i.CHECKOUT_LOADED,this.getDetails())}catch(s){this.store.set("checkout.error",s.message),this.pubSub.publishAction(i.CHECKOUT_FAILED,{message:s.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(e){const r=this.store.get("checkout.isGift"),s=null!=e?e:!r,c={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":s,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":c});const d=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_IS_GIFT_TOGGLED,{cartId:d,isActive:s,previousIsActive:r})}async toggleBillingSameAsShipping(e){const r=this.store.get("checkout.paymentForm.billingSameAsShipping"),s=null!=e?e:!r;this.store.set("checkout.paymentForm.billingSameAsShipping",s);const c=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{cartId:c,isActive:s,previousIsActive:r})}async toggleMarketingPreferences(e,r){const s=this.store.get("checkout.marketingPreferences."+e),c=null!=r?r:!s,d=this.store.get("checkout.marketingPreferences"),h=this.dataForCheckoutPrepare({marketingPreferences:{...d,[e]:c}}),u=await this.api.prepareCheckout(h);this.store.set("checkout.marketingPreferences",u.marketingPreferences);const g=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{cartId:g,fieldName:e,isActive:c,previousIsActive:s})}async getPaymentSession(){try{const e=this.store.get("cart.id"),i=await this.api.getPaymentSession(e);this.store.batch({"checkout.paymentForm.paymentSession":i,"checkout.paymentForm.paymentMethod":null})}catch(e){throw this.store.batch({"checkout.error":e.message,"checkout.loading":![]}),e}}async confirmPaymentSession(e,i){try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"35"}};const r=await this.api.confirmPaymentSession({confirmationTokenId:e,setupIntentId:i});return{id:r.id,card:{brand:r.card.brand,last4:r.card.last4,expMonth:r.card.expMonth,expYear:r.card.expYear}}}catch(r){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(e){try{this.googleTagManager.promoCodeAttempt(e);const r=this.dataForCheckoutPrepare({}),s=await this.api.prepareCheckout({...r,promoCode:e}),c=0!==s.amounts.discounts,d=s.events.some(e=>e.type===u.PROMO_CODE)?s.events[0]:null;if(!c){this.store.set("checkout.promoCodeError",d?d.message:'Code "'+e+'" does not exist');const r=this.store.get("checkout.cartId");return this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_FAILED,{cartId:r,error:(null==d?void 0:d.message)||'Code "'+e+'" does not exist'}),this.googleTagManager.promoCodeFailed(e,(null==d?void 0:d.message)||"not_applied"),void 0}const h=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_APPLIED,{cartId:h,discount:s.amounts.discounts,newTotal:s.amounts.total}),this.googleTagManager.promoCodeApplied(e,s.amounts.discounts),await this.refreshCheckout({response:s})}catch(r){const s=(null==r?void 0:r.message)||"Failed to apply promo code. Please try again.";this.store.set("checkout.error",s);const c=this.store.get("checkout.cartId");throw this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_FAILED,{cartId:c,error:s}),this.googleTagManager.promoCodeFailed(e,s),r}}async removePromoCode(){var e,r;try{const s=this.dataForCheckoutPrepare({}),c=(null===(r=null===(e=this.store.get("checkout"))||void 0===e?void 0:e.promoCode)||void 0===r?void 0:r.code)||"",d=await this.api.prepareCheckout({...s,promoCode:""});if(0!==d.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;const h=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_REMOVED,{cartId:h,newTotal:d.amounts.total}),this.googleTagManager.promoCodeApplied(c,0),await this.refreshCheckout({response:d})}catch(s){const e=(null==s?void 0:s.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",e);const r=this.store.get("checkout.promoCode.code")||"",c=this.store.get("checkout.cartId");throw this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_FAILED,{cartId:c,error:e}),r&&this.googleTagManager.promoCodeFailed(r,e),s}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(yt){const i=yt.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",i),yt}}async applyGiftCard(e){const r=e.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(r);const e=this.dataForCheckoutPrepare({}),s=e.giftCards||[],c=await this.api.prepareCheckout({...e,giftCards:[...s,r]}),d=c.events.some(e=>e.type===u.GIFT_CARD&&e.level===g.ERROR)?c.events[0]:null;d&&this.store.set("checkout.giftCardError",d.message);const h=c.giftCards.find(e=>e.code.toLowerCase()===r.toLowerCase());if(!h){this.store.set("checkout.giftCardError","Gift card could not be applied");const e=this.store.get("checkout.cartId");return this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_FAILED,{cartId:e,error:(null==d?void 0:d.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(r,(null==d?void 0:d.message)||"not_applied"),void 0}const v=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_APPLIED,{cartId:v,newTotal:c.amounts.total}),this.googleTagManager.giftCardApplied(r,h.applied),await this.refreshCheckout({response:c})}catch(s){const e=(null==s?void 0:s.message)||"Failed to apply gift card. Please try again.";this.store.set("checkout.error",e);const c=this.store.get("checkout.cartId");throw this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_FAILED,{cartId:c,error:e}),this.googleTagManager.giftCardFailed(r,e),s}}async removeGiftCard(e){var r;const s=e.trim().toUpperCase();try{const e=this.dataForCheckoutPrepare({}),c=(null===(r=e.giftCards)||void 0===r?void 0:r.filter(e=>e.toLowerCase()!==s.toLowerCase()))||[],d=await this.api.prepareCheckout({...e,giftCards:c}),h=d.giftCards.find(e=>e.code.toLowerCase()===s.toLowerCase());if(h)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+s),void 0;const u=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_REMOVED,{cartId:u,newTotal:d.amounts.total}),this.googleTagManager.giftCardApplied(s,0),await this.refreshCheckout({response:d})}catch(c){const e=(null==c?void 0:c.message)||"Failed to remove gift card. Please try again.";this.store.set("checkout.error",e);const r=this.store.get("checkout.cartId");throw this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_FAILED,{cartId:r,error:e}),this.googleTagManager.giftCardFailed(s,e),c}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(yt){throw this.store.set("checkout.error",(null==yt?void 0:yt.message)||"Failed to clear gift card error. Please try again."),yt}}openPresaleExpiredDrawer(e="time_expired"){this.uiCommands.openDrawer(s.CHECKOUT_PRESALE_EXPIRED,{reason:e})}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(e,r){var s,c,d;try{this.store.set("checkout.items."+e+".updating",!![]);const h=this.store.get("checkout.cartId"),u=this.store.get("checkout.items."+e);if(!u)throw new SDKError("Item not found");const g=u.quantity,v=u.quantity+r;if(v<1)return this.removeItem(e,!![]);const b={id:u.cartItemId,fulfillmentId:u.fulfillmentId,partNumber:u.partNumber,quantity:v},x=(null===(d=null===(c=null===(s=u.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.lines)||void 0===d?void 0:d.filter(e=>""!==e.trim()))||[];x.length>0&&(b.engravingLines=x);const k=await this.api.updateCheckoutItems({cartId:h,items:[b],location:this.getLocation()});this.syncFromItemUpdate(k.cart,k.checkout),this.pubSub.publishAction(r>0?i.CHECKOUT_ITEM_QUANTITY_INCREASE:i.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartId:h,cartItemId:u.cartItemId,quantity:v,previousQuantity:g});const E=splitCategoryPath(u.catPath),_={item_id:u.liquidId,item_name:u.name,item_brand:u.brand,item_size:u.size,item_category:E.category,item_category2:E.category2,item_category3:E.category3,quantity:Math.abs(r),price:centToDollar(u.unitPrice||0),item_image:u.mainImage,upc:u.upc,grouping_id:u.salsifyGrouping,product_id:u.liquidId};r<0?this.googleTagManager.removeFromCart(_):r>0&&this.googleTagManager.addToCart(_)}catch(h){throw this.store.set("checkout.items."+e+".error",h.message),h}finally{this.store.set("checkout.items."+e+".updating",![])}}async removeItemEngraving(e){var r,s,c;try{const d=this.store.get("checkout.items."+e);if(!d)throw new SDKError("Item not found in checkout");if(!(null===(r=d.attributes)||void 0===r?void 0:r.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:e}),void 0;const h=(null===(c=null===(s=d.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.lines)||[],u={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:d.quantity,engravingLines:[]},g=this.store.get("checkout.cartId"),v=await this.api.updateCheckoutItems({cartId:g,items:[u],location:this.getLocation()});this.syncFromItemUpdate(v.cart,v.checkout),this.pubSub.publishAction(i.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartId:g,cartItemId:d.cartItemId,engravingLines:[],previousEngravingLines:h})}catch(d){throw this.store.set("checkout.items."+e+".error",d.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:e,error:d}),d}}async removeItem(e,r){var s,c,d;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;r||this.store.set("checkout.items."+e+".updating",!![]);const h=this.store.get("checkout.cartId"),u=this.store.get("checkout.items."+e);if(!u)throw new SDKError("Item not found");const g={id:u.cartItemId,fulfillmentId:u.fulfillmentId,partNumber:u.partNumber,quantity:0},v=(null===(d=null===(c=null===(s=u.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.lines)||void 0===d?void 0:d.filter(e=>""!==e.trim()))||[];v.length>0&&(g.engravingLines=v);const b=await this.api.updateCheckoutItems({cartId:h,items:[g],location:this.getLocation()});this.syncFromItemUpdate(b.cart,b.checkout),this.pubSub.publishAction(i.CHECKOUT_ITEM_REMOVED,{cartId:h,cartItemId:u.cartItemId})}catch(h){throw this.store.set("checkout.items."+e+".error",h.message),h}}async updateTips(e){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",e);const r=this.store.get("checkout.fulfillments"),s=Object.values(r||{}).filter(e=>e.type===c.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.amounts.tip})),d=Object.values(r||{}).filter(e=>e.type===c.ON_DEMAND).map(i=>({fulfillmentId:i.id,tip:Math.round(i.amounts.subtotal*e/100)})),h=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:d}));this.updateStoreFromCheckoutResponse(h);const u=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_TIP_UPDATED,{cartId:u,deliveryTips:d,previousDeliveryTips:s})}catch(r){throw this.store.set("checkout.error",(null==r?void 0:r.message)||"Failed to update tips. Please try again."),r}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(e,r){try{this.store.set("checkout.updating",!![]);const s=this.store.get("checkout.fulfillments"),d=Object.values(s||{}).filter(e=>e.type===c.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.amounts.tip})),h=Object.values(s||{}).filter(e=>e.type===c.ON_DEMAND).map(i=>({fulfillmentId:i.id,tip:i.id===e?r:i.amounts.tip})),u=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:h}));this.updateStoreFromCheckoutResponse(u);const g=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_TIP_UPDATED,{cartId:g,deliveryTips:h,previousDeliveryTips:d})}catch(s){throw this.store.set("checkout.error",(null==s?void 0:s.message)||"Failed to update fulfillment tip. Please try again."),s}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(e){try{this.store.set("checkout.updating",!![]);const r=this.store.get("checkout.fulfillments"),s=Object.values(r||{}).filter(e=>e.type===c.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.amounts.tip})),d=Object.values(r||{}).filter(e=>e.type===c.ON_DEMAND).map(i=>({fulfillmentId:i.id,tip:i.id===e?0:i.amounts.tip})),h=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:d}));this.updateStoreFromCheckoutResponse(h);const u=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_TIP_UPDATED,{cartId:u,deliveryTips:d,previousDeliveryTips:s})}catch(r){throw this.store.set("checkout.error",(null==r?void 0:r.message)||"Failed to remove fulfillment tip. Please try again."),r}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:r,customerData:s}){var c;try{this.store.set("checkout.customerForm.isSaving",!![]);const d=this.store.get("checkout.customerForm.data"),h=this.store.get("checkout.isGift"),u=this.dataForCheckoutPrepare({shippingAddressTwo:e,deliveryInstructions:r||void 0,customer:{...d,...s},isGift:h}),g=await this.api.prepareCheckout(u);this.store.batch({"checkout.customerForm.data":g.customer,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddress":g.shippingAddress,"checkout.deliveryInstructions":r});const v=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{cartId:v});const b=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(b.items||{}).map(e=>{const i=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:i.category,item_category2:i.category2,item_category3:i.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===(c=b.promoCode)||void 0===c?void 0:c.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:e,deliveryInstructions:r,...s}){var c;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const d=this.dataForCheckoutPrepare({shippingAddressTwo:e,deliveryInstructions:r||void 0,isGift:!![],giftRecipient:s}),h=await this.api.prepareCheckout(d);this.store.batch({"checkout.giftRecipientForm.data":h.giftOptions,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddress":h.shippingAddress,"checkout.deliveryInstructions":r});const u=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_GIFT_INFORMATION_UPDATED,{cartId:u});const g=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(g.items||{}).map(e=>{const i=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:i.category,item_category2:i.category2,item_category3:i.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===(c=g.promoCode)||void 0===c?void 0:c.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:e,paymentSession:r}){var s,c,d;try{this.store.set("checkout.paymentForm.isSaving",!![]);const h=this.store.get("checkout"),u={},g=this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId");let v=null,b=null;if(g||r){const e=await this.confirmPaymentSession((null==r?void 0:r.confirmationTokenId)||"",(null==r?void 0:r.setupIntentId)||"");if(!e)throw new Error("Failed to confirm payment method");v=e.card,b=e.id}const x=this.dataForCheckoutPrepare({billingData:e,paymentMethodId:b||void 0}),k=await this.api.prepareCheckout(x);if(k.payment&&v&&(u["checkout.paymentForm.paymentMethod"]={id:k.payment,card:v}),e&&k.billingAddress){u["checkout.paymentForm.data"]={firstName:k.billingAddress.firstName||"",lastName:k.billingAddress.lastName||"",email:k.billingAddress.email||"",phone:k.billingAddress.phone||"",company:k.billingAddress.company||"",addressOne:k.billingAddress.one||"",addressTwo:k.billingAddress.two||"",city:k.billingAddress.city||"",state:k.billingAddress.state||"",zipCode:k.billingAddress.zip||""};const e=this.store.get("checkout.cartId");this.pubSub.publishAction(i.CHECKOUT_BILLING_INFORMATION_UPDATED,{cartId:e})}u["checkout.paymentForm.isEditing"]=![],u["checkout.paymentForm.isValid"]=!![],this.store.batch(u);const E=u["checkout.paymentForm.paymentMethod"]||(null===(s=h.paymentForm)||void 0===s?void 0:s.paymentMethod),_=(null===(c=null==E?void 0:E.card)||void 0===c?void 0:c.brand)?E.card.brand+" ****"+E.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(h.items||{}).map(e=>{const i=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:i.category,item_category2:i.category2,item_category3:i.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===(d=h.promoCode)||void 0===d?void 0:d.code)||void 0)}catch(h){throw this.logger.error("Failed to save payment form",h),this.store.set("checkout.error",h.message),h}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var e,r,c,d,h,u;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(i.CHECKOUT_SUBMIT_STARTED,{started:!![]});const g=this.store.get("checkout"),{orderNumber:v}=await this.api.checkoutComplete(g.token);g.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(s.CHECKOUT_COMPLETED,{orderNumber:v,orderTotal:g.amounts.total,cardLast4:null===(c=null===(r=null===(e=null==g?void 0:g.paymentForm)||void 0===e?void 0:e.paymentMethod)||void 0===r?void 0:r.card)||void 0===c?void 0:c.last4,customerEmail:g.customerForm.data.email,giftRecipientEmail:(null===(h=null===(d=null==g?void 0:g.giftRecipientForm)||void 0===d?void 0:d.data)||void 0===h?void 0:h.email)||null}),this.pubSub.publishAction(i.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:v,orderTotal:g.amounts.total}),this.googleTagManager.purchase({transaction_id:v,tax:centToDollar(g.amounts.tax+g.amounts.service+g.amounts.platform),shipping:centToDollar(g.amounts.shipping||0),coupon:(null===(u=g.promoCode)||void 0===u?void 0:u.code)||void 0,items:[...Object.values(g.items||{}).map(e=>{const i=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:i.category,item_category2:i.category2,item_category3:i.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(g.amounts.total),subtotal:centToDollar(g.amounts.subtotal),total_before_discounts:centToDollar(g.amounts.subtotal+g.amounts.tax+g.amounts.service+g.amounts.platform+g.amounts.shipping+g.amounts.delivery),discounts:centToDollar(g.amounts.discounts),gift_cards:centToDollar(g.amounts.giftCards||0),net_total:centToDollar(g.amounts.total)})}catch(g){const e=(null==g?void 0:g.message)||"Checkout complete failed";this.store.batch({"checkout.error":e}),this.pubSub.publishAction(i.CHECKOUT_SUBMIT_FAILED,{message:e})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(e){const i={"checkout.amounts":e.amounts,"checkout.events":e.events,"checkout.error":null};if(e.retailers&&Object.values(e.retailers).length>0)for(const r of Object.values(e.retailers))for(const e of Object.values(r.fulfillments))i["checkout.fulfillments."+e.id]=e;this.store.batch(i)}syncFromItemUpdate(e,i){var r,s,c,d,h;try{this.store.set("checkout.updating",!![]);const u=this.store.get("cart");for(const e of Object.keys(u.items||{}))this.store.remove("cart.items."+e);for(const e of Object.keys(u.retailers||{}))this.store.remove("cart.retailers."+e);for(const e of Object.keys(u.fulfillments||{}))this.store.remove("cart.fulfillments."+e);const g={"cart.id":e.id,"cart.error":null,"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.events":e.events||[],"cart.promoCode":(null===(r=e.promoCode)||void 0===r?void 0:r.code)?{...e.promoCode,error:null}:null};if((null===(s=Object.values(e.items))||void 0===s?void 0:s.length)>0)for(const i of Object.values(e.items))g["cart.items."+i.id]=i;if((null===(c=Object.values(e.retailers))||void 0===c?void 0:c.length)>0)for(const i of Object.values(e.retailers))if(g["cart.retailers."+i.id]=i,(null===(d=Object.values(i.fulfillments))||void 0===d?void 0:d.length)>0)for(const e of Object.values(i.fulfillments))g["cart.fulfillments."+e.id]=e;this.store.batch(g);const v={"checkout.token":i.token,"checkout.events":i.events,"checkout.amounts":i.amounts,"checkout.shippingAddress":i.shippingAddress,"checkout.itemsQuantity":i.itemsQuantity,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":i.giftCards.map(e=>({code:e.code,discount:e.applied})),"checkout.promoCode":(null===(h=null==i?void 0:i.promoCode)||void 0===h?void 0:h.code)?null==i?void 0:i.promoCode:null};if(Object.values(i.items).length>0){this.store.remove("checkout.items");for(const e of Object.values(i.items))v["checkout.items."+e.cartItemId]={...e,loading:![],updating:![],error:null}}if(i.retailers&&Object.values(i.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const e of Object.values(i.retailers)){v["checkout.retailers."+e.id]=e;for(const i of Object.values(e.fulfillments))v["checkout.fulfillments."+i.id]=i}}this.store.batch(v)}finally{this.store.set("checkout.updating",![])}}syncCheckoutState(e){var i;const r={"checkout.token":e.token,"checkout.events":e.events,"checkout.amounts":e.amounts,"checkout.shippingAddress":e.shippingAddress,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":e.giftCards.map(e=>({code:e.code,discount:e.applied})),"checkout.promoCode":(null===(i=null==e?void 0:e.promoCode)||void 0===i?void 0:i.code)?null==e?void 0:e.promoCode:null};if(Object.values(e.items).length>0){this.store.remove("checkout.items");for(const i of Object.values(e.items))r["checkout.items."+i.cartItemId]={...i,loading:![],updating:![],error:null}}if(e.retailers&&Object.values(e.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const i of Object.values(e.retailers)){r["checkout.retailers."+i.id]=i;for(const e of Object.values(i.fulfillments))r["checkout.fulfillments."+e.id]=e}}this.store.batch(r)}async refreshCheckout(e){var r;try{let i;if(this.store.set("checkout.updating",!![]),null==e?void 0:e.response)i=e.response;else{const s=null!==(r=null==e?void 0:e.cartId)&&void 0!==r?r:this.store.get("checkout.cartId");if(!s)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const c=this.dataForCheckoutPrepare({});i=await this.api.prepareCheckout({...c,cartId:s})}this.syncCheckoutState(i)}catch(s){const e=(null==s?void 0:s.message)||"Failed to refresh checkout data. Please try again.";throw this.store.set("checkout.error",e),this.pubSub.publishAction(i.CHECKOUT_FAILED,{message:e}),s}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:e,giftRecipient:i,billingData:r,marketingPreferences:s,shippingAddressTwo:d,deliveryInstructions:h,deliveryTips:u,paymentMethodId:g,isGift:v}){var b,x,k,E,_,F,D,T,A,O,z,L,R,M,j,N,B,q,U,V,G,H,Y;const W=this.store.get("checkout"),X=null!==(x=null===(b=W.paymentForm)||void 0===b?void 0:b.billingSameAsShipping)&&void 0!==x?x:!![],$=void 0!==v?v:W.isGift,tt=i?!![]:null!==(E=null===(k=W.giftRecipientForm)||void 0===k?void 0:k.isValid)&&void 0!==E?E:![],et=$&&tt,nt={cartId:W.cartId,shippingAddressTwo:d,billingSameAsShipping:X,marketingPreferences:s||W.marketingPreferences,promoCode:(null===(_=W.promoCode)||void 0===_?void 0:_.code)||void 0,isGift:et,giftCards:(null===(F=null==W?void 0:W.giftCards)||void 0===F?void 0:F.map(e=>e.code))||[],deliveryTips:u||Object.values(W.fulfillments||{}).filter(e=>e.type===c.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.amounts.tip}))};g?nt.payment=g:(null===(T=null===(D=W.paymentForm)||void 0===D?void 0:D.paymentMethod)||void 0===T?void 0:T.id)&&(nt.payment=W.paymentForm.paymentMethod.id);const it=h||W.deliveryInstructions;if(it&&(nt.deliveryInstructions=Object.values(W.items||{}).map(e=>({fulfillmentId:e.fulfillmentId,instructions:it}))),nt.customer=e||((null===(O=null===(A=null==W?void 0:W.customerForm)||void 0===A?void 0:A.data)||void 0===O?void 0:O.email)?{firstName:null===(L=null===(z=W.customerForm)||void 0===z?void 0:z.data)||void 0===L?void 0:L.firstName,lastName:null===(M=null===(R=W.customerForm)||void 0===R?void 0:R.data)||void 0===M?void 0:M.lastName,email:null===(N=null===(j=W.customerForm)||void 0===j?void 0:j.data)||void 0===N?void 0:N.email,phone:null===(q=null===(B=W.customerForm)||void 0===B?void 0:B.data)||void 0===q?void 0:q.phone,birthDate:null===(V=null===(U=W.customerForm)||void 0===U?void 0:U.data)||void 0===V?void 0:V.birthDate,company:null===(H=null===(G=W.customerForm)||void 0===G?void 0:G.data)||void 0===H?void 0:H.company}:void 0),et){const e=i||(null===(Y=W.giftRecipientForm)||void 0===Y?void 0:Y.data);e&&(nt.giftOptions=e)}return X||(r?nt.billingAddress={firstName:r.firstName,lastName:r.lastName,email:r.email,phone:r.phone,company:r.company,one:r.one,two:r.two,city:r.city,state:r.state,zip:r.zip}:W.paymentForm.data&&(nt.billingAddress=W.paymentForm.data)),nt}getDetails(){var e,i,r,s;const c=this.store.get("checkout"),d={};for(const h in c.items||{}){const e=c.items[h];d[h]={liquidId:e.liquidId,variantId:e.variantId,cartItemId:h,retailerId:e.retailerId,fulfillmentId:e.fulfillmentId,salsifyPid:e.salsifyPid,salsifyGrouping:e.salsifyGrouping,name:e.name,catPath:e.catPath,volume:e.volume,uom:e.uom,proof:e.proof,abv:e.abv,containerType:e.containerType,container:e.container,size:e.size,pack:e.pack,packDesc:e.packDesc,mainImage:e.mainImage,brand:e.brand,partNumber:e.partNumber,upc:e.upc,sku:e.sku,price:e.price,unitPrice:e.unitPrice,quantity:e.quantity,tax:e.tax,unitTax:e.unitTax,bottleDeposits:e.bottleDeposits,attributes:e.attributes}}return{cartId:c.cartId,isGift:c.isGift||![],billingSameAsShipping:(null===(e=c.paymentForm)||void 0===e?void 0:e.billingSameAsShipping)||!![],marketingPreferences:{canEmail:(null===(i=c.marketingPreferences)||void 0===i?void 0:i.canEmail)||![],canSms:(null===(r=c.marketingPreferences)||void 0===r?void 0:r.canSms)||![]},hasPromoCode:Boolean(null===(s=c.promoCode)||void 0===s?void 0:s.code),hasGiftCards:Array.isArray(c.giftCards)&&c.giftCards.length>0,amounts:c.amounts,itemCount:Object.values(d).reduce((e,i)=>e+(i.quantity||0),0),items:d}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(e,i=![]){this.store.createProductInstance(e),i&&this.store.set("products."+e+".loading",!![])}async loadMultipleProducts(e){var i;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,i)=>(e["products."+i+".loading"]=!![],e["products."+i+".error"]=null,e),{}));const r=await this.api.getProductsData(e,this.getLocation());if(!r||!r.products||0===r.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(e.reduce((e,i)=>(e["products."+i+".loading"]=![],e["products."+i+".error"]=!![],e),{})),void 0;const s=[];for(const d of r.products){const c=Object.values(d.sizes).filter(i=>e.some(e=>e===(i.upc||i.id||d.salsifyGrouping))),h=e.find(e=>c.some(i=>e===i.upc||e===i.id)||e===d.salsifyGrouping),u=h||(null===(i=null==c?void 0:c[0])||void 0===i?void 0:i.upc);await this.loadProduct(u,{products:[d],retailers:r.retailers}),s.push(u)}const c=e.filter(e=>-1===s.indexOf(e));this.store.batch(c.reduce((e,i)=>(e["products."+i+".loading"]=![],e["products."+i+".error"]="Product data not found",e),{}))}async loadProduct(e,r=null){var s,c;try{const d=this.store.get("products."+e);d.loading||this.store.set("products."+e+".loading",!![]);let h=null;if(r&&(h=r),r||(h=await this.api.getProductsData([e],this.getLocation())),!h||!(null===(s=null==h?void 0:h.products)||void 0===s?void 0:s[0]))return this.store.set("products."+e+".error","Product data not found"),void 0;const u=this.loadProductStoreUpdate(h);if(!u)return this.store.set("products."+e+".error","Failed to process product data"),void 0;this.store.set("products."+e,{...u,identifier:e}),this.pubSub.publishAction(i.PRODUCT_LOADED,this.productDataForEventFromStore(e));const g=h.products[0],v=u.sizes[u.selectedSizeId||""],b=Boolean(this.getLocation()),x=u.selectedFulfillment,k=b&&(null==x?void 0:x.variant.price)?x.variant.price:u.noAvailabilityPrice,E=splitCategoryPath(g.catPath);this.googleTagManager.viewItem({item_id:null==v?void 0:v.id,item_name:g.name,item_brand:g.brand,item_size:null==v?void 0:v.size,item_category:E.category,item_category2:E.category2,item_category3:E.category3,price:centToDollar(k),item_type:g.type,item_subtype:g.subType,item_image:(null==v?void 0:v.image)||(null===(c=g.images)||void 0===c?void 0:c[0]),upc:null==v?void 0:v.upc,grouping_id:g.salsifyGrouping,product_id:null==v?void 0:v.id})}catch(d){this.store.set("products."+e+".error",d.message),this.logger.error("Failed to load product data for ID "+e,d)}finally{this.store.set("products."+e+".loading",![])}}async selectSize(e,r){var s,d,h;const u=this.store.get("products."+e),g=u.sizes[r],v=Object.values(g.shippingFulfillments),b=Object.values(g.onDemandFulfillments),x=v.length>0,k=b.length>0,E=x||k;let _=u.selectedFulfillmentType,F=null,D=null;const T=_===c.SHIPPING?x:k;!T&&E&&(_=_===c.SHIPPING?c.ON_DEMAND:c.SHIPPING);const A=_===c.SHIPPING?v:b;A.length>0&&(F=A[0],D=F.id);const O=A.length>0,z=splitCategoryPath(u.catPath);this.googleTagManager.viewItem({item_id:null==g?void 0:g.id,item_name:u.name,item_brand:u.brand,item_size:null==g?void 0:g.size,item_category:z.category,item_category2:z.category2,item_category3:z.category3,price:centToDollar((null==F?void 0:F.variant.price)||u.noAvailabilityPrice),item_type:u.type,item_subtype:u.subType,item_image:(null==g?void 0:g.image)||(null===(s=u.images)||void 0===s?void 0:s[0]),upc:null==g?void 0:g.upc,grouping_id:u.salsifyGrouping,product_id:null==g?void 0:g.id}),E||this.googleTagManager.productSizeNoAvailability({productId:null==g?void 0:g.id,productName:u.name,productBrand:u.brand,productCategory:z.category,productCategory2:z.category2,productCategory3:z.category3,productType:u.type,productSubtype:u.subType,productPrice:u.noAvailabilityPrice,sizeId:r,sizeName:null==g?void 0:g.size,upc:null==g?void 0:g.upc,groupingId:u.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(i.PRODUCT_SIZE_CHANGED,{identifier:e,selectedSizeId:r,selectedSize:(null===(d=u.sizes[r])||void 0===d?void 0:d.size)||"",previousSizeId:u.selectedSizeId||"",previousSize:(null===(h=u.sizes[u.selectedSizeId])||void 0===h?void 0:h.size)||""}),this.store.batch({["products."+e+".selectedSizeId"]:r,["products."+e+".productHasAvailability"]:E,["products."+e+".fulfillmentHasAvailability"]:O,["products."+e+".selectedFulfillmentType"]:_,["products."+e+".selectedFulfillment"]:F,["products."+e+".selectedFulfillmentId"]:D})}async selectFulfillment(e,r){var s;const d=this.store.get("products."+e),h=d.sizes[d.selectedSizeId],u=d.selectedFulfillmentType===c.SHIPPING?h.shippingFulfillments:h.onDemandFulfillments,g=u[r];this.pubSub.publishAction(i.PRODUCT_FULFILLMENT_CHANGED,{identifier:e,selectedFulfillmentId:r,selectedFulfillmentType:d.selectedFulfillmentType,previousFulfillmentId:d.selectedFulfillmentId||"",previousFulfillmentType:d.selectedFulfillmentType});const v=splitCategoryPath(d.catPath);this.googleTagManager.viewItem({item_id:null==h?void 0:h.id,item_name:d.name,item_brand:d.brand,item_size:null==h?void 0:h.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar((null==g?void 0:g.variant.price)||d.noAvailabilityPrice),item_type:d.type,item_subtype:d.subType,item_image:(null==h?void 0:h.image)||(null===(s=d.images)||void 0===s?void 0:s[0]),upc:null==h?void 0:h.upc,grouping_id:d.salsifyGrouping,product_id:null==h?void 0:h.id}),this.store.batch({["products."+e+".selectedFulfillment"]:g,["products."+e+".selectedFulfillmentId"]:r,["products."+e+".quantity"]:1})}async updateQuantity(e,r){var s;const c=this.store.get("products."+e),d=c.quantity,h=d+r,u=1,g=(null===(s=null==c?void 0:c.selectedFulfillment)||void 0===s?void 0:s.variant.stock)||5,v=Math.max(u,Math.min(g,h));this.pubSub.publishAction(r<0?i.PRODUCT_QUANTITY_DECREASE:i.PRODUCT_QUANTITY_INCREASE,{identifier:e,quantity:v,previousQuantity:d}),this.store.set("products."+e+".quantity",v)}async changeFulfillmentType(e,r){var s,d;const h=this.store.get("products."+e),u=h.sizes[h.selectedSizeId],g=r===c.SHIPPING?u.shippingFulfillments:u.onDemandFulfillments,v=Object.values(g);if(0===v.length){const e=splitCategoryPath(h.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==u?void 0:u.id,productName:h.name,productBrand:h.brand,productCategory:e.category,productCategory2:e.category2,productCategory3:e.category3,productType:h.type,productSubtype:h.subType,productPrice:h.noAvailabilityPrice,sizeId:null!==(s=h.selectedSizeId)&&void 0!==s?s:void 0,sizeName:null==u?void 0:u.size,fulfillmentType:r,upc:null==u?void 0:u.upc,groupingId:h.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+r+" fulfillments available for selected size"}),void 0}const b=v[0]||null,x=(null==b?void 0:b.id)||null;this.pubSub.publishAction(i.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:e,selectedFulfillmentType:r,selectedFulfillmentId:x,previousFulfillmentType:h.selectedFulfillmentType,previousFulfillmentId:h.selectedFulfillmentId,fulfillmentHasAvailability:v.length>0});const k=splitCategoryPath(h.catPath);this.googleTagManager.viewItem({item_id:null==u?void 0:u.id,item_name:h.name,item_brand:h.brand,item_size:null==u?void 0:u.size,item_category:k.category,item_category2:k.category2,item_category3:k.category3,price:centToDollar((null==b?void 0:b.variant.price)||h.noAvailabilityPrice),item_type:h.type,item_subtype:h.subType,item_image:(null==u?void 0:u.image)||(null===(d=h.images)||void 0===d?void 0:d[0]),upc:null==u?void 0:u.upc,grouping_id:h.salsifyGrouping,product_id:null==u?void 0:u.id}),this.store.batch({["products."+e+".selectedFulfillmentType"]:r,["products."+e+".selectedFulfillment"]:b,["products."+e+".selectedFulfillmentId"]:x,["products."+e+".fulfillmentHasAvailability"]:v.length>0})}async removeProduct(e){this.store.removeProductInstance(e)}async openProductDrawer(e,i,r){const s={type:i,data:r||{}};this.store.batch({["products."+e+".drawer.isOpen"]:!![],["products."+e+".drawer.contentConfig"]:s})}async closeProductDrawer(e){this.store.set("products."+e+".drawer.isOpen",![])}async rerenderAllProducts(){const e=this.store.getProductInstances(),i=Object.keys(e);for(const r of i)this.store.set("products."+r+".rerender",!![])}async addToCart(e,i){try{this.store.set("products."+e+".updating",!![]),this.uiCommands.openDrawer(s.CART),await this.cartCommands.addItem(i),this.store.batch({["products."+e+".quantity"]:1,["products."+e+".updating"]:![]});const r=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(r.items||{}).map(e=>{const i=splitCategoryPath(e.catPath);return{item_id:e.liquidId,item_name:e.name,item_brand:e.brand,item_size:e.size,item_category:i.category,item_category2:i.category2,item_category3:i.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(r){this.logger.error("Error adding to cart",r),this.store.set("products."+e+".updating",![])}}async addPresaleToCart(e,i){try{this.store.set("products."+e+".updating",!![]),await this.checkoutCommands.addPresaleItem(i),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(s.CHECKOUT),this.store.batch({["products."+e+".quantity"]:1,["products."+e+".updating"]:![]})}catch(r){this.logger.error("Error adding presale item to checkout",r),this.store.set("products."+e+".updating",![])}}productDataForEventFromStore(e){const i=this.store.get("products."+e);if(!i)throw new Error('Product store not found for identifier "'+e+'"');const fulfillmentEventData=e=>e?Object.entries(e).reduce((e,[i,r])=>(e[i]={...r},e),{}):{},r=Object.entries(i.sizes||{}).reduce((e,[i,r])=>{const{loading:s,error:c,shippingFulfillments:d,onDemandFulfillments:h,...u}=r;return e[i]={...u,shippingFulfillments:fulfillmentEventData(d),onDemandFulfillments:fulfillmentEventData(h)},e},{});return{identifier:e,selectedSizeId:i.selectedSizeId||null,selectedFulfillmentType:i.selectedFulfillmentType,selectedFulfillmentId:i.selectedFulfillmentId||null,productHasAvailability:Boolean(i.productHasAvailability),fulfillmentHasAvailability:Boolean(i.fulfillmentHasAvailability),id:i.id,name:i.name,brand:i.brand,catPath:i.catPath,category:i.category,classification:i.classification,type:i.type,subType:i.subType,salsifyGrouping:i.salsifyGrouping,description:i.description,htmlDescription:i.htmlDescription,tastingNotes:i.tastingNotes,images:i.images||[],region:i.region,country:i.country,material:i.material,abv:i.abv,proof:i.proof,age:i.age,color:i.color,flavor:i.flavor,variety:i.variety,appellation:i.appellation,vintage:i.vintage,noAvailabilityPrice:i.noAvailabilityPrice,sizes:r}}findFirstAvailableSize(e){const i=Object.values(e);for(const r of i){const e=r.shippingFulfillments||{},i=r.onDemandFulfillments||{},s=Object.values(e).length,c=Object.values(i).length;if(s+c>0)return r.id}return null}loadProductStoreUpdate({products:[e,...i],retailers:r}){var s,d,h,u,g;try{const i=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:i.layout.enableShippingFulfillment?c.SHIPPING:c.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:s,onDemandVariants:c,...d}of Object.values(e.sizes)){v.sizes[d.id]={...d,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};for(const e of Object.values(s)){const i=r[e.retailerId];(null==i?void 0:i.shippingFulfillment)&&(v.sizes[d.id].shippingFulfillments[i.shippingFulfillment.id]={...i.shippingFulfillment,retailerName:i.name,retailerAddress:i.address,retailerAddressFormatted:i.addressFormatted,variant:e})}for(const e of Object.values(c)){const i=r[e.retailerId];(null==i?void 0:i.onDemandFulfillment)&&(v.sizes[d.id].onDemandFulfillments[i.onDemandFulfillment.id]={...i.onDemandFulfillment,retailerName:i.name,retailerAddress:i.address,retailerAddressFormatted:i.addressFormatted,variant:e})}}const b=Object.values(v.sizes),x=this.findFirstAvailableSize(v.sizes);v.selectedSizeId=x||(null===(s=b[0])||void 0===s?void 0:s.id)||"";const k=(null===(d=v.sizes[v.selectedSizeId])||void 0===d?void 0:d.shippingFulfillments)||{},E=(null===(h=v.sizes[v.selectedSizeId])||void 0===h?void 0:h.onDemandFulfillments)||{};v.productHasAvailability=Object.values(k).length+Object.values(E).length>0;const _=v.selectedFulfillmentType===c.SHIPPING?Object.values(k):Object.values(E);if(v.fulfillmentHasAvailability=_.length>0,v.selectedFulfillment=_[0]||null,v.selectedFulfillmentId=(null===(u=v.selectedFulfillment)||void 0===u?void 0:u.id)||null,!v.fulfillmentHasAvailability){const e=v.selectedFulfillmentType===c.SHIPPING?c.ON_DEMAND:c.SHIPPING,i=e===c.SHIPPING?Object.values(k):Object.values(E);i.length>0&&(v.selectedFulfillmentType=e,v.selectedFulfillment=i[0],v.selectedFulfillmentId=(null===(g=v.selectedFulfillment)||void 0===g?void 0:g.id)||null,v.fulfillmentHasAvailability=!![])}if(!v.productHasAvailability){const i=splitCategoryPath(e.catPath),r=v.sizes[v.selectedSizeId];this.googleTagManager.productNoAvailability({productId:null==r?void 0:r.id,productName:e.name,productBrand:e.brand,productCategory:i.category,productCategory2:i.category2,productCategory3:i.category3,productType:e.type,productSubtype:e.subType,productPrice:e.noAvailabilityPrice,upc:null==r?void 0:r.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 i=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(i)),await this.cartCommands.resetCart(),await this.store.persist()}catch(r){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==r?void 0:r.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(i.ADDRESS_FAILED,{googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:e.address,coordinates:e.coordinates,error:(null==r?void 0:r.message)||"Failed to update downstream state after address change"}),r}this.googleTagManager.addressUpdated({googlePlacesId:e.id,formattedAddress:e.formattedAddress,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country},coordinates:e.coordinates}),this.pubSub.publishAction(i.ADDRESS_UPDATED,{googlePlacesId:e.id,address:{one:e.address.one,two:e.address.two,city:e.address.city,state:e.address.state,zip:e.address.zip,country:e.address.country},coordinates:e.coordinates,formattedAddress:e.formattedAddress})}async setAddressManually(e,r){try{const i=this.buildFormattedAddressString(e),s={id:"",formattedAddress:i,address:e,coordinates:r};await this.setSelectedAddress(s)}catch(s){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==s?void 0:s.message)||"Failed to set manual address"}),this.pubSub.publishAction(i.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(e),address:e,coordinates:r,error:(null==s?void 0:s.message)||"Failed to set manual address"}),s}}async clearSelectedAddress(){this.store.set("address",E),this.pubSub.publishAction(i.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 i,r,s,c,d,h;const u=[],g=[];(null===(i=e.one)||void 0===i?void 0:i.trim())&&g.push(e.one.trim()),(null===(r=e.two)||void 0===r?void 0:r.trim())&&g.push(e.two.trim()),g.length>0&&u.push(g.join(" ")),(null===(s=e.city)||void 0===s?void 0:s.trim())&&u.push(e.city.trim());const v=[];return(null===(c=e.state)||void 0===c?void 0:c.trim())&&v.push(e.state.trim()),(null===(d=e.zip)||void 0===d?void 0:d.trim())&&v.push(e.zip.trim()),v.length>0&&u.push(v.join(" ")),(null===(h=e.country)||void 0===h?void 0:h.trim())&&u.push(e.country.trim()),u.join(", ")}}const bt={BRANDS:"brands",FLAVOR:"flavor",FULFILLMENT:"fulfillment",REGION:"region",VARIETY:"variety",ENGRAVING:"engraving",PRICE:"price",PRESALE:"presale",CATEGORIES:"categories",SIZES:"sizes",APPELLATION:"appellation",COUNTRY:"country",VINTAGE:"vintage",MATERIALS:"materials"},xt={ALL:"all",SHIPPING:"shipping",ON_DEMAND:"onDemand"},wt={MIN:"0",MAX:"1000"},kt={YES:"YES",NO:"NO"},Ct={IDLE:"idle",LOADING_INITIAL:"loading_initial",LOADING_MORE:"loading_more",ERROR:"error"};class ProductListCommands extends BaseCommand{constructor(){super(),this.FILTER_TYPE_MAP={[bt.BRANDS]:b.BRANDS,[bt.CATEGORIES]:b.CATEGORIES,[bt.FLAVOR]:b.FLAVOR,[bt.REGION]:b.REGION,[bt.VARIETY]:b.VARIETY,[bt.VINTAGE]:b.VINTAGE,[bt.COUNTRY]:b.COUNTRY,[bt.APPELLATION]:b.APPELLATION,[bt.MATERIALS]:b.MATERIALS,[bt.SIZES]:b.SIZES,[bt.PRESALE]:b.PRESALE,[bt.ENGRAVING]:b.ENGRAVING,[bt.FULFILLMENT]:b.FULFILLMENT},this.listeners=new Set,this.selectFulfillmentType=async(e,i)=>{var r;const s=this.getStoreState(),d=s.products.find(i=>(i.salsifyGrouping||i.id)===e),h=s.userProducts[e].selectedSizeId,u=d?Object.values(d.sizes).find(e=>e.id===h):void 0;if(!u)return;const g=i===c.SHIPPING?Object.values(u.shippingFulfillments):Object.values(u.onDemandFulfillments),v=g[0];if(!v)return;const b=v.variant,x=s.retailers,k=x[b.retailerId];if(!k)return;const E=i===c.SHIPPING?k.shippingFulfillment:k.onDemandFulfillment,_={...s.userProducts,[e]:{...s.userProducts[e],selectedFulfillmentType:i,selectedFulfillment:E?{...E,id:null!==(r=E.id)&&void 0!==r?r:"",retailerName:k.name,retailerAddress:k.address,retailerAddressFormatted:k.addressFormatted,variant:b,image:u.image}:null}};this.store.set("productsList.userProducts",_),this.notifyListeners()},this.selectFulfillment=async(e,i)=>{var r,s;const d=this.getStoreState(),h=d.products.find(i=>(i.salsifyGrouping||i.id)===e),u=d.userProducts[e].selectedSizeId,g=h?Object.values(h.sizes).find(e=>e.id===u):void 0;if(!g)return;const v=Object.values(g.shippingFulfillments||{}).find(e=>e.id===i),b=Object.values(g.onDemandFulfillments||{}).find(e=>e.id===i),x=v||b;if(!x)return;const k=v?c.SHIPPING:c.ON_DEMAND,E=null===(r=x.variant)||void 0===r?void 0:r.retailerId,_=E?d.retailers[E]:void 0;if(!_)return;const F=k===c.SHIPPING?_.shippingFulfillment:_.onDemandFulfillment,D={...d.userProducts,[e]:{...d.userProducts[e],selectedFulfillmentType:k,selectedFulfillment:F?{...F,id:null!==(s=F.id)&&void 0!==s?s:"",retailerName:_.name,retailerAddress:_.address,retailerAddressFormatted:_.addressFormatted,variant:x.variant,image:g.image}:null}};this.store.set("productsList.userProducts",D),this.notifyListeners()},this.selectSize=async(e,i)=>{var r;const s=this.getStoreState(),c=s.products.find(i=>(i.salsifyGrouping||i.id)===e);if(!c)return;const d=Object.values(c.sizes).find(e=>e.id===i);if(!d)return;const{fulfillment:h,fulfillmentType:u}=this.getFulfillmentForSize(d,s.userProducts[e].selectedFulfillmentType),g={...s.userProducts,[e]:{...s.userProducts[e],selectedSizeId:i,...u?{selectedFulfillmentType:u}:{},...h?{selectedFulfillment:h?{...h,image:null!==(r=h.image)&&void 0!==r?r:null}:null}:{}}};this.store.set("productsList.userProducts",g),this.notifyListeners()},this.updateQuantity=(e,i)=>{const r=this.getStoreState(),s={...r.userProducts,[e]:{...r.userProducts[e],selectedQuantity:i}};this.store.set("productsList.userProducts",s),this.notifyListeners()},this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}subscribe(e){this.listeners.add(e);const i=this.getStoreState();try{e(i)}catch(r){this.logger.error("Error in initial state listener call:",r)}return()=>{this.listeners.delete(e)}}getStoreState(){return this.store.get("productsList")}updateSearchTerm(e){this.store.set("productsList.searchTerm",e),this.notifyListeners()}setLoading(e){this.store.set("productsList.loading",e),this.notifyListeners()}notifyListeners(){const e=this.getStoreState();this.listeners.forEach(i=>{try{i(e)}catch(r){this.logger.error("Error in state listener:",r)}})}initializeProductFulfillment(e){const i=Object.values(e.sizes)[0];if(!i)return{sizeId:"",fulfillmentType:null,fulfillment:null};const r=i.id,s=Object.values(i.shippingFulfillments)[0];if(s)return{sizeId:r,fulfillmentType:"shipping",fulfillment:{...s,image:Object.values(e.sizes)[0].image}};const c=Object.values(i.onDemandFulfillments)[0];return c?{sizeId:r,fulfillmentType:"onDemand",fulfillment:{...c,image:e.sizes[0].image}}:{sizeId:r,fulfillmentType:null,fulfillment:null}}transformProductVariantsToFulfillments(e,i){return e.map(e=>this.transformSingleProduct(e,i))}transformSingleProduct(e,i){const r={...e,sizes:{}};if(!e.sizes||0===Object.values(e.sizes).length)return r;for(const[s,c]of Object.entries(e.sizes))r.sizes[s]=this.transformProductSize(c,i);return r}transformProductSize(e,i){const{shippingVariants:r,onDemandVariants:s,...c}=e,d={...c,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};return this.addShippingFulfillments(d,r,i),this.addOnDemandFulfillments(d,s,i),d}addShippingFulfillments(e,i,r){if(i)for(const s of Object.values(i)){const i=r[s.retailerId];(null==i?void 0:i.shippingFulfillment)&&(e.shippingFulfillments[i.shippingFulfillment.id]={...i.shippingFulfillment,retailerName:i.name,retailerAddress:i.address,retailerAddressFormatted:i.addressFormatted,variant:s})}}addOnDemandFulfillments(e,i,r){if(i)for(const s of Object.values(i)){const i=r[s.retailerId];(null==i?void 0:i.onDemandFulfillment)&&(e.onDemandFulfillments[i.onDemandFulfillment.id]={...i.onDemandFulfillment,retailerName:i.name,retailerAddress:i.address,retailerAddressFormatted:i.addressFormatted,variant:s})}}async loadInitialProducts(e,i,r,s,c){try{this.setLoading(!![]);const d=this.buildSearchParams(e,i,r,s,c),h=await this.getProductList(d),u=this.transformProductVariantsToFulfillments(h.products||[],h.retailers||{}),g={};u&&u.length>0&&u.forEach(e=>{var i;const r=e.salsifyGrouping||e.id||"",s=this.initializeProductFulfillment(e);g[r]={selectedSizeId:s.sizeId,selectedQuantity:1,selectedFulfillmentType:s.fulfillmentType||"shipping",selectedFulfillment:s.fulfillment?{...s.fulfillment,image:null!==(i=s.fulfillment.image)&&void 0!==i?i:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":u,"productsList.retailers":h.retailers,"productsList.filters":h.navigation.filters,"productsList.pagination":this.updatePagination(h.navigation),"productsList.loading":![],"productsList.userProducts":g}),this.notifyListeners()}catch(d){throw this.logger.error("Error loading initial products:",d),this.store.batch({"productsList.products":[],"productsList.retailers":{},"productsList.filters":[],"productsList.pagination":{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]},"productsList.loading":![],"productsList.userProducts":{}}),this.notifyListeners(),d}}async loadMoreProducts(e,i,r,s){try{const c=this.getStoreState(),d=c.pagination;if(!d.hasMorePages)return;this.setLoading(!![]);const h=d.currentPage+1,u=this.buildSearchParams(h,e,i,r,s),g=await this.getProductList(u);if(g.products&&g.products.length>0){const e=c.products,i=c.retailers,r=c.userProducts,s=this.mergeRetailers(i,g.retailers||{}),d=this.transformProductVariantsToFulfillments(g.products,g.retailers||{}),h={...r};d.forEach(e=>{var i;const r=e.salsifyGrouping||e.id||"",s=this.initializeProductFulfillment(e);h[r]={selectedSizeId:s.sizeId,selectedQuantity:1,selectedFulfillmentType:s.fulfillmentType||"shipping",selectedFulfillment:s.fulfillment?{...s.fulfillment,image:null!==(i=s.fulfillment.image)&&void 0!==i?i:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":[...e,...d],"productsList.retailers":s,"productsList.filters":g.navigation.filters,"productsList.pagination":this.updatePagination(g.navigation),"productsList.loading":![],"productsList.userProducts":h}),this.notifyListeners()}else this.store.batch({"productsList.pagination":{...d,hasMorePages:![]},"productsList.loading":![]}),this.notifyListeners()}catch(c){throw this.logger.error("Error loading more products:",c),this.setLoading(![]),c}}async getProductList(e){e.location=this.getLocation();const i=await this.api.catalogSearch(e);return i.products&&i.products.length>0&&this.trackViewItemList(i.products),i}syncFiltersFromComponent(e){const i={};for(const[r,s]of Object.entries(e))null!=s&&(Array.isArray(s)?i[r]=s:i[r]="object"==typeof s?[JSON.stringify(s)]:[String(s)]);this.store.set("productsList.appliedFilters",i),this.notifyListeners()}getSanitizedFilters(e,i){return i&&0!==i.length?e.filter(e=>{const r=this.FILTER_TYPE_MAP[e.type];return r&&i.includes(r)}):[]}buildSearchParams(e,i,r,s,c){const d={page:e,perPage:i,filters:this.buildFilters(s,c)};return r&&r.trim().length>0&&(d.search=r.trim()),d}buildFilters(e,i){const r=[];return this.addToggleFilters(r,e,i),this.addPriceFilter(r,e,i),this.addDynamicFilters(r,e,i),r}addToggleFilters(e,i,r){this.addEngravingFilter(e,i,r),this.addPresaleFilter(e,i,r),this.addFulfillmentFilter(e,i,r)}getBooleanFilterValue(e){return"boolean"==typeof e?e:Array.isArray(e)&&e.length>0?"true"===e[0]:"string"==typeof e?"true"===e:![]}addEngravingFilter(e,i,r){if(r.includes(b.ENGRAVING)){const r=this.getBooleanFilterValue(i[bt.ENGRAVING]);e.push({key:bt.ENGRAVING,values:[r?kt.YES:kt.NO]})}}addPresaleFilter(e,i,r){if(r.includes(b.PRESALE)){const r=this.getBooleanFilterValue(i[bt.PRESALE]);e.push({key:bt.PRESALE,values:[r?kt.YES:kt.NO]})}}addFulfillmentFilter(e,i,r){if(r.includes(b.FULFILLMENT)){const r=i[bt.FULFILLMENT],s=Array.isArray(r)?r[0]:r||xt.ALL,c=s===xt.ALL?[xt.ON_DEMAND,xt.SHIPPING]:[s];e.push({key:bt.FULFILLMENT,values:c})}}addPriceFilter(e,i,r){var s,c,d,h;r.includes(b.PRICE)&&e.push({key:bt.PRICE,values:{min:null!==(c=null===(s=i.price)||void 0===s?void 0:s.min)&&void 0!==c?c:wt.MIN,max:null!==(h=null===(d=i.price)||void 0===d?void 0:d.max)&&void 0!==h?h:wt.MAX}})}addDynamicFilters(e,i,r){const s=[bt.PRICE,bt.ENGRAVING,bt.PRESALE,bt.FULFILLMENT],c=Object.keys(i).filter(e=>!s.includes(e)),d=new Set;for(const u of c)e.push({key:u,values:i[u]}),d.add(u);const h=this.getFilterKeyToTypeMap();for(const u of r){const i=h[u];!i||d.has(i)||s.includes(i)||e.push({key:i,values:[]})}}setGridConfig(e,i){this.store.set("productsList.gridConfig",{rows:e,columns:i})}getItemsPerPage(){const e=this.getStoreState(),i=e.gridConfig;return i?i.rows*i.columns:16}updatePagination(e){var i,r,s,c,d;return e?{currentPage:null!==(i=e.currentPage)&&void 0!==i?i:0,totalPages:null!==(r=e.totalPages)&&void 0!==r?r:0,totalCount:null!==(s=e.totalCount)&&void 0!==s?s:0,hasMorePages:(null!==(c=e.currentPage)&&void 0!==c?c:0)<(null!==(d=e.totalPages)&&void 0!==d?d:1)-1}:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]}}createInitialPagination(){return{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]}}mergeRetailers(e,i){const r={...e};for(const[s,c]of Object.entries(i))r[s]||(r[s]=c);return r}extractProductCardData(e,i){const r=Object.values(e.sizes)[0];if(!r)return this.logger.warn("Product "+e.id+" has no sizes"),null;const s=Object.values(r.shippingFulfillments),c=Object.values(r.onDemandFulfillments),d=s[0],h=c[0],u=(null==d?void 0:d.variant)||(null==h?void 0:h.variant);if(!u)return this.logger.warn("Product "+e.id+" has no variants"),null;const g=i[u.retailerId];return g?{product:e,retailer:g}:(this.logger.warn("Retailer "+u.retailerId+" not found for product "+e.id),null)}getFilterKeyToTypeMap(){const e={};for(const[i,r]of Object.entries(this.FILTER_TYPE_MAP))e[r]=i;return e}async addToCart(e){try{this.uiCommands.openDrawer(s.CART),await this.cartCommands.addItem(e)}catch(i){throw this.logger.error("Error adding product to cart from product list",i),i}}async addPresaleToCart(e){try{await this.checkoutCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(s.CHECKOUT)}catch(i){throw this.logger.error("Error adding presale product to checkout from product list",i),i}}trackViewItemList(e){if(0!==e.length)try{const i=this.getStoreState(),r=this.transformProductVariantsToFulfillments(e,i.retailers),s=r.map((e,i)=>({...this.convertProductToBaseItem(e),index:i+1}));this.googleTagManager.viewItemList(s,"product_list","Product List")}catch(i){this.logger.error("Error tracking view_item_list event",i)}}trackSelectItem(e){try{const i=this.convertProductToBaseItem(e);this.googleTagManager.selectItem(i,"product_list","Product List")}catch(i){this.logger.error("Error tracking select_item event",i)}}convertProductToBaseItem(e){var i,r;const s=null===(i=e.sizes)||void 0===i?void 0:i[0],c=null==s?void 0:s.shippingFulfillments[Object.keys(s.shippingFulfillments)[0]],d=splitCategoryPath(e.catPath);return{item_id:null==s?void 0:s.id,item_name:e.name,item_brand:e.brand,item_size:null==s?void 0:s.size,item_category:d.category,item_category2:d.category2,item_category3:d.category3,price:(null==c?void 0:c.variant.price)?centToDollar(c.variant.price):e.noAvailabilityPrice?centToDollar(e.noAvailabilityPrice):void 0,item_type:e.type,item_subtype:e.subType,item_image:(null==s?void 0:s.image)||(null===(r=e.images)||void 0===r?void 0:r[0]),upc:null==s?void 0:s.upc,grouping_id:e.salsifyGrouping,product_id:null==s?void 0:s.id,item_list_id:"product_list",item_list_name:"Product List"}}openProductListModal(e,i,r){const s={type:i,data:r};this.store.batch({["productsList.userProducts."+e+".modal.isOpen"]:!![],["productsList.userProducts."+e+".modal.contentConfig"]:s}),this.notifyListeners()}closeProductListModal(e){this.store.batch({["productsList.userProducts."+e+".modal.isOpen"]:![],["productsList.userProducts."+e+".modal.contentConfig"]:null}),this.notifyListeners()}getFulfillmentForSize(e,i){const r=Object.values(e.shippingFulfillments||{}),s=Object.values(e.onDemandFulfillments||{}),d=r[0],h=s[0];return i===c.SHIPPING&&d?{fulfillment:{...d,image:e.image},fulfillmentType:c.SHIPPING}:i===c.ON_DEMAND&&h?{fulfillment:{...h,image:e.image},fulfillmentType:c.ON_DEMAND}:d?{fulfillment:{...d,image:e.image},fulfillmentType:c.SHIPPING}:h?{fulfillment:{...h,image:e.image},fulfillmentType:c.ON_DEMAND}:{fulfillment:null,fulfillmentType:null}}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(e,r=![]){var s,c,d,h,u;const g=this.store.get("cart");for(const i of Object.keys(g.items||{}))this.store.remove("cart.items."+i);for(const i of Object.keys(g.retailers||{}))this.store.remove("cart.retailers."+i);for(const i of Object.keys(g.fulfillments||{}))this.store.remove("cart.fulfillments."+i);const v={"cart.id":e.id,"cart.error":null,"cart.subtotal":e.subtotal,"cart.itemsQuantity":e.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(s=e.promoCode)||void 0===s?void 0:s.code)?{...e.promoCode,error:null}:null};if((null===(c=Object.values(e.items))||void 0===c?void 0:c.length)>0)for(const i of Object.values(e.items))v["cart.items."+i.id]=i;if((null===(d=Object.values(e.retailers))||void 0===d?void 0:d.length)>0)for(const i of Object.values(e.retailers))if(v["cart.retailers."+i.id]=i,(null===(h=Object.values(i.fulfillments))||void 0===h?void 0:h.length)>0)for(const e of Object.values(i.fulfillments))v["cart.fulfillments."+e.id]=e;if((null===(u=e.events)||void 0===u?void 0:u.length)>0&&(v["cart.events"]=e.events),this.store.batch(v),r){const e=this.store.get("cart"),r=this.buildCartLoadedEventData(e);this.pubSub.publishAction(i.CART_LOADED,r)}}buildCartLoadedEventData(e){var i,r;const s=this.store.get("address"),c={};for(const d of Object.keys(e.items||{})){const i=e.items[d];c[d]={id:i.id,variantId:i.variantId,liquidId:i.liquidId,salsifyGrouping:i.salsifyGrouping,retailerId:i.retailerId,partNumber:i.partNumber,fulfillmentId:i.fulfillmentId,upc:i.upc,sku:i.sku,catPath:i.catPath,volume:i.volume,uom:i.uom,pack:i.pack,packDesc:i.packDesc,container:i.container,containerType:i.containerType,name:i.name,brand:i.brand,size:i.size,price:i.price,quantity:i.quantity,maxQuantity:i.maxQuantity,unitPrice:i.unitPrice,mainImage:i.mainImage,attributes:i.attributes}}return{cartId:e.id,promoCodeDiscount:null!==(r=null===(i=e.promoCode)||void 0===i?void 0:i.discount)&&void 0!==r?r:null,subtotal:e.subtotal,itemCount:e.itemsQuantity,items:c,retailers:e.retailers||{},location:(null==s?void 0:s.id)&&s.coordinates&&s.address?{placesId:s.id,formattedAddress:s.formattedAddress,address:s.address,coordinates:s.coordinates}:null}}async loadCart(){try{this.store.set("cart.loading",!![]);const e=this.store.get("cart"),i=await this.api.getCartData(e.id);this.syncCartFromResponse(i,!![]),i.id!==e.id&&await this.store.persist()}catch(e){const r=(null==e?void 0:e.message)||"Failed to load cart";this.store.set("cart.error",r);const s=this.store.get("cart.id");this.pubSub.publishAction(i.CART_FAILED,{cartId:s,message:r}),this.logger.error("Load cart failed",e)}finally{this.store.set("cart.loading",![])}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}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:i}){var r;this.o=Object.freeze(e),this.l=Object.freeze({type:i.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(r=null==i?void 0:i.useShadowDom)&&void 0!==r?r:![]}),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 i=/\{([^}]+)}/g;return e.replace(i,(i,r)=>{const s=this.o[r];return null==s?(this.logger.warn('Parameter "'+r+'" not found in component params for path "'+e+'"'),i):String(s)})}connectedCallback(){var e,i;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.l.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(r){this.logger.error("Component connectedCallback error in "+((null===(i=this.l)||void 0===i?void 0:i.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"connectedCallback")}}disconnectedCallback(){var e,i;try{this.cleanup(),null===(e=this.disconnected)||void 0===e||e.call(this)}catch(r){this.logger.error("Component disconnectedCallback error in "+((null===(i=this.l)||void 0===i?void 0:i.tagName)||"unknown"),r),r instanceof Error&&this.captureComponentError(r,"disconnectedCallback")}}setup(){var e,i,r;try{this.updateHostClasses(),this.updateHostAttributes(),null===(e=this.beforeSetupStoreWatchers)||void 0===e||e.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(i=this.beforeConnected)||void 0===i||i.call(this)}catch(s){this.logger.error("Component setup error in "+((null===(r=this.l)||void 0===r?void 0:r.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const i of this.unsubscribers)try{i()}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 i=this.reactiveOptions.autoDestroyPath;if(!i&&(null===(e=this.reactiveOptions.watchStorePaths)||void 0===e?void 0:e.length)&&(i=this.reactiveOptions.watchStorePaths[0]),!i)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const r=this.interpolatePath(i),s=this.store.watch(r,(e,i)=>{this.isDestroyed||void 0===e&&void 0!==i&&this.handleAutoDestroy(r)});this.unsubscribers.push(s)}handleAutoDestroy(e){var i;if(this.isDestroyed)return;null===(i=this.beforeAutoDestroy)||void 0===i?void 0:i.call(this,e);const r=this.reactiveOptions.autoDestroyDelay||0;r>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},r):this.destroyComponent()}destroyComponent(){var e;if(!this.isDestroyed)try{null===(e=this.onAutoDestroy)||void 0===e?void 0:e.call(this),this.remove()}catch(i){this.logger.error("Error during auto-destroy of "+this.l.tagName,i),i instanceof Error&&this.captureComponentError(i,"auto-destroy")}}setupStoreWatchers(){var e;try{let e=this.reactiveOptions.watchStorePaths;if(!(null==e?void 0:e.length)||!this.o)return;e=this.interpolateStorePaths(e);const i=this.store.watchMany(e,e=>{var i,r;try{if(this.isDestroyed)return;const r=e.map(e=>e.path).join(", "),s="store:["+r+"]",c=null===(i=this.onStoreChanged)||void 0===i?void 0:i.call(this,e);c!==![]&&this.triggerRender(s)}catch(s){this.logger.error("Store watcher callback error in "+((null===(r=this.l)||void 0===r?void 0:r.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"storeWatcher")}});this.unsubscribers.push(i)}catch(i){this.logger.error("Store watchers setup error in "+((null===(e=this.l)||void 0===e?void 0:e.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"setupStoreWatchers")}}setupNonRenderingWatchers(){var e;try{let e=this.reactiveOptions.watchOnlyStorePaths;if(!(null==e?void 0:e.length)||!this.o)return;e=this.interpolateStorePaths(e);const i=this.store.watchMany(e,e=>{var i,r;try{if(this.isDestroyed)return;null===(i=this.onStoreWatch)||void 0===i?void 0:i.call(this,e)}catch(s){this.logger.error("Non-rendering watcher callback error in "+((null===(r=this.l)||void 0===r?void 0:r.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"nonRenderingWatcher")}});this.unsubscribers.push(i)}catch(i){this.logger.error("Non-rendering watchers setup error in "+((null===(e=this.l)||void 0===e?void 0:e.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"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,i;if(!this.initialized||this.isDestroyed)return;const r=performance.now();this.renderCount++;try{const i=this.template();"string"==typeof i&&(this.container.innerHTML=i),i instanceof HTMLElement&&safeReplaceChildren(this.container,i),Array.isArray(i)&&safeReplaceChildren(this.container,...i);const c=performance.now()-r;this.logRenderInfo(c);try{null===(e=this.afterRender)||void 0===e?void 0:e.call(this)}catch(s){this.logger.error("❌ afterRender hook error in "+this.l.tagName,s),s instanceof Error&&this.captureComponentError(s,"afterRender")}}catch(c){const e=performance.now()-r;this.logger.error("❌ Component render error in "+this.l.tagName,c),this.captureComponentError(c,"render",e),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.l.type,message:c instanceof Error?c.message:String(c)}));try{null===(i=this.onError)||void 0===i?void 0:i.call(this,c,"render")}catch(d){this.logger.error("❌ onError hook error in "+this.l.tagName,d)}}}logRenderInfo(e){const i=this.l.type,r=this.l.tagName,s=e>16?"🐌":e>8?"⚡":"🚀";this.logger.debug("Rendered "+s+" "+i+" </"+r+"> | #"+this.renderCount+" | "+e.toFixed(2)+"ms | "+this.lastRenderTrigger),e>16&&(this.logger.warn("⚠️ Slow render in "+i+"("+r+"): "+e.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:e,threshold:16,componentType:i,tagName:r,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+e.toFixed(2)+"ms",{context:"Component:"+r+":performance",component:{type:i,tagName:r,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:e,useShadowDom:this.l.useShadowDom}}))}rerender(e){this.triggerRender(e?"manual:rerender:"+e:"manual:rerender()")}captureComponentError(e,i,r){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",e.message,{context:"Component:"+this.l.tagName+":"+i,component:{type:this.l.type,tagName:this.l.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:r,useShadowDom:this.l.useShadowDom}})}catch(s){}}updateHostClasses(){const e=this.hostClasses;if(e.length>0){const i=e.filter(e=>e&&"string"==typeof e&&e.trim());i.length>0&&this.classList.add(...i)}}addHostClasses(...e){const i=e.filter(e=>e&&"string"==typeof e&&e.trim());i.length>0&&this.classList.add(...i)}removeHostClasses(...e){const i=e.filter(e=>e&&"string"==typeof e&&e.trim());i.length>0&&this.classList.remove(...i)}toggleHostClasses(...e){const i=e.filter(e=>e&&"string"==typeof e&&e.trim());for(const r of i)this.classList.toggle(r)}addHostAttribute(e,i){e&&"string"==typeof e&&i&&"string"==typeof i&&(this.setAttribute(e,String(i)),this.hostAttributes[e]=String(i))}removeHostAttribute(e){e&&"string"==typeof e&&(this.removeAttribute(e),delete this.hostAttributes[e])}updateHostAttributes(){const e=this.hostAttributes;for(const[i,r]of Object.entries(e))i&&"string"==typeof i&&r&&"string"==typeof r&&this.setAttribute(i,String(r))}get params(){return this.o}get config(){return this.themeProvider.getComponentConfig(this.l.type)}get elementConfig(){return this.l}getConfigs(e){return this.themeProvider.getConfigs(e)}getStoreValue(e){return this.store.get(e)}setStoreValue(e,i){return this.store.set(e,i)}watchStore(e,i){const r=this.store.watch(e,i);return this.unsubscribers.push(r),r}}const createAddToCartButton=({isPresale:e,hasAvailability:i,state:r,disabled:s=![],borderRadius:c,hasAddress:d,onClick:h})=>{const u=document.createElement("button");return u.type="button",u.className="plc__button "+c,u.disabled=d&&(s||!i),u.textContent=e?"Pre Order":d?i?"Add to Cart":"Not Available In "+r.toUpperCase():"Buy Now",h&&u.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),await h(e)}),u},createFulfillmentSection=e=>{const{shippingVariants:i,onDemandVariants:r,enableShippingFulfillment:s,enableOnDemandFulfillment:d,selectedFulfillmentType:h,selectedFulfillmentRetailerName:u,productId:g,onDeliveryOptionsClick:v}=e,b=document.createElement("div");b.className="plc__fulfillment-wrapper";const x=document.createElement("span");x.className="plc__fulfillment-text",x.textContent=h===c.SHIPPING?"Ships from: "+(u||""):"Delivered from: "+(u||""),b.appendChild(x);const k=Object.values(i),E=Object.values(r),_=(s?k.length:0)+(d?E.length:0),F=document.createElement("button");return F.className="plc__fulfillment-delivery",F.textContent="Delivery Options ("+_+")",F.addEventListener("click",async e=>{e.preventDefault(),e.stopPropagation(),0!==_&&await v(g)}),b.appendChild(F),b},createQuantitySelector=({initialQuantity:e,minQuantity:i,maxQuantity:r,cornerRadius:s,cardStyle:c,onChange:d})=>{let h=e;const u=document.createElement("div");u.className="plc__quantity-container";const g=document.createElement("button");g.type="button",g.className="quantity-decrease "+s+" "+c,g.textContent="-",g.setAttribute("aria-label","Decrease quantity");const v=document.createElement("span");v.className="quantity-text "+c,v.textContent=h.toString(),v.setAttribute("aria-live","polite"),v.setAttribute("aria-atomic","true");const b=document.createElement("button");b.type="button",b.className="quantity-increase "+s+" "+c,b.textContent="+",b.setAttribute("aria-label","Increase quantity");const J=e=>{const s=e>i,c=e<r;s?(g.disabled=![],g.classList.remove("disabled")):(g.disabled=!![],g.classList.add("disabled")),c?(b.disabled=![],b.classList.remove("disabled")):(b.disabled=!![],b.classList.add("disabled"))},o=e=>{h=Math.max(i,Math.min(r,e)),v.textContent=h.toString(),J(h),null==d||d(h)},t=e=>{e.preventDefault(),e.stopPropagation(),h>i&&o(h-1)},y=e=>{e.preventDefault(),e.stopPropagation(),h<r&&o(h+1)};return g.addEventListener("click",t),b.addEventListener("click",y),J(h),u.appendChild(g),u.appendChild(v),u.appendChild(b),u},ArrowRightIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="arrow-right-icon '+r+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:e=24,height:i=24,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 489 489" class="bag-icon '+r+'" style="'+c+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckIcon=({width:e=12,height:i=12,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="'+r+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M11.8047 0.195262C12.0651 0.455612 12.0651 0.877722 11.8047 1.13807L4.4714 8.4714C4.21106 8.73175 3.78894 8.73175 3.5286 8.4714L0.195262 5.13807C-0.0650874 4.87772 -0.0650874 4.45561 0.195262 4.19526C0.455612 3.93491 0.877722 3.93491 1.13807 4.19526L4 7.05719L10.8619 0.195262C11.1223 -0.0650874 11.5444 -0.0650874 11.8047 0.195262Z" fill="#18181B"/>\n </svg>\n '},CheckboxIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="checkbox-icon '+r+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="'+r+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="chevron-left-icon '+r+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},ChevronUpIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="'+r+'" style="'+c+'" 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:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="close-icon '+r+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="error-info-icon '+r+'" style="'+c+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="info-icon '+r+'" style="'+c+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="search-icon '+r+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+c+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="success-icon '+r+'" style="'+c+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="trash-icon '+r+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 16 16" class="warning-icon '+r+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '},createProductSizesList=({sizes:e,selectedSize:i,cornerRadius:r,onSelect:s})=>{let c=i;const d=document.createElement("div");d.className="plc__dropdown-size-wrapper "+r;const h=document.createElement("button");h.type="button",h.className="plc__dropdown-default-size-wrapper";const u=document.createElement("span");u.className="plc__dropdown-size-text",u.textContent=c.size;const g=document.createElement("span");g.className="plc__dropdown-chevron",g.innerHTML=ChevronDownIcon({className:"chevron-down-icon"}),g.style.display="none";const v=document.createElement("span");v.className="plc__dropdown-check",v.innerHTML=CheckIcon({className:"check-icon"}),h.appendChild(u),h.appendChild(g),h.appendChild(v),d.appendChild(h);const b=Object.values(e);if(b.length<=1)return h.setAttribute("aria-haspopup","false"),h.setAttribute("aria-expanded","false"),h.disabled=!![],g.style.display="none",v.style.display="flex",d;h.setAttribute("aria-haspopup","listbox"),h.setAttribute("aria-expanded","false");const x=document.createElement("div");x.className="plc__sizes-list "+r,x.setAttribute("role","listbox");const S=()=>{d.classList.remove("expanded"),h.setAttribute("aria-expanded","false"),g.style.display="none",v.style.display="flex"},openDropdown=()=>{d.classList.add("expanded"),h.setAttribute("aria-expanded","true"),g.style.display="flex",v.style.display="none"},J=()=>d.classList.contains("expanded"),o=()=>{x.innerHTML="",b.forEach(e=>{const i=document.createElement("div");i.className="plc__size-option",i.setAttribute("role","option");const r=(null==c?void 0:c.id)===e.id;i.setAttribute("aria-selected",String(r));const d=document.createElement("span");if(d.className="plc__size-option-text",d.textContent=e.size,i.appendChild(d),r){const e=document.createElement("span");e.className="plc__size-option-check",e.innerHTML=CheckIcon({width:16,height:16,className:"check-icon"}),i.appendChild(e)}i.addEventListener("click",i=>{i.stopPropagation(),c=e,u.textContent=e.size,null==s||s(e),o(),S()}),x.appendChild(i)})};o(),d.appendChild(x),h.addEventListener("click",e=>{e.stopPropagation(),J()?S():openDropdown()});const t=e=>{const i=e.target;i&&(d.contains(i)||S())};return document.addEventListener("click",t),d};class ProductListCardComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address","address.formattedAddress","productsList.userProducts"]}),this.selectedSize=null,this.DESKTOP_BREAKPOINT=1024}get hostClasses(){return["product-list-card",this.config.layout.productCard.cornerRadius,""+this.config.layout.productCard.style]}async connected(){var e;null===(e=super.connected)||void 0===e?void 0:e.call(this);const i=this.params.product.salsifyGrouping||this.params.product.id||"";this.unsubscribeFromState=this.commands.productList.subscribe(e=>{var r,s;const c=e.userProducts[i];if(!c)return;const d=c.selectedFulfillment,h=c.selectedFulfillmentType;if(c){const e=Object.values(this.params.product.sizes).find(e=>e.id===c.selectedSizeId);e&&(null===(r=this.selectedSize)||void 0===r?void 0:r.id)!==e.id&&(this.selectedSize=e)}(d||h)&&this.reRender(),(null===(s=c.modal)||void 0===s?void 0:s.isOpen)&&this.reRender()})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=void 0)}reRender(){const e=this.template();this.innerHTML="";const i=document.createDocumentFragment();for(const r of e)i.appendChild(r);this.appendChild(i)}getAvailabilityData(e){var i;const r=this.params.product,s=this.getStoreValue("address.address"),c={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==s?void 0:s.state)||"",isPresale:![],isPresaleActive:![]},d=e||Object.values(r.sizes)[0];if(!d)return c;const h=Object.values(d.shippingFulfillments||{}),u=h[0],g=null==u?void 0:u.variant;if(!g)return c;c.upc=d.upc;const v=d.attributes||{};return c.isPresale=(null===(i=v.presale)||void 0===i?void 0:i.isActive)===!![],c.isPresaleActive=this.isPresaleActive(v),this.params.shippingFulfillment&&g.shippingFulfillmentId===this.params.shippingFulfillment.id&&g.stock>0?(c.hasAvailability=!![],c.fulfillmentId=this.params.shippingFulfillment.id,c.partNumber=g.partNumber):this.params.onDemandFulfillment&&g.onDemandFulfillmentId===this.params.onDemandFulfillment.id&&g.stock>0&&(c.hasAvailability=!![],c.fulfillmentId=this.params.onDemandFulfillment.id,c.partNumber=g.partNumber),c}isPresaleActive(e){const i=null==e?void 0:e.presale;if(!i||!i.isActive)return![];if(i.canPurchaseOn){const e=new Date(i.canPurchaseOn),r=new Date;if(r.getTime()<e.getTime())return![]}return!![]}async handleAddToCart(e){var i,r,s;if(!e.hasAvailability)return;const c=this.params.product.salsifyGrouping||this.params.product.id||"",d=this.getStoreValue("productsList"),h=null===(i=d.userProducts[c])||void 0===i?void 0:i.selectedFulfillment,u=(null===(r=d.userProducts[c])||void 0===r?void 0:r.selectedQuantity)||1,g=(null==h?void 0:h.id)||e.fulfillmentId,v=(null===(s=null==h?void 0:h.variant)||void 0===s?void 0:s.partNumber)||e.partNumber;e.isPresale&&e.isPresaleActive?await this.commands.productList.addPresaleToCart({fulfillmentId:g,partNumber:v,quantity:u,identifier:c}):await this.commands.productList.addToCart({fulfillmentId:g,partNumber:v,quantity:u,identifier:c}),this.commands.productList.updateQuantity(c,1)}template(){var e,i,r,s,c,d,h,u,g;const v=this.params.product,b=this.params.product.salsifyGrouping||this.params.product.id||"",x=this.getStoreValue("productsList"),k=null===(e=x.userProducts[b])||void 0===e?void 0:e.selectedSizeId,E=k?Object.values(v.sizes).find(e=>e.id===k):this.selectedSize||Object.values(v.sizes)[0];this.selectedSize=E||Object.values(v.sizes)[0];const _=null===(i=x.userProducts[b])||void 0===i?void 0:i.selectedFulfillment,F=(null===(r=x.userProducts[b])||void 0===r?void 0:r.selectedQuantity)||1,D=(null==_?void 0:_.image)||(null===(s=this.selectedSize)||void 0===s?void 0:s.image),T=v.name,A=this.selectedSize?this.selectedSize.size:null;let O=v.noAvailabilityPrice;if(null===(c=null==_?void 0:_.variant)||void 0===c?void 0:c.price)O=_.variant.price;else{const e=Object.values((null===(d=this.selectedSize)||void 0===d?void 0:d.shippingFulfillments)||{});O=null!==(u=null===(h=e[0])||void 0===h?void 0:h.variant.price)&&void 0!==u?u:v.noAvailabilityPrice}const z=O*F,L=this.getAvailabilityData(this.selectedSize),R=(null==_?void 0:_.variant.isEngravable)||![],M=v.sizes,j=null===(g=this.selectedSize)||void 0===g?void 0:g.maxQuantityPerOrder,N=this.createVariantStandard({image:D,name:T,size:A,price:z,availability:L,hasPersonalization:R,sizes:M,maxQuantityPerOrder:j,shippingVariants:{},onDemandVariants:{}});return N}generateProductUrl(){if(!this.params.productUrl)return null;const e=this.params.product,i=this.selectedSize||Object.values(e.sizes)[0],r=this.params.productUrl;if(r.includes("{upc}")){const e=(null==i?void 0:i.upc)||"";return e?r.replace("{upc}",e):null}if(r.includes("{grouping}")){const i=e.salsifyGrouping||"";return i?r.replace("{grouping}",i):null}return r}createVariantStandard(e){const{image:i,name:r,price:s,availability:c,hasPersonalization:d,sizes:h,maxQuantityPerOrder:u}=e,g=this.params.product.salsifyGrouping||this.params.product.id||"",v=this.generateProductUrl();return[this.createImageSection(i,r,c,v),this.createContentSection({name:r,price:s,hasPersonalization:d,sizes:h,maxQuantityPerOrder:u,availability:c,productId:g,productUrl:v})]}createImageSection(e,i,r,s){const c=document.createElement("div");c.className="plc__image-content";const d=document.createElement("div");d.className="plc__image-wrapper";const h=document.createElement("img");if(h.className="plc__image",h.src=e,h.alt=i,h.loading="lazy",d.appendChild(h),r.isPresale){const e=document.createElement("div");e.className="plc__presale-badge "+this.config.layout.productCard.cornerRadius,e.textContent="Pre-Order",d.appendChild(e)}if(c.appendChild(d),s){const e=document.createElement("a");return e.href=s,e.className="plc__image-link",e.target="_blank",e.rel="noopener noreferrer",e.addEventListener("click",()=>this.commands.productList.trackSelectItem(this.params.product)),e.appendChild(c),e}return c}createContentSection(e){const i=this.getStoreValue("address.formattedAddress"),r=!!(i&&i.trim().length>0),s=document.createElement("div");s.className="plc__content",this.config.layout.productCard.showCollections&&r&&s.appendChild(this.createBadgesSection()),s.appendChild(this.createTitleSection(e.name,e.productUrl));const c=this.createPricePersonalizationSection(e.price,e.hasPersonalization,r);return c&&s.appendChild(c),this.config.layout.productCard.showSizeSelector&&r&&s.appendChild(this.createSizesSection(e.sizes)),this.config.layout.productCard.showFulfillment&&r&&s.appendChild(this.createFulfillmentSectionWrapper(e.productId)),s.appendChild(this.createAddToCartSection(e.availability,e.maxQuantityPerOrder,r)),s}createBadgesSection(){const e=document.createElement("div");e.className="plc__badges-wrapper";const i=document.createElement("span");i.className="plc__badge-text",i.textContent="First Bottle Free",e.appendChild(i);const r=document.createElement("span");r.textContent="•",e.appendChild(r);const s=document.createElement("span");return s.className="plc__badge-text",s.textContent="Same-Day Delivery",e.appendChild(s),e}createTitleSection(e,i){const r=document.createElement("h3");if(r.className="plc__title",r.textContent=e,i){const e=document.createElement("a");return e.href=i,e.className="plc__title-link",e.target="_blank",e.rel="noopener noreferrer",e.addEventListener("click",()=>this.commands.productList.trackSelectItem(this.params.product)),e.appendChild(r),e}return r}createPricePersonalizationSection(e,i,r){const s=this.config.layout.productCard.showPrice,c=this.config.layout.productCard.enablePersonalization&&i;if(!s&&!c)return null;const d=document.createElement("div");if(d.className="plc__price-personalization-wrapper",s){const i=document.createElement("span");i.className="plc__price",i.textContent=formatCentToDollarText(e),d.appendChild(i)}if(c&&r){const e=document.createElement("span");e.className="plc__personalize",e.textContent="Personalize Bottle",d.appendChild(e)}return d}createSizesSection(e){return createProductSizesList({sizes:e,selectedSize:this.selectedSize||Object.values(e)[0],cornerRadius:this.config.layout.productCard.cornerRadius,onSelect:e=>{this.selectedSize=e;const i=this.params.product.salsifyGrouping||this.params.product.id||"";this.commands.productList.selectSize(i,e.id),this.reRender()}})}handleDeliveryOptionsClick(e){const i=window.innerWidth;i>=this.DESKTOP_BREAKPOINT?this.commands.ui.openModal(s.PRODUCT_LIST_RETAILERS,{productId:e,config:this.config}):this.commands.ui.openDrawer(s.PRODUCT_LIST_RETAILERS,{productId:e,config:this.config})}createFulfillmentSectionWrapper(e){var i,r;const s=this.getStoreValue("productsList"),c=this.params.product,d=this.selectedSize||Object.values(c.sizes)[0];return createFulfillmentSection({shippingVariants:(null==d?void 0:d.shippingFulfillments)||{},onDemandVariants:(null==d?void 0:d.onDemandFulfillments)||{},enableShippingFulfillment:this.config.layout.productCard.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.productCard.enableOnDemandFulfillment,selectedFulfillmentType:s.userProducts[e].selectedFulfillmentType,selectedFulfillmentRetailerName:(null===(r=null===(i=s.userProducts[e])||void 0===i?void 0:i.selectedFulfillment)||void 0===r?void 0:r.retailerName)||"",productId:e,onDeliveryOptionsClick:e=>this.handleDeliveryOptionsClick(e)})}createAddToCartSection(e,i,r){var c;const d=this.getStoreValue("productsList"),h=document.createElement("div");h.className="plc__add-to-cart-wrapper";const u=this.params.product.salsifyGrouping||this.params.product.id||"",g=(null===(c=d.userProducts[u])||void 0===c?void 0:c.selectedQuantity)||1;this.config.layout.productCard.showQuantityCounter&&r&&h.appendChild(createQuantitySelector({initialQuantity:g,minQuantity:1,maxQuantity:i,cornerRadius:this.config.layout.productCard.cornerRadius,cardStyle:this.config.layout.productCard.style,onChange:e=>this.commands.productList.updateQuantity(u,e)}));const v=createAddToCartButton({isPresale:e.isPresale,hasAvailability:e.hasAvailability,state:e.state,borderRadius:this.config.layout.productCard.cornerRadius,hasAddress:r,onClick:async()=>{r?await this.handleAddToCart(e):this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:u,isIndependentComponent:!![]})}});return e.hasAvailability||this.addHostClasses("not-available"),h.appendChild(v),h}}class ModalComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.modal"]}),this.isOpen=![],this.modalElement=null,this.contentContainer=null,this.currentContentType=null,this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.modalElement&&(this.modalElement.removeEventListener("cancel",this.handleCancel.bind(this)),this.modalElement.removeEventListener("click",this.handleBackdropClick.bind(this))),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(e){var i;const r=e.find(e=>"ui.modal"===e.path);if(!r)return![];const s=r.value,c=s.isOpen,d=null===(i=s.contentConfig)||void 0===i?void 0:i.type,h=d!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=d,this.openWithContent(s),![]):c&&this.isOpen&&!h?![]:c&&this.isOpen&&h?(this.currentContentType=d,this.openWithContent(s),![]):!c&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:e}){try{if(!e)return this.logger.warn("Modal opening attempted without content configuration"),void 0;const{type:i,data:r}=e||{};let s;s=this.isElementsEnabled()?ComponentFactoryService.createElement({type:i,...r}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:i}):componentError({message:"Elements is not enabled.",componentType:i}),this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(s),this.updateModalContentTypeClass(i),this.open(),this.addHostAttribute("data-target",i.toString().toLowerCase())}catch(i){this.logger.error("Modal content loading failed",i),this.commands.ui.closeModal()}}open(){this.isOpen=!![],requestAnimationFrame(()=>{this.modalElement&&!this.modalElement.open&&this.modalElement.showModal()})}close(){var e;this.isOpen=![],(null===(e=this.modalElement)||void 0===e?void 0:e.open)&&this.modalElement.close(),this.cleanupCurrentContent()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleCancel(e){e.preventDefault(),this.commands.ui.closeModal()}handleBackdropClick(e){e.target===this.modalElement&&this.commands.ui.closeModal()}handleKeydown(e){this.isOpen&&"Escape"===e.key&&this.commands.ui.closeModal()}updateModalContentTypeClass(e){if(!this.modalElement)return;const i=["modal"];this.isOpen&&i.push("open"),i.push(e.toString().toLowerCase()),this.modalElement.className=i.join(" ")}isElementsEnabled(){var e;try{const i=this.themeProvider.getConfigs("configurations");return null!==(e=null==i?void 0:i.isElementsEnabled)&&void 0!==e?e:![]}catch(i){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",i),!![]}}template(){return this.modalElement=document.createElement("dialog"),this.modalElement.classList.add("modal"),this.modalElement.addEventListener("cancel",this.handleCancel.bind(this)),this.modalElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("modal-content"),this.modalElement.appendChild(this.contentContainer),document.addEventListener("keydown",this.boundHandleKeydown),this.modalElement}}class HttpClientService{constructor(){this.logger=LoggerFactory.get("HttpClient"),this.defaultShouldRetry=(e,i)=>e||i&&i.status>=500&&i.status<600?!![]:![],this.xhrFetch=(e,i)=>new Promise((r,s)=>{const c=new XMLHttpRequest;c.open(i.method||"GET",e);for(const[e,d]of Object.entries(i.headers))c.setRequestHeader(e,d);c.onload=()=>{const e={ok:c.status>=200&&c.status<300,status:c.status,statusText:c.statusText,headers:c.getAllResponseHeaders().split("\r\n").reduce((e,i)=>{const[r,s]=i.split(": ");return r&&s&&(e[r]=s),e},{}),h:c.responseText,json:()=>Promise.resolve(JSON.parse(c.responseText)),text:()=>Promise.resolve(c.responseText)};r(e)},c.onerror=()=>{s(new TypeError("Network request failed"))},c.ontimeout=()=>{s(new TypeError("Network request timed out"))},c.timeout=3e4,c.send(i.body)}),this.fetchImpl=this.getFetchImplementation()}async request(e){var i,r,s;const{url:c,options:d,retryConfig:h}=e,u=null!==(i=null==h?void 0:h.maxRetries)&&void 0!==i?i:3,g=null!==(r=null==h?void 0:h.retryDelay)&&void 0!==r?r:1e3,v=null!==(s=null==h?void 0:h.shouldRetry)&&void 0!==s?s:this.defaultShouldRetry;let b;const x=Date.now();for(let E=0;E<=u;E++){let e=Date.now();try{e=Date.now();const i=await this.fetchImpl(c,d),r=Date.now()-e;if(i.ok)return i;if(await this.logFailedResponse(c,d,i,r,E,u),E<u&&v(null,i)){await this.delay(g*2**E);continue}return i}catch(k){const i=Date.now()-e;if(b=k,this.logNetworkError(c,d,k,i,E,u),E<u&&v(k,void 0)){await this.delay(g*2**E);continue}throw this.enhanceError(k,c,d,Date.now()-x)}}throw this.enhanceError(b,c,d,Date.now()-x)}async logFailedResponse(e,i,r,s,c,d){const h=c<d;let u,g;try{r.h||(r.h=await r.text());try{u=JSON.parse(r.h)}catch(v){u=r.h}}catch(b){u="[Unable to read response body]"}if(i.body)try{g=JSON.parse(i.body)}catch(x){g=i.body}this.logger.error("HTTP request failed",{method:i.method,url:e,status:r.status,statusText:r.statusText,duration:s+"ms",attempt:c+1+"/"+(d+1),willRetry:h,requestHeaders:i.headers,requestBody:g,responseHeaders:r.headers,responseBody:u})}logNetworkError(e,i,r,s,c,d){var h;const u=c<d;this.logger.error("Network request failed",{method:i.method,url:e,error:r,errorType:(null===(h=null==r?void 0:r.constructor)||void 0===h?void 0:h.name)||typeof r,duration:s+"ms",attempt:c+1+"/"+(d+1),willRetry:u,possibleCauses:this.diagnosePossibleCauses(r)})}diagnosePossibleCauses(e){var i,r,s,c,d;const h=[];return((null===(i=null==e?void 0:e.message)||void 0===i?void 0:i.includes("timeout"))||(null===(r=null==e?void 0:e.message)||void 0===r?void 0:r.includes("timed out")))&&h.push("Request timeout - server took too long to respond"),((null===(s=null==e?void 0:e.message)||void 0===s?void 0:s.includes("Failed to fetch"))||(null===(c=null==e?void 0:e.message)||void 0===c?void 0:c.includes("Network request failed")))&&(h.push("Network connectivity issue"),h.push("CORS policy blocking the request"),h.push("Server is not responding"),h.push("Request was blocked by browser or firewall")),(null===(d=null==e?void 0:e.message)||void 0===d?void 0:d.includes("aborted"))&&h.push("Request was aborted"),0===h.length&&h.push("Unknown network error"),h}enhanceError(e,i,r,s){const c=new Error((null==e?void 0:e.message)||"Network request failed - no response from server");return c.url=i,c.method=r.method,c.totalDuration=s+"ms",c.isNetworkError=!![],c.originalError=e,c.possibleCauses=this.diagnosePossibleCauses(e),c}delay(e){return new Promise(i=>setTimeout(i,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(i,r)=>{var s;const c=await e(i,r);let d;if("function"==typeof(null===(s=c.headers)||void 0===s?void 0:s.entries))d=Object.fromEntries(c.headers.entries());else{d={};for(const[e,i]of c.headers)d[e]=i}const h={ok:c.ok,status:c.status,statusText:c.statusText,headers:d,json:async()=>(h.h||(h.h=await c.text()),JSON.parse(h.h)),text:async()=>(h.h||(h.h=await c.text()),h.h)};return h}}}class AuthClientService{constructor(e){this.accessToken=null,this.tokenExpiration=null,this.authPromise=null,this.refreshPromise=null,this.shouldRetryNonAuth=(e,i)=>e?!![]:i&&this.isAuthError(i)?![]:i&&i.status>=500&&i.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,i,r,s,c,d,h,u,g;try{this.logger.info("Authenticating and fetching configurations in single request");const v=await this.request("/auth/authenticate",{method:"GET"},!![]);return(null===(i=null===(e=null==v?void 0:v.data)||void 0===e?void 0:e.auth)||void 0===i?void 0:i.accessToken)&&(null===(s=null===(r=null==v?void 0:v.data)||void 0===r?void 0:r.auth)||void 0===s?void 0:s.expiration)?(null===(g=null==v?void 0:v.data)||void 0===g?void 0:g.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,productList:{theme:{backgroundColor:"#FFFFFF"},layout:{productCard:{style:"card",cornerRadius:"rounded",showPrice:!![],showSizeSelector:!![],showFulfillment:!![],showQuantityCounter:!![],enablePersonalization:!![],enableShippingFulfillment:!![],enableOnDemandFulfillment:!![],showCollections:![]}}}}}):(this.logger.error("Combined auth response missing configs data",{response:null==v?void 0:v.data}),{success:![]}):(this.logger.error("Combined auth response missing required auth fields",{hasToken:!!(null===(d=null===(c=null==v?void 0:v.data)||void 0===c?void 0:c.auth)||void 0===d?void 0:d.accessToken),hasExp:!!(null===(u=null===(h=null==v?void 0:v.data)||void 0===h?void 0:h.auth)||void 0===u?void 0:u.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: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,i){return this.request(e,{method:"GET",headers:null==i?void 0:i.headers})}async post(e,i){return this.request(e,{method:"POST",body:null==i?void 0:i.body,headers:null==i?void 0:i.headers})}async performAuthentication(){var e,i,r,s;try{const c=await this.request("/auth",{method:"GET"},!![]);return(null===(e=null==c?void 0:c.data)||void 0===e?void 0:e.accessToken)&&(null===(i=null==c?void 0:c.data)||void 0===i?void 0:i.expiration)?(this.accessToken=c.data.accessToken,this.tokenExpiration=c.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,!![]):(this.logger.error("Authentication response missing required fields",{hasToken:!!(null===(r=null==c?void 0:c.data)||void 0===r?void 0:r.accessToken),hasExp:!!(null===(s=null==c?void 0:c.data)||void 0===s?void 0:s.expiration),response:null==c?void 0:c.data}),![])}catch(c){return this.logger.error("Failed to obtain access token from authentication endpoint",{error:c,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),![]}}async performTokenRefresh(){var e,i,r,s;try{this.logger.info("Attempting to refresh access token");const c=await this.request("/auth/refresh",{method:"POST"},![],!![]);return(null===(e=null==c?void 0:c.data)||void 0===e?void 0:e.accessToken)&&(null===(i=null==c?void 0:c.data)||void 0===i?void 0:i.expiration)?(this.accessToken=c.data.accessToken,this.tokenExpiration=c.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===(r=null==c?void 0:c.data)||void 0===r?void 0:r.accessToken),hasExp:!!(null===(s=null==c?void 0:c.data)||void 0===s?void 0:s.expiration),response:null==c?void 0:c.data}),![])}catch(c){return this.logger.warn("Failed to refresh access token, will fall back to full authentication",{error:c,status:null==c?void 0:c.status,endpoint:"/auth/refresh"}),![]}}async request(e,i,r=![],s=![]){if(!r&&!s&&(!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 c=this.buildUrl(e),d=this.buildHeaders(i.headers,r),h=await this.httpClient.request({url:c,options:{method:i.method,headers:d,body:i.body?JSON.stringify(i.body):void 0},retryConfig:{maxRetries:AuthClientService.MAX_RETRIES,retryDelay:AuthClientService.RETRY_DELAY_MS,shouldRetry:this.shouldRetryNonAuth}});return h.ok?this.handleSuccessResponse(h,e,i.method):!this.isAuthError(h)||r||s?this.handleErrorResponse(h):this.handleAuthError(h,e,i)}async handleSuccessResponse(e,i,r){try{return await e.json()}catch(s){const c=await e.text().catch(()=>"Success");return this.logger.error("Response returned 2xx status but body is not valid JSON",{path:i,method:r,status:e.status,responsePreview:c.substring(0,1e3),error:s}),{message:c}}}async handleAuthError(e,i,r){this.logger.warn("Access token rejected with "+e.status+", attempting to obtain new token and retry request",{status:e.status,path:i,method:r.method});let s=await this.refreshToken();return s||(this.logger.info("Token refresh failed after auth error, attempting full authentication"),this.clearToken(),s=await this.authenticate()),s?this.request(i,r,![],!![]):(this.logger.error("Unable to obtain new access token after receiving auth error, request cannot be retried",{status:e.status,path:i,method:r.method}),this.handleErrorResponse(e))}async handleErrorResponse(e){let i;try{i=await e.json()}catch(r){const s=await e.text().catch(()=>"HTTP error status: "+e.status);i={message:s||"Unknown error"}}throw{...i,status:e.status,message:(null==i?void 0:i.message)||"Request failed"}}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}clearToken(){this.accessToken=null,this.tokenExpiration=null}buildUrl(e){const i=this.clientConfig.getProxyConfig();return new URL("api"+e,i?i.baseUrl:this.baseUrl).toString()}buildHeaders(e,i=![]){const r={"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 i?r["X-Liquid-Api-Key"]=this.apiKey:r.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(r["X-Liquid-Api-Builder"]="true"),r}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 St="lce-checkout-stripe-slot",Et={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},_t={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},Pt={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(Et)),this.allowedBillingFields=new Set(Object.values(Pt)),this.allowedGiftFields=new Set(Object.values(_t)),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(i){throw this.logger.error('Unable to retrieve product details for identifier "'+e+'"',i),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 i=await this.command.address.getAddressDetails(e);await this.command.address.setSelectedAddress({id:e,address:i.address,coordinates:i.coordinates,formattedAddress:i.formattedAddress})}catch(i){throw this.logger.error("Error setting address by placesId:",i),i}},setAddressManually:async(e,i)=>{try{if(!e||!i)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 i.latitude||"number"!=typeof i.longitude)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof i.latitude+", long: "+typeof i.longitude,!![]);if(i.latitude<-90||i.latitude>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+i.latitude,!![]);if(i.longitude<-180||i.longitude>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+i.longitude,!![]);await this.command.address.setAddressManually(e,i)}catch(r){throw this.logger.error("Error setting manual address:",r),r}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(s.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(s.CART)},addProduct:async(e,r)=>{var d,h;try{if(!e||0===e.length)return this.logger.warn("No products provided to add to cart"),void 0;for(const i of e){if(!i.identifier||"string"!=typeof i.identifier)throw new SDKError("Product identifier is required and must be a string",!![]);if(i.fulfillmentType||(i.fulfillmentType=c.SHIPPING),i.quantity&&"number"==typeof i.quantity||(i.quantity=1),i.fulfillmentType!==c.SHIPPING&&i.fulfillmentType!==c.ON_DEMAND)throw new SDKError('Invalid fulfillment type "'+i.fulfillmentType+'" for product "'+i.identifier+'". Must be either "shipping" or "onDemand"',!![]);if(i.quantity<1)throw new SDKError('Quantity must be a number greater than 0 for product "'+i.identifier+'"',!![])}const u=this.getLocation();if(void 0===u)return this.pendingCartParams=e,this.pendingCartOpenFlag=null!=r?r:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(s.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;r===!![]&&this.command.ui.openDrawer(s.CART);const g=[...new Set(e.map(e=>e.identifier))],v=await this.api.getProductsData(g,u);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(i.CART_PRODUCT_ADD_FAILED,{cartId:e,identifiers:[],error:"No products provided"}),void 0}for(const i of e){let e=null;for(let c=0;c<v.products.length;c++){const r=v.products[c];let s=![];const d=Object.values(r.sizes);for(let e=0;e<d.length;e++){const c=d[e];if(c.upc===i.identifier||c.id===i.identifier||r.salsifyGrouping===i.identifier){s=!![];break}}if(s){e=r;break}}if(!e){this.logger.warn("No product found for identifier: "+i.identifier);continue}const r=Object.values(e.sizes)[0];if(!r){this.logger.warn("No sizes found for product: "+i.identifier);continue}if((null===(h=null===(d=null==r?void 0:r.attributes)||void 0===d?void 0:d.presale)||void 0===h?void 0:h.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+i.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let s=null;const u=i.fulfillmentType===c.SHIPPING?r.shippingVariants:r.onDemandVariants,g=Object.values(u);for(let i=0;i<g.length;i++)if(g[i]){s=g[i];break}if(!s){this.logger.warn("No supported variant found for product: "+i.identifier+" with fulfillment type: "+i.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const b=i.fulfillmentType===c.ON_DEMAND?s.onDemandFulfillmentId:s.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:b,partNumber:s.partNumber,quantity:i.quantity,identifier:i.identifier})}this.clearPendingCartOperation();const b=this.store.get("cart.id");this.pubSub.publishAction(i.CART_PRODUCT_ADD_SUCCESS,{cartId:b,itemsAdded:e.length,identifiers:g}),this.logger.info("Products added to cart successfully:",g)}catch(u){this.logger.error("Error adding products to cart:",u),this.clearPendingCartOperation();const r=this.store.get("cart.id");throw this.pubSub.publishAction(i.CART_PRODUCT_ADD_FAILED,{cartId:r,identifiers:e.map(e=>e.identifier),error:u.message||"Failed to add products to cart"}),u}},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 r=e.trim().toUpperCase(),s=this.themeProvider.getConfigs("global"),c=s.layout.allowPromoCodes;if(!c)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;const d=this.store.get("cart.promoCode");if(d&&d.code===r)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(r);const h=this.command.cart.getDetails();this.pubSub.publishAction(i.CART_PROMO_CODE_APPLIED,{cartId:h.cartId,discount:h.promoCodeDiscount||0,newSubtotal:h.subtotal}),this.logger.info("Promo code applied successfully")}catch(r){this.logger.error("Failed to apply promo code:",r);const e=this.store.get("cart.id");throw this.pubSub.publishAction(i.CART_PROMO_CODE_FAILED,{cartId:e,error:"Promo code could not be applied"}),r}},removePromoCode:async()=>{try{const e=this.themeProvider.getConfigs("global"),r=e.layout.allowPromoCodes;if(!r)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const s=this.command.cart.getDetails();this.pubSub.publishAction(i.CART_PROMO_CODE_REMOVED,{cartId:s.cartId,newSubtotal:s.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(i.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(s.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const e=this.store.get("ui.drawer.isOpen");e?this.command.ui.closeDrawer():this.command.ui.openDrawer(s.CHECKOUT)},addProduct:async(e,r)=>{try{if(!e||0===e.length)return this.logger.warn("No products provided to add to checkout"),void 0;r===!![]&&this.command.ui.openDrawer(s.CHECKOUT);const c=e.map(e=>e.identifier);await this.cartActions.addProduct(e),await this.command.checkout.loadCheckout({});const d=this.store.get("cart.id");this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:d,itemsAdded:e.length,identifiers:c}),this.logger.info("Products added to checkout successfully:",c)}catch(c){this.logger.error("Error adding products to checkout:",c);const r=this.store.get("cart.id");throw this.pubSub.publishAction(i.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:r,identifiers:e.map(e=>e.identifier),error:c.message||"Failed to add products to checkout"}),c}},applyPromoCode:async e=>{var r;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 s=e.trim().toUpperCase(),c=this.themeProvider.getConfigs("global"),d=c.layout.allowPromoCodes;if(!d)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const h=this.store.get("checkout.promoCode");if(h&&h.code===s)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(e);const u=this.store.get("checkout"),g=u.promoCode;this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_APPLIED,{cartId:u.cartId,discount:(null==g?void 0:g.discount)||0,newTotal:(null===(r=null==u?void 0:u.amounts)||void 0===r?void 0:r.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(s){this.logger.error("Failed to apply checkout promo code:",s);const e=this.store.get("checkout");throw this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_FAILED,{cartId:e.cartId,error:"Promo code could not be applied"}),s}},removePromoCode:async()=>{var e;try{const r=this.themeProvider.getConfigs("global"),s=r.layout.allowPromoCodes;if(!s)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 c=this.store.get("checkout");this.pubSub.publishAction(i.CHECKOUT_PROMO_CODE_REMOVED,{cartId:c.cartId,newTotal:(null===(e=null==c?void 0:c.amounts)||void 0===e?void 0:e.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(r){throw this.logger.error("Failed to remove checkout promo code:",r),r}},applyGiftCard:async e=>{var r;try{const s=this.themeProvider.getConfigs("checkout"),c=s.layout.allowGiftCards;if(!c)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(e);const d=this.store.get("checkout");this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_APPLIED,{cartId:d.cartId,newTotal:(null===(r=null==d?void 0:d.amounts)||void 0===r?void 0:r.total)||0}),this.logger.info("Gift card applied successfully")}catch(s){this.logger.error("Failed to apply gift card:",s);const e=this.store.get("checkout");throw this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_FAILED,{cartId:e.cartId,error:"Gift card could not be applied"}),s}},removeGiftCard:async e=>{var r;try{const s=this.themeProvider.getConfigs("checkout"),c=s.layout.allowGiftCards;if(!c)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(e);const d=this.store.get("checkout");this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_REMOVED,{cartId:d.cartId,newTotal:(null===(r=null==d?void 0:d.amounts)||void 0===r?void 0:r.total)||0}),this.logger.info("Gift card removed successfully")}catch(s){this.logger.error("Failed to remove gift card:",s);const e=this.store.get("checkout");throw this.pubSub.publishAction(i.CHECKOUT_GIFT_CARD_FAILED,{cartId:e.cartId,error:"Gift card could not be removed"}),s}},toggleIsGift:async e=>{await this.command.checkout.toggleIsGift(e)},toggleBillingSameAsShipping:async e=>{await this.command.checkout.toggleBillingSameAsShipping(e)},toggleMarketingPreferences:async(e,i)=>{await this.command.checkout.toggleMarketingPreferences(e,i)},updateCustomerInfo:e=>{const i={};if(!e||"object"!=typeof e)return this.logger.warn("actions.checkout.updateCustomerInfo called without valid params"),void 0;for(const[r,s]of Object.entries(e)){if(!this.allowedCustomerFields.has(r))continue;const e=this.normalizeCheckoutFieldValue(s);r===Et.addressTwo?i["checkout.shippingAddress.address.two"]=e:i["checkout.customerForm.data."+r]=e}if(0===Object.keys(i).length)return this.logger.warn("actions.checkout.updateCustomerInfo called without supported fields"),void 0;this.store.batch(i)},updateBillingInfo:e=>{const i={};if(!e||"object"!=typeof e)return this.logger.warn("actions.checkout.updateBillingInfo called without valid params"),void 0;for(const[r,s]of Object.entries(e))this.allowedBillingFields.has(r)&&(i["checkout.paymentForm.data."+r]=this.normalizeCheckoutFieldValue(s));if(0===Object.keys(i).length)return this.logger.warn("actions.checkout.updateBillingInfo called without supported fields"),void 0;this.store.batch(i)},updateGiftInfo:e=>{const i={};if(!e||"object"!=typeof e)return this.logger.warn("actions.checkout.updateGiftInfo called without valid params"),void 0;for(const[r,s]of Object.entries(e)){if(!this.allowedGiftFields.has(r))continue;const e=this.normalizeCheckoutFieldValue(s);r===_t.addressTwo?i["checkout.shippingAddress.address.two"]=e:i["checkout.giftRecipientForm.data."+r]=e}if(0===Object.keys(i).length)return this.logger.warn("actions.checkout.updateGiftInfo called without supported fields"),void 0;this.store.batch(i)},getDetails:()=>this.command.checkout.getDetails()},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 P=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+i.ADDRESS_UPDATED,P)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const e=this.pendingCartParams,i=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(e,i)}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 Ft="\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",Dt="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,i=e.instances;if(i)for(const[s,c]of i)this.interceptLoggerInstance(c,s);const r=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=e=>{const i=r(e);return this.interceptLoggerInstance(i,e),i}}interceptLoggerInstance(e,i){if(e.u)return;const r=e.debug.bind(e),s=e.info.bind(e),c=e.warn.bind(e),d=e.error.bind(e),l=(e,r,s)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:e,message:r,data:s,context:i});e.debug=(e,i)=>{r(e,i),this.addLogEntry(l("debug",e,i))},e.info=(e,i)=>{s(e,i),this.addLogEntry(l("info",e,i))},e.warn=(e,i)=>{c(e,i),this.addLogEntry(l("warn",e,i))},e.error=(e,i)=>{d(e,i),this.addLogEntry(l("error",e,i))},e.u=!![]}interceptPubSubEvents(){const e=PubSubService.getInstance(),i=e.publishAction.bind(e);e.publishAction=(e,r)=>{i(e,r),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+e,data:r,context:"PubSub"})};const r=e.publishForm.bind(e);e.publishForm=(e,i)=>{r(e,i),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:i,context:"PubSub"})}}interceptGtmEvents(){const e=GoogleTagManagerService.getInstance(),i=e.executeEvent.bind(e);e.executeEvent=(e,r,s)=>{i(e,r,s),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+r,data:s,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 i=this.createLogElement(e);this.logContainer.appendChild(i)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const e=document.querySelector(Dt);e&&e.remove(),this.panelElement=document.createElement(Dt);const i=window.innerWidth<=768,r=window.innerWidth<=480;r?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):i?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const e=this.panelElement.attachShadow({mode:"closed"}),i=document.createElement("style");i.textContent=Ft,e.appendChild(i),this.floatingButton=this.createFloatingButton(),e.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const r=this.createHeader();this.panelContainer.appendChild(r);const s=this.createToggles();this.panelContainer.appendChild(s),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const c=this.createResizeHandle();this.panelContainer.appendChild(c),e.appendChild(this.panelContainer),this.setupShadowEventListeners(e)}createHeader(){const e=document.createElement("div");e.className="header",e.title="Drag to move panel";const i=document.createElement("div");i.className="icon",i.innerHTML="🔍",i.title="Elements Debug Console",i.style.cursor="help";const r=document.createElement("div");r.className="title-container";const s=document.createElement("div");s.className="title",s.textContent="Elements Debug Console";const c=document.createElement("div");c.className="subtitle",c.textContent="Live SDK logs, events & GTM tracking",r.appendChild(s),r.appendChild(c);const d=document.createElement("button");return d.className="minimize",d.innerHTML="−",d.title="Minimize debug panel",d.addEventListener("click",()=>this.toggleVisibility()),e.appendChild(i),e.appendChild(r),e.appendChild(d),e}createToggles(){const e=document.createElement("div");e.className="toggles";const i=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];i.forEach(({key:i,label:r,description:s,color:c})=>{const d=document.createElement("label");d.className="toggle",d.title=s;const h=document.createElement("input");h.type="checkbox",h.checked="showLogs"!==i,h.addEventListener("change",e=>{const r=e.target;"showEvents"===i&&(this.showEvents=r.checked),"showGtmEvents"===i&&(this.showGtmEvents=r.checked),"showLogs"===i&&(this.showLogs=r.checked),this.renderLogs()});const u=document.createElement("span");u.textContent=r,u.style.color=c,d.appendChild(h),d.appendChild(u),e.appendChild(d)});const r=document.createElement("button");return r.className="clear-btn",r.innerHTML="🗑️",r.title="Clear all logs",r.addEventListener("click",()=>this.clearLogs()),e.appendChild(r),e}createResizeHandle(){const e=document.createElement("div");e.className="resize-handle",e.title="Drag to resize panel",e.style.cursor="nw-resize";let i=![],r=0,s=0,c=0,d=0;e.addEventListener("mousedown",e=>{i=!![],r=e.clientX,s=e.clientY,c=Number.parseInt(this.panelElement.style.width,10)||500,d=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",n),document.addEventListener("mouseup",m),e.preventDefault()});const n=e=>{if(!i||!this.panelElement)return;const h=e.clientX-r,u=e.clientY-s,g=window.innerWidth<=768,v=window.innerWidth<=480;let b,x,k,E;v?(b=280,x=window.innerWidth-20,k=200,E=.4*window.innerHeight):g?(b=300,x=window.innerWidth-30,k=200,E=.4*window.innerHeight):(b=300,x=800,k=200,E=600);const _=Math.max(b,Math.min(x,c+h)),F=Math.max(k,Math.min(E,d+u));this.panelElement.style.width=_+"px",this.panelElement.style.height=F+"px"},m=()=>{i=![],document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",m)};return e}setupShadowEventListeners(e){if(!this.panelElement)return;const i=e.querySelector(".header");if(i){let e=![],r=0,s=0,c=0,d=0;i.addEventListener("mousedown",i=>{if(i.target.classList.contains("minimize"))return;e=!![],r=i.clientX,s=i.clientY;const h=this.panelElement.getBoundingClientRect();c=h.left,d=h.top,document.addEventListener("mousemove",n),document.addEventListener("mouseup",m),i.preventDefault()});const n=i=>{if(!e||!this.panelElement)return;const h=i.clientX-r,u=i.clientY-s;this.panelElement.style.left=c+h+"px",this.panelElement.style.top=d+u+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},m=()=>{e=![],document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",m)}}}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 i=document.createElement("div");i.className="log-entry "+e.type+" "+e.level;const r=new Date(e.timestamp).toLocaleTimeString();return i.innerHTML='\n <div class="log-meta">\n <div class="log-type '+e.type+'">'+e.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+r+'</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 ",i}formatJsonData(e){try{return"object"==typeof e&&null!==e?JSON.stringify(e,null,2):String(e)}catch(i){return String(e)}}escapeHtml(e){const i=document.createElement("div");return i.textContent=e,i.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.m()){const i=this.v(e);if(i)return this.k(e,i)}return this.cachedFingerprint||(this.cachedFingerprint=this.C()),this.k(e,this.cachedFingerprint)}getFingerprintData(){return{screen:this.S(),browser:this._(),timezone:this.P()}}isLocalStorageWebApiAvailable(){return this.m()}k(e,i){return(e+"_"+i).toLowerCase()}m(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const e=window.localStorage,i="__localStorage_test_"+Date.now()+"__",r="test";e.setItem(i,r);const s=e.getItem(i);return s!==r?(this.isLocalStorageAvailable=![],![]):(e.removeItem(i),this.isLocalStorageAvailable=!![],!![])}catch(e){const r=e instanceof DOMException&&(22===e.code||1014===e.code||"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name);if(r)try{const e=window.localStorage;return e&&e.length>0?(this.F()&&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(i){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],e instanceof DOMException){const i={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"},r=i[e.name]||"Storage error: "+e.name,s=this.F()?"webview":"browser";console.warn("localStorage unavailable in "+s+": "+r)}else console.warn("localStorage unavailable:",e.message||"Unknown error");return![]}}v(e){try{const i=this.clientConfig.get("localStorageKeyPrefix")+"_"+e.toLowerCase()+"_";for(let e=0;e<localStorage.length;e++){const r=localStorage.key(e);if(null==r?void 0:r.startsWith(i)){const e=r.substring(i.length);if(e&&/^[a-f0-9]+$/.test(e))return e}}return null}catch(i){return null}}C(){const e=this.getFingerprintData(),i=Object.keys(e).sort().map(i=>i+":"+e[i]).join("|");return this.D(i)}S(){try{const e=screen,i=e.colorDepth||24,r=e.pixelDepth||i,s=this.I(),c=Math.round(100*(window.devicePixelRatio||1));return i+"|"+r+"|"+s+"|"+c}catch(e){return"24|24|srgb|100"}}I(){try{if(window.matchMedia&&"function"==="object".matchMedia){if(window.matchMedia("(color-gamut: rec2020)").matches)return"rec2020";if(window.matchMedia("(color-gamut: p3)").matches)return"p3";if(window.matchMedia("(color-gamut: srgb)").matches)return"srgb"}}catch(yt){}return"srgb"}_(){var e;try{const i=navigator,r=[],s=((null===(e=i.languages)||void 0===e?void 0:e[0])||i.language||"en").substring(0,2);r.push(s),r.push(i.hardwareConcurrency||4);const c=(i.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);r.push(c),r.push(i.cookieEnabled?"1":"0"),r.push(i.maxTouchPoints||0),r.push(i.deviceMemory||0),r.push(this.T()),r.push(this.F()?"webview":"browser");const d=["bluetooth"in i?"1":"0","usb"in i?"1":"0","mediaDevices"in i?"1":"0","permissions"in i?"1":"0","credentials"in i?"1":"0","storage"in i?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return r.push(d.join("")),r.join("|")}catch(i){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}T(){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"}}F(){try{const e=navigator.userAgent.toLowerCase(),i=navigator,r=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return r.some(i=>e.includes(i))?!![]:void 0===i.standalone||i.standalone?window.self!==window.top?!![]:![]:!![]}catch(e){return![]}}P(){try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return e.replace(/\//g,"_").substring(0,30)}catch(e){return"UTC"}}D(e){const i=16777619;let r=2166136261,s=2166136261,c=2166136261,d=2166136261;for(let h=0;h<e.length;h++){const u=e.charCodeAt(h);r^=u,r=Math.imul(r,i),s^=u<<1,s=Math.imul(s,i),c^=u<<2,c=Math.imul(c,i),d^=u<<3,d=Math.imul(d,i)}return r=Math.abs(r),s=Math.abs(s),c=Math.abs(c),d=Math.abs(d),r.toString(16)+s.toString(16)+c.toString(16)+d.toString(16)}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var e;const i=null!==(e=this.params.options)&&void 0!==e?e:{};return ComponentFactoryService.createElement({type:s.ADDRESS_DISPLAY,isIndependentComponent:!![],options:i})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var e,i,r,c;const d=this.getStoreValue("address"),h=null!==(e=this.params.isIndependentComponent)&&void 0!==e?e:![],u=null!==(i=this.params.productId)&&void 0!==i?i:"",g=null!==(r=this.params.options)&&void 0!==r?r:{},v=null!==(c=g.showLabel)&&void 0!==c?c:!![],b=[];if(v){const e=document.createElement("span");e.textContent="Delivers to:",b.push(e)}const x=document.createElement("button");x.type="button",x.textContent=d.formattedAddress||"Select an address";const k=d.formattedAddress?"Change delivery address, currently set to "+d.formattedAddress:"Select delivery address";return x.setAttribute("aria-label",k),x.addEventListener("click",async()=>{if(h)return this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:u,isIndependentComponent:!![]}),void 0;!h&&u&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:u}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(u,s.ADDRESS_INPUT,{productId:u}))}),b.push(x),b}}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 i=e.target,r=i.value.replace(/[^a-zA-Z0-9\s\-.,#'/]/g,"");i.value=r;const s=r.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const c=/^\d/.test(s);if(s.length<this.minSearchLength||!c)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(s)},300)},this.closeDrawer=async()=>{const e=this.params.productId,i=this.clientConfig.isMobile(),r=this.isIndependentComponent();(i||r)&&this.commands.ui.closeDrawer(),!i&&e&&await this.commands.product.closeProductDrawer(e)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(yt){this.logger.error("Address edit cancellation failed",yt)}},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"),i=(null==e?void 0:e.coordinates.latitude)!==this.selectedAddress.coordinates.latitude||(null==e?void 0:e.coordinates.longitude)!==this.selectedAddress.coordinates.longitude;i&&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 i=e.currentTarget.dataset.suggestionId;if(i)try{this.error=null,this.updateErrorDisplay();const e=await this.commands.address.getAddressDetails(i);if(0===Object.keys(e).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:i,address:e.address,coordinates:e.coordinates,formattedAddress:e.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(r){this.logger.error("Address details retrieval failed",r),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 i=await this.commands.address.searchAddresses(e);this.suggestions=i.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(i){this.logger.error("Address search operation failed",i),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const 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 i=this.createElement("li",{className:"suggestion-item"}),r=this.createElement("span",{textContent:e.description});i.appendChild(r),i.setAttribute("data-suggestion-id",e.id),i.setAttribute("role","option"),i.setAttribute("aria-label","Select address: "+e.description),i.setAttribute("tabindex","0"),i.addEventListener("click",this.handleSuggestionClick),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i.click())}),this.suggestionsContainer.appendChild(i)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(e,i){const r=document.createElement(e);return i&&Object.assign(r,i),r}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 i=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),r=this.createElement("span",{className:"error-text"});return e.appendChild(i),e.appendChild(r),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,i,r;const s=this.getConfigs("global"),c=null!==(e=this.params.options)&&void 0!==e?e:{},d=null!==(i=c.showLabel)&&void 0!==i?i:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),d){const e=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(e)}const h=this.createElement("div",{className:"input-wrapper "+s.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(r=this.selectedAddress)||void 0===r?void 0:r.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),h.appendChild(this.inputElement);const u=this.createElement("span");u.className="input-icon",u.innerHTML=SearchIcon({width:16,height:16,className:""}),h.appendChild(u),this.inputContainer.appendChild(h),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 g=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,g,this.errorContainer],b=this.createElement("div",{className:"action-buttons"}),x=this.createCancelButton();b.appendChild(x);const k=this.createCheckButton();return b.appendChild(k),v.push(b),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=[],i=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!i){const i=ComponentFactoryService.createElement({type:s.CART_HEADER});e.push(i)}const r=ComponentFactoryService.createElement({type:s.CART_BODY});e.push(r);const c=ComponentFactoryService.createElement({type:s.CART_FOOTER});return e.push(c),e}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const e=this.config.layout.drawerHeaderText,i=document.createElement("div");i.className="empty-cart-container";const r=document.createElement("h3");return r.className="empty-cart-content",r.textContent="Your "+e.toLowerCase()+" is empty",i.appendChild(r),i}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:s.CART_RETAILER,retailerId:e.id})}catch(i){return this.logger.error("Cart retailer component creation failed",i),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,i){const r=this.createRetailerElement(i);r.setAttribute("data-retailer-id",e),this.container.appendChild(r)}removeRetailerElement(e){const i=this.getRetailerElementById(e);i&&i.remove()}updateRetailerElement(e,i){const r=this.getRetailerElementById(e);if(r){const s=this.createRetailerElement(i);s.setAttribute("data-retailer-id",e),r.replaceWith(s)}}hasRetailerDataChanged(e,i){return e?![]:!![]}getValidRetailers(e){if(!e)return{};const i={};for(const[r,s]of Object.entries(e))s&&"object"==typeof s&&s.id&&(i[r]=s);return i}getValidRetailerIds(e){const i=this.getValidRetailers(e);return new Set(Object.keys(i))}onStoreChanged(e){const i=e.find(e=>"cart.retailers"===e.path),r=e.find(e=>"cart.loading"===e.path);if(i){const e=this.getValidRetailers(i.oldValue),r=this.getValidRetailers(i.value),s=this.getValidRetailerIds(i.oldValue),c=this.getValidRetailerIds(i.value),d=s.size,h=c.size,u=this.getValidRetailers(this.getStoreValue("cart.retailers")),g=Object.keys(u).length;if(h>0&&0===g)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===d&&h>0){this.container.innerHTML="";for(const[e,i]of Object.entries(r))this.addRetailerElement(e,i)}else if(d>0&&0===h)this.showEmptyCartState();else if(h>0){for(const e of s)c.has(e)||this.removeRetailerElement(e);for(const i of c){const c=r[i],d=e[i];s.has(i)?this.hasRetailerDataChanged(d,c)&&this.updateRetailerElement(i,c):this.addRetailerElement(i,c)}}else 0===d&&0===h&&this.showEmptyCartState()}if(r){const e=r.value,i=r.oldValue;e!==i&&(e?this.addLoadingOverlay():this.removeLoadingOverlay())}return r||i,![]}afterRender(){this.setupEmptyCartListeners();const e=this.getStoreValue("cart.loading");e&&this.addLoadingOverlay()}template(){const e=this.getStoreValue("cart.retailers")||{},i=Object.values(e);if(0===i.length)return this.createEmptyCartElement();const r=[];for(const s of i){const e=this.createRetailerElement(s);e.setAttribute("data-retailer-id",s.id),r.push(e)}return r}}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 i=e.some(e=>e.path.includes("cart.items")),r=e.some(e=>e.path.includes("cart.subtotal")),s=e.some(e=>e.path.includes("cart.fulfillments")),c=e.some(e=>"cart.loading"===e.path),d=e.some(e=>e.path.includes("cart.retailers"));i&&this.updateSubtotalItemsCount(),r&&this.subtotalPrice&&(this.subtotalPrice.textContent=formatCentToDollarText(this.getStoreValue("cart.subtotal"))),(s||r||c||i||d)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const e=this.getStoreValue("cart.loading");if(e)return!![];const i=this.getStoreValue("cart.items")||{},r=Object.values(i).some(e=>e.updating);if(r)return!![];const s=this.getStoreValue("cart.fulfillments")||{},c=Object.values(s).some(e=>e.updating);if(c)return!![];const d=this.getStoreValue("cart.retailers")||{},h=Object.values(d).some(e=>e.updating);return h?!![]:![]}shouldDisableCheckout(){const e=this.getStoreValue("cart.fulfillments");return Object.values(e).some(e=>e.hasUnmetMinimumPurchaseAmount)}updateCheckoutButtonState(){const e=this.getStoreValue("cart.items")||{},i=Object.keys(e).length>0;if(this.checkoutButton){const e=this.isAnythingLoading(),r=this.shouldDisableCheckout(),s=e||r||!i;this.checkoutButton.disabled=s,this.checkoutButton.classList.toggle("checkout-btn-disabled",s),this.checkoutButton.classList.toggle("loading",e)}}updateSubtotalItemsCount(){const e=this.getStoreValue("cart.items"),i=Object.values(e).reduce((e,i)=>e+i.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+i+" item"+(1!==i?"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"),i=this.getStoreValue("cart.subtotal"),r=[],c=document.createElement("div");c.className="cart-footer-header";const d=document.createElement("div");d.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",d.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(i),d.appendChild(this.subtotalPrice);const h=document.createElement("p");if(h.textContent="Taxes & fees will be calculated at checkout",h.className="taxes-fees-info",c.appendChild(d),c.appendChild(h),r.push(c),e.layout.allowPromoCodes){const e=ComponentFactoryService.createElement({type:s.CART_PROMO_CODE});r.push(e)}const u=ComponentFactoryService.createElement({type:s.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(r.push(u),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleCheckout(e)}),this.checkoutButton.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.handleCheckout(e))}),r.push(this.checkoutButton),e.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"general"});r.push(e)}return r}}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,i){const r=new Set(e||[]),c=new Set(i||[]);for(const s of r)if(!c.has(s)){const e=this.container.querySelector('[data-item-id="'+s+'"]');e&&e.remove()}for(const d of c)if(!r.has(d)){const e=ComponentFactoryService.createElement({type:s.CART_ITEM,itemId:d});e.setAttribute("data-item-id",d),this.container.appendChild(e)}}setupItemElements(){const e=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+e+".itemIds"),r=this.container.querySelectorAll("[data-item-id]");for(const s of r)s.remove();for(const c of i){const e=ComponentFactoryService.createElement({type:s.CART_ITEM,itemId:c});this.container.appendChild(e)}}setupMinimumPurchaseAlert(){const e=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+e),r=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(r&&r.remove(),null==i?void 0:i.hasUnmetMinimumPurchaseAmount){const e=ComponentFactoryService.createElement({type:s.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(i.minimumPurchaseAmount-i.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:i.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 i=document.createElement("div");i.className="cart-loading-spinner-container";const r=document.createElement("div");return r.className="cart-loading-spinner",r.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',i.appendChild(r),e.appendChild(i),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 i=this.getFulfillmentId(),r=this.getStoreValue("cart.fulfillments."+i);return(null===(e=null==r?void 0:r.itemIds)||void 0===e?void 0:e.length)?r.itemIds.some(e=>this.getStoreValue("cart.items."+e+".updating")):![]}checkAndUpdateLoadingState(){const e=this.isAnyItemUpdating(),i=this.hasLoadingOverlay();e&&!i?this.showLoadingOverlay():!e&&i&&this.hideLoadingOverlay()}onStoreChanged(e){const i=this.getFulfillmentId(),r="cart.fulfillments."+i,s=e.find(e=>e.path===r),c=e.filter(e=>"cart.items"===e.path||e.path.startsWith("cart.items."));if(c.length>0&&this.checkAndUpdateLoadingState(),s){const e=s.oldValue,i=s.value,r=(null==e?void 0:e.itemIds)||[],c=(null==i?void 0:i.itemIds)||[],d=JSON.stringify(r)!==JSON.stringify(c);d&&(this.handleItemsUpdate(r,c),this.checkAndUpdateLoadingState());const h=(null==e?void 0:e.subtotal)!==(null==i?void 0:i.subtotal),u=this.hasFulfillmentDataChanged(e,i,["itemIds","updating"]);if(h&&!u&&this.setupMinimumPurchaseAlert(),!u)return![]}return![]}hasFulfillmentDataChanged(e,i,r=[]){if(!e)return!![];const s=["type","canEngrave"];for(const c of s)if(!r.includes(c)&&e[c]!==i[c])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const It={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"},Tt="America/New_York";function detectUserTimezone(e){try{if(e){const i=e.toUpperCase(),r=It[i];return r||Tt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(i){return Tt}}function getCurrentTimeInTimezone(e){try{const i=new Date,r=i.getTime(),s=6e4*i.getTimezoneOffset(),c=new Date(r+s),d=new Date(c.toLocaleString("en-US",{timeZone:e})),h=c.getTime()-d.getTime();return new Date(r+h)}catch(i){return new Date}}function getCurrentTimeInUserTimezone(e){const i=detectUserTimezone(e);return getCurrentTimeInTimezone(i)}function isDateTimeInRange(e){const{startDate:i,endDate:r,addressState:s}=e;try{const e=getCurrentTimeInUserTimezone(s),c=!i||e>=new Date(i),d=!r||e<=new Date(r);return c&&d}catch(c){return![]}}function filterActiveItems(e,i){return e.filter(e=>isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:i}))}function hasActiveItems(e,i){return filterActiveItems(e,i).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var e,i,r;const c=this.config.layout.drawerHeaderText,d=this.getConfigs("global"),h=document.createElement("div");h.className="cart-header-content";const u=document.createElement("h2");u.className="cart-title",u.textContent=c,h.appendChild(u);const g=document.createElement("button");g.type="button",g.className="cart-header-close-btn",g.innerHTML=CloseIcon({width:16,height:16}),g.setAttribute("aria-label","Close cart drawer"),g.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),h.appendChild(g);const v=this.clientConfig.get("promoTicker"),b=null!==(i=null===(e=null==d?void 0:d.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==i?i:[],x=null!=v?v:b,k=this.store.get("address"),E=hasActiveItems(x,null===(r=null==k?void 0:k.address)||void 0===r?void 0:r.state);if(!x.length||!E)return[h];const _=ComponentFactoryService.createElement({context:"cart",type:s.PROMO_CODE_TICKER,tickers:x});return[h,_]}}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,i){this.commands.ui.openDrawer(s.ENGRAVING_FORM,{identifier:e,context:"cart",lines:i.attributes.engraving.lines,maxLines:i.attributes.engraving.maxLines,maxCharsPerLine:i.attributes.engraving.maxCharsPerLine,fee:i.attributes.engraving.fee,location:i.attributes.engraving.location})}template(){var e,i;const r=this.params.itemId,c=this.getStoreValue("cart.items."+r),d=this.getConfigs("global"),h=this.getStoreValue("cart.fulfillments."+c.fulfillmentId),u=document.createElement("article");u.className="cart-item";const g=document.createElement("div");g.className="item-image";const v=document.createElement("img");v.src=c.mainImage,v.alt=c.name,g.appendChild(v);const b=document.createElement("div");b.className="item-details";const x=document.createElement("div");x.className="item-header";const k=document.createElement("h3");k.className="item-title",k.textContent=c.name;const E=document.createElement("button");E.className="item-delete",E.innerHTML=TrashIcon({}),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.setAttribute("aria-label","Remove "+c.name+" from cart"),E.setAttribute("aria-expanded","true"),E.addEventListener("click",async()=>{await this.commands.cart.removeItem(r)}),E.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.commands.cart.removeItem(r))}),x.appendChild(k),x.appendChild(E);const _=document.createElement("div");_.className="item-specs",_.textContent=c.size+", "+c.container;const F=document.createElement("div");F.className="item-shipping-container";const D=document.createElement("div");if(D.className="item-shipping",D.textContent=c.attributes.engraving.hasEngraving?h.engravingExpectation:h.expectation,F.appendChild(D),d.layout.enablePersonalization&&(null==c?void 0:c.attributes.engraving.isEngravable)&&(null==c?void 0:c.attributes.engraving.hasEngraving)===![]&&h.canEngrave){const e=document.createElement("span");e.className="cart-add-personalization-span",e.textContent=d.layout.personalizationText+" +"+formatCentToDollarText(c.attributes.engraving.fee,![]),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Add personalization to "+c.name),e.addEventListener("click",()=>this.handleOpenEngravingForm(r,c)),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleOpenEngravingForm(r,c))}),F.appendChild(e)}b.appendChild(x),b.appendChild(_),b.appendChild(F),u.appendChild(g),u.appendChild(b);const T=[u],A=ComponentFactoryService.createElement({type:s.CART_ITEM_QUANTITY_PRICE,itemId:r});if((null===(i=null===(e=null==c?void 0:c.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.hasEngraving)===!![]){const e=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:r,context:"cart"});T.push(e)}return T.push(A),T}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(e){const i=e.find(e=>"cart.items"===e.path);if(i){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getItemStore(){const e=this.params.itemId,i=this.getStoreValue("cart.items."+e);return i||null}calculateQuantityLimits(){const e=this.getItemStore();if(!e)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const i=e.quantity,r=this.getAvailableQuantity(),s=r>0;return{currentQuantity:i,availableQuantity:r,canIncrease:s,canDecrease:!![]}}getAvailableQuantity(){var e,i;const r=this.getItemStore();if(!r)return 0;const s=r.partNumber,c=r.fulfillmentId,d=this.getStoreValue("cart.items")||{},h=Object.values(d).filter(e=>e.partNumber===s&&e.fulfillmentId===c),u=h.reduce((e,i)=>e+i.quantity,0),g=this.getStoreValue("products."+r.upc)||this.getStoreValue("products."+r.salsifyGrouping);if(!g)return r.maxQuantity-u;const v=(null===(i=null===(e=null==g?void 0:g.sizes)||void 0===e?void 0:e[r.liquidId])||void 0===i?void 0:i.maxQuantityPerOrder)||0;return!v||v<=0?r.maxQuantity-u:v-u}updateButtonStates(e){this.qtyDecreaseButton&&(this.qtyDecreaseButton.disabled=!e.canDecrease,this.qtyDecreaseButton.classList.toggle("quantity-btn-disabled",!e.canDecrease)),this.qtyIncreaseButton&&(this.qtyIncreaseButton.disabled=!e.canIncrease,this.qtyIncreaseButton.classList.toggle("quantity-btn-disabled",!e.canIncrease)),this.quantitySpan&&(this.quantitySpan.textContent=e.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+e.currentQuantity))}async handleQuantityChange(e){const i=this.calculateQuantityLimits();e>0&&!i.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,e)}createQuantityContainer(){const e=this.calculateQuantityLimits(),i=this.getItemStore();if(!i)return document.createElement("div");const r=document.createElement("div");return r.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),r.appendChild(this.qtyDecreaseButton),r.appendChild(this.quantitySpan),r.appendChild(this.qtyIncreaseButton),r}createPriceContainer(){const e=this.getItemStore();if(!e)return document.createElement("div");const i=document.createElement("div");i.className="item-price-container";const r=document.createElement("span");if(r.className="item-price",r.textContent=formatCentToDollarText(e.price),i.appendChild(r),e.quantity>1){const r=document.createElement("span");r.className="item-price-per-unit",r.textContent="("+formatCentToDollarText(e.unitPrice)+" ea)",i.appendChild(r)}return i}template(){const e=[];if(this.config.layout.showQuantityCounter){const i=this.createQuantityContainer();e.push(i)}const i=this.createPriceContainer();return e.push(i),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 i=e.find(e=>"cart.promoCode"===e.path);if(i){const{value:e,oldValue:r}=i,s=Boolean(null==r?void 0:r.code),c=Boolean(null==e?void 0:e.code);if(!s&&c)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(s&&!c)return this.container.innerHTML="",this.createInputContainer(),void 0;if(c&&this.promoCodePill&&e.discount!==(null==r?void 0:r.discount))return this.promoCodePill.textContent=e.code+" (- "+formatCentToDollarText(e.discount)+")",void 0}}createAppliedContainer(e){const i=document.createElement("div");i.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==e?void 0:e.code)+" (- "+formatCentToDollarText((null==e?void 0:e.discount)||0)+")";const r=document.createElement("button");r.type="button",r.classList.add("promo-remove-btn"),r.textContent="Remove",r.setAttribute("role","button"),r.setAttribute("aria-label","Remove promo code "+(null==e?void 0:e.code)),r.setAttribute("tabindex","0"),r.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||this.commands.cart.removePromoCode()}),i.appendChild(this.promoCodePill),i.appendChild(r),this.container.appendChild(i),this.promoInput=null,this.applyButton=null}createInputContainer(){const e=document.createElement("div");e.classList.add("promo-code-container");const i=document.createElement("div");i.classList.add("promo-container"),i.appendChild(this.createPromoInput()),i.appendChild(this.createApplyButton()),e.appendChild(i),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(),i=e.length>=3&&e.length<=255,r=this.getStoreValue("cart.loading"),s=this.getStoreValue("cart.promoCode"),c=this.getStoreValue("cart.events"),d=c.some(e=>e.type===h.PROMO_CODE);this.applyButton.disabled=!i||r||Boolean(null==s?void 0:s.discount)||this.isApplying||d}createPromoInput(){const e=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+e.layout.inputFieldStyle,validation:{min:3,max:255},onChange:e=>{const i=e.toUpperCase(),r=this.promoInput;r.setValue(i),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const P=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(i){this.logger.error("Cart promo code application failed",{promoCode:e,error:i instanceof Error?i.message:String(i)})}};return this.applyButton.addEventListener("click",P),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),P())}),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 i=document.createElement("div");i.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=e.code+" (- "+formatCentToDollarText(e.discount)+")";const r=document.createElement("button");return r.type="button",r.classList.add("promo-remove-btn"),r.textContent="Remove",r.setAttribute("role","button"),r.setAttribute("aria-label","Remove promo code "+e.code),r.setAttribute("tabindex","0"),r.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||this.commands.cart.removePromoCode()}),i.appendChild(this.promoCodePill),i.appendChild(r),i}const i=document.createElement("div");i.classList.add("promo-code-container");const r=document.createElement("div");return r.classList.add("promo-container"),r.appendChild(this.createPromoInput()),r.appendChild(this.createApplyButton()),i.appendChild(r),i}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(e){return ComponentFactoryService.createElement({type:s.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 i=this.container.querySelectorAll("[data-fulfillment-id]");if(i.length>0){const e=i[i.length-1];return{parent:e.parentElement,nextSibling:e.nextElementSibling}}return null}addFulfillmentElement(e){const i=this.getFulfillmentInsertionPoint();if(i){const r=this.createFulfillmentElement(e);r.setAttribute("data-fulfillment-id",e);const s=this.getFulfillmentContainer();s&&s.remove(),i.nextSibling?i.parent.insertBefore(r,i.nextSibling):i.parent.appendChild(r)}}removeFulfillmentElement(e){const i=this.getFulfillmentElementById(e);if(i){const e=i.parentElement,r=i.nextElementSibling;i.remove();const s=this.container.querySelectorAll("[data-fulfillment-id]");if(0===s.length){const i=document.createElement("div");i.id="retailer-fulfillment-container",r?e.insertBefore(i,r):e.appendChild(i)}}}handleFulfillmentsUpdate(e,i){const r=new Set(e||[]),s=new Set(i||[]);for(const c of r)s.has(c)||this.removeFulfillmentElement(c);for(const c of s)r.has(c)||this.addFulfillmentElement(c)}setupFulfillmentElements(){const e=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+e+".fulfillments")||[],r=this.container.querySelectorAll("[data-fulfillment-id]");for(const c of r)c.remove();let s=this.getFulfillmentContainer();if(!s){const e=this.container.querySelector(".retailer-body-container"),i=this.container.querySelector("#retailer-subtotal-container");s=document.createElement("div"),s.id="retailer-fulfillment-container",e&&i&&e.insertBefore(s,i)}for(const c of Object.keys(i))this.addFulfillmentElement(c)}setupSubtotalElement(){const e=this.getRetailerId(),i=this.container.querySelector("#retailer-subtotal-container");if(i){const r=ComponentFactoryService.createElement({type:s.CART_RETAILER_SUBTOTAL,retailerId:e});i.replaceWith(r)}}onStoreChanged(e){const i=this.getRetailerId(),r="cart.retailers."+i,s=e.find(e=>e.path===r);if(s){const e=s.oldValue,i=s.value,r=Object.keys((null==e?void 0:e.fulfillments)||{}),c=Object.keys(i.fulfillments||{});JSON.stringify(r)!==JSON.stringify(c)&&this.handleFulfillmentsUpdate(r,c)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const e=this.container.querySelector(".section-toggle"),i=this.container.querySelector(".retailer-section"),r=this.container.querySelector(".section-header-label");if(e&&i&&r){const Z=()=>{const i=e.checked;r.setAttribute("aria-label",i?"Expand retailer section":"Collapse retailer section"),r.setAttribute("aria-expanded",i?"false":"true")};e.addEventListener("change",()=>{e.checked?i.classList.add("collapsed"):i.classList.remove("collapsed"),Z()}),r.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),e.click())}),e.checked?i.classList.add("collapsed"):i.classList.remove("collapsed"),Z()}}template(){const e=this.getRetailerId(),i=this.getStoreValue("cart.retailers."+e),r=document.createElement("section");r.className="retailer-section";const s=document.createElement("div");s.className="cart-retailer-header";const c=document.createElement("div");c.className="retailer-info";const d=document.createElement("h2");d.className="section-title",d.textContent=i.name,c.appendChild(d);const h=document.createElement("input");h.type="checkbox",h.id=i.id,h.className="section-toggle",c.appendChild(h);const u=document.createElement("label");u.htmlFor=i.id,u.className="section-header-label",u.setAttribute("role","button"),u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Collapse retailer section"),u.setAttribute("aria-expanded","true");const g=document.createElement("span");g.className="chevron",g.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),u.appendChild(g),c.appendChild(u),s.appendChild(c),r.appendChild(s);const v=document.createElement("div");v.className="retailer-body-container";const b=document.createElement("div");b.id="retailer-fulfillment-container",v.appendChild(b);const x=document.createElement("div");return x.id="retailer-subtotal-container",v.appendChild(x),r.appendChild(v),r}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(e,i){const r=Object.values(e||{}).filter(e=>e.retailerId===i);let s=0;for(const c of r)s+=c.quantity;return s}template(){const e=this.params.retailerId,i=this.getStoreValue("cart.retailers."+e+".subtotal")||0,r=this.getStoreValue("cart.retailers."+e+".engravingFee")||0,s=this.getStoreValue("cart.items"),c=this.getRetailerItemCount(s,e),d=1===c?"item":"items",h=document.createElement("h3");h.className="retailer-subtotal-header",h.textContent="Subtotal ("+c+" "+d+"):";const u=document.createElement("span");return u.className="retailer-subtotal-amount",u.textContent=formatCentToDollarText(i+r),[h,u]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var e,i,r;const c=this.store.get("checkout.presale"),d=this.getConfigs("global"),h=this.clientConfig.get("promoTicker"),u=null!==(i=null===(e=null==d?void 0:d.experienceFeatures)||void 0===e?void 0:e.promoTicker)&&void 0!==i?i:[],g=null!=h?h:u,v=this.store.get("address"),b=hasActiveItems(g,null===(r=null==v?void 0:v.address)||void 0===r?void 0:r.state),x=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),k=document.createElement("div");k.classList.add("checkout-container"),x&&k.classList.add("no-header"),this.params.isIndependentComponent&&k.classList.add("independent");const E=ComponentFactoryService.createElement({type:s.CHECKOUT_INFORMATION});k.appendChild(E);const _=ComponentFactoryService.createElement({type:s.CHECKOUT_ORDER_SUMMARY});if(k.appendChild(_),!c&&(!g.length||!b)&&x)return[k];const F=document.createElement("div");if(F.classList.add("checkout-header-wrapper"),!x){const e=ComponentFactoryService.createElement({type:s.CHECKOUT_HEADER});F.appendChild(e)}if(g.length&&b&&!c){const e=ComponentFactoryService.createElement({context:"checkout",type:s.PROMO_CODE_TICKER,tickers:g});F.appendChild(e)}if(c){const e=ComponentFactoryService.createElement({type:s.CHECKOUT_PRESALE_COUNTDOWN});F.appendChild(e)}return[F,k]}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var e,i,r;const s=this.getStoreValue("checkout"),d=Boolean(s.promoCode),h=Boolean(null===(e=s.giftCards)||void 0===e?void 0:e.length),u=this.getConfigs("global"),g=Object.values(s.fulfillments).some(e=>e.type===c.SHIPPING),v=Object.values(s.fulfillments).some(e=>e.type===c.ON_DEMAND),b=[],x=document.createElement("div");x.classList.add("checkout-amount-line");const k=document.createElement("span");k.textContent="Subtotal ("+s.itemsQuantity+" item"+(s.itemsQuantity>1?"s":"")+")",x.appendChild(k);const E=document.createElement("span");if(E.textContent=formatCentToDollarText(s.amounts.subtotal),x.appendChild(E),b.push(x),g){const e=document.createElement("div");e.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Shipping",e.appendChild(i);const r=document.createElement("span");r.textContent=formatCentToDollarText(s.amounts.shipping),e.appendChild(r),b.push(e)}if(v){const e=document.createElement("div");e.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Delivery",e.appendChild(i);const r=document.createElement("span");r.textContent=formatCentToDollarText(s.amounts.delivery),e.appendChild(r),b.push(e)}if((null===(i=null==s?void 0:s.amounts)||void 0===i?void 0:i.engraving)>0){const e=document.createElement("div");e.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Engraving",e.appendChild(i);const r=document.createElement("span");r.textContent=formatCentToDollarText(s.amounts.engraving),e.appendChild(r),b.push(e)}const _=document.createElement("div");_.classList.add("checkout-amount-line");const F=document.createElement("span");F.textContent="Taxes & Fees",_.appendChild(F);const D=document.createElement("span");if(D.textContent=formatCentToDollarText(s.amounts.tax+s.amounts.service+s.amounts.platform),_.appendChild(D),b.push(_),d){const e=document.createElement("div");e.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Promo Code ("+(null===(r=s.promoCode)||void 0===r?void 0:r.code.toUpperCase())+")",e.appendChild(i);const c=document.createElement("span");c.textContent="-"+formatCentToDollarText(s.amounts.discounts),e.appendChild(c),b.push(e)}if(h){const e=document.createElement("div");e.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Gift Cards Applied",e.appendChild(i);const r=document.createElement("span");r.textContent="-"+formatCentToDollarText(s.amounts.giftCards),e.appendChild(r),b.push(e)}if(v){const e=document.createElement("div");e.classList.add("checkout-amount-line");const i=document.createElement("span");i.textContent="Tips",e.appendChild(i);const r=document.createElement("span");r.textContent=formatCentToDollarText(s.amounts.tip),e.appendChild(r),b.push(e)}const T=document.createElement("div");T.classList.add("checkout-separator"),b.push(T);const A=document.createElement("div");A.classList.add("checkout-amount-total");const O=document.createElement("span");O.textContent="Total",A.appendChild(O);const z=document.createElement("span");if(z.textContent=formatCentToDollarText(s.amounts.total),A.appendChild(z),b.push(A),s.presale){const e=document.createElement("div");e.classList.add("checkout-amount-due");const i=document.createElement("span");i.textContent="Amount due today",e.appendChild(i);const r=document.createElement("span");r.textContent=formatCentToDollarText(0),e.appendChild(r),b.push(e);const s=document.createElement("div");s.classList.add("checkout-presale-locked-message");const c=htmlStringToElement(InfoIcon({color:u.theme.defaultTextColor}));s.appendChild(c);const d=document.createElement("p");d.textContent="Pre-ordered items will be charged when shipped.",s.appendChild(d),b.push(s)}return b}}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"),i=document.createElement("div");i.classList.add("checkout-billing-same-as-shipping-toggle-container");const r=document.createElement("div");r.classList.add("checkout-checkbox-container");const s=document.createElement("span");s.id="billingSameAsShipping",s.classList.add("checkout-checkbox-visual"),s.setAttribute("role","checkbox"),s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Billing same as shipping checkbox"),s.setAttribute("aria-checked",e?"true":"false"),e&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),i.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),i.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const c=document.createElement("label");return c.textContent="Billing address same as shipping address",c.setAttribute("for","billingSameAsShipping"),c.classList.add("billing-checkbox-label"),r.appendChild(s),r.appendChild(c),i.appendChild(r),i}updateSaveButtonState(){const e=!Object.values(this.billingData).every(e=>e.isValid),i={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,one:this.billingData.addressOne.value,two:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zip:this.billingData.zipCode.value};this.params.isFormValid(!e,i)}template(){const e=this.getStoreValue("checkout.paymentForm"),i=[],c=this.billingSameAsShippingToggle();if(i.push(c),e.billingSameAsShipping)return i;e.data&&(e.data.firstName&&(this.billingData.firstName={isValid:!![],value:e.data.firstName}),e.data.lastName&&(this.billingData.lastName={isValid:!![],value:e.data.lastName}),e.data.email&&(this.billingData.email={isValid:!![],value:e.data.email}),e.data.phone&&(this.billingData.phone={isValid:!![],value:e.data.phone}),e.data.company&&(this.billingData.company={isValid:!![],value:e.data.company}),e.data.one&&(this.billingData.addressOne={isValid:!![],value:e.data.one}),e.data.two&&(this.billingData.addressTwo={isValid:!![],value:e.data.two}),e.data.city&&(this.billingData.city={isValid:!![],value:e.data.city}),e.data.state&&(this.billingData.state={isValid:!![],value:e.data.state}),e.data.zip&&(this.billingData.zipCode={isValid:!![],value:e.data.zip})),this.updateSaveButtonState();const d=document.createElement("div");d.classList.add("section-title-container");const h=document.createElement("h3");h.textContent="Your billing info",h.classList.add("section-title"),d.appendChild(h);const u=document.createElement("p");u.textContent="Provide the info relevant to your payment method",u.classList.add("section-subtitle"),d.appendChild(u),i.push(d);const g=document.createElement("div");g.classList.add("section-form-container");const v=document.createElement("div");v.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Pt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.firstName.value=e,this.pubSub.publishForm(r.BILLING,{fieldName:Pt.firstName})},onValidation:e=>{this.billingData.firstName.isValid=e,this.updateSaveButtonState()}});b.setAttribute("aria-label","First name input"),v.appendChild(b);const x=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Pt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.lastName.value=e,this.pubSub.publishForm(r.BILLING,{fieldName:Pt.lastName})},onValidation:e=>{this.billingData.lastName.isValid=e,this.updateSaveButtonState()}});x.setAttribute("aria-label","Last name input"),v.appendChild(x),g.appendChild(v);const k=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:Pt.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.email.value=e,this.pubSub.publishForm(r.BILLING,{fieldName:Pt.email})},onValidation:e=>{this.billingData.email.isValid=e,this.updateSaveButtonState()}});k.setAttribute("aria-label","Email input"),g.appendChild(k);const E=document.createElement("div");E.classList.add("checkout-two-col-container");const _=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:Pt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.phone.value=e,this.pubSub.publishForm(r.BILLING,{fieldName:Pt.phone})},onValidation:e=>{this.billingData.phone.isValid=e,this.updateSaveButtonState()}});_.setAttribute("aria-label","Phone input"),E.appendChild(_);const F=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Pt.company,label:"Company (optional)",autocomplete:!![],onChange:async e=>{this.billingData.company.value=e,this.pubSub.publishForm(r.BILLING,{fieldName:Pt.company})},onValidation:e=>{this.billingData.company.isValid=e,this.updateSaveButtonState()}});F.setAttribute("aria-label","Company input"),E.appendChild(F),g.appendChild(E);const D=document.createElement("div");D.classList.add("checkout-two-col-container");const T=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Pt.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.addressOne.value=e,this.pubSub.publishForm(r.BILLING,{fieldName:Pt.addressOne})},onValidation:e=>{this.billingData.addressOne.isValid=e,this.updateSaveButtonState()}});T.setAttribute("aria-label","Street address input"),D.appendChild(T);const A=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Pt.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async e=>{this.billingData.addressTwo.value=e,this.pubSub.publishForm(r.BILLING,{fieldName:Pt.addressTwo})},onValidation:e=>{this.billingData.addressTwo.isValid=e,this.updateSaveButtonState()}});A.setAttribute("aria-label","Apt, suite, etc. (optional) input"),D.appendChild(A),g.appendChild(D);const O=document.createElement("div");O.classList.add("checkout-three-col-container");const z=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Pt.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.city.value=e,this.pubSub.publishForm(r.BILLING,{fieldName:Pt.city})},onValidation:e=>{this.billingData.city.isValid=e,this.updateSaveButtonState()}});z.setAttribute("aria-label","City input"),O.appendChild(z);const L=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Pt.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(r.BILLING,{fieldName:Pt.state})},onValidation:e=>{this.billingData.state.isValid=e,this.updateSaveButtonState()}});L.setAttribute("aria-label","State input"),O.appendChild(L);const R=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Pt.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async e=>{this.billingData.zipCode.value=e,this.pubSub.publishForm(r.BILLING,{fieldName:Pt.zipCode})},onValidation:e=>{this.billingData.zipCode.isValid=e,this.updateSaveButtonState()}});return R.setAttribute("aria-label","Zip Code input"),O.appendChild(R),g.appendChild(O),i.push(g),i}}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 i=e.find(e=>"checkout.customerForm.isSaving"===e.path);i&&(i.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 i=[],c=document.createElement("div");c.classList.add("section-title-container");const d=document.createElement("h3");d.textContent="Buyer Information",d.classList.add("section-title"),c.appendChild(d);const h=document.createElement("p");h.textContent="Buyer information is used to process your order and for delivery purposes.",h.classList.add("section-subtitle"),c.appendChild(h),i.push(c);const u=document.createElement("div");u.classList.add("section-form-container");const g=document.createElement("div");g.classList.add("checkout-two-col-container");const v=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Et.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:e.firstName,onChange:async e=>{this.customerData.firstName.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.firstName})},onValidation:e=>{this.customerData.firstName.isValid=e,this.updateSaveButtonState()}});g.appendChild(v);const b=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Et.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:e.lastName,onChange:async e=>{this.customerData.lastName.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.lastName})},onValidation:e=>{this.customerData.lastName.isValid=e,this.updateSaveButtonState()}});g.appendChild(b),u.appendChild(g);const x=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Et.company,label:"Company (optional)",autocomplete:!![],value:e.company,onChange:async e=>{this.customerData.company.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.company})},onValidation:e=>{this.customerData.company.isValid=e,this.updateSaveButtonState()}});u.appendChild(x);const k=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:Et.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:e.email,onChange:async e=>{this.customerData.email.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.email})},onValidation:e=>{this.customerData.email.isValid=e,this.updateSaveButtonState()}});u.appendChild(k);const E=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:Et.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:e.phone,onChange:async e=>{this.customerData.phone.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.phone})},onValidation:e=>{this.customerData.phone.isValid=e,this.updateSaveButtonState()}});u.appendChild(E);const _=ComponentFactoryService.createElement({type:s.INPUT,inputType:"birthdate",name:Et.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:e.birthDate,onChange:async e=>{this.customerData.birthDate.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.birthDate})},onValidation:e=>{this.customerData.birthDate.isValid=e,this.updateSaveButtonState()}});return u.appendChild(_),i.push(u),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:""})}),i.push(this.saveButton),this.updateSaveButtonState(),i}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const e=[],i=this.getStoreValue("checkout.customerForm.data"),r=document.createElement("div");r.classList.add("checkout-summary-form-header");const s=document.createElement("h2");s.textContent="Buyer: "+i.firstName+" "+i.lastName,r.appendChild(s);const c=document.createElement("span");if(c.textContent="Edit",c.setAttribute("aria-label","Edit Buyer Information"),c.setAttribute("role","button"),c.setAttribute("tabindex","0"),c.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),c.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.editCustomerForm())}),r.appendChild(c),e.push(r),i.company){const r=document.createElement("p");r.classList.add("checkout-summary-form-line"),r.textContent=i.company,e.push(r)}const d=document.createElement("p");d.classList.add("checkout-summary-form-line"),d.textContent=i.email,e.push(d);const h=document.createElement("p");h.classList.add("checkout-summary-form-line"),h.textContent=i.phone,e.push(h);const u=document.createElement("p");return u.classList.add("checkout-summary-form-line"),u.textContent=formatISODateToMMDDYYYY(i.birthDate),e.push(u),e}}const At=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],Ot={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,i){return"href"===e?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(i)?i:null:"src"===e?/^https?:\/\/[^\s<>"']+$/i.test(i)?i:null:"class"===e?i.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():i.replace(/[<>"']/g,"").trim()}function cleanNode(e){if(e.nodeType===Node.TEXT_NODE){const i=e.textContent||"",r=i.replace(/<[^>]*>/g,"");if(r.trim()){const e=document.createTextNode(r);return e}return null}if(e.nodeType===Node.ELEMENT_NODE){const i=e,r=i.tagName.toLowerCase();if(At.includes(r)){const e=document.createElement(r),s=Ot[r]||[];for(const r of Array.from(i.attributes)){const i=r.name.toLowerCase();if(s.includes(i)){const s=sanitizeAttributeValue(i,r.value);null!==s&&e.setAttribute(i,s)}}"a"===r&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"));for(const r of Array.from(i.childNodes)){const i=cleanNode(r);i&&e.appendChild(i)}return e}const s=document.createDocumentFragment();for(const e of Array.from(i.childNodes)){const i=cleanNode(e);i&&s.appendChild(i)}return s.childNodes.length>0?s:null}return null}function sanitizeHTML(e){if(!e||"string"!=typeof e)return"";try{const i=new DOMParser,r=i.parseFromString(e,"text/html"),s=r.querySelector("parsererror");if(s)return console.warn("HTML parsing error detected"),"";const c=document.createDocumentFragment();for(const e of Array.from(r.body.childNodes)){const i=cleanNode(e);i&&c.appendChild(i)}const d=document.createElement("div");return d.appendChild(c),d.innerHTML}catch(i){return console.error("HTML sanitization error:",i),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var e,i,r,c,d,h;const u=[],g=this.getConfigs("configurations"),v=this.getConfigs("global"),b=this.getConfigs("checkout"),x=this.config.layout.exitUrl||window.location.host,k=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(i=null===(e=this.config.layout)||void 0===e?void 0:e.checkoutCompleted)||void 0===i?void 0:i.customLogo){const e=document.createElement("div");e.classList.add("checkout-completed-header-container");const i=document.createElement("img");i.src=null===(c=null===(r=this.config.layout)||void 0===r?void 0:r.checkoutCompleted)||void 0===c?void 0:c.customLogo,i.alt=g.partnerName+" Logo",e.appendChild(i),u.push(e)}const E=document.createElement("div");E.classList.add("checkout-completed-section-container");const _=document.createElement("div");_.classList.add("checkout-completed-title-container");const F=document.createElement("div");F.classList.add("checkout-completed-title-section");const D=document.createElement("h3");D.innerHTML=(null===(h=null===(d=this.config.layout)||void 0===d?void 0:d.checkoutCompleted)||void 0===h?void 0:h.customText)||"Thank You for Your Order!",F.appendChild(D);const T=document.createElement("p");T.textContent="Your payment has been successfully processed.",F.appendChild(T),_.appendChild(F),E.appendChild(_);const A=document.createElement("div");A.classList.add("checkout-completed-sub-section");const O=document.createElement("div");O.classList.add("checkout-completed-line");const z=document.createElement("h3");z.textContent="Order Number",O.appendChild(z);const L=document.createElement("span");L.textContent=this.params.orderNumber,O.appendChild(L),A.appendChild(O);const R=document.createElement("div");R.classList.add("checkout-completed-line");const M=document.createElement("h3");M.textContent="Order Amount",R.appendChild(M);const j=document.createElement("span");j.textContent=""+formatCentToDollarText(this.params.orderTotal),R.appendChild(j),A.appendChild(R);const N=document.createElement("div");N.classList.add("checkout-completed-line");const B=document.createElement("h3");B.textContent="Payment Method",N.appendChild(B);const q=document.createElement("span");q.textContent="** "+this.params.cardLast4,N.appendChild(q),A.appendChild(N),E.appendChild(A);const U=document.createElement("div");U.classList.add("checkout-completed-sub-section");const V=document.createElement("p");V.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<br><br>A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.":"A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.",U.appendChild(V),E.appendChild(U),u.push(E);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=k,H.setAttribute("tabindex","0"),H.setAttribute("role","button"),H.setAttribute("aria-label",k),H.appendChild(Y);const W=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:v.theme.selectedTextColor}));H.appendChild(W),H.addEventListener("click",()=>{window.location.href=x}),H.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),window.location.href=x)}),G.appendChild(H),u.push(G);const X=document.createElement("div");X.classList.add("checkout-completed-section-container");const $=document.createElement("div");$.classList.add("checkout-completed-help-section"),X.appendChild($);const tt=document.createElement("p");tt.textContent="Questions about your order? Contact us at ";const et=document.createElement("a");et.href="mailto:"+g.supportEmail,et.textContent=g.supportEmail,tt.appendChild(et),$.appendChild(tt);const nt=document.createElement("p"),it=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(nt.textContent="Order placed on "+it,$.appendChild(nt),u.push(X),b.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const i=document.createElement("div");i.classList.add("checkout-legal-message"),i.innerHTML=sanitizeHTML(b.layout.legalMessage.text);const r=document.createElement("div");r.classList.add("checkout-separator"),u.push(e),u.push(i),u.push(r)}if(v.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"general"});u.push(e)}return u}}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 i=e.find(e=>"checkout.customerForm.isSaving"===e.path),r=e.find(e=>"checkout.giftRecipientForm.isSaving"===e.path);(null==i?void 0:i.value)||(null==r?void 0:r.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const e=this.getStoreValue("checkout.isGift")||![];let i;i=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=i}template(){const e=this.getConfigs("global"),i=this.getStoreValue("checkout.isGift"),d=this.store.get("checkout.giftRecipientForm.data"),h=this.store.get("checkout.customerForm.data"),u=this.store.get("checkout.shippingAddress"),g=i?d:h,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}),d.firstName&&(this.giftData.firstName={isValid:!![],value:d.firstName}),d.lastName&&(this.giftData.lastName={isValid:!![],value:d.lastName}),d.email&&(this.giftData.email={isValid:!![],value:d.email}),d.phone&&(this.giftData.phone={isValid:!![],value:d.phone}),d.message&&(this.giftData.message={isValid:!![],value:d.message}),u.address.two&&(this.customerData.addressTwo={isValid:!![],value:u.address.two},this.giftData.addressTwo={isValid:!![],value:u.address.two}),v&&(this.customerData.deliveryInstructions={isValid:!![],value:v},this.giftData.deliveryInstructions={isValid:!![],value:v});const b=this.store.get("checkout.fulfillments")||{},x=Object.values(b).some(e=>e.type===c.ON_DEMAND),k=[],E=document.createElement("div");E.classList.add("delivery-header-container");const _=document.createElement("div");_.classList.add("delivery-header-content");const F=document.createElement("div");F.classList.add("delivery-title-container");const D=document.createElement("h3");D.textContent="Deliver to",D.classList.add("delivery-title");const T=document.createElement("p");T.textContent="Package recipient must be 21+",T.classList.add("delivery-subtitle"),F.appendChild(D),F.appendChild(T),E.appendChild(F),k.push(E);const A=document.createElement("div");A.classList.add("section-form-container");const O=document.createElement("div");O.classList.add("checkout-two-col-container");const z=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:i?_t.firstName:Et.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:g.firstName,onChange:e=>{i?(this.giftData.firstName.value=e,this.pubSub.publishForm(r.GIFT,{fieldName:_t.firstName})):(this.customerData.firstName.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.firstName}))},onValidation:e=>{i?this.giftData.firstName.isValid=e:this.customerData.firstName.isValid=e,this.updateSaveButtonState()}});z.setAttribute("aria-label","First Name Input"),O.appendChild(z);const L=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:i?_t.lastName:Et.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:g.lastName,onChange:e=>{i?(this.giftData.lastName.value=e,this.pubSub.publishForm(r.GIFT,{fieldName:_t.lastName})):(this.customerData.lastName.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.lastName}))},onValidation:e=>{i?this.giftData.lastName.isValid=e:this.customerData.lastName.isValid=e,this.updateSaveButtonState()}});if(L.setAttribute("aria-label","Last Name Input"),O.appendChild(L),A.appendChild(O),!i){const e=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:Et.company,label:"Company (optional)",autocomplete:!![],value:g.company,onChange:async e=>{this.customerData.company.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.company})},onValidation:e=>{this.customerData.company.isValid=e,this.updateSaveButtonState()}});e.setAttribute("aria-label","Company Input"),A.appendChild(e)}const R=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:i?_t.email:Et.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:g.email,onChange:e=>{i?(this.giftData.email.value=e,this.pubSub.publishForm(r.GIFT,{fieldName:_t.email})):(this.customerData.email.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.email}))},onValidation:e=>{i?this.giftData.email.isValid=e:this.customerData.email.isValid=e,this.updateSaveButtonState()}});R.setAttribute("aria-label","Email Input"),A.appendChild(R);const M=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:i?_t.phone:Et.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:g.phone,onChange:e=>{i?(this.giftData.phone.value=e,this.pubSub.publishForm(r.GIFT,{fieldName:_t.phone})):(this.customerData.phone.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.phone}))},onValidation:e=>{i?this.giftData.phone.isValid=e:this.customerData.phone.isValid=e,this.updateSaveButtonState()}});if(M.setAttribute("aria-label","Phone Input"),A.appendChild(M),!i){const e=ComponentFactoryService.createElement({type:s.INPUT,inputType:"birthdate",name:Et.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:g.birthDate,onChange:async e=>{this.customerData.birthDate.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.birthDate})},onValidation:e=>{this.customerData.birthDate.isValid=e,this.updateSaveButtonState()}});e.setAttribute("aria-label","Birthdate Input"),A.appendChild(e)}const j=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:u.formattedAddress,disabled:!![],className:"disabled-input"});j.setAttribute("aria-label","Delivery Address Input"),A.appendChild(j);const N=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:i?_t.addressTwo:Et.addressTwo,label:"Apt, suite, etc. (optional)",value:u.address.two,onChange:e=>{i?(this.giftData.addressTwo.value=e,this.pubSub.publishForm(r.GIFT,{fieldName:_t.addressTwo})):(this.customerData.addressTwo.value=e,this.pubSub.publishForm(r.CUSTOMER,{fieldName:Et.addressTwo}))},onValidation:e=>{i?this.giftData.addressTwo.isValid=e:this.customerData.addressTwo.isValid=e,this.updateSaveButtonState()}});if(N.setAttribute("aria-label","Address Line 2 Input"),A.appendChild(N),i){const i=document.createElement("div");i.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const s=document.createElement("label");s.textContent="Gift Message*",s.setAttribute("for",_t.message);const c=document.createElement("textarea");c.name=_t.message,c.id=_t.message,c.rows=4,c.value=d.message||"",c.setAttribute("aria-label","Gift Message Textarea"),c.addEventListener("input",async e=>{const i=e.target.value;this.giftData.message.value=i,this.giftData.message.isValid=i.length>0,this.pubSub.publishForm(r.GIFT,{fieldName:_t.message}),this.updateSaveButtonState()});const h=document.createElement("p");h.textContent="Your gift message will be emailed to the recipient along with delivery details.",h.classList.add("textarea-message-disclaimer"),i.appendChild(s),i.appendChild(c),i.appendChild(h),A.appendChild(i)}if(x){const r=document.createElement("div");r.classList.add("custom-input","textarea",e.layout.inputFieldStyle);const s=document.createElement("label");s.textContent="Delivery Instructions",s.setAttribute("for","delivery_instructions");const c=document.createElement("textarea");c.id="delivery_instructions",c.name="delivery_instructions",c.rows=4,c.setAttribute("aria-label","Delivery Instructions Textarea"),c.value=v,c.addEventListener("input",async e=>{const r=e.target.value;i?(this.giftData.deliveryInstructions.value=r,this.giftData.deliveryInstructions.isValid=r.length>0):(this.customerData.deliveryInstructions.value=r,this.customerData.deliveryInstructions.isValid=r.length>0)});const d=document.createElement("p");d.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",d.classList.add("textarea-message-disclaimer"),r.appendChild(s),r.appendChild(c),r.appendChild(d),A.appendChild(r)}k.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.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const K=async()=>{i?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",K),this.saveButton.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await K())}),k.push(this.saveButton),this.updateSaveButtonState(),k}}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=[],i=this.getStoreValue("checkout.isGift"),r=this.getStoreValue("checkout.customerForm.data"),s=this.getStoreValue("checkout.giftRecipientForm.data"),c=this.getStoreValue("checkout.shippingAddress"),d=this.getStoreValue("checkout.deliveryInstructions"),h=document.createElement("div");h.classList.add("checkout-summary-form-header");const u=document.createElement("h2");u.textContent=i?"Delivering to "+s.firstName+" "+s.lastName:"Delivering to "+r.firstName+" "+r.lastName,h.appendChild(u);const g=document.createElement("span");g.textContent="Edit",g.setAttribute("aria-label","Edit Delivery Information"),g.setAttribute("role","button"),g.setAttribute("tabindex","0");const l=async()=>{i?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(g.addEventListener("click",l),g.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await l())}),h.appendChild(g),e.push(h),!i&&r.company){const i=document.createElement("p");i.classList.add("checkout-summary-form-line"),i.textContent=r.company,e.push(i)}const v=document.createElement("p");v.classList.add("checkout-summary-form-line"),v.textContent=c.formattedAddress,e.push(v);const b=document.createElement("p");b.classList.add("checkout-summary-form-line"),b.textContent=i?s.email:r.email,e.push(b);const x=document.createElement("p");if(x.classList.add("checkout-summary-form-line"),x.textContent=i?s.phone:r.phone,e.push(x),!i&&r.birthDate){const i=document.createElement("p");i.classList.add("checkout-summary-form-line"),i.textContent=formatISODateToMMDDYYYY(r.birthDate),e.push(i)}if(i){const i=document.createElement("div");i.classList.add("checkout-summary-form-line-container");const r=document.createElement("span");r.classList.add("checkout-summary-form-line-container-label"),r.textContent="Gift Message:",i.appendChild(r);const c=document.createElement("span");c.classList.add("checkout-summary-form-line"),c.textContent=s.message||"No message provided.",i.appendChild(c),e.push(i)}if(d){const i=document.createElement("div");i.classList.add("checkout-summary-form-line-container");const r=document.createElement("span");r.classList.add("checkout-summary-form-line-container-label"),r.textContent="Delivery Instructions:",i.appendChild(r);const s=document.createElement("span");s.classList.add("checkout-summary-form-line"),s.textContent=d||"No instructions provided.",i.appendChild(s),e.push(i)}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 i;const r=e.find(e=>"checkout.giftCards"===e.path),s=e.find(e=>"checkout.loading"===e.path);r&&r.value.length>((null===(i=r.oldValue)||void 0===i?void 0:i.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),s&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const e=this.giftCardInput.getValue().trim(),i=e.length>=3&&e.length<=255,r=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!i||r||Boolean(s)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:e=>{const i=e.toUpperCase(),r=this.giftCardInput;r.setValue(i),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 P=async()=>{const e=this.giftCardInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(e)}catch(i){this.logger.error("Checkout gift card application failed",{giftCardCode:e,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",P),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),P())}),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"),i=this.getConfigs("checkout");let r=null;if(!e){r=document.createElement("button"),r.classList.add("checkout-header-button"),r.setAttribute("aria-label","Back to Cart"),r.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(s.CART)});const e=document.createElement("span");e.innerHTML=ChevronLeftIcon({}),r.appendChild(e)}const c=document.createElement("h1");c.textContent=(null==i?void 0:i.layout.drawerHeaderText)||"Checkout",c.classList.add("checkout-header-title"),c.setAttribute("aria-label","Checkout Page");const d=document.createElement("button");return d.innerHTML=CloseIcon({width:16,height:16}),d.classList.add("checkout-header-button-close"),d.setAttribute("aria-label","Close Checkout"),d.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),r?[r,c,d]:[c,d]}}class CheckoutInformationComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift","checkout.customerForm.isEditing","checkout.giftRecipientForm.isEditing","checkout.paymentForm.isEditing"]})}onStoreWatch(){const e=this.getStoreValue("checkout.isGift"),i=this.getStoreValue("checkout.customerForm.isEditing"),r=this.getStoreValue("checkout.giftRecipientForm.isEditing"),s=this.getStoreValue("checkout.paymentForm.isEditing");e?(this.buyerForm.style.display=i?"block":"none",this.buyerSummary.style.display=i?"none":"block",this.deliveryToForm.style.display=r?"block":"none",this.deliverToSummary.style.display=r?"none":"block"):(this.deliveryToForm.style.display=i?"block":"none",this.deliverToSummary.style.display=i?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=s?"block":"none",this.paymentSummary.style.display=s?"none":"block"}template(){const e=[],i=this.getStoreValue("checkout.isGift"),r=this.getStoreValue("checkout.customerForm"),c=this.getStoreValue("checkout.giftRecipientForm"),d=this.getStoreValue("checkout.paymentForm"),h=ComponentFactoryService.createElement({type:s.CHECKOUT_SEND_AS_GIFT});return e.push(h),this.deliveryToForm=ComponentFactoryService.createElement({type:s.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=i?c.isEditing?"block":"none":r.isEditing?"block":"none",e.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:s.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=i?c.isEditing?"none":"block":r.isEditing?"none":"block",e.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:s.CHECKOUT_BUYER}),this.buyerForm.style.display=i&&r.isEditing?"block":"none",e.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:s.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=i&&!r.isEditing?"block":"none",e.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:s.CHECKOUT_PAYMENT}),this.paymentForm.style.display=d.isEditing?"block":"none",e.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:s.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=d.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 i,r,s,c;const d=e.find(e=>"checkout.items"===e.path);d&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const h=e.find(e=>e.path==="checkout.items."+this.params.itemId);if(h){const e=h.oldValue,d=h.value;if(d.updating)return![];const u=(null==e?void 0:e.quantity)!==(null==d?void 0:d.quantity),g=(null===(r=null===(i=null==e?void 0:e.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.lines)||[],v=(null===(c=null===(s=null==d?void 0:d.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.lines)||[],b=JSON.stringify(g)!==JSON.stringify(v);(u||b)&&this.updateEngravingElement(d)}return![]}updateEngravingElement(e){var i,r;const c=this.getConfigs("global"),d=this.container.querySelector(".engraving-view-container");if(d&&d.remove(),(null===(r=null===(i=null==e?void 0:e.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.hasEngraving)===!![]&&c.layout.enablePersonalization){const i=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:e.cartItemId,context:"checkout"}),r=this.container.querySelector(".checkout-item-card-footer");r&&r.before(i)}}setupMinimumPurchaseAlert(){const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return;const i=e.fulfillmentId;if(!i)return;if(!this.container)return;const r=this.container.querySelector(".checkout-item-card-header");if(r){const e=this.getStoreValue("cart.fulfillments."+i),c=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(c&&c.remove(),e.hasUnmetMinimumPurchaseAmount){const i=ComponentFactoryService.createElement({type:s.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(e.minimumPurchaseAmount-e.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:e.subtotal,config:{showIcon:!![],alertType:"minimal"}});i.setAttribute("data-component-type","checkout-retailer-alert"),r.before(i)}}}updateTrashButtonState(){if(!this.trashButton)return;const e=this.getStoreValue("checkout"),i=Object.keys(e.items).length,r=1===i;this.trashButton.disabled=r,r?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 i=document.createElement("div");i.className="cart-loading-spinner-container";const r=document.createElement("div");return r.className="cart-loading-spinner",r.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',i.appendChild(r),e.appendChild(i),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(),i=this.hasLoadingOverlay();e&&!i?this.showLoadingOverlay():!e&&i&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var e,i,r;const c=this.getConfigs("global"),d=this.getStoreValue("checkout.items."+this.params.itemId),h=null===(e=null==d?void 0:d.attributes)||void 0===e?void 0:e.presale,u=(null==h?void 0:h.isActive)&&(null==h?void 0:h.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(h.estimatedShipBy):"";if(!d)return[];const g=this.getStoreValue("checkout.fulfillments."+d.fulfillmentId),v=this.getStoreValue("checkout.retailers."+d.retailerId),b=document.createElement("div");b.classList.add("checkout-item-card-header");const x=document.createElement("div");x.classList.add("checkout-item-image");const k=document.createElement("img");k.src=d.mainImage,k.alt=d.name,k.loading="lazy",x.appendChild(k),b.appendChild(x);const E=document.createElement("div");E.classList.add("checkout-item-details-container");const _=document.createElement("h4");_.classList.add("checkout-item-title"),_.textContent=d.name,E.appendChild(_);const F=document.createElement("div");F.classList.add("checkout-item-subtitle");const D=document.createElement("span");D.textContent=h.isActive?u+",":(d.attributes.engraving.hasEngraving?null==g?void 0:g.engravingExpectation:null==g?void 0:g.expectation)+",",F.appendChild(D);const T=document.createElement("span");T.textContent="From "+((null==v?void 0:v.name)||"Retailer"),F.appendChild(T),E.appendChild(F),b.appendChild(E),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async e=>{var i;if(e.preventDefault(),e.stopPropagation(),!(null===(i=this.trashButton)||void 0===i?void 0:i.disabled))try{await this.commands.checkout.removeItem(d.cartItemId)}catch(r){this.logger.error("Checkout item removal failed",r)}}),b.appendChild(this.trashButton);const A=ComponentFactoryService.createElement({type:s.CHECKOUT_ITEM_QUANTITY,itemId:d.cartItemId}),O=[];if(O.push(b),c.layout.enablePersonalization&&(null===(r=null===(i=null==d?void 0:d.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.hasEngraving)===!![]){const e=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:d.cartItemId,context:"checkout"});O.push(e)}return O.push(A),O}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 i=e.find(e=>"checkout.items"===e.path);if(i){const e=this.calculateQuantityLimits();this.updateButtonStates(e)}}getAvailableQuantity(){var e,i,r;const s=this.getStoreValue("checkout.items."+this.params.itemId);if(!s)return 0;const c=this.getStoreValue("products");if(!c)return 0;const d=s.partNumber,h=s.fulfillmentId,u=null===(r=null===(i=null===(e=Object.values(c).find(e=>e.sizes[s.liquidId]))||void 0===e?void 0:e.sizes)||void 0===i?void 0:i[s.liquidId])||void 0===r?void 0:r.maxQuantityPerOrder;if(!u)return 0;const g=this.getStoreValue("checkout.items")||{},v=Object.values(g).filter(e=>e.partNumber===d&&e.fulfillmentId===h),b=v.reduce((e,i)=>e+i.quantity,0);return u-b}calculateQuantityLimits(){var e;const i=this.getStoreValue("checkout.items."+this.params.itemId);if(!i)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const r=this.getStoreValue("checkout"),s=1===(null===(e=Object.values(r.items))||void 0===e?void 0:e.length),c=i.quantity,d=this.getAvailableQuantity(),h=d>0,u=!(s&&1===c);return{currentQuantity:c,availableQuantity:d,isTheOnlyItem:s,canIncrease:h,canDecrease:u}}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 i=this.calculateQuantityLimits(),r=this.params.itemId;if((!(e<0)||i.canDecrease)&&(!(e>0)||i.canIncrease)){if(!r)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(r,e)}catch(s){this.logger.error("Checkout item quantity change operation failed",s)}}}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 i=this.calculateQuantityLimits(),r=document.createElement("div");r.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)}),r.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),r.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)}),r.appendChild(this.increaseButton),this.updateButtonStates(i);const s=document.createElement("span");if(s.classList.add("checkout-item-price-text"),s.textContent=formatCentToDollarText(e.price),e.quantity>1){const i=document.createElement("span");i.classList.add("checkout-item-price-each-text"),i.textContent=" ("+formatCentToDollarText(e.unitPrice)+" ea)",s.appendChild(i)}return[r,s]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]}),this.togglerElement=null,this.togglerButton=null,this.togglerLabel=null,this.itemsList=null}createItemElement(e){return ComponentFactoryService.createElement({type:s.CHECKOUT_ITEM,itemId:e})}getCurrentItemsMap(){const e=this.getStoreValue("checkout.items")||{},i=new Map;for(const r of Object.values(e))r&&r.cartItemId&&i.set(r.cartItemId,r);return i}syncItemsWithStore(){if(!this.itemsList)return;const e=this.getCurrentItemsMap(),i=this.itemsList.querySelectorAll("[data-item-id]"),r=new Set;for(const s of i){const e=s.getAttribute("data-item-id");e&&r.add(e)}for(const s of i){const i=s.getAttribute("data-item-id");i&&!e.has(i)&&s.remove()}for(const[s]of e)if(!r.has(s)){const e=this.createItemElement(s);e.setAttribute("data-item-id",s),this.itemsList.appendChild(e)}if(this.togglerLabel){const e=this.getStoreValue("checkout.itemsQuantity");this.togglerLabel.textContent=e+" item"+(e>1?"s":"")}}onStoreChanged(e){let i=null;for(let r=0;r<e.length;r++){const s=e[r];if("checkout"===s.path||"checkout.items"===s.path||"checkout.items."===s.path.substring(0,15)){i=s;break}}return i?(this.syncItemsWithStore(),![]):![]}handleToggle(){if(!this.togglerButton||!this.itemsList)return;const e=this.itemsList.classList.contains("show");this.itemsList.classList.toggle("show"),this.togglerButton.classList.toggle("expanded"),e?(this.togglerButton.setAttribute("aria-expanded","false"),this.togglerButton.setAttribute("aria-label","Expand checkout items")):(this.togglerButton.setAttribute("aria-expanded","true"),this.togglerButton.setAttribute("aria-label","Collapse checkout items"))}setupToggler(){if(!this.togglerElement||!this.togglerButton||!this.itemsList)return;const e=this.itemsList.classList.contains("show");this.togglerButton.setAttribute("tabindex","0"),this.togglerButton.setAttribute("aria-expanded",e?"true":"false"),this.togglerButton.setAttribute("aria-label",e?"Collapse checkout items":"Expand checkout items"),this.togglerElement.addEventListener("click",()=>this.handleToggle()),this.togglerElement.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleToggle())})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const e=this.getStoreValue("checkout.itemsQuantity"),i=this.getStoreValue("checkout.items");this.togglerElement=document.createElement("div"),this.togglerElement.classList.add("checkout-items-toggler"),this.togglerLabel=document.createElement("span"),this.togglerLabel.classList.add("checkout-items-toggler-label"),this.togglerLabel.textContent=e+" item"+(e>1?"s":""),this.togglerElement.appendChild(this.togglerLabel),this.togglerButton=document.createElement("button"),this.togglerButton.type="button",this.togglerButton.classList.add("checkout-items-toggler-button"),this.togglerButton.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),this.togglerElement.appendChild(this.togglerButton),this.itemsList=document.createElement("div"),this.itemsList.classList.add("checkout-items-list","show");for(const r of Object.values(i)){const e=this.createItemElement(r.cartItemId);e.setAttribute("data-item-id",r.cartItemId),this.itemsList.appendChild(e)}return[this.togglerElement,this.itemsList]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(e){const i=e.find(e=>"checkout.amounts"===e.path);if(i){const e=this.getStoreValue("checkout"),i=Object.values(e.items||{}).length;this.updateZeroAmountElement(0===e.amounts.total&&i>0)}}updateZeroAmountElement(e){const i=this.container.querySelector(".checkout-zero-amount-container");if(e&&!i){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 i=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");i&&i.after(e)}else!e&&i&&i.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 i=e.classList.contains("checked");e.setAttribute("aria-checked",i?"true":"false")}handleSmsToggle(e){this.commands.checkout.toggleMarketingPreferences("canSms"),e.classList.toggle("checked");const i=e.classList.contains("checked");e.setAttribute("aria-checked",i?"true":"false")}marketingOptInsContainer(){const e=this.config.layout.emailOptIn,i=this.config.layout.smsOptIn;if(!e.show&&!i.show)return null;const r=document.createElement("div");if(r.classList.add("checkout-marketing-opt-ins-container"),e.show){const i=document.createElement("div");let s;i.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?e.checked:this.store.get("checkout.marketingPreferences.canEmail");const c=document.createElement("span");c.id="emailOptIn",c.classList.add("checkout-checkbox-visual"),s&&c.classList.add("checked"),c.innerHTML=CheckboxIcon({width:16,height:16}),c.setAttribute("role","checkbox"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","Email opt-in checkbox"),c.setAttribute("aria-checked",s?"true":"false"),c.addEventListener("click",()=>this.handleEmailToggle(c)),c.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleEmailToggle(c))});const d=document.createElement("label");d.setAttribute("for","emailOptIn"),d.classList.add("checkbox-label"),d.innerHTML=sanitizeHTML(e.text),d.addEventListener("click",e=>{const i=e.target,r="A"===i.tagName||i.closest("a");r||(this.commands.checkout.toggleMarketingPreferences("canEmail"),c.classList.toggle("checked"))}),i.appendChild(c),i.appendChild(d),r.appendChild(i)}if(i.show){const e=document.createElement("div");let s;e.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?i.checked:this.store.get("checkout.marketingPreferences.canSms");const c=document.createElement("span");c.classList.add("checkout-checkbox-visual"),c.id="smsOptIn",s&&c.classList.add("checked"),c.innerHTML=CheckboxIcon({width:16,height:16}),c.setAttribute("role","checkbox"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","SMS opt-in checkbox"),c.setAttribute("aria-checked",s?"true":"false"),c.addEventListener("click",()=>this.handleSmsToggle(c)),c.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleSmsToggle(c))});const d=document.createElement("label");d.setAttribute("for","smsOptIn"),d.classList.add("checkbox-label"),d.innerHTML=sanitizeHTML(i.text),d.addEventListener("click",e=>{const i=e.target,r="A"===i.tagName||i.closest("a");r||(this.commands.checkout.toggleMarketingPreferences("canSms"),c.classList.toggle("checked"))}),e.appendChild(c),e.appendChild(d),r.appendChild(e)}return r}hasOnDemandOrder(){const e=this.getStoreValue("checkout.fulfillments")||{};return Object.values(e).some(e=>e.type===c.ON_DEMAND)}template(){var e;const i=[],r=this.getConfigs("global"),c=this.getConfigs("checkout"),d=this.getConfigs("global"),h=c.layout.allowGiftCards,u=null===(e=null==d?void 0:d.layout)||void 0===e?void 0:e.allowPromoCodes,g=document.createElement("div");g.classList.add("section-title-container");const v=document.createElement("h3");v.textContent="Order Summary",v.classList.add("section-title"),g.appendChild(v),i.push(g);const b=ComponentFactoryService.createElement({type:s.CHECKOUT_ITEMS});i.push(b);const x=document.createElement("div");x.classList.add("checkout-separator");const k=document.createElement("div");if(k.classList.add("checkout-separator"),i.push(x),h||u){const e=ComponentFactoryService.createElement({type:s.CHECKOUT_PC_GC});i.push(e)}if(this.hasOnDemandOrder()){const e=ComponentFactoryService.createElement({type:s.CHECKOUT_TIPS});i.push(e),i.push(k)}const E=document.createElement("div");E.classList.add("section-title-container");const _=document.createElement("h3");_.textContent="100% Secure Payments",_.classList.add("disclaimer-header"),E.appendChild(_);const F=document.createElement("p");F.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",F.classList.add("disclaimer-description"),E.appendChild(F),i.push(E);const D=ComponentFactoryService.createElement({type:s.CHECKOUT_AMOUNTS});i.push(D);const T=ComponentFactoryService.createElement({type:s.CHECKOUT_PLACE_ORDER_BUTTON});i.push(T);const A=this.marketingOptInsContainer();if(A&&i.push(A),c.layout.legalMessage.show){const e=document.createElement("div");e.classList.add("checkout-separator");const r=document.createElement("div");r.classList.add("checkout-legal-message"),r.innerHTML=sanitizeHTML(c.layout.legalMessage.text),i.push(e),i.push(r)}const O=document.createElement("div");if(O.classList.add("checkout-separator"),i.push(O),r.layout.showPoweredBy){const e=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"checkout"});i.push(e)}return i}}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 i of e)switch(i.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=i.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(i.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=!![],i="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)i="Saving...",e=!![];else if(this.stripeFormStatus.hasError)i="Fix Errors and Retry",e=![];else if(this.showingStripeSummary&&this.savedCardInfo){const i=this.isBillingSameAsShipping||this.isValidBillingForm;e=!i}else{const i=this.stripeFormStatus.isFormComplete,r=this.isBillingSameAsShipping||this.isValidBillingForm;e=!(i&&r)}this.saveButton.disabled=e,this.saveButton.textContent=i,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=[],i=document.createElement("div");i.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Payment",r.classList.add("section-title"),i.appendChild(r);const c=document.createElement("p");if(c.textContent="All transactions are secure and encrypted.",c.classList.add("section-subtitle"),i.appendChild(c),e.push(i),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const i=document.createElement("p");i.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(i),e.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:s.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,i)=>{const r={paymentSession:{confirmationTokenId:e,setupIntentId:i}};!this.isBillingSameAsShipping&&this.billingFormData&&(r.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(r)}}}),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 d=ComponentFactoryService.createElement({type:s.CHECKOUT_BILLING,isFormValid:(e,i)=>{this.billingFormData=i,this.isValidBillingForm=e,this.updateSaveButtonState(),this.updateErrorMessage()}});return e.push(d),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(i){this.logger.error("Failed to save payment form in edit mode",i),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(r){this.logger.error("Failed to save payment form in beta mode",r),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,i,r,s,c,d,h,u,g;const v=[],b=this.getStoreValue("checkout.paymentForm"),x=document.createElement("div");x.classList.add("checkout-summary-form-header");const k=document.createElement("h2");k.textContent="Paying with "+(null!==(r=null===(i=null===(e=b.paymentMethod)||void 0===e?void 0:e.card)||void 0===i?void 0:i.brand)&&void 0!==r?r:"")+" "+(null===(c=null===(s=b.paymentMethod)||void 0===s?void 0:s.card)||void 0===c?void 0:c.last4),x.appendChild(k);const E=document.createElement("span");E.textContent="Edit",E.setAttribute("aria-label","Edit Payment Information"),E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),E.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.editPaymentForm())}),x.appendChild(E),v.push(x);const _=document.createElement("p");return _.classList.add("checkout-summary-form-line"),_.textContent="Exp. "+(null===(h=null===(d=b.paymentMethod)||void 0===d?void 0:d.card)||void 0===h?void 0:h.expMonth)+"/"+(null===(g=null===(u=b.paymentMethod)||void 0===u?void 0:u.card)||void 0===g?void 0:g.expYear),v.push(_),v}}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 i=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);i&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const e=this.store.get("checkout.loading")||![],i=this.store.get("checkout.error")||null;this.updateErrorDisplay(i);const r=this.determineButtonState({isCheckoutLoading:e,hasCheckoutError:!!i});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(r.state),this.placeOrderButton.disabled=r.disabled,this.placeOrderButton.textContent=r.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(e){if(!this.errorContainer)return;const i=this.errorContainer.querySelector(".error-text");i&&(this.clearErrorTimeout(),e?(i.textContent=e,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(i.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:e,hasCheckoutError:i}){const r=this.config.layout.placeOrderButtonText,s=this.store.get("checkout.presale");let c=![];if(!s){const e=this.getStoreValue("cart.fulfillments")||{};c=Object.values(e).some(e=>e.hasUnmetMinimumPurchaseAmount)}const d=this.store.get("checkout.isGift"),h=this.store.get("checkout.customerForm.isValid"),u=this.store.get("checkout.giftRecipientForm.isValid"),g=this.store.get("checkout.paymentForm.isValid");return c||d&&!u||!h||!g?{state:"disabled",text:r,disabled:!![]}:e?{state:"processing",text:"Placing Order...",disabled:!![]}:i?{state:"disabled",text:r,disabled:!![]}:{state:"ready",text:r,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 i=document.createElement("div");i.classList.add("checkout-error-wrapper"),i.setAttribute("role","alert"),i.style.display="none";const r=document.createElement("div");r.classList.add("checkout-error");const c=document.createElement("span");c.classList.add("icon-error"),c.innerHTML=ErrorInfoIcon({});const d=document.createElement("span");d.classList.add("error-text"),r.appendChild(c),r.appendChild(d),i.appendChild(r);const h=ComponentFactoryService.createElement({type:s.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[i,h,e]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.initialDurationSeconds=null,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(e){var i;const r=e.find(e=>"checkout.presale"===e.path);if(null==r?void 0:r.value)return this.updateExpiresAt(r.value.expiresAt),!![];const s=e.find(e=>"ui.drawer"===e.path);return(null===(i=null==s?void 0:s.value)||void 0===i?void 0:i.isOpen)===![]&&this.resetCountdownState(),![]}resetCountdownState(){this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}afterRender(){const e=this.store.get("checkout.presale");(null==e?void 0:e.expiresAt)&&this.updateExpiresAt(e.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){if(this.scrollContainer=this.findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;const e=70,i=10;this.scrollHandler=()=>{if(!this.scrollContainer)return;const r=this.scrollContainer.scrollTop;!this.isCurrentlyScrolled&&r>e?this.setScrolledState(!![]):this.isCurrentlyScrolled&&r<i&&this.setScrolledState(![])},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}findScrollContainer(){var e,i;const r=[".drawer-content"];for(const c of r){const i=null===(e=this.rootElement)||void 0===e?void 0:e.closest(c);if(i&&this.isScrollable(i))return i}let s=null===(i=this.rootElement)||void 0===i?void 0:i.parentElement;for(;s&&s!==document.body;){if(this.isScrollable(s))return s;s=s.parentElement}return null}setScrolledState(e){var i,r;this.isCurrentlyScrolled=e,e?(null===(i=this.rootElement)||void 0===i?void 0:i.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):(null===(r=this.rootElement)||void 0===r?void 0:r.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))}isScrollable(e){const i=window.getComputedStyle(e),r=i.overflowY;return e.scrollHeight>=e.clientHeight&&("auto"===r||"scroll"===r||"overlay"===r)}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 i=new Date,r=Math.floor((this.expiresAt.getTime()-i.getTime())/1e3);this.initialDurationSeconds=Math.min(r,CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS),this.startCountdown()}catch(i){this.logger.error("Failed to parse presale expiration date",i),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement||!this.initialDurationSeconds)return;const e=new Date,i=Math.max(0,this.expiresAt.getTime()-e.getTime()),r=i/1e3,s=this.initialDurationSeconds-r,c=Math.max(0,Math.min(100,s/this.initialDurationSeconds*100)),d=r<CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS;d!==this.isUnderOneMinute&&(this.isUnderOneMinute=d,this.updateWarningState()),this.updateTimerDisplay(i),this.updateProgressBar(c),0===i&&this.handleExpire()}updateWarningState(){if(!this.rootElement)return;const e=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==e||e.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==e||e.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}updateTimerDisplay(e){if(!this.rootElement)return;const i=this.rootElement.querySelector("[data-timer]");i&&(i.textContent=this.formatTime(e))}updateProgressBar(e){if(!this.rootElement)return;const i=this.rootElement.querySelector("[data-progress-fill]");i&&(i.style.width=e+"%")}formatTime(e){const i=Math.floor(e/1e3),r=Math.floor(i/60),s=i%60,c=Math.floor(e%1e3/10);return r.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")+":"+c.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 i=this.createTextContainer(),r=this.createProgressBar();return e.appendChild(i),e.appendChild(r),e}createTextContainer(){const e=document.createElement("div");e.classList.add("checkout-presale-text-container");const i=this.createHeader(),r=this.createSubtitle();return e.appendChild(i),e.appendChild(r),e}createHeader(){const e=document.createElement("div");e.classList.add("checkout-presale-heading");const i=document.createElement("h2");i.textContent="LIMITED PRE-ORDER:";const r=document.createElement("div");return r.classList.add("checkout-presale-timer"),r.setAttribute("data-timer",""),r.textContent="00:00:00",e.appendChild(i),e.appendChild(r),e}createSubtitle(){const e=document.createElement("p");return e.classList.add("checkout-presale-subtitle"),e.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",e}createProgressBar(){const e=document.createElement("div");e.className="checkout-presale-progress-bar",e.setAttribute("data-progress","");const i=document.createElement("div");return i.className="checkout-presale-progress-fill",i.setAttribute("data-progress-fill",""),i.style.width="0%",e.appendChild(i),e}}CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS=300,CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS=60,CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS=10;class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}isItemsUnavailable(){var e;return"items_unavailable"===(null===(e=this.params)||void 0===e?void 0:e.reason)}isTimeExpired(){var e,i;return"time_expired"===(null===(e=this.params)||void 0===e?void 0:e.reason)||!(null===(i=this.params)||void 0===i?void 0:i.reason)}afterRender(){this.isTimeExpired()&&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=[],i=this.getConfigs("global"),r=document.createElement("div");r.classList.add("checkout-completed-section-container");const c=document.createElement("div");c.classList.add("checkout-completed-title-section");const d=document.createElement("div");d.classList.add("checkout-completed-title-section");const h=document.createElement("p");h.classList.add("presale-expired-title");const u=document.createElement("p"),g=document.createElement("div");g.classList.add("checkout-completed-help-section"),this.isItemsUnavailable()&&(h.textContent="Items No Longer Available",u.textContent="The presale items you were trying to purchase are no longer available.",g.textContent="These items may have sold out or are no longer part of the presale. Please check our catalog for other available products."),this.isTimeExpired()&&(h.textContent="Session Expired",u.textContent="Your reservation time has ended. The item has been released for other customers.",g.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available."),d.appendChild(h),d.appendChild(u),c.appendChild(d),r.appendChild(c),r.appendChild(g),e.push(r);const v=document.createElement("div");v.classList.add("checkout-completed-section-container");const b=document.createElement("button");b.setAttribute("aria-label","Continue shopping"),b.type="button";const x=document.createElement("span");x.textContent="Continue Shopping",b.setAttribute("tabindex","0"),b.setAttribute("role","button"),b.setAttribute("aria-label","Continue Shopping"),b.appendChild(x);const k=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:i.theme.selectedTextColor}));if(b.appendChild(k),b.addEventListener("click",()=>this.handleExit()),b.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleExit())}),v.appendChild(b),e.push(v),this.isTimeExpired()){const i=document.createElement("div");i.classList.add("checkout-completed-section-container");const r=document.createElement("p");r.classList.add("checkout-completed-auto-close-text"),r.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 s=document.createElement("span");s.classList.add("checkout-completed-auto-close-text"),s.textContent="seconds",i.appendChild(r),i.appendChild(this.autoCloseElement),i.appendChild(s),e.push(i)}if(i.layout.showPoweredBy){const i=document.createElement("div");i.classList.add("checkout-completed-powered-by-container");const r=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"checkout"});i.appendChild(r),e.push(i)}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 i=e.find(e=>"checkout.promoCode"===e.path),r=e.find(e=>"checkout.loading"===e.path);if(i){const{value:e,oldValue:r}=i,s=Boolean(r),c=Boolean(e);if(!s&&c)return this.container.innerHTML="",this.createAppliedContainer(e),void 0;if(s&&!c)return this.container.innerHTML="",this.createInputContainer(),void 0;c&&this.promoCodeText&&e.discount!==(null==r?void 0:r.discount)&&(this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discount)+")")}r&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const e=this.promoInput.getValue().trim(),i=e.length>=3&&e.length<=255,r=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.promoCode"),c=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!i||r||Boolean(s)||Boolean(c)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:e=>{const i=e.toUpperCase(),r=this.promoInput;r.setValue(i),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const P=async()=>{const e=this.promoInput.getValue().trim().toUpperCase();if(e)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(e)}catch(i){this.logger.error("Checkout promo code application failed",{promoCode:e,error:i instanceof Error?i.message:String(i)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",P),this.applyButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),P())}),this.applyButton}createAppliedContainer(e){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==e?void 0:e.code)+" (- "+formatCentToDollarText((null==e?void 0:e.discount)||0)+")";const r=document.createElement("button");r.type="button",r.classList.add("remove-button"),r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),i.appendChild(this.promoCodeText),i.appendChild(r),this.container.appendChild(i),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const e=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,e){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=e.code+" (- "+formatCentToDollarText(e.discount)+")";const r=document.createElement("button");return r.type="button",r.classList.add("remove-button"),r.textContent="Remove",r.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),i.appendChild(this.promoCodeText),i.appendChild(r),i}const i=[];return i.push(this.createPromoInput()),i.push(this.createApplyButton()),i}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"),i=document.createElement("div");i.classList.add("gift-label-wrapper");const r=document.createElement("span");r.textContent="Send as Gift? (Free)",r.classList.add("gift-toggle-label"),i.appendChild(r);const s=document.createElement("span");s.textContent="With personalized note & gift receipt.",s.classList.add("gift-toggle-description"),i.appendChild(s);const c=document.createElement("div");c.classList.add("toggle-switch"),c.classList.toggle("active",e);const d=document.createElement("div");return d.classList.add("toggle-slider"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","Toggle Gift Option"),c.setAttribute("role","switch"),c.setAttribute("aria-checked",e?"true":"false"),c.appendChild(d),c.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),c.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await this.commands.checkout.toggleIsGift())}),[i,c]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.A=![],this.O=null,this.L=null,this.R=null,this.M=![],this.j=![],this.N=![],this.B=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.L=this.O.elements({clientSecret:e.clientSecret,appearance:e.appearance}),this.R=this.L.create("payment",e.elementOptions),this.R.mount(this),this.R.on("change",async e=>{const i=!!e.error,r=e.complete,s=i?e.error.message:null;this.j=r,this.M||await this.updateStripeFormStatus({isFormComplete:r,isProcessing:![],hasCompletedPayment:![],errorMessage:s,hasError:i})}),this.R.on("focus",async()=>{this.M||await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.N=![]}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:i}=e.detail;i&&(this.q=i,await this.refreshPaymentSession())}async handleSubmit(){var e,i;if(this.M)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.j)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.M=!![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.N&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const e=await this.createConfirmationTokenId(),i=this.q.clientSecret,r=i.split("_secret_")[0];this.N=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:e,setupIntentId:r},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(r){console.error("Payment submission error:",r),this.N=!![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==r?void 0:r.message)||"Payment processing failed. Please try again."}),((null===(e=null==r?void 0:r.message)||void 0===e?void 0:e.includes("expired"))||(null===(i=null==r?void 0:r.message)||void 0===i?void 0:i.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.M=![]}}async requestSessionRefresh(){return this.B||(this.B=new Promise((e,i)=>{const r=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",a),this.B=null,i(new Error("Session refresh timeout"))},1e4),a=()=>{clearTimeout(r),this.removeEventListener("lce:s:refreshSession",a),this.B=null,e()};this.addEventListener("lce:s:refreshSession",a,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.B}async refreshPaymentSession(){try{this.L&&this.L.update({clientSecret:this.q.clientSecret}),this.N=![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(yt){console.error("Failed to refresh payment session:",yt),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.R&&this.R.clear(),this.j=![],this.N=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(yt){console.error("Failed to reset form:",yt)}}async updateStripeFormStatus(e){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:e},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.L)throw new SDKError("Payment elements not initialized");try{const{error:e}=await this.L.submit();if(e)throw new SDKError(e.message||"Failed to submit payment information");const i={elements:this.L,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:r,confirmationToken:s}=await this.O.createConfirmationToken(i);if(r)throw new SDKError(r.message||"Failed to create confirmation token");if(!s||!s.id)throw new SDKError("Invalid confirmation token received");return s.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,i;try{this.B=null,this.R&&(this.R.unmount(),this.R=null),this.L&&(null===(i=(e=this.L).destroy)||void 0===i?void 0:i.call(e),this.L=null),this.O=null,this.M=![],this.j=![],this.N=![],this.A=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(r){console.warn("Error during Stripe form cleanup:",r)}}loadStripeJS(){return new Promise((e,i)=>{const r=document.querySelector('script[src*="stripe.com"]');if(r)return r.addEventListener("load",()=>e()),r.addEventListener("error",()=>i(new Error("Failed to load Stripe.js"))),void 0;const s=document.createElement("script");s.src="https://js.stripe.com/basil/stripe.js",s.async=!![],s.onload=()=>e(),s.onerror=()=>i(new Error("Failed to load Stripe.js")),document.head.appendChild(s)})}}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 i of e)switch(i.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(i.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(i.value)}}handleSavedCardChange(e){var i,r,s,c;(null===(i=null==e?void 0:e.card)||void 0===i?void 0:i.brand)&&(null===(r=null==e?void 0:e.card)||void 0===r?void 0:r.last4)?this.savedCardInfo={brand:e.card.brand,last4:e.card.last4}:this.savedCardInfo=null,null===(c=(s=this.callbacks).onSavedCardInfoChanged)||void 0===c||c.call(s,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(e){this.isInEditMode=e,this.updateDisplayState()}updateDisplayState(){var e,i,r,s,c,d;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(i=(e=this.callbacks).onEditModeVisibilityChanged)||void 0===i||i.call(e,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(s=(r=this.callbacks).onEditModeVisibilityChanged)||void 0===s||s.call(r,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(e=>{this.logger.error("Failed to create stripe form in updateDisplayState",e)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(d=(c=this.callbacks).onEditModeVisibilityChanged)||void 0===d||d.call(c,![]))}async afterRender(){var e,i,r,s;this.isInEditMode=null!==(e=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==e?e:![];const c=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(i=null==c?void 0:c.card)||void 0===i?void 0:i.brand)&&c.card.last4&&(this.savedCardInfo={brand:c.card.brand,last4:c.card.last4}),null===(s=(r=this.callbacks).onSavedCardInfoChanged)||void 0===s||s.call(r,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 i,r;this.stripeFormStatus=e.detail.status,null===(r=(i=this.callbacks).onStripeFormStatusChanged)||void 0===r||r.call(i,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async e=>{var i,r,s,c,d;try{const{confirmationTokenId:s,setupIntentId:c}=e.detail;await(null===(r=(i=this.callbacks).onPaymentSessionConfirmed)||void 0===r?void 0:r.call(i,s,c)),this.isChangingPayment=![]}catch(h){this.logger.error("Failed to save payment form",h),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==h?void 0:h.message)||"Failed to save payment information. Please try again."},null===(c=(s=this.callbacks).onStripeFormStatusChanged)||void 0===c||c.call(s,this.stripeFormStatus),null===(d=this.stripeFormElement)||void 0===d||d.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var e;try{const i=await this.doStripeConfig();null===(e=this.stripeFormElement)||void 0===e?void 0:e.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:i}}))}catch(i){this.logger.error("Failed to refresh payment session",i)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const e=document.createElement("span");e.classList.add("stripe-summary-text"),e.textContent=(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const i=document.createElement("button");i.type="button",i.classList.add("change-payment-link"),i.textContent="Change",i.setAttribute("aria-label","Change Payment Method"),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.addEventListener("click",()=>this.handleChangePayment()),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handleChangePayment())}),this.stripeSummaryContainer.append(e,i),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,i;this.isChangingPayment=!![],this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(i=(e=this.callbacks).onStripeFormStatusChanged)||void 0===i||i.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 i=document.createElement("slot");return i.setAttribute("name",St),this.stripeFormContainer.appendChild(i),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,i=null;for(;e&&e!==document.body;){const r=e.hasAttribute("checkout"),c=e.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(s.LCE_ELEMENT),d=e.hasAttribute("drawer"),h=(null==i?void 0:i.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(s.DRAWER),u="checkout"===(null==i?void 0:i.getAttribute("data-target"));if(r||c&&d&&h&&u)return this.rootComponent=e,e;i=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 i=this.store.get("checkout.paymentForm.paymentSession"),r=this.getConfigs("global");return{publishableKey:i.key,clientSecret:i.secret,appearance:{theme:"dark"===r.layout.poweredByMode?"night":"stripe",variables:{fontFamily:r.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:r.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===r.layout.inputFieldStyle?"none":"1px solid "+r.theme.accentColor,backgroundColor:"filled"===r.layout.inputFieldStyle?r.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,i,r;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 c=this.findRootComponent();if(!c)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 d=c.querySelectorAll('[slot="'+St+'"]');if(d.length>0)for(const s of d)s.remove();this.isCreatingStripeForm=!![];try{const e=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:s.CHECKOUT_STRIPE_FORM,stripeConfig:e}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",St),c.appendChild(this.stripeFormElement)}catch(h){this.logger.error("Stripe form element creation failed",h),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(r=(i=this.callbacks).onStripeFormStatusChanged)||void 0===r||r.call(i,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var e;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(e=super.disconnected)||void 0===e||e.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.fulfillments","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const e=this.getStoreValue("checkout.tipSelection");return null!=e?e:10}getOnDemandFulfillments(){const e=this.getStoreValue("checkout.fulfillments")||{};return Object.values(e).filter(e=>e.type===c.ON_DEMAND)}getRetailerNameForFulfillment(e){const i=this.getStoreValue("checkout.items")||{},r=this.getStoreValue("checkout.retailers")||{},s=Object.values(i).find(i=>i.fulfillmentId===e);if(!s)return"Retailer";const c=r[s.retailerId];return(null==c?void 0:c.name)||"Retailer"}async handlePercentageSelect(e){const i=this.getStoreValue("checkout.updating")||![];if(!i)try{await this.commands.checkout.updateTips(e)}catch(r){this.logger.error("Checkout tips update failed",r)}}async handleFulfillmentTipInput(e,i){const r=this.getStoreValue("checkout.updating")||![];if(r)return;const s=this.getOnDemandFulfillments();if(!s.find(i=>i.id===e))return;const c=Math.round(100*i);try{await this.commands.checkout.updateFulfillmentTip(e,c)}catch(d){this.logger.error("Checkout fulfillment tip update failed",d)}}async removeTipFromFulfillment(e){const i=this.getStoreValue("checkout.updating")||![];if(i)return;const r=this.getOnDemandFulfillments();if(r.find(i=>i.id===e))try{await this.commands.checkout.removeFulfillmentTip(e)}catch(s){this.logger.error("Checkout fulfillment tip removal failed",s)}}createTipSelectionButtons(){const e=document.createElement("div");e.classList.add("checkout-tip-selection-container");const i=[10,18,20],r=this.getStoreValue("checkout.updating")||![],s=this.getTipSelection();for(const c of i){const i=document.createElement("button");i.type="button",i.textContent=c+"%",i.classList.add("checkout-tip-button"),i.disabled=r,s===c&&i.classList.add("selected"),i.addEventListener("click",()=>this.handlePercentageSelect(c)),e.appendChild(i)}return e}setupToggler(){const e=this.container.querySelector(".checkout-tip-distribution-header"),i=this.container.querySelector(".checkout-items-toggler-button"),r=this.container.querySelector(".retailers-tips-list");e&&i&&r&&e.addEventListener("click",()=>{const e=r.classList.contains("show");r.classList.toggle("show"),e?(i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label","Expand tips section")):(i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label","Collapse tips section")),i.classList.toggle("expanded")})}createTipDistribution(){const e=document.createElement("section");e.classList.add("checkout-tip-distribution-container");const i=this.getOnDemandFulfillments();if(0===i.length)return e;const r=document.createElement("div");r.classList.add("checkout-tip-distribution-header");const s=document.createElement("h3");s.textContent="View Tip Distribution",s.classList.add("checkout-sub-header"),r.appendChild(s);const c=document.createElement("button");c.type="button",c.classList.add("checkout-items-toggler-button"),c.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),r.appendChild(c),e.appendChild(r);const d=document.createElement("div");d.classList.add("retailers-tips-list","show");for(const h of i){const e=document.createElement("div");e.classList.add("checkout-tip-distribution-item");const i=document.createElement("h4");i.textContent=this.getRetailerNameForFulfillment(h.id),i.classList.add("checkout-sub-header"),e.appendChild(i);const r=document.createElement("div");r.classList.add("checkout-tip-fulfillment-input-wrapper");const s=document.createElement("div");s.classList.add("dollar-input-container");const c=document.createElement("span");c.classList.add("dollar-sign"),c.textContent="$";const u=document.createElement("input");let g;u.type="number",u.id="tip-input-"+h.id,u.name="tip-"+h.id,u.min="0",u.step="0.01",u.placeholder="0.00",u.classList.add("dollar-input"),u.value=h.amounts.tip>0?(h.amounts.tip/100).toFixed(2):"",u.disabled=this.getStoreValue("checkout.updating")||![],u.addEventListener("wheel",e=>{e.preventDefault()}),u.addEventListener("keydown",e=>{"-"!==e.key&&"+"!==e.key||e.preventDefault()}),u.addEventListener("keydown",e=>{"ArrowUp"!==e.key&&"ArrowDown"!==e.key||e.preventDefault()}),u.addEventListener("paste",e=>{e.preventDefault()}),u.addEventListener("contextmenu",e=>{e.preventDefault()}),u.addEventListener("input",e=>{const i=e.target;let r=i.value;if(Number.parseFloat(r)<0&&(i.value=Math.abs(Number.parseFloat(r)).toString(),r=i.value),r.includes(".")){const e=r.split(".");e.length>1&&e[1].length>2&&(i.value=e[0]+"."+e[1].substring(0,2))}}),u.addEventListener("input",e=>{const i=e.target,r=Number.parseFloat(i.value)||0;g&&clearTimeout(g),g=setTimeout(()=>{this.handleFulfillmentTipInput(h.id,r)},500)}),s.appendChild(c),s.appendChild(u),r.appendChild(s);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(h.id)),r.appendChild(v),e.appendChild(r),d.appendChild(e)}return e.appendChild(d),e}async initializeDefaultTip(){if(this.isInitialized)return;const e=this.getStoreValue("checkout.tipSelection"),i=this.getOnDemandFulfillments();if(e&&i.length>0){const s=i.every(e=>e.amounts.tip>0);if(s)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(e)}catch(r){this.logger.error("Default tip initialization failed",r),this.isInitialized=![]}}if(null==e)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(s){this.logger.error("Default tip initialization failed during fallback",s),this.isInitialized=![]}}template(){const e=[],i=this.getOnDemandFulfillments();if(0===i.length)return e;i.length>0&&this.initializeDefaultTip();const r=document.createElement("section");r.classList.add("checkout-tip-container");const s=document.createElement("h3");s.classList.add("checkout-sub-header"),s.textContent="Add a tip",r.appendChild(s);const c=document.createElement("div");c.classList.add("checkout-tip-config-container");const d=this.createTipSelectionButtons();c.appendChild(d),r.appendChild(c);const h=document.createElement("p");h.classList.add("checkout-tip-disclaimer"),h.textContent="Tips will be split proportionally between retailers.",r.appendChild(h);const u=this.createTipDistribution();return e.push(r,u),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 i,r;const s=e.find(e=>"checkout.giftCardError"===e.path),c=e.find(e=>"checkout.promoCodeError"===e.path),d=e.find(e=>"checkout.giftCards"===e.path);if(d&&this.updateAppliedGiftCards(d.value),s){const e=this.container.querySelector(".input-gift-card-container");if(e){const r=e.nextElementSibling;if((null===(i=null==r?void 0:r.classList)||void 0===i?void 0:i.contains("error-banner-checkout"))&&(null==r?void 0:r.remove()),s.value){const i=this.createErrorElement(s.value);e.after(i)}const c=e.querySelector(".apply-button");c&&(c.disabled=Boolean(s.value))}}if(c){const e=this.container.querySelector(".input-promo-code-container");if(e){const i=e.nextElementSibling;if((null===(r=null==i?void 0:i.classList)||void 0===r?void 0:r.contains("error-banner-checkout"))&&(null==i?void 0:i.remove()),c.value){const i=this.createErrorElement(c.value);e.after(i)}const s=e.querySelector(".apply-button");s&&(s.disabled=Boolean(c.value))}}}updateAppliedGiftCards(e){const i=e&&e.length>0;if(!i)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",e.forEach(e=>{const i=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(i)})}createAppliedGiftCardElement(e){const i=document.createElement("div");i.classList.add("checkout-pc-gc-applied"),i.setAttribute("data-gift-card-code",e.code);const r=document.createElement("span");r.textContent=e.code+" (- "+formatCentToDollarText(e.applied)+")",i.appendChild(r);const s=document.createElement("button");return s.type="button",s.textContent="Remove",s.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(e.code)}),i.appendChild(s),i}inputContainer(){var e;const i=this.getConfigs("checkout"),r=this.getConfigs("global"),c=i.layout.allowGiftCards,d=null===(e=null==r?void 0:r.layout)||void 0===e?void 0:e.allowPromoCodes,h=document.createElement("div");h.classList.add("checkout-pc-gc-sub-container");const u=ComponentFactoryService.createElement({type:s.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]}),g=ComponentFactoryService.createElement({type:s.CHECKOUT_GIFT_CARDS});d&&h.appendChild(u);const v=this.getStoreValue("checkout.promoCodeError");if(v){const e=this.createErrorElement(v);e.classList.add("promo-code-error-wrapper"),h.appendChild(e)}c&&h.appendChild(g);const b=this.getStoreValue("checkout.giftCardError");if(b){const e=this.createErrorElement(b);h.appendChild(e)}return h}createErrorElement(e){const i=document.createElement("div");i.classList.add("error-banner-checkout");const r=document.createElement("div");r.innerHTML=ErrorInfoIcon({});const s=document.createElement("p");return s.textContent=e.toString(),i.appendChild(r),i.appendChild(s),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),i.remove()},3e3),i}template(){const e=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const i=[];return i.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 i=this.createAppliedGiftCardElement(e);this.appliedGiftCardsContainer.appendChild(i)}),i.push(this.appliedGiftCardsContainer)),i}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:e,selectedFulfillmentType:i,isSelected:r,selectedSizeAttributes:s}){var d,h,u,g,v,b;const x=i===c.ON_DEMAND;let k=null;x&&e.hourStatus.openTime&&(null===(d=e.hourStatus)||void 0===d?void 0:d.closeTime)&&(k=e.hourStatus.isOpen?"Closes at "+e.hourStatus.closeTime:"Opens at "+e.hourStatus.openTime);const E=x&&e.hourStatus.isClosed?"closed":"",_=document.createElement("div");_.className="popup-retailer-card "+(r?"selected":"")+" "+E,_.setAttribute("data-fulfillment-id",e.id),_.setAttribute("role","button"),_.setAttribute("tabindex","0"),_.setAttribute("aria-pressed",r?"true":"false");const F=i===c.SHIPPING?"Shipping":"Same-day delivery";_.setAttribute("aria-label",F+" from "+e.retailerName+", "+formatCentToDollarText(null!==(h=e.variant.price)&&void 0!==h?h:0));const D=document.createElement("div");D.className="row";const T=document.createElement("span");T.className="name",T.textContent=e.retailerName,D.appendChild(T);const A=document.createElement("span");A.className="price",A.textContent=formatCentToDollarText(null!==(u=e.variant.price)&&void 0!==u?u:0),D.appendChild(A),_.appendChild(D);const O=document.createElement("div");O.className="row";const z=document.createElement("span");z.className="expectation",z.textContent=e.hourStatus.isClosed?k:(null===(g=null==s?void 0:s.presale)||void 0===g?void 0:g.isActive)?(null===(v=null==s?void 0:s.presale)||void 0===v?void 0:v.isActive)&&(null===(b=null==s?void 0:s.presale)||void 0===b?void 0:b.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==s?void 0:s.presale.estimatedShipBy):"":null==e?void 0:e.expectation,O.appendChild(z);const L=document.createElement("span");if(L.className="fee",L.textContent=e.fee>0?formatCentToDollarText(e.fee):"Free Delivery",O.appendChild(L),_.appendChild(O),x){const i=document.createElement("div");i.className="row";const r=document.createElement("span");r.className="address",r.textContent=e.retailerAddressFormatted,i.appendChild(r),_.appendChild(i)}return _}function renderFulfillmentTabsContainer({shippingFulfillments:e,onDemandFulfillments:i,shippingSelected:r,onDemandSelected:s,onTabClick:d,enableShippingFulfillment:h,enableOnDemandFulfillment:u}){const g=i.length>0,v=document.createElement("div");if(v.className="fulfillment-tabs-container",v.setAttribute("role","tablist"),v.setAttribute("aria-label","Delivery method options"),h){const i=document.createElement("div");i.className="fulfillment-tab "+(r?"selected":""),i.setAttribute("data-fulfillment-type",c.SHIPPING),i.setAttribute("role","tab"),i.setAttribute("tabindex","0"),i.setAttribute("aria-selected",r?"true":"false"),i.setAttribute("aria-label","Shipping, "+e.length+" options"),i.addEventListener("click",d),i.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i.click())});const s=document.createElement("span");s.className="fulfillment-tab-label "+(r?"selected":""),s.textContent="Shipping ("+e.length+")",i.appendChild(s),v.appendChild(i)}if(u){const e=document.createElement("div");e.className="fulfillment-tab "+(s?"selected":"")+" "+(g?"":"disabled"),e.setAttribute("data-fulfillment-type",c.ON_DEMAND),e.setAttribute("role","tab"),e.setAttribute("tabindex","0"),e.setAttribute("aria-selected",s?"true":"false"),e.setAttribute("aria-label","Same-day delivery, "+i.length+" options"),g||e.setAttribute("aria-disabled","true"),e.addEventListener("click",d),e.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),e.click())});const r=document.createElement("span");r.className="fulfillment-tab-label "+(s?"selected":""),r.textContent="Same-Day Delivery ("+i.length+")",e.appendChild(r),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 i=this.getProductId(),r=this.getStoreValue("products."+i);if(!r.selectedFulfillment||!r.selectedSizeId)return 0;const s=r.selectedFulfillment.variant.partNumber,c=r.selectedFulfillment.id,d=null===(e=r.sizes[r.selectedSizeId])||void 0===e?void 0:e.maxQuantityPerOrder;if(!d)return 0;const h=this.getStoreValue("cart.items")||{},u=Object.values(h).filter(e=>e.partNumber===s&&e.fulfillmentId===c),g=u.reduce((e,i)=>e+i.quantity,0);return d-g}isFulfillmentClosed(){const e=this.getProductId(),i=this.getStoreValue("products."+e);return i.selectedFulfillment?i.selectedFulfillmentType===c.ON_DEMAND&&i.selectedFulfillment.hourStatus.isClosed:![]}isButtonLoading(){const e=this.getProductId();return this.getStoreValue("products."+e+".updating")}calculateQuantityLimits(){const{quantity:e}=this.calculateTotalPrice(),i=this.getAvailableQuantity(),r=e<i;return{currentQuantity:e,availableQuantity:i,canIncrease:r,canDecrease:e>1}}async handleAddToCart(){var e,i,r;const s=this.getProductId(),c=this.getStoreValue("products."+s);if(!c.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:s,selectedSizeId:c.selectedSizeId}),void 0;const d=this.getSizeAttributes(),h=(null===(e=null==d?void 0:d.presale)||void 0===e?void 0:e.isActive)===!![],u=this.isPresaleActive(d);h&&u?await this.commands.product.addPresaleToCart(s,{fulfillmentId:c.selectedFulfillment.id,partNumber:null===(i=c.selectedFulfillment)||void 0===i?void 0:i.variant.partNumber,quantity:c.quantity,identifier:s}):await this.commands.product.addToCart(s,{fulfillmentId:c.selectedFulfillment.id,partNumber:null===(r=c.selectedFulfillment)||void 0===r?void 0:r.variant.partNumber,quantity:c.quantity,identifier:s})}async handleQuantityChange(e){const i=this.getProductId();await this.commands.product.updateQuantity(i,e)}calculateTotalPrice(){const e=this.getProductId(),i=this.getStoreValue("products."+e),r=i.selectedFulfillment,s=r.variant.price*i.quantity;return{quantity:i.quantity,totalPrice:s}}createQuantityContainer(e){const i=this.calculateQuantityLimits(),r=document.createElement("div");return r.className="quantity-container "+e,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!i.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!i.canDecrease).toString()),i.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=i.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+i.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!i.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!i.canIncrease).toString()),i.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async e=>{e.preventDefault(),await this.handleQuantityChange(1)}),r.appendChild(this.qtyDecreaseButton),r.appendChild(this.quantityText),r.appendChild(this.qtyIncreaseButton),r}getSizeAttributes(){const e=this.getProductId(),i=this.getStoreValue("products."+e+".selectedSizeId"),r=this.getStoreValue("products."+e+".sizes."+i);return(null==r?void 0:r.attributes)||{}}isPresaleActive(e){const i=null==e?void 0:e.presale;if(!i)return![];if(!i.isActive)return![];if(i.canPurchaseOn){const e=new Date(i.canPurchaseOn),r=new Date;if(r.getTime()<e.getTime())return![]}return!![]}createAddToCartButton(){var e;const{totalPrice:i}=this.calculateTotalPrice(),r=this.getSizeAttributes(),s=this.calculateQuantityLimits(),c=(null===(e=null==r?void 0:r.presale)||void 0===e?void 0:e.isActive)===!![],d=this.isPresaleActive(r),h=c?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?h+" - "+formatCentToDollarText(i):h;const u=c&&!d||0===s.availableQuantity||this.isFulfillmentClosed(),g=this.isButtonLoading(),v=this.config.layout.addToCartButtonShowTotalPrice?h+" for "+formatCentToDollarText(i):h;return this.addToCartButton.setAttribute("aria-label",v),this.addToCartButton.setAttribute("aria-busy",g.toString()),this.addToCartButton.setAttribute("aria-disabled",u.toString()),u&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),g&&(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(),i=this.getStoreValue("products."+e+".fulfillmentHasAvailability"),r=this.getConfigs("configurations");if(!i||!r.isElementsEnabled)return[];const s=[];if(this.config.layout.showQuantityCounter){const e=this.createQuantityContainer(this.config.layout.quantityCounterStyle);s.push(e)}const c=this.createAddToCartButton();return s.push(c),s}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const e=this.params.productId,i=this.getStoreValue("products."+e+".description"),r=this.getStoreValue("products."+e+".htmlDescription"),s="About this product:",c="See More",d="See Less",h=document.createElement("h3");h.className="title",h.textContent=s;const u=document.createElement("div");u.className="content collapsed",u.innerHTML=""===(null==r?void 0:r.trim())?i:sanitizeHTML(r);const g=document.createElement("span");g.className="collapse-button",g.textContent=c,g.setAttribute("role","button"),g.setAttribute("tabindex","0"),g.setAttribute("aria-label","Show more product information"),g.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,u.classList.toggle("collapsed"),g.textContent=this.isCollapsed?c:d,g.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),g.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return g.addEventListener("click",toggleContent),g.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),toggleContent())}),[h,u,g]}}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 i;const r=e.find(e=>e.path==="products."+this.getProductId()+".drawer");if(!r)return![];const s=r.value,c=s.isOpen,d=null===(i=s.contentConfig)||void 0===i?void 0:i.type,h=d!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=d,this.openWithContent(s),![]):c&&this.isOpen&&!h?![]:c&&this.isOpen&&h?(this.currentContentType=d,this.openWithContent(s),![]):!c&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:e}){const i=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!e)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:i}),void 0;const{type:r,data:s}=e||{},c=ComponentFactoryService.createElement({type:r,...s});this.contentContainer&&this.contentContainer.appendChild(c),this.open()}catch(r){this.logger.error("Failed to open product drawer",r),this.commands.product.closeProductDrawer(i)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const 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,i=this.config.layout.showOnlyMainImage?"only-main-image":"with-thumbnails";return["product-image-carousel",e,i]}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 i;const r=this.params.productId,s=e.find(e=>e.path==="products."+r+".selectedSizeId");if(null==s?void 0:s.value){const e=this.getStoreValue("products."+r),c=null===(i=null==e?void 0:e.sizes)||void 0===i?void 0:i[s.value],d=null==c?void 0:c.image;if(d){const e=this.params.images.indexOf(d);-1!==e?this.selectImage(e):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+d+"')")}}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let i=0;i<this.thumbnails.length;i++){const e=this.thumbnails[i];e.addEventListener("click",()=>{this.hasMoved||this.selectImage(i)})}const e=this.container.querySelectorAll(".carousel-dot");for(let i=0;i<e.length;i++){const r=e[i];r.addEventListener("click",()=>this.selectImage(i))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(e){var i,r;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===(i=this.thumbnails[this.currentImageIndex])||void 0===i||i.classList.remove("selected"),null===(r=this.thumbnails[e])||void 0===r||r.classList.add("selected");const s=this.container.querySelectorAll(".carousel-dot");for(let c=0;c<s.length;c++){const i=s[c];i.classList.toggle("active",c===e)}this.currentImageIndex=e,this.galleryViewport&&this.scrollToIndex(e)}scrollToIndex(e){if(!this.galleryViewport||!this.thumbnails[e])return;const i=this.thumbnails[e],r=this.galleryViewport.offsetWidth,s=i.offsetLeft+i.offsetWidth/2,c=r/2,d=c-s,h=0,u=-(this.galleryContainer.scrollWidth-r);this.translateX=Math.max(u,Math.min(h,d)),this.updateTransform(!![])}setupMainImageSwipe(){var e,i;let r=0,s=0;null===(e=this.mainImageElement)||void 0===e?void 0:e.addEventListener("touchstart",e=>{r=e.touches[0].clientX,s=e.touches[0].clientY},{passive:!![]}),null===(i=this.mainImageElement)||void 0===i||i.addEventListener("touchend",e=>{const i=e.changedTouches[0].clientX-r,c=e.changedTouches[0].clientY-s;Math.abs(i)>Math.abs(c)&&Math.abs(i)>50&&(i>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const 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 i="touches"in e?e.touches[0].clientX:e.clientX,r=i-this.startX;Math.abs(r)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+r,c=0,d=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(d,Math.min(c,s)),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=[],i=this.params.images.length>1,r=this.config.layout.showOnlyMainImage,s=document.createElement("div");if(s.className="main-image",s.title="Product main image",s.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",i&&!r){const e=document.createElement("div");e.className="carousel-dots";for(let i=0;i<this.params.images.length;i++){const r=document.createElement("button");r.type="button",r.className="carousel-dot "+(0===i?"active":""),r.setAttribute("data-index",i.toString()),e.appendChild(r)}s.appendChild(e)}if(this.mainImageElement=s,e.push(s),!r){const i=document.createElement("div");i.className="gallery-viewport";const r=document.createElement("div");r.className="gallery-container";for(let e=0;e<this.params.images.length;e++){const i=this.params.images[e],s=document.createElement("div");s.className="gallery-image-wrapper "+(0===e?"selected":"");const c=document.createElement("img");c.src=i,c.className="gallery-image",c.alt="Product thumbnail "+(e+1),c.loading="lazy",s.appendChild(c),r.appendChild(s)}i.appendChild(r),e.push(i)}return e}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(e){var i;const r=this.getProductId();if(!e.some(e=>e.path==="products."+r+".selectedFulfillmentType"))return;const s=this.getStoreValue("products."+r),d=this.getConfigs("global");this.addPersonalizationSpan&&(s.selectedFulfillmentType===c.SHIPPING&&d.layout.enablePersonalization&&s.productHasAvailability&&(null===(i=null==s?void 0:s.selectedFulfillment)||void 0===i?void 0:i.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(),i=this.container.querySelectorAll("[select-size]");for(const r of i){const s=r.textContent||"",c=r.classList.contains("selected");r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","Select "+s),r.setAttribute("aria-pressed",c?"true":"false"),r.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r.click())}),r.addEventListener("click",async()=>{var s;const c=r.dataset.sizeId;if(!c)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:e,buttonElement:r.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(e,c);for(const e of i)e.classList.remove("selected"),e.setAttribute("aria-pressed","false");r.classList.add("selected"),r.setAttribute("aria-pressed","true");const d=this.getStoreValue("products."+e),h=this.getConfigs("global");this.addPersonalizationSpan&&(h.layout.enablePersonalization&&d.productHasAvailability&&(null===(s=d.selectedFulfillment)||void 0===s?void 0:s.variant.isEngravable)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(e,i){const r=document.createElement("div");r.className="size-container";const s=document.createElement("h3");s.className="size-label",s.textContent="Size",s.id="size-label",r.appendChild(s);const c=document.createElement("div");c.className="size-buttons-container",c.setAttribute("role","group"),c.setAttribute("aria-labelledby","size-label");for(const d of Object.values(i)){const i=document.createElement("span");i.setAttribute("data-size-id",d.id),i.setAttribute("select-size",""),i.className="size-button "+(d.id===e?"selected":"");const r=d.packDesc?" ("+d.packDesc+")":"";i.textContent=""+d.size+r,c.appendChild(i)}return r.appendChild(c),r}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,i;const r=this.getProductId(),c=this.getStoreValue("products."+r),d=c.sizes[c.selectedSizeId],h=this.getConfigs("global"),u=[],g=document.createElement("div");g.className="price-personalization-container";const v=ComponentFactoryService.createElement({type:s.PRODUCT_PRICE,productId:r});if(g.appendChild(v),h.layout.enablePersonalization&&c.productHasAvailability&&(null===(e=null==c?void 0:c.selectedFulfillment)||void 0===e?void 0:e.variant.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent=h.layout.personalizationText,this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label",h.layout.personalizationText);const addPersonalization=async()=>{var e,i,d,h,u,g,v,b;const x=c.sizes[c.selectedSizeId];await this.commands.product.openProductDrawer(r,s.ENGRAVING_FORM,{identifier:r,context:"product",lines:[],maxLines:(null===(i=null===(e=x.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.maxLines)||1,maxCharsPerLine:(null===(h=null===(d=x.attributes)||void 0===d?void 0:d.engraving)||void 0===h?void 0:h.maxCharsPerLine)||16,fee:(null===(g=null===(u=x.attributes)||void 0===u?void 0:u.engraving)||void 0===g?void 0:g.fee)||0,location:null===(b=null===(v=x.attributes)||void 0===v?void 0:v.engraving)||void 0===b?void 0:b.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await addPersonalization())}),g.appendChild(this.addPersonalizationSpan)}u.push(g);const b=this.renderProductSizes(c.selectedSizeId,c.sizes);if(u.push(b),!this.hasIndependentAddressComponent()){const e=ComponentFactoryService.createElement({type:s.ADDRESS_DISPLAY,productId:r});u.push(e)}const x=ComponentFactoryService.createElement({type:s.PRODUCT_RETAILERS,productId:r});u.push(x);const k=ComponentFactoryService.createElement({type:s.PRODUCT_ADD_TO_CART_SECTION,productId:r});u.push(k);const E=null===(i=null==d?void 0:d.attributes)||void 0===i?void 0:i.presale;if((null==E?void 0:E.isActive)===!![]&&(null==E?void 0:E.language)){const e=document.createElement("div");e.className="product-presale-notice",e.innerHTML=sanitizeHTML((null==E?void 0:E.language)||""),u.push(e)}if(this.config.layout.showDescription&&(c.description.trim().length>0||c.htmlDescription.trim().length>0)){const e=ComponentFactoryService.createElement({type:s.PRODUCT_DESCRIPTION,productId:r});u.push(e)}return u}}class ProductLoadingComponent extends BaseComponent{template(){const e=Boolean(this.getStoreValue("address")),{showTitle:i,showDescription:r,showQuantityCounter:s,fulfillmentDisplay:c,showImages:d,showOnlyMainImage:h}=this.config.layout,u=document.createElement("div");u.classList.add("product-content-wrapper");const g=document.createElement("div");if(g.classList.add("skeleton-container"),i){const e=document.createElement("div");e.classList.add("wave","sc-title"),g.appendChild(e)}if(!e){const e=document.createElement("div");return e.classList.add("wave","sc-add-to-cart"),g.appendChild(e),g}const v=document.createElement("div");v.classList.add("wave","sc-price"),g.appendChild(v);const b=document.createElement("div");b.classList.add("sc-sizes");const x=document.createElement("div");x.classList.add("wave","sc-size-button"),b.appendChild(x);const k=document.createElement("div");k.classList.add("wave","sc-size-button"),b.appendChild(k);const E=document.createElement("div");E.classList.add("wave","sc-size-button"),b.appendChild(E);const _=document.createElement("div");_.classList.add("wave","sc-size-button"),b.appendChild(_);const F=document.createElement("div");F.classList.add("wave","sc-size-button"),b.appendChild(F),g.appendChild(b);const D=document.createElement("div");D.classList.add("sc-row");const T=document.createElement("div");T.classList.add("wave","sc-price"),D.appendChild(T);const A=document.createElement("div");A.classList.add("wave","sc-personalization"),D.appendChild(A),g.appendChild(D);const O=document.createElement("div");O.classList.add("wave","sc-deliver-to"),g.appendChild(O);const z=document.createElement("div");z.classList.add("wave","sc-address"),g.appendChild(z);const L=document.createElement("div");L.classList.add("wave","sc-retailers",c),g.appendChild(L);const R=document.createElement("div");if(R.classList.add("sc-row"),s){const e=document.createElement("div");e.classList.add("wave","sc-quantity"),R.appendChild(e)}const M=document.createElement("div");if(M.classList.add("wave","sc-add-to-cart"),R.appendChild(M),g.appendChild(R),r){const e=document.createElement("div");e.classList.add("wave","sc-description-title"),g.appendChild(e);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),g.appendChild(i);const r=document.createElement("div");r.classList.add("wave","sc-description-line"),g.appendChild(r);const s=document.createElement("div");s.classList.add("wave","sc-description-line"),g.appendChild(s);const c=document.createElement("div");c.classList.add("wave","sc-description-more"),g.appendChild(c)}const j=document.createElement("div");if(j.classList.add("product-content"),j.appendChild(g),u.appendChild(j),d){u.classList.add("has-images");const e=this.createImageSkeletons(h);u.prepend(e)}return u}createImageSkeletons(e){const i=document.createElement("div");i.classList.add("product-image-carousel","skeleton");const r=document.createElement("div");if(r.classList.add("wave","sc-main-image"),r.title="Product main image loading",!e){const e=document.createElement("div");e.classList.add("carousel-dots");for(let i=0;i<3;i++){const i=document.createElement("div");i.classList.add("wave","sc-carousel-dot"),e.appendChild(i)}r.appendChild(e)}if(i.appendChild(r),!e){const e=document.createElement("div");e.classList.add("gallery-viewport");const r=document.createElement("div");r.classList.add("gallery-container");for(let i=0;i<4;i++){const e=document.createElement("div");e.classList.add("gallery-image-wrapper");const i=document.createElement("div");i.classList.add("wave","sc-gallery-thumbnail"),e.appendChild(i),r.appendChild(e)}e.appendChild(r),i.appendChild(e)}return i}}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 i=this.getProductId(),r=e.find(e=>e.path==="products."+i+".drawer.isOpen");if(r){const e=r.value===!![];e&&this.addHostClasses("hide-content"),e||this.removeHostClasses("hide-content")}}template(){const e=this.getProductId(),i=this.getStoreValue("address.formattedAddress");if(i)return ComponentFactoryService.createElement({type:s.PRODUCT_INTERACTIONS,productId:this.getProductId()});const r=document.createElement("button");return r.type="button",r.className="product-options-open-address-button",r.textContent=this.config.layout.buyNowButtonText,r.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,s.ADDRESS_INPUT,{productId:e})}),r}}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(),i=this.getStoreValue("products."+e);let r=i.noAvailabilityPrice;return i.selectedFulfillment&&(r=i.selectedFulfillment.variant.price),formatCentToDollarText(r)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const e=this.getProductId(),i=this.getStoreValue("products."+e),r=this.getConfigs("product"),c=[],d=this.getConfigs("configurations");if(!i.productHasAvailability||!d.isElementsEnabled){const e=document.createElement("p");return e.className="product-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),c.push(e),c}const h="carousel"===r.layout.fulfillmentDisplay?s.PRODUCT_RETAILERS_CAROUSEL:s.PRODUCT_RETAILERS_POPUP,u=ComponentFactoryService.createElement({type:h,productId:e});return c.push(u),c}}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 i=this.getProductId(),r=e.find(e=>e.path==="products."+i+".selectedFulfillmentId");(null==r?void 0:r.value)&&this.updateSelectedCard(r.value)}updateSelectedCard(e){for(const r of this.retailerCards)r.classList.remove("selected"),r.setAttribute("aria-pressed","false");const i=this.retailerCards.findIndex(i=>i.dataset.fulfillmentId===e);-1!==i&&(this.retailerCards[i].classList.add("selected"),this.retailerCards[i].setAttribute("aria-pressed","true"),this.scrollToIndex(i))}scrollToIndex(e){if(!this.listViewport||!this.retailerCards[e])return;const i=this.retailerCards[e],r=this.listViewport.offsetWidth,s=i.offsetLeft+i.offsetWidth/2,c=r/2,d=c-s,h=0,u=-(this.listContainer.scrollWidth-r);this.translateX=Math.max(u,Math.min(h,d)),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 i="touches"in e?e.touches[0].clientX:e.clientX,r=i-this.startX;Math.abs(r)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+r,c=0,d=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(d,Math.min(c,s)),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 i=this.getProductId(),r=e.currentTarget.dataset.fulfillmentType;if(!r)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:i,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(i,r)}async onRetailerCardClick(e){if(this.hasMoved)return;const i=this.getProductId(),r=e.currentTarget.dataset.fulfillmentId;if(!r)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:i,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;const s=this.getStoreValue("products."+i+".selectedFulfillment");if(s&&s.id===r)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:i,fulfillmentId:r}),void 0;await this.commands.product.selectFulfillment(i,r)}generateRetailerCard({fulfillment:e,selectedFulfillmentType:i,isSelected:r,selectedSizeAttributes:s}){var d,h,u,g,v,b;const x=i===c.ON_DEMAND;let k=null;x&&e.hourStatus.openTime&&(null===(d=e.hourStatus)||void 0===d?void 0:d.closeTime)&&(k=e.hourStatus.isOpen?"Closes at "+e.hourStatus.closeTime:"Opens at "+e.hourStatus.openTime);const E=x&&e.hourStatus&&e.hourStatus.isClosed?"closed":"",_=document.createElement("div");_.className="carousel-retailer-card "+(r?"selected":"")+" "+E,_.setAttribute("data-fulfillment-id",e.id),_.setAttribute("role","button"),_.setAttribute("tabindex","0"),_.setAttribute("aria-pressed",r?"true":"false");const F=i===c.SHIPPING?"Shipping":"Same-day delivery";_.setAttribute("aria-label",F+" from "+e.retailerName+", "+formatCentToDollarText(null!==(h=e.variant.price)&&void 0!==h?h:0));const D=document.createElement("div");D.className="retailer-header";const T=document.createElement("h3");if(T.className="name",T.textContent=e.retailerName,D.appendChild(T),x){const i=document.createElement("h3");i.className="address",i.textContent=e.retailerAddressFormatted,D.appendChild(i)}const A=document.createElement("div");A.className="retailer-body";const O=document.createElement("span");O.className="product-price",O.textContent=formatCentToDollarText(null!==(u=e.variant.price)&&void 0!==u?u:0);const z=document.createElement("span");z.className="shipping-price",z.textContent=e.fee>0?"+ "+formatCentToDollarText(e.fee):"FREE Delivery";const L=document.createElement("span");return L.className="expectation",L.textContent=e.hourStatus.isClosed?k:(null===(g=null==s?void 0:s.presale)||void 0===g?void 0:g.isActive)?(null===(v=null==s?void 0:s.presale)||void 0===v?void 0:v.isActive)&&(null===(b=null==s?void 0:s.presale)||void 0===b?void 0:b.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==s?void 0:s.presale.estimatedShipBy):"":null==e?void 0:e.expectation,A.append(O,z,L),_.append(D,A),_}template(){const e=this.getProductId(),i=this.getStoreValue("products."+e),r=this.getStoreValue("products."+e+".sizes."+i.selectedSizeId),s=(null==r?void 0:r.attributes)||null,d=[];for(const c in r.shippingFulfillments)Object.prototype.hasOwnProperty.call(r.shippingFulfillments,c)&&d.push(r.shippingFulfillments[c]);const h=[];for(const c in r.onDemandFulfillments)Object.prototype.hasOwnProperty.call(r.onDemandFulfillments,c)&&h.push(r.onDemandFulfillments[c]);const u=i.selectedFulfillmentType===c.SHIPPING,g=i.selectedFulfillmentType===c.ON_DEMAND,v=u?d:h,b=renderFulfillmentTabsContainer({shippingFulfillments:d,onDemandFulfillments:h,shippingSelected:u,onDemandSelected:g,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!i.fulfillmentHasAvailability||0===v.length){const e=document.createElement("p");return e.className="product-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[b,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 x of v){const e=this.generateRetailerCard({fulfillment:x,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:x.id===i.selectedFulfillmentId,selectedSizeAttributes:s}),r=i.selectedFulfillmentType===c.ON_DEMAND&&x.hourStatus.isClosed;r?e.setAttribute("aria-disabled","true"):(e.addEventListener("click",this.onRetailerCardClick.bind(this)),e.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),e.click())})),this.listContainer.appendChild(e)}return this.listViewport.appendChild(this.listContainer),[b,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(),i=this.getStoreValue("products."+e),r=this.getStoreValue("products."+e+".sizes."+i.selectedSizeId),d=(null==r?void 0:r.attributes)||null,h=this.config.layout.enableShippingFulfillment,u=this.config.layout.enableOnDemandFulfillment,g=Object.values(r.shippingFulfillments),v=Object.values(r.onDemandFulfillments),b=(h?g.length:0)+(u?v.length:0),x=document.createElement("div");x.className="header";const k=document.createElement("span");k.className="header-label",k.textContent=i.selectedFulfillmentType===c.SHIPPING?"Shipping From:":"Delivering From:";const E=document.createElement("button");if(E.className="delivery-options",E.type="button",E.textContent="See Delivery Options ("+b+")",E.setAttribute("aria-label","View all "+b+" delivery options"),E.addEventListener("click",async()=>{0!==b&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(s.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(e,s.PRODUCT_RETAILERS_POPUP_LIST,{productId:e}))}),x.appendChild(k),x.appendChild(E),!i.fulfillmentHasAvailability){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[x,e]}const _=document.createElement("div");_.className="popup-fulfillment-list-container";const F=renderPopupRetailerCard({fulfillment:i.selectedFulfillment,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:d});return _.appendChild(F),[x,_]}}class ProductRetailersPopupListComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}async onFulfillmentTabClick(e){const i=this.getProductId(),r=e.currentTarget.dataset.fulfillmentType;if(!r)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:i,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(i,r)}async onRetailerCardClick(e){const i=this.getProductId(),r=e.currentTarget.dataset.fulfillmentId;if(!r)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:i,targetElement:e.currentTarget.outerHTML.substring(0,100)}),void 0;const Z=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(i),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},s=this.getStoreValue("products."+i+".selectedFulfillment");if(s&&s.id===r)return await Z(),void 0;await this.commands.product.selectFulfillment(i,r),await Z()}template(){const e=this.getProductId(),i=this.getStoreValue("products."+e),r=this.getStoreValue("products."+e+".sizes."+i.selectedSizeId),s=(null==r?void 0:r.attributes)||null,d=[];for(const c in r.shippingFulfillments)Object.prototype.hasOwnProperty.call(r.shippingFulfillments,c)&&d.push(r.shippingFulfillments[c]);const h=[];for(const c in r.onDemandFulfillments)Object.prototype.hasOwnProperty.call(r.onDemandFulfillments,c)&&h.push(r.onDemandFulfillments[c]);const u=i.selectedFulfillmentType===c.SHIPPING,g=i.selectedFulfillmentType===c.ON_DEMAND,v=u?d:h,b=document.createElement("h5");b.className="popup-retailers-section-title",b.textContent="Delivery Options";const x=renderFulfillmentTabsContainer({shippingFulfillments:d,onDemandFulfillments:h,shippingSelected:u,onDemandSelected:g,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!i.fulfillmentHasAvailability||0===v.length){const e=document.createElement("p");return e.className="fulfillments-no-availability-message",e.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[b,x,e]}const k=document.createElement("div");k.className="popup-fulfillment-list-container";for(const c of v){const e=renderPopupRetailerCard({fulfillment:c,selectedFulfillmentType:i.selectedFulfillmentType,isSelected:c.id===i.selectedFulfillmentId,selectedSizeAttributes:s});e.addEventListener("click",this.onRetailerCardClick.bind(this)),e.addEventListener("keydown",i=>{"Enter"!==i.key&&" "!==i.key||(i.preventDefault(),e.click())}),k.appendChild(e)}return[b,x,k]}}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 i=this.getProductId(),r=e.find(e=>e.path==="products."+i+".drawer.isOpen"),s=e.find(e=>e.path==="products."+i+".rerender");r&&this.titleElement&&this.titleElement.classList.toggle("hide",r.value),(null==s?void 0:s.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var e;const i=this.getProductId(),r=this.getStoreValue("products."+i);if(!r)return ComponentFactoryService.createElement({type:s.PRODUCT_LOADING});if(r.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:s.PRODUCT});if(r.loading)return ComponentFactoryService.createElement({type:s.PRODUCT_LOADING});const c=r.sizes[r.selectedSizeId],d=document.createElement("div");d.classList.add("product-content-wrapper"),d.setAttribute("role","region"),d.setAttribute("aria-label",""+r.name);const h=document.createElement("div");if(h.classList.add("product-content"),h.setAttribute("role","region"),h.setAttribute("aria-label",""+r.name),this.config.layout.showTitle){const e=document.createElement("h1");e.classList.add("product-title"),e.textContent=r.name,this.titleElement=e,h.appendChild(e)}const u=ComponentFactoryService.createElement({type:s.PRODUCT_OPTIONS,productId:i});h.appendChild(u);const g=ComponentFactoryService.createElement({type:s.PRODUCT_DRAWER,productId:i});if(h.appendChild(g),d.appendChild(h),!this.config.layout.showImages||!(null===(e=r.images)||void 0===e?void 0:e.length))return d;d.classList.add("has-images");const v=ComponentFactoryService.createElement({type:s.PRODUCT_IMAGE_CAROUSEL,images:r.images,mainImage:c.image,productId:i});return d.prepend(v),v.setAttribute("aria-label","Product images"),d}async disconnected(){const e=this.getProductId();e&&await this.commands.product.removeProduct(e)}}function createApplyFiltersButton(e){const i=document.createElement("div");i.className="product-list-filters-apply-container";const r=document.createElement("button");return r.className="product-list-filters-apply-btn",r.textContent="Apply Filters",r.addEventListener("click",()=>e()),i.appendChild(r),i}function createCheckboxItem(e){const{filter:i,state:r,item:s,onChange:c}=e,d=document.createElement("div");d.className="checkbox-filter-item";const h=document.createElement("input");h.type="checkbox",h.id=i.type+"-"+s.value,h.value=s.value.toString(),h.className="checkbox-filter-checkbox",h.checked=r.selectedValues.has(s.value.toString()),h.addEventListener("change",c);const u=document.createElement("label");u.htmlFor=h.id,u.className="checkbox-filter-item-label";const g=s.count||0,v=document.createElement("span");v.className="checkbox-filter-item-text",v.textContent=s.name;const b=document.createElement("span");return b.className="checkbox-filter-item-count",b.textContent="("+g+")",u.appendChild(v),u.appendChild(b),d.appendChild(h),d.appendChild(u),d}function handleCheckboxFilterSearch(e){const{filter:i,state:r,searchTerm:s,renderCheckboxItems:c}=e,d=s.toLowerCase().trim();r.filteredItems=d?i.values.filter(e=>{const i=(e.name||e.value.toString()).toLowerCase();return i.includes(d)}):[...i.values],c()}function createCheckboxFilterHeader(e){const{filter:i,state:r,onToggle:s}=e,c=document.createElement("div");c.className="checkbox-filter-header";const d=document.createElement("button");d.className="checkbox-filter-label",d.type="button";const h=document.createElement("span");h.textContent=formatFilterLabel(i.type);const u=document.createElement("span");return u.className="checkbox-filter-toggle-icon "+(r.isExpanded?"expanded":"collapsed"),u.innerHTML=r.isExpanded?ChevronUpIcon({width:20,height:20,color:"#374151"}):ChevronDownIcon({width:20,height:20,color:"#374151"}),r.iconElement=u,d.appendChild(h),d.appendChild(u),d.addEventListener("click",()=>s(i.type)),c.appendChild(d),c}function createCheckboxFilterSearchContainer(e){const{state:i,onSearch:r}=e,s=document.createElement("div");s.className="checkbox-filter-search-wrapper",i.searchInput=document.createElement("input"),i.searchInput.type="text",i.searchInput.className="checkbox-filter-search",i.searchInput.placeholder="Search";const c=document.createElement("span");return c.className="checkbox-filter-search-icon",c.innerHTML=SearchIcon({}),i.searchInput.addEventListener("input",e=>{const i=e.target;r(i.value)}),s.appendChild(i.searchInput),s.appendChild(c),s}function renderCheckboxItems(e){const{filter:i,state:r,onCheckboxChange:s}=e;if(r.checkboxList&&(r.checkboxList.innerHTML="",r.filteredItems.forEach(e=>{const c=createCheckboxItem({filter:i,state:r,item:e,onChange:()=>{const i=c.querySelector("input");s(e.value.toString(),i.checked)}});r.checkboxList.appendChild(c)}),0===r.filteredItems.length)){const e=document.createElement("div");e.className="checkbox-filter-no-results",e.textContent="No results found",r.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 createChip(e){const{text:i,onRemove:r}=e,s=document.createElement("div");s.className="chip";const c=document.createElement("span");c.className="chip-text",c.textContent=i,s.appendChild(c);const d=document.createElement("button");return d.className="chip-close",d.type="button",d.innerHTML=CloseIcon({width:16,height:16}),d.setAttribute("aria-label","Remove"),r&&d.addEventListener("click",e=>{e.stopPropagation(),r()}),s.appendChild(d),s}function createChipsContainer(e){const{currentFilters:i,sanitizedFilters:r,onRemoveFilter:s,onClearAllFilters:c}=e,d=document.createElement("div");d.className="product-list-filters-chips-container";const h=getActiveFilters(i,r);if(0===h.length)return d.style.display="none",d;if(d.style.display="flex",h.forEach(e=>{const i=createChip({text:e.label,onRemove:()=>s(e.key,e.value)});d.appendChild(i)}),h.length>0){const e=createClearAllButton(c);d.appendChild(e)}return d}function getActiveFilters(e,i){const r=[];return addBooleanFilters(r,e),addDeliveryFilter(r,e),addPriceFilter(r,e),addDynamicFilters(r,e,i),r}function addBooleanFilters(e,i){(null==i?void 0:i[bt.ENGRAVING])&&e.push({key:b.ENGRAVING,value:"true",label:"Engravable"}),(null==i?void 0:i[bt.PRESALE])&&e.push({key:b.PRESALE,value:"true",label:"Presale"})}function addDeliveryFilter(e,i){if(!(null==i?void 0:i.fulfillment)||(null==i?void 0:i.fulfillment)===xt.ALL)return;const r=(null==i?void 0:i.fulfillment)===xt.ON_DEMAND?"Same-day Delivery":"Shipping";e.push({key:b.FULFILLMENT,value:null==i?void 0:i.fulfillment.toString(),label:r})}function addPriceFilter(e,i){const r=null==i?void 0:i.price;if(!r)return;const s=r.min&&r.min!==wt.MIN,c=r.max&&r.max!==wt.MAX;if(!s&&!c)return;const d=s?"$"+r.min:"$0",h=c?"$"+r.max:"$"+wt.MAX+"+";e.push({key:b.PRICE,value:"price",label:d+" - "+h})}function addDynamicFilters(e,i,r){if(!i)return;const s=getDynamicFilterKeys(i);for(const c of s)addDynamicFilterChips(c,e,i,r)}function getDynamicFilterKeys(e){const i=[bt.ENGRAVING,bt.PRESALE,bt.FULFILLMENT,bt.PRICE];return Object.keys(e).filter(e=>!i.includes(e))}function addDynamicFilterChips(e,i,r,s){const c=r[e];if(!Array.isArray(c)||0===c.length)return;const d=null==s?void 0:s.find(i=>i.type===e);c.forEach(r=>{const s=null==d?void 0:d.values.find(e=>e.value.toString()===r),c=(null==s?void 0:s.name)||r;i.push({key:e,value:r,label:c})})}function createClearAllButton(e){const i=document.createElement("button");return i.className="product-list-filters-clear-all",i.textContent="CLEAR ALL FILTERS",i.type="button",i.addEventListener("click",()=>{e()}),i}function createFulfillmentFilter(e){const{currentFilters:i,deliveryCollapsed:r,isSameDayDeliveryDisabled:s,onFulfillmentOptionsChange:c,onToggleCollapse:d}=e,h=[],u=document.createElement("div");u.className="product-list-filters-fulfillment-options";const g=[{value:xt.ALL,label:"All"},{value:xt.SHIPPING,label:"Shipping"},{value:xt.ON_DEMAND,label:"Same-Day Delivery"}],v=document.createElement("div");v.className="product-list-filters-fulfillment-options-header",v.style.cursor="pointer";const b=document.createElement("h3");b.className="product-list-filters-fulfillment-options-label",b.textContent="Fulfillment Options";const x=document.createElement("div");x.className="product-list-filters-chevron",x.innerHTML=r?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),v.appendChild(b),v.appendChild(x),u.appendChild(v);const k=document.createElement("div");k.className="product-list-filters-fulfillment-options-list",r&&k.classList.add("collapsed");for(const E of g){const e=document.createElement("div");e.className="product-list-filters-fulfillment-option";const r=document.createElement("input");r.type="radio",r.id="fulfillment-"+E.value,r.name="fulfillment-options",r.value=E.value,r.className="product-list-filters-fulfillment-radio";const d="onDemand"===E.value&&s;r.disabled=d;const h=(null==i?void 0:i.fulfillment)||xt.ALL;r.checked=E.value===h,r.addEventListener("change",e=>{const i=e.target;null==c?void 0:c(i.value)});const u=document.createElement("label");u.htmlFor="fulfillment-"+E.value,u.className="product-list-filters-fulfillment-radio-label "+(d?"disabled":""),u.textContent=E.label,e.appendChild(r),e.appendChild(u),k.appendChild(e)}return u.appendChild(k),v.addEventListener("click",()=>{d()}),h.push(u),{elements:h,chevronContainer:x,fulfillmentList:k}}function createPriceFilter(e){var i,r,s,c,d,h,u,g;const{priceConfig:v,currentFilters:b,priceCollapsed:x,onPriceChange:k,onToggleCollapse:E,DEFAULT_MIN:_,DEFAULT_MAX:F}=e,D=[],T=document.createElement("div");T.className="product-list-filters-price";const A=Number.parseInt(null!==(i=null==v?void 0:v.min)&&void 0!==i?i:_,10),O=Number.parseInt(null!==(r=null==v?void 0:v.max)&&void 0!==r?r:F,10),z=Number.parseInt(null!==(d=null!==(c=null===(s=null==b?void 0:b.price)||void 0===s?void 0:s.min)&&void 0!==c?c:null==v?void 0:v.min)&&void 0!==d?d:_,10),L=Number.parseInt(null!==(g=null!==(u=null===(h=null==b?void 0:b.price)||void 0===h?void 0:h.max)&&void 0!==u?u:null==v?void 0:v.max)&&void 0!==g?g:F,10),R=document.createElement("div");R.className="product-list-filters-price-header",R.style.cursor="pointer";const M=document.createElement("h3");M.className="product-list-filters-price-title",M.textContent="Price Range",R.appendChild(M);const j=document.createElement("div");j.className="product-list-filters-chevron",j.innerHTML=x?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),R.appendChild(j),T.appendChild(R);const N=document.createElement("div");N.className="product-list-filters-price-slider-container",x&&N.classList.add("collapsed");const B=document.createElement("div");B.className="product-list-filters-price-range-wrapper";const q=document.createElement("div");q.className="product-list-filters-price-track";const U=document.createElement("div");U.className="product-list-filters-price-track-active",q.appendChild(U),B.appendChild(q);const V=document.createElement("input");V.type="range",V.min=A.toString(),V.max=O.toString(),V.value=z.toString(),V.step="1",V.className="product-list-filters-price-range product-list-filters-price-range-min",B.appendChild(V);const G=document.createElement("input");G.type="range",G.min=A.toString(),G.max=O.toString(),G.value=L.toString(),G.step="1",G.className="product-list-filters-price-range product-list-filters-price-range-max",B.appendChild(G),N.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 X=document.createElement("input");X.type="number",X.min=A.toString(),X.max=O.toString(),X.value=z.toString(),X.className="product-list-filters-price-input",X.placeholder=A.toString(),Y.appendChild(W),Y.appendChild(X);const $=document.createElement("span");$.className="product-list-filters-price-separator",$.textContent="to";const tt=document.createElement("div");tt.className="product-list-filters-price-input-wrapper";const et=document.createElement("span");et.className="product-list-filters-price-input-prefix",et.textContent="$";const nt=document.createElement("input");nt.type="number",nt.min=A.toString(),nt.max=O.toString(),nt.value=L.toString(),nt.className="product-list-filters-price-input",nt.placeholder=O+"+",tt.appendChild(et),tt.appendChild(nt),H.appendChild(Y),H.appendChild($),H.appendChild(tt),N.appendChild(H),T.appendChild(N);const I=()=>{const e=Number.parseInt(V.value,10),i=Number.parseInt(G.value,10),r=O-A,s=(e-A)/r*100,c=(i-A)/r*100;U.style.left=s+"%",U.style.width=c-s+"%"},w=(e,i)=>{V.value=e.toString(),G.value=i.toString(),X.value=e.toString(),nt.value=i.toString(),I()};return V.addEventListener("input",()=>{let e=Number.parseInt(V.value,10);const i=Number.parseInt(G.value,10);e>i&&(e=i),w(e,i)}),V.addEventListener("change",()=>{const e=Number.parseInt(V.value,10),i=Number.parseInt(G.value,10);null==k?void 0:k(e.toString(),i.toString())}),G.addEventListener("input",()=>{const e=Number.parseInt(V.value,10);let i=Number.parseInt(G.value,10);i<e&&(i=e),w(e,i)}),G.addEventListener("change",()=>{const e=Number.parseInt(V.value,10),i=Number.parseInt(G.value,10);null==k?void 0:k(e.toString(),i.toString())}),X.addEventListener("input",()=>{let e=Number.parseInt(X.value,10)||A;const i=Number.parseInt(nt.value,10)||O;e=Math.max(A,Math.min(e,O)),e>i&&(e=i),w(e,i),null==k||k(e.toString(),i.toString())}),nt.addEventListener("input",()=>{const e=Number.parseInt(X.value,10)||A;let i=Number.parseInt(nt.value,10)||O;i=Math.max(A,Math.min(i,O)),i<e&&(i=e),w(e,i),null==k||k(e.toString(),i.toString())}),I(),R.addEventListener("click",()=>{E()}),D.push(T),{elements:D,chevronContainer:j,sliderContainer:N}}function createEngravingFilter(e){const{currentFilters:i,isPersonalizationDisabled:r,onEngravingChange:s}=e,c=[],d=document.createElement("div");d.className="product-list-filters-engraving";const h=document.createElement("label");h.className="product-list-filters-engraving-label",h.setAttribute("for","engraving-switch"),h.textContent="Engraved Bottles",d.appendChild(h);const u=document.createElement("div");u.classList.add("toggle-switch");const g=!!(null==i?void 0:i.engraving);g&&u.classList.add("active");const v=document.createElement("div");v.classList.add("toggle-slider"),u.id="engraving-switch",u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Toggle Engraved Bottles"),u.setAttribute("role","switch"),u.setAttribute("aria-checked",g?"true":"false"),u.appendChild(v);const f=e=>{u.classList.toggle("active",e),u.setAttribute("aria-checked",e?"true":"false")},S=()=>{const e=u.classList.contains("active"),i=!e;f(i),null==s||s(i)};if(u.addEventListener("click",()=>{r||S()}),u.addEventListener("keydown",e=>{r||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S())}),d.appendChild(u),r){const e=document.createElement("div");e.className="product-list-filters-warning",d.appendChild(e)}return c.push(d),c}function createPresaleFilter(e){const{currentFilters:i,isPresaleDisabled:r,onPresaleChange:s}=e,c=[],d=document.createElement("div");d.className="product-list-filters-presale";const h=document.createElement("label");h.className="product-list-filters-presale-label",h.setAttribute("for","presale-switch"),h.textContent="Presale",d.appendChild(h);const u=document.createElement("div");u.classList.add("toggle-switch");const g=!!(null==i?void 0:i.presale);g&&u.classList.add("active"),r&&u.classList.add("disabled");const v=document.createElement("div");v.classList.add("toggle-slider"),u.id="presale-switch",u.setAttribute("tabindex",r?"-1":"0"),u.setAttribute("aria-label","Toggle Presale"),u.setAttribute("role","switch"),u.setAttribute("aria-checked",g?"true":"false"),u.setAttribute("aria-disabled",r?"true":"false"),u.appendChild(v);const f=e=>{u.classList.toggle("active",e),u.setAttribute("aria-checked",e?"true":"false")},S=()=>{const e=u.classList.contains("active"),i=!e;f(i),null==s||s(i)};if(u.addEventListener("click",()=>{r||S()}),u.addEventListener("keydown",e=>{r||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),S())}),d.appendChild(u),r){const e=document.createElement("div");e.className="product-list-filters-warning",d.appendChild(e)}return c.push(d),c}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(e){const i=document.createElement("div");i.classList.add("slc__card");const r=document.createElement("div");r.className="slc__image-content";const s=document.createElement("div");s.className="slc__image-wrapper";const c=document.createElement("div");c.classList.add("wave","slc__image"),s.appendChild(c),r.appendChild(s);const d=document.createElement("div");d.className="slc__content";const h=document.createElement("div");h.className="slc__title-container";const u=document.createElement("div");u.classList.add("wave","slc__title","slc__title-line-1"),h.appendChild(u);const g=document.createElement("div");g.classList.add("wave","slc__title","slc__title-line-2"),h.appendChild(g),d.appendChild(h);const v=document.createElement("div");v.className="slc__size-price-wrapper";const b=document.createElement("div");b.classList.add("wave","slc__price"),v.appendChild(b);const x=document.createElement("div");x.classList.add("wave","slc__size"),v.appendChild(x),d.appendChild(v);const k=document.createElement("div");return k.classList.add("wave","slc__button"),i.appendChild(r),i.appendChild(d),i.appendChild(k),i}template(){const e=[],i=100/this.params.columns;this.container.style.setProperty("--card-width",i+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const r=this.params.rows*this.params.columns;for(let s=0;s<r;s++){const i=this.createSkeletonCard(s);e.push(i)}return e}}const FilterIcon=({width:e=16,height:i=16,className:r="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+i+'" viewBox="0 0 24 24" class="filter-icon '+r+'" style="'+c+'" 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 '};class ProductListFiltersComponent extends BaseComponent{constructor(){super({watchStorePaths:["address","address.formattedAddress","productsList.filters","productsList.appliedFilters"]}),this.DEFAULT_MIN_PRICE=wt.MIN,this.DEFAULT_MAX_PRICE=wt.MAX,this.FILTER_DEBOUNCE_DELAY_MS=500,this.DESKTOP_BREAKPOINT=1024,this.isRenderedInDrawerMode=![],this.permanentFilters={price:{min:wt.MIN,max:wt.MAX},fulfillment:xt.ALL,presale:![],engraving:![]},this.availableDynamicFilters=[],this.checkboxFilterStateMap=new Map,this.isPriceFilterCollapsed=![],this.isFulfillmentFilterCollapsed=![],this.appliedFiltersChipsContainer=null,this.resizeHandler=null,this.priceFilterDebounceTimer=null}get hostClasses(){const e=["product-list-filters-container"];return this.isRenderedInDrawerMode&&e.push("drawer-mode"),e}async connected(){var e;null===(e=super.connected)||void 0===e?void 0:e.call(this),this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.setupResizeListener(),this.setupDrawerCloseListener(),this.syncFiltersFromStore(),this.onStoreWatch()}setupDrawerCloseListener(){document.addEventListener("drawerClosed",()=>{this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.isRenderedInDrawerMode||(this.syncFiltersFromStore(),this.refreshUIStates())})}setupResizeListener(){this.resizeHandler=()=>{const e=window.innerWidth;e>=this.DESKTOP_BREAKPOINT&&(this.commands.ui.closeDrawer(),this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.syncFiltersFromStore(),this.refreshUIStates())},window.addEventListener("resize",this.resizeHandler)}detectIfRenderedInDrawer(){var e,i,r;let s=this.parentElement;for(;s;){if((null===(e=s.classList)||void 0===e?void 0:e.contains("drawer"))||(null===(i=s.hasAttribute)||void 0===i?void 0:i.call(s,"data-drawer"))||"drawer-component"===(null===(r=s.tagName)||void 0===r?void 0:r.toLowerCase()))return!![];s=s.parentElement}return![]}onStoreWatch(){const{filters:e}=this.getStoreValue("productsList");e&&Array.isArray(e)&&e.length>0&&(this.availableDynamicFilters=e),this.syncFiltersFromStore(),this.refreshUIStates()}syncFiltersFromStore(){const{appliedFilters:e}=this.getStoreValue("productsList");if(e){const i={};for(const[r,s]of Object.entries(e))i[r]=this.transformFilterValue(r,s);this.permanentFilters={price:{min:wt.MIN,max:wt.MAX},fulfillment:xt.ALL,presale:![],engraving:![],...i},this.checkboxFilterStateMap.clear()}}refreshUIStates(){!this.isRenderedInDrawerMode&&this.appliedFiltersChipsContainer&&(this.appliedFiltersChipsContainer.innerHTML="",this.appliedFiltersChipsContainer.appendChild(this.buildAppliedFiltersChipsContainer())),this.engravingFiltersContainer&&(this.engravingFiltersContainer.innerHTML="",this.buildEngravingFilterElements().forEach(e=>{var i;null===(i=this.engravingFiltersContainer)||void 0===i?void 0:i.appendChild(e)})),this.presaleFilterContainer&&(this.presaleFilterContainer.innerHTML="",this.buildPresaleFilterElements().forEach(e=>{var i;null===(i=this.presaleFilterContainer)||void 0===i?void 0:i.appendChild(e)})),this.dynamicFiltersContainer&&(this.dynamicFiltersContainer.innerHTML="",this.buildDynamicFiltersElements().forEach(e=>{var i;null===(i=this.dynamicFiltersContainer)||void 0===i?void 0:i.appendChild(e)}))}transformFilterValue(e,i){if(e===bt.ENGRAVING||e===bt.PRESALE)return Array.isArray(i)?"true"===i[0]:"true"===i;if(e===bt.FULFILLMENT)return Array.isArray(i)?i[0]:i;if(e!==bt.PRICE)return i;if(Array.isArray(i)&&i[0])try{return JSON.parse(i[0])}catch(r){this.logger.error("Error fetching products with updated filters:",r)}}async fetchFilters(){const{searchTerm:e}=this.getStoreValue("productsList");try{this.store.set("productsList.loading",!![]),this.store.batch({"productsList.products":[],"productsList.retailers":{}}),this.commands.productList.syncFiltersFromComponent(this.permanentFilters),await this.commands.productList.loadInitialProducts(0,this.commands.productList.getItemsPerPage(),e,this.permanentFilters,this.params.filters);const{filters:i}=this.getStoreValue("productsList");this.availableDynamicFilters=i}catch(i){throw this.logger.error("Error fetching products with updated filters:",i),this.store.set("productsList.loading",![]),i}}async applyFiltersAndCloseDrawer(){await this.fetchFilters(),this.syncFiltersFromStore(),this.commands.ui.closeDrawer()}template(){const e=[];if(!this.isRenderedInDrawerMode){this.filterButtonContainer=document.createElement("div"),this.filterButtonContainer.className="product-list-filter-button-host";const i=this.getStoreValue("productsList"),r=null==i?void 0:i.filters;(null==r?void 0:r.length)>0&&this.filterButtonContainer.appendChild(this.buildFilterButton()),e.push(this.filterButtonContainer)}const i=document.createElement("div");i.className=this.isRenderedInDrawerMode?"product-list-filters-content-wrapper drawer-mode":"product-list-filters-content-wrapper";const r=this.buildFilterHeader();i.appendChild(r),this.appliedFiltersChipsContainer=this.buildAppliedFiltersChipsContainer(),i.appendChild(this.appliedFiltersChipsContainer),this.engravingFiltersContainer=document.createElement("div"),this.engravingFiltersContainer.className="product-list-engraving-filters-container";const s=this.buildEngravingFilterElements();for(const g of s)this.engravingFiltersContainer.appendChild(g);i.appendChild(this.engravingFiltersContainer),this.presaleFilterContainer=document.createElement("div"),this.presaleFilterContainer.className="product-list-presale-filters-container";const c=this.buildPresaleFilterElements();for(const g of c)this.presaleFilterContainer.appendChild(g);i.appendChild(this.presaleFilterContainer),this.fulfillmentFilterContainer=document.createElement("div"),this.fulfillmentFilterContainer.className="product-list-fulfillment-filters-container";const d=this.buildFulfillmentFilterElements();for(const g of d)this.fulfillmentFilterContainer.appendChild(g);i.appendChild(this.fulfillmentFilterContainer),this.priceFiltersContainer=document.createElement("div"),this.priceFiltersContainer.className="product-list-price-filters-container";const h=this.buildPriceFilterElements();for(const g of h)this.priceFiltersContainer.appendChild(g);i.appendChild(this.priceFiltersContainer),this.dynamicFiltersContainer=document.createElement("div"),this.dynamicFiltersContainer.className="product-list-dynamic-filters-container";const u=this.buildDynamicFiltersElements();for(const g of u)this.dynamicFiltersContainer.appendChild(g);return i.appendChild(this.dynamicFiltersContainer),this.isRenderedInDrawerMode&&i.appendChild(createApplyFiltersButton(()=>{void this.applyFiltersAndCloseDrawer()})),e.push(i),e}buildFilterButton(){const e=document.createElement("div");e.className="product-list-filter-container";const i=document.createElement("div");i.className="product-list-filter-icon",i.innerHTML=FilterIcon({}),i.style.cursor="pointer",i.addEventListener("click",()=>{this.openFilterDrawer()});const r=document.createElement("span");return r.className="product-list-filter-text",r.textContent="Filter",r.style.cursor="pointer",r.addEventListener("click",()=>{this.openFilterDrawer()}),e.appendChild(i),e.appendChild(r),e}openFilterDrawer(){this.commands.ui.openDrawer(s.PRODUCT_LIST_FILTERS,{filters:this.params.filters||[]})}buildFilterHeader(){const e=document.createElement("div");e.className="product-list-filters-header",this.isRenderedInDrawerMode&&e.classList.add("drawer-mode");const i=document.createElement("h3");if(i.className="product-list-filters-title",i.textContent="Filters",e.appendChild(i),this.isRenderedInDrawerMode){const i=document.createElement("button");i.className="product-list-filters-close-btn",i.innerHTML=CloseIcon({}),i.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),e.appendChild(i)}return e}async clearAllActiveFilters(){this.permanentFilters={price:{min:wt.MIN,max:wt.MAX},fulfillment:xt.ALL,presale:![],engraving:![]},await this.fetchFilters()}async removeSingleFilter(e,i){switch(e){case b.ENGRAVING:this.permanentFilters[bt.ENGRAVING]=![];break;case b.PRESALE:this.permanentFilters[bt.PRESALE]=![];break;case b.FULFILLMENT:this.permanentFilters[bt.FULFILLMENT]=xt.ALL;break;case b.PRICE:delete this.permanentFilters.price;break;default:{const r=this.checkboxFilterStateMap.get(e);if(r){r.selectedValues.delete(i);const s=Array.from(r.selectedValues);s.length>0?this.permanentFilters[e]=s:delete this.permanentFilters[e]}break}}await this.fetchFilters()}getFilteredAndSanitizedFilters(){return this.params.filters&&0!==this.params.filters.length?this.commands.productList.getSanitizedFilters(this.availableDynamicFilters,this.params.filters):[]}buildAppliedFiltersChipsContainer(){return createChipsContainer({currentFilters:this.permanentFilters,sanitizedFilters:this.getFilteredAndSanitizedFilters(),onRemoveFilter:(e,i)=>this.removeSingleFilter(e,i),onClearAllFilters:()=>this.clearAllActiveFilters()})}async handleFilterChange(){this.commands.productList.syncFiltersFromComponent(this.permanentFilters),this.isRenderedInDrawerMode||await this.fetchFilters()}isEngravingCurrentlyDisabled(){return this.permanentFilters[bt.FULFILLMENT]===xt.ON_DEMAND}buildEngravingFilterElements(){return createEngravingFilter({currentFilters:this.permanentFilters,isPersonalizationDisabled:this.isEngravingCurrentlyDisabled(),onEngravingChange:async e=>{this.permanentFilters[bt.ENGRAVING]=e,await this.handleFilterChange()}})}buildPresaleFilterElements(){return createPresaleFilter({currentFilters:this.permanentFilters,isPresaleDisabled:this.permanentFilters[bt.FULFILLMENT]===xt.ON_DEMAND,onPresaleChange:async e=>{this.permanentFilters[bt.PRESALE]=e,await this.handleFilterChange()}})}isSameDayDeliveryCurrentlyDisabled(){return!(!this.permanentFilters[bt.ENGRAVING]&&!this.permanentFilters[bt.PRESALE])}toggleFulfillmentFilterCollapse(){this.isFulfillmentFilterCollapsed=!this.isFulfillmentFilterCollapsed,this.fulfillmentOptionsList&&this.fulfillmentOptionsList.classList.toggle("collapsed"),this.fulfillmentFilterChevronIcon&&(this.fulfillmentFilterChevronIcon.innerHTML=this.isFulfillmentFilterCollapsed?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}))}buildFulfillmentFilterElements(){const e=createFulfillmentFilter({currentFilters:this.permanentFilters,deliveryCollapsed:this.isFulfillmentFilterCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryCurrentlyDisabled(),onFulfillmentOptionsChange:async e=>{this.permanentFilters[bt.FULFILLMENT]=e,e===xt.ON_DEMAND&&(this.permanentFilters[bt.ENGRAVING]=![],this.permanentFilters[bt.PRESALE]=![]),await this.handleFilterChange()},onToggleCollapse:()=>this.toggleFulfillmentFilterCollapse()});return this.fulfillmentFilterChevronIcon=e.chevronContainer,this.fulfillmentOptionsList=e.fulfillmentList,e.elements}togglePriceFilterCollapse(){this.isPriceFilterCollapsed=!this.isPriceFilterCollapsed,this.priceSliderWrapper&&this.priceSliderWrapper.classList.toggle("collapsed"),this.priceFilterChevronIcon&&(this.priceFilterChevronIcon.innerHTML=this.isPriceFilterCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}buildPriceFilterElements(){const e=createPriceFilter({priceConfig:{min:wt.MIN,max:wt.MAX},currentFilters:this.permanentFilters,priceCollapsed:this.isPriceFilterCollapsed,onPriceChange:async(e,i)=>{this.permanentFilters.price||(this.permanentFilters.price={}),e!==wt.MIN?this.permanentFilters.price.min=e:delete this.permanentFilters.price.min,i!==wt.MAX?this.permanentFilters.price.max=i:delete this.permanentFilters.price.max,this.priceFilterDebounceTimer&&clearTimeout(this.priceFilterDebounceTimer),this.isRenderedInDrawerMode||(this.priceFilterDebounceTimer=setTimeout(async()=>{await this.handleFilterChange()},this.FILTER_DEBOUNCE_DELAY_MS))},onToggleCollapse:()=>this.togglePriceFilterCollapse(),DEFAULT_MIN:this.DEFAULT_MIN_PRICE,DEFAULT_MAX:this.DEFAULT_MAX_PRICE});return this.priceFilterChevronIcon=e.chevronContainer,this.priceSliderWrapper=e.sliderContainer,e.elements}buildDynamicFiltersElements(){const e=[],i=this.getFilteredAndSanitizedFilters(),r=new Set([bt.ENGRAVING,bt.PRESALE,bt.FULFILLMENT]);for(const s of i)if(!r.has(s.type)){const i=this.getFilterElements(s);e.push(...i)}return e}getFilterElements(e){return this.buildCheckboxFilterElements(e)}buildCheckboxFilterElements(e){const i=[];if(!this.checkboxFilterStateMap.has(e.type)){const i=this.permanentFilters[e.type],r=Array.isArray(i)?new Set(i):new Set;this.checkboxFilterStateMap.set(e.type,{isExpanded:r.size>0,selectedValues:r,searchInput:null,checkboxList:null,filteredItems:[...e.values],contentElement:null,iconElement:null,hasUserInteraction:r.size>0})}const r=this.checkboxFilterStateMap.get(e.type);r.filteredItems=[...e.values];const s=document.createElement("div");s.className="product-list-checkbox-filter",s.setAttribute("data-filter-category",e.type);const c=document.createElement("div");c.className="checkbox-filter-container";const d=createCheckboxFilterHeader({filter:e,state:r,onToggle:e=>this.toggleCheckboxFilterExpansion(e)});c.appendChild(d);const h=document.createElement("div");h.className="checkbox-filter-content "+(r.isExpanded?"expanded":"collapsed"),r.contentElement=h;const u=createCheckboxFilterSearchContainer({state:r,onSearch:i=>{handleCheckboxFilterSearch({filter:e,state:r,searchTerm:i,renderCheckboxItems:()=>this.renderCheckboxItemsForFilter(e,r)})}});return h.appendChild(u),r.checkboxList=document.createElement("div"),r.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsForFilter(e,r),h.appendChild(r.checkboxList),c.appendChild(h),s.appendChild(c),i.push(s),i}toggleCheckboxFilterExpansion(e){const i=this.checkboxFilterStateMap.get(e);i&&(i.isExpanded=!i.isExpanded,i.hasUserInteraction=!![],updateFilterExpandState(i))}renderCheckboxItemsForFilter(e,i){renderCheckboxItems({filter:e,state:i,onCheckboxChange:(r,s)=>this.handleCheckboxSelectionChange(e.type,i,r,s)})}async handleCheckboxSelectionChange(e,i,r,s){s?i.selectedValues.add(r):i.selectedValues.delete(r),i.hasUserInteraction=!![],i.isExpanded||(i.isExpanded=!![],updateFilterExpandState(i));const c=Array.from(i.selectedValues);c.length>0?this.permanentFilters[e]=c:delete this.permanentFilters[e],await this.handleFilterChange()}}class ProductListRetailersComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["productsList.userProducts"]})}getProductId(){return this.params.productId}template(){var e,i,r,s,d,h,u,g,v,b;const x=this.getProductId(),k=this.params.config||this.config,E=this.getStoreValue("productsList"),_=E.products.find(e=>(e.salsifyGrouping||e.id)===x);if(!_)return[];const F=null===(e=E.userProducts[x])||void 0===e?void 0:e.selectedSizeId,D=Object.values(_.sizes).find(e=>e.id===F);if(!D)return[];const T=document.createElement("div");T.className="retailers-popup-wrapper";const A=D.attributes||null,O=this.extractFulfillments(D.shippingFulfillments),z=this.extractFulfillments(D.onDemandFulfillments),L=null===(i=E.userProducts[x])||void 0===i?void 0:i.selectedFulfillmentType,R=L===c.SHIPPING,M=L===c.ON_DEMAND,j=R?O:z;T.appendChild(this.createHeader());const N=renderFulfillmentTabsContainer({shippingFulfillments:O,onDemandFulfillments:z,shippingSelected:R,onDemandSelected:M,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:null!==(d=null===(s=null===(r=null==k?void 0:k.layout)||void 0===r?void 0:r.productCard)||void 0===s?void 0:s.enableShippingFulfillment)&&void 0!==d?d:!![],enableOnDemandFulfillment:null!==(g=null===(u=null===(h=null==k?void 0:k.layout)||void 0===h?void 0:h.productCard)||void 0===u?void 0:u.enableOnDemandFulfillment)&&void 0!==g?g:!![]});if(T.appendChild(N),0===j.length)T.appendChild(this.createNoAvailabilityMessage());else{const e=null===(b=null===(v=E.userProducts[x])||void 0===v?void 0:v.selectedFulfillment)||void 0===b?void 0:b.id,i=document.createElement("div");i.className="popup-fulfillment-list-container";for(const r of j){const s=renderPopupRetailerCard({fulfillment:r,selectedFulfillmentType:L,isSelected:r.id===e,selectedSizeAttributes:A});s.addEventListener("click",async()=>{await this.onRetailerCardClick(r.id)}),i.appendChild(s)}T.appendChild(i)}return[T]}extractFulfillments(e){return e?Object.values(e):[]}onFulfillmentTabClick(e){const i=e.currentTarget,r=i.getAttribute("data-fulfillment-type");r&&this.commands.productList.selectFulfillmentType(this.getProductId(),r)}async onRetailerCardClick(e){const i=this.getProductId();e&&(await this.commands.productList.selectFulfillment(i,e),this.commands.productList.updateQuantity(i,1),this.clientConfig.isMobile()?this.commands.ui.closeDrawer():this.commands.ui.closeModal())}createHeader(){const e=document.createElement("div");e.className="retailers-popup-header";const i=document.createElement("h5");i.className="retailers-popup-title",i.textContent="Select a Retailer",e.appendChild(i);const r=document.createElement("button");return r.className="retailers-popup-close",r.innerHTML=CloseIcon({}),r.addEventListener("click",()=>this.commands.ui.closeModal()),e.appendChild(r),e}createNoAvailabilityMessage(){const e=document.createElement("p");return e.className="retailers-popup-no-data",e.innerHTML=sanitizeHTML("No delivery options available at this time."),e}}class ProductListSearchComponent extends BaseComponent{constructor(){super(...arguments),this.debounceTimer=null,this.currentSearchTerm="",this.ALLOWED_CHARACTERS=/[^a-zA-Z0-9\s\-_'.,&()]/g,this.MAX_LENGTH=100,this.DEFAULT_DEBOUNCE_MS=500}get hostClasses(){return["product-list-search__control-container"]}disconnectedCallback(){super.disconnectedCallback(),this.cleanupDebounceTimer()}getCurrentSearchTerm(){return this.currentSearchTerm}async fetchProducts(){try{this.commands.productList.setLoading(!![]),this.store.batch({"productList.products":[],"productList.retailers":{}});const e=this.getStoreValue("productsList"),i=this.buildCurrentFiltersFromState(e.appliedFilters);await this.commands.productList.loadInitialProducts(0,this.commands.productList.getItemsPerPage(),this.currentSearchTerm,i,[])}catch(e){throw this.logger.error("Error fetching products with search term:",e),this.commands.productList.setLoading(![]),e}}buildCurrentFiltersFromState(e){const i={price:{min:wt.MIN,max:wt.MAX},fulfillment:xt.ALL};for(const[r,s]of Object.entries(e))r===bt.PRICE?i.price=s:r===bt.FULFILLMENT?i.fulfillment=s:i[r]=s;return i}template(){const e=[],i=document.createElement("div");i.className="product-list-search-box";const r=document.createElement("span");return r.className="product-list-search-icon",r.innerHTML=SearchIcon({}),r.setAttribute("aria-hidden","true"),this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="product-list-search-input",this.searchInput.id="product-list-search-input",this.searchInput.placeholder="Search",this.searchInput.setAttribute("aria-label","Search products"),this.searchInput.setAttribute("maxlength",this.MAX_LENGTH.toString()),this.searchInput.addEventListener("input",e=>{const i=e.target,r=i.value,s=this.cleanInput(r);s!==r&&(i.value=s),this.updateClearButtonVisibility(s);const c=this.normalizeForSearch(s);c!==this.currentSearchTerm&&this.handleDebouncedSearch(c)}),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="none",this.clearButton.addEventListener("click",()=>{this.handleClearSearch()}),i.appendChild(r),i.appendChild(this.searchInput),i.appendChild(this.clearButton),e.push(i),e}handleDebouncedSearch(e){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.currentSearchTerm=e,this.commands.productList.updateSearchTerm(e),this.fetchProducts()},this.DEFAULT_DEBOUNCE_MS)}handleClearSearch(){var e;const i=""!==(null===(e=this.searchInput)||void 0===e?void 0:e.value);this.searchInput&&(this.searchInput.value="",this.searchInput.focus()),this.updateClearButtonVisibility(""),this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),i&&(this.currentSearchTerm="",this.commands.productList.updateSearchTerm(""),this.fetchProducts())}cleanInput(e){if(!e)return"";let i=e.replace(this.ALLOWED_CHARACTERS,"");return i.length>this.MAX_LENGTH&&(i=i.substring(0,this.MAX_LENGTH)),i}normalizeForSearch(e){return e?e.trim().replace(/\s+/g," "):""}updateClearButtonVisibility(e){this.clearButton&&(this.clearButton.style.display=e?"flex":"none")}cleanupDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}}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","address.formattedAddress"]}),this.products=[],this.retailers={},this.pagination={currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]},this.cardsContainer=null,this.sentinelElement=null,this.loadingState=Ct.IDLE,this.scrollObserver=null,this.initializationPromise=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise,this.unsubscribeFromState=this.commands.productList.subscribe(e=>{this.handleStateUpdate(e)})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=void 0),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(Ct.LOADING_INITIAL),this.commands.productList.setGridConfig(this.params.rows,this.params.columns),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(Ct.IDLE)}catch(yt){this.logger.error("Error initializing product list:",yt),this.setLoadingState(Ct.ERROR),this.showErrorState("Failed to load products")}}handleStateUpdate(e){this.updateLoadingState(e.loading);const i=this.hasProductsChanged(e.products);!i&&e.loading||(this.updateProductData(e),this.handleProductRendering(e.products))}updateLoadingState(e){const i=this.loadingState===Ct.LOADING_INITIAL||this.loadingState===Ct.LOADING_MORE;e&&0===this.products.length?this.setLoadingState(Ct.LOADING_INITIAL):e&&this.products.length>0?this.setLoadingState(Ct.LOADING_MORE):!e&&i&&this.setLoadingState(Ct.IDLE)}hasProductsChanged(e){return e.length!==this.products.length||e.some((e,i)=>{var r;return e.id!==(null===(r=this.products[i])||void 0===r?void 0:r.id)})}updateProductData(e){this.products=e.products,this.retailers=e.retailers,this.pagination=e.pagination}handleProductRendering(e){var i;if(!this.cardsContainer)return;const r=this.getStoreValue("address.formattedAddress");e.length>0&&r?(this.renderProducts(),this.setupInfiniteScroll()):!r&&e.length>0&&(this.renderSimplifiedProducts(e),this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:null===(i=this.getStoreValue("productsList").products[0])||void 0===i?void 0:i.id,isIndependentComponent:!![]}))}renderSimplifiedProducts(e){this.clearCardsContainer();const i=e.map(e=>ComponentFactoryService.createElement({type:s.PRODUCT_LIST_CARD,product:e,shippingFulfillment:{},onDemandFulfillment:{},productUrl:this.params.productUrl}));i.forEach(e=>{this.cardsContainer.appendChild(e)}),this.setupInfiniteScroll()}setLoadingState(e){this.loadingState=e,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case Ct.LOADING_INITIAL:this.renderLoadingState();break;case Ct.ERROR:break;case Ct.IDLE:case Ct.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){try{const e=this.getStoreValue("productsList");await this.commands.productList.loadInitialProducts(0,this.params.rows*this.params.columns,e.searchTerm,e.appliedFilters,this.params.filters);const i=this.getStoreValue("productsList");this.products=i.products,this.retailers=i.retailers,this.pagination=i.pagination}catch(e){throw this.products=[],this.retailers={},this.pagination.hasMorePages=![],e}}async loadMoreProducts(){if(this.loadingState!==Ct.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(Ct.LOADING_MORE);const e=this.getStoreValue("productsList"),i=this.buildCurrentFiltersFromState(e.appliedFilters);await this.commands.productList.loadMoreProducts(this.params.rows*this.params.columns,e.searchTerm,i,this.params.filters);const r=this.getStoreValue("productsList"),s=this.products.length;this.products=r.products,this.retailers=r.retailers,this.pagination=r.pagination;const c=this.products.slice(s);c.length>0&&this.appendNewProducts(c),this.setLoadingState(Ct.IDLE)}catch(e){this.logger.error("Error loading more products:",e),this.setLoadingState(Ct.ERROR),this.showSentinelError("Error loading products")}}buildCurrentFiltersFromState(e){const i={price:{min:wt.MIN,max:wt.MAX},fulfillment:xt.ALL};for(const[r,s]of Object.entries(e))this.mapStateFilterToComponentFilter(i,r,s);return i}mapStateFilterToComponentFilter(e,i,r){switch(i){case bt.PRICE:"object"!=typeof r||Array.isArray(r)||(e.price=r);break;case bt.FULFILLMENT:"string"==typeof r&&(e.fulfillment=r);break;case bt.ENGRAVING:"boolean"==typeof r&&(e[bt.ENGRAVING]=r);break;case bt.PRESALE:"boolean"==typeof r&&(e[bt.PRESALE]=r);break;default:Array.isArray(r)&&(e[i]=r)}}createCardsContainer(){const e=document.createElement("div");e.className="product-list-cards__container";const i=100/this.params.columns;return e.style.setProperty("--card-width",i+"%"),e.style.setProperty("--columns",""+this.params.columns),e}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const e=ComponentFactoryService.createElement({type:s.PRODUCT_LIST_CARD_LOADING,rows:this.params.rows,columns:this.getResponsiveColumns(),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 i=this.createProductCard(e);i&&this.cardsContainer.appendChild(i)}}}appendNewProducts(e){if(this.cardsContainer&&0!==e.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const i of e){const e=this.createProductCard(i);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 i=this.commands.productList.extractProductCardData(e,this.retailers);return i?ComponentFactoryService.createElement({type:s.PRODUCT_LIST_CARD,product:i.product,shippingFulfillment:i.retailer.shippingFulfillment,onDemandFulfillment:i.retailer.onDemandFulfillment,productUrl:this.params.productUrl}):null}catch(i){return this.logger.error("Error creating product card for product "+e.id+":",i),null}}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}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(e=>{const i=e[0];i.isIntersecting&&this.loadingState===Ct.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 i;e.innerHTML="",i=this.loadingState===Ct.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),e.appendChild(i)}showSentinelError(e){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const i=this.createErrorElement(e);this.sentinelElement.appendChild(i)}createLoadingElement(e){const i=document.createElement("div");i.className="product-list-sentinel-container";const r=document.createElement("div");r.className="product-list-sentinel-spinner";const s=document.createElement("div");return s.className="product-list-sentinel-text",s.textContent=e,i.appendChild(r),i.appendChild(s),i}createErrorElement(e){const i=document.createElement("div");i.className="product-list-sentinel-error-container";const r=document.createElement("div");r.className="product-list-sentinel-error-icon",r.innerHTML="⚠";const s=document.createElement("div");return s.className="product-list-sentinel-error-text",s.textContent=e,i.appendChild(r),i.appendChild(s),i}createInfoElement(e,i=![]){const r=document.createElement("div");if(r.className="product-list-sentinel-info-container",!i&&e.includes("Scroll")){const e=document.createElement("div");e.className="product-list-sentinel-icon",e.innerHTML="↓",r.appendChild(e)}else if(i){const e=document.createElement("div");e.className="product-list-sentinel-divider",r.appendChild(e)}const s=document.createElement("div");return s.className=i?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",s.textContent=e,r.appendChild(s),r}showErrorState(e){if(!this.cardsContainer)return;this.clearCardsContainer();const i=this.createErrorElement(e);this.cardsContainer.appendChild(i)}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)}doCleanup(){this.cleanupScrollObserver(),this.products=[],this.retailers={},this.cardsContainer=null,this.sentinelElement=null,this.initializationPromise=null}async onStoreWatch(e){const i=e.find(e=>"address"===e.path);if(i&&void 0!==i.value&&this.cardsContainer)try{this.pagination=this.commands.productList.createInitialPagination(),this.products=[],this.retailers={},this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(r){this.logger.error("Error refetching products after address change:",r),this.setLoadingState(Ct.ERROR),this.cardsContainer&&this.showErrorState("Failed to refetch products")}}template(){const e=[],i=document.createElement("div");return i.className="product-list-controls",this.cardsContainer=this.createCardsContainer(),i.appendChild(this.cardsContainer),e.push(i),this.renderCurrentState(),e}}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,i;const r=null!==(e=this.params.fromEvents)&&void 0!==e?e:![],s=null!==(i=this.params.showFirstEvent)&&void 0!==i?i:!![];if(r){const e=this.store.get(this.params.errorStorePath)||[],i=e.filter(e=>null==e?void 0:e.message).map(e=>({message:e.message,level:e.level||"error",type:e.type}));return s?i.slice(0,1):i}const c=this.store.get(this.params.errorStorePath);return c?[{message:c,level:"error"}]:[]}createErrorElement(e){const i=document.createElement("div");i.classList.add("alert-container","alert-"+e.level);const r=document.createElement("span");r.classList.add("alert-icon"),r.innerHTML=ErrorInfoIcon({className:e.level+"-icon"});const s=document.createElement("span");return s.classList.add("alert-text"),s.textContent=e.message,i.appendChild(r),i.appendChild(s),i}scheduleHide(){var e;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const i=null!==(e=this.params.autoHideDelay)&&void 0!==e?e:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},i)}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 i=null!==(e=this.params.fromEvents)&&void 0!==e?e:![];i?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(s.CART)});const i=document.createElement("span");if(i.className="lce-cart-button-icon",i.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",[i,e]}return[i]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const e=this.container.querySelector(".lce-cart-button-badge");if(!e)return;const i=this.getStoreValue("cart.itemsQuantity")||0;e.textContent=i.toString(),e.style.visibility=i>0?"visible":"hidden",this.store.watch("cart.itemsQuantity",()=>{const i=this.getStoreValue("cart.itemsQuantity")||0;e.textContent=i.toString(),e.style.visibility=i>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(e){var i;const r=e.find(e=>"ui.drawer"===e.path);if(!r)return![];const s=r.value,c=s.isOpen,d=null===(i=s.contentConfig)||void 0===i?void 0:i.type,h=d!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=d,this.openWithContent(s),![]):c&&this.isOpen&&!h?![]:c&&this.isOpen&&h?(this.currentContentType=d,this.openWithContent(s),![]):!c&&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:i,data:r}=e||{};let s;s=this.isElementsEnabled()?ComponentFactoryService.createElement({type:i,...r}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:i}):componentError({message:"Elements is not enabled.",componentType:i}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(s,i):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(s),this.updateDrawerContentTypeClass(i),this.open()),this.addHostAttribute("data-target",i.toString().toLowerCase())}catch(i){this.logger.error("Drawer content loading failed",i),this.commands.ui.closeDrawer()}}animateContentSwap(e,i){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const r=this.contentContainer.firstElementChild;r.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{r.classList.add("fading")}),setTimeout(()=>{r.remove(),e.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(e),this.updateDrawerContentTypeClass(i),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 i=["drawer"];this.isOpen&&i.push("open"),i.push(e.toString().toLowerCase()),this.drawerElement.className=i.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var e;try{const i=this.themeProvider.getConfigs("configurations");return null!==(e=null==i?void 0:i.isElementsEnabled)&&void 0!==e?e:![]}catch(i){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",i),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null,this.isPresale=![]}get hostClasses(){return["engraving-form"]}beforeConnected(){var e,i,r,s;if(this.engravingLines=this.params.lines,"product"===this.params.context){const c=this.store.get("products."+this.params.identifier);this.fulfillmentId=c.selectedFulfillmentId,this.partNumber=(null===(e=c.selectedFulfillment)||void 0===e?void 0:e.variant.partNumber)||null,this.isPresale=(null===(s=null===(r=null===(i=c.sizes[c.selectedSizeId])||void 0===i?void 0:i.attributes)||void 0===r?void 0:r.presale)||void 0===s?void 0:s.isActive)||![]}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,i;if("product"===this.params.context){const r=this.store.get("products."+this.params.identifier),s=r.sizes[r.selectedSizeId],c=s.shippingFulfillments[this.fulfillmentId],d=c.variant.price,h=(null===(i=null===(e=null==s?void 0:s.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.fee)||0;return d+h}if("cart"===this.params.context){const e=this.store.get("cart.items."+this.params.identifier),i=e.unitPrice,r=e.attributes.engraving.fee||0;return i+r}return 0}productInformationSection(){const e=[];let i="",r="";if("product"===this.params.context){const s=this.store.get("products."+this.params.identifier);s.sizes[s.selectedSizeId].image?e.push(s.sizes[s.selectedSizeId].image):e.push(...s.images||[]),i=s.name,r=s.sizes[s.selectedSizeId].size}if("cart"===this.params.context){const s=this.store.get("cart.items."+this.params.identifier);s.mainImage&&e.push(s.mainImage),i=s.name,r=s.size}const s=document.createElement("div");if(s.className="product-info-section",e.length>0){const r=document.createElement("div");r.className="product-image-container";const c=document.createElement("img");c.src=e[0],c.alt=i,c.loading="lazy",c.className="product-image",r.appendChild(c),s.appendChild(r)}const c=document.createElement("div");c.className="product-details-container";const d=document.createElement("div");d.className="product-header";const h=document.createElement("h4");h.className="product-title",h.textContent=i,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),d.appendChild(h),d.appendChild(this.productPriceSpan),c.appendChild(d);const u=document.createElement("p");u.className="product-size-text",u.textContent=r,c.appendChild(u);const g=document.createElement("p");return g.className="engraving-fees-disclaimer",g.textContent="Personalization fees included in total, varies by retailer.",c.appendChild(g),s.appendChild(c),s}addToCartButtonText(e){if("product"!==this.params.context)return"Save";const i=this.getConfigs("product"),r=this.isPresale?i.layout.preSaleButtonText:i.layout.addToCartButtonText;return i.layout.addToCartButtonShowTotalPrice?r+" - "+formatCentToDollarText(e):r}retailersSection(){var e,i,r,s,c,d,h;const u=this.store.get("products."+this.params.identifier),g=u.sizes[u.selectedSizeId],v=Object.values(g.shippingFulfillments).filter(e=>e.variant.isEngravable),b=document.createElement("div");b.className="fulfillment-section";const x=document.createElement("p");if(x.className="shipping-from-text",x.innerHTML="Shipping from: <b>"+(null===(e=u.selectedFulfillment)||void 0===e?void 0:e.retailerName)+"</b>",b.appendChild(x),1===v.length)return b;const k=document.createElement("div");k.className="fulfillment-options-container",b.appendChild(k);const E=document.createElement("span");E.className="see-more-fulfillments",E.textContent="See More Delivery Options ("+v.length+")",E.setAttribute("role","button"),E.setAttribute("tabindex","0"),E.setAttribute("aria-label","See More Delivery Options ("+v.length+")"),E.setAttribute("aria-expanded","false");const y=()=>{const e=k.classList.contains("expanded");k.classList.toggle("expanded"),e?(E.textContent="See More Delivery Options ("+v.length+")",E.setAttribute("aria-label","See More Delivery Options ("+v.length+")"),E.setAttribute("aria-expanded","false")):(E.textContent="See Less Delivery Options",E.setAttribute("aria-label","See Less Delivery Options"),E.setAttribute("aria-expanded","true"))};E.addEventListener("click",y),E.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),y())}),b.appendChild(E);for(const _ of v){const e=document.createElement("div");e.className="fulfillment-option",e.setAttribute("data-fulfillment-id",_.id),_.id===(null===(i=u.selectedFulfillment)||void 0===i?void 0:i.id)&&e.classList.add("selected"),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("aria-label","Select delivery from "+_.retailerName+", "+formatCentToDollarText(_.variant.price+((null===(s=null===(r=u.sizes[u.selectedSizeId].attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.fee)||0))+", "+_.engravingExpectation),e.setAttribute("aria-pressed",_.id===(null===(c=u.selectedFulfillment)||void 0===c?void 0:c.id)?"true":"false");const C=()=>{this.fulfillmentId=_.id,this.partNumber=_.variant.partNumber;const i=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(i),this.productPriceSpan.textContent=formatCentToDollarText(i);const r=k.querySelector(".fulfillment-option.selected");r&&(r.classList.remove("selected"),r.setAttribute("aria-pressed","false")),e.classList.add("selected"),e.setAttribute("aria-pressed","true"),x.innerHTML="Shipping from: <b>"+_.retailerName+"</b>"};e.addEventListener("click",C),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),C())});const g=_.variant.price+((null===(h=null===(d=u.sizes[u.selectedSizeId].attributes)||void 0===d?void 0:d.engraving)||void 0===h?void 0:h.fee)||0),v=document.createElement("div");v.className="option-row row-1",e.appendChild(v);const b=document.createElement("span");b.className="retailer-name",b.textContent=_.retailerName,v.appendChild(b);const E=document.createElement("span");E.className="fulfillment-price",E.textContent=formatCentToDollarText(g),v.appendChild(E),e.appendChild(v);const F=document.createElement("div");F.className="option-row row-2",e.appendChild(F);const D=document.createElement("span");D.className="estimated-time",D.textContent=_.engravingExpectation,F.appendChild(D),e.appendChild(F),k.appendChild(e)}return b}engravingLinesSection(){var e;const i=this.getConfigs("global"),{lines:r,maxLines:s,location:c,maxCharsPerLine:d}=this.params,h=document.createElement("div");h.className="engraving-section";const u=document.createElement("p");if(u.className="engraving-title",u.textContent=i.layout.personalizationText,h.appendChild(u),c&&(null===(e=null==c?void 0:c.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 "+c.toLowerCase()+".",h.appendChild(e)}const g=Array.from({length:s},(e,i)=>{const s=i+1,c=document.createElement("div");c.className="engraving-input-wrapper",c.setAttribute("data-line-number",s.toString());const h=document.createElement("input");h.type="text",h.id="engraving-line-"+s,h.dataset.lineNumber=s.toString(),h.maxLength=d,h.value=r[i]||"",h.placeholder=s>1?"Line "+s+" (optional)":"Line "+s,h.className="engraving-input",h.autocomplete="off",h.setAttribute("aria-label",s>1?"Engraving line "+s+", optional, maximum "+d+" characters":"Engraving line "+s+", maximum "+d+" characters");const u=document.createElement("span");return u.className="engraving-char-count",u.textContent=h.value.length+"/"+d,u.setAttribute("aria-live","polite"),u.setAttribute("aria-atomic","true"),h.addEventListener("input",()=>{u.textContent=h.value.length+"/"+d,this.engravingLines[i]=h.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),c.appendChild(h),c.appendChild(u),c}),v=document.createElement("div");return v.className="engraving-inputs-container",v.append(...g),h.appendChild(v),h}actionButtonsSection(){const{identifier:e,context:i}=this.params,r=document.createElement("div");r.className="action-buttons-container";const c=document.createElement("button");c.type="button",c.className="cancel-action-button",c.textContent="Cancel",c.setAttribute("aria-label","Cancel personalization and close");const p=async()=>{"product"===i&&await this.commands.product.closeProductDrawer(e),"cart"===i&&this.commands.ui.openDrawer(s.CART)};c.addEventListener("click",p),c.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),p())}),r.appendChild(c),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===i?"Add personalized item to cart":"Update personalization and return to cart");const l=async()=>{const r=this.engravingLines.map(e=>e.trim().toUpperCase()).filter(e=>e&&e.length>0);if("product"===i&&this.fulfillmentId&&this.partNumber){const i={fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:r,identifier:e};this.isPresale?await this.commands.product.addPresaleToCart(e,i):await this.commands.product.addToCart(e,i),await this.commands.product.closeProductDrawer(e)}"cart"===i&&(await this.commands.cart.updateItemEngraving(e,r),this.commands.ui.openDrawer(s.CART))};return this.addToCartButton.addEventListener("click",l),this.addToCartButton.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),l())}),r.appendChild(this.addToCartButton),r}template(){const e=[],i=this.productInformationSection();if(e.push(i),"product"===this.params.context){const i=this.retailersSection();e.push(i)}const r=this.engravingLinesSection();e.push(r);const s=this.actionButtonsSection();e.push(s);const c=document.createElement("p");return c.className="engraving-disclaimer",c.innerHTML="Personalized orders require up to 10 business days to be processed and then shipped. Tracking information will be provided once processed. <b>Personalized bottle orders cannot be cancelled.</b>",e.push(c),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 i=this.getStoreValue("cart.items."+e),r=(null==i?void 0:i.attributes.engraving.fee)||0,s=(null==i?void 0:i.quantity)||1;return{quantity:s,fee:r,total:r*s}}if("checkout"===this.params.context){const i=this.getStoreValue("checkout.items."+e),r=(null==i?void 0:i.attributes.engraving.fee)||0,s=(null==i?void 0:i.quantity)||1;return{quantity:s,fee:r,total:r*s}}return{quantity:0,fee:0,total:0}}engravingLines(){const e=this.params.identifier;if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+e);return(null==i?void 0:i.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const i=this.getStoreValue("checkout.items."+e);return(null==i?void 0:i.attributes.engraving.lines)||[]}return[]}handleEdit(){var e,i,r,c,d,h,u,g,v,b,x,k,E,_,F,D,T,A,O,z;const L=this.params.identifier,R={identifier:L,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const s=this.getStoreValue("cart.items."+L);R.lines=(null===(i=null===(e=null==s?void 0:s.attributes)||void 0===e?void 0:e.engraving)||void 0===i?void 0:i.lines)||[],R.maxLines=(null===(c=null===(r=null==s?void 0:s.attributes)||void 0===r?void 0:r.engraving)||void 0===c?void 0:c.maxLines)||1,R.maxCharsPerLine=(null===(h=null===(d=null==s?void 0:s.attributes)||void 0===d?void 0:d.engraving)||void 0===h?void 0:h.maxCharsPerLine)||16,R.fee=(null===(g=null===(u=null==s?void 0:s.attributes)||void 0===u?void 0:u.engraving)||void 0===g?void 0:g.fee)||0,R.location=(null===(b=null===(v=null==s?void 0:s.attributes)||void 0===v?void 0:v.engraving)||void 0===b?void 0:b.location)||""}if("checkout"===this.params.context){const e=this.getStoreValue("checkout.items."+L);R.lines=(null===(k=null===(x=null==e?void 0:e.attributes)||void 0===x?void 0:x.engraving)||void 0===k?void 0:k.lines)||[],R.maxLines=(null===(_=null===(E=null==e?void 0:e.attributes)||void 0===E?void 0:E.engraving)||void 0===_?void 0:_.maxLines)||1,R.maxCharsPerLine=(null===(D=null===(F=null==e?void 0:e.attributes)||void 0===F?void 0:F.engraving)||void 0===D?void 0:D.maxCharsPerLine)||16,R.fee=(null===(A=null===(T=null==e?void 0:e.attributes)||void 0===T?void 0:T.engraving)||void 0===A?void 0:A.fee)||0,R.location=(null===(z=null===(O=null==e?void 0:e.attributes)||void 0===O?void 0:O.engraving)||void 0===z?void 0:z.location)||""}this.commands.ui.openDrawer(s.ENGRAVING_FORM,R)}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(),i=this.engravingLines();if(0===i.length)return"";const r=document.createElement("div");r.className="engraving-header";const s=document.createElement("h3");s.textContent="Personalization";const c=document.createElement("span");if(c.className="engraving-fee",1===e.quantity&&(c.textContent=formatCentToDollarText(e.total,![])),e.quantity>1){c.textContent=formatCentToDollarText(e.total,![]);const i=document.createElement("span");i.className="engraving-fee-each",i.textContent=" ("+formatCentToDollarText(e.fee,![])+" ea)",c.appendChild(i)}r.appendChild(s),r.appendChild(c);const d=document.createElement("div");d.className="engraving-body";const h=document.createElement("div");h.className="engraving-lines";for(const v of i){const e=document.createElement("span");e.className="engraving-line",e.textContent=v,h.appendChild(e)}const u=document.createElement("div");u.className="engraving-actions";const g=document.createElement("button");g.type="button",g.classList.add("remove-button"),g.textContent="Remove",g.setAttribute("aria-label","Remove engraving");const f=async()=>{await this.handleRemove()};if(g.addEventListener("click",f),g.addEventListener("keydown",async e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),await f())}),u.appendChild(g),"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())}),u.appendChild(e)}return d.appendChild(h),d.appendChild(u),[r,d]}}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 i=e.target,r=i.selectionStart||0,s=i.value;r>0&&/\D/.test(s[r-1])&&setTimeout(()=>{const e=Math.max(0,r-2);i.setSelectionRange(e,e)},0)}}formatPhoneNumber(e){const i=e.target;let r=i.value.replace(/\D/g,"");r.length>10&&(r=r.substring(0,10)),r.length>=6?r="("+r.substring(0,3)+") "+r.substring(3,6)+"-"+r.substring(6):r.length>=3&&(r="("+r.substring(0,3)+") "+r.substring(3)),i.value=r}formatDate(e){const i=e.target,r=i.value,s=i.selectionStart||0;let c=0,d;if(s>2&&(c=1),s>5&&(c=2),r.includes("/")){const e=r.split("/");let i=(e[0]||"").replace(/\D/g,"").substring(0,2);const s=(e[1]||"").replace(/\D/g,"");let c=s.substring(0,2);const h=s.substring(2);let u=(e[2]||"").replace(/\D/g,"");if(u=(h+u).substring(0,4),""===i&&3===e.length&&(i="01"),2===i.length){let e=Number.parseInt(i,10);e>12&&(e=12),e<1&&(e=1),i=e.toString().padStart(2,"0")}if(""===c&&3===e.length&&(c="01"),2===c.length){let e=Number.parseInt(c,10);e>31&&(e=31),e<1&&(e=1),c=e.toString().padStart(2,"0")}d=i,(e.length>1||c)&&(d+="/"+c),(u||e.length>2)&&(d+="/"+u)}else{let e=r.replace(/\D/g,"");if(e.length>8&&(e=e.substring(0,8)),e.length>=2){let i=Number.parseInt(e.substring(0,2),10);i>12&&(i=12),e=i.toString().padStart(2,"0")+e.substring(2)}if(e.length>=4){let i=Number.parseInt(e.substring(2,4),10);i>31&&(i=31),e=e.substring(0,2)+i.toString().padStart(2,"0")+e.substring(4)}d=e.length>=5?e.substring(0,2)+"/"+e.substring(2,4)+"/"+e.substring(4):e.length>=3?e.substring(0,2)+"/"+e.substring(2):e}if(i.value=d,r.includes("/")){let e;e=0===c?Math.min(s,2):1===c?Math.min(s,5):d.length,i.setSelectionRange(e,e)}}validateEmail(e){const i=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return i.test(e)}validateTel(e){const i=/^\(\d{3}\) \d{3}-\d{4}$/;return i.test(e)}validateDate(e){const i=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!i.test(e))return![];const[r,s,c]=e.split("/").map(Number),d=new Date(c,r-1,s);return d.getFullYear()===c&&d.getMonth()===r-1&&d.getDate()===s}parseDateString(e){if(!this.validateDate(e))return null;const[i,r,s]=e.split("/").map(Number);return new Date(s,i-1,r)}calculateAge(e){const i=new Date;let r=i.getFullYear()-e.getFullYear();const s=i.getMonth()-e.getMonth();return(s<0||0===s&&i.getDate()<e.getDate())&&r--,r}validateDateConstraints(e){const i=[],r=this.params.validation;if(!r)return i;const s=this.parseDateString(e);if(!s)return i;const c=s.getFullYear();void 0!==r.minYear&&c<r.minYear&&i.push("Year must be "+r.minYear+" or later"),void 0!==r.maxYear&&c>r.maxYear&&i.push("Year must be "+r.maxYear+" or earlier");const d=this.calculateAge(s);return void 0!==r.minAge&&d<r.minAge&&i.push("Must be at least "+r.minAge+" years old"),void 0!==r.maxAge&&d>r.maxAge&&i.push("Must be no more than "+r.maxAge+" years old"),i}isFieldComplete(){var e,i,r;const s=this.inputElement.value.trim();if(!s)return![];switch(this.params.inputType){case"tel":return this.validateTel(s);case"date":case"birthdate":return this.validateDate(s);case"email":return s.includes("@")&&(null===(e=s.split("@")[1])||void 0===e?void 0:e.includes("."));case"number":return!Number.isNaN(Number.parseFloat(s));default:return(null===(i=this.params.validation)||void 0===i?void 0:i.max)&&s.length>=this.params.validation.max||(null===(r=this.params.validation)||void 0===r?void 0:r.min)&&s.length>=this.params.validation.min?!![]:s.length>=3}}validateInput(){const e=this.inputElement.value,i=[],r=this.params.validation;if(!r)return this.showErrors([]),!![];if(r.required&&!e.trim()&&i.push("This field is required"),!r.required&&!e.trim())return this.showErrors([]),!![];if(e.trim()){if("email"!==this.params.inputType||this.validateEmail(e)||i.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(e)||i.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"===this.params.inputType||"birthdate"===this.params.inputType)if(this.validateDate(e)){const r=this.validateDateConstraints(e);i.push(...r)}else i.push("Please enter a valid date (MM/DD/YYYY)");if("number"===this.params.inputType){const s=Number.parseFloat(e);Number.isNaN(s)?e.trim()&&i.push("Please enter a valid number"):(void 0!==r.min&&s<r.min&&i.push("Value must be at least "+r.min),void 0!==r.max&&s>r.max&&i.push("Value must be no more than "+r.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==r.min&&e.length<r.min&&i.push("Must be at least "+r.min+" characters"),void 0!==r.max&&e.length>r.max&&i.push("Must be no more than "+r.max+" characters")),r.pattern){const s=new RegExp(r.pattern);s.test(e)||i.push("Invalid format")}if(r.customValidator){const s=r.customValidator(e);s&&i.push(s)}}this.showErrors(i);const s=0===i.length;return this.params.onValidation&&this.params.onValidation(s,i),s}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 i of e){const e=document.createElement("div");e.className="error-message",e.textContent=i,this.errorContainer.appendChild(e)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(e){this.inputElement.value=e,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var e;const i=[];if(this.params.label){const r=document.createElement("label");r.textContent=this.params.label,(null===(e=this.params.validation)||void 0===e?void 0:e.required)&&(r.textContent+="*"),r.setAttribute("for",this.params.name),i.push(r)}return this.inputElement=document.createElement("input"),this.inputElement.type="birthdate"===this.params.inputType?"text":this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||(this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.params.placeholder||(this.inputElement.placeholder="MM/DD/YYYY")),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",e=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(e.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",i.push(this.inputElement),i.push(this.errorContainer),i}}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,i){if(this.A)return;if(!e||"string"!=typeof e)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(i&&i 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");i&&"function"==typeof i.rerender&&(this.U=e=>{i.rerender(e||"LceElementRerender")}),this.V.appendChild(i),this.applyBasicStyles();const r=ThemeProviderService.getInstance(),s=r.getStylesheet(e);this.applyThemeStyles(s),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 i=new CSSStyleSheet;i.replaceSync(e),this.V.adoptedStyleSheets=[i,...this.V.adoptedStyleSheets]}else this.createFallbackStylesheet(e)}catch(yt){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 i=document.createElement("style");i.textContent=e,this.V&&this.V.appendChild(i)}}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 i=document.createElement("span");i.className="pb-text",i.textContent="Powered by",e.appendChild(i);const r=document.createElement("span");r.className="pb-lc",r.textContent="LiquidCommerce",e.appendChild(r);const s=document.createElement("span");return s.className="pb-dot",s.textContent=".",e.appendChild(s),e}createDisclaimerSection(){const e=document.createElement("div");e.className="pb-disclaimer-container";const i=this.getDisclaimerConfig();return i.parts.forEach(i=>{"text"===i.type?e.appendChild(document.createTextNode(i.content)):"link"===i.type&&e.appendChild(this.createLink(i.href,i.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,i){const r=document.createElement("a");return r.href=e,r.target="_blank",r.rel="noopener noreferrer",r.className="pb-link",r.textContent=i,r.setAttribute("role","link"),r.setAttribute("aria-label","Read "+i),r}template(){const e=this.createPoweredBySection(),i=this.createDisclaimerSection();return[e,i]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(e){const i=e.find(e=>"cart.promoCode"===e.path||"checkout.promoCode"===e.path);if(!i||!this.applyButton||!this.currentActiveTicker)return;const r=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);r&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!r&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(e){const i=this.store.get("cart.promoCode"),r=this.store.get("checkout.promoCode");return(null==i?void 0:i.code)===e||(null==r?void 0:r.code)===e}getActiveTickers(){var e;const i=this.store.get("address");return null===(e=this.params.tickers)||void 0===e?void 0:e.filter(e=>{var r;return isDateTimeInRange({startDate:e.activeFrom,endDate:e.activeUntil,addressState:null===(r=null==i?void 0:i.address)||void 0===r?void 0:r.state})})}selectCurrentTicker(e){return 0===e.length?null:e[0]}generateTextContent(e){const i=document.createElement("div");i.classList.add("promo-ticker__text-group");const r=e.text.map(e=>e.trim()).map(e=>e.substring(0,50)).filter(e=>""!==e.trim()).slice(0,5);for(const s of r){const r=s.trim();if(!r)continue;const c=document.createElement("span");c.classList.add("promo-ticker__text-item"),c.textContent=r,i.appendChild(c);const d=document.createElement("span");d.classList.add("promo-ticker__separator"),d.textContent=e.separator,i.appendChild(d)}return i}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 i=document.createElement("div");i.classList.add("promo-ticker__content");const r=document.createElement("div");r.classList.add("promo-ticker__track");for(let c=0;c<5;c++)r.appendChild(this.generateTextContent(this.currentActiveTicker));i.appendChild(r);const s=document.createElement("button");return s.type="button",s.classList.add("promo-ticker__cta"),s.textContent="APPLY",s.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(s.disabled=!![],s.textContent="APPLIED"),s.addEventListener("click",()=>this.handlePromoClick()),s.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.handlePromoClick())}),this.applyButton=s,[i,s]}}class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const e=this.config||{};if(e.showIcon===![])return null;const i={warning:"warning",success:"success",info:"info"},r={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},s=i[this.params.messageType]||"warning",c=document.createElement("div");return c.className="alert-icon alert-icon-"+this.params.messageType,c.appendChild(htmlStringToElement(r[s]({width:16,height:16,className:"alert-icon-svg"}))),c}template(){var e;const i=[],r=this.getIconElement();r&&i.push(r);const s=document.createElement("span");if(s.className="alert-message",s.textContent=this.params.message,i.push(s),"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 r=document.createElement("small");r.className="alert-details-text",r.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),e.appendChild(r),i.push(e)}return i}}const zt=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,i){if(!e||!i)return e;const r={...e},s=[];for(const c in i){const d=i[c],h=r[c];if(!(c in e)){s.push('Property "'+c+'" does not exist in target schema, skipping merge.');continue}const u=getType(d),g=getType(h);u===g?isObject(d)&&isObject(h)?r[c]=deepMergeConfigs(h,d):r[c]=d:s.push('Type mismatch for key "'+c+'": source is '+u+", target is "+g+". Skipping merge.")}return s.length>0&&zt.warn("Merging configurations with warnings:",s),r}const Lt=new Map([["global.layout.enablePersonalization",[s.PRODUCT,s.CART,s.CHECKOUT,s.ENGRAVING_FORM,s.ENGRAVING_VIEW,s.PRODUCT_INTERACTIONS,s.CART_ITEM,s.CHECKOUT_ITEM]],["global.layout.personalizationText",[s.PRODUCT,s.CART,s.CHECKOUT,s.ENGRAVING_FORM,s.ENGRAVING_VIEW,s.CART_ITEM]],["global.layout.personalizationCardStyle",[s.PRODUCT,s.CART,s.CHECKOUT,s.ENGRAVING_FORM,s.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[s.CART,s.CART_PROMO_CODE,s.CART_FOOTER,s.CHECKOUT_ORDER_SUMMARY,s.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[s.CART,s.CHECKOUT,s.ADDRESS,s.INPUT,s.ADDRESS_INPUT,s.CHECKOUT_DELIVER_TO,s.CHECKOUT_BUYER,s.CHECKOUT_BILLING,s.CHECKOUT_PAYMENT,s.CART_PROMO_CODE]],["global.layout.showPoweredBy",[s.CART,s.CHECKOUT,s.CHECKOUT_COMPLETED,s.POWERED_BY,s.CART_FOOTER,s.CHECKOUT_ORDER_SUMMARY,s.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[s.POWERED_BY]],["product.layout.showImages",[s.PRODUCT,s.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[s.PRODUCT]],["product.layout.showDescription",[s.PRODUCT,s.PRODUCT_DESCRIPTION,s.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[s.PRODUCT,s.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[s.PRODUCT,s.PRODUCT_RETAILERS,s.PRODUCT_RETAILERS_CAROUSEL,s.PRODUCT_RETAILERS_POPUP,s.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[s.PRODUCT,s.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[s.PRODUCT,s.PRODUCT_IMAGE_CAROUSEL,s.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[s.PRODUCT,s.PRODUCT_RETAILERS,s.PRODUCT_RETAILERS_CAROUSEL,s.PRODUCT_RETAILERS_POPUP,s.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[s.PRODUCT,s.PRODUCT_RETAILERS,s.PRODUCT_RETAILERS_CAROUSEL,s.PRODUCT_RETAILERS_POPUP,s.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[s.PRODUCT,s.PRODUCT_ADD_TO_CART_SECTION,s.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[s.PRODUCT,s.PRODUCT_ADD_TO_CART_SECTION,s.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[s.PRODUCT,s.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[s.PRODUCT,s.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[s.CART,s.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[s.CART,s.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[s.CART,s.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[s.CART,s.CART_FOOTER]],["checkout.layout.emailOptIn",[s.CHECKOUT,s.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[s.CHECKOUT,s.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[s.CHECKOUT,s.CHECKOUT_GIFT_CARDS,s.CHECKOUT_ORDER_SUMMARY,s.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[s.CHECKOUT,s.CHECKOUT_ORDER_SUMMARY,s.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[s.CHECKOUT,s.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[s.CHECKOUT,s.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[s.CHECKOUT,s.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[s.CHECKOUT,s.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[s.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(e,i){const r=new Set;for(const s of Object.keys(i)){const i=Lt.get(e+"."+s);if(i)for(const e of i)r.add(e)}return Array.from(r)}class ElementsBaseClient{constructor(e){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.modalCreated=![],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("Client preparation failed",e),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),e}}async prepareEssentialServices(){this.clientConfig.set("version",yt.version);const e=this.clientConfig.isProduction(),i=this.clientConfig.isDebuggingEnabled();!e&&i&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled")),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),!e&&i&&this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized")),this.logger.info("🔐 Starting authentication and loading configurations...");const{success:r,configs:s}=await this.authClient.authenticateAndGetConfigs();if(!r||!s)throw this.clientPrepared=![],new SDKError("Authentication failed",!![]);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 c=s;this.clientConfig.set("partnerCode",c.configurations.partnerCode),this.clientConfig.set("partnerName",c.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const d=await this.fingerPrintService.getId(c.configurations.partnerCode),h=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",d),this.clientConfig.set("isLocalStorageAvailable",h);const u=h?null:await this.apiClient.getPersistedStore(d);if(await this.store.initialize({userDeviceId:d,isLocalStorageAvailable:h,persistedStore:u}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const e=this.clientConfig.get("customTheme"),i=c.global.layout.showPoweredBy;c=deepMergeConfigs(c,e),c.global.layout.showPoweredBy=i}await this.themeProvider.initialize(c),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.ensureModalExists(),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:i,containerId:r,...c}=e;if(!r||"string"!=typeof r)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof r?'"'+r+'"':r),!![]);if(!i)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const d=r.replace("#",""),h=document.getElementById(d);if(!h)return console.warn("Container with ID '"+d+"' not found"),null;h.innerHTML="";const u={type:e.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...c},g=ComponentFactoryService.createElement(u);if(safeReplaceChildren(h,g),e.type===s.CHECKOUT){const i=e.checkoutId;await this.commands.checkout.loadCheckout({customCartId:i})}return this.createInjectedComponentWrapper(d,e.type,g)}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 i=e.slice(0,20),r=[],c=[];for(const s of i){if(!s||"object"!=typeof s){this.logger.warn("Invalid product parameter: must be an object");continue}if(!s.containerId||"string"!=typeof s.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+s.identifier+"'");continue}const e=s.containerId.replace("#","").trim();if(!e){this.logger.warn("Container ID is required for product with ID '"+s.identifier+"'");continue}const i=document.getElementById(e);if(!i){this.logger.warn("Container with ID '"+e+"' not found for product '"+s.identifier+"'");continue}const c=r.every(i=>i.containerId!==e);if(!c){this.logger.warn("Duplicate container ID '"+e+"' found, skipping");continue}if(!s.identifier||"string"!=typeof s.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+e+"'");continue}const d=r.every(e=>e.identifier!==s.identifier);d?r.push({containerId:e,identifier:s.identifier}):this.logger.warn("Duplicate product identifier '"+s.identifier+"' found, skipping")}for(const d of r){const e=ComponentFactoryService.createElement({type:s.PRODUCT,useShadowDom:!![],productId:d.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),i=document.getElementById(d.containerId);i?(i.innerHTML="",i.appendChild(e),c.push(this.createInjectedComponentWrapper(d.containerId,s.PRODUCT,e)),await this.commands.product.createProductInstance(d.identifier,!![])):this.logger.warn("Product ("+d.identifier+") container with ID '"+d.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(r.map(e=>e.identifier)),c}async injectProductList(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e.containerId,s.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.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 i=Object.values(b);for(const r of e.filters)if(!i.includes(r))throw new SDKError('Invalid filter "'+r+'". Valid options: '+i.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 i=document.getElementById(e.containerId.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+e.containerId+'". Make sure the element exists before adding the product list.',!![]);const r=ComponentFactoryService.createElement({type:s.PRODUCT_LIST,wrapInLceElement:!![],rows:e.rows||4,columns:e.columns||4,filters:e.filters||[],productUrl:e.productUrl});safeReplaceChildren(i,r)}async injectProductListSearch(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e.containerId,s.PRODUCT_LIST_SEARCH),void 0;if(!e)throw new SDKError("Product list search requires a container ID parameter.",!![]);if(!e.containerId||"string"!=typeof e.containerId)throw new SDKError("Product list search container ID is required and must be a string. Received: "+("string"==typeof e.containerId?'"'+e.containerId+'"':e.containerId),!![]);const i=document.getElementById(e.containerId.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+e.containerId+'". Make sure the element exists before adding the product list search.',!![]);const r=ComponentFactoryService.createElement({type:s.PRODUCT_LIST_SEARCH,wrapInLceElement:!![],useShadowDom:!![],isIndependentComponent:!![]});safeReplaceChildren(i,r)}async injectProductListFilters(e){if(!this.isElementsEnabled())return this.injectDisabledElementsError(e.containerId,s.PRODUCT_LIST_FILTERS),void 0;if(!e)throw new SDKError("Product list filters requires a container ID parameter.",!![]);if(!e.containerId||"string"!=typeof e.containerId)throw new SDKError("Product list filters container ID is required and must be a string. Received: "+("string"==typeof e.containerId?'"'+e.containerId+'"':e.containerId),!![]);if(e.filters&&e.filters.length>0){const i=Object.values(b);for(const r of e.filters)if(!i.includes(r))throw new SDKError('Invalid filter "'+r+'". Valid options: '+i.join(", "),!![])}const i=document.getElementById(e.containerId.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+e.containerId+'". Make sure the element exists before adding the product list filters.',!![]);const r=ComponentFactoryService.createElement({type:s.PRODUCT_LIST_FILTERS,wrapInLceElement:!![],useShadowDom:!![],isIndependentComponent:!![],filters:e.filters});safeReplaceChildren(i,r)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const e=ComponentFactoryService.createElement({type:s.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(e),this.cartDrawerCreated=!![]}catch(e){this.logger.warn("Failed to create cart drawer:",e)}}ensureModalExists(){if(!this.modalCreated)try{const e=ComponentFactoryService.createElement({type:s.MODAL,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(e),this.modalCreated=!![]}catch(e){this.logger.warn("Failed to create modal:",e)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(e,i,r){const s={getType:()=>i,getElement:()=>document.getElementById(e),rerender:()=>{try{r&&"function"==typeof r.rerender?r.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+e+"' does not support rerender")}catch(i){this.logger.warn("Failed to rerender component in container '"+e+"'")}}};return this.injectedComponents.set(e,s),s}rerenderInjectedComponentsByType(e){for(const[i,r]of this.injectedComponents)r.getType()===e&&r.rerender()}isElementsEnabled(){var e;try{const i=this.themeProvider.getConfigs("configurations");return null!==(e=null==i?void 0:i.isElementsEnabled)&&void 0!==e?e:![]}catch(i){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",i),!![]}}injectDisabledElementsError(e,i){const r=document.getElementById(e.replace("#",""));if(!r)return this.logger.warn("Container with ID '"+e+"' not found for disabled elements error"),void 0;let s;s=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:i}):componentError({message:"Elements is not enabled.",componentType:i}),r.innerHTML="",safeReplaceChildren(r,s)}registerEssentialComponents(){ComponentFactoryService.registerComponent(s.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(s.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(s.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(s.CART,AddressInputComponent),ComponentFactoryService.registerComponent(s.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(s.MODAL,ModalComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(s.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(s.INPUT,InputComponent),ComponentFactoryService.registerComponent(s.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(s.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(s.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(s.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(s.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(s.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(s.ALERT,AlertComponent),ComponentFactoryService.registerComponent(s.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(s.MODAL,ModalComponent),ComponentFactoryService.registerComponent(s.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(s.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(s.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(s.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(s.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(s.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(s.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(s.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(s.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(s.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(s.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LIST_RETAILERS,ProductListRetailersComponent),ComponentFactoryService.registerComponent(s.CART,CartComponent),ComponentFactoryService.registerComponent(s.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(s.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(s.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(s.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(s.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(s.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(s.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(s.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(s.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(s.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(s.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(s.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(e,i)=>{if(!e||"string"!=typeof e)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);this.ensureCartDrawerExists();const r=document.getElementById(e.replace("#",""));if(!r)throw new SDKError('Cannot find element with ID "'+e+'". Make sure the element exists before adding the cart button.',!![]);const c=ComponentFactoryService.createElement({type:s.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:i});r.innerHTML="",safeReplaceChildren(r,c)},floatingCartButton:e=>{this.ensureCartDrawerExists();const i=ComponentFactoryService.createElement({type:s.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:e});document.body.appendChild(i)},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 i=document.getElementById(e.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+e+'". Make sure the element exists before displaying cart subtotal.',!![]);i.innerHTML="",i.classList.add("lce-cart-subtotal");const Q=e=>{i.textContent=formatCentToDollarText(e)},r=this.store.get("cart.subtotal")||0;Q(r),this.store.watch("cart.subtotal",()=>{const e=this.store.get("cart.subtotal")||0;Q(e)})},cartItemsCount:(e,i)=>{if(!e||"string"!=typeof e)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);let r=!![];i&&"boolean"==typeof i.hideZero&&(r=i.hideZero);const s=document.getElementById(e.replace("#",""));if(!s)throw new SDKError('Cannot find element with ID "'+e+'". Make sure the element exists before displaying cart items count.',!![]);s.innerHTML="",s.classList.add("lce-cart-items-count");const p=e=>{s.textContent=e.toString(),0===e?(r&&(s.style.visibility="hidden"),s.classList.add("no-items")):(r&&(s.style.visibility="visible"),s.classList.remove("no-items"))},c=this.store.get("cart.itemsQuantity")||0;p(c),this.store.watch("cart.itemsQuantity",()=>{const e=this.store.get("cart.itemsQuantity")||0;p(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 i of e)this.injectDisabledElementsError(i.containerId,s.PRODUCT);return[]}return await this.processInjectProduct(e)}async injectAddressElement(e,i){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:s.ADDRESS,containerId:e,options:i}):(this.injectDisabledElementsError(e,s.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:s.CART,containerId:e}):(this.injectDisabledElementsError(e,s.CART),null)}async injectCheckoutElement({containerId:e,checkoutId:i}){if(!e||"string"!=typeof e)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);const r="string"==typeof i?i.trim():void 0;if(void 0!==i&&("string"!=typeof i||!r))throw new SDKError("Checkout element requires a valid checkout ID when provided. Received: "+("string"==typeof i?'"'+i+'"':i),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:s.CHECKOUT,containerId:e,checkoutId:r}):(this.injectDisabledElementsError(e,s.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(e,r){try{SingletonManager.setContext({isBuilder:![]});const s=ClientConfigService.getInstance();s.initialize(e,{env:r.env,isBuilder:![],debugMode:r.debugMode,customTheme:r.customTheme,promoTicker:r.promoTicker,proxy:r.proxy,development:r.development,checkoutUrl:r.checkoutUrl});const c=s.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const d=await SingletonManager.getClient(c);if(!d.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const h={injectProductElement:d.injectProductElement.bind(d),injectAddressElement:d.injectAddressElement.bind(d),injectCartElement:d.injectCartElement.bind(d),injectCheckoutElement:d.injectCheckoutElement.bind(d),injectProductList:d.injectProductList.bind(d),injectProductListFilters:d.injectProductListFilters.bind(d),injectProductListSearch:d.injectProductListSearch.bind(d),ui:d.ui,actions:d.actions,getInjectedComponents:d.getInjectedComponents.bind(d)};window.elements=h;const u=PubSubService.getInstance();return u.publishAction(i.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:s.get("version")}),h}catch(s){return console.error("[LiquidCommerce Elements] Client initialization failed",s),null}}const Rt={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",ROWS:"data-rows",COLUMNS:"data-columns",FILTERS:"data-filters",FILTERS_CONTAINER:"data-filters-container",SEARCH_CONTAINER:"data-search-container",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"},CHECKOUT:{CHECKOUT:"data-lce-checkout",URL:"data-checkout-url",PARAM:"data-checkout-param"},DEVELOPMENT:"data-liquid-commerce-elements-development"};function startsWithLcePrefix(e){return null!==e&&"lce_"===e.substring(0,4)}function generateElementId({prefix:e,index:i}){const r=Math.random().toString(36).substring(2,7),s=void 0!==e?e:"",c=void 0!==i?i:"",d=s&&c?"-":"";return""+s+d+c+r}function pairsFromMainScript(e){const i=[];try{const s=e.getAttributeNames().filter(e=>e.substring(0,12)===Rt.PRODUCT.PRODUCT);for(const c of s)try{const r=c.match(/^data-product(-(.+))?$/),s=(null==r?void 0:r[2])?"-"+r[2]:"",d=""+Rt.PRODUCT.CONTAINER+s;if(e.hasAttribute(d)){const r=e.getAttribute(d),s=e.getAttribute(c);r&&s&&i.push({containerId:r,identifier:s})}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",r)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",s)}return i}function pairsFromProductsScript(){const e=[];try{const r=document.querySelectorAll("script["+Rt.PRODUCT_LIST.SCRIPT+"]");for(const s of r)try{const i=JSON.parse(s.textContent||"[]");if(!Array.isArray(i))continue;for(const r of i)r.containerId&&r.identifier&&e.push({containerId:r.containerId,identifier:r.identifier})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",i)}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",r)}return e}function pairsFromAttributedElements(){const e=[];try{const r=document.querySelectorAll("div["+Rt.PRODUCT.LCE_PRODUCT+"]");let s=0;for(const c of r)try{const i=generateElementId({prefix:"lce-p",index:s});c.setAttribute("id",i);const r=c.getAttribute(Rt.PRODUCT.LCE_PRODUCT);i&&r&&e.push({containerId:i,identifier:r}),s+=1}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",i)}}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",r)}return e}async function addProductToCartViaQueryParam(e,i){try{const s=i.getAttribute(Rt.PRODUCT.PARAM),d=i.getAttribute(Rt.PRODUCT.FULFILLMENT_TYPE_PARAM);if(!s)return;if(!startsWithLcePrefix(s))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+s+'" because it does not start with "lce_" prefix.'),void 0;const h=new URLSearchParams(window.location.search),u=h.get(s);if(!u)return;let g=c.SHIPPING;if(d)if(startsWithLcePrefix(d)){const e=h.get(d);e!==c.ON_DEMAND&&e!==c.SHIPPING||(g=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:u,fulfillmentType:g,quantity:1}],!![])}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",r)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",s)}}async function addPromoCodeToCartViaQueryParam(e,i){try{const s=i.getAttribute(Rt.PROMO_TICKER.CODE_PARAM);if(!s)return;if(!startsWithLcePrefix(s))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+s+'" because it does not start with "lce_" prefix.'),void 0;const c=new URLSearchParams(window.location.search),d=c.get(s);if(!d)return;try{await e.actions.cart.applyPromoCode(d)}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",r)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",s)}}async function setupCartButtonWithPosition(e,i,r,s){var c,d,h;try{const u=r.includes("mobile"),g=u?"mobile":"desktop",v=!u,b=i.getAttribute(r),x=i.getAttribute(s);if(!i.hasAttribute(r)&&!i.hasAttribute(s))return v&&e.ui.floatingCartButton(![]),void 0;if(v){if(i.hasAttribute(r)&&!b)return e.ui.floatingCartButton(![]),void 0;if(i.hasAttribute(s)&&!x)return e.ui.floatingCartButton(!![]),void 0}const k=b||x,E=!!x;if(!k)return v&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),e.ui.floatingCartButton(E)),void 0;const _=["above","below","replace","inside"],F=k.match(/^(\w+):(.+)$/),D=F&&_.includes(F[1])?F[1]:"inside";let T=F?F[2]:k;/^[#.]/.test(T)||/\s/.test(T)||(T="#"+T);const A=document.querySelector(T);if(!A)return v&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+T+'" not found. Using floating button.'),e.ui.floatingCartButton(E)),void 0;const O=document.createElement("div");switch(O.classList.add("lce-cart-"+g+"-button-container"),O.id=generateElementId({prefix:"lce-cart-"+g+"-btn"}),D){case"above":null===(c=A.parentNode)||void 0===c?void 0:c.insertBefore(O,A);break;case"below":null===(d=A.parentNode)||void 0===d?void 0:d.insertBefore(O,A.nextSibling);break;case"replace":null===(h=A.parentNode)||void 0===h?void 0:h.replaceChild(O,A);break;default:A.appendChild(O)}e.ui.cartButton(O.id,E)}catch(u){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",u)}}async function setupCartButtons(e,i){i.hasAttribute(Rt.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(e,i,Rt.CART.BUTTON,Rt.CART.BADGE_BUTTON),await setupCartButtonWithPosition(e,i,Rt.CART.MOBILE_BUTTON,Rt.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(e){try{const i=document.querySelector("div["+Rt.PRODUCT_LIST.LIST+"]"),r=document.querySelector("div["+Rt.PRODUCT_LIST.SEARCH_CONTAINER+"]"),s=document.querySelector("div["+Rt.PRODUCT_LIST.FILTERS_CONTAINER+"]");if(!i)return;const c="lce-products-list-container";if(i.className="lce-products-list-container",i.id=c,r){const i="lce-product-list-search-container";r.className="lce-product-list-search-container",r.id=i,await e.injectProductListSearch({containerId:i})}if(s){const i="lce-product-list-filters-container";s.className="lce-product-list-filters-container",s.id=i;const r=s.getAttribute(Rt.PRODUCT_LIST.FILTERS);let c=[];r&&(c=r.split(",").map(e=>e.trim()).filter(e=>e.length>0)),await e.injectProductListFilters({containerId:i,filters:c})}const d=Number.parseInt(i.getAttribute(Rt.PRODUCT_LIST.ROWS)||"3",10)||3,h=Number.parseInt(i.getAttribute(Rt.PRODUCT_LIST.COLUMNS)||"4",10)||4,u=i.getAttribute(Rt.PRODUCT_LIST.FILTERS),g=i.getAttribute(Rt.PRODUCT_LIST.PRODUCT_URL)||void 0;let v=[];u&&(v=u.split(",").map(e=>e.trim()).filter(e=>e.length>0)),await e.injectProductList({containerId:c,rows:d,columns:h,filters:v,productUrl:g})}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",i)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async e=>{const i=e.detail;if(!i.data.isReady)return;const r=window.elements,s=document.querySelectorAll("["+Rt.CART.TOGGLE_BUTTON+"]");if(s.length>0)for(const d of s)d.addEventListener("click",async e=>{e.stopPropagation(),e.preventDefault(),r.actions.cart.toggleCart()});const c=document.querySelectorAll("["+Rt.CART.ITEMS_COUNT+"]");if(c.length>0){let e=0;for(const i of c){const s=i.getAttribute(Rt.CART.ITEMS_COUNT),c=!(s&&"keep-zero"===s),d=Boolean(null==i?void 0:i.id);let h;d?h=i.id:(h=generateElementId({prefix:"lce-cart-items-count",index:e}),i.id=h),r.ui.cartItemsCount(h,{hideZero:c}),e+=1}}})}catch(yt){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",yt)}}function getDevelopmentConfigs(){const e=document.querySelector("script["+Rt.DEVELOPMENT+"]");if(e)try{return JSON.parse(e.textContent||"{}")}catch(i){return console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in development config script",i),void 0}}async function setupCheckout(e,i){try{const r=document.querySelector("div["+Rt.CHECKOUT.CHECKOUT+"]");if(!r)return;const s="lce-checkout-container";r.className="lce-checkout-container",r.id=s;const c=i.getAttribute(Rt.CHECKOUT.PARAM)||"lce_checkout";if(!c||!startsWithLcePrefix(c))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring checkout query parameter "'+c+'" because it does not start with "lce_" prefix.'),void 0;const d=new URLSearchParams(window.location.search),h=d.get(c);if(!h)return console.warn("[LiquidCommerce Elements Auto Initialization] Checkout ID not found in query parameters."),void 0;await e.injectCheckoutElement({containerId:s,checkoutId:h})}catch(r){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup checkout:",r)}}async function ElementsAutoInitialize(){var i,r,s,c,h;try{const u=document.querySelector("script["+Rt.CORE.MAIN_SCRIPT+"]");if(!u)return;const g=u.getAttribute(Rt.CORE.TOKEN),v=u.getAttribute(Rt.CORE.ENV)||e.PRODUCTION,b=u.getAttribute(Rt.CORE.DEBUG_MODE);if(!g)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const x=u.getAttribute(Rt.PROMO_TICKER.CODE),k=u.getAttribute(Rt.PROMO_TICKER.TEXT),E=null!==(i=u.getAttribute(Rt.PROMO_TICKER.SEPARATOR))&&void 0!==i?i:"•",_=null!==(r=u.getAttribute(Rt.PROMO_TICKER.ACTIVE_FROM))&&void 0!==r?r:void 0,F=null!==(s=u.getAttribute(Rt.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==s?s:void 0,D=u.getAttribute(Rt.CHECKOUT.URL)||void 0,T=pairsFromMainScript(u),A=pairsFromProductsScript(),O=pairsFromAttributedElements(),z=[...T,...A,...O],L=x&&k&&_&&F?{promoCode:x,text:k.split("|").map(e=>e.trim()).filter(e=>e.length>0),separator:E,activeFrom:null===(c=new Date(_))||void 0===c?void 0:c.toISOString(),activeUntil:null===(h=new Date(F))||void 0===h?void 0:h.toISOString()}:void 0;let R=d.NONE;b&&v!==e.PRODUCTION&&(R=b),setupEventListeners();const M=await Elements(g,{env:v,debugMode:R,promoTicker:L?[L]:void 0,checkoutUrl:D,development:getDevelopmentConfigs()});if(!M)throw new SDKError("Elements SDK client initialization failed",!![]);setupCartButtons(M,u),0!==z.length&&M.injectProductElement(z).catch(e=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",e)}),await initializeProductsList(M),addProductToCartViaQueryParam(M,u),addPromoCodeToCartViaQueryParam(M,u),setupCheckout(M,u)}catch(u){console.error("[LiquidCommerce Elements Auto Initialization]",u)}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(yt){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",yt)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(yt){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",yt)}},50)}catch(yt){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",yt)}}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 i of getComponentTypesForLayoutFields("global.layout",e.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(i){throw this.logger.error("❌ Failed to update global theme configuration",i),new SDKError("Failed to update global configuration: "+i.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 i of getComponentTypesForLayoutFields("product.layout",e.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(i){throw this.logger.error("❌ Failed to update product component theme",i),new SDKError("Failed to update product configuration: "+i.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 i of getComponentTypesForLayoutFields("cart.layout",e.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(i){throw this.logger.error("❌ Failed to update cart component theme",i),new SDKError("Failed to update cart configuration: "+i.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 i of getComponentTypesForLayoutFields("checkout.layout",e.layout))this.rerenderInjectedComponentsByType(i)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(i){throw this.logger.error("❌ Failed to update checkout component theme",i),new SDKError("Failed to update checkout configuration: "+i.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(i){throw this.logger.error("❌ Failed to update address component theme",i),new SDKError("Failed to update address configuration: "+i.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,i){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:s.ADDRESS,containerId:e,options:i})}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:s.CART,containerId:e})}async injectCheckoutElement(e,i){if(!e||"string"!=typeof e)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof e?'"'+e+'"':e),!![]);const r=await this.processInjectElement({type:s.CHECKOUT,containerId:e});if(null==i?void 0:i.simulatePresale){const e=i.presaleExpiresInMinutes||15,r=new Date;r.setMinutes(r.getMinutes()+e),this.store.set("checkout.presale",{isLocked:!![],expiresAt:r.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+e+" minutes")}return r}}async function ElementsBuilder(e,r){try{SingletonManager.setContext({isBuilder:!![]});const s=ClientConfigService.getInstance();s.initialize(e,{env:r.env,isBuilder:!![],debugMode:r.debugMode,customTheme:r.customTheme,promoTicker:r.promoTicker,checkoutUrl:r.checkoutUrl,proxy:void 0,development:void 0});const c=s.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const d=await SingletonManager.getClient(c);if(!d.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const h={updateComponentGlobalConfigs:d.updateComponentGlobalConfigs.bind(d),updateProductComponent:d.updateProductComponent.bind(d),updateAddressComponent:d.updateAddressComponent.bind(d),updateCartComponent:d.updateCartComponent.bind(d),updateCheckoutComponent:d.updateCheckoutComponent.bind(d),injectElement:d.injectElement.bind(d),injectProductElement:d.injectProductElement.bind(d),injectAddressElement:d.injectAddressElement.bind(d),injectCartElement:d.injectCartElement.bind(d),injectCheckoutElement:d.injectCheckoutElement.bind(d),injectProductList:d.injectProductList.bind(d),actions:d.actions};window.elementsBuilder=h;const u=PubSubService.getInstance();return u.publishAction(i.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:s.get("version")}),h}catch(s){return console.error("[LiquidCommerce Elements] Client initialization failed",s),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=(i,r,s,c,d)=>isSDKError(d,r)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:i,source:r,lineno:s,colno:c,error:d}),!![]):e?e(i,r,s,c,d):![];const i=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;i&&i.call(window,e)};try{initializeDOMPolyfills()}catch(Mt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Mt)}try{triggerElementsAutoInit()}catch(jt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",jt)}}catch(Nt){console.error("[LiquidCommerce Elements] SDK initialization failed:",Nt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
1
+ (function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,e(t.LiquidCommerceElements={}))})(this,function(exports){"use strict";function polyfillReplaceChildren(){"undefined"!=typeof Element&&"replaceChildren"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceChildren=function(...t){for(;this.firstChild;)this.removeChild(this.firstChild);for(const e of t)"string"==typeof e?this.appendChild(document.createTextNode(e)):this.appendChild(e)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const e=document.createDocumentFragment();for(const n of t)"string"==typeof n?e.appendChild(document.createTextNode(n)):e.appendChild(n);this.insertBefore(e,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.replaceChild(n,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.insertBefore(n,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const e=this.parentNode;if(!e)return;const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);e.insertBefore(n,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const e={};for(const[n,i]of t)e[n]=i;return e})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(bt){console.warn("DOM polyfills initialization failed:",bt)}}function safeReplaceChildren(t,...e){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...e);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const n of e)"string"==typeof n?t.appendChild(document.createTextNode(n)):t.appendChild(n)}}catch(n){console.error("replaceChildren operation failed:",n),1===e.length&&"string"==typeof e[0]&&(t.innerHTML=e[0])}}const t={DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},e={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",INTERNAL_CART_TO_CHECKOUT:"internal_cart_to_checkout",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},n={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},i={DRAWER:"drawer",INPUT:"input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",MODAL:"modal",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_SEARCH:"product-list-search",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",PRODUCT_LIST_RETAILERS:"product-list-retailers",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},o={ON_DEMAND:"onDemand",SHIPPING:"shipping"},r={NONE:"none",CONSOLE:"console",PANEL:"panel"},s={PROMO_CODE:"promo-code"},a={GENERIC:"generic",PROMO_CODE:"promo-code",GIFT_CARD:"gift-card"},c={SUCCESS:"success",WARNING:"warning",ERROR:"error"},p={[t.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[t.STAGING]:"https://staging-elements.liquidcommerce.us",[t.PRODUCTION]:"https://elements.liquidcommerce.us"},m={ENGRAVING:"engraving",PRESALE:"presale",FULFILLMENT:"fulfillment",PRICE:"price",BRANDS:"brands",CATEGORIES:"categories",FLAVOR:"flavor",REGION:"region",VARIETY:"variety",VINTAGE:"vintage",COUNTRY:"country",APPELLATION:"appellation",MATERIALS:"materials",SIZES:"sizes"},f={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040,MODAL:2147483640};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\/(?:main|checkout)\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],p=[/elements-sdk[/\\]/i,/modules[/\\](?:cart|product|checkout|address|product-list|theme-provider|ui-components)[/\\]/,/core[/\\](?:auth|store|command|api-client|telemetry|fingerprint|google-tag-manager|client|component-factory|pubsub|singleton-manager|debug-panel)[/\\]/,/@liquidcommerce[/\\]elements-sdk/i],m=isSDKSource(r),f=s.some(t=>t.test(o)),g=a.some(t=>t.test(o)),v=c.some(t=>t.test(o)),b=p.some(t=>t.test(o));return i||m||f||g||v||b}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))}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 g="lce",v={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},b={id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",noAvailabilityPrice:0,identifier:"",sizes:{},quantity:1,selectedSizeId:null,selectedFulfillmentType:o.SHIPPING,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null},x={id:"",subtotal:0,itemsQuantity:0,items:{},fulfillments:{},retailers:{},promoCode:null,events:[],loading:![],error:null,rerender:![],shouldReset:![]},w={token:"",cartId:"",loading:![],updating:![],error:null,presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddress:{formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{latitude:0,longitude:0}},promoCode:null,giftCards:[],orderNumber:null,itemsQuantity:0,items:{},fulfillments:{},retailers:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,engraving:0,giftCards:0,tip:0,service:0,platform:0,tax:0},rerender:![],tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},S={drawer:{isOpen:![],contentConfig:null},modal:{isOpen:![],contentConfig:null}},E={checkout:{injection:null,returnUrl:null}},_={products:[],retailers:{},filters:[],pagination:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]},appliedFilters:{},searchTerm:"",gridConfig:void 0,userProducts:{},loading:![]},F={products:{},cart:x,address:v,checkout:w,ui:S,metadata:E,productsList:_};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")===t.DEVELOPMENT}isStaging(){return this.get("env")===t.STAGING}isProduction(){return this.get("env")===t.PRODUCTION}isBuilder(){return this.get("isBuilder")}isDebuggingEnabled(){const t=this.get("debugMode");return t===r.CONSOLE||t===r.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===r.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===r.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}getProxyConfig(){return this.get("proxy")}validateInputs(e,n){if(!(null==e?void 0:e.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(n.env&&!Object.values(t).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(r).includes(n.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+n.debugMode+'". Must be one of: '+Object.values(r).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.checkout&&("object"!=typeof n.checkout?(console.warn("[LiquidCommerce Elements] checkout must be an object. Skipping checkout configuration."),n.checkout=void 0):n.checkout.pageUrl&&"string"==typeof n.checkout.pageUrl?n.checkout.pageUrl.trim()?n.checkout.pageUrl.includes("{id}")||console.warn('[LiquidCommerce Elements] checkout.pageUrl does not include "{id}" placeholder and will not include cart IDs.'):(console.warn("[LiquidCommerce Elements] checkout.pageUrl cannot be empty. Skipping checkout configuration."),n.checkout=void 0):(console.warn("[LiquidCommerce Elements] checkout.pageUrl is required and must be a string. Skipping checkout configuration."),n.checkout=void 0)),n.promoTicker)if(Array.isArray(n.promoTicker)){const t=n.promoTicker.filter((t,e)=>{if(!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(e,n){var i,o,s,a;const c=n.env||t.PRODUCTION;let m=p[c];const f=c===t.PRODUCTION,v=n.isBuilder||![],b=g+(f?"":"_"+c)+(v?"builder":"");return(null===(i=n.development)||void 0===i?void 0:i.customApiUrl)&&(m=n.development.customApiUrl),{apiKey:e.trim(),env:c,isBuilder:v,debugMode:n.debugMode||r.NONE,baseUrl:m,partnerCode:void 0,partnerName:void 0,customTheme:n.customTheme||null,proxy:n.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:b,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:f?![]:(null===(s=n.development)||void 0===s?void 0:s.openShadowDom)||![],hasCustomApiUrl:Boolean(null===(a=n.development)||void 0===a?void 0:a.customApiUrl),checkout:n.checkout||null}}detectDeviceType(){var t,e;if("undefined"==typeof navigator)return"desktop";const n=navigator.userAgent.toLowerCase(),i="ontouchstart"in window||navigator.maxTouchPoints>0,o=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,r=(null===(e=window.screen)||void 0===e?void 0:e.height)||0,s=Math.max(o,r),a=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],c=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return a.some(t=>t.test(n))?"tablet":c.some(t=>t.test(n))||i&&s<768?"mobile":i&&s>=768&&s<=1200||i&&/macintosh/i.test(n)&&navigator.maxTouchPoints>1||/android/i.test(n)&&i&&s>=768||/windows nt/i.test(n)&&i&&s>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(n),"desktop")}}class LoggerService{constructor(t){this.prefix="LiquidCommerce Elements",this.colors={debug:"#9CA3AF",log:"#60A5FA",info:"#22D3EE",warn:"#FB923C",error:"#F87171",prefix:"#C084FC"},this.enableLogging=![],this.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;let i=n?e:void 0,o=!n&&e?e:void 0;if(o&&o.error instanceof Error){i=o.error;const{error:t,...e}=o;o=Object.keys(e).length>0?e:void 0}if(this.sendToTelemetry("error",t,i,o),!this.enableLogging)return;const[r,...s]=this.getPrefix("error");if(console.group(r+" "+t,...s),i){console.log("Type:",i.name||"Error"),console.log("Message:",i.message),i.stack&&console.log("Stack:",i.stack),i.cause&&console.log("Caused by:",i.cause);const t=Object.keys(i).filter(t=>!["name","message","stack","cause"].includes(t));if(t.length>0){const e={};for(const n of t)e[n]=i[n];console.log("Additional:",e)}}o&&Object.keys(o).length>0&&console.log("Context:",o),console.groupEnd()}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: #f0f4f8;\n border-radius: 6px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: #d63031;\n line-height: 1.4;\n margin-bottom: 5px;\n }\n\n p {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n color: #18181B;\n line-height: 1.5;\n max-width: 350px;\n }\n ';const r=document.createElement("div"),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: #f0f4f8;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: Poppins, sans-serif;\n max-width: 512px;\n display: block;\n }\n\n h2 {\n color: #18181B;\n margin: 0 0 8px 0;\n font-size: 18px;\n font-style: normal;\n font-weight: 600;\n line-height: 18px;\n text-transform: lowercase;\n }\n\n h2::first-letter {\n text-transform: uppercase;\n }\n\n p {\n color: #18181B;\n font-size: 14px;\n font-style: italic;\n font-weight: 400;\n line-height: 20px;\n margin: 0;\n }\n ";const 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 o=document.createElement(n);if(o.initialize){const{type:e,useShadowDom:i,wrapInLceElement:r,...s}=t,a={type:e,tagName:n,useShadowDom:i&&r!==!![]};o.initialize({data:s,config:a})}if(t.wrapInLceElement){const e=ComponentFactoryService.getComponentRegistry().get(i.LCE_ELEMENT),n=ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT);window.customElements.get(n)||window.customElements.define(n,e);const r=document.createElement(n);return r.initialize(t.type,o),r}return o}catch(e){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.type.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t.type}):componentError({componentType:t.type,message:(null==e?void 0:e.message)||e})}}static componentError({componentType:t,message:e}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+e),ComponentFactoryService.clientConfig.isProduction()?productionComponentError({title:t.replace(/-/g," ")+" is not available.",message:"We're sorry, this element is currently unavailable.",componentType:t}):componentError({componentType:t,message:e})}static getComponentTagName(t){const e={[i.DRAWER]:"drawer-lc",[i.INPUT]:"input-lc",[i.ENGRAVING_FORM]:"engraving-form-lc",[i.ENGRAVING_VIEW]:"engraving-view-lc",[i.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[i.POWERED_BY]:"powered-by-lc",[i.LCE_ELEMENT]:"lce-element",[i.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[i.ALERT]:"alert-lc",[i.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[i.MODAL]:"modal-lc",[i.ADDRESS]:"address-lc",[i.ADDRESS_INPUT]:"address-input-lc",[i.ADDRESS_DISPLAY]:"address-display-lc",[i.PRODUCT]:"product-lc",[i.PRODUCT_OPTIONS]:"product-options-lc",[i.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[i.PRODUCT_INTERACTIONS]:"product-interactions-lc",[i.PRODUCT_DESCRIPTION]:"product-description-lc",[i.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[i.PRODUCT_RETAILERS]:"product-retailers-lc",[i.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[i.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[i.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[i.PRODUCT_PRICE]:"product-price-lc",[i.PRODUCT_DRAWER]:"product-drawer-lc",[i.PRODUCT_LOADING]:"product-loading-lc",[i.PRODUCT_LIST]:"product-list-lc",[i.PRODUCT_LIST_CARD]:"product-list-card-lc",[i.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[i.PRODUCT_LIST_SEARCH]:"product-list-search-lc",[i.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[i.PRODUCT_LIST_RETAILERS]:"product-list-retailers-lc",[i.CART]:"cart-lc",[i.CART_RETAILER]:"cart-retailer-lc",[i.CART_ITEM]:"cart-item-lc",[i.CART_FOOTER]:"cart-footer-lc",[i.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[i.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[i.CART_PROMO_CODE]:"cart-promo-code-lc",[i.CART_HEADER]:"cart-header-lc",[i.CART_BODY]:"cart-body-lc",[i.CART_FULFILLMENT]:"cart-fulfillment-lc",[i.CHECKOUT]:"checkout-lc",[i.CHECKOUT_INFORMATION]:"checkout-information-lc",[i.CHECKOUT_PAYMENT]:"checkout-payment-lc",[i.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[i.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[i.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[i.CHECKOUT_BILLING]:"checkout-billing-lc",[i.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[i.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[i.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[i.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[i.CHECKOUT_ITEMS]:"checkout-items-lc",[i.CHECKOUT_COMPLETED]:"checkout-completed-lc",[i.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[i.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[i.CHECKOUT_BUYER]:"checkout-buyer-lc",[i.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[i.CHECKOUT_TIPS]:"checkout-tips-lc",[i.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[i.CHECKOUT_ITEM]:"checkout-item-lc",[i.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[i.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[i.CHECKOUT_HEADER]:"checkout-header-lc",[i.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[i.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[i.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return 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(){try{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)}}catch(bt){this.logger.error("Error setting up CLIENT_READY buffering",bt)}}}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 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 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){try{const e=await this.client.post("/product/search",{body:t});return e.data}catch(e){return this.logger.error("Error fetching catalog search data",e),{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){try{const e=await this.client.post("/checkout/prepare",{body:t});return e.data}catch(e){throw this.logger.error("Error fetching prepare checkout data",e),new SDKError("Failed to fetch prepare checkout data: "+(null==e?void 0:e.message))}}async updateCheckoutItems(t){try{const e=await this.client.post("/checkout/items",{body:t});return e.data}catch(e){throw this.logger.error("Error updating checkout items",e),new SDKError("Failed to update checkout items: "+(null==e?void 0:e.message))}}async getPaymentSession(t){try{const e=await this.client.post("/checkout/payment/session",{body:{cartId:t}});return e.data}catch(e){throw this.logger.error("Error fetching payment session",e),new SDKError("Failed to get payment session: "+(null==e?void 0:e.message))}}async confirmPaymentSession(t){try{const e=await this.client.post("/checkout/payment/confirm",{body:t});return e.data}catch(e){throw this.logger.error("Error confirming payment session",e),new SDKError("Failed to confirm payment session: "+(null==e?void 0:e.message))}}async checkoutComplete(t){try{const e=await this.client.post("/checkout/complete",{body:{token:t}});return e.data}catch(e){if(this.logger.error("Error completing checkout",e),null==e?void 0:e.error)throw new SDKError("Failed to complete checkout: "+(null==e?void 0:e.message));throw e}}}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=F,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.state={...this.state,metadata:E},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,b)}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 k=()=>{if(i>=this.middleware.length)return n();const o=this.middleware[i++];return o({action:t,payload:e,state:this.getState(),next:k})};return k()}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(bt){this.logger.error("Failed to clear localStorage entry",bt)}}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 v;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}}:{...v,id:t}}catch(e){return{...v,id:t}}}}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"),n=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!this.clientConfig.get("hasCustomApiUrl"),endpoint:n,batchSize:e===t.PRODUCTION?5:10,batchInterval:e===t.PRODUCTION?5e3:3e3,includeDebugLogs:![],includeWarnings:!![],includeErrors:!![],maxQueueSize:50},window.addEventListener("beforeunload",()=>this.shutdown()),window.addEventListener("pagehide",()=>this.shutdown()),this.config.enabled&&this.startBatchTimer()}static getInstance(){return SingletonManager.getClassInstance("TelemetryService",()=>new TelemetryService)}isEnabled(){return this.config.enabled}captureEvent(t,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++}}}}const I=[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL,i.PRODUCT_OPTIONS,i.PRODUCT_INTERACTIONS,i.PRODUCT_DESCRIPTION,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST,i.PRODUCT_PRICE,i.PRODUCT_ADD_TO_CART_SECTION,i.PRODUCT_DRAWER,i.PRODUCT_LOADING,i.ENGRAVING_FORM,i.ENGRAVING_VIEW],O=[i.ADDRESS_INPUT,i.ADDRESS_DISPLAY],R=[i.CART,i.CART_RETAILER,i.CART_ITEM,i.CART_FOOTER,i.CART_ITEM_QUANTITY_PRICE,i.CART_RETAILER_SUBTOTAL,i.CART_PROMO_CODE,i.CART_HEADER,i.CART_BODY,i.CART_FULFILLMENT,i.BUTTONS_CART_OPEN],M=[i.CHECKOUT,i.CHECKOUT_INFORMATION,i.CHECKOUT_STRIPE_HANDLER,i.CHECKOUT_STRIPE_FORM,i.CHECKOUT_PAYMENT,i.CHECKOUT_BILLING,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PROMO_CODE,i.CHECKOUT_GIFT_CARDS,i.CHECKOUT_AMOUNTS,i.CHECKOUT_ITEMS,i.CHECKOUT_COMPLETED,i.CHECKOUT_DELIVER_TO,i.CHECKOUT_DELIVER_TO_SUMMARY,i.CHECKOUT_BUYER,i.CHECKOUT_TIPS,i.CHECKOUT_PC_GC,i.CHECKOUT_ITEM,i.CHECKOUT_ITEM_QUANTITY,i.CHECKOUT_PLACE_ORDER_BUTTON,i.CHECKOUT_HEADER,i.CHECKOUT_PRESALE_COUNTDOWN,i.CHECKOUT_PRESALE_EXPIRED,i.CHECKOUT_SEND_AS_GIFT],B=[i.PRODUCT_LIST,i.PRODUCT_LIST_CARD,i.PRODUCT_LIST_CARD_LOADING,i.PRODUCT_LIST_FILTERS,i.PRODUCT_LIST_SEARCH];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,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 /* Filter button host - shown only on mobile when NOT in drawer */\n .product-list-filter-button-host {\n display: none;\n }\n\n /* Mobile: show button on page, but hide it in drawer */\n @media (max-width: 1023px) {\n /* Show button on the page */\n .product-list-filter-button-host {\n display: flex;\n }\n \n /* Hide filter content on the page (sidebar) */\n .product-list-filters-content-wrapper {\n display: none !important;\n }\n \n /* But in drawer mode, hide button and show content */\n .drawer-mode .product-list-filter-button-host,\n .product-list-filters-container.drawer-mode .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper.drawer-mode,\n .product-list-filters-container.drawer-mode .product-list-filters-content-wrapper {\n display: block !important;\n padding: 0px 16px;\n }\n }\n\n /* Desktop: always hide button, show filter content */\n @media (min-width: 1024px) {\n .product-list-filter-button-host {\n display: none !important;\n }\n \n .product-list-filters-content-wrapper {\n display: block !important;\n }\n }\n\n /* Mobile Filter Container */\n .product-list-filter-container {\n display: none;\n align-items: center;\n gap: 8px;\n width: 100%;\n justify-content: flex-start;\n cursor: default;\n }\n\n .product-list-filter-icon {\n display: flex;\n align-items: center;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-filter-icon svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filter-text {\n color: var(--default-text-color, #111827);\n font-size: 16px;\n font-weight: 400;\n font-family: var(--paragraph-font-family, Poppins);\n user-select: none;\n cursor: pointer;\n transition: opacity 0.2s ease;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: row;\n gap: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n /* Filters Styles */\n .product-list-filters-header {\n padding: 0px 0px 10px;\n }\n\n .product-list-filters-header.drawer-mode {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 0px;\n }\n\n .product-list-filters-container {\n width: 16.6%;\n min-width: 200px;\n max-height: calc(100vh - 48px);\n height: fit-content;\n position: sticky;\n overflow-y: auto;\n overflow-x: hidden;\n }\n \n .product-list-filters-container.drawer-mode {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0 24px 80px 24px;\n position: static;\n max-height: none;\n height: 100%;\n overflow-y: visible;\n }\n\n\n\n .product-list-filters-engraving,\n .product-list-filters-presale,\n .product-list-filters-delivery-options {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-header.drawer-mode .product-list-filters-title {\n font-size: 14px;\n }\n\n .product-list-filters-close-btn {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: opacity 0.2s ease;\n }\n\n .product-list-filters-engraving,\n .product-list-filters-presale {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n }\n\n .product-list-filters-engraving-label,\n .product-list-filters-presale-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-fulfillment-options-header,\n .product-list-filters-price-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: pointer;\n user-select: none;\n }\n\n .product-list-filters-fulfillment-options-header:hover .product-list-filters-fulfillment-options-label,\n .product-list-filters-price-header:hover .product-list-filters-price-title, \n .product-list-filters-engraving:hover .product-list-filters-engraving-label, \n .product-list-filters-presale:hover .product-list-filters-presale-label {\n text-decoration: underline;\n }\n\n .product-list-filters-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-chevron svg {\n display: block;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .product-list-filters-fulfillment-options-list,\n .product-list-filters-price-inputs {\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-fulfillment-options-list.collapsed,\n .product-list-filters-price-inputs.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-fulfillment-options-list:not(.collapsed) {\n margin-top: 8px;\n }\n\n .product-list-filters-price-inputs:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-fulfillment-options {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n \n .product-list-filters-fulfillment-options-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-fulfillment-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-fulfillment-option {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 4px 10px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n\n .product-list-filters-fulfillment-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-fulfillment-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-fulfillment-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-fulfillment-radio:focus,\n .product-list-filters-fulfillment-radio:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-filters-fulfillment-radio-label {\n font-size: 14px;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-fulfillment-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n height: 16px;\n z-index: "+f.TOGGLE_SLIDER+";\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n /* Price Filters */\n .product-list-filters-fulfillment-options,\n .product-list-filters-price {\n display: flex;\n flex-direction: column;\n padding: 10px 0px 14px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-price:last-child {\n border-bottom: none;\n padding-bottom: 0px 16px;\n }\n\n .product-list-filters-price-title {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .product-list-filters-price-slider-container {\n display: flex;\n flex-direction: column;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .product-list-filters-price-slider-container.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .product-list-filters-price-slider-container:not(.collapsed) {\n margin-top: 16px;\n }\n\n .product-list-filters-price-range-wrapper {\n position: relative;\n width: 100%;\n height: 24px;\n display: flex;\n align-items: center;\n margin-bottom: 8px;\n }\n\n .product-list-filters-price-track {\n position: absolute;\n width: 100%;\n height: 4px;\n background: var(--accent-color, #e5e7eb);\n border-radius: 2px;\n pointer-events: none;\n }\n\n .product-list-filters-price-track-active {\n position: absolute;\n height: 100%;\n background: var(--primary-color, #3b82f6);\n border-radius: 2px;\n }\n\n .product-list-filters-price-range {\n position: absolute;\n width: 100%;\n height: 4px;\n background: transparent;\n pointer-events: none;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-webkit-slider-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range::-moz-range-thumb {\n width: 20px;\n height: 20px;\n border-radius: 50%;\n background: var(--primary-color, #3b82f6);\n cursor: pointer;\n pointer-events: auto;\n border: 3px solid white;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n transition: transform 0.2s ease;\n }\n\n .product-list-filters-price-range::-moz-range-thumb:hover {\n transform: scale(1.1);\n }\n\n .product-list-filters-price-range::-moz-range-thumb:active {\n transform: scale(0.95);\n }\n\n .product-list-filters-price-range:focus {\n outline: none;\n }\n\n .product-list-filters-price-range-min {\n z-index: 3;\n }\n\n .product-list-filters-price-range-max {\n z-index: 4;\n }\n\n .product-list-filters-price-inputs-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n }\n\n .product-list-filters-price-input-wrapper {\n flex: 1;\n display: flex;\n align-items: center;\n background: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n padding: 8px 12px;\n transition: border-color 0.2s ease;\n }\n\n .product-list-filters-price-input-wrapper:focus-within {\n border-color: var(--default-text-color, #111827);\n }\n\n .product-list-filters-price-input-prefix {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n margin-right: 4px;\n }\n\n .product-list-filters-price-input {\n flex: 1;\n border: none;\n background: transparent;\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n outline: none;\n width: 100%;\n min-width: 0;\n -moz-appearance: textfield;\n }\n\n .product-list-filters-price-input:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .product-list-filters-price-input::-webkit-outer-spin-button,\n .product-list-filters-price-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .product-list-filters-price-input::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .product-list-filters-price-separator {\n font-size: 14px;\n font-weight: 400;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n flex-shrink: 0;\n }\n\n /* Checkbox filters */\n .product-list-checkbox-filter {\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-checkbox-filter:last-child {\n border-bottom: none;\n padding-bottom: 0;\n }\n\n .checkbox-filter-container {\n display: flex;\n flex-direction: column;\n }\n\n .checkbox-filter-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 0px;\n }\n\n .checkbox-filter-label {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n text-align: left;\n user-select: none;\n font-family: inherit;\n }\n\n .checkbox-filter-label:focus,\n .checkbox-filter-label:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-label:hover span:first-child {\n text-decoration: underline;\n }\n\n .checkbox-filter-label span:first-child {\n font-size: 14px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n margin: 0;\n }\n\n .checkbox-filter-toggle-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n margin-left: 8px;\n }\n\n .checkbox-filter-toggle-icon svg {\n display: block;\n }\n\n .checkbox-filter-content {\n display: flex;\n flex-direction: column;\n gap: 12px;\n max-height: 500px;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;\n opacity: 1;\n }\n\n .checkbox-filter-content.collapsed {\n max-height: 0;\n opacity: 0;\n margin-top: 0;\n }\n\n .checkbox-filter-content.expanded,\n .checkbox-filter-content:not(.collapsed) {\n margin-top: 8px;\n }\n\n .checkbox-filter-search-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n }\n\n .checkbox-filter-search {\n width: 100%;\n padding: 8px 40px 8px 12px;\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: var(--button-border-radius, 8px);\n font-size: 15px;\n font-weight: 400;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n background: var(--accent-color-30, #f9fafb);\n transition: border-color 0.2s ease;\n }\n\n .checkbox-filter-search:focus,\n .checkbox-filter-search:focus-visible {\n outline: none;\n border-color: var(--accent-color, #e5e7eb);\n box-shadow: none;\n }\n\n .checkbox-filter-search::placeholder {\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon {\n position: absolute;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-search-icon svg {\n display: block;\n }\n\n .checkbox-filter-list {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 280px;\n overflow-y: auto;\n padding-right: 4px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar {\n width: 6px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-track {\n background: var(--accent-color-30, #f3f4f6);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb {\n background: var(--accent-color, #d1d5db);\n border-radius: 3px;\n }\n\n .checkbox-filter-list::-webkit-scrollbar-thumb:hover {\n background: var(--default-text-color-70, #9ca3af);\n }\n\n .checkbox-filter-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-radius: var(--button-border-radius, 8px);\n transition: background-color 0.15s ease;\n cursor: pointer;\n }\n\n .checkbox-filter-checkbox {\n width: 18px;\n height: 18px;\n cursor: pointer;\n flex-shrink: 0;\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border: 2px solid var(--accent-color, #d1d5db);\n border-radius: 4px;\n background-color: transparent;\n position: relative;\n transition: all 0.15s ease;\n }\n\n .checkbox-filter-checkbox:checked {\n background-color: var(--primary-color, #3b82f6);\n border-color: var(--primary-color, #3b82f6);\n }\n\n .checkbox-filter-checkbox:checked::after {\n content: '';\n position: absolute;\n left: 5px;\n top: 2px;\n width: 4px;\n height: 8px;\n border: solid white;\n border-width: 0 2px 2px 0;\n transform: rotate(45deg);\n }\n\n .checkbox-filter-checkbox:focus,\n .checkbox-filter-checkbox:focus-visible {\n outline: none;\n box-shadow: none;\n }\n\n .checkbox-filter-item-label {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex: 1;\n cursor: pointer;\n user-select: none;\n font-size: 15px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .checkbox-filter-item-text {\n color: var(--default-text-color, #374151);\n font-weight: 400;\n flex: 1;\n }\n\n .checkbox-filter-item-count {\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n margin-left: 8px;\n font-weight: 400;\n }\n\n /* Apply filters button */\n .product-list-filters-apply-container {\n position: fixed;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 16px;\n margin-top: 0;\n background: var(--drawer-background-color, #ffffff);\n z-index: 999;\n }\n\n .product-list-filters-apply-btn {\n width: 100%;\n padding: 12px 16px;\n border: none;\n border-radius: var(--button-border-radius, 8px);\n font-size: 14px;\n font-weight: 600;\n font-family: var(--paragraph-font-family, Poppins);\n cursor: pointer;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;\n }\n\n .product-list-filters-apply-btn:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-apply-btn:active {\n transform: translateY(1px);\n }\n\n .product-list-filters-apply-btn:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .checkbox-filter-no-results {\n padding: 24px 16px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Search Styles */\n .product-list-search-box {\n position: relative;\n width: 100%;\n display: flex;\n align-items: center;\n }\n\n .product-list-search-icon {\n position: absolute;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n color: #9ca3af;\n }\n\n .product-list-search-icon svg {\n width: 20px;\n height: 20px;\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-icon svg path {\n stroke: var(--default-text-color, #18181B) !important;\n }\n\n .product-list-search-input {\n width: 100%;\n border: 0;\n border-bottom: 1px solid #d1d5db;\n border-radius: 0;\n background-color: transparent;\n color: #374151;\n padding: 0.25rem 2rem;\n font-size: 1rem;\n font-family: var(--paragraph-font-family, Poppins);\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n transition: border-color 0.15s ease-in-out;\n }\n\n .product-list-search-input:focus {\n outline: none;\n border-bottom-color: #6b7280;\n border-radius: 0;\n box-shadow: none;\n }\n\n .product-list-search-input::placeholder {\n color: #9ca3af;\n }\n\n .product-list-search-clear-btn {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n border-radius: 0;\n cursor: pointer;\n padding: 0.25rem;\n color: #9ca3af;\n transition: color 0.15s ease-in-out;\n }\n\n .product-list-search-clear-btn:hover {\n color: #374151;\n }\n\n .product-list-search-clear-btn:focus {\n outline: none;\n box-shadow: none;\n }\n\n .product-list-search-clear-btn svg {\n width: 20px;\n height: 20px;\n }\n\n /* Product List Card Styles */\n .product-list-card {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n min-height: 400px;\n height: 100%;\n padding: 8px;\n border: 1px solid var(--base-accent, #E4E4E7);\n background: var(--base-background, #FAFAFA);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .product-list-card.sharp {\n border-radius: 0px;\n }\n\n .product-list-card.card {\n background: var(--base-background, #FAFAFA);\n border: 1px solid var(--base-accent, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .product-list-card.ghost {\n background: transparent;\n border: none;\n box-shadow: none;\n }\n\n .product-list-card.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n position: relative;\n }\n\n .product-list-card .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .product-list-card .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n /* Pre-Order Badge Styles */\n .plc__presale-badge {\n position: absolute;\n top: 16px;\n left: 16px;\n padding: 4px 12px;\n background-color: #18181B;\n color: #FFFFFF;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n z-index: 10;\n text-transform: capitalize;\n letter-spacing: 0.5px;\n }\n\n .plc__presale-badge.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__presale-badge.sharp {\n border-radius: 0px;\n }\n\n .plc__content {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n gap: 16px;\n align-self: stretch;\n padding-top: 16px;\n }\n\n .plc__badges-wrapper {\n display: flex;\n align-items: center;\n align-content: center;\n align-self: stretch;\n flex-wrap: wrap;\n gap: 8px;\n line-height: 14px;\n }\n\n .plc__badge-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 400;\n }\n\n .plc__content .plc__title {\n width: 100%;\n font-size: 24px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n line-height: 24px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n word-wrap: break-word;\n word-break: break-word;\n height: 70px;\n }\n\n .plc__price-personalization-wrapper {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .plc__price {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 24px;\n }\n\n .plc__personalize {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .plc__dropdown-size-wrapper {\n display: flex;\n flex-direction: column;\n width: 100%;\n padding: 0;\n align-items: flex-start;\n border: 1px solid var(--base-accent, #E4E4E7);\n background: var(--base-background, #FAFAFA);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n transition: all 0.3s ease;\n overflow: visible;\n position: relative;\n }\n\n .plc__dropdown-size-wrapper.rounded {\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__dropdown-size-wrapper.sharp {\n border-radius: 0px;\n }\n\n .plc__dropdown-default-size-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n background: none;\n border: none;\n padding: 4px 8px;\n cursor: pointer;\n transition: opacity 0.2s ease;\n border-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__dropdown-size-wrapper.expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .plc__dropdown-size-text {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-weight: 400;\n }\n\n .plc__dropdown-chevron {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .plc__dropdown-chevron svg {\n display: block;\n }\n\n .plc__dropdown-check {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n .plc__dropdown-check svg {\n display: block;\n }\n\n .plc__sizes-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 0;\n max-height: 0;\n opacity: 0;\n overflow: hidden;\n transition: max-height 0.3s ease, opacity 0.3s ease;\n background: var(--base-background, #FFFFFF);\n border: 1px solid var(--base-accent, #E4E4E7);\n border-top: none;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n z-index: 1000;\n }\n\n .plc__sizes-list.rounded {\n border-bottom-left-radius: var(--border-radius-rounded, 6px);\n border-bottom-right-radius: var(--border-radius-rounded, 6px);\n }\n\n .plc__sizes-list.sharp {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .plc__dropdown-size-wrapper.expanded .plc__sizes-list {\n max-height: 200px;\n opacity: 1;\n overflow-y: auto;\n }\n\n .plc__size-option {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 4px 8px;\n background: var(--base-background, #FFFFFF);\n border: none;\n cursor: pointer;\n transition: all 0.2s ease;\n }\n\n .plc__size-option:hover {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .plc__size-option:hover .plc__size-option-text {\n color: var(--selected-text-color, #ffffff);\n }\n\n .plc__size-option:hover .plc__size-option-check svg {\n color: var(--selected-text-color, #ffffff);\n }\n\n .plc__size-option-text {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-weight: 400;\n transition: color 0.2s ease;\n }\n\n .plc__size-option-check {\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--icon-color, var(--default-text-color, #18181B));\n transition: color 0.2s ease;\n width: 12px;\n }\n\n .plc__size-option-check svg {\n display: block;\n }\n\n .plc__fulfillment-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n align-self: stretch;\n }\n\n .plc__fulfillment-text {\n color: var(--base-foreground, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n word-wrap: break-word;\n word-break: break-word;\n height: 48px;\n }\n\n .plc__fulfillment-delivery {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 24px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .plc__add-to-cart-wrapper {\n display: flex;\n align-items: center;\n align-content: flex-start;\n gap: 8px;\n align-self: stretch;\n flex-wrap: nowrap;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text {\n display: flex;\n min-width: 32px;\n height: 36px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n user-select: none;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-text.ghost {\n border: none;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase {\n display: flex;\n width: 32px;\n height: 36px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n background: transparent;\n border: 1px solid var(--accent-color, #E4E4E7);\n transition: background-color 0.15s ease, opacity 0.15s ease;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease {\n border-right: 1px solid var(--accent-color, #E4E4E7); \n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase {\n border-left: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.disabled,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.rounded {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.rounded {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n \n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.sharp {\n border-radius: 0px;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.sharp {\n border-radius: 0px;\n }\n\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-decrease.ghost,\n .plc__add-to-cart-wrapper .plc__quantity-container .quantity-increase.ghost {\n border: none;\n }\n\n .product-list-card .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 1;\n height: 36px;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n font-family: var(--paragraph-font-family, Poppins);\n padding: 0 0.75rem;\n border: none;\n cursor: pointer;\n transition-property: background-color, transform;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button.rounded {\n border-radius: var(--button-border-radius, 6px);\n }\n\n .plc__button.sharp {\n border-radius: 0px;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #2563eb);\n }\n\n .plc__button:active {\n transform: translateY(1px);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Product List Card Drawer */\n .product-list-card {\n position: relative;\n overflow: visible;\n }\n\n .product-list-card-drawer-container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: var(--drawer-background-color, #ffffff);\n z-index: 100;\n transform: translateX(100%);\n transition: transform 0.3s ease;\n overflow: hidden;\n border-radius: var(--border-radius-rounded, 6px);\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);\n }\n\n .product-list-card-drawer-container.open {\n transform: translateX(0);\n }\n\n .product-list-card-drawer-content {\n width: 100%;\n height: 100%;\n overflow-y: auto;\n padding: 16px;\n position: relative;\n }\n\n\n /* Retailers Popup Styles */\n .retailers-popup-wrapper {\n padding: 16px;\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .retailers-popup-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 16px;\n }\n\n .retailers-popup-title {\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n line-height: 24px;\n margin: 0;\n }\n\n .retailers-popup-close {\n background: none;\n border: none;\n cursor: pointer;\n color: #6B7280;\n padding: 4px;\n }\n\n .retailers-popup-no-data {\n padding: 24px;\n text-align: center;\n color: var(--default-text-color-70, #9ca3af);\n font-size: 14px;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .popup-fulfillment-list-container {\n margin-top: 16px;\n max-height: 445px;\n overflow-y: auto;\n }\n\n /* Prevent background scroll when dialog is active */\n body:has(dialog[open]) {\n overflow: hidden;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n }\n\n .product-list-sentinel-spinner {\n width: 24px;\n height: 24px;\n border: 2px solid var(--primary-color-20, rgba(59, 130, 246, 0.2));\n border-top-color: var(--primary-color, #3b82f6);\n border-radius: 50%;\n animation: product-list-spin 0.8s linear infinite;\n }\n\n @keyframes product-list-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n .product-list-sentinel-text {\n font-size: 14px;\n color: var(--primary-color, #3b82f6);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n .product-list-sentinel-icon {\n font-size: 20px;\n color: var(--primary-color-80, rgba(59, 130, 246, 0.8));\n animation: product-list-bounce 2s ease-in-out infinite;\n margin-bottom: 4px;\n }\n\n @keyframes product-list-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(4px);\n }\n }\n\n .product-list-sentinel-info-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n flex: 1;\n }\n\n .product-list-sentinel-divider {\n width: 60px;\n height: 1px;\n background: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n margin-bottom: 8px;\n }\n\n .product-list-sentinel-info-text {\n font-size: 13px;\n font-weight: 400;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--primary-color, rgba(59, 130, 246, 0.67));\n }\n\n .product-list-sentinel-info-text.no-more {\n color: var(--primary-color, rgba(59, 130, 246, 0.8));\n font-weight: 500;\n }\n\n .product-list-sentinel-error-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 8px;\n }\n\n .product-list-sentinel-error-icon {\n font-size: 18px;\n color: var(--error-color, #ef4444);\n }\n\n .product-list-sentinel-error-text {\n font-size: 13px;\n color: var(--error-color, #ef4444);\n font-weight: 500;\n letter-spacing: 0.2px;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n }\n\n /* Filters Chips */\n .product-list-filters-chips-container {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n align-items: center;\n padding: 10px 0px;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-chips-container:empty {\n display: none;\n padding: 0;\n border-bottom: none;\n }\n\n .product-list-filters-clear-all {\n display: inline-flex;\n align-items: center;\n padding: 8px 0px 0px;\n background: none;\n border: none;\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 700;\n color: var(--primary-color, #3b82f6);\n text-decoration: underline;\n cursor: pointer;\n text-transform: uppercase;\n }\n\n .product-list-filters-clear-all:hover {\n color: var(--primary-color-70, #2563eb);\n }\n\n .product-list-filters-clear-all:focus {\n outline: none;\n }\n\n .chip {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n padding: 4px 12px;\n background-color: var(--accent-color-30, #f9fafb);\n border: 1px solid var(--accent-color, #e5e7eb);\n border-radius: 20px;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 10px;\n font-weight: 400;\n color: var(--default-text-color, #374151);\n transition: background-color 0.2s ease, border-color 0.2s ease;\n }\n\n .chip-text {\n line-height: 1.2;\n user-select: none;\n }\n\n .chip-close {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--default-text-color-70, #9ca3af);\n transition: color 0.2s ease;\n flex-shrink: 0;\n }\n\n .chip-close:hover {\n color: var(--default-text-color, #374151);\n }\n\n .chip-close:focus {\n outline: none;\n }\n\n .chip-close svg {\n display: block;\n width: 16px;\n height: 16px;\n }\n\n /* Responsive Styles */\n @media (max-width: 1023px) {\n .product-list-filter-container {\n display: flex;\n }\n\n .product-list-controls {\n width: 100%;\n display: flex;\n flex-direction: column;\n gap: 24px;\n }\n\n .product-list-controls .product-list-filters-container {\n display: none;\n }\n\n .product-list-cards__container {\n width: 100%;\n }\n\n .checkbox-filter-list {\n max-height: 220px;\n }\n \n .checkbox-filter-search {\n font-size: 14px;\n }\n }\n\n @media (max-width: 639px) {\n .product-list-cards__container {\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list-card {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list-cards__container {\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list-card {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list-cards__container {\n width: 100%;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list-card {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n @media (min-width: 1024px) {\n .product-list-filter-container {\n display: none;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n",getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+f.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: "+f.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: "+f.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: "+f.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: "+f.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .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: "+f.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: "+f.LOADING_INDICATOR+";\n width: 16px;\n height: 16px;\n border: 2px solid var(--accent-color, #E4E4E7);\n border-top: 2px solid var(--accent-color, #E4E4E7);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n\n .empty-cart-content {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getCheckoutStyles=()=>"\n .checkout-container {\n width: 100%;\n height: auto;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n align-self: stretch;\n gap: 24px;\n }\n\n .checkout-container:not(.independent) {\n padding: 24px;\n }\n\n .checkout-container.independent {\n padding: 24px;\n }\n\n .checkout-information-section {\n min-width: 320px;\n max-width: 512px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-wrap: wrap;\n flex: 1 0 0;\n }\n\n .checkout-information-section > *:not(:first-child) {\n margin-top: 24px;\n padding-top: 24px;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-delivery-information,\n .checkout-buyer-information,\n .checkout-billing-form {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-delivery-information > *:not(:first-child),\n .checkout-buyer-information > *:not(:first-child),\n .checkout-billing-form > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-billing-form {\n margin-top: 24px;\n }\n\n .checkout-payment-form {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .checkout-payment-form > *:not(:last-child) {\n margin-bottom: 24px;\n }\n\n .delivery-header-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .delivery-title-container {\n display: flex;\n min-width: 200px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .delivery-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .section-title-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .section-title-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .delivery-title-container > .delivery-title,\n .section-title-container > .section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .delivery-title-container > .delivery-subtitle,\n .section-title-container > .section-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .gift-toggle-container {\n display: flex;\n padding: 2px 0px;\n align-self: stretch;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .gift-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .gift-toggle-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .gift-label-wrapper {\n display: flex;\n flex-direction: column;\n min-width: 200px;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .gift-toggle-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .toggle-switch {\n position: relative;\n width: 40px;\n height: 20px;\n background-color: var(--primary-color-30, #d1d5db);\n border-radius: 12px;\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .toggle-switch.active {\n background-color: var(--primary-color, #3b82f6);\n }\n\n .toggle-slider {\n position: absolute;\n top: 2px;\n left: 2px;\n width: 16px;\n z-index: "+f.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-top: 6px;\n }\n\n .checkout-tips-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tips-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-tip-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-distribution-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-distribution-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-tips-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-tips-list.show {\n display: flex;\n }\n\n .checkout-tip-distribution-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-fulfillment-input-wrapper {\n display: flex;\n align-items: center;\n }\n\n .checkout-tip-fulfillment-input-wrapper > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-tip-remove-button {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .checkout-tip-distribution-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-sub-header {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-tip-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-tip-config-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-config-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-tip-selection-container {\n display: flex;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-tip-selection-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-tip-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .checkout-tip-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-tip-button > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-tip-input-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-tip-input-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-tip-input {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-sections-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-sections-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-pc-gc-sub-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-pc-gc-sub-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-pc-gc-applied {\n display: flex;\n width: 100%;\n flex-direction: row;\n align-self: stretch;\n display: flex;\n padding: 0px 12px;\n justify-content: space-between;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-pc-gc-applied span {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .checkout-pc-gc-applied button {\n display: flex;\n height: 36px;\n padding: 8px 0px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+f.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-send-to-subtitle,\n .checkout-your-info-subtitle,\n .checkout-billing-subtitle,\n .checkout-payment-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-summary-section {\n min-width: 320px;\n max-width: 400px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-summary-section > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-disclaimer-title,\n .checkout-summary-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-disclaimer-subtitle,\n .checkout-summary-subtitle {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-promo-code-container,\n .checkout-gift-cards-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-promo-code-container > *:not(:first-child),\n .checkout-gift-cards-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .input-promo-code-container,\n .input-gift-card-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n }\n\n .input-promo-code-container > *:not(:first-child),\n .input-gift-card-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .input-promo-code-container .apply-button,\n .input-gift-card-container .apply-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-self: flex-start;\n align-items: center;\n\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n }\n\n .input-promo-code-container .apply-button.disabled,\n .input-gift-card-container .apply-button.disabled {\n background: var(--primary-color-50, #1D4ED8);\n }\n\n .checkout-amounts-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-amounts-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-amount-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-amount-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-total {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n\n }\n\n .checkout-amount-total span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .checkout-separator {\n width: 100%;\n height: 1px;\n margin: 0px;\n background: var(--accent-color, #E4E4E7);\n }\n\n .checkout-place-order-button-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-place-order-button {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n font-family: var(--paragraph-font-family, Poppins);\n align-self: stretch;\n font-weight: 600;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n transition: all 0.2s ease;\n cursor: pointer;\n position: relative;\n }\n\n .checkout-place-order-button-container .alert-container, .checkout-place-order-button-container .alert-wrapper {\n margin-bottom: 24px;\n }\n\n .checkout-place-order-button.ready {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n }\n\n .checkout-place-order-button.ready:hover {\n filter: brightness(0.9);\n transform: translateY(-1px);\n }\n\n .checkout-place-order-button.ready:active {\n transform: translateY(0);\n }\n\n /* States when things are missing/wrong - use your opacity variants */\n .checkout-place-order-button.form-invalid,\n .checkout-place-order-button.payment-incomplete,\n .checkout-place-order-button.payment-error {\n background: var(--primary-color-70);\n color: var(--selected-text-color);\n }\n\n .checkout-place-order-button.form-invalid:hover,\n .checkout-place-order-button.payment-incomplete:hover,\n .checkout-place-order-button.payment-error:hover {\n background: var(--primary-color-70);\n }\n\n /* Processing state - keep full primary color to show confidence */\n .checkout-place-order-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .checkout-place-order-button.processing::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+f.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n text-align: center;\n line-height: 100%;\n }\n\n .checkout-completed-help-section a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section {\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child,\n .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n border-radius: var(--card-border-radius, 6px);\n }\n\n .error-banner-checkout > *:not(:first-child) {\n margin-left: 8px;\n }\n\n /* It needs background color since it is sticky to cover content behind it\n TODO: for standalone checkout\n */\n .checkout-header-wrapper {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: sticky;\n top: 0;\n z-index: '+f.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\n }\n\n /* Hosted checkout header - non-sticky */\n .checkout-header-wrapper.hosted {\n position: relative;\n background-color: transparent;\n }\n\n .checkout-header-container {\n display: flex;\n min-width: 320px;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 8px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-header-button {\n display: flex;\n height: 36px;\n padding: 12px 16px;\n padding-right: 0px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n stroke: var(--default-text-color, #18181B);\n }\n\n .checkout-header-button > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-header-button-close {\n display: flex;\n height: 36px;\n width: 36px;\n padding: 2px 4px;\n justify-content: center;\n align-items: center;\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Spacer to maintain layout balance when close button is hidden */\n .checkout-header-spacer {\n width: 36px;\n height: 36px;\n flex-shrink: 0;\n }\n\n .checkout-header-title {\n display: flex;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-presale-countdown-container {\n display: flex;\n min-width: 320px;\n padding: 12px 24px 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n\n &.is-scrolled {\n box-shadow: 0px 6px 10px -2px var(--primary-color-30);\n }\n\n &.time-warning {\n box-shadow: 0px 6px 10px -2px var(--error-color-30, #FDE68A);\n }\n }\n\n .checkout-presale-countdown {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: 0;\n overflow: hidden;\n }\n\n .checkout-presale-countdown.time-warning {\n background: var(--error-color-30, #FDE68A);\n border: 1px solid var(--error-color, #E4E4E7);\n }\n\n .checkout-presale-countdown.time-warning {\n background: transparent;\n border: none;\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-bar {\n background: var(--error-color-70, #FDE68A);\n }\n\n .checkout-presale-countdown.time-warning .checkout-presale-progress-fill {\n background: var(--error-color, #EF4444);\n }\n\n .checkout-presale-text-container {\n display: flex;\n padding: 0px 0px 6px;\n justify-content: flex-end;\n align-self: stretch;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-presale-progress-bar {\n display: flex;\n height: 6px;\n align-items: center;\n align-self: stretch;\n border-radius: 40px;\n background: var(--primary-color-50, #E4E4E7);\n position: relative;\n overflow: hidden;\n }\n\n .checkout-presale-progress-fill {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n z-index: "+f.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--link-text-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-summary-form-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-align: left;\n }\n\n .checkout-summary-form-line-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 8px;\n }\n\n .checkout-summary-form-line-container-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n opacity: 0.7;\n }\n\n .save-form-info-button {\n width: 100%;\n display: flex;\n height: 36px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n }\n\n .save-form-info-button:disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n .stripe-summary-container {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .stripe-summary-container .stripe-summary-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n text-align: left;\n }\n\n .stripe-summary-container .change-payment-link {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .payment-error-message {\n color: var(--warning-color, #6B7280);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n margin-top: 16px;\n }\n\n .hardcoded-payment-notice {\n background-color: #fff3cd;\n color: #856404;\n font-family: Poppins;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n border-radius: 4px;\n padding: 16px;\n border: 1px solid #ffc107;\n word-break: break-all;\n }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n color: var(--default-text-color, #18181B);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 5px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n flex-direction: row;\n align-items: center;\n }\n\n .product-info-section > *:not(:last-child) {\n margin-right: 12px;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n white-space: nowrap;\n }\n\n .product-size-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-fees-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n align-self: stretch;\n text-align: left;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n margin-bottom: 8px;\n }\n\n .engraving-form .fulfillment-section .shipping-from-text b {\n font-weight: 600;\n }\n\n .engraving-form .fulfillment-section {\n flex-direction: column;\n }\n\n .fulfillment-options-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease;\n }\n\n .fulfillment-options-container.expanded {\n max-height: 100%;\n }\n\n .fulfillment-options-container.expanded + .see-more-fulfillments {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-options-container .fulfillment-option:not(:first-child) {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row > *:not(:last-child) {\n margin-right: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:first-child span {\n font-weight: 600;\n }\n\n .fulfillment-options-container .fulfillment-option .option-row:last-child {\n margin-top: 8px;\n }\n\n .fulfillment-options-container .fulfillment-option > span {\n width: 50%;\n }\n\n .see-more-fulfillments {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .engraving-section {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-section .engraving-title {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .engraving-section .engraving-location-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .engraving-inputs-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n margin-top: 16px;\n }\n\n .engraving-inputs-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper > *:not(:last-child) {\n margin-right: 4px;\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-transform: uppercase;\n }\n\n .engraving-input-wrapper .engraving-char-count {\n color: var(--default-text-color-50, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n }\n\n .action-buttons-container > *:not(:last-child) {\n margin-right: 16px;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button {\n width: 80%;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.10), 0 1px 2px 0 rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n white-space: nowrap;\n }\n\n .action-buttons-container .add-to-cart-button:disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .engraving-disclaimer {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n .engraving-disclaimer b {\n font-weight: 600;\n }\n\n /** Component Error View **/\n .error-view {\n padding: 20px;\n background: #fff5f5;\n border: 1px solid #fed7d7;\n border-radius: 4px;\n color: #c53030;\n text-align: center;\n }\n\n .error-view h3 {\n margin-bottom: 10px;\n }\n\n .error-view p {\n margin-bottom: 20px;\n font-size: 16px;\n font-style: italic;\n }\n\n .error-view button {\n padding: 8px 16px;\n background: #c53030;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n }\n\n .powered-by-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .pb-title-container {\n display: flex;\n justify-content: center;\n align-items: baseline;\n align-self: stretch;\n margin-bottom: 4px;\n padding-bottom: 7px;\n }\n\n .pb-text {\n text-align: center;\n font-family: 'Poppins';\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n margin-right: 4px;\n }\n\n .pb-lc {\n font-family: 'Poppins';\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .pb-dot {\n font-family: 'Poppins';\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .light .pb-text,\n .light .pb-lc {\n color: #0F172A;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .dark .pb-text,\n .dark .pb-lc,\n .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n word-break: break-word;\n }\n\n .pb-link {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 300;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container {\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+f.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .engraving-view-container .engraving-header span.engraving-fee .engraving-fee-each {\n font-weight: 500;\n }\n\n .engraving-view-container .engraving-body {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n align-content: flex-end;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .engraving-view-container .engraving-lines {\n display: flex;\n min-width: 136px;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .engraving-view-container .engraving-lines .engraving-line {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-transform: uppercase;\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-lines .engraving-line:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-view-container .engraving-actions {\n display: flex;\n align-items: center;\n }\n\n .engraving-view-container .engraving-actions .edit-button {\n margin-left: 16px;\n }\n\n .engraving-view-container .engraving-actions button {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n .action-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .disclaimer-header {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 600;\n line-height: 16px;\n }\n\n .disclaimer-description {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n font-weight: 500;\n line-height: 16px;\n }\n\n /* Alert Container - Simplified version matching existing alert design */\n .alert-container {\n display: flex;\n padding: 8px 16px;\n align-items: flex-start;\n flex-direction: row;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-wrapper {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .alert-wrapper > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .alert-wrapper.hidden {\n display: none;\n }\n\n .alert-item {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n }\n\n .alert-container.hidden {\n display: none;\n }\n\n .alert-container.alert-error {\n border-color: var(--error-color, #DC2626);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--error-color, #DC2626);\n }\n\n .alert-container.alert-warning {\n border-color: var(--warning-color, #FBBF24);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #FBBF24);\n }\n\n .alert-container.alert-success {\n border-color: var(--success-color, #4ADE80);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #4ADE80);\n }\n\n .alert-container .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n margin-right: 8px;\n color: var(--error-color, #DC2626);\n }\n\n .alert-container .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-container .alert-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n\n /*************************\n Animation\n *************************/\n @keyframes spin {\n 0% {\n transform: translateY(-50%) rotate(0deg);\n }\n 100% {\n transform: translateY(-50%) rotate(360deg);\n }\n }\n\n @keyframes slideIn {\n 0% {\n opacity: 0;\n transform: translateY(-8px);\n max-height: 0;\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n max-height: 100px;\n }\n }\n\n /*************************\n Accessibility - Focus Visible\n *************************/\n\n /* Remove default focus outline for mouse users */\n *:focus {\n outline: none;\n }\n\n /* Show focus only for keyboard navigation */\n *:focus-visible {\n outline: 1px solid var(--warning-color, #1D4ED8);\n outline-offset: 0px;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.1);\n }\n\n /* Screen reader only text */\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n }\n',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: "+f.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n width: 60px;\n height: 60px;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n opacity: 0.5;\n overflow: hidden;\n }\n\n .gallery-image {\n display: block;\n object-fit: cover;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n height: 100%;\n margin: 0 auto;\n max-width: 100%;\n max-height: 100%;\n }\n\n .gallery-image-wrapper.selected {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image-wrapper {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** Product Add to Cart Container */\n .add-to-cart-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n }\n\n .add-to-cart-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .add-to-cart-container .quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease,\n .add-to-cart-container .quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease,\n .add-to-cart-container .quantity-container.outlined .quantity-increase {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .quantity-container.outlined .quantity-decrease.disabled,\n .add-to-cart-container .quantity-container.outlined .quantity-increase.disabled {\n cursor: not-allowed;\n }\n\n .add-to-cart-container .quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .add-to-cart-container .quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .add-to-cart-container .quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .add-to-cart-container .quantity-container.outlined .product-count {\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .add-to-cart-container .add-to-cart-button {\n display: flex;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n outline: none;\n cursor: pointer;\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n position: relative;\n }\n\n .add-to-cart-container .add-to-cart-button.loading::after {\n content: '';\n position: absolute;\n right: 16px;\n top: 50%;\n transform: translateY(-50%);\n z-index: "+f.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .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: "+f.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n max-height: 418px;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--link-text-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+f.DRAWER_WRAPPER+";\n pointer-events: none;\n }\n\n .drawer-wrapper.open {\n pointer-events: auto;\n }\n\n /* Backdrop overlay */\n .drawer-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: "+f.DRAWER_BACKDROP+";\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n pointer-events: none;\n }\n\n .drawer-backdrop.visible {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n /* Main drawer */\n .drawer {\n position: absolute;\n top: 0;\n right: 0;\n width: 400px;\n height: 100vh; /* Fallback for browsers that don't support dvh */\n height: 100dvh;\n z-index: "+f.DRAWER_CONTENT+";\n background-color: #ffffff;\n overflow: hidden;\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n }\n\n /* Opened drawer state */\n .drawer.open {\n transform: translateX(0);\n }\n\n .drawer.address-input .drawer-content,\n .drawer.engraving-form .drawer-content,\n .drawer.product-retailers-popup-list .drawer-content {\n padding: 16px;\n }\n\n /* Content area - fills the remaining space */\n .drawer-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n background-color: var(--drawer-background-color, #FAFAFA);\n }\n\n /* Content swap animation classes */\n .drawer-content-fade-out {\n opacity: 1;\n transition: opacity 150ms ease-out;\n }\n\n .drawer-content-fade-out.fading {\n opacity: 0;\n }\n\n .drawer-content-fade-in {\n opacity: 0;\n transition: opacity 150ms ease-in;\n }\n\n .drawer-content-fade-in.visible {\n opacity: 1;\n }\n\n /* Mobile adjustments */\n @media (max-width: 576px) {\n .drawer {\n width: 100%;\n }\n }\n\n /* Accessibility - respect user's motion preferences */\n @media (prefers-reduced-motion: reduce) {\n .drawer,\n .drawer-backdrop,\n .drawer-content-fade-out,\n .drawer-content-fade-in {\n transition: none;\n }\n }\n "}const getProductLoadingStyles=()=>"\n .skeleton-container {\n min-width: 320px;\n width: 100%;\n height: auto;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n }\n\n .skeleton-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .skeleton-container .wave {\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .skeleton-container .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+f.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n .sc-main-image {\n width: 100%;\n height: 350px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n flex: 1;\n }\n\n .sc-carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n background-color: #c4d1e0;\n margin-right: 10px;\n }\n\n .sc-carousel-dot:last-child {\n margin-right: 0;\n }\n\n .sc-gallery-thumbnail {\n width: 60px;\n height: 60px;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-main-image::before { animation-delay: 1.5s; }\n .sc-carousel-dot::before { animation-delay: 1.6s; }\n .sc-gallery-thumbnail::before { animation-delay: 1.7s; }\n\n @media (min-width: 480px) {\n .sc-carousel-dot {\n width: 8px;\n height: 8px;\n margin-right: 8px;\n }\n }\n\n @media (min-width: 769px) {\n .sc-gallery-thumbnail {\n width: 80px;\n height: 80px;\n }\n\n .sc-main-image {\n height: 474px;\n }\n }\n\n @keyframes wave {\n 0% {\n left: -100%;\n }\n 100% {\n left: 100%;\n }\n }\n",getProductListCardLoadingStyles=()=>"\n .product-list-card-loading__container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-wrap: wrap;\n align-items: flex-start;\n gap: 24px;\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .slc__card {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n pointer-events: none;\n background-color: transparent;\n border: none;\n border-radius: var(--card-border-radius, 0.375rem);\n overflow: hidden;\n cursor: default;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n }\n\n .slc__card .wave {\n background-color: #c4d1e0;\n position: relative;\n overflow: hidden;\n }\n\n .slc__card .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+f.SKELETON_WAVE+";\n }\n\n .slc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px 0;\n }\n\n .slc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: none;\n padding-bottom: 10px;\n }\n\n .slc__image {\n width: 100%;\n height: 14rem;\n background-color: #c4d1e0;\n }\n\n .slc__content {\n width: 100%;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .slc__title-container {\n display: flex;\n flex-direction: column;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getModalStyles(){return"\n /* Modal dialog */\n .modal {\n position: fixed;\n border: none;\n padding: 0;\n margin: auto;\n background: transparent;\n max-width: 90vw;\n max-height: 90vh;\n z-index: "+f.MODAL+";\n overflow: visible;\n }\n\n .modal::backdrop {\n background-color: rgba(0, 0, 0, 0.5);\n backdrop-filter: blur(2px);\n animation: modal-backdrop-fade-in 150ms ease-out;\n }\n\n @keyframes modal-backdrop-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n /* Modal content */\n .modal-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow: hidden;\n background: var(--drawer-background-color, #FAFAFA);\n border-radius: var(--border-radius-rounded, 6px);\n box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);\n }\n\n /* Specific modal sizes based on content type */\n .modal.product-list-retailers {\n width: 512px;\n height: 576px;\n }\n "}function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const q={"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"},U={backgroundColor:"--product-background-color"},V={backgroundColor:"--cart-background-color"},K={backgroundColor:"--address-background-color"},H={backgroundColor:"--checkout-background-color"},W={backgroundColor:"--product-list-background-color"},X={global:q,product:U,cart:V,address:K,checkout:H,productList:W};function getCSSVariableMapping(t){return X[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(bt){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(),getModalStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];case"product-list":return[getProductListStyles(),getProductRetailersStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme),this.stylesheetGenerator.generateSpecificStylesheet("product-list",this.data.productList.theme)}updateComponentGlobalConfigs(t){var 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")}updateProductListComponent(t){this.data.productList=this.deepMerge(this.getConfigs("productList"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product-list",t.theme,"product-list")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==I.indexOf(t)?this.getConfigs("product"):-1!==O.indexOf(t)?this.getConfigs("address"):-1!==R.indexOf(t)?this.getConfigs("cart"):-1!==M.indexOf(t)?this.getConfigs("checkout"):-1!==B.indexOf(t)?this.getConfigs("productList"):void 0}getStylesheet(t){const e=this.getBaseStylesheets();if(t===i.DRAWER||t===i.MODAL){const t=[...e],n=this.stylesheetGenerator.getStylesheet("product"),i=this.stylesheetGenerator.getStylesheet("cart"),o=this.stylesheetGenerator.getStylesheet("checkout"),r=this.stylesheetGenerator.getStylesheet("address"),s=this.stylesheetGenerator.getStylesheet("product-list");return n&&t.push(n),i&&t.push(i),o&&t.push(o),r&&t.push(r),s&&t.push(s),t}let n;if(O.includes(t)||t===i.ADDRESS)n="address";else if(I.includes(t)||t===i.PRODUCT)n="product";else if(R.includes(t)||t===i.CART)n="cart";else if(M.includes(t)||t===i.CHECKOUT)n="checkout";else{if(!B.includes(t)&&t!==i.PRODUCT_LIST)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),e;n="product-list"}const o=this.stylesheetGenerator.getStylesheet(n);return o?[...e,o]:e}getBaseStylesheets(){const t=[],e=this.stylesheetGenerator.getStylesheet("global"),n=this.stylesheetGenerator.getStylesheet("ui");return e&&t.push(e),n&&t.push(n),t}deepMerge(t,e){const n={...t};for(const i in e)null!==e[i]&&void 0!==e[i]&&("object"!=typeof e[i]||Array.isArray(e[i])||"object"!=typeof t[i]||Array.isArray(t[i])?n[i]=e[i]:n[i]=this.deepMerge(t[i],e[i]));return n}}const Z="@liquidcommerce/elements-sdk",J="LiquidCommerce Elements SDK",$="UNLICENSED",tt="LiquidCommerce Team",et="2.6.0-beta.32",nt="https://docs.liquidcommerce.co/elements-sdk",it={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},ot={url:"https://github.com/liquidcommerce/elements-sdk/issues"},rt="./dist/index.esm.js",st="./umd/elements.js",at="./dist/types/index.d.ts",ct="pnpm@10.0.0",lt={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./checkout":{types:"./dist/types/index.checkout.d.ts",import:"./dist/index.checkout.esm.js",browser:"./umd/elements-checkout.js",default:"./dist/index.checkout.esm.js"},"./package.json":"./package.json"},dt=["dist","umd","docs","README.md","LICENSE"],ht={access:"public",registry:"https://registry.npmjs.org/"},ut="module",pt=["dist/index.esm.js","dist/index.checkout.esm.js","umd/elements.js","umd/elements-checkout.js","src/index.ts","src/index.umd.ts","src/index.checkout.ts","src/index.checkout.umd.ts"],mt={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"},ft=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],gt={"@biomejs/biome":"2.3.11","@commitlint/cli":"^20.3.1","@commitlint/config-conventional":"^20.3.1","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.3","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^25.0.10","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.56.0","rollup-obfuscator":"^4.1.1","rollup-plugin-typescript2":"^0.36.0","semantic-release":"^25.0.2","ts-node":"^10.9.2",typescript:"^5.9.3"},vt={node:">=22"},yt={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},bt={name:Z,description:J,license:$,author:tt,version:et,homepage:nt,repository:it,bugs:ot,module:rt,browser:st,types:at,packageManager:ct,exports:lt,files:dt,publishConfig:ht,type:ut,sideEffects:pt,scripts:mt,keywords:ft,devDependencies:gt,engines:vt,pnpm:yt};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:bt.description+" v"+bt.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 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}}}class CartCommands extends BaseCommand{constructor(){super(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,n){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 "+n),new SDKError("Item not found");const r=o.quantity+n;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(n<0?e.CART_ITEM_QUANTITY_DECREASE:e.CART_ITEM_QUANTITY_INCREASE,{cartId:i,itemId:o.id,quantity:r,previousQuantity:o.quantity});const c=splitCategoryPath(o.catPath),p={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(n),price:centToDollar(o.unitPrice||0),item_image:o.mainImage,upc:o.upc,grouping_id:o.salsifyGrouping,product_id:o.liquidId};n<0?this.googleTagManager.removeFromCart(p):n>0&&this.googleTagManager.addToCart(p)}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,n){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;n||this.store.set("cart.items."+t+".updating",!![]);const i=this.store.get("cart.id"),o=this.store.get("cart.items."+t);if(!o)throw new SDKError("Item not found");const r=this.buildItemUpdate(o,0),s=await this.api.updateCart({id:i,items:[r],location:this.getLocation()}),a={itemId:o.id,fulfillmentId:o.fulfillmentId,retailerId:o.retailerId};this.syncItemsFromApiResponse(s,[]),this.cleanupAfterItemRemoval(a,s),this.syncCartMetaFromApiResponse(s),this.pubSub.publishAction(e.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,n){var i,o,r;try{const s=this.store.get("cart"),a=null===(i=s.items)||void 0===i?void 0:i[t];if(!a)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const c=this.getDetails(),p={id:a.id,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:a.quantity,engravingLines:n},m=await this.api.updateCart({id:s.id||"",items:[p],location:this.getLocation()});this.syncItemsFromApiResponse(m,[t]),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const f=this.getDetails();this.pubSub.publishAction(e.CART_ITEM_ENGRAVING_UPDATED,{cartId:f.cartId,itemId:a.id,engravingLines:n,previousEngravingLines:(null===(r=null===(o=a.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[]}),this.pubSub.publishAction(e.CART_UPDATED,{previous:c,current:f})}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 n,i;try{this.store.set("cart.loading",!![]);const o=this.store.get("cart"),r=this.getDetails(),s=(null===(n=t.engravingLines)||void 0===n?void 0:n.filter(t=>""!==t.trim()))||[],a=s.length>0,c=Object.values(o.items||{}).find(e=>{var n,i,o,r,c;const p=e.fulfillmentId===t.fulfillmentId&&e.partNumber===t.partNumber;if(!p)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)}),p={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:c?t.quantity+c.quantity:t.quantity};a&&(p.engravingLines=s);const m=await this.api.updateCart({id:o.id||"",items:[p],location:this.getLocation()}),f=null===(i=Object.values(m.items))||void 0===i?void 0:i.find(t=>t.fulfillmentId===p.fulfillmentId&&t.partNumber===p.partNumber);if(!f)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(m,[]);const g=this.store.get("cart.fulfillments."+t.fulfillmentId);g?this.updateFulfillment(t.fulfillmentId,m):this.addNewFulfillmentAndRetailer(t.fulfillmentId,m),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const v=this.getDetails();this.pubSub.publishAction(e.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(e.CART_ITEM_ADDED,{cartId:v.cartId,itemId:f.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(e.CART_UPDATED,{previous:r,current:v});const b=splitCategoryPath(f.catPath);this.googleTagManager.addToCart({item_id:f.liquidId,item_name:f.name,item_brand:f.brand,item_size:f.size,item_category:b.category,item_category2:b.category2,item_category3:b.category3,quantity:f.quantity,price:centToDollar(f.unitPrice||0),item_image:f.mainImage,upc:f.upc,grouping_id:f.salsifyGrouping,product_id:f.liquidId})}catch(o){this.store.set("cart.error",o.message),this.logger.error("Failed to add item to cart",o)}finally{this.store.set("cart.loading",![])}}async handleGoToCheckout(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),n=this.clientConfig.get("checkout");if(n){this.trackBeginCheckout(t);const e=await this.api.prepareCheckout({cartId:t.id||""}),i=this.resolveCheckoutRedirectUrl(n.pageUrl,e.token);return window.location.assign(i),void 0}this.pubSub.publishAction(e.INTERNAL_CART_TO_CHECKOUT,{}),this.trackBeginCheckout(t)}catch(t){throw this.store.set("cart.error",t.message),this.logger.error("Failed to proceed to checkout",t),t}finally{this.store.set("cart.loading",![])}}trackBeginCheckout(t){var e;const n=(null===(e=t.promoCode)||void 0===e?void 0:e.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(t.items||{}).map(t=>{const e=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_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)}resolveCheckoutRedirectUrl(t,e){return t.includes("{id}")?e?t.split("{id}").join(encodeURIComponent(e)):(this.logger.warn('Checkout redirect URL contains "{id}" placeholder but no checkout token was found. Removing placeholder.'),t.split("{id}").join("")):t}async applyPromoCode(t){var n,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.batch({"cart.subtotal":c.subtotal,"cart.itemsQuantity":c.itemsQuantity,"cart.events":c.events});const p=(null===(i=null===(n=c.promoCode)||void 0===n?void 0:n.code)||void 0===i?void 0:i.toLowerCase())===a.toLowerCase();p?(this.store.set("cart.promoCode",{code:a,discount:(null===(o=c.promoCode)||void 0===o?void 0:o.discount)||0}),this.pubSub.publishAction(e.CART_PROMO_CODE_APPLIED,{cartId:t,discount:(null===(r=c.promoCode)||void 0===r?void 0:r.discount)||0,newSubtotal:c.subtotal||0}),this.googleTagManager.promoCodeApplied(a,(null===(s=c.promoCode)||void 0===s?void 0:s.discount)||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(e.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 n=this.store.get("cart.id");throw this.pubSub.publishAction(e.CART_PROMO_CODE_FAILED,{cartId:n,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"),n=await this.api.updateCart({id:t,items:[],promoCode:"",location:this.getLocation()});this.store.batch({"cart.subtotal":n.subtotal,"cart.itemsQuantity":n.itemsQuantity,"cart.promoCode":null}),this.pubSub.publishAction(e.CART_PROMO_CODE_REMOVED,{cartId:t,newSubtotal:n.subtotal||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const n=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",n);const i=this.store.get("cart.promoCode"),o=this.store.get("cart.id");throw this.pubSub.publishAction(e.CART_PROMO_CODE_FAILED,{cartId:o,error:n}),(null==i?void 0:i.code)&&this.googleTagManager.promoCodeFailed(i.code,n),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){try{this.store.set("cart",{...x,rerender:!![]}),this.store.set("cart.loading",!![]);const t=this.store.get("cart"),n=await this.api.getCartData(t.id);this.syncCartState(n,!![]),n.id!==t.id&&await this.store.persist(),this.pubSub.publishAction(e.CART_RESET,!![])}catch(t){const n=(null==t?void 0:t.message)||"Failed to reset cart";this.store.set("cart.error",n);const i=this.store.get("cart.id");throw this.pubSub.publishAction(e.CART_FAILED,{cartId:i,message:n}),this.logger.error("Reset cart failed",t),t}finally{this.store.set("cart.loading",![])}}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.discount)||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.itemsQuantity":t.itemsQuantity,"cart.error":null,"cart.events":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(),discount:(null===(n=t.promoCode)||void 0===n?void 0:n.discount)||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(i["cart.promoCode"]=null)}this.store.batch(i)}syncRetailersFromApiResponse(t){var e,n;const i=this.store.get("cart.retailers")||{},o=this.store.get("cart.fulfillments")||{},r=new Set(Object.keys(t.retailers)),s=new Set;for(const a of Object.values(t.retailers))if(a.fulfillments)for(const t of Object.keys(a.fulfillments))s.add(t);for(const a of Object.keys(i))r.has(a)||this.store.remove("cart.retailers."+a);for(const a of Object.keys(o))s.has(a)||this.store.remove("cart.fulfillments."+a);if((null===(e=Object.values(t.retailers))||void 0===e?void 0:e.length)>0){const e={};for(const i of Object.values(t.retailers))if(e["cart.retailers."+i.id]=i,(null===(n=Object.values(i.fulfillments))||void 0===n?void 0:n.length)>0)for(const t of Object.values(i.fulfillments))e["cart.fulfillments."+t.id]=t;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;const o=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)}),r=null===(i=Object.keys(e.retailers))||void 0===i?void 0:i.some(e=>e===t.retailerId);if(o){this.updateFulfillment(t.fulfillmentId,e);const n=e.retailers[t.retailerId];n&&this.store.set("cart.retailers."+t.retailerId,n)}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),r){const n=e.retailers[t.retailerId];n&&this.store.set("cart.retailers."+t.retailerId,n)}else this.store.remove("cart.retailers."+t.retailerId)}syncCartState(t,n=![]){var i,o,r,s,a;const c=this.store.get("cart");for(const e of Object.keys(c.items||{}))this.store.remove("cart.items."+e);for(const e of Object.keys(c.retailers||{}))this.store.remove("cart.retailers."+e);for(const e of Object.keys(c.fulfillments||{}))this.store.remove("cart.fulfillments."+e);const p={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(i=t.promoCode)||void 0===i?void 0:i.code)?{...t.promoCode,error:null}:null};if((null===(o=Object.values(t.items))||void 0===o?void 0:o.length)>0)for(const e of Object.values(t.items))p["cart.items."+e.id]=e;if((null===(r=Object.values(t.retailers))||void 0===r?void 0:r.length)>0)for(const e of Object.values(t.retailers))if(p["cart.retailers."+e.id]=e,(null===(s=Object.values(e.fulfillments))||void 0===s?void 0:s.length)>0)for(const t of Object.values(e.fulfillments))p["cart.fulfillments."+t.id]=t;if((null===(a=t.events)||void 0===a?void 0:a.length)>0&&(p["cart.events"]=t.events),this.store.batch(p),n){const t=this.store.get("cart"),n=this.buildCartLoadedEventData(t);this.pubSub.publishAction(e.CART_LOADED,n)}}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.discount)&&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}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,n){const o={type:t,data:n||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:o}),t===i.CART&&this.pubSub.publishAction(e.CART_OPENED,!![]),t===i.CHECKOUT&&this.pubSub.publishAction(e.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===i.CART&&this.pubSub.publishAction(e.CART_CLOSED,!![]),(null==t?void 0:t.type)===i.CHECKOUT&&this.pubSub.publishAction(e.CHECKOUT_CLOSED,!![])}openModal(t,e){const n={type:t,data:e||{}};this.store.set("ui.modal",{isOpen:!![],contentConfig:n})}closeModal(){this.store.set("ui.modal.isOpen",![]),this.store.set("ui.modal.contentConfig",null)}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),window.addEventListener("lce:actions."+e.INTERNAL_CART_TO_CHECKOUT,async()=>{this.store.set("metadata.checkout",E.checkout),await this.loadCheckout({}),this.uiCommands.openDrawer(i.CHECKOUT)}),window.addEventListener("lce:actions."+e.CART_RESET,()=>{this.store.set("checkout",{...w,rerender:!![]})})}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async addPresaleItem(t){try{const e={fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines},n=await this.api.updateCart({id:"",items:[e],location:this.getLocation()});await this.loadCheckout({cartId:n.id,isForPresale:!![]})}catch(e){throw this.store.set("checkout.error",e.message),this.logger.error("Failed to add presale item to checkout",e),e}}async loadCheckout(t){try{this.store.set("checkout.loading",!![]);const n=void 0!==t.cartId?t.cartId:this.store.get("cart.id");if(!t.checkoutId&&!n)return this.store.set("checkout.error","Checkout token or Cart ID is required"),void 0;const i=this.themeProvider.getConfigs("checkout"),o=await this.api.prepareCheckout({token:t.checkoutId||void 0,cartId:t.checkoutId?void 0:n,marketingPreferences:{canEmail:i.layout.emailOptIn.checked,canSms:i.layout.smsOptIn.checked}});if(t.isForPresale===!![]&&0===o.itemsQuantity)return this.showPresaleExpired("items_unavailable"),void 0;const r={"checkout.cartId":o.cartId,"checkout.isGift":o.isGift,"checkout.marketingPreferences":o.marketingPreferences,"checkout.customerForm":w.customerForm,"checkout.giftRecipientForm":w.giftRecipientForm,"checkout.paymentForm":w.paymentForm,"checkout.paymentForm.billingSameAsShipping":o.billingSameAsShipping,"checkout.shippingAddress":o.shippingAddress,"checkout.presale":o.presale,"checkout.giftRecipientForm.data":o.giftOptions,"checkout.updating":![],"checkout.itemsQuantity":o.itemsQuantity};this.store.batch(r),this.syncCheckoutState(o),this.pubSub.publishAction(e.CHECKOUT_LOADED,this.getDetails())}catch(n){this.store.set("checkout.error",n.message),this.pubSub.publishAction(e.CHECKOUT_FAILED,{message:n.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const n=this.store.get("checkout.isGift"),i=null!=t?t:!n,o={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":i,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.isValid":![],"checkout.giftRecipientForm.data":o});const r=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_IS_GIFT_TOGGLED,{cartId:r,isActive:i,previousIsActive:n})}async toggleBillingSameAsShipping(t){const n=this.store.get("checkout.paymentForm.billingSameAsShipping"),i=null!=t?t:!n;this.store.set("checkout.paymentForm.billingSameAsShipping",i);const o=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{cartId:o,isActive:i,previousIsActive:n})}async toggleMarketingPreferences(t,n){const i=this.store.get("checkout.marketingPreferences."+t),o=null!=n?n:!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);const c=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{cartId:c,fieldName:t,isActive:o,previousIsActive:i})}async getPaymentSession(){try{const t=this.store.get("cart.id"),e=await this.api.getPaymentSession(t);this.store.batch({"checkout.paymentForm.paymentSession":e,"checkout.paymentForm.paymentMethod":null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,e){try{if(this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111",expMonth:"03",expYear:"35"}};const n=await this.api.confirmPaymentSession({confirmationTokenId:t,setupIntentId:e});return{id:n.id,card:{brand:n.card.brand,last4:n.card.last4,expMonth:n.card.expMonth,expYear:n.card.expYear}}}catch(n){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){try{this.googleTagManager.promoCodeAttempt(t);const n=this.dataForCheckoutPrepare({}),i=await this.api.prepareCheckout({...n,promoCode:t}),o=0!==i.amounts.discounts,r=i.events.some(t=>t.type===a.PROMO_CODE)?i.events[0]:null;if(!o){this.store.set("checkout.promoCodeError",r?r.message:'Code "'+t+'" does not exist');const n=this.store.get("checkout.cartId");return this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_FAILED,{cartId:n,error:(null==r?void 0:r.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==r?void 0:r.message)||"not_applied"),void 0}const s=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_APPLIED,{cartId:s,discount:i.amounts.discounts,newTotal:i.amounts.total}),this.googleTagManager.promoCodeApplied(t,i.amounts.discounts),await this.refreshCheckout({response:i})}catch(n){const i=(null==n?void 0:n.message)||"Failed to apply promo code. Please try again.";this.store.set("checkout.error",i);const o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:i}),this.googleTagManager.promoCodeFailed(t,i),n}}async removePromoCode(){var t,n;try{const i=this.dataForCheckoutPrepare({}),o=(null===(n=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===n?void 0:n.code)||"",r=await this.api.prepareCheckout({...i,promoCode:""});if(0!==r.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;const s=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_REMOVED,{cartId:s,newTotal:r.amounts.total}),this.googleTagManager.promoCodeApplied(o,0),await this.refreshCheckout({response:r})}catch(i){const t=(null==i?void 0:i.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const n=this.store.get("checkout.promoCode.code")||"",o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(e.CHECKOUT_PROMO_CODE_FAILED,{cartId:o,error:t}),n&&this.googleTagManager.promoCodeFailed(n,t),i}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(bt){const e=bt.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",e),bt}}async applyGiftCard(t){const n=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(n);const t=this.dataForCheckoutPrepare({}),i=t.giftCards||[],o=await this.api.prepareCheckout({...t,giftCards:[...i,n]}),r=o.events.some(t=>t.type===a.GIFT_CARD&&t.level===c.ERROR)?o.events[0]:null;r&&this.store.set("checkout.giftCardError",r.message);const s=o.giftCards.find(t=>t.code.toLowerCase()===n.toLowerCase());if(!s){this.store.set("checkout.giftCardError","Gift card could not be applied");const t=this.store.get("checkout.cartId");return this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{cartId:t,error:(null==r?void 0:r.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(n,(null==r?void 0:r.message)||"not_applied"),void 0}const p=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_APPLIED,{cartId:p,newTotal:o.amounts.total}),this.googleTagManager.giftCardApplied(n,s.applied),await this.refreshCheckout({response:o})}catch(i){const t=(null==i?void 0:i.message)||"Failed to apply gift card. Please try again.";this.store.set("checkout.error",t);const o=this.store.get("checkout.cartId");throw this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{cartId:o,error:t}),this.googleTagManager.giftCardFailed(n,t),i}}async removeGiftCard(t){var n;const i=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),o=(null===(n=t.giftCards)||void 0===n?void 0:n.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(e.CHECKOUT_GIFT_CARD_REMOVED,{cartId:a,newTotal:r.amounts.total}),this.googleTagManager.giftCardApplied(i,0),await this.refreshCheckout({response:r})}catch(o){const t=(null==o?void 0:o.message)||"Failed to remove gift card. Please try again.";this.store.set("checkout.error",t);const n=this.store.get("checkout.cartId");throw this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{cartId:n,error:t}),this.googleTagManager.giftCardFailed(i,t),o}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(bt){throw this.store.set("checkout.error",(null==bt?void 0:bt.message)||"Failed to clear gift card error. Please try again."),bt}}showPresaleExpired(t="time_expired"){this.store.set("checkout",{...w,rerender:![]});const e=this.store.get("metadata.checkout.injection");if(null==e?void 0:e.containerId){const n=document.getElementById(e.containerId);if(n){const e=ComponentFactoryService.createElement({type:i.CHECKOUT_PRESALE_EXPIRED,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],reason:t});safeReplaceChildren(n,e)}return}this.uiCommands.openDrawer(i.CHECKOUT_PRESALE_EXPIRED,{reason:t})}openCheckout(){const t=this.clientConfig.get("checkout");if(null==t?void 0:t.pageUrl){this.store.set("metadata.checkout.returnUrl",window.location.href);const e=this.store.get("checkout.token")||"",n=this.resolveCheckoutPageUrl(t.pageUrl,e);return window.location.assign(n),void 0}this.uiCommands.openDrawer(i.CHECKOUT)}getReturnUrl(){return this.store.get("metadata.checkout.returnUrl")}resolveCheckoutPageUrl(t,e){return t.includes("{id}")?e?t.split("{id}").join(encodeURIComponent(e)):(this.logger.warn('Checkout page URL contains "{id}" placeholder but no checkout token was found. Removing placeholder.'),t.split("{id}").join("")):t}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,n){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,p=a.quantity+n;if(p<1)return this.removeItem(t,!![]);const m={id:a.cartItemId,fulfillmentId:a.fulfillmentId,partNumber:a.partNumber,quantity:p},f=(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()))||[];f.length>0&&(m.engravingLines=f);const g=await this.api.updateCheckoutItems({cartId:s,items:[m],location:this.getLocation()});this.syncFromItemUpdate(g.cart,g.checkout),this.pubSub.publishAction(n>0?e.CHECKOUT_ITEM_QUANTITY_INCREASE:e.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartId:s,cartItemId:a.cartItemId,quantity:p,previousQuantity:c});const v=splitCategoryPath(a.catPath),b={item_id:a.liquidId,item_name:a.name,item_brand:a.brand,item_size:a.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,quantity:Math.abs(n),price:centToDollar(a.unitPrice||0),item_image:a.mainImage,upc:a.upc,grouping_id:a.salsifyGrouping,product_id:a.liquidId};n<0?this.googleTagManager.removeFromCart(b):n>0&&this.googleTagManager.addToCart(b)}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 n,i,o;try{const r=this.store.get("checkout.items."+t);if(!r)throw new SDKError("Item not found in checkout");if(!(null===(n=r.attributes)||void 0===n?void 0:n.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"),p=await this.api.updateCheckoutItems({cartId:c,items:[a],location:this.getLocation()});this.syncFromItemUpdate(p.cart,p.checkout),this.pubSub.publishAction(e.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartId:c,cartItemId:r.cartItemId,engravingLines:[],previousEngravingLines:s})}catch(r){throw this.store.set("checkout.items."+t+".error",r.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:r}),r}}async removeItem(t,n){var i,o,r;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;n||this.store.set("checkout.items."+t+".updating",!![]);const 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},p=(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()))||[];p.length>0&&(c.engravingLines=p);const m=await this.api.updateCheckoutItems({cartId:s,items:[c],location:this.getLocation()});this.syncFromItemUpdate(m.cart,m.checkout),this.pubSub.publishAction(e.CHECKOUT_ITEM_REMOVED,{cartId:s,cartItemId:a.cartItemId})}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 n=this.store.get("checkout.fulfillments"),i=Object.values(n||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),r=Object.values(n||{}).filter(t=>t.type===o.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:Math.round(e.amounts.subtotal*t/100)})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(s);const a=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{cartId:a,deliveryTips:r,previousDeliveryTips:i})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to update tips. Please try again."),n}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,n){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.fulfillments"),r=Object.values(i||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),s=Object.values(i||{}).filter(t=>t.type===o.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.id===t?n:e.amounts.tip})),a=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:s}));this.updateStoreFromCheckoutResponse(a);const c=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{cartId:c,deliveryTips:s,previousDeliveryTips:r})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update fulfillment tip. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const n=this.store.get("checkout.fulfillments"),i=Object.values(n||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip})),r=Object.values(n||{}).filter(t=>t.type===o.ON_DEMAND).map(e=>({fulfillmentId:e.id,tip:e.id===t?0:e.amounts.tip})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(s);const a=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_TIP_UPDATED,{cartId:a,deliveryTips:r,previousDeliveryTips:i})}catch(n){throw this.store.set("checkout.error",(null==n?void 0:n.message)||"Failed to remove fulfillment tip. Please try again."),n}finally{this.store.set("checkout.updating",![])}}async clearCheckoutError(){this.store.set("checkout.error",null)}async editCustomerForm(){this.store.set("checkout.customerForm.isEditing",!![])}async saveCustomerForm({shippingAddressTwo:t,deliveryInstructions:n,customerData:i}){var o;try{this.store.set("checkout.customerForm.isSaving",!![]);const r=this.store.get("checkout.customerForm.data"),s=this.store.get("checkout.isGift"),a=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:n||void 0,customer:{...r,...i},isGift:s}),c=await this.api.prepareCheckout(a);this.store.batch({"checkout.customerForm.data":c.customer,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddress":c.shippingAddress,"checkout.deliveryInstructions":n});const p=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,{cartId:p});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===(o=m.promoCode)||void 0===o?void 0:o.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:n,...i}){var o;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const r=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:n||void 0,isGift:!![],giftRecipient:i}),s=await this.api.prepareCheckout(r);this.store.batch({"checkout.giftRecipientForm.data":s.giftOptions,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddress":s.shippingAddress,"checkout.deliveryInstructions":n});const a=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_GIFT_INFORMATION_UPDATED,{cartId:a});const c=this.store.get("checkout");this.googleTagManager.addShippingInfo([...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}})],(null===(o=c.promoCode)||void 0===o?void 0:o.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:t,paymentSession:n}){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 p=null,m=null;if(c||n){const t=await this.confirmPaymentSession((null==n?void 0:n.confirmationTokenId)||"",(null==n?void 0:n.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");p=t.card,m=t.id}const f=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:m||void 0}),g=await this.api.prepareCheckout(f);if(g.payment&&p&&(a["checkout.paymentForm.paymentMethod"]={id:g.payment,card:p}),t&&g.billingAddress){a["checkout.paymentForm.data"]={firstName:g.billingAddress.firstName||"",lastName:g.billingAddress.lastName||"",email:g.billingAddress.email||"",phone:g.billingAddress.phone||"",company:g.billingAddress.company||"",addressOne:g.billingAddress.one||"",addressTwo:g.billingAddress.two||"",city:g.billingAddress.city||"",state:g.billingAddress.state||"",zipCode:g.billingAddress.zip||""};const t=this.store.get("checkout.cartId");this.pubSub.publishAction(e.CHECKOUT_BILLING_INFORMATION_UPDATED,{cartId:t})}a["checkout.paymentForm.isEditing"]=![],a["checkout.paymentForm.isValid"]=!![],this.store.batch(a);const v=a["checkout.paymentForm.paymentMethod"]||(null===(i=s.paymentForm)||void 0===i?void 0:i.paymentMethod),b=(null===(o=null==v?void 0:v.card)||void 0===o?void 0:o.brand)?v.card.brand+" ****"+v.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}}),b,(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,n,o,r,s,a;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_STARTED,{started:!![]});const c=this.store.get("checkout"),{orderNumber:p}=await this.api.checkoutComplete(c.token);c.presale||this.store.set("cart.shouldReset",!![]);const m={orderNumber:p,orderTotal:c.amounts.total,cardLast4:(null===(o=null===(n=null===(t=null==c?void 0:c.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===n?void 0:n.card)||void 0===o?void 0:o.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},f=this.store.get("metadata.checkout.injection");if(null==f?void 0:f.containerId){const t=document.getElementById(f.containerId);if(t){const e=ComponentFactoryService.createElement({type:i.CHECKOUT_COMPLETED,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...m});safeReplaceChildren(t,e)}}else this.uiCommands.openDrawer(i.CHECKOUT_COMPLETED,m);this.pubSub.publishAction(e.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:p,orderTotal:c.amounts.total}),this.googleTagManager.purchase({transaction_id:p,tax:centToDollar(c.amounts.tax+c.amounts.service+c.amounts.platform),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.service+c.amounts.platform+c.amounts.shipping+c.amounts.delivery),discounts:centToDollar(c.amounts.discounts),gift_cards:centToDollar(c.amounts.giftCards||0),net_total:centToDollar(c.amounts.total)})}catch(c){const t=(null==c?void 0:c.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(e.CHECKOUT_SUBMIT_FAILED,{message:t})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(t){const e={"checkout.amounts":t.amounts,"checkout.events":t.events,"checkout.error":null};if(t.retailers&&Object.values(t.retailers).length>0)for(const n of Object.values(t.retailers))for(const t of Object.values(n.fulfillments))e["checkout.fulfillments."+t.id]=t;this.store.batch(e)}syncFromItemUpdate(t,e){var n,i,o,r,s;try{this.store.set("checkout.updating",!![]);const a=this.store.get("cart");for(const t of Object.keys(a.items||{}))this.store.remove("cart.items."+t);for(const t of Object.keys(a.retailers||{}))this.store.remove("cart.retailers."+t);for(const t of Object.keys(a.fulfillments||{}))this.store.remove("cart.fulfillments."+t);const c={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":t.events||[],"cart.promoCode":(null===(n=t.promoCode)||void 0===n?void 0:n.code)?{...t.promoCode,error:null}:null};if((null===(i=Object.values(t.items))||void 0===i?void 0:i.length)>0)for(const e of Object.values(t.items))c["cart.items."+e.id]=e;if((null===(o=Object.values(t.retailers))||void 0===o?void 0:o.length)>0)for(const e of Object.values(t.retailers))if(c["cart.retailers."+e.id]=e,(null===(r=Object.values(e.fulfillments))||void 0===r?void 0:r.length)>0)for(const t of Object.values(e.fulfillments))c["cart.fulfillments."+t.id]=t;this.store.batch(c);const p={"checkout.token":e.token,"checkout.events":e.events,"checkout.amounts":e.amounts,"checkout.shippingAddress":e.shippingAddress,"checkout.itemsQuantity":e.itemsQuantity,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":e.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(s=null==e?void 0:e.promoCode)||void 0===s?void 0:s.code)?null==e?void 0:e.promoCode:null};if(Object.values(e.items).length>0){this.store.remove("checkout.items");for(const t of Object.values(e.items))p["checkout.items."+t.cartItemId]={...t,loading:![],updating:![],error:null}}if(e.retailers&&Object.values(e.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const t of Object.values(e.retailers)){p["checkout.retailers."+t.id]=t;for(const e of Object.values(t.fulfillments))p["checkout.fulfillments."+e.id]=e}}this.store.batch(p)}finally{this.store.set("checkout.updating",![])}}syncCheckoutState(t){var e;const n={"checkout.token":t.token,"checkout.events":t.events,"checkout.amounts":t.amounts,"checkout.shippingAddress":t.shippingAddress,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":t.giftCards.map(t=>({code:t.code,discount:t.applied})),"checkout.promoCode":(null===(e=null==t?void 0:t.promoCode)||void 0===e?void 0:e.code)?null==t?void 0:t.promoCode:null};if(Object.values(t.items).length>0){this.store.remove("checkout.items");for(const e of Object.values(t.items))n["checkout.items."+e.cartItemId]={...e,loading:![],updating:![],error:null}}if(t.retailers&&Object.values(t.retailers).length>0){this.store.remove("checkout.fulfillments"),this.store.remove("checkout.retailers");for(const e of Object.values(t.retailers)){n["checkout.retailers."+e.id]=e;for(const t of Object.values(e.fulfillments))n["checkout.fulfillments."+t.id]=t}}this.store.batch(n)}async refreshCheckout(t){var n;try{let e;if(this.store.set("checkout.updating",!![]),null==t?void 0:t.response)e=t.response;else{const i=null!==(n=null==t?void 0:t.cartId)&&void 0!==n?n:this.store.get("checkout.cartId");if(!i)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const o=this.dataForCheckoutPrepare({});e=await this.api.prepareCheckout({...o,cartId:i})}this.syncCheckoutState(e)}catch(i){const t=(null==i?void 0:i.message)||"Failed to refresh checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(e.CHECKOUT_FAILED,{message:t}),i}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:e,billingData:n,marketingPreferences:i,shippingAddressTwo:r,deliveryInstructions:s,deliveryTips:a,paymentMethodId:c,isGift:p}){var m,f,g,v,b,x,w,S,E,_,F,I,O,R,M,B,q,U,V,K,H,W,X;const Z=this.store.get("checkout"),J=null!==(f=null===(m=Z.paymentForm)||void 0===m?void 0:m.billingSameAsShipping)&&void 0!==f?f:!![],$=void 0!==p?p:Z.isGift,tt=e?!![]:null!==(v=null===(g=Z.giftRecipientForm)||void 0===g?void 0:g.isValid)&&void 0!==v?v:![],et=$&&tt,nt={cartId:Z.cartId,shippingAddressTwo:r,billingSameAsShipping:J,marketingPreferences:i||Z.marketingPreferences,promoCode:(null===(b=Z.promoCode)||void 0===b?void 0:b.code)||void 0,isGift:et,giftCards:(null===(x=null==Z?void 0:Z.giftCards)||void 0===x?void 0:x.map(t=>t.code))||[],deliveryTips:a||Object.values(Z.fulfillments||{}).filter(t=>t.type===o.ON_DEMAND).map(t=>({fulfillmentId:t.id,tip:t.amounts.tip}))};c?nt.payment=c:(null===(S=null===(w=Z.paymentForm)||void 0===w?void 0:w.paymentMethod)||void 0===S?void 0:S.id)&&(nt.payment=Z.paymentForm.paymentMethod.id);const it=s||Z.deliveryInstructions;if(it&&(nt.deliveryInstructions=Object.values(Z.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:it}))),nt.customer=t||((null===(_=null===(E=null==Z?void 0:Z.customerForm)||void 0===E?void 0:E.data)||void 0===_?void 0:_.email)?{firstName:null===(I=null===(F=Z.customerForm)||void 0===F?void 0:F.data)||void 0===I?void 0:I.firstName,lastName:null===(R=null===(O=Z.customerForm)||void 0===O?void 0:O.data)||void 0===R?void 0:R.lastName,email:null===(B=null===(M=Z.customerForm)||void 0===M?void 0:M.data)||void 0===B?void 0:B.email,phone:null===(U=null===(q=Z.customerForm)||void 0===q?void 0:q.data)||void 0===U?void 0:U.phone,birthDate:null===(K=null===(V=Z.customerForm)||void 0===V?void 0:V.data)||void 0===K?void 0:K.birthDate,company:null===(W=null===(H=Z.customerForm)||void 0===H?void 0:H.data)||void 0===W?void 0:W.company}:void 0),et){const t=e||(null===(X=Z.giftRecipientForm)||void 0===X?void 0:X.data);t&&(nt.giftOptions=t)}return J||(n?nt.billingAddress={firstName:n.firstName,lastName:n.lastName,email:n.email,phone:n.phone,company:n.company,one:n.one,two:n.two,city:n.city,state:n.state,zip:n.zip}:Z.paymentForm.data&&(nt.billingAddress=Z.paymentForm.data)),nt}getDetails(){var t,e,n,i;const o=this.store.get("checkout"),r={};for(const s in o.items||{}){const t=o.items[s];r[s]={liquidId:t.liquidId,variantId:t.variantId,cartItemId:s,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyPid:t.salsifyPid,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,tax:t.tax,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes}}return{cartId:o.cartId,isGift:o.isGift||![],billingSameAsShipping:(null===(t=o.paymentForm)||void 0===t?void 0:t.billingSameAsShipping)||!![],marketingPreferences:{canEmail:(null===(e=o.marketingPreferences)||void 0===e?void 0:e.canEmail)||![],canSms:(null===(n=o.marketingPreferences)||void 0===n?void 0:n.canSms)||![]},hasPromoCode:Boolean(null===(i=o.promoCode)||void 0===i?void 0:i.code),hasGiftCards:Array.isArray(o.giftCards)&&o.giftCards.length>0,amounts:o.amounts,itemCount:Object.values(r).reduce((t,e)=>t+(e.quantity||0),0),items:r}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,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,n=null){var i,o;try{const r=this.store.get("products."+t);r.loading||this.store.set("products."+t+".loading",!![]);let s=null;if(n&&(s=n),n||(s=await this.api.getProductsData([t],this.getLocation())),!s||!(null===(i=null==s?void 0:s.products)||void 0===i?void 0:i[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const a=this.loadProductStoreUpdate(s);if(!a)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...a,identifier:t}),this.pubSub.publishAction(e.PRODUCT_LOADED,this.productDataForEventFromStore(t));const c=s.products[0],p=a.sizes[a.selectedSizeId||""],m=Boolean(this.getLocation()),f=a.selectedFulfillment,g=m&&(null==f?void 0:f.variant.price)?f.variant.price:a.noAvailabilityPrice,v=splitCategoryPath(c.catPath);this.googleTagManager.viewItem({item_id:null==p?void 0:p.id,item_name:c.name,item_brand:c.brand,item_size:null==p?void 0:p.size,item_category:v.category,item_category2:v.category2,item_category3:v.category3,price:centToDollar(g),item_type:c.type,item_subtype:c.subType,item_image:(null==p?void 0:p.image)||(null===(o=c.images)||void 0===o?void 0:o[0]),upc:null==p?void 0:p.upc,grouping_id:c.salsifyGrouping,product_id:null==p?void 0:p.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,n){var i,r,s;const a=this.store.get("products."+t),c=a.sizes[n],p=Object.values(c.shippingFulfillments),m=Object.values(c.onDemandFulfillments),f=p.length>0,g=m.length>0,v=f||g;let b=a.selectedFulfillmentType,x=null,w=null;const S=b===o.SHIPPING?f:g;!S&&v&&(b=b===o.SHIPPING?o.ON_DEMAND:o.SHIPPING);const E=b===o.SHIPPING?p:m;E.length>0&&(x=E[0],w=x.id);const _=E.length>0,F=splitCategoryPath(a.catPath);this.googleTagManager.viewItem({item_id:null==c?void 0:c.id,item_name:a.name,item_brand:a.brand,item_size:null==c?void 0:c.size,item_category:F.category,item_category2:F.category2,item_category3:F.category3,price:centToDollar((null==x?void 0:x.variant.price)||a.noAvailabilityPrice),item_type:a.type,item_subtype:a.subType,item_image:(null==c?void 0:c.image)||(null===(i=a.images)||void 0===i?void 0:i[0]),upc:null==c?void 0:c.upc,grouping_id:a.salsifyGrouping,product_id:null==c?void 0:c.id}),v||this.googleTagManager.productSizeNoAvailability({productId:null==c?void 0:c.id,productName:a.name,productBrand:a.brand,productCategory:F.category,productCategory2:F.category2,productCategory3:F.category3,productType:a.type,productSubtype:a.subType,productPrice:a.noAvailabilityPrice,sizeId:n,sizeName:null==c?void 0:c.size,upc:null==c?void 0:c.upc,groupingId:a.salsifyGrouping,address:this.store.get("address.address"),reason:"No fulfillments available for this size"}),this.pubSub.publishAction(e.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:n,selectedSize:(null===(r=a.sizes[n])||void 0===r?void 0:r.size)||"",previousSizeId:a.selectedSizeId||"",previousSize:(null===(s=a.sizes[a.selectedSizeId])||void 0===s?void 0:s.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:n,["products."+t+".productHasAvailability"]:v,["products."+t+".fulfillmentHasAvailability"]:_,["products."+t+".selectedFulfillmentType"]:b,["products."+t+".selectedFulfillment"]:x,["products."+t+".selectedFulfillmentId"]:w})}async selectFulfillment(t,n){var i;const r=this.store.get("products."+t),s=r.sizes[r.selectedSizeId],a=r.selectedFulfillmentType===o.SHIPPING?s.shippingFulfillments:s.onDemandFulfillments,c=a[n];this.pubSub.publishAction(e.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:n,selectedFulfillmentType:r.selectedFulfillmentType,previousFulfillmentId:r.selectedFulfillmentId||"",previousFulfillmentType:r.selectedFulfillmentType});const p=splitCategoryPath(r.catPath);this.googleTagManager.viewItem({item_id:null==s?void 0:s.id,item_name:r.name,item_brand:r.brand,item_size:null==s?void 0:s.size,item_category:p.category,item_category2:p.category2,item_category3:p.category3,price:centToDollar((null==c?void 0:c.variant.price)||r.noAvailabilityPrice),item_type:r.type,item_subtype:r.subType,item_image:(null==s?void 0:s.image)||(null===(i=r.images)||void 0===i?void 0:i[0]),upc:null==s?void 0:s.upc,grouping_id:r.salsifyGrouping,product_id:null==s?void 0:s.id}),this.store.batch({["products."+t+".selectedFulfillment"]:c,["products."+t+".selectedFulfillmentId"]:n,["products."+t+".quantity"]:1})}async updateQuantity(t,n){var i;const o=this.store.get("products."+t),r=o.quantity,s=r+n,a=1,c=(null===(i=null==o?void 0:o.selectedFulfillment)||void 0===i?void 0:i.variant.stock)||5,p=Math.max(a,Math.min(c,s));this.pubSub.publishAction(n<0?e.PRODUCT_QUANTITY_DECREASE:e.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:p,previousQuantity:r}),this.store.set("products."+t+".quantity",p)}async changeFulfillmentType(t,n){var i,r;const s=this.store.get("products."+t),a=s.sizes[s.selectedSizeId],c=n===o.SHIPPING?a.shippingFulfillments:a.onDemandFulfillments,p=Object.values(c);if(0===p.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:n,upc:null==a?void 0:a.upc,groupingId:s.salsifyGrouping,address:this.store.get("address.address"),reason:"No "+n+" fulfillments available for selected size"}),void 0}const m=p[0]||null,f=(null==m?void 0:m.id)||null;this.pubSub.publishAction(e.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:n,selectedFulfillmentId:f,previousFulfillmentType:s.selectedFulfillmentType,previousFulfillmentId:s.selectedFulfillmentId,fulfillmentHasAvailability:p.length>0});const g=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:g.category,item_category2:g.category2,item_category3:g.category3,price:centToDollar((null==m?void 0:m.variant.price)||s.noAvailabilityPrice),item_type:s.type,item_subtype:s.subType,item_image:(null==a?void 0:a.image)||(null===(r=s.images)||void 0===r?void 0:r[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"]:n,["products."+t+".selectedFulfillment"]:m,["products."+t+".selectedFulfillmentId"]:f,["products."+t+".fulfillmentHasAvailability"]:p.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(i.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.checkoutCommands.addPresaleItem(e),this.clientConfig.isBuilder()||this.checkoutCommands.openCheckout(),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(n){this.logger.error("Error adding presale item to checkout",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,r,s,a,c;try{const e=this.themeProvider.getConfigs("product"),p={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?o.SHIPPING:o.ON_DEMAND,selectedFulfillmentId:null,selectedFulfillment:null,productHasAvailability:![],fulfillmentHasAvailability:![],drawer:{isOpen:![],contentConfig:null},loading:![],updating:![],rerender:![],error:null};if(t.sizes&&Object.values(t.sizes).length>0)for(const{shippingVariants:i,onDemandVariants:o,...r}of Object.values(t.sizes)){p.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)&&(p.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)&&(p.sizes[r.id].onDemandFulfillments[e.onDemandFulfillment.id]={...e.onDemandFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:t})}}const m=Object.values(p.sizes),f=this.findFirstAvailableSize(p.sizes);p.selectedSizeId=f||(null===(i=m[0])||void 0===i?void 0:i.id)||"";const g=(null===(r=p.sizes[p.selectedSizeId])||void 0===r?void 0:r.shippingFulfillments)||{},v=(null===(s=p.sizes[p.selectedSizeId])||void 0===s?void 0:s.onDemandFulfillments)||{};p.productHasAvailability=Object.values(g).length+Object.values(v).length>0;const b=p.selectedFulfillmentType===o.SHIPPING?Object.values(g):Object.values(v);if(p.fulfillmentHasAvailability=b.length>0,p.selectedFulfillment=b[0]||null,p.selectedFulfillmentId=(null===(a=p.selectedFulfillment)||void 0===a?void 0:a.id)||null,!p.fulfillmentHasAvailability){const t=p.selectedFulfillmentType===o.SHIPPING?o.ON_DEMAND:o.SHIPPING,e=t===o.SHIPPING?Object.values(g):Object.values(v);e.length>0&&(p.selectedFulfillmentType=t,p.selectedFulfillment=e[0],p.selectedFulfillmentId=(null===(c=p.selectedFulfillment)||void 0===c?void 0:c.id)||null,p.fulfillmentHasAvailability=!![])}if(!p.productHasAvailability){const e=splitCategoryPath(t.catPath),n=p.sizes[p.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 p}catch(p){throw this.logger.error("Product data processing error",p),p}}}class AddressCommands extends BaseCommand{constructor(){super(),this.productCommands=ProductCommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("AddressCommands",()=>new AddressCommands)}async searchAddresses(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(n){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==n?void 0:n.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(e.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==n?void 0:n.message)||"Failed to update downstream state after address change"}),n}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(e.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,n){try{const e=this.buildFormattedAddressString(t),i={id:"",formattedAddress:e,address:t,coordinates:n};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(e.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:this.buildFormattedAddressString(t),address:t,coordinates:n,error:(null==i?void 0:i.message)||"Failed to set manual address"}),i}}async clearSelectedAddress(){this.store.set("address",v),this.pubSub.publishAction(e.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 p=[];return(null===(o=t.state)||void 0===o?void 0:o.trim())&&p.push(t.state.trim()),(null===(r=t.zip)||void 0===r?void 0:r.trim())&&p.push(t.zip.trim()),p.length>0&&a.push(p.join(" ")),(null===(s=t.country)||void 0===s?void 0:s.trim())&&a.push(t.country.trim()),a.join(", ")}}const xt={BRANDS:"brands",FLAVOR:"flavor",FULFILLMENT:"fulfillment",REGION:"region",VARIETY:"variety",ENGRAVING:"engraving",PRICE:"price",PRESALE:"presale",CATEGORIES:"categories",SIZES:"sizes",APPELLATION:"appellation",COUNTRY:"country",VINTAGE:"vintage",MATERIALS:"materials"},wt={ALL:"all",SHIPPING:"shipping",ON_DEMAND:"onDemand"},kt={MIN:"0",MAX:"1000"},Ct={YES:"YES",NO:"NO"},St={IDLE:"idle",LOADING_INITIAL:"loading_initial",LOADING_MORE:"loading_more",ERROR:"error"};class ProductListCommands extends BaseCommand{constructor(){super(),this.FILTER_TYPE_MAP={[xt.BRANDS]:m.BRANDS,[xt.CATEGORIES]:m.CATEGORIES,[xt.FLAVOR]:m.FLAVOR,[xt.REGION]:m.REGION,[xt.VARIETY]:m.VARIETY,[xt.VINTAGE]:m.VINTAGE,[xt.COUNTRY]:m.COUNTRY,[xt.APPELLATION]:m.APPELLATION,[xt.MATERIALS]:m.MATERIALS,[xt.SIZES]:m.SIZES,[xt.PRESALE]:m.PRESALE,[xt.ENGRAVING]:m.ENGRAVING,[xt.FULFILLMENT]:m.FULFILLMENT},this.listeners=new Set,this.selectFulfillmentType=async(t,e)=>{var n;const i=this.getStoreState(),r=i.products.find(e=>(e.salsifyGrouping||e.id)===t),s=i.userProducts[t].selectedSizeId,a=r?Object.values(r.sizes).find(t=>t.id===s):void 0;if(!a)return;const c=e===o.SHIPPING?Object.values(a.shippingFulfillments):Object.values(a.onDemandFulfillments),p=c[0];if(!p)return;const m=p.variant,f=i.retailers,g=f[m.retailerId];if(!g)return;const v=e===o.SHIPPING?g.shippingFulfillment:g.onDemandFulfillment,b={...i.userProducts,[t]:{...i.userProducts[t],selectedFulfillmentType:e,selectedFulfillment:v?{...v,id:null!==(n=v.id)&&void 0!==n?n:"",retailerName:g.name,retailerAddress:g.address,retailerAddressFormatted:g.addressFormatted,variant:m,image:a.image}:null}};this.store.set("productsList.userProducts",b),this.notifyListeners()},this.selectFulfillment=async(t,e)=>{var n,i;const r=this.getStoreState(),s=r.products.find(e=>(e.salsifyGrouping||e.id)===t),a=r.userProducts[t].selectedSizeId,c=s?Object.values(s.sizes).find(t=>t.id===a):void 0;if(!c)return;const p=Object.values(c.shippingFulfillments||{}).find(t=>t.id===e),m=Object.values(c.onDemandFulfillments||{}).find(t=>t.id===e),f=p||m;if(!f)return;const g=p?o.SHIPPING:o.ON_DEMAND,v=null===(n=f.variant)||void 0===n?void 0:n.retailerId,b=v?r.retailers[v]:void 0;if(!b)return;const x=g===o.SHIPPING?b.shippingFulfillment:b.onDemandFulfillment,w={...r.userProducts,[t]:{...r.userProducts[t],selectedFulfillmentType:g,selectedFulfillment:x?{...x,id:null!==(i=x.id)&&void 0!==i?i:"",retailerName:b.name,retailerAddress:b.address,retailerAddressFormatted:b.addressFormatted,variant:f.variant,image:c.image}:null}};this.store.set("productsList.userProducts",w),this.notifyListeners()},this.selectSize=async(t,e)=>{var n;const i=this.getStoreState(),o=i.products.find(e=>(e.salsifyGrouping||e.id)===t);if(!o)return;const r=Object.values(o.sizes).find(t=>t.id===e);if(!r)return;const{fulfillment:s,fulfillmentType:a}=this.getFulfillmentForSize(r,i.userProducts[t].selectedFulfillmentType),c={...i.userProducts,[t]:{...i.userProducts[t],selectedSizeId:e,...a?{selectedFulfillmentType:a}:{},...s?{selectedFulfillment:s?{...s,image:null!==(n=s.image)&&void 0!==n?n:null}:null}:{}}};this.store.set("productsList.userProducts",c),this.notifyListeners()},this.updateQuantity=(t,e)=>{const n=this.getStoreState(),i={...n.userProducts,[t]:{...n.userProducts[t],selectedQuantity:e}};this.store.set("productsList.userProducts",i),this.notifyListeners()},this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}subscribe(t){this.listeners.add(t);const e=this.getStoreState();try{t(e)}catch(n){this.logger.error("Error in initial state listener call:",n)}return()=>{this.listeners.delete(t)}}getStoreState(){return this.store.get("productsList")}updateSearchTerm(t){this.store.set("productsList.searchTerm",t),this.notifyListeners()}setLoading(t){this.store.set("productsList.loading",t),this.notifyListeners()}notifyListeners(){const t=this.getStoreState();this.listeners.forEach(e=>{try{e(t)}catch(n){this.logger.error("Error in state listener:",n)}})}initializeProductFulfillment(t){const e=Object.values(t.sizes)[0];if(!e)return{sizeId:"",fulfillmentType:null,fulfillment:null};const n=e.id,i=Object.values(e.shippingFulfillments)[0];if(i)return{sizeId:n,fulfillmentType:"shipping",fulfillment:{...i,image:Object.values(t.sizes)[0].image}};const o=Object.values(e.onDemandFulfillments)[0];return o?{sizeId:n,fulfillmentType:"onDemand",fulfillment:{...o,image:t.sizes[0].image}}:{sizeId:n,fulfillmentType:null,fulfillment:null}}transformProductVariantsToFulfillments(t,e){return t.map(t=>this.transformSingleProduct(t,e))}transformSingleProduct(t,e){const n={...t,sizes:{}};if(!t.sizes||0===Object.values(t.sizes).length)return n;for(const[i,o]of Object.entries(t.sizes))n.sizes[i]=this.transformProductSize(o,e);return n}transformProductSize(t,e){const{shippingVariants:n,onDemandVariants:i,...o}=t,r={...o,shippingFulfillments:{},onDemandFulfillments:{},loading:![],error:null};return this.addShippingFulfillments(r,n,e),this.addOnDemandFulfillments(r,i,e),r}addShippingFulfillments(t,e,n){if(e)for(const i of Object.values(e)){const e=n[i.retailerId];(null==e?void 0:e.shippingFulfillment)&&(t.shippingFulfillments[e.shippingFulfillment.id]={...e.shippingFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:i})}}addOnDemandFulfillments(t,e,n){if(e)for(const i of Object.values(e)){const e=n[i.retailerId];(null==e?void 0:e.onDemandFulfillment)&&(t.onDemandFulfillments[e.onDemandFulfillment.id]={...e.onDemandFulfillment,retailerName:e.name,retailerAddress:e.address,retailerAddressFormatted:e.addressFormatted,variant:i})}}async loadInitialProducts(t,e,n,i,o){try{this.setLoading(!![]);const r=this.buildSearchParams(t,e,n,i,o),s=await this.getProductList(r),a=this.transformProductVariantsToFulfillments(s.products||[],s.retailers||{}),c={};a&&a.length>0&&a.forEach(t=>{var e;const n=t.salsifyGrouping||t.id||"",i=this.initializeProductFulfillment(t);c[n]={selectedSizeId:i.sizeId,selectedQuantity:1,selectedFulfillmentType:i.fulfillmentType||"shipping",selectedFulfillment:i.fulfillment?{...i.fulfillment,image:null!==(e=i.fulfillment.image)&&void 0!==e?e:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":a,"productsList.retailers":s.retailers,"productsList.filters":s.navigation.filters,"productsList.pagination":this.updatePagination(s.navigation),"productsList.loading":![],"productsList.userProducts":c}),this.notifyListeners()}catch(r){throw this.logger.error("Error loading initial products:",r),this.store.batch({"productsList.products":[],"productsList.retailers":{},"productsList.filters":[],"productsList.pagination":{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]},"productsList.loading":![],"productsList.userProducts":{}}),this.notifyListeners(),r}}async loadMoreProducts(t,e,n,i){try{const o=this.getStoreState(),r=o.pagination;if(!r.hasMorePages)return;this.setLoading(!![]);const s=r.currentPage+1,a=this.buildSearchParams(s,t,e,n,i),c=await this.getProductList(a);if(c.products&&c.products.length>0){const t=o.products,e=o.retailers,n=o.userProducts,i=this.mergeRetailers(e,c.retailers||{}),r=this.transformProductVariantsToFulfillments(c.products,c.retailers||{}),s={...n};r.forEach(t=>{var e;const n=t.salsifyGrouping||t.id||"",i=this.initializeProductFulfillment(t);s[n]={selectedSizeId:i.sizeId,selectedQuantity:1,selectedFulfillmentType:i.fulfillmentType||"shipping",selectedFulfillment:i.fulfillment?{...i.fulfillment,image:null!==(e=i.fulfillment.image)&&void 0!==e?e:null}:null,modal:{isOpen:![],contentConfig:null}}}),this.store.batch({"productsList.products":[...t,...r],"productsList.retailers":i,"productsList.filters":c.navigation.filters,"productsList.pagination":this.updatePagination(c.navigation),"productsList.loading":![],"productsList.userProducts":s}),this.notifyListeners()}else this.store.batch({"productsList.pagination":{...r,hasMorePages:![]},"productsList.loading":![]}),this.notifyListeners()}catch(o){throw this.logger.error("Error loading more products:",o),this.setLoading(![]),o}}async getProductList(t){t.location=this.getLocation();const e=await this.api.catalogSearch(t);return e.products&&e.products.length>0&&this.trackViewItemList(e.products),e}syncFiltersFromComponent(t){const e={};for(const[n,i]of Object.entries(t))null!=i&&(Array.isArray(i)?e[n]=i:e[n]="object"==typeof i?[JSON.stringify(i)]:[String(i)]);this.store.set("productsList.appliedFilters",e),this.notifyListeners()}getSanitizedFilters(t,e){return e&&0!==e.length?t.filter(t=>{const n=this.FILTER_TYPE_MAP[t.type];return n&&e.includes(n)}):[]}buildSearchParams(t,e,n,i,o){const r={page:t,perPage:e,filters:this.buildFilters(i,o)};return n&&n.trim().length>0&&(r.search=n.trim()),r}buildFilters(t,e){const n=[];return this.addToggleFilters(n,t,e),this.addPriceFilter(n,t,e),this.addDynamicFilters(n,t,e),n}addToggleFilters(t,e,n){this.addEngravingFilter(t,e,n),this.addPresaleFilter(t,e,n),this.addFulfillmentFilter(t,e,n)}getBooleanFilterValue(t){return"boolean"==typeof t?t:Array.isArray(t)&&t.length>0?"true"===t[0]:"string"==typeof t?"true"===t:![]}addEngravingFilter(t,e,n){if(n.includes(m.ENGRAVING)){const n=this.getBooleanFilterValue(e[xt.ENGRAVING]);t.push({key:xt.ENGRAVING,values:[n?Ct.YES:Ct.NO]})}}addPresaleFilter(t,e,n){if(n.includes(m.PRESALE)){const n=this.getBooleanFilterValue(e[xt.PRESALE]);t.push({key:xt.PRESALE,values:[n?Ct.YES:Ct.NO]})}}addFulfillmentFilter(t,e,n){if(n.includes(m.FULFILLMENT)){const n=e[xt.FULFILLMENT],i=Array.isArray(n)?n[0]:n||wt.ALL,o=i===wt.ALL?[wt.ON_DEMAND,wt.SHIPPING]:[i];t.push({key:xt.FULFILLMENT,values:o})}}addPriceFilter(t,e,n){var i,o,r,s;n.includes(m.PRICE)&&t.push({key:xt.PRICE,values:{min:null!==(o=null===(i=e.price)||void 0===i?void 0:i.min)&&void 0!==o?o:kt.MIN,max:null!==(s=null===(r=e.price)||void 0===r?void 0:r.max)&&void 0!==s?s:kt.MAX}})}addDynamicFilters(t,e,n){const i=[xt.PRICE,xt.ENGRAVING,xt.PRESALE,xt.FULFILLMENT],o=Object.keys(e).filter(t=>!i.includes(t)),r=new Set;for(const a of o)t.push({key:a,values:e[a]}),r.add(a);const s=this.getFilterKeyToTypeMap();for(const a of n){const e=s[a];!e||r.has(e)||i.includes(e)||t.push({key:e,values:[]})}}setGridConfig(t,e){this.store.set("productsList.gridConfig",{rows:t,columns:e})}getItemsPerPage(){const t=this.getStoreState(),e=t.gridConfig;return e?e.rows*e.columns:16}updatePagination(t){var e,n,i,o,r;return t?{currentPage:null!==(e=t.currentPage)&&void 0!==e?e:0,totalPages:null!==(n=t.totalPages)&&void 0!==n?n:0,totalCount:null!==(i=t.totalCount)&&void 0!==i?i:0,hasMorePages:(null!==(o=t.currentPage)&&void 0!==o?o:0)<(null!==(r=t.totalPages)&&void 0!==r?r:1)-1}:{currentPage:0,totalPages:0,totalCount:0,hasMorePages:![]}}createInitialPagination(){return{currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]}}mergeRetailers(t,e){const n={...t};for(const[i,o]of Object.entries(e))n[i]||(n[i]=o);return n}extractProductCardData(t,e){const n=Object.values(t.sizes)[0];if(!n)return this.logger.warn("Product "+t.id+" has no sizes"),null;const i=Object.values(n.shippingFulfillments),o=Object.values(n.onDemandFulfillments),r=i[0],s=o[0],a=(null==r?void 0:r.variant)||(null==s?void 0:s.variant);if(!a)return this.logger.warn("Product "+t.id+" has no variants"),null;const c=e[a.retailerId];return c?{product:t,retailer:c}:(this.logger.warn("Retailer "+a.retailerId+" not found for product "+t.id),null)}getFilterKeyToTypeMap(){const t={};for(const[e,n]of Object.entries(this.FILTER_TYPE_MAP))t[n]=e;return t}async addToCart(t){try{this.uiCommands.openDrawer(i.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.checkoutCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.checkoutCommands.openCheckout()}catch(e){throw this.logger.error("Error adding presale product to checkout from product list",e),e}}trackViewItemList(t){if(0!==t.length)try{const e=this.getStoreState(),n=this.transformProductVariantsToFulfillments(t,e.retailers),i=n.map((t,e)=>({...this.convertProductToBaseItem(t),index:e+1}));this.googleTagManager.viewItemList(i,"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.shippingFulfillments[Object.keys(i.shippingFulfillments)[0]],r=splitCategoryPath(t.catPath);return{item_id:null==i?void 0:i.id,item_name:t.name,item_brand:t.brand,item_size:null==i?void 0:i.size,item_category:r.category,item_category2:r.category2,item_category3:r.category3,price:(null==o?void 0:o.variant.price)?centToDollar(o.variant.price):t.noAvailabilityPrice?centToDollar(t.noAvailabilityPrice):void 0,item_type:t.type,item_subtype:t.subType,item_image:(null==i?void 0:i.image)||(null===(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"}}openProductListModal(t,e,n){const i={type:e,data:n};this.store.batch({["productsList.userProducts."+t+".modal.isOpen"]:!![],["productsList.userProducts."+t+".modal.contentConfig"]:i}),this.notifyListeners()}closeProductListModal(t){this.store.batch({["productsList.userProducts."+t+".modal.isOpen"]:![],["productsList.userProducts."+t+".modal.contentConfig"]:null}),this.notifyListeners()}getFulfillmentForSize(t,e){const n=Object.values(t.shippingFulfillments||{}),i=Object.values(t.onDemandFulfillments||{}),r=n[0],s=i[0];return e===o.SHIPPING&&r?{fulfillment:{...r,image:t.image},fulfillmentType:o.SHIPPING}:e===o.ON_DEMAND&&s?{fulfillment:{...s,image:t.image},fulfillmentType:o.ON_DEMAND}:r?{fulfillment:{...r,image:t.image},fulfillmentType:o.SHIPPING}:s?{fulfillment:{...s,image:t.image},fulfillmentType:o.ON_DEMAND}:{fulfillment:null,fulfillmentType:null}}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,n=![]){var i,o,r,s,a;const c=this.store.get("cart");for(const e of Object.keys(c.items||{}))this.store.remove("cart.items."+e);for(const e of Object.keys(c.retailers||{}))this.store.remove("cart.retailers."+e);for(const e of Object.keys(c.fulfillments||{}))this.store.remove("cart.fulfillments."+e);const p={"cart.id":t.id,"cart.error":null,"cart.subtotal":t.subtotal,"cart.itemsQuantity":t.itemsQuantity,"cart.events":[],"cart.promoCode":(null===(i=t.promoCode)||void 0===i?void 0:i.code)?{...t.promoCode,error:null}:null};if((null===(o=Object.values(t.items))||void 0===o?void 0:o.length)>0)for(const e of Object.values(t.items))p["cart.items."+e.id]=e;if((null===(r=Object.values(t.retailers))||void 0===r?void 0:r.length)>0)for(const e of Object.values(t.retailers))if(p["cart.retailers."+e.id]=e,(null===(s=Object.values(e.fulfillments))||void 0===s?void 0:s.length)>0)for(const t of Object.values(e.fulfillments))p["cart.fulfillments."+t.id]=t;if((null===(a=t.events)||void 0===a?void 0:a.length)>0&&(p["cart.events"]=t.events),this.store.batch(p),n){const t=this.store.get("cart"),n=this.buildCartLoadedEventData(t);this.pubSub.publishAction(e.CART_LOADED,n)}}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.discount)&&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 n=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",n);const i=this.store.get("cart.id");this.pubSub.publishAction(e.CART_FAILED,{cartId:i,message:n}),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}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.o=Object.freeze(t),this.l=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.o[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.l.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.l)||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.l)||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.l)||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.l.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.o)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.l)||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.l)||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.o)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.l)||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.l)||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.l.tagName,i),i instanceof Error&&this.captureComponentError(i,"afterRender")}}catch(o){const t=performance.now()-n;this.logger.error("❌ Component render error in "+this.l.tagName,o),this.captureComponentError(o,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.l.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.l.tagName,r)}}}logRenderInfo(t){const e=this.l.type,n=this.l.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.l.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.l.tagName+":"+e,component:{type:this.l.type,tagName:this.l.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:n,useShadowDom:this.l.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.o}get config(){return this.themeProvider.getComponentConfig(this.l.type)}get elementConfig(){return this.l}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}}const createAddToCartButton=({isPresale:t,hasAvailability:e,state:n,disabled:i=![],borderRadius:o,hasAddress:r,onClick:s})=>{const a=document.createElement("button");return a.type="button",a.className="plc__button "+o,a.disabled=r&&(i||!e),a.textContent=t?"Pre Order":r?e?"Add to Cart":"Not Available In "+n.toUpperCase():"Buy Now",s&&a.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await s(t)}),a},createFulfillmentSection=t=>{const{shippingVariants:e,onDemandVariants:n,enableShippingFulfillment:i,enableOnDemandFulfillment:r,selectedFulfillmentType:s,selectedFulfillmentRetailerName:a,productId:c,onDeliveryOptionsClick:p}=t,m=document.createElement("div");m.className="plc__fulfillment-wrapper";const f=document.createElement("span");f.className="plc__fulfillment-text",f.textContent=s===o.SHIPPING?"Ships from: "+(a||""):"Delivered from: "+(a||""),m.appendChild(f);const g=Object.values(e),v=Object.values(n),b=(i?g.length:0)+(r?v.length:0),x=document.createElement("button");return x.className="plc__fulfillment-delivery",x.textContent="Delivery Options ("+b+")",x.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),0!==b&&await p(c)}),m.appendChild(x),m},createQuantitySelector=({initialQuantity:t,minQuantity:e,maxQuantity:n,cornerRadius:i,cardStyle:o,onChange:r})=>{let s=t;const a=document.createElement("div");a.className="plc__quantity-container";const c=document.createElement("button");c.type="button",c.className="quantity-decrease "+i+" "+o,c.textContent="-",c.setAttribute("aria-label","Decrease quantity");const p=document.createElement("span");p.className="quantity-text "+o,p.textContent=s.toString(),p.setAttribute("aria-live","polite"),p.setAttribute("aria-atomic","true");const m=document.createElement("button");m.type="button",m.className="quantity-increase "+i+" "+o,m.textContent="+",m.setAttribute("aria-label","Increase quantity");const j=t=>{const i=t>e,o=t<n;i?(c.disabled=![],c.classList.remove("disabled")):(c.disabled=!![],c.classList.add("disabled")),o?(m.disabled=![],m.classList.remove("disabled")):(m.disabled=!![],m.classList.add("disabled"))},d=t=>{s=Math.max(e,Math.min(n,t)),p.textContent=s.toString(),j(s),null==r||r(s)},P=t=>{t.preventDefault(),t.stopPropagation(),s>e&&d(s-1)},l=t=>{t.preventDefault(),t.stopPropagation(),s<n&&d(s+1)};return c.addEventListener("click",P),m.addEventListener("click",l),j(s),a.appendChild(c),a.appendChild(p),a.appendChild(m),a},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'},CheckIcon=({width:t=12,height:e=12,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="M11.8047 0.195262C12.0651 0.455612 12.0651 0.877722 11.8047 1.13807L4.4714 8.4714C4.21106 8.73175 3.78894 8.73175 3.5286 8.4714L0.195262 5.13807C-0.0650874 4.87772 -0.0650874 4.45561 0.195262 4.19526C0.455612 3.93491 0.877722 3.93491 1.13807 4.19526L4 7.05719L10.8619 0.195262C11.1223 -0.0650874 11.5444 -0.0650874 11.8047 0.195262Z" fill="#18181B"/>\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 '},createProductSizesList=({sizes:t,selectedSize:e,cornerRadius:n,onSelect:i})=>{let o=e;const r=document.createElement("div");r.className="plc__dropdown-size-wrapper "+n;const s=document.createElement("button");s.type="button",s.className="plc__dropdown-default-size-wrapper";const a=document.createElement("span");a.className="plc__dropdown-size-text",a.textContent=o.size;const c=document.createElement("span");c.className="plc__dropdown-chevron",c.innerHTML=ChevronDownIcon({className:"chevron-down-icon"}),c.style.display="none";const p=document.createElement("span");p.className="plc__dropdown-check",p.innerHTML=CheckIcon({className:"check-icon"}),s.appendChild(a),s.appendChild(c),s.appendChild(p),r.appendChild(s);const m=Object.values(t);if(m.length<=1)return s.setAttribute("aria-haspopup","false"),s.setAttribute("aria-expanded","false"),s.disabled=!![],c.style.display="none",p.style.display="flex",r;s.setAttribute("aria-haspopup","listbox"),s.setAttribute("aria-expanded","false");const f=document.createElement("div");f.className="plc__sizes-list "+n,f.setAttribute("role","listbox");const L=()=>{r.classList.remove("expanded"),s.setAttribute("aria-expanded","false"),c.style.display="none",p.style.display="flex"},openDropdown=()=>{r.classList.add("expanded"),s.setAttribute("aria-expanded","true"),c.style.display="flex",p.style.display="none"},j=()=>r.classList.contains("expanded"),d=()=>{f.innerHTML="",m.forEach(t=>{const e=document.createElement("div");e.className="plc__size-option",e.setAttribute("role","option");const n=(null==o?void 0:o.id)===t.id;e.setAttribute("aria-selected",String(n));const r=document.createElement("span");if(r.className="plc__size-option-text",r.textContent=t.size,e.appendChild(r),n){const t=document.createElement("span");t.className="plc__size-option-check",t.innerHTML=CheckIcon({width:16,height:16,className:"check-icon"}),e.appendChild(t)}e.addEventListener("click",e=>{e.stopPropagation(),o=t,a.textContent=t.size,null==i||i(t),d(),L()}),f.appendChild(e)})};d(),r.appendChild(f),s.addEventListener("click",t=>{t.stopPropagation(),j()?L():openDropdown()});const P=t=>{const e=t.target;e&&(r.contains(e)||L())};return document.addEventListener("click",P),r};class ProductListCardComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address","address.formattedAddress","productsList.userProducts"]}),this.selectedSize=null,this.DESKTOP_BREAKPOINT=1024}get hostClasses(){return["product-list-card",this.config.layout.productCard.cornerRadius,""+this.config.layout.productCard.style]}async connected(){var t;null===(t=super.connected)||void 0===t?void 0:t.call(this);const e=this.params.product.salsifyGrouping||this.params.product.id||"";this.unsubscribeFromState=this.commands.productList.subscribe(t=>{var n,i;const o=t.userProducts[e];if(!o)return;const r=o.selectedFulfillment,s=o.selectedFulfillmentType;if(o){const t=Object.values(this.params.product.sizes).find(t=>t.id===o.selectedSizeId);t&&(null===(n=this.selectedSize)||void 0===n?void 0:n.id)!==t.id&&(this.selectedSize=t)}(r||s)&&this.reRender(),(null===(i=o.modal)||void 0===i?void 0:i.isOpen)&&this.reRender()})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=void 0)}reRender(){const elements=this.template();this.innerHTML="";const t=document.createDocumentFragment();for(const e of elements)t.appendChild(e);this.appendChild(t)}getAvailabilityData(t){var e;const n=this.params.product,i=this.getStoreValue("address.address"),o={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==i?void 0:i.state)||"",isPresale:![],isPresaleActive:![]},r=t||Object.values(n.sizes)[0];if(!r)return o;const s=Object.values(r.shippingFulfillments||{}),a=s[0],c=null==a?void 0:a.variant;if(!c)return o;o.upc=r.upc;const p=r.attributes||{};return o.isPresale=(null===(e=p.presale)||void 0===e?void 0:e.isActive)===!![],o.isPresaleActive=this.isPresaleActive(p),this.params.shippingFulfillment&&c.shippingFulfillmentId===this.params.shippingFulfillment.id&&c.stock>0?(o.hasAvailability=!![],o.fulfillmentId=this.params.shippingFulfillment.id,o.partNumber=c.partNumber):this.params.onDemandFulfillment&&c.onDemandFulfillmentId===this.params.onDemandFulfillment.id&&c.stock>0&&(o.hasAvailability=!![],o.fulfillmentId=this.params.onDemandFulfillment.id,o.partNumber=c.partNumber),o}isPresaleActive(t){const e=null==t?void 0:t.presale;if(!e||!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){var e,n,i;if(!t.hasAvailability)return;const o=this.params.product.salsifyGrouping||this.params.product.id||"",r=this.getStoreValue("productsList"),s=null===(e=r.userProducts[o])||void 0===e?void 0:e.selectedFulfillment,a=(null===(n=r.userProducts[o])||void 0===n?void 0:n.selectedQuantity)||1,c=(null==s?void 0:s.id)||t.fulfillmentId,p=(null===(i=null==s?void 0:s.variant)||void 0===i?void 0:i.partNumber)||t.partNumber;t.isPresale&&t.isPresaleActive?await this.commands.productList.addPresaleToCart({fulfillmentId:c,partNumber:p,quantity:a,identifier:o}):await this.commands.productList.addToCart({fulfillmentId:c,partNumber:p,quantity:a,identifier:o}),this.commands.productList.updateQuantity(o,1)}template(){var t,e,n,i,o,r,s,a,c;const p=this.params.product,m=this.params.product.salsifyGrouping||this.params.product.id||"",f=this.getStoreValue("productsList"),g=null===(t=f.userProducts[m])||void 0===t?void 0:t.selectedSizeId,v=g?Object.values(p.sizes).find(t=>t.id===g):this.selectedSize||Object.values(p.sizes)[0];this.selectedSize=v||Object.values(p.sizes)[0];const b=null===(e=f.userProducts[m])||void 0===e?void 0:e.selectedFulfillment,x=(null===(n=f.userProducts[m])||void 0===n?void 0:n.selectedQuantity)||1,w=(null==b?void 0:b.image)||(null===(i=this.selectedSize)||void 0===i?void 0:i.image),S=p.name,E=this.selectedSize?this.selectedSize.size:null;let _=p.noAvailabilityPrice;if(null===(o=null==b?void 0:b.variant)||void 0===o?void 0:o.price)_=b.variant.price;else{const t=Object.values((null===(r=this.selectedSize)||void 0===r?void 0:r.shippingFulfillments)||{});_=null!==(a=null===(s=t[0])||void 0===s?void 0:s.variant.price)&&void 0!==a?a:p.noAvailabilityPrice}const F=_*x,I=this.getAvailabilityData(this.selectedSize),O=(null==b?void 0:b.variant.isEngravable)||![],R=p.sizes,M=null===(c=this.selectedSize)||void 0===c?void 0:c.maxQuantityPerOrder,elements=this.createVariantStandard({image:w,name:S,size:E,price:F,availability:I,hasPersonalization:O,sizes:R,maxQuantityPerOrder:M,shippingVariants:{},onDemandVariants:{}});return elements}generateProductUrl(){if(!this.params.productUrl)return null;const t=this.params.product,e=this.selectedSize||Object.values(t.sizes)[0],n=this.params.productUrl;if(n.includes("{upc}")){const t=(null==e?void 0:e.upc)||"";return t?n.replace("{upc}",t):null}if(n.includes("{grouping}")){const e=t.salsifyGrouping||"";return e?n.replace("{grouping}",e):null}return n}createVariantStandard(t){const{image:e,name:n,price:i,availability:o,hasPersonalization:r,sizes:s,maxQuantityPerOrder:a}=t,c=this.params.product.salsifyGrouping||this.params.product.id||"",p=this.generateProductUrl();return[this.createImageSection(e,n,o,p),this.createContentSection({name:n,price:i,hasPersonalization:r,sizes:s,maxQuantityPerOrder:a,availability:o,productId:c,productUrl:p})]}createImageSection(t,e,n,i){const o=document.createElement("div");o.className="plc__image-content";const r=document.createElement("div");r.className="plc__image-wrapper";const s=document.createElement("img");if(s.className="plc__image",s.src=t,s.alt=e,s.loading="lazy",r.appendChild(s),n.isPresale){const t=document.createElement("div");t.className="plc__presale-badge "+this.config.layout.productCard.cornerRadius,t.textContent="Pre-Order",r.appendChild(t)}if(o.appendChild(r),i){const t=document.createElement("a");return t.href=i,t.className="plc__image-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>this.commands.productList.trackSelectItem(this.params.product)),t.appendChild(o),t}return o}createContentSection(t){const e=this.getStoreValue("address.formattedAddress"),n=!!(e&&e.trim().length>0),i=document.createElement("div");i.className="plc__content",this.config.layout.productCard.showCollections&&n&&i.appendChild(this.createBadgesSection()),i.appendChild(this.createTitleSection(t.name,t.productUrl));const o=this.createPricePersonalizationSection(t.price,t.hasPersonalization,n);return o&&i.appendChild(o),this.config.layout.productCard.showSizeSelector&&n&&i.appendChild(this.createSizesSection(t.sizes)),this.config.layout.productCard.showFulfillment&&n&&i.appendChild(this.createFulfillmentSectionWrapper(t.productId)),i.appendChild(this.createAddToCartSection(t.availability,t.maxQuantityPerOrder,n)),i}createBadgesSection(){const t=document.createElement("div");t.className="plc__badges-wrapper";const e=document.createElement("span");e.className="plc__badge-text",e.textContent="First Bottle Free",t.appendChild(e);const n=document.createElement("span");n.textContent="•",t.appendChild(n);const i=document.createElement("span");return i.className="plc__badge-text",i.textContent="Same-Day Delivery",t.appendChild(i),t}createTitleSection(t,e){const n=document.createElement("h3");if(n.className="plc__title",n.textContent=t,e){const t=document.createElement("a");return t.href=e,t.className="plc__title-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>this.commands.productList.trackSelectItem(this.params.product)),t.appendChild(n),t}return n}createPricePersonalizationSection(t,e,n){const i=this.config.layout.productCard.showPrice,o=this.config.layout.productCard.enablePersonalization&&e;if(!i&&!o)return null;const r=document.createElement("div");if(r.className="plc__price-personalization-wrapper",i){const e=document.createElement("span");e.className="plc__price",e.textContent=formatCentToDollarText(t),r.appendChild(e)}if(o&&n){const t=document.createElement("span");t.className="plc__personalize",t.textContent="Personalize Bottle",r.appendChild(t)}return r}createSizesSection(t){return createProductSizesList({sizes:t,selectedSize:this.selectedSize||Object.values(t)[0],cornerRadius:this.config.layout.productCard.cornerRadius,onSelect:t=>{this.selectedSize=t;const e=this.params.product.salsifyGrouping||this.params.product.id||"";this.commands.productList.selectSize(e,t.id),this.reRender()}})}handleDeliveryOptionsClick(t){const e=window.innerWidth;e>=this.DESKTOP_BREAKPOINT?this.commands.ui.openModal(i.PRODUCT_LIST_RETAILERS,{productId:t,config:this.config}):this.commands.ui.openDrawer(i.PRODUCT_LIST_RETAILERS,{productId:t,config:this.config})}createFulfillmentSectionWrapper(t){var e,n;const i=this.getStoreValue("productsList"),o=this.params.product,r=this.selectedSize||Object.values(o.sizes)[0];return createFulfillmentSection({shippingVariants:(null==r?void 0:r.shippingFulfillments)||{},onDemandVariants:(null==r?void 0:r.onDemandFulfillments)||{},enableShippingFulfillment:this.config.layout.productCard.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.productCard.enableOnDemandFulfillment,selectedFulfillmentType:i.userProducts[t].selectedFulfillmentType,selectedFulfillmentRetailerName:(null===(n=null===(e=i.userProducts[t])||void 0===e?void 0:e.selectedFulfillment)||void 0===n?void 0:n.retailerName)||"",productId:t,onDeliveryOptionsClick:t=>this.handleDeliveryOptionsClick(t)})}createAddToCartSection(t,e,n){var o;const r=this.getStoreValue("productsList"),s=document.createElement("div");s.className="plc__add-to-cart-wrapper";const a=this.params.product.salsifyGrouping||this.params.product.id||"",c=(null===(o=r.userProducts[a])||void 0===o?void 0:o.selectedQuantity)||1;this.config.layout.productCard.showQuantityCounter&&n&&s.appendChild(createQuantitySelector({initialQuantity:c,minQuantity:1,maxQuantity:e,cornerRadius:this.config.layout.productCard.cornerRadius,cardStyle:this.config.layout.productCard.style,onChange:t=>this.commands.productList.updateQuantity(a,t)}));const p=createAddToCartButton({isPresale:t.isPresale,hasAvailability:t.hasAvailability,state:t.state,borderRadius:this.config.layout.productCard.cornerRadius,hasAddress:n,onClick:async()=>{n?await this.handleAddToCart(t):this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a,isIndependentComponent:!![]})}});return t.hasAvailability||this.addHostClasses("not-available"),s.appendChild(p),s}}class ModalComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.modal"]}),this.isOpen=![],this.modalElement=null,this.contentContainer=null,this.currentContentType=null,this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.modalElement&&(this.modalElement.removeEventListener("cancel",this.handleCancel.bind(this)),this.modalElement.removeEventListener("click",this.handleBackdropClick.bind(this))),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var e;const n=t.find(t=>"ui.modal"===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("Modal 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.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(i),this.updateModalContentTypeClass(e),this.open(),this.addHostAttribute("data-target",e.toString().toLowerCase())}catch(e){this.logger.error("Modal content loading failed",e),this.commands.ui.closeModal()}}open(){this.isOpen=!![],requestAnimationFrame(()=>{this.modalElement&&!this.modalElement.open&&this.modalElement.showModal()})}close(){var t;this.isOpen=![],(null===(t=this.modalElement)||void 0===t?void 0:t.open)&&this.modalElement.close(),this.cleanupCurrentContent()}cleanupCurrentContent(){this.contentContainer&&(this.contentContainer.innerHTML="")}handleCancel(t){t.preventDefault(),this.commands.ui.closeModal()}handleBackdropClick(t){t.target===this.modalElement&&this.commands.ui.closeModal()}handleKeydown(t){this.isOpen&&"Escape"===t.key&&this.commands.ui.closeModal()}updateModalContentTypeClass(t){if(!this.modalElement)return;const e=["modal"];this.isOpen&&e.push("open"),e.push(t.toString().toLowerCase()),this.modalElement.className=e.join(" ")}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.modalElement=document.createElement("dialog"),this.modalElement.classList.add("modal"),this.modalElement.addEventListener("cancel",this.handleCancel.bind(this)),this.modalElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("modal-content"),this.modalElement.appendChild(this.contentContainer),document.addEventListener("keydown",this.boundHandleKeydown),this.modalElement}}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},{}),h: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,p=null!==(i=null==s?void 0:s.shouldRetry)&&void 0!==i?i:this.defaultShouldRetry;let m;const f=Date.now();for(let v=0;v<=a;v++){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,v,a),v<a&&p(null,e)){await this.delay(c*2**v);continue}return e}catch(g){const e=Date.now()-t;if(m=g,this.logNetworkError(o,r,g,e,v,a),v<a&&p(g,void 0)){await this.delay(c*2**v);continue}throw this.enhanceError(g,o,r,Date.now()-f)}}throw this.enhanceError(m,o,r,Date.now()-f)}async logFailedResponse(t,e,n,i,o,r){const s=o<r;let a,c;try{n.h||(n.h=await n.text());try{a=JSON.parse(n.h)}catch(p){a=n.h}}catch(m){a="[Unable to read response body]"}if(e.body)try{c=JSON.parse(e.body)}catch(f){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:e.headers,requestBody:c,responseHeaders: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:n,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}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.h||(s.h=await o.text()),JSON.parse(s.h)),text:async()=>(s.h||(s.h=await o.text()),s.h)};return s}}}class AuthClientService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.authPromise=null,this.refreshPromise=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 authenticateAndGetConfigs(){var t,e,n,i,o,r,s,a,c;try{this.logger.info("Authenticating and fetching configurations in single request");const p=await this.request("/auth/authenticate",{method:"GET"},!![]);return(null===(e=null===(t=null==p?void 0:p.data)||void 0===t?void 0:t.auth)||void 0===e?void 0:e.accessToken)&&(null===(i=null===(n=null==p?void 0:p.data)||void 0===n?void 0:n.auth)||void 0===i?void 0:i.expiration)?(null===(c=null==p?void 0:p.data)||void 0===c?void 0:c.configs)?(this.accessToken=p.data.auth.accessToken,this.tokenExpiration=p.data.auth.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Successfully authenticated and retrieved configurations"),{success:!![],configs:{...p.data.configs,productList:{theme:{backgroundColor:"#FFFFFF"},layout:{productCard:{style:"card",cornerRadius:"rounded",showPrice:!![],showSizeSelector:!![],showFulfillment:!![],showQuantityCounter:!![],enablePersonalization:!![],enableShippingFulfillment:!![],enableOnDemandFulfillment:!![],showCollections:![]}}}}}):(this.logger.error("Combined auth response missing configs data",{response:null==p?void 0:p.data}),{success:![]}):(this.logger.error("Combined auth response missing required auth fields",{hasToken:!!(null===(r=null===(o=null==p?void 0:p.data)||void 0===o?void 0:o.auth)||void 0===r?void 0:r.accessToken),hasExp:!!(null===(a=null===(s=null==p?void 0:p.data)||void 0===s?void 0:s.auth)||void 0===a?void 0:a.expiration),response:null==p?void 0:p.data}),{success:![]})}catch(p){return this.logger.error("Failed to authenticate and get configs from combined endpoint",{error:p,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),{success:![]}}}async authenticate(){if(this.authPromise)return this.authPromise;this.authPromise=this.performAuthentication();try{return await this.authPromise}finally{this.authPromise=null}}async refreshToken(){if(this.refreshPromise)return this.refreshPromise;this.refreshPromise=this.performTokenRefresh();try{return await this.refreshPromise}finally{this.refreshPromise=null}}async get(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})}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.accessToken)&&(null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.expiration)?(this.accessToken=o.data.accessToken,this.tokenExpiration=o.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,!![]):(this.logger.error("Authentication response missing required fields",{hasToken:!!(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.accessToken),hasExp:!!(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.expiration),response:null==o?void 0:o.data}),![])}catch(o){return this.logger.error("Failed to obtain access token from authentication endpoint",{error:o,env:this.env,baseUrl:this.baseUrl,endpoint:"/auth"}),![]}}async performTokenRefresh(){var t,e,n,i;try{this.logger.info("Attempting to refresh access token");const o=await this.request("/auth/refresh",{method:"POST"},![],!![]);return(null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.accessToken)&&(null===(e=null==o?void 0:o.data)||void 0===e?void 0:e.expiration)?(this.accessToken=o.data.accessToken,this.tokenExpiration=o.data.expiration-AuthClientService.TOKEN_EXPIRATION_BUFFER_MS,this.logger.info("Access token refreshed successfully"),!![]):(this.logger.error("Token refresh response missing required fields",{hasToken:!!(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.accessToken),hasExp:!!(null===(i=null==o?void 0:o.data)||void 0===i?void 0:i.expiration),response:null==o?void 0:o.data}),![])}catch(o){return this.logger.warn("Failed to refresh access token, will fall back to full authentication",{error:o,status:null==o?void 0:o.status,endpoint:"/auth/refresh"}),![]}}async request(t,e,n=![],i=![]){if(!n&&!i&&(!this.accessToken||this.isTokenExpired())){let t=this.accessToken?await this.refreshToken():![];if(t||(this.logger.info("Token refresh failed or unavailable, attempting full authentication"),t=await this.authenticate()),!t)throw{status:401,message:"Authentication failed - unable to obtain valid access token",isAuthError:!![]}}const o=this.buildUrl(t),r=this.buildHeaders(e.headers,n),s=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}});return s.ok?this.handleSuccessResponse(s,t,e.method):!this.isAuthError(s)||n||i?this.handleErrorResponse(s):this.handleAuthError(s,t,e)}async handleSuccessResponse(t,e,n){try{return await t.json()}catch(i){const o=await t.text().catch(()=>"Success");return this.logger.error("Response returned 2xx status but body is not valid JSON",{path:e,method:n,status:t.status,responsePreview:o.substring(0,1e3),error:i}),{message:o}}}async handleAuthError(t,e,n){this.logger.warn("Access token rejected with "+t.status+", attempting to obtain new token and retry request",{status:t.status,path:e,method:n.method});let i=await this.refreshToken();return i||(this.logger.info("Token refresh failed after auth error, attempting full authentication"),this.clearToken(),i=await this.authenticate()),i?this.request(e,n,![],!![]):(this.logger.error("Unable to obtain new access token after receiving auth error, request cannot be retried",{status:t.status,path:e,method:n.method}),this.handleErrorResponse(t))}async handleErrorResponse(t){let e;try{e=await t.json()}catch(n){const i=await t.text().catch(()=>"HTTP error status: "+t.status);e={message:i||"Unknown error"}}throw{...e,status:t.status,message:(null==e?void 0:e.message)||"Request failed"}}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}clearToken(){this.accessToken=null,this.tokenExpiration=null}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().toString(),"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"]="true"),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}}AuthClientService.TOKEN_EXPIRATION_BUFFER_MS=6e5,AuthClientService.MAX_RETRIES=2,AuthClientService.RETRY_DELAY_MS=1e3;class BaseActionService{constructor(t){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get(t)}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.latitude&&t.coordinates.longitude)return{coordinates:t.coordinates,address:t.address}}}class ClientAddressActionService extends BaseActionService{constructor(){super("AddressAction"),this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientAddressActionService",()=>new ClientAddressActionService)}get actions(){return{setAddressByPlacesId:this.setAddressByPlacesId.bind(this),setAddressManually:this.setAddressManually.bind(this),clear:this.clear.bind(this),getDetails:this.getDetails.bind(this)}}async setAddressByPlacesId(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}}async setAddressManually(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}}async clear(){await this.command.address.clearSelectedAddress()}getDetails(){return this.command.address.getDetails()}}class ClientCartActionService extends BaseActionService{constructor(){super("CartAction"),this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.command=CommandService.getInstance(),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientCartActionService",()=>new ClientCartActionService)}get actions(){return{openCart:this.openCart.bind(this),closeCart:this.closeCart.bind(this),toggleCart:this.toggleCart.bind(this),addProduct:this.addProduct.bind(this),applyPromoCode:this.applyPromoCode.bind(this),removePromoCode:this.removePromoCode.bind(this),resetCart:this.resetCart.bind(this),getDetails:this.getDetails.bind(this)}}setupAddressUpdateListener(){const y=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+e.ADDRESS_UPDATED,y)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,e=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.addProduct(t,e)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}openCart(){this.command.ui.openDrawer(i.CART)}closeCart(){this.command.ui.closeDrawer()}toggleCart(){const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CART)}async addProduct(t,n){var r,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=o.SHIPPING),e.quantity&&"number"==typeof e.quantity||(e.quantity=1),e.fulfillmentType!==o.SHIPPING&&e.fulfillmentType!==o.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!=n?n:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(i.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;n===!![]&&this.command.ui.openDrawer(i.CART);const c=[...new Set(t.map(t=>t.identifier))],p=await this.api.getProductsData(c,a);if(!p||!p.products||0===p.products.length){this.logger.warn("No product data found for the provided identifiers");const t=this.store.get("cart.id");return this.pubSub.publishAction(e.CART_PRODUCT_ADD_FAILED,{cartId:t,identifiers:[],error:"No products provided"}),void 0}for(const e of t){let t=null;for(let o=0;o<p.products.length;o++){const n=p.products[o];let i=![];const r=Object.values(n.sizes);for(let t=0;t<r.length;t++){const o=r[t];if(o.upc===e.identifier||o.id===e.identifier||n.salsifyGrouping===e.identifier){i=!![];break}}if(i){t=n;break}}if(!t){this.logger.warn("No product found for identifier: "+e.identifier);continue}const n=Object.values(t.sizes)[0];if(!n){this.logger.warn("No sizes found for product: "+e.identifier);continue}if((null===(s=null===(r=null==n?void 0:n.attributes)||void 0===r?void 0:r.presale)||void 0===s?void 0:s.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+e.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let i=null;const a=e.fulfillmentType===o.SHIPPING?n.shippingVariants:n.onDemandVariants,c=Object.values(a);for(let e=0;e<c.length;e++)if(c[e]){i=c[e];break}if(!i){this.logger.warn("No supported variant found for product: "+e.identifier+" with fulfillment type: "+e.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const m=e.fulfillmentType===o.ON_DEMAND?i.onDemandFulfillmentId:i.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:m,partNumber:i.partNumber,quantity:e.quantity,identifier:e.identifier})}this.clearPendingCartOperation();const m=this.store.get("cart.id");this.pubSub.publishAction(e.CART_PRODUCT_ADD_SUCCESS,{cartId:m,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 n=this.store.get("cart.id");throw this.pubSub.publishAction(e.CART_PRODUCT_ADD_FAILED,{cartId:n,identifiers:t.map(t=>t.identifier),error:a.message||"Failed to add products to cart"}),a}}async applyPromoCode(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 n=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===n)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(n);const s=this.command.cart.getDetails();this.pubSub.publishAction(e.CART_PROMO_CODE_APPLIED,{cartId:s.cartId,discount:s.promoCodeDiscount||0,newSubtotal:s.subtotal}),this.logger.info("Promo code applied successfully")}catch(n){this.logger.error("Failed to apply promo code:",n);const t=this.store.get("cart.id");throw this.pubSub.publishAction(e.CART_PROMO_CODE_FAILED,{cartId:t,error:"Promo code could not be applied"}),n}}async removePromoCode(){try{const t=this.themeProvider.getConfigs("global"),n=t.layout.allowPromoCodes;if(!n)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const i=this.command.cart.getDetails();this.pubSub.publishAction(e.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}}async resetCart(){await this.command.cart.resetCart(),this.pubSub.publishAction(e.CART_RESET,!![])}getDetails(){return this.command.cart.getDetails()}}const Et="lce-checkout-stripe-slot",_t={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},Pt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},Ft={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};class ClientCheckoutActionService extends BaseActionService{constructor(){super("CheckoutAction"),this.allowedCustomerFields=new Set(Object.values(_t)),this.allowedBillingFields=new Set(Object.values(Ft)),this.allowedGiftFields=new Set(Object.values(Pt)),this.cartActionsAddProduct=null,this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientCheckoutActionService",()=>new ClientCheckoutActionService)}setCartActionsAddProduct(t){this.cartActionsAddProduct=t}get actions(){return{openCheckout:this.openCheckout.bind(this),closeCheckout:this.closeCheckout.bind(this),toggleCheckout:this.toggleCheckout.bind(this),addProduct:this.addProduct.bind(this),applyPromoCode:this.applyPromoCode.bind(this),removePromoCode:this.removePromoCode.bind(this),applyGiftCard:this.applyGiftCard.bind(this),removeGiftCard:this.removeGiftCard.bind(this),toggleIsGift:this.toggleIsGift.bind(this),toggleBillingSameAsShipping:this.toggleBillingSameAsShipping.bind(this),toggleMarketingPreferences:this.toggleMarketingPreferences.bind(this),updateCustomerInfo:this.updateCustomerInfo.bind(this),updateBillingInfo:this.updateBillingInfo.bind(this),updateGiftInfo:this.updateGiftInfo.bind(this),getDetails:this.getDetails.bind(this)}}normalizeCheckoutFieldValue(t){return"string"==typeof t?t:null==t?"":String(t)}openCheckout(){this.command.ui.openDrawer(i.CHECKOUT)}closeCheckout(){this.command.ui.closeDrawer()}toggleCheckout(){const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(i.CHECKOUT)}async addProduct(t,n){var r;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;n===!![]&&this.command.ui.openDrawer(i.CHECKOUT);const s=t.map(t=>t.identifier);if(this.cartActionsAddProduct)await this.cartActionsAddProduct(t);else for(const e of t){const t=this.getLocation();if(!t)throw new SDKError("Location is required to add products to checkout",!![]);const n=await this.api.getProductsData([e.identifier],t);if(!(null===(r=null==n?void 0:n.products)||void 0===r?void 0:r[0])){this.logger.warn("No product data found for identifier: "+e.identifier);continue}const i=n.products[0],s=Object.values(i.sizes)[0];if(!s)continue;const a=e.fulfillmentType===o.SHIPPING?s.shippingVariants:s.onDemandVariants,c=Object.values(a)[0];if(!c)continue;const p=e.fulfillmentType===o.ON_DEMAND?c.onDemandFulfillmentId:c.shippingFulfillmentId;await this.command.cart.addItem({fulfillmentId:p,partNumber:c.partNumber,quantity:e.quantity,identifier:e.identifier})}await this.command.checkout.loadCheckout({});const a=this.store.get("cart.id");this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_SUCCESS,{cartId:a,itemsAdded:t.length,identifiers:s}),this.logger.info("Products added to checkout successfully:",s)}catch(s){this.logger.error("Error adding products to checkout:",s);const n=this.store.get("cart.id");throw this.pubSub.publishAction(e.CHECKOUT_PRODUCT_ADD_FAILED,{cartId:n,identifiers:t.map(t=>t.identifier),error:s.message||"Failed to add products to checkout"}),s}}async applyPromoCode(t){var n;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(e.CHECKOUT_PROMO_CODE_APPLIED,{cartId:a.cartId,discount:(null==c?void 0:c.discount)||0,newTotal:(null===(n=null==a?void 0:a.amounts)||void 0===n?void 0:n.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(e.CHECKOUT_PROMO_CODE_FAILED,{cartId:t.cartId,error:"Promo code could not be applied"}),i}}async removePromoCode(){var t;try{const n=this.themeProvider.getConfigs("global"),i=n.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const o=this.store.get("checkout");this.pubSub.publishAction(e.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(n){throw this.logger.error("Failed to remove checkout promo code:",n),n}}async applyGiftCard(t){var n;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_APPLIED,{cartId:r.cartId,newTotal:(null===(n=null==r?void 0:r.amounts)||void 0===n?void 0:n.total)||0}),this.logger.info("Gift card applied successfully")}catch(i){this.logger.error("Failed to apply gift card:",i);const t=this.store.get("checkout");throw this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be applied"}),i}}async removeGiftCard(t){var n;try{const i=this.themeProvider.getConfigs("checkout"),o=i.layout.allowGiftCards;if(!o)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t);const r=this.store.get("checkout");this.pubSub.publishAction(e.CHECKOUT_GIFT_CARD_REMOVED,{cartId:r.cartId,newTotal:(null===(n=null==r?void 0:r.amounts)||void 0===n?void 0:n.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(e.CHECKOUT_GIFT_CARD_FAILED,{cartId:t.cartId,error:"Gift card could not be removed"}),i}}async toggleIsGift(t){await this.command.checkout.toggleIsGift(t)}async toggleBillingSameAsShipping(t){await this.command.checkout.toggleBillingSameAsShipping(t)}async toggleMarketingPreferences(t,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===_t.addressTwo?e["checkout.shippingAddress.address.two"]=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===Pt.addressTwo?e["checkout.shippingAddress.address.two"]=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(){return this.command.checkout.getDetails()}}class ClientProductActionService extends BaseActionService{constructor(){super("ProductAction"),this.command=CommandService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ClientProductActionService",()=>new ClientProductActionService)}get actions(){return{getDetails:this.getDetails.bind(this)}}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.',!![])}}}class ClientActionService{constructor(){this.productActionService=ClientProductActionService.getInstance(),this.addressActionService=ClientAddressActionService.getInstance(),this.cartActionService=ClientCartActionService.getInstance(),this.checkoutActionService=ClientCheckoutActionService.getInstance(),this.checkoutActionService.setCartActionsAddProduct(this.cartActionService.actions.addProduct)}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}get actions(){return{product:this.productActionService.actions,address:this.addressActionService.actions,cart:this.cartActionService.actions,checkout:this.checkoutActionService.actions}}}const It="\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",Dt="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.u)return;const n=t.debug.bind(t),i=t.info.bind(t),o=t.warn.bind(t),r=t.error.bind(t),C=(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(C("debug",t,e))},t.info=(t,e)=>{i(t,e),this.addLogEntry(C("info",t,e))},t.warn=(t,e)=>{o(t,e),this.addLogEntry(C("warn",t,e))},t.error=(t,e)=>{r(t,e),this.addLogEntry(C("error",t,e))},t.u=!![]}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(Dt);t&&t.remove(),this.panelElement=document.createElement(Dt);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=It,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",A),document.addEventListener("mouseup",z),t.preventDefault()});const A=t=>{if(!e||!this.panelElement)return;const s=t.clientX-n,a=t.clientY-i,c=window.innerWidth<=768,p=window.innerWidth<=480;let m,f,g,v;p?(m=280,f=window.innerWidth-20,g=200,v=.4*window.innerHeight):c?(m=300,f=window.innerWidth-30,g=200,v=.4*window.innerHeight):(m=300,f=800,g=200,v=600);const b=Math.max(m,Math.min(f,o+s)),x=Math.max(g,Math.min(v,r+a));this.panelElement.style.width=b+"px",this.panelElement.style.height=x+"px"},z=()=>{e=![],document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",z)};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",A),document.addEventListener("mouseup",z),e.preventDefault()});const A=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"},z=()=>{t=![],document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",z)}}}createFloatingButton(){const t=document.createElement("div");return t.className="floating-btn",t.innerHTML="⚙️",t.title="Open Elements Debug Console",t.style.display="none",t.addEventListener("click",()=>{this.toggleVisibility()}),t}showPanelContent(){this.panelContainer&&(this.panelContainer.style.display="flex"),this.floatingButton&&(this.floatingButton.style.display="none")}hidePanelContent(){this.panelContainer&&(this.panelContainer.style.display="none"),this.floatingButton&&(this.floatingButton.style.display="flex")}createLogElement(t){const 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.m()){const e=this.v(t);if(e)return this.k(t,e)}return this.cachedFingerprint||(this.cachedFingerprint=this.C()),this.k(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.S(),browser:this._(),timezone:this.P()}}isLocalStorageWebApiAvailable(){return this.m()}k(t,e){return(t+"_"+e).toLowerCase()}m(){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.F()&&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.F()?"webview":"browser";console.warn("localStorage unavailable in "+i+": "+n)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}v(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}}C(){const t=this.getFingerprintData(),e=Object.keys(t).sort().map(e=>e+":"+t[e]).join("|");return this.I(e)}S(){try{const t=screen,e=t.colorDepth||24,n=t.pixelDepth||e,i=this.D(),o=Math.round(100*(window.devicePixelRatio||1));return e+"|"+n+"|"+i+"|"+o}catch(t){return"24|24|srgb|100"}}D(){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(bt){}return"srgb"}_(){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.T()),n.push(this.F()?"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"}}T(){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"}}F(){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![]}}P(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}I(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 AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const e=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:i.ADDRESS_DISPLAY,isIndependentComponent:!![],options:e})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,e,n,o;const r=this.getStoreValue("address"),s=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],a=null!==(e=this.params.productId)&&void 0!==e?e:"",c=null!==(n=this.params.options)&&void 0!==n?n:{},p=null!==(o=c.showLabel)&&void 0!==o?o:!![],elements=[];if(p){const t=document.createElement("span");t.textContent="Delivers to:",elements.push(t)}const m=document.createElement("button");m.type="button",m.textContent=r.formattedAddress||"Select an address";const f=r.formattedAddress?"Change delivery address, currently set to "+r.formattedAddress:"Select delivery address";return m.setAttribute("aria-label",f),m.addEventListener("click",async()=>{if(s)return this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a,isIndependentComponent:!![]}),void 0;!s&&a&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:a}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(a,i.ADDRESS_INPUT,{productId:a}))}),elements.push(m),elements}}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(bt){this.logger.error("Address edit cancellation failed",bt)}},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."}),p=[this.inputContainer,c,this.errorContainer],m=this.createElement("div",{className:"action-buttons"}),f=this.createCancelButton();m.appendChild(f);const g=this.createCheckButton();return m.appendChild(g),p.push(m),document.addEventListener("click",this.handleDocumentClick),p}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const elements=[],t=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!t){const t=ComponentFactoryService.createElement({type:i.CART_HEADER});elements.push(t)}const e=ComponentFactoryService.createElement({type:i.CART_BODY});elements.push(e);const n=ComponentFactoryService.createElement({type:i.CART_FOOTER});return elements.push(n),elements}}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:i.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"),elements=[],n=document.createElement("div");n.className="cart-footer-header";const o=document.createElement("div");o.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",o.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(e),o.appendChild(this.subtotalPrice);const r=document.createElement("p");if(r.textContent="Taxes & fees will be calculated at checkout",r.className="taxes-fees-info",n.appendChild(o),n.appendChild(r),elements.push(n),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:i.CART_PROMO_CODE});elements.push(t)}const s=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(elements.push(s),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))}),elements.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});elements.push(t)}return elements}}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||[]),o=new Set(e||[]);for(const i of n)if(!o.has(i)){const t=this.container.querySelector('[data-item-id="'+i+'"]');t&&t.remove()}for(const r of o)if(!n.has(r)){const t=ComponentFactoryService.createElement({type:i.CART_ITEM,itemId:r});t.setAttribute("data-item-id",r),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),e=this.getStoreValue("cart.fulfillments."+t+".itemIds"),n=this.container.querySelectorAll("[data-item-id]");for(const i of n)i.remove();for(const o of e){const t=ComponentFactoryService.createElement({type:i.CART_ITEM,itemId:o});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:i.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 Tt={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"},At="America/New_York";function detectUserTimezone(t){try{if(t){const e=t.toUpperCase(),n=Tt[e];return n||At}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return At}}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 o=this.config.layout.drawerHeaderText,r=this.getConfigs("global"),s=document.createElement("div");s.className="cart-header-content";const a=document.createElement("h2");a.className="cart-title",a.textContent=o,s.appendChild(a);const c=document.createElement("button");c.type="button",c.className="cart-header-close-btn",c.innerHTML=CloseIcon({width:16,height:16}),c.setAttribute("aria-label","Close cart drawer"),c.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),s.appendChild(c);const p=this.clientConfig.get("promoTicker"),m=null!==(e=null===(t=null==r?void 0:r.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[],f=null!=p?p:m,g=this.store.get("address"),v=hasActiveItems(f,null===(n=null==g?void 0:g.address)||void 0===n?void 0:n.state);if(!f.length||!v)return[s];const b=ComponentFactoryService.createElement({context:"cart",type:i.PROMO_CODE_TICKER,tickers:f});return[s,b]}}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){this.commands.ui.openDrawer(i.ENGRAVING_FORM,{identifier:t,context:"cart",lines:e.attributes.engraving.lines,maxLines:e.attributes.engraving.maxLines,maxCharsPerLine:e.attributes.engraving.maxCharsPerLine,fee:e.attributes.engraving.fee,location:e.attributes.engraving.location})}template(){var t,e;const n=this.params.itemId,o=this.getStoreValue("cart.items."+n),r=this.getConfigs("global"),s=this.getStoreValue("cart.fulfillments."+o.fulfillmentId),a=document.createElement("article");a.className="cart-item";const c=document.createElement("div");c.className="item-image";const p=document.createElement("img");p.src=o.mainImage,p.alt=o.name,c.appendChild(p);const m=document.createElement("div");m.className="item-details";const f=document.createElement("div");f.className="item-header";const g=document.createElement("h3");g.className="item-title",g.textContent=o.name;const v=document.createElement("button");v.className="item-delete",v.innerHTML=TrashIcon({}),v.setAttribute("role","button"),v.setAttribute("tabindex","0"),v.setAttribute("aria-label","Remove "+o.name+" from cart"),v.setAttribute("aria-expanded","true"),v.addEventListener("click",async()=>{await this.commands.cart.removeItem(n)}),v.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(n))}),f.appendChild(g),f.appendChild(v);const b=document.createElement("div");b.className="item-specs",b.textContent=o.size+", "+o.container;const x=document.createElement("div");x.className="item-shipping-container";const w=document.createElement("div");if(w.className="item-shipping",w.textContent=o.attributes.engraving.hasEngraving?s.engravingExpectation:s.expectation,x.appendChild(w),r.layout.enablePersonalization&&(null==o?void 0:o.attributes.engraving.isEngravable)&&(null==o?void 0:o.attributes.engraving.hasEngraving)===![]&&s.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=r.layout.personalizationText+" +"+formatCentToDollarText(o.attributes.engraving.fee,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+o.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(n,o)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(n,o))}),x.appendChild(t)}m.appendChild(f),m.appendChild(b),m.appendChild(x),a.appendChild(c),a.appendChild(m);const elements=[a],S=ComponentFactoryService.createElement({type:i.CART_ITEM_QUANTITY_PRICE,itemId:n});if((null===(e=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:i.ENGRAVING_VIEW,identifier:n,context:"cart"});elements.push(t)}return elements.push(S),elements}}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 p=(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!p||p<=0?n.maxQuantity-a:p-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 elements=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer();elements.push(t)}const t=this.createPriceContainer();return elements.push(t),elements}}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.discount!==(null==n?void 0:n.discount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")",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.discount)||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=o.some(t=>t.type===s.PROMO_CODE);this.applyButton.disabled=!e||n||Boolean(null==i?void 0:i.discount)||this.isApplying||r}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max: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 y=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",y),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),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.discount)+")";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:i.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const e=this.container.querySelectorAll("[data-fulfillment-id]");if(e.length>0){const t=e[e.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const e=this.getFulfillmentInsertionPoint();if(e){const n=this.createFulfillmentElement(t);n.setAttribute("data-fulfillment-id",t);const i=this.getFulfillmentContainer();i&&i.remove(),e.nextSibling?e.parent.insertBefore(n,e.nextSibling):e.parent.appendChild(n)}}removeFulfillmentElement(t){const e=this.getFulfillmentElementById(t);if(e){const t=e.parentElement,n=e.nextElementSibling;e.remove();const i=this.container.querySelectorAll("[data-fulfillment-id]");if(0===i.length){const e=document.createElement("div");e.id="retailer-fulfillment-container",n?t.insertBefore(e,n):t.appendChild(e)}}}handleFulfillmentsUpdate(t,e){const n=new Set(t||[]),i=new Set(e||[]);for(const o of n)i.has(o)||this.removeFulfillmentElement(o);for(const o of i)n.has(o)||this.addFulfillmentElement(o)}setupFulfillmentElements(){const t=this.getRetailerId(),e=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],n=this.container.querySelectorAll("[data-fulfillment-id]");for(const o of n)o.remove();let i=this.getFulfillmentContainer();if(!i){const t=this.container.querySelector(".retailer-body-container"),e=this.container.querySelector("#retailer-subtotal-container");i=document.createElement("div"),i.id="retailer-fulfillment-container",t&&e&&t.insertBefore(i,e)}for(const o of 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:i.CART_RETAILER_SUBTOTAL,retailerId:t});e.replaceWith(n)}}onStoreChanged(t){const e=this.getRetailerId(),n="cart.retailers."+e,i=t.find(t=>t.path===n);if(i){const t=i.oldValue,e=i.value,n=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 Q=()=>{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"),Q()}),n.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.click())}),t.checked?e.classList.add("collapsed"):e.classList.remove("collapsed"),Q()}}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 p=document.createElement("div");p.className="retailer-body-container";const m=document.createElement("div");m.id="retailer-fulfillment-container",p.appendChild(m);const f=document.createElement("div");return f.id="retailer-subtotal-container",p.appendChild(f),n.appendChild(p),n}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,e){const n=Object.values(t||{}).filter(t=>t.retailerId===e);let 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(){const t=this.store.get("checkout.presale"),e=this.getPromoTickerData(),n=this.checkForActiveTickers(e),o=document.createElement("div");o.classList.add("checkout-container"),this.params.isIndependentComponent&&o.classList.add("independent"),o.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_INFORMATION})),o.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_ORDER_SUMMARY}));const r=this.createHeaderWrapper(t,e,n);return[r,o]}getPromoTickerData(){var t,e;const n=this.getConfigs("global"),i=this.clientConfig.get("promoTicker"),o=null!==(e=null===(t=null==n?void 0:n.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==e?e:[];return null!=i?i:o}checkForActiveTickers(t){var e;const n=this.store.get("address");return hasActiveItems(t,null===(e=null==n?void 0:n.address)||void 0===e?void 0:e.state)}createHeaderWrapper(t,e,n){const o=this.params.isIndependentComponent,r=document.createElement("div");return r.classList.add("checkout-header-wrapper"),o&&r.classList.add("hosted"),r.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_HEADER,isHostedCheckout:o})),e.length>0&&n&&!t&&r.appendChild(ComponentFactoryService.createElement({context:"checkout",type:i.PROMO_CODE_TICKER,tickers:e})),t&&r.appendChild(ComponentFactoryService.createElement({type:i.CHECKOUT_PRESALE_COUNTDOWN})),r}}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"),r=Boolean(i.promoCode),s=Boolean(null===(t=i.giftCards)||void 0===t?void 0:t.length),a=this.getConfigs("global"),c=Object.values(i.fulfillments).some(t=>t.type===o.SHIPPING),p=Object.values(i.fulfillments).some(t=>t.type===o.ON_DEMAND),elements=[],m=document.createElement("div");m.classList.add("checkout-amount-line");const f=document.createElement("span");f.textContent="Subtotal ("+i.itemsQuantity+" item"+(i.itemsQuantity>1?"s":"")+")",m.appendChild(f);const g=document.createElement("span");if(g.textContent=formatCentToDollarText(i.amounts.subtotal),m.appendChild(g),elements.push(m),c){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Shipping",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.shipping),t.appendChild(n),elements.push(t)}if(p){const t=document.createElement("div");t.classList.add("checkout-amount-line");const e=document.createElement("span");e.textContent="Delivery",t.appendChild(e);const n=document.createElement("span");n.textContent=formatCentToDollarText(i.amounts.delivery),t.appendChild(n),elements.push(t)}if((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),elements.push(t)}const v=document.createElement("div");v.classList.add("checkout-amount-line");const b=document.createElement("span");b.textContent="Taxes & Fees",v.appendChild(b);const x=document.createElement("span");if(x.textContent=formatCentToDollarText(i.amounts.tax+i.amounts.service+i.amounts.platform),v.appendChild(x),elements.push(v),r){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),elements.push(t)}if(s){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),elements.push(t)}if(p){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),elements.push(t)}const w=document.createElement("div");w.classList.add("checkout-separator"),elements.push(w);const S=document.createElement("div");S.classList.add("checkout-amount-total");const E=document.createElement("span");E.textContent="Total",S.appendChild(E);const _=document.createElement("span");if(_.textContent=formatCentToDollarText(i.amounts.total),S.appendChild(_),elements.push(S),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),elements.push(t);const i=document.createElement("div");i.classList.add("checkout-presale-locked-message");const o=htmlStringToElement(InfoIcon({color:a.theme.defaultTextColor}));i.appendChild(o);const r=document.createElement("p");r.textContent="Pre-ordered items will be charged when shipped.",i.appendChild(r),elements.push(i)}return elements}}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,one:this.billingData.addressOne.value,two:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zip:this.billingData.zipCode.value};this.params.isFormValid(!t,e)}template(){const t=this.getStoreValue("checkout.paymentForm"),elements=[],e=this.billingSameAsShippingToggle();if(elements.push(e),t.billingSameAsShipping)return elements;t.data&&(t.data.firstName&&(this.billingData.firstName={isValid:!![],value:t.data.firstName}),t.data.lastName&&(this.billingData.lastName={isValid:!![],value:t.data.lastName}),t.data.email&&(this.billingData.email={isValid:!![],value:t.data.email}),t.data.phone&&(this.billingData.phone={isValid:!![],value:t.data.phone}),t.data.company&&(this.billingData.company={isValid:!![],value:t.data.company}),t.data.one&&(this.billingData.addressOne={isValid:!![],value:t.data.one}),t.data.two&&(this.billingData.addressTwo={isValid:!![],value:t.data.two}),t.data.city&&(this.billingData.city={isValid:!![],value:t.data.city}),t.data.state&&(this.billingData.state={isValid:!![],value:t.data.state}),t.data.zip&&(this.billingData.zipCode={isValid:!![],value:t.data.zip})),this.updateSaveButtonState();const o=document.createElement("div");o.classList.add("section-title-container");const r=document.createElement("h3");r.textContent="Your billing info",r.classList.add("section-title"),o.appendChild(r);const s=document.createElement("p");s.textContent="Provide the info relevant to your payment method",s.classList.add("section-subtitle"),o.appendChild(s),elements.push(o);const a=document.createElement("div");a.classList.add("section-form-container");const c=document.createElement("div");c.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});p.setAttribute("aria-label","First name input"),c.appendChild(p);const m=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});m.setAttribute("aria-label","Last name input"),c.appendChild(m),a.appendChild(c);const f=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:Ft.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});f.setAttribute("aria-label","Email input"),a.appendChild(f);const g=document.createElement("div");g.classList.add("checkout-two-col-container");const v=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:Ft.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});v.setAttribute("aria-label","Phone input"),g.appendChild(v);const b=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});b.setAttribute("aria-label","Company input"),g.appendChild(b),a.appendChild(g);const x=document.createElement("div");x.classList.add("checkout-two-col-container");const w=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});w.setAttribute("aria-label","Street address input"),x.appendChild(w);const S=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});S.setAttribute("aria-label","Apt, suite, etc. (optional) input"),x.appendChild(S),a.appendChild(x);const E=document.createElement("div");E.classList.add("checkout-three-col-container");const _=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","City input"),E.appendChild(_);const F=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.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(n.BILLING,{fieldName:Ft.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});F.setAttribute("aria-label","State input"),E.appendChild(F);const I=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:Ft.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(n.BILLING,{fieldName:Ft.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return I.setAttribute("aria-label","Zip Code input"),E.appendChild(I),a.appendChild(E),elements.push(a),elements}}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 elements=[],e=document.createElement("div");e.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Buyer Information",o.classList.add("section-title"),e.appendChild(o);const r=document.createElement("p");r.textContent="Buyer information is used to process your order and for delivery purposes.",r.classList.add("section-subtitle"),e.appendChild(r),elements.push(e);const s=document.createElement("div");s.classList.add("section-form-container");const a=document.createElement("div");a.classList.add("checkout-two-col-container");const c=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:_t.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});a.appendChild(c);const p=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:_t.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});a.appendChild(p),s.appendChild(a);const m=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:_t.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});s.appendChild(m);const f=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:_t.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});s.appendChild(f);const g=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:_t.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});s.appendChild(g);const v=ComponentFactoryService.createElement({type:i.INPUT,inputType:"birthdate",name:_t.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return s.appendChild(v),elements.push(s),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),elements.push(this.saveButton),this.updateSaveButtonState(),elements}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const elements=[],t=this.getStoreValue("checkout.customerForm.data"),e=document.createElement("div");e.classList.add("checkout-summary-form-header");const n=document.createElement("h2");n.textContent="Buyer: "+t.firstName+" "+t.lastName,e.appendChild(n);const i=document.createElement("span");if(i.textContent="Edit",i.setAttribute("aria-label","Edit Buyer Information"),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),i.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.editCustomerForm())}),e.appendChild(i),elements.push(e),t.company){const e=document.createElement("p");e.classList.add("checkout-summary-form-line"),e.textContent=t.company,elements.push(e)}const o=document.createElement("p");o.classList.add("checkout-summary-form-line"),o.textContent=t.email,elements.push(o);const r=document.createElement("p");r.classList.add("checkout-summary-form-line"),r.textContent=t.phone,elements.push(r);const s=document.createElement("p");return s.classList.add("checkout-summary-form-line"),s.textContent=formatISODateToMMDDYYYY(t.birthDate),elements.push(s),elements}}const Ot=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],zt={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(Ot.includes(n)){const t=document.createElement(n),i=zt[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,o,r,s;const elements=[],a=this.getConfigs("configurations"),c=this.getConfigs("global"),p=this.getConfigs("checkout"),m=this.config.layout.continueShoppingUrl||window.location.host,f=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===(o=null===(n=this.config.layout)||void 0===n?void 0:n.checkoutCompleted)||void 0===o?void 0:o.customLogo,e.alt=a.partnerName+" Logo",t.appendChild(e),elements.push(t)}const g=document.createElement("div");g.classList.add("checkout-completed-section-container");const v=document.createElement("div");v.classList.add("checkout-completed-title-container");const b=document.createElement("div");b.classList.add("checkout-completed-title-section");const x=document.createElement("h3");x.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!",b.appendChild(x);const w=document.createElement("p");w.textContent="Your payment has been successfully processed.",b.appendChild(w),v.appendChild(b),g.appendChild(v);const S=document.createElement("div");S.classList.add("checkout-completed-sub-section");const E=document.createElement("div");E.classList.add("checkout-completed-line");const _=document.createElement("h3");_.textContent="Order Number",E.appendChild(_);const F=document.createElement("span");F.textContent=this.params.orderNumber,E.appendChild(F),S.appendChild(E);const I=document.createElement("div");I.classList.add("checkout-completed-line");const O=document.createElement("h3");O.textContent="Order Amount",I.appendChild(O);const R=document.createElement("span");R.textContent=""+formatCentToDollarText(this.params.orderTotal),I.appendChild(R),S.appendChild(I);const M=document.createElement("div");M.classList.add("checkout-completed-line");const B=document.createElement("h3");B.textContent="Payment Method",M.appendChild(B);const q=document.createElement("span");q.textContent="** "+this.params.cardLast4,M.appendChild(q),S.appendChild(M),g.appendChild(S);const U=document.createElement("div");U.classList.add("checkout-completed-sub-section");const V=document.createElement("p");V.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<br><br>A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.":"A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.",U.appendChild(V),g.appendChild(U),elements.push(g);const K=document.createElement("div");K.classList.add("checkout-completed-section-container");const H=document.createElement("button");H.type="button";const W=document.createElement("span");W.textContent=f,H.setAttribute("tabindex","0"),H.setAttribute("role","button"),H.setAttribute("aria-label",f),H.appendChild(W);const X=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:c.theme.selectedTextColor}));H.appendChild(X),H.addEventListener("click",()=>{window.location.href=m}),H.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=m)}),K.appendChild(H),elements.push(K);const Z=document.createElement("div");Z.classList.add("checkout-completed-section-container");const J=document.createElement("div");J.classList.add("checkout-completed-help-section"),Z.appendChild(J);const $=document.createElement("p");$.textContent="Questions about your order? Contact us at ";const tt=document.createElement("a");tt.href="mailto:"+a.supportEmail,tt.textContent=a.supportEmail,$.appendChild(tt),J.appendChild($);const et=document.createElement("p"),nt=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(et.textContent="Order placed on "+nt,J.appendChild(et),elements.push(Z),p.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(p.layout.legalMessage.text);const n=document.createElement("div");n.classList.add("checkout-separator"),elements.push(t),elements.push(e),elements.push(n)}if(c.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"general"});elements.push(t)}return elements}}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"),r=this.store.get("checkout.giftRecipientForm.data"),s=this.store.get("checkout.customerForm.data"),a=this.store.get("checkout.shippingAddress"),c=e?r:s,p=this.store.get("checkout.deliveryInstructions");s.firstName&&(this.customerData.firstName={isValid:!![],value:s.firstName}),s.lastName&&(this.customerData.lastName={isValid:!![],value:s.lastName}),s.email&&(this.customerData.email={isValid:!![],value:s.email}),s.phone&&(this.customerData.phone={isValid:!![],value:s.phone}),s.company&&(this.customerData.company={isValid:!![],value:s.company}),s.birthDate&&(this.customerData.birthDate={isValid:!![],value:s.birthDate}),r.firstName&&(this.giftData.firstName={isValid:!![],value:r.firstName}),r.lastName&&(this.giftData.lastName={isValid:!![],value:r.lastName}),r.email&&(this.giftData.email={isValid:!![],value:r.email}),r.phone&&(this.giftData.phone={isValid:!![],value:r.phone}),r.message&&(this.giftData.message={isValid:!![],value:r.message}),a.address.two&&(this.customerData.addressTwo={isValid:!![],value:a.address.two},this.giftData.addressTwo={isValid:!![],value:a.address.two}),p&&(this.customerData.deliveryInstructions={isValid:!![],value:p},this.giftData.deliveryInstructions={isValid:!![],value:p});const m=this.store.get("checkout.fulfillments")||{},f=Object.values(m).some(t=>t.type===o.ON_DEMAND),elements=[],g=document.createElement("div");g.classList.add("delivery-header-container");const v=document.createElement("div");v.classList.add("delivery-header-content");const b=document.createElement("div");b.classList.add("delivery-title-container");const x=document.createElement("h3");x.textContent="Deliver to",x.classList.add("delivery-title");const w=document.createElement("p");w.textContent="Package recipient must be 21+",w.classList.add("delivery-subtitle"),b.appendChild(x),b.appendChild(w),g.appendChild(b),elements.push(g);const S=document.createElement("div");S.classList.add("section-form-container");const E=document.createElement("div");E.classList.add("checkout-two-col-container");const _=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?Pt.firstName:_t.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:c.firstName,onChange:t=>{e?(this.giftData.firstName.value=t,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.firstName}))},onValidation:t=>{e?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","First Name Input"),E.appendChild(_);const F=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?Pt.lastName:_t.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:c.lastName,onChange:t=>{e?(this.giftData.lastName.value=t,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.lastName}))},onValidation:t=>{e?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(F.setAttribute("aria-label","Last Name Input"),E.appendChild(F),S.appendChild(E),!e){const t=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:_t.company,label:"Company (optional)",autocomplete:!![],value:c.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),S.appendChild(t)}const I=ComponentFactoryService.createElement({type:i.INPUT,inputType:"email",name:e?Pt.email:_t.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:c.email,onChange:t=>{e?(this.giftData.email.value=t,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.email})):(this.customerData.email.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.email}))},onValidation:t=>{e?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});I.setAttribute("aria-label","Email Input"),S.appendChild(I);const O=ComponentFactoryService.createElement({type:i.INPUT,inputType:"tel",name:e?Pt.phone:_t.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:c.phone,onChange:t=>{e?(this.giftData.phone.value=t,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.phone}))},onValidation:t=>{e?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(O.setAttribute("aria-label","Phone Input"),S.appendChild(O),!e){const t=ComponentFactoryService.createElement({type:i.INPUT,inputType:"birthdate",name:_t.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:c.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),S.appendChild(t)}const R=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:a.formattedAddress,disabled:!![],className:"disabled-input"});R.setAttribute("aria-label","Delivery Address Input"),S.appendChild(R);const M=ComponentFactoryService.createElement({type:i.INPUT,inputType:"text",name:e?Pt.addressTwo:_t.addressTwo,label:"Apt, suite, etc. (optional)",value:a.address.two,onChange:t=>{e?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(n.CUSTOMER,{fieldName:_t.addressTwo}))},onValidation:t=>{e?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(M.setAttribute("aria-label","Address Line 2 Input"),S.appendChild(M),e){const e=document.createElement("div");e.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const i=document.createElement("label");i.textContent="Gift Message*",i.setAttribute("for",Pt.message);const o=document.createElement("textarea");o.name=Pt.message,o.id=Pt.message,o.rows=4,o.value=r.message||"",o.setAttribute("aria-label","Gift Message Textarea"),o.addEventListener("input",async t=>{const e=t.target.value;this.giftData.message.value=e,this.giftData.message.isValid=e.length>0,this.pubSub.publishForm(n.GIFT,{fieldName:Pt.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(i),e.appendChild(o),e.appendChild(s),S.appendChild(e)}if(f){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=p,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),S.appendChild(n)}elements.push(S),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.setAttribute("aria-label","Save Delivery Information"),this.saveButton.setAttribute("role","button"),this.saveButton.setAttribute("tabindex","0");const T=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",T),this.saveButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await T())}),elements.push(this.saveButton),this.updateSaveButtonState(),elements}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const elements=[],t=this.getStoreValue("checkout.isGift"),e=this.getStoreValue("checkout.customerForm.data"),n=this.getStoreValue("checkout.giftRecipientForm.data"),i=this.getStoreValue("checkout.shippingAddress"),o=this.getStoreValue("checkout.deliveryInstructions"),r=document.createElement("div");r.classList.add("checkout-summary-form-header");const s=document.createElement("h2");s.textContent=t?"Delivering to "+n.firstName+" "+n.lastName:"Delivering to "+e.firstName+" "+e.lastName,r.appendChild(s);const a=document.createElement("span");a.textContent="Edit",a.setAttribute("aria-label","Edit Delivery Information"),a.setAttribute("role","button"),a.setAttribute("tabindex","0");const C=async()=>{t?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()};if(a.addEventListener("click",C),a.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await C())}),r.appendChild(a),elements.push(r),!t&&e.company){const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent=e.company,elements.push(t)}const c=document.createElement("p");c.classList.add("checkout-summary-form-line"),c.textContent=i.formattedAddress,elements.push(c);const p=document.createElement("p");p.classList.add("checkout-summary-form-line"),p.textContent=t?n.email:e.email,elements.push(p);const m=document.createElement("p");if(m.classList.add("checkout-summary-form-line"),m.textContent=t?n.phone:e.phone,elements.push(m),!t&&e.birthDate){const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent=formatISODateToMMDDYYYY(e.birthDate),elements.push(t)}if(t){const t=document.createElement("div");t.classList.add("checkout-summary-form-line-container");const e=document.createElement("span");e.classList.add("checkout-summary-form-line-container-label"),e.textContent="Gift Message:",t.appendChild(e);const i=document.createElement("span");i.classList.add("checkout-summary-form-line"),i.textContent=n.message||"No message provided.",t.appendChild(i),elements.push(t)}if(o){const t=document.createElement("div");t.classList.add("checkout-summary-form-line-container");const e=document.createElement("span");e.classList.add("checkout-summary-form-line-container-label"),e.textContent="Delivery Instructions:",t.appendChild(e);const n=document.createElement("span");n.classList.add("checkout-summary-form-line"),n.textContent=o||"No instructions provided.",t.appendChild(n),elements.push(t)}return elements}}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:i.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 y=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",y),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const elements=[];return elements.push(this.createGiftCardInput()),elements.push(this.createApplyButton()),elements}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){var t,e;const n=this.store.get("checkout.presale"),o=this.getConfigs("checkout"),r=null!==(e=null===(t=this.params)||void 0===t?void 0:t.isHostedCheckout)&&void 0!==e?e:![];let s=null;if(!n){s=document.createElement("button"),s.type="button",s.classList.add("checkout-header-button"),s.setAttribute("aria-label",r?"Back":"Back to Cart"),s.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back Button Is Disabled In Builder Mode"),void 0;if(r){const t=null==o?void 0:o.layout.continueShoppingUrl;t&&(window.location.href=t)}else this.commands.ui.openDrawer(i.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),s.appendChild(t)}const a=document.createElement("h1");if(a.textContent=(null==o?void 0:o.layout.drawerHeaderText)||"Checkout",a.classList.add("checkout-header-title"),a.setAttribute("aria-label","Checkout Page"),r){const t=document.createElement("div");return t.classList.add("checkout-header-spacer"),s?[s,a,t]:[a,t]}const c=document.createElement("button");return c.innerHTML=CloseIcon({width:16,height:16}),c.classList.add("checkout-header-button-close"),c.setAttribute("aria-label","Close Checkout"),c.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),s?[s,a,c]:[a,c]}}class CheckoutInformationComponent extends BaseComponent{get hostClasses(){return["checkout-information-section"]}constructor(){super({watchOnlyStorePaths:["checkout.isGift","checkout.customerForm.isEditing","checkout.giftRecipientForm.isEditing","checkout.paymentForm.isEditing"]})}onStoreWatch(){const t=this.getStoreValue("checkout.isGift"),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 elements=[],t=this.getStoreValue("checkout.isGift"),e=this.getStoreValue("checkout.customerForm"),n=this.getStoreValue("checkout.giftRecipientForm"),o=this.getStoreValue("checkout.paymentForm"),r=ComponentFactoryService.createElement({type:i.CHECKOUT_SEND_AS_GIFT});return elements.push(r),this.deliveryToForm=ComponentFactoryService.createElement({type:i.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=t?n.isEditing?"block":"none":e.isEditing?"block":"none",elements.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=t?n.isEditing?"none":"block":e.isEditing?"none":"block",elements.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:i.CHECKOUT_BUYER}),this.buyerForm.style.display=t&&e.isEditing?"block":"none",elements.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=t&&!e.isEditing?"block":"none",elements.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:i.CHECKOUT_PAYMENT}),this.paymentForm.style.display=o.isEditing?"block":"none",elements.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:i.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=o.isEditing?"none":"block",elements.push(this.paymentSummary),elements}}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)||[],p=(null===(o=null===(i=null==r?void 0:r.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[],m=JSON.stringify(c)!==JSON.stringify(p);(a||m)&&this.updateEngravingElement(r)}return![]}updateEngravingElement(t){var e,n;const o=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)===!![]&&o.layout.enablePersonalization){const e=ComponentFactoryService.createElement({type:i.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),o=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(o&&o.remove(),t.hasUnmetMinimumPurchaseAmount){const e=ComponentFactoryService.createElement({type:i.PURCHASE_MIN_ALERT,message:"+"+formatCentToDollarText(t.minimumPurchaseAmount-t.subtotal)+" needed for order minimum",messageType:"warning",currentTotal:t.subtotal,config:{showIcon:!![],alertType:"minimal"}});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 o=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=this.getStoreValue("checkout.fulfillments."+r.fulfillmentId),p=this.getStoreValue("checkout.retailers."+r.retailerId),m=document.createElement("div");m.classList.add("checkout-item-card-header");const f=document.createElement("div");f.classList.add("checkout-item-image");const g=document.createElement("img");g.src=r.mainImage,g.alt=r.name,g.loading="lazy",f.appendChild(g),m.appendChild(f);const v=document.createElement("div");v.classList.add("checkout-item-details-container");const b=document.createElement("h4");b.classList.add("checkout-item-title"),b.textContent=r.name,v.appendChild(b);const x=document.createElement("div");x.classList.add("checkout-item-subtitle");const w=document.createElement("span");w.textContent=s.isActive?a+",":(r.attributes.engraving.hasEngraving?null==c?void 0:c.engravingExpectation:null==c?void 0:c.expectation)+",",x.appendChild(w);const S=document.createElement("span");S.textContent="From "+((null==p?void 0:p.name)||"Retailer"),x.appendChild(S),v.appendChild(x),m.appendChild(v),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)}}),m.appendChild(this.trashButton);const E=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM_QUANTITY,itemId:r.cartItemId}),_=[];if(_.push(m),o.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:i.ENGRAVING_VIEW,identifier:r.cartItemId,context:"checkout"});_.push(t)}return _.push(E),_}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")||{},p=Object.values(c).filter(t=>t.partNumber===r&&t.fulfillmentId===s),m=p.reduce((t,e)=>t+e.quantity,0);return a-m}calculateQuantityLimits(){var t;const e=this.getStoreValue("checkout.items."+this.params.itemId);if(!e)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const n=this.getStoreValue("checkout"),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"]}),this.togglerElement=null,this.togglerButton=null,this.togglerLabel=null,this.itemsList=null}createItemElement(t){return ComponentFactoryService.createElement({type:i.CHECKOUT_ITEM,itemId:t})}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},e=new Map;for(const n of Object.values(t))n&&n.cartItemId&&e.set(n.cartItemId,n);return e}syncItemsWithStore(){if(!this.itemsList)return;const t=this.getCurrentItemsMap(),e=this.itemsList.querySelectorAll("[data-item-id]"),n=new Set;for(const i of e){const t=i.getAttribute("data-item-id");t&&n.add(t)}for(const i of e){const e=i.getAttribute("data-item-id");e&&!t.has(e)&&i.remove()}for(const[i]of t)if(!n.has(i)){const t=this.createItemElement(i);t.setAttribute("data-item-id",i),this.itemsList.appendChild(t)}if(this.togglerLabel){const t=this.getStoreValue("checkout.itemsQuantity");this.togglerLabel.textContent=t+" item"+(t>1?"s":"")}}onStoreChanged(t){let e=null;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(){if(!this.togglerButton||!this.itemsList)return;const t=this.itemsList.classList.contains("show");this.itemsList.classList.toggle("show"),this.togglerButton.classList.toggle("expanded"),t?(this.togglerButton.setAttribute("aria-expanded","false"),this.togglerButton.setAttribute("aria-label","Expand checkout items")):(this.togglerButton.setAttribute("aria-expanded","true"),this.togglerButton.setAttribute("aria-label","Collapse checkout items"))}setupToggler(){if(!this.togglerElement||!this.togglerButton||!this.itemsList)return;const t=this.itemsList.classList.contains("show");this.togglerButton.setAttribute("tabindex","0"),this.togglerButton.setAttribute("aria-expanded",t?"true":"false"),this.togglerButton.setAttribute("aria-label",t?"Collapse checkout items":"Expand checkout items"),this.togglerElement.addEventListener("click",()=>this.handleToggle()),this.togglerElement.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.itemsQuantity"),e=this.getStoreValue("checkout.items");this.togglerElement=document.createElement("div"),this.togglerElement.classList.add("checkout-items-toggler"),this.togglerLabel=document.createElement("span"),this.togglerLabel.classList.add("checkout-items-toggler-label"),this.togglerLabel.textContent=t+" item"+(t>1?"s":""),this.togglerElement.appendChild(this.togglerLabel),this.togglerButton=document.createElement("button"),this.togglerButton.type="button",this.togglerButton.classList.add("checkout-items-toggler-button"),this.togglerButton.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),this.togglerElement.appendChild(this.togglerButton),this.itemsList=document.createElement("div"),this.itemsList.classList.add("checkout-items-list","show");for(const n of Object.values(e)){const t=this.createItemElement(n.cartItemId);t.setAttribute("data-item-id",n.cartItemId),this.itemsList.appendChild(t)}return[this.togglerElement,this.itemsList]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const 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.fulfillments")||{};return Object.values(t).some(t=>t.type===o.ON_DEMAND)}template(){var t;const elements=[],e=this.getConfigs("global"),n=this.getConfigs("checkout"),o=this.getConfigs("global"),r=n.layout.allowGiftCards,s=null===(t=null==o?void 0:o.layout)||void 0===t?void 0:t.allowPromoCodes,a=document.createElement("div");a.classList.add("section-title-container");const c=document.createElement("h3");c.textContent="Order Summary",c.classList.add("section-title"),a.appendChild(c),elements.push(a);const p=ComponentFactoryService.createElement({type:i.CHECKOUT_ITEMS});elements.push(p);const m=document.createElement("div");m.classList.add("checkout-separator");const f=document.createElement("div");if(f.classList.add("checkout-separator"),elements.push(m),r||s){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_PC_GC});elements.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:i.CHECKOUT_TIPS});elements.push(t),elements.push(f)}const g=document.createElement("div");g.classList.add("section-title-container");const v=document.createElement("h3");v.textContent="100% Secure Payments",v.classList.add("disclaimer-header"),g.appendChild(v);const b=document.createElement("p");b.textContent="If a person over 21 is not available to receive this order, it will be returned for a $20 restocking fee. Valid Government ID required.",b.classList.add("disclaimer-description"),g.appendChild(b),elements.push(g);const x=ComponentFactoryService.createElement({type:i.CHECKOUT_AMOUNTS});elements.push(x);const w=ComponentFactoryService.createElement({type:i.CHECKOUT_PLACE_ORDER_BUTTON});elements.push(w);const S=this.marketingOptInsContainer();if(S&&elements.push(S),n.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(n.layout.legalMessage.text),elements.push(t),elements.push(e)}const E=document.createElement("div");if(E.classList.add("checkout-separator"),elements.push(E),e.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});elements.push(t)}return elements}}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 elements=[],t=document.createElement("div");t.classList.add("section-title-container");const e=document.createElement("h3");e.textContent="Payment",e.classList.add("section-title"),t.appendChild(e);const n=document.createElement("p");if(n.textContent="All transactions are secure and encrypted.",n.classList.add("section-subtitle"),t.appendChild(n),elements.push(t),this.clientConfig.isDevelopment()&&this.clientConfig.get("paymentMethodId")){this.hardcodedPaymentElement=document.createElement("div"),this.hardcodedPaymentElement.classList.add("hardcoded-payment-notice");const t=document.createElement("p");t.innerHTML="⚠️ Development Mode<br/>Payment Method: "+this.clientConfig.get("paymentMethodId"),this.hardcodedPaymentElement.appendChild(t),elements.push(this.hardcodedPaymentElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:i.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:t=>{this.stripeFormStatus=t,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:t=>{this.savedCardInfo=t},onEditModeVisibilityChanged:t=>{this.showingStripeSummary=t,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(t,e)=>{const n={paymentSession:{confirmationTokenId:t,setupIntentId:e}};!this.isBillingSameAsShipping&&this.billingFormData&&(n.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(n)}}}),elements.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"),elements.push(this.errorMessageElement);const o=ComponentFactoryService.createElement({type:i.CHECKOUT_BILLING,isFormValid:(t,e)=>{this.billingFormData=e,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return elements.push(o),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())}),elements.push(this.saveButton),elements}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;const elements=[],p=this.getStoreValue("checkout.paymentForm"),m=document.createElement("div");m.classList.add("checkout-summary-form-header");const f=document.createElement("h2");f.textContent="Paying with "+(null!==(n=null===(e=null===(t=p.paymentMethod)||void 0===t?void 0:t.card)||void 0===e?void 0:e.brand)&&void 0!==n?n:"")+" "+(null===(o=null===(i=p.paymentMethod)||void 0===i?void 0:i.card)||void 0===o?void 0:o.last4),m.appendChild(f);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())}),m.appendChild(g),elements.push(m);const v=document.createElement("p");return v.classList.add("checkout-summary-form-line"),v.textContent="Exp. "+(null===(s=null===(r=p.paymentMethod)||void 0===r?void 0:r.card)||void 0===s?void 0:s.expMonth)+"/"+(null===(c=null===(a=p.paymentMethod)||void 0===a?void 0:a.card)||void 0===c?void 0:c.expYear),elements.push(v),elements}}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 o=document.createElement("span");o.classList.add("icon-error"),o.innerHTML=ErrorInfoIcon({});const r=document.createElement("span");r.classList.add("error-text"),n.appendChild(o),n.appendChild(r),e.appendChild(n);const s=ComponentFactoryService.createElement({type:i.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[e,s,t]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.initialDurationSeconds=null,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var 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.resetCountdownState(),![]}resetCountdownState(){this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}afterRender(){const t=this.store.get("checkout.presale");(null==t?void 0:t.expiresAt)&&this.updateExpiresAt(t.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){if(this.scrollContainer=this.findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;const t=70,e=10;this.scrollHandler=()=>{if(!this.scrollContainer)return;const n=this.scrollContainer.scrollTop;!this.isCurrentlyScrolled&&n>t?this.setScrolledState(!![]):this.isCurrentlyScrolled&&n<e&&this.setScrolledState(![])},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}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}setScrolledState(t){var e,n;this.isCurrentlyScrolled=t,t?(null===(e=this.rootElement)||void 0===e?void 0:e.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):(null===(n=this.rootElement)||void 0===n?void 0:n.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))}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);this.initialDurationSeconds=Math.min(n,CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS),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()},CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement||!this.initialDurationSeconds)return;const t=new Date,e=Math.max(0,this.expiresAt.getTime()-t.getTime()),n=e/1e3,i=this.initialDurationSeconds-n,o=Math.max(0,Math.min(100,i/this.initialDurationSeconds*100)),r=n<CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS;r!==this.isUnderOneMinute&&(this.isUnderOneMinute=r,this.updateWarningState()),this.updateTimerDisplay(e),this.updateProgressBar(o),0===e&&this.handleExpire()}updateWarningState(){if(!this.rootElement)return;const t=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==t||t.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==t||t.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}updateTimerDisplay(t){if(!this.rootElement)return;const e=this.rootElement.querySelector("[data-timer]");e&&(e.textContent=this.formatTime(t))}updateProgressBar(t){if(!this.rootElement)return;const e=this.rootElement.querySelector("[data-progress-fill]");e&&(e.style.width=t+"%")}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.showPresaleExpired())}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const e=this.createTextContainer(),n=this.createProgressBar();return t.appendChild(e),t.appendChild(n),t}createTextContainer(){const t=document.createElement("div");t.classList.add("checkout-presale-text-container");const e=this.createHeader(),n=this.createSubtitle();return t.appendChild(e),t.appendChild(n),t}createHeader(){const t=document.createElement("div");t.classList.add("checkout-presale-heading");const e=document.createElement("h2");e.textContent="LIMITED PRE-ORDER:";const n=document.createElement("div");return n.classList.add("checkout-presale-timer"),n.setAttribute("data-timer",""),n.textContent="00:00:00",t.appendChild(e),t.appendChild(n),t}createSubtitle(){const t=document.createElement("p");return t.classList.add("checkout-presale-subtitle"),t.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",t}createProgressBar(){const t=document.createElement("div");t.className="checkout-presale-progress-bar",t.setAttribute("data-progress","");const e=document.createElement("div");return e.className="checkout-presale-progress-fill",e.setAttribute("data-progress-fill",""),e.style.width="0%",t.appendChild(e),t}}CheckoutPresaleCountdownComponent.DEFAULT_PRESALE_DURATION_SECONDS=300,CheckoutPresaleCountdownComponent.ONE_MINUTE_THRESHOLD_SECONDS=60,CheckoutPresaleCountdownComponent.COUNTDOWN_UPDATE_INTERVAL_MS=10;class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}isItemsUnavailable(){var t;return"items_unavailable"===(null===(t=this.params)||void 0===t?void 0:t.reason)}isTimeExpired(){var t,e;return"time_expired"===(null===(t=this.params)||void 0===t?void 0:t.reason)||!(null===(e=this.params)||void 0===e?void 0:e.reason)}afterRender(){this.isTimeExpired()&&this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown();const t=this.commands.checkout.getReturnUrl();if(t)return window.location.assign(t),void 0;this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const elements=[],t=this.getConfigs("global"),e=document.createElement("div");e.classList.add("checkout-completed-section-container");const n=document.createElement("div");n.classList.add("checkout-completed-title-section");const o=document.createElement("div");o.classList.add("checkout-completed-title-section");const r=document.createElement("p");r.classList.add("presale-expired-title");const s=document.createElement("p"),a=document.createElement("div");a.classList.add("checkout-completed-help-section"),this.isItemsUnavailable()&&(r.textContent="Items No Longer Available",s.textContent="The presale items you were trying to purchase are no longer available.",a.textContent="These items may have sold out or are no longer part of the presale. Please check our catalog for other available products."),this.isTimeExpired()&&(r.textContent="Session Expired",s.textContent="Your reservation time has ended. The item has been released for other customers.",a.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(r),o.appendChild(s),n.appendChild(o),e.appendChild(n),e.appendChild(a),elements.push(e);const c=document.createElement("div");c.classList.add("checkout-completed-section-container");const p=document.createElement("button");p.setAttribute("aria-label","Continue shopping"),p.type="button";const m=document.createElement("span");m.textContent="Continue Shopping",p.setAttribute("tabindex","0"),p.setAttribute("role","button"),p.setAttribute("aria-label","Continue Shopping"),p.appendChild(m);const f=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:t.theme.selectedTextColor}));if(p.appendChild(f),p.addEventListener("click",()=>this.handleExit()),p.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),c.appendChild(p),elements.push(c),this.isTimeExpired()){const t=document.createElement("div");t.classList.add("checkout-completed-section-container");const e=document.createElement("p");e.classList.add("checkout-completed-auto-close-text"),e.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const n=document.createElement("span");n.classList.add("checkout-completed-auto-close-text"),n.textContent="seconds",t.appendChild(e),t.appendChild(this.autoCloseElement),t.appendChild(n),elements.push(t)}if(t.layout.showPoweredBy){const t=document.createElement("div");t.classList.add("checkout-completed-powered-by-container");const e=ComponentFactoryService.createElement({type:i.POWERED_BY,context:"checkout"});t.appendChild(e),elements.push(t)}return elements}}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.discount!==(null==n?void 0:n.discount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discount)+")")}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:i.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 y=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",y),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y())}),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.discount)||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.discount)+")";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 elements=[];return elements.push(this.createPromoInput()),elements.push(this.createApplyButton()),elements}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.L=null,this.R=null,this.M=![],this.j=![],this.N=![],this.B=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.L=this.O.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.R=this.L.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.j=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.j,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.N=![]}catch(t){throw await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to initialize payment form"}),t}}setupEventListeners(){this.addEventListener("lce:s:submit",async()=>{await this.handleSubmit()}),this.addEventListener("lce:s:refreshSession",this.handleRefreshSession.bind(this)),this.addEventListener("lce:s:reset",async()=>{await this.resetForm()})}async handleRefreshSession(t){const{stripeConfig: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.j)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.M=!![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.N&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const t=await this.createConfirmationTokenId(),e=this.q.clientSecret,n=e.split("_secret_")[0];this.N=!![],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.N=!![],await this.updateStripeFormStatus({isFormComplete:this.j,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.B||(this.B=new Promise((t,e)=>{const n=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",G),this.B=null,e(new Error("Session refresh timeout"))},1e4),G=()=>{clearTimeout(n),this.removeEventListener("lce:s:refreshSession",G),this.B=null,t()};this.addEventListener("lce:s:refreshSession",G,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.B}async refreshPaymentSession(){try{this.L&&this.L.update({clientSecret:this.q.clientSecret}),this.N=![],await this.updateStripeFormStatus({isFormComplete:this.j,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(bt){console.error("Failed to refresh payment session:",bt),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.R&&this.R.clear(),this.j=![],this.N=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(bt){console.error("Failed to reset form:",bt)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.L)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.L.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const e={elements:this.L,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.B=null,this.R&&(this.R.unmount(),this.R=null),this.L&&(null===(e=(t=this.L).destroy)||void 0===e?void 0:e.call(t),this.L=null),this.O=null,this.M=![],this.j=![],this.N=![],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=(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 elements=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",elements.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const t=document.createElement("slot");return t.setAttribute("name",Et),this.stripeFormContainer.appendChild(t),elements.push(this.stripeFormContainer),elements}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"),o=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(i.LCE_ELEMENT),r=t.hasAttribute("drawer"),s=(null==e?void 0:e.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(i.DRAWER),a="checkout"===(null==e?void 0:e.getAttribute("data-target"));if(n||o&&r&&s&&a)return this.rootComponent=t,t;e=t,t=t.parentElement||t.getRootNode().host}return null}removeExistingStripeForm(){this.stripeFormElement&&(this.stripeFormElement.remove(),this.stripeFormElement=null)}async doStripeConfig(){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:"dark"===n.layout.poweredByMode?"night":"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 o=this.findRootComponent();if(!o)return this.logger.error("Could not find root component for Stripe form"),void 0;if(null===(t=this.stripeFormElement)||void 0===t?void 0:t.isConnected)return this.logger.info("Stripe form already exists and is connected, skipping creation"),void 0;const r=o.querySelectorAll('[slot="'+Et+'"]');if(r.length>0)for(const i of r)i.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:i.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",Et),o.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.fulfillments","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillments(){const t=this.getStoreValue("checkout.fulfillments")||{};return Object.values(t).filter(t=>t.type===o.ON_DEMAND)}getRetailerNameForFulfillment(t){const e=this.getStoreValue("checkout.items")||{},n=this.getStoreValue("checkout.retailers")||{},i=Object.values(e).find(e=>e.fulfillmentId===t);if(!i)return"Retailer";const o=n[i.retailerId];return(null==o?void 0:o.name)||"Retailer"}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.getOnDemandFulfillments();if(!i.find(e=>e.id===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.getOnDemandFulfillments();if(n.find(e=>e.id===t))try{await this.commands.checkout.removeFulfillmentTip(t)}catch(i){this.logger.error("Checkout fulfillment tip removal failed",i)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const 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.getOnDemandFulfillments();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=this.getRetailerNameForFulfillment(s.id),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.id,a.name="tip-"+s.id,a.min="0",a.step="0.01",a.placeholder="0.00",a.classList.add("dollar-input"),a.value=s.amounts.tip>0?(s.amounts.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.id,n)},500)}),i.appendChild(o),i.appendChild(a),n.appendChild(i);const p=document.createElement("button");p.type="button",p.textContent="Remove",p.classList.add("checkout-tip-remove-button"),p.disabled=this.getStoreValue("checkout.updating")||![],p.addEventListener("click",()=>this.removeTipFromFulfillment(s.id)),n.appendChild(p),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.getOnDemandFulfillments();if(t&&e.length>0){const i=e.every(t=>t.amounts.tip>0);if(i)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(t)}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 elements=[],t=this.getOnDemandFulfillments();if(0===t.length)return elements;t.length>0&&this.initializeDefaultTip();const e=document.createElement("section");e.classList.add("checkout-tip-container");const n=document.createElement("h3");n.classList.add("checkout-sub-header"),n.textContent="Add a tip",e.appendChild(n);const i=document.createElement("div");i.classList.add("checkout-tip-config-container");const o=this.createTipSelectionButtons();i.appendChild(o),e.appendChild(i);const r=document.createElement("p");r.classList.add("checkout-tip-disclaimer"),r.textContent="Tips will be split proportionally between retailers.",e.appendChild(r);const s=this.createTipDistribution();return elements.push(e,s),elements}}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.applied)+")",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}inputContainer(){var t;const e=this.getConfigs("checkout"),n=this.getConfigs("global"),o=e.layout.allowGiftCards,r=null===(t=null==n?void 0:n.layout)||void 0===t?void 0:t.allowPromoCodes,s=document.createElement("div");s.classList.add("checkout-pc-gc-sub-container");const a=ComponentFactoryService.createElement({type:i.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]}),c=ComponentFactoryService.createElement({type:i.CHECKOUT_GIFT_CARDS});r&&s.appendChild(a);const p=this.getStoreValue("checkout.promoCodeError");if(p){const t=this.createErrorElement(p);t.classList.add("promo-code-error-wrapper"),s.appendChild(t)}o&&s.appendChild(c);const m=this.getStoreValue("checkout.giftCardError");if(m){const t=this.createErrorElement(m);s.appendChild(t)}return s}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 elements=[];return elements.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)}),elements.push(this.appliedGiftCardsContainer)),elements}disconnected(){this.appliedGiftCardsContainer=null}}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:e,isSelected:n,selectedSizeAttributes:i}){var r,s,a,c,p,m;const f=e===o.ON_DEMAND;let g=null;f&&t.hourStatus.openTime&&(null===(r=t.hourStatus)||void 0===r?void 0:r.closeTime)&&(g=t.hourStatus.isOpen?"Closes at "+t.hourStatus.closeTime:"Opens at "+t.hourStatus.openTime);const v=f&&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===o.SHIPPING?"Shipping":"Same-day delivery";b.setAttribute("aria-label",x+" from "+t.retailerName+", "+formatCentToDollarText(null!==(s=t.variant.price)&&void 0!==s?s:0));const w=document.createElement("div");w.className="row";const S=document.createElement("span");S.className="name",S.textContent=t.retailerName,w.appendChild(S);const E=document.createElement("span");E.className="price",E.textContent=formatCentToDollarText(null!==(a=t.variant.price)&&void 0!==a?a:0),w.appendChild(E),b.appendChild(w);const _=document.createElement("div");_.className="row";const F=document.createElement("span");F.className="expectation",F.textContent=t.hourStatus.isClosed?g:(null===(c=null==i?void 0:i.presale)||void 0===c?void 0:c.isActive)?(null===(p=null==i?void 0:i.presale)||void 0===p?void 0:p.isActive)&&(null===(m=null==i?void 0:i.presale)||void 0===m?void 0:m.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==i?void 0:i.presale.estimatedShipBy):"":null==t?void 0:t.expectation,_.appendChild(F);const I=document.createElement("span");if(I.className="fee",I.textContent=t.fee>0?formatCentToDollarText(t.fee):"Free Delivery",_.appendChild(I),b.appendChild(_),f){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:r,enableShippingFulfillment:s,enableOnDemandFulfillment:a}){const c=e.length>0,p=document.createElement("div");if(p.className="fulfillment-tabs-container",p.setAttribute("role","tablist"),p.setAttribute("aria-label","Delivery method options"),s){const e=document.createElement("div");e.className="fulfillment-tab "+(n?"selected":""),e.setAttribute("data-fulfillment-type",o.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",r),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),p.appendChild(e)}if(a){const t=document.createElement("div");t.className="fulfillment-tab "+(i?"selected":"")+" "+(c?"":"disabled"),t.setAttribute("data-fulfillment-type",o.ON_DEMAND),t.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",r),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),p.appendChild(t)}return p}class ProductAddToCartSectionComponent extends BaseComponent{get hostClasses(){return["add-to-cart-container"]}get hostAttributes(){return{role:"region","aria-live":"polite","aria-atomic":"false","aria-label":"Add to cart section"}}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const e=this.getProductId(),n=this.getStoreValue("products."+e);if(!n.selectedFulfillment||!n.selectedSizeId)return 0;const 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===o.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(),p=this.config.layout.addToCartButtonShowTotalPrice?s+" for "+formatCentToDollarText(e):s;return this.addToCartButton.setAttribute("aria-label",p),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 elements=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer(this.config.layout.quantityCounterStyle);elements.push(t)}const i=this.createAddToCartButton();return elements.push(i),elements}}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 elements=[],t=this.params.images.length>1,e=this.config.layout.showOnlyMainImage,n=document.createElement("div");if(n.className="main-image",n.title="Product main image",n.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",t&&!e){const t=document.createElement("div");t.className="carousel-dots";for(let e=0;e<this.params.images.length;e++){const n=document.createElement("button");n.type="button",n.className="carousel-dot "+(0===e?"active":""),n.setAttribute("data-index",e.toString()),t.appendChild(n)}n.appendChild(t)}if(this.mainImageElement=n,elements.push(n),!e){const t=document.createElement("div");t.className="gallery-viewport";const e=document.createElement("div");e.className="gallery-container";for(let n=0;n<this.params.images.length;n++){const t=this.params.images[n],i=document.createElement("div");i.className="gallery-image-wrapper "+(0===n?"selected":"");const o=document.createElement("img");o.src=t,o.className="gallery-image",o.alt="Product thumbnail "+(n+1),o.loading="lazy",i.appendChild(o),e.appendChild(i)}t.appendChild(e),elements.push(t)}return elements}}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),r=this.getConfigs("global");this.addPersonalizationSpan&&(i.selectedFulfillmentType===o.SHIPPING&&r.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(),o=this.getStoreValue("products."+n),r=o.sizes[o.selectedSizeId],s=this.getConfigs("global"),elements=[],a=document.createElement("div");a.className="price-personalization-container";const c=ComponentFactoryService.createElement({type:i.PRODUCT_PRICE,productId:n});if(a.appendChild(c),s.layout.enablePersonalization&&o.productHasAvailability&&(null===(t=null==o?void 0:o.selectedFulfillment)||void 0===t?void 0:t.variant.isEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent=s.layout.personalizationText,this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label",s.layout.personalizationText);const addPersonalization=async()=>{var t,e,r,s,a,c,p,m;const f=o.sizes[o.selectedSizeId];await this.commands.product.openProductDrawer(n,i.ENGRAVING_FORM,{identifier:n,context:"product",lines:[],maxLines:(null===(e=null===(t=f.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.maxLines)||1,maxCharsPerLine:(null===(s=null===(r=f.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxCharsPerLine)||16,fee:(null===(c=null===(a=f.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.fee)||0,location:null===(m=null===(p=f.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),a.appendChild(this.addPersonalizationSpan)}elements.push(a);const p=this.renderProductSizes(o.selectedSizeId,o.sizes);if(elements.push(p),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:i.ADDRESS_DISPLAY,productId:n});elements.push(t)}const m=ComponentFactoryService.createElement({type:i.PRODUCT_RETAILERS,productId:n});elements.push(m);const f=ComponentFactoryService.createElement({type:i.PRODUCT_ADD_TO_CART_SECTION,productId:n});elements.push(f);const g=null===(e=null==r?void 0:r.attributes)||void 0===e?void 0:e.presale;if((null==g?void 0:g.isActive)===!![]&&(null==g?void 0:g.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==g?void 0:g.language)||""),elements.push(t)}if(this.config.layout.showDescription&&(o.description.trim().length>0||o.htmlDescription.trim().length>0)){const t=ComponentFactoryService.createElement({type:i.PRODUCT_DESCRIPTION,productId:n});elements.push(t)}return elements}}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 p=document.createElement("div");p.classList.add("wave","sc-price"),c.appendChild(p);const m=document.createElement("div");m.classList.add("sc-sizes");const f=document.createElement("div");f.classList.add("wave","sc-size-button"),m.appendChild(f);const g=document.createElement("div");g.classList.add("wave","sc-size-button"),m.appendChild(g);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),m.appendChild(v);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),m.appendChild(b);const x=document.createElement("div");x.classList.add("wave","sc-size-button"),m.appendChild(x),c.appendChild(m);const w=document.createElement("div");w.classList.add("sc-row");const S=document.createElement("div");S.classList.add("wave","sc-price"),w.appendChild(S);const E=document.createElement("div");E.classList.add("wave","sc-personalization"),w.appendChild(E),c.appendChild(w);const _=document.createElement("div");_.classList.add("wave","sc-deliver-to"),c.appendChild(_);const F=document.createElement("div");F.classList.add("wave","sc-address"),c.appendChild(F);const I=document.createElement("div");I.classList.add("wave","sc-retailers",o),c.appendChild(I);const O=document.createElement("div");if(O.classList.add("sc-row"),i){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),O.appendChild(t)}const R=document.createElement("div");if(R.classList.add("wave","sc-add-to-cart"),O.appendChild(R),c.appendChild(O),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 M=document.createElement("div");if(M.classList.add("product-content"),M.appendChild(c),a.appendChild(M),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:i.PRODUCT_INTERACTIONS,productId:this.getProductId()});const n=document.createElement("button");return n.type="button",n.className="product-options-open-address-button",n.textContent=this.config.layout.buyNowButtonText,n.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,i.ADDRESS_INPUT,{productId:t})}),n}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}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"),elements=[],o=this.getConfigs("configurations");if(!e.productHasAvailability||!o.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),elements.push(t),elements}const r="carousel"===n.layout.fulfillmentDisplay?i.PRODUCT_RETAILERS_CAROUSEL:i.PRODUCT_RETAILERS_POPUP,s=ComponentFactoryService.createElement({type:r,productId:t});return elements.push(s),elements}}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 r,s,a,c,p,m;const f=e===o.ON_DEMAND;let g=null;f&&t.hourStatus.openTime&&(null===(r=t.hourStatus)||void 0===r?void 0:r.closeTime)&&(g=t.hourStatus.isOpen?"Closes at "+t.hourStatus.closeTime:"Opens at "+t.hourStatus.openTime);const v=f&&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===o.SHIPPING?"Shipping":"Same-day delivery";b.setAttribute("aria-label",x+" from "+t.retailerName+", "+formatCentToDollarText(null!==(s=t.variant.price)&&void 0!==s?s:0));const w=document.createElement("div");w.className="retailer-header";const S=document.createElement("h3");if(S.className="name",S.textContent=t.retailerName,w.appendChild(S),f){const e=document.createElement("h3");e.className="address",e.textContent=t.retailerAddressFormatted,w.appendChild(e)}const E=document.createElement("div");E.className="retailer-body";const _=document.createElement("span");_.className="product-price",_.textContent=formatCentToDollarText(null!==(a=t.variant.price)&&void 0!==a?a:0);const F=document.createElement("span");F.className="shipping-price",F.textContent=t.fee>0?"+ "+formatCentToDollarText(t.fee):"FREE Delivery";const I=document.createElement("span");return I.className="expectation",I.textContent=t.hourStatus.isClosed?g:(null===(c=null==i?void 0:i.presale)||void 0===c?void 0:c.isActive)?(null===(p=null==i?void 0:i.presale)||void 0===p?void 0:p.isActive)&&(null===(m=null==i?void 0:i.presale)||void 0===m?void 0:m.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(null==i?void 0:i.presale.estimatedShipBy):"":null==t?void 0:t.expectation,E.append(_,F,I),b.append(w,E),b}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,r=[];for(const o in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,o)&&r.push(n.shippingFulfillments[o]);const s=[];for(const o in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,o)&&s.push(n.onDemandFulfillments[o]);const a=e.selectedFulfillmentType===o.SHIPPING,c=e.selectedFulfillmentType===o.ON_DEMAND,p=a?r:s,m=renderFulfillmentTabsContainer({shippingFulfillments:r,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===p.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[m,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 f of p){const t=this.generateRetailerCard({fulfillment:f,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:f.id===e.selectedFulfillmentId,selectedSizeAttributes:i}),n=e.selectedFulfillmentType===o.ON_DEMAND&&f.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),[m,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),r=(null==n?void 0:n.attributes)||null,s=this.config.layout.enableShippingFulfillment,a=this.config.layout.enableOnDemandFulfillment,c=Object.values(n.shippingFulfillments),p=Object.values(n.onDemandFulfillments),m=(s?c.length:0)+(a?p.length:0),f=document.createElement("div");f.className="header";const g=document.createElement("span");g.className="header-label",g.textContent=e.selectedFulfillmentType===o.SHIPPING?"Shipping From:":"Delivering From:";const v=document.createElement("button");if(v.className="delivery-options",v.type="button",v.textContent="See Delivery Options ("+m+")",v.setAttribute("aria-label","View all "+m+" delivery options"),v.addEventListener("click",async()=>{0!==m&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(i.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,i.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),f.appendChild(g),f.appendChild(v),!e.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[f,t]}const b=document.createElement("div");b.className="popup-fulfillment-list-container";const x=renderPopupRetailerCard({fulfillment:e.selectedFulfillment,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:![],selectedSizeAttributes:r});return b.appendChild(x),[f,b]}}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 Q=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 Q(),void 0;await this.commands.product.selectFulfillment(e,n),await Q()}template(){const t=this.getProductId(),e=this.getStoreValue("products."+t),n=this.getStoreValue("products."+t+".sizes."+e.selectedSizeId),i=(null==n?void 0:n.attributes)||null,r=[];for(const o in n.shippingFulfillments)Object.prototype.hasOwnProperty.call(n.shippingFulfillments,o)&&r.push(n.shippingFulfillments[o]);const s=[];for(const o in n.onDemandFulfillments)Object.prototype.hasOwnProperty.call(n.onDemandFulfillments,o)&&s.push(n.onDemandFulfillments[o]);const a=e.selectedFulfillmentType===o.SHIPPING,c=e.selectedFulfillmentType===o.ON_DEMAND,p=a?r:s,m=document.createElement("h5");m.className="popup-retailers-section-title",m.textContent="Delivery Options";const f=renderFulfillmentTabsContainer({shippingFulfillments:r,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===p.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[m,f,t]}const g=document.createElement("div");g.className="popup-fulfillment-list-container";for(const o of p){const t=renderPopupRetailerCard({fulfillment:o,selectedFulfillmentType:e.selectedFulfillmentType,isSelected:o.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())}),g.appendChild(t)}return[m,f,g]}}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:i.PRODUCT_LOADING});if(n.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:i.PRODUCT});if(n.loading)return ComponentFactoryService.createElement({type:i.PRODUCT_LOADING});const o=n.sizes[n.selectedSizeId],r=document.createElement("div");r.classList.add("product-content-wrapper"),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:i.PRODUCT_OPTIONS,productId:e});s.appendChild(a);const c=ComponentFactoryService.createElement({type:i.PRODUCT_DRAWER,productId:e});if(s.appendChild(c),r.appendChild(s),!this.config.layout.showImages||!(null===(t=n.images)||void 0===t?void 0:t.length))return r;r.classList.add("has-images");const p=ComponentFactoryService.createElement({type:i.PRODUCT_IMAGE_CAROUSEL,images:n.images,mainImage:o.image,productId:e});return r.prepend(p),p.setAttribute("aria-label","Product images"),r}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(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.type+"-"+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.count||0,p=document.createElement("span");p.className="checkbox-filter-item-text",p.textContent=i.name;const m=document.createElement("span");return m.className="checkbox-filter-item-count",m.textContent="("+c+")",a.appendChild(p),a.appendChild(m),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.name||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.type);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.type)),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 createChip(t){const{text:e,onRemove:n}=t,i=document.createElement("div");i.className="chip";const o=document.createElement("span");o.className="chip-text",o.textContent=e,i.appendChild(o);const r=document.createElement("button");return r.className="chip-close",r.type="button",r.innerHTML=CloseIcon({width:16,height:16}),r.setAttribute("aria-label","Remove"),n&&r.addEventListener("click",t=>{t.stopPropagation(),n()}),i.appendChild(r),i}function createChipsContainer(t){const{currentFilters:e,sanitizedFilters:n,onRemoveFilter:i,onClearAllFilters:o}=t,r=document.createElement("div");r.className="product-list-filters-chips-container";const s=getActiveFilters(e,n);if(0===s.length)return r.style.display="none",r;if(r.style.display="flex",s.forEach(t=>{const e=createChip({text:t.label,onRemove:()=>i(t.key,t.value)});r.appendChild(e)}),s.length>0){const t=createClearAllButton(o);r.appendChild(t)}return r}function getActiveFilters(t,e){const n=[];return addBooleanFilters(n,t),addDeliveryFilter(n,t),addPriceFilter(n,t),addDynamicFilters(n,t,e),n}function addBooleanFilters(t,e){(null==e?void 0:e[xt.ENGRAVING])&&t.push({key:m.ENGRAVING,value:"true",label:"Engravable"}),(null==e?void 0:e[xt.PRESALE])&&t.push({key:m.PRESALE,value:"true",label:"Presale"})}function addDeliveryFilter(t,e){if(!(null==e?void 0:e.fulfillment)||(null==e?void 0:e.fulfillment)===wt.ALL)return;const n=(null==e?void 0:e.fulfillment)===wt.ON_DEMAND?"Same-day Delivery":"Shipping";t.push({key:m.FULFILLMENT,value:null==e?void 0:e.fulfillment.toString(),label:n})}function addPriceFilter(t,e){const n=null==e?void 0:e.price;if(!n)return;const i=n.min&&n.min!==kt.MIN,o=n.max&&n.max!==kt.MAX;if(!i&&!o)return;const r=i?"$"+n.min:"$0",s=o?"$"+n.max:"$"+kt.MAX+"+";t.push({key:m.PRICE,value:"price",label:r+" - "+s})}function addDynamicFilters(t,e,n){if(!e)return;const i=getDynamicFilterKeys(e);for(const o of i)addDynamicFilterChips(o,t,e,n)}function getDynamicFilterKeys(t){const e=[xt.ENGRAVING,xt.PRESALE,xt.FULFILLMENT,xt.PRICE];return Object.keys(t).filter(t=>!e.includes(t))}function addDynamicFilterChips(t,e,n,i){const o=n[t];if(!Array.isArray(o)||0===o.length)return;const r=null==i?void 0:i.find(e=>e.type===t);o.forEach(n=>{const i=null==r?void 0:r.values.find(t=>t.value.toString()===n),o=(null==i?void 0:i.name)||n;e.push({key:t,value:n,label:o})})}function createClearAllButton(t){const e=document.createElement("button");return e.className="product-list-filters-clear-all",e.textContent="CLEAR ALL FILTERS",e.type="button",e.addEventListener("click",()=>{t()}),e}function createFulfillmentFilter(t){const{currentFilters:e,deliveryCollapsed:n,isSameDayDeliveryDisabled:i,onFulfillmentOptionsChange:o,onToggleCollapse:r}=t,elements=[],s=document.createElement("div");s.className="product-list-filters-fulfillment-options";const a=[{value:wt.ALL,label:"All"},{value:wt.SHIPPING,label:"Shipping"},{value:wt.ON_DEMAND,label:"Same-Day Delivery"}],c=document.createElement("div");c.className="product-list-filters-fulfillment-options-header",c.style.cursor="pointer";const p=document.createElement("h3");p.className="product-list-filters-fulfillment-options-label",p.textContent="Fulfillment Options";const m=document.createElement("div");m.className="product-list-filters-chevron",m.innerHTML=n?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),c.appendChild(p),c.appendChild(m),s.appendChild(c);const f=document.createElement("div");f.className="product-list-filters-fulfillment-options-list",n&&f.classList.add("collapsed");for(const g of a){const t=document.createElement("div");t.className="product-list-filters-fulfillment-option";const n=document.createElement("input");n.type="radio",n.id="fulfillment-"+g.value,n.name="fulfillment-options",n.value=g.value,n.className="product-list-filters-fulfillment-radio";const r="onDemand"===g.value&&i;n.disabled=r;const s=(null==e?void 0:e.fulfillment)||wt.ALL;n.checked=g.value===s,n.addEventListener("change",t=>{const e=t.target;null==o?void 0:o(e.value)});const a=document.createElement("label");a.htmlFor="fulfillment-"+g.value,a.className="product-list-filters-fulfillment-radio-label "+(r?"disabled":""),a.textContent=g.label,t.appendChild(n),t.appendChild(a),f.appendChild(t)}return s.appendChild(f),c.addEventListener("click",()=>{r()}),elements.push(s),{elements,chevronContainer:m,fulfillmentList:f}}function createPriceFilter(t){var e,n,i,o,r,s,a,c;const{priceConfig:p,currentFilters:m,priceCollapsed:f,onPriceChange:g,onToggleCollapse:v,DEFAULT_MIN:b,DEFAULT_MAX:x}=t,elements=[],w=document.createElement("div");w.className="product-list-filters-price";const S=Number.parseInt(null!==(e=null==p?void 0:p.min)&&void 0!==e?e:b,10),E=Number.parseInt(null!==(n=null==p?void 0:p.max)&&void 0!==n?n:x,10),_=Number.parseInt(null!==(r=null!==(o=null===(i=null==m?void 0:m.price)||void 0===i?void 0:i.min)&&void 0!==o?o:null==p?void 0:p.min)&&void 0!==r?r:b,10),F=Number.parseInt(null!==(c=null!==(a=null===(s=null==m?void 0:m.price)||void 0===s?void 0:s.max)&&void 0!==a?a:null==p?void 0:p.max)&&void 0!==c?c:x,10),I=document.createElement("div");I.className="product-list-filters-price-header",I.style.cursor="pointer";const O=document.createElement("h3");O.className="product-list-filters-price-title",O.textContent="Price Range",I.appendChild(O);const R=document.createElement("div");R.className="product-list-filters-chevron",R.innerHTML=f?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}),I.appendChild(R),w.appendChild(I);const M=document.createElement("div");M.className="product-list-filters-price-slider-container",f&&M.classList.add("collapsed");const B=document.createElement("div");B.className="product-list-filters-price-range-wrapper";const q=document.createElement("div");q.className="product-list-filters-price-track";const U=document.createElement("div");U.className="product-list-filters-price-track-active",q.appendChild(U),B.appendChild(q);const V=document.createElement("input");V.type="range",V.min=S.toString(),V.max=E.toString(),V.value=_.toString(),V.step="1",V.className="product-list-filters-price-range product-list-filters-price-range-min",B.appendChild(V);const K=document.createElement("input");K.type="range",K.min=S.toString(),K.max=E.toString(),K.value=F.toString(),K.step="1",K.className="product-list-filters-price-range product-list-filters-price-range-max",B.appendChild(K),M.appendChild(B);const H=document.createElement("div");H.className="product-list-filters-price-inputs-container";const W=document.createElement("div");W.className="product-list-filters-price-input-wrapper";const X=document.createElement("span");X.className="product-list-filters-price-input-prefix",X.textContent="$";const Z=document.createElement("input");Z.type="number",Z.min=S.toString(),Z.max=E.toString(),Z.value=_.toString(),Z.className="product-list-filters-price-input",Z.placeholder=S.toString(),W.appendChild(X),W.appendChild(Z);const J=document.createElement("span");J.className="product-list-filters-price-separator",J.textContent="to";const $=document.createElement("div");$.className="product-list-filters-price-input-wrapper";const tt=document.createElement("span");tt.className="product-list-filters-price-input-prefix",tt.textContent="$";const et=document.createElement("input");et.type="number",et.min=S.toString(),et.max=E.toString(),et.value=F.toString(),et.className="product-list-filters-price-input",et.placeholder=E+"+",$.appendChild(tt),$.appendChild(et),H.appendChild(W),H.appendChild(J),H.appendChild($),M.appendChild(H),w.appendChild(M);const D=()=>{const t=Number.parseInt(V.value,10),e=Number.parseInt(K.value,10),n=E-S,i=(t-S)/n*100,o=(e-S)/n*100;U.style.left=i+"%",U.style.width=o-i+"%"},h=(t,e)=>{V.value=t.toString(),K.value=e.toString(),Z.value=t.toString(),et.value=e.toString(),D()};return V.addEventListener("input",()=>{let t=Number.parseInt(V.value,10);const e=Number.parseInt(K.value,10);t>e&&(t=e),h(t,e)}),V.addEventListener("change",()=>{const t=Number.parseInt(V.value,10),e=Number.parseInt(K.value,10);null==g?void 0:g(t.toString(),e.toString())}),K.addEventListener("input",()=>{const t=Number.parseInt(V.value,10);let e=Number.parseInt(K.value,10);e<t&&(e=t),h(t,e)}),K.addEventListener("change",()=>{const t=Number.parseInt(V.value,10),e=Number.parseInt(K.value,10);null==g?void 0:g(t.toString(),e.toString())}),Z.addEventListener("input",()=>{let t=Number.parseInt(Z.value,10)||S;const e=Number.parseInt(et.value,10)||E;t=Math.max(S,Math.min(t,E)),t>e&&(t=e),h(t,e),null==g||g(t.toString(),e.toString())}),et.addEventListener("input",()=>{const t=Number.parseInt(Z.value,10)||S;let e=Number.parseInt(et.value,10)||E;e=Math.max(S,Math.min(e,E)),e<t&&(e=t),h(t,e),null==g||g(t.toString(),e.toString())}),D(),I.addEventListener("click",()=>{v()}),elements.push(w),{elements,chevronContainer:R,sliderContainer:M}}function createEngravingFilter(t){const{currentFilters:e,isPersonalizationDisabled:n,onEngravingChange:i}=t,elements=[],o=document.createElement("div");o.className="product-list-filters-engraving";const r=document.createElement("label");r.className="product-list-filters-engraving-label",r.setAttribute("for","engraving-switch"),r.textContent="Engraved Bottles",o.appendChild(r);const s=document.createElement("div");s.classList.add("toggle-switch");const a=!!(null==e?void 0:e.engraving);a&&s.classList.add("active");const c=document.createElement("div");c.classList.add("toggle-slider"),s.id="engraving-switch",s.setAttribute("tabindex","0"),s.setAttribute("aria-label","Toggle Engraved Bottles"),s.setAttribute("role","switch"),s.setAttribute("aria-checked",a?"true":"false"),s.appendChild(c);const u=t=>{s.classList.toggle("active",t),s.setAttribute("aria-checked",t?"true":"false")},L=()=>{const t=s.classList.contains("active"),e=!t;u(e),null==i||i(e)};if(s.addEventListener("click",()=>{n||L()}),s.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),L())}),o.appendChild(s),n){const t=document.createElement("div");t.className="product-list-filters-warning",o.appendChild(t)}return elements.push(o),elements}function createPresaleFilter(t){const{currentFilters:e,isPresaleDisabled:n,onPresaleChange:i}=t,elements=[],o=document.createElement("div");o.className="product-list-filters-presale";const r=document.createElement("label");r.className="product-list-filters-presale-label",r.setAttribute("for","presale-switch"),r.textContent="Presale",o.appendChild(r);const s=document.createElement("div");s.classList.add("toggle-switch");const a=!!(null==e?void 0:e.presale);a&&s.classList.add("active"),n&&s.classList.add("disabled");const c=document.createElement("div");c.classList.add("toggle-slider"),s.id="presale-switch",s.setAttribute("tabindex",n?"-1":"0"),s.setAttribute("aria-label","Toggle Presale"),s.setAttribute("role","switch"),s.setAttribute("aria-checked",a?"true":"false"),s.setAttribute("aria-disabled",n?"true":"false"),s.appendChild(c);const u=t=>{s.classList.toggle("active",t),s.setAttribute("aria-checked",t?"true":"false")},L=()=>{const t=s.classList.contains("active"),e=!t;u(e),null==i||i(e)};if(s.addEventListener("click",()=>{n||L()}),s.addEventListener("keydown",t=>{n||"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),L())}),o.appendChild(s),n){const t=document.createElement("div");t.className="product-list-filters-warning",o.appendChild(t)}return elements.push(o),elements}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 p=document.createElement("div");p.className="slc__size-price-wrapper";const m=document.createElement("div");m.classList.add("wave","slc__price"),p.appendChild(m);const f=document.createElement("div");f.classList.add("wave","slc__size"),p.appendChild(f),r.appendChild(p);const g=document.createElement("div");return g.classList.add("wave","slc__button"),e.appendChild(n),e.appendChild(r),e.appendChild(g),e}template(){const elements=[],t=100/this.params.columns;this.container.style.setProperty("--card-width",t+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const e=this.params.rows*this.params.columns;for(let n=0;n<e;n++){const t=this.createSkeletonCard(n);elements.push(t)}return elements}}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 '};class ProductListFiltersComponent extends BaseComponent{constructor(){super({watchStorePaths:["address","address.formattedAddress","productsList.filters","productsList.appliedFilters"]}),this.DEFAULT_MIN_PRICE=kt.MIN,this.DEFAULT_MAX_PRICE=kt.MAX,this.FILTER_DEBOUNCE_DELAY_MS=500,this.DESKTOP_BREAKPOINT=1024,this.isRenderedInDrawerMode=![],this.permanentFilters={price:{min:kt.MIN,max:kt.MAX},fulfillment:wt.ALL,presale:![],engraving:![]},this.availableDynamicFilters=[],this.checkboxFilterStateMap=new Map,this.isPriceFilterCollapsed=![],this.isFulfillmentFilterCollapsed=![],this.appliedFiltersChipsContainer=null,this.resizeHandler=null,this.priceFilterDebounceTimer=null}get hostClasses(){const t=["product-list-filters-container"];return this.isRenderedInDrawerMode&&t.push("drawer-mode"),t}async connected(){var t;null===(t=super.connected)||void 0===t?void 0:t.call(this),this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.setupResizeListener(),this.setupDrawerCloseListener(),this.syncFiltersFromStore(),this.onStoreWatch()}setupDrawerCloseListener(){document.addEventListener("drawerClosed",()=>{this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.isRenderedInDrawerMode||(this.syncFiltersFromStore(),this.refreshUIStates())})}setupResizeListener(){this.resizeHandler=()=>{const t=window.innerWidth;t>=this.DESKTOP_BREAKPOINT&&(this.commands.ui.closeDrawer(),this.isRenderedInDrawerMode=this.detectIfRenderedInDrawer(),this.syncFiltersFromStore(),this.refreshUIStates())},window.addEventListener("resize",this.resizeHandler)}detectIfRenderedInDrawer(){var t,e,n;let i=this.parentElement;for(;i;){if((null===(t=i.classList)||void 0===t?void 0:t.contains("drawer"))||(null===(e=i.hasAttribute)||void 0===e?void 0:e.call(i,"data-drawer"))||"drawer-component"===(null===(n=i.tagName)||void 0===n?void 0:n.toLowerCase()))return!![];i=i.parentElement}return![]}onStoreWatch(){const{filters:t}=this.getStoreValue("productsList");t&&Array.isArray(t)&&t.length>0&&(this.availableDynamicFilters=t),this.syncFiltersFromStore(),this.refreshUIStates()}syncFiltersFromStore(){const{appliedFilters:t}=this.getStoreValue("productsList");if(t){const e={};for(const[n,i]of Object.entries(t))e[n]=this.transformFilterValue(n,i);this.permanentFilters={price:{min:kt.MIN,max:kt.MAX},fulfillment:wt.ALL,presale:![],engraving:![],...e},this.checkboxFilterStateMap.clear()}}refreshUIStates(){!this.isRenderedInDrawerMode&&this.appliedFiltersChipsContainer&&(this.appliedFiltersChipsContainer.innerHTML="",this.appliedFiltersChipsContainer.appendChild(this.buildAppliedFiltersChipsContainer())),this.engravingFiltersContainer&&(this.engravingFiltersContainer.innerHTML="",this.buildEngravingFilterElements().forEach(t=>{var e;null===(e=this.engravingFiltersContainer)||void 0===e?void 0:e.appendChild(t)})),this.presaleFilterContainer&&(this.presaleFilterContainer.innerHTML="",this.buildPresaleFilterElements().forEach(t=>{var e;null===(e=this.presaleFilterContainer)||void 0===e?void 0:e.appendChild(t)})),this.dynamicFiltersContainer&&(this.dynamicFiltersContainer.innerHTML="",this.buildDynamicFiltersElements().forEach(t=>{var e;null===(e=this.dynamicFiltersContainer)||void 0===e?void 0:e.appendChild(t)}))}transformFilterValue(t,e){if(t===xt.ENGRAVING||t===xt.PRESALE)return Array.isArray(e)?"true"===e[0]:"true"===e;if(t===xt.FULFILLMENT)return Array.isArray(e)?e[0]:e;if(t!==xt.PRICE)return e;if(Array.isArray(e)&&e[0])try{return JSON.parse(e[0])}catch(n){this.logger.error("Error fetching products with updated filters:",n)}}async fetchFilters(){const{searchTerm:t}=this.getStoreValue("productsList");try{this.store.set("productsList.loading",!![]),this.store.batch({"productsList.products":[],"productsList.retailers":{}}),this.commands.productList.syncFiltersFromComponent(this.permanentFilters),await this.commands.productList.loadInitialProducts(0,this.commands.productList.getItemsPerPage(),t,this.permanentFilters,this.params.filters);const{filters:e}=this.getStoreValue("productsList");this.availableDynamicFilters=e}catch(e){throw this.logger.error("Error fetching products with updated filters:",e),this.store.set("productsList.loading",![]),e}}async applyFiltersAndCloseDrawer(){await this.fetchFilters(),this.syncFiltersFromStore(),this.commands.ui.closeDrawer()}template(){const t=[];if(!this.isRenderedInDrawerMode){this.filterButtonContainer=document.createElement("div"),this.filterButtonContainer.className="product-list-filter-button-host";const e=this.getStoreValue("productsList"),n=null==e?void 0:e.filters;(null==n?void 0:n.length)>0&&this.filterButtonContainer.appendChild(this.buildFilterButton()),t.push(this.filterButtonContainer)}const e=document.createElement("div");e.className=this.isRenderedInDrawerMode?"product-list-filters-content-wrapper drawer-mode":"product-list-filters-content-wrapper";const n=this.buildFilterHeader();e.appendChild(n),this.appliedFiltersChipsContainer=this.buildAppliedFiltersChipsContainer(),e.appendChild(this.appliedFiltersChipsContainer),this.engravingFiltersContainer=document.createElement("div"),this.engravingFiltersContainer.className="product-list-engraving-filters-container";const i=this.buildEngravingFilterElements();for(const c of i)this.engravingFiltersContainer.appendChild(c);e.appendChild(this.engravingFiltersContainer),this.presaleFilterContainer=document.createElement("div"),this.presaleFilterContainer.className="product-list-presale-filters-container";const o=this.buildPresaleFilterElements();for(const c of o)this.presaleFilterContainer.appendChild(c);e.appendChild(this.presaleFilterContainer),this.fulfillmentFilterContainer=document.createElement("div"),this.fulfillmentFilterContainer.className="product-list-fulfillment-filters-container";const r=this.buildFulfillmentFilterElements();for(const c of r)this.fulfillmentFilterContainer.appendChild(c);e.appendChild(this.fulfillmentFilterContainer),this.priceFiltersContainer=document.createElement("div"),this.priceFiltersContainer.className="product-list-price-filters-container";const s=this.buildPriceFilterElements();for(const c of s)this.priceFiltersContainer.appendChild(c);e.appendChild(this.priceFiltersContainer),this.dynamicFiltersContainer=document.createElement("div"),this.dynamicFiltersContainer.className="product-list-dynamic-filters-container";const a=this.buildDynamicFiltersElements();for(const c of a)this.dynamicFiltersContainer.appendChild(c);return e.appendChild(this.dynamicFiltersContainer),this.isRenderedInDrawerMode&&e.appendChild(createApplyFiltersButton(()=>{void this.applyFiltersAndCloseDrawer()})),t.push(e),t}buildFilterButton(){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.style.cursor="pointer",e.addEventListener("click",()=>{this.openFilterDrawer()});const n=document.createElement("span");return n.className="product-list-filter-text",n.textContent="Filter",n.style.cursor="pointer",n.addEventListener("click",()=>{this.openFilterDrawer()}),t.appendChild(e),t.appendChild(n),t}openFilterDrawer(){this.commands.ui.openDrawer(i.PRODUCT_LIST_FILTERS,{filters:this.params.filters||[]})}buildFilterHeader(){const t=document.createElement("div");t.className="product-list-filters-header",this.isRenderedInDrawerMode&&t.classList.add("drawer-mode");const e=document.createElement("h3");if(e.className="product-list-filters-title",e.textContent="Filters",t.appendChild(e),this.isRenderedInDrawerMode){const e=document.createElement("button");e.className="product-list-filters-close-btn",e.innerHTML=CloseIcon({}),e.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),t.appendChild(e)}return t}async clearAllActiveFilters(){this.permanentFilters={price:{min:kt.MIN,max:kt.MAX},fulfillment:wt.ALL,presale:![],engraving:![]},await this.fetchFilters()}async removeSingleFilter(t,e){switch(t){case m.ENGRAVING:this.permanentFilters[xt.ENGRAVING]=![];break;case m.PRESALE:this.permanentFilters[xt.PRESALE]=![];break;case m.FULFILLMENT:this.permanentFilters[xt.FULFILLMENT]=wt.ALL;break;case m.PRICE:delete this.permanentFilters.price;break;default:{const n=this.checkboxFilterStateMap.get(t);if(n){n.selectedValues.delete(e);const i=Array.from(n.selectedValues);i.length>0?this.permanentFilters[t]=i:delete this.permanentFilters[t]}break}}await this.fetchFilters()}getFilteredAndSanitizedFilters(){return this.params.filters&&0!==this.params.filters.length?this.commands.productList.getSanitizedFilters(this.availableDynamicFilters,this.params.filters):[]}buildAppliedFiltersChipsContainer(){return createChipsContainer({currentFilters:this.permanentFilters,sanitizedFilters:this.getFilteredAndSanitizedFilters(),onRemoveFilter:(t,e)=>this.removeSingleFilter(t,e),onClearAllFilters:()=>this.clearAllActiveFilters()})}async handleFilterChange(){this.commands.productList.syncFiltersFromComponent(this.permanentFilters),this.isRenderedInDrawerMode||await this.fetchFilters()}isEngravingCurrentlyDisabled(){return this.permanentFilters[xt.FULFILLMENT]===wt.ON_DEMAND}buildEngravingFilterElements(){return createEngravingFilter({currentFilters:this.permanentFilters,isPersonalizationDisabled:this.isEngravingCurrentlyDisabled(),onEngravingChange:async t=>{this.permanentFilters[xt.ENGRAVING]=t,await this.handleFilterChange()}})}buildPresaleFilterElements(){return createPresaleFilter({currentFilters:this.permanentFilters,isPresaleDisabled:this.permanentFilters[xt.FULFILLMENT]===wt.ON_DEMAND,onPresaleChange:async t=>{this.permanentFilters[xt.PRESALE]=t,await this.handleFilterChange()}})}isSameDayDeliveryCurrentlyDisabled(){return!(!this.permanentFilters[xt.ENGRAVING]&&!this.permanentFilters[xt.PRESALE])}toggleFulfillmentFilterCollapse(){this.isFulfillmentFilterCollapsed=!this.isFulfillmentFilterCollapsed,this.fulfillmentOptionsList&&this.fulfillmentOptionsList.classList.toggle("collapsed"),this.fulfillmentFilterChevronIcon&&(this.fulfillmentFilterChevronIcon.innerHTML=this.isFulfillmentFilterCollapsed?ChevronDownIcon({width:20,height:20,color:"#374151"}):ChevronUpIcon({width:20,height:20,color:"#374151"}))}buildFulfillmentFilterElements(){const t=createFulfillmentFilter({currentFilters:this.permanentFilters,deliveryCollapsed:this.isFulfillmentFilterCollapsed,isSameDayDeliveryDisabled:this.isSameDayDeliveryCurrentlyDisabled(),onFulfillmentOptionsChange:async t=>{this.permanentFilters[xt.FULFILLMENT]=t,t===wt.ON_DEMAND&&(this.permanentFilters[xt.ENGRAVING]=![],this.permanentFilters[xt.PRESALE]=![]),await this.handleFilterChange()},onToggleCollapse:()=>this.toggleFulfillmentFilterCollapse()});return this.fulfillmentFilterChevronIcon=t.chevronContainer,this.fulfillmentOptionsList=t.fulfillmentList,t.elements}togglePriceFilterCollapse(){this.isPriceFilterCollapsed=!this.isPriceFilterCollapsed,this.priceSliderWrapper&&this.priceSliderWrapper.classList.toggle("collapsed"),this.priceFilterChevronIcon&&(this.priceFilterChevronIcon.innerHTML=this.isPriceFilterCollapsed?ChevronDownIcon({}):ChevronUpIcon({}))}buildPriceFilterElements(){const t=createPriceFilter({priceConfig:{min:kt.MIN,max:kt.MAX},currentFilters:this.permanentFilters,priceCollapsed:this.isPriceFilterCollapsed,onPriceChange:async(t,e)=>{this.permanentFilters.price||(this.permanentFilters.price={}),t!==kt.MIN?this.permanentFilters.price.min=t:delete this.permanentFilters.price.min,e!==kt.MAX?this.permanentFilters.price.max=e:delete this.permanentFilters.price.max,this.priceFilterDebounceTimer&&clearTimeout(this.priceFilterDebounceTimer),this.isRenderedInDrawerMode||(this.priceFilterDebounceTimer=setTimeout(async()=>{await this.handleFilterChange()},this.FILTER_DEBOUNCE_DELAY_MS))},onToggleCollapse:()=>this.togglePriceFilterCollapse(),DEFAULT_MIN:this.DEFAULT_MIN_PRICE,DEFAULT_MAX:this.DEFAULT_MAX_PRICE});return this.priceFilterChevronIcon=t.chevronContainer,this.priceSliderWrapper=t.sliderContainer,t.elements}buildDynamicFiltersElements(){const elements=[],t=this.getFilteredAndSanitizedFilters(),e=new Set([xt.ENGRAVING,xt.PRESALE,xt.FULFILLMENT]);for(const n of t)if(!e.has(n.type)){const t=this.getFilterElements(n);elements.push(...t)}return elements}getFilterElements(t){return this.buildCheckboxFilterElements(t)}buildCheckboxFilterElements(t){const elements=[];if(!this.checkboxFilterStateMap.has(t.type)){const e=this.permanentFilters[t.type],n=Array.isArray(e)?new Set(e):new Set;this.checkboxFilterStateMap.set(t.type,{isExpanded:n.size>0,selectedValues:n,searchInput:null,checkboxList:null,filteredItems:[...t.values],contentElement:null,iconElement:null,hasUserInteraction:n.size>0})}const e=this.checkboxFilterStateMap.get(t.type);e.filteredItems=[...t.values];const n=document.createElement("div");n.className="product-list-checkbox-filter",n.setAttribute("data-filter-category",t.type);const i=document.createElement("div");i.className="checkbox-filter-container";const o=createCheckboxFilterHeader({filter:t,state:e,onToggle:t=>this.toggleCheckboxFilterExpansion(t)});i.appendChild(o);const r=document.createElement("div");r.className="checkbox-filter-content "+(e.isExpanded?"expanded":"collapsed"),e.contentElement=r;const s=createCheckboxFilterSearchContainer({state:e,onSearch:n=>{handleCheckboxFilterSearch({filter:t,state:e,searchTerm:n,renderCheckboxItems:()=>this.renderCheckboxItemsForFilter(t,e)})}});return r.appendChild(s),e.checkboxList=document.createElement("div"),e.checkboxList.className="checkbox-filter-list",this.renderCheckboxItemsForFilter(t,e),r.appendChild(e.checkboxList),i.appendChild(r),n.appendChild(i),elements.push(n),elements}toggleCheckboxFilterExpansion(t){const e=this.checkboxFilterStateMap.get(t);e&&(e.isExpanded=!e.isExpanded,e.hasUserInteraction=!![],updateFilterExpandState(e))}renderCheckboxItemsForFilter(t,e){renderCheckboxItems({filter:t,state:e,onCheckboxChange:(n,i)=>this.handleCheckboxSelectionChange(t.type,e,n,i)})}async handleCheckboxSelectionChange(t,e,n,i){i?e.selectedValues.add(n):e.selectedValues.delete(n),e.hasUserInteraction=!![],e.isExpanded||(e.isExpanded=!![],updateFilterExpandState(e));const o=Array.from(e.selectedValues);o.length>0?this.permanentFilters[t]=o:delete this.permanentFilters[t],await this.handleFilterChange()}}class ProductListRetailersComponent extends BaseComponent{get hostClasses(){return["retailers-popup-list-container"]}constructor(){super({watchStorePaths:["productsList.userProducts"]})}getProductId(){return this.params.productId}template(){var t,e,n,i,r,s,a,c,p,m;const f=this.getProductId(),g=this.params.config||this.config,v=this.getStoreValue("productsList"),b=v.products.find(t=>(t.salsifyGrouping||t.id)===f);if(!b)return[];const x=null===(t=v.userProducts[f])||void 0===t?void 0:t.selectedSizeId,w=Object.values(b.sizes).find(t=>t.id===x);if(!w)return[];const S=document.createElement("div");S.className="retailers-popup-wrapper";const E=w.attributes||null,_=this.extractFulfillments(w.shippingFulfillments),F=this.extractFulfillments(w.onDemandFulfillments),I=null===(e=v.userProducts[f])||void 0===e?void 0:e.selectedFulfillmentType,O=I===o.SHIPPING,R=I===o.ON_DEMAND,M=O?_:F;S.appendChild(this.createHeader());const B=renderFulfillmentTabsContainer({shippingFulfillments:_,onDemandFulfillments:F,shippingSelected:O,onDemandSelected:R,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:null!==(r=null===(i=null===(n=null==g?void 0:g.layout)||void 0===n?void 0:n.productCard)||void 0===i?void 0:i.enableShippingFulfillment)&&void 0!==r?r:!![],enableOnDemandFulfillment:null!==(c=null===(a=null===(s=null==g?void 0:g.layout)||void 0===s?void 0:s.productCard)||void 0===a?void 0:a.enableOnDemandFulfillment)&&void 0!==c?c:!![]});if(S.appendChild(B),0===M.length)S.appendChild(this.createNoAvailabilityMessage());else{const t=null===(m=null===(p=v.userProducts[f])||void 0===p?void 0:p.selectedFulfillment)||void 0===m?void 0:m.id,e=document.createElement("div");e.className="popup-fulfillment-list-container";for(const n of M){const i=renderPopupRetailerCard({fulfillment:n,selectedFulfillmentType:I,isSelected:n.id===t,selectedSizeAttributes:E});i.addEventListener("click",async()=>{await this.onRetailerCardClick(n.id)}),e.appendChild(i)}S.appendChild(e)}return[S]}extractFulfillments(t){return t?Object.values(t):[]}onFulfillmentTabClick(t){const e=t.currentTarget,n=e.getAttribute("data-fulfillment-type");n&&this.commands.productList.selectFulfillmentType(this.getProductId(),n)}async onRetailerCardClick(t){const e=this.getProductId();t&&(await this.commands.productList.selectFulfillment(e,t),this.commands.productList.updateQuantity(e,1),this.clientConfig.isMobile()?this.commands.ui.closeDrawer():this.commands.ui.closeModal())}createHeader(){const t=document.createElement("div");t.className="retailers-popup-header";const e=document.createElement("h5");e.className="retailers-popup-title",e.textContent="Select a Retailer",t.appendChild(e);const n=document.createElement("button");return n.className="retailers-popup-close",n.innerHTML=CloseIcon({}),n.addEventListener("click",()=>this.commands.ui.closeModal()),t.appendChild(n),t}createNoAvailabilityMessage(){const t=document.createElement("p");return t.className="retailers-popup-no-data",t.innerHTML=sanitizeHTML("No delivery options available at this time."),t}}class ProductListSearchComponent extends BaseComponent{constructor(){super(...arguments),this.debounceTimer=null,this.currentSearchTerm="",this.ALLOWED_CHARACTERS=/[^a-zA-Z0-9\s\-_'.,&()]/g,this.MAX_LENGTH=100,this.DEFAULT_DEBOUNCE_MS=500}get hostClasses(){return["product-list-search__control-container"]}disconnectedCallback(){super.disconnectedCallback(),this.cleanupDebounceTimer()}getCurrentSearchTerm(){return this.currentSearchTerm}async fetchProducts(){try{this.commands.productList.setLoading(!![]),this.store.batch({"productList.products":[],"productList.retailers":{}});const t=this.getStoreValue("productsList"),e=this.buildCurrentFiltersFromState(t.appliedFilters);await this.commands.productList.loadInitialProducts(0,this.commands.productList.getItemsPerPage(),this.currentSearchTerm,e,[])}catch(t){throw this.logger.error("Error fetching products with search term:",t),this.commands.productList.setLoading(![]),t}}buildCurrentFiltersFromState(t){const e={price:{min:kt.MIN,max:kt.MAX},fulfillment:wt.ALL};for(const[n,i]of Object.entries(t))n===xt.PRICE?e.price=i:n===xt.FULFILLMENT?e.fulfillment=i:e[n]=i;return e}template(){const elements=[],t=document.createElement("div");t.className="product-list-search-box";const e=document.createElement("span");return e.className="product-list-search-icon",e.innerHTML=SearchIcon({}),e.setAttribute("aria-hidden","true"),this.searchInput=document.createElement("input"),this.searchInput.type="text",this.searchInput.className="product-list-search-input",this.searchInput.id="product-list-search-input",this.searchInput.placeholder="Search",this.searchInput.setAttribute("aria-label","Search products"),this.searchInput.setAttribute("maxlength",this.MAX_LENGTH.toString()),this.searchInput.addEventListener("input",t=>{const e=t.target,n=e.value,i=this.cleanInput(n);i!==n&&(e.value=i),this.updateClearButtonVisibility(i);const o=this.normalizeForSearch(i);o!==this.currentSearchTerm&&this.handleDebouncedSearch(o)}),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="none",this.clearButton.addEventListener("click",()=>{this.handleClearSearch()}),t.appendChild(e),t.appendChild(this.searchInput),t.appendChild(this.clearButton),elements.push(t),elements}handleDebouncedSearch(t){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.currentSearchTerm=t,this.commands.productList.updateSearchTerm(t),this.fetchProducts()},this.DEFAULT_DEBOUNCE_MS)}handleClearSearch(){var t;const e=""!==(null===(t=this.searchInput)||void 0===t?void 0:t.value);this.searchInput&&(this.searchInput.value="",this.searchInput.focus()),this.updateClearButtonVisibility(""),this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null),e&&(this.currentSearchTerm="",this.commands.productList.updateSearchTerm(""),this.fetchProducts())}cleanInput(t){if(!t)return"";let e=t.replace(this.ALLOWED_CHARACTERS,"");return e.length>this.MAX_LENGTH&&(e=e.substring(0,this.MAX_LENGTH)),e}normalizeForSearch(t){return t?t.trim().replace(/\s+/g," "):""}updateClearButtonVisibility(t){this.clearButton&&(this.clearButton.style.display=t?"flex":"none")}cleanupDebounceTimer(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=null)}}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","address.formattedAddress"]}),this.products=[],this.retailers={},this.pagination={currentPage:0,totalPages:0,totalCount:0,hasMorePages:!![]},this.cardsContainer=null,this.sentinelElement=null,this.loadingState=St.IDLE,this.scrollObserver=null,this.initializationPromise=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise,this.unsubscribeFromState=this.commands.productList.subscribe(t=>{this.handleStateUpdate(t)})}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribeFromState&&(this.unsubscribeFromState(),this.unsubscribeFromState=void 0),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(St.LOADING_INITIAL),this.commands.productList.setGridConfig(this.params.rows,this.params.columns),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(St.IDLE)}catch(bt){this.logger.error("Error initializing product list:",bt),this.setLoadingState(St.ERROR),this.showErrorState("Failed to load products")}}handleStateUpdate(t){this.updateLoadingState(t.loading);const e=this.hasProductsChanged(t.products);!e&&t.loading||(this.updateProductData(t),this.handleProductRendering(t.products))}updateLoadingState(t){const e=this.loadingState===St.LOADING_INITIAL||this.loadingState===St.LOADING_MORE;t&&0===this.products.length?this.setLoadingState(St.LOADING_INITIAL):t&&this.products.length>0?this.setLoadingState(St.LOADING_MORE):!t&&e&&this.setLoadingState(St.IDLE)}hasProductsChanged(t){return t.length!==this.products.length||t.some((t,e)=>{var n;return t.id!==(null===(n=this.products[e])||void 0===n?void 0:n.id)})}updateProductData(t){this.products=t.products,this.retailers=t.retailers,this.pagination=t.pagination}handleProductRendering(t){var e;if(!this.cardsContainer)return;const n=this.getStoreValue("address.formattedAddress");t.length>0&&n?(this.renderProducts(),this.setupInfiniteScroll()):!n&&t.length>0&&(this.renderSimplifiedProducts(t),this.commands.ui.openDrawer(i.ADDRESS_INPUT,{productId:null===(e=this.getStoreValue("productsList").products[0])||void 0===e?void 0:e.id,isIndependentComponent:!![]}))}renderSimplifiedProducts(t){this.clearCardsContainer();const e=t.map(t=>ComponentFactoryService.createElement({type:i.PRODUCT_LIST_CARD,product:t,shippingFulfillment:{},onDemandFulfillment:{},productUrl:this.params.productUrl}));e.forEach(t=>{this.cardsContainer.appendChild(t)}),this.setupInfiniteScroll()}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(){try{const t=this.getStoreValue("productsList");await this.commands.productList.loadInitialProducts(0,this.params.rows*this.params.columns,t.searchTerm,t.appliedFilters,this.params.filters);const e=this.getStoreValue("productsList");this.products=e.products,this.retailers=e.retailers,this.pagination=e.pagination}catch(t){throw this.products=[],this.retailers={},this.pagination.hasMorePages=![],t}}async loadMoreProducts(){if(this.loadingState!==St.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(St.LOADING_MORE);const t=this.getStoreValue("productsList"),e=this.buildCurrentFiltersFromState(t.appliedFilters);await this.commands.productList.loadMoreProducts(this.params.rows*this.params.columns,t.searchTerm,e,this.params.filters);const n=this.getStoreValue("productsList"),i=this.products.length;this.products=n.products,this.retailers=n.retailers,this.pagination=n.pagination;const o=this.products.slice(i);o.length>0&&this.appendNewProducts(o),this.setLoadingState(St.IDLE)}catch(t){this.logger.error("Error loading more products:",t),this.setLoadingState(St.ERROR),this.showSentinelError("Error loading products")}}buildCurrentFiltersFromState(t){const e={price:{min:kt.MIN,max:kt.MAX},fulfillment:wt.ALL};for(const[n,i]of Object.entries(t))this.mapStateFilterToComponentFilter(e,n,i);return e}mapStateFilterToComponentFilter(t,e,n){switch(e){case xt.PRICE:"object"!=typeof n||Array.isArray(n)||(t.price=n);break;case xt.FULFILLMENT:"string"==typeof n&&(t.fulfillment=n);break;case xt.ENGRAVING:"boolean"==typeof n&&(t[xt.ENGRAVING]=n);break;case xt.PRESALE:"boolean"==typeof n&&(t[xt.PRESALE]=n);break;default:Array.isArray(n)&&(t[e]=n)}}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}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const t=ComponentFactoryService.createElement({type:i.PRODUCT_LIST_CARD_LOADING,rows:this.params.rows,columns:this.getResponsiveColumns(),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=this.commands.productList.extractProductCardData(t,this.retailers);return e?ComponentFactoryService.createElement({type:i.PRODUCT_LIST_CARD,product:e.product,shippingFulfillment:e.retailer.shippingFulfillment,onDemandFulfillment:e.retailer.onDemandFulfillment,productUrl:this.params.productUrl}):null}catch(e){return this.logger.error("Error creating product card for product "+t.id+":",e),null}}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}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)}doCleanup(){this.cleanupScrollObserver(),this.products=[],this.retailers={},this.cardsContainer=null,this.sentinelElement=null,this.initializationPromise=null}async onStoreWatch(t){const e=t.find(t=>"address"===t.path);if(e&&void 0!==e.value&&this.cardsContainer)try{this.pagination=this.commands.productList.createInitialPagination(),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 refetching products after address change:",n),this.setLoadingState(St.ERROR),this.cardsContainer&&this.showErrorState("Failed to refetch products")}}template(){const elements=[],t=document.createElement("div");return t.className="product-list-controls",this.cardsContainer=this.createCardsContainer(),t.appendChild(this.cardsContainer),elements.push(t),this.renderCurrentState(),elements}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,e;const n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],i=null!==(e=this.params.showFirstEvent)&&void 0!==e?e:!![];if(n){const t=this.store.get(this.params.errorStorePath)||[],e=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return i?e.slice(0,1):e}const o=this.store.get(this.params.errorStorePath);return o?[{message:o,level:"error"}]:[]}createErrorElement(t){const e=document.createElement("div");e.classList.add("alert-container","alert-"+t.level);const n=document.createElement("span");n.classList.add("alert-icon"),n.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const i=document.createElement("span");return i.classList.add("alert-text"),i.textContent=t.message,e.appendChild(n),e.appendChild(i),e}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const e=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},e)}hideAllErrors(){var t;this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[];const e=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];e?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(i.CART)});const e=document.createElement("span");if(e.className="lce-cart-button-icon",e.innerHTML=BagIcon({color:t.theme.primaryColor}),this.params.showItemsCount){const t=document.createElement("span");return t.className="lce-cart-button-badge",t.style.visibility="hidden",[e,t]}return[e]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const e=this.getStoreValue("cart.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,this.isPresale=![]}get hostClasses(){return["engraving-form"]}beforeConnected(){var t,e,n,i;if(this.engravingLines=this.params.lines,"product"===this.params.context){const o=this.store.get("products."+this.params.identifier);this.fulfillmentId=o.selectedFulfillmentId,this.partNumber=(null===(t=o.selectedFulfillment)||void 0===t?void 0:t.variant.partNumber)||null,this.isPresale=(null===(i=null===(n=null===(e=o.sizes[o.selectedSizeId])||void 0===e?void 0:e.attributes)||void 0===n?void 0:n.presale)||void 0===i?void 0:i.isActive)||![]}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=this.isPresale?e.layout.preSaleButtonText: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],p=Object.values(c.shippingFulfillments).filter(t=>t.variant.isEngravable),m=document.createElement("div");m.className="fulfillment-section";const f=document.createElement("p");if(f.className="shipping-from-text",f.innerHTML="Shipping from: <b>"+(null===(t=a.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",m.appendChild(f),1===p.length)return m;const g=document.createElement("div");g.className="fulfillment-options-container",m.appendChild(g);const v=document.createElement("span");v.className="see-more-fulfillments",v.textContent="See More Delivery Options ("+p.length+")",v.setAttribute("role","button"),v.setAttribute("tabindex","0"),v.setAttribute("aria-label","See More Delivery Options ("+p.length+")"),v.setAttribute("aria-expanded","false");const l=()=>{const t=g.classList.contains("expanded");g.classList.toggle("expanded"),t?(v.textContent="See More Delivery Options ("+p.length+")",v.setAttribute("aria-label","See More Delivery Options ("+p.length+")"),v.setAttribute("aria-expanded","false")):(v.textContent="See Less Delivery Options",v.setAttribute("aria-label","See Less Delivery Options"),v.setAttribute("aria-expanded","true"))};v.addEventListener("click",l),v.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),l())}),m.appendChild(v);for(const b of p){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",b.id),b.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 "+b.retailerName+", "+formatCentToDollarText(b.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))+", "+b.engravingExpectation),t.setAttribute("aria-pressed",b.id===(null===(o=a.selectedFulfillment)||void 0===o?void 0:o.id)?"true":"false");const Y=()=>{this.fulfillmentId=b.id,this.partNumber=b.variant.partNumber;const e=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(e),this.productPriceSpan.textContent=formatCentToDollarText(e);const n=g.querySelector(".fulfillment-option.selected");n&&(n.classList.remove("selected"),n.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),f.innerHTML="Shipping from: <b>"+b.retailerName+"</b>"};t.addEventListener("click",Y),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Y())});const c=b.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),p=document.createElement("div");p.className="option-row row-1",t.appendChild(p);const m=document.createElement("span");m.className="retailer-name",m.textContent=b.retailerName,p.appendChild(m);const v=document.createElement("span");v.className="fulfillment-price",v.textContent=formatCentToDollarText(c),p.appendChild(v),t.appendChild(p);const x=document.createElement("div");x.className="option-row row-2",t.appendChild(x);const w=document.createElement("span");w.className="estimated-time",w.textContent=b.engravingExpectation,x.appendChild(w),t.appendChild(x),g.appendChild(t)}return m}engravingLinesSection(){var t;const e=this.getConfigs("global"),{lines:n,maxLines:i,location:o,maxCharsPerLine:r}=this.params,s=document.createElement("div");s.className="engraving-section";const a=document.createElement("p");if(a.className="engraving-title",a.textContent=e.layout.personalizationText,s.appendChild(a),o&&(null===(t=null==o?void 0:o.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-location-text",t.textContent="Your message will appear "+o.toLowerCase()+".",s.appendChild(t)}const c=Array.from({length:i},(t,e)=>{const i=e+1,o=document.createElement("div");o.className="engraving-input-wrapper",o.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=r,s.value=n[e]||"",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 "+r+" characters":"Engraving line "+i+", maximum "+r+" characters");const a=document.createElement("span");return a.className="engraving-char-count",a.textContent=s.value.length+"/"+r,a.setAttribute("aria-live","polite"),a.setAttribute("aria-atomic","true"),s.addEventListener("input",()=>{a.textContent=s.value.length+"/"+r,this.engravingLines[e]=s.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),o.appendChild(s),o.appendChild(a),o}),p=document.createElement("div");return p.className="engraving-inputs-container",p.append(...c),s.appendChild(p),s}actionButtonsSection(){const{identifier:t,context:e}=this.params,n=document.createElement("div");n.className="action-buttons-container";const o=document.createElement("button");o.type="button",o.className="cancel-action-button",o.textContent="Cancel",o.setAttribute("aria-label","Cancel personalization and close");const Q=async()=>{"product"===e&&await this.commands.product.closeProductDrawer(t),"cart"===e&&this.commands.ui.openDrawer(i.CART)};o.addEventListener("click",Q),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Q())}),n.appendChild(o),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===e?"Add personalized item to cart":"Update personalization and return to cart");const k=async()=>{const n=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);if("product"===e&&this.fulfillmentId&&this.partNumber){const e={fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:n,identifier:t};this.isPresale?await this.commands.product.addPresaleToCart(t,e):await this.commands.product.addToCart(t,e),await this.commands.product.closeProductDrawer(t)}"cart"===e&&(await this.commands.cart.updateItemEngraving(t,n),this.commands.ui.openDrawer(i.CART))};return this.addToCartButton.addEventListener("click",k),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),k())}),n.appendChild(this.addToCartButton),n}template(){const elements=[],t=this.productInformationSection();if(elements.push(t),"product"===this.params.context){const t=this.retailersSection();elements.push(t)}const e=this.engravingLinesSection();elements.push(e);const n=this.actionButtonsSection();elements.push(n);const i=document.createElement("p");return i.className="engraving-disclaimer",i.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>",elements.push(i),elements}}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,o,r,s,a,c,p,m,f,g,v,b,x,w,S,E,_,F;const I=this.params.identifier,O={identifier:I,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const i=this.getStoreValue("cart.items."+I);O.lines=(null===(e=null===(t=null==i?void 0:i.attributes)||void 0===t?void 0:t.engraving)||void 0===e?void 0:e.lines)||[],O.maxLines=(null===(o=null===(n=null==i?void 0:i.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.maxLines)||1,O.maxCharsPerLine=(null===(s=null===(r=null==i?void 0:i.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.maxCharsPerLine)||16,O.fee=(null===(c=null===(a=null==i?void 0:i.attributes)||void 0===a?void 0:a.engraving)||void 0===c?void 0:c.fee)||0,O.location=(null===(m=null===(p=null==i?void 0:i.attributes)||void 0===p?void 0:p.engraving)||void 0===m?void 0:m.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+I);O.lines=(null===(g=null===(f=null==t?void 0:t.attributes)||void 0===f?void 0:f.engraving)||void 0===g?void 0:g.lines)||[],O.maxLines=(null===(b=null===(v=null==t?void 0:t.attributes)||void 0===v?void 0:v.engraving)||void 0===b?void 0:b.maxLines)||1,O.maxCharsPerLine=(null===(w=null===(x=null==t?void 0:t.attributes)||void 0===x?void 0:x.engraving)||void 0===w?void 0:w.maxCharsPerLine)||16,O.fee=(null===(E=null===(S=null==t?void 0:t.attributes)||void 0===S?void 0:S.engraving)||void 0===E?void 0:E.fee)||0,O.location=(null===(F=null===(_=null==t?void 0:t.attributes)||void 0===_?void 0:_.engraving)||void 0===F?void 0:F.location)||""}this.commands.ui.openDrawer(i.ENGRAVING_FORM,O)}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 p of e){const t=document.createElement("span");t.className="engraving-line",t.textContent=p,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 u=async()=>{await this.handleRemove()};if(c.addEventListener("click",u),c.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await u())}),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 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,n=e.value,i=e.selectionStart||0;let o=0,r;if(i>2&&(o=1),i>5&&(o=2),n.includes("/")){const t=n.split("/");let e=(t[0]||"").replace(/\D/g,"").substring(0,2);const i=(t[1]||"").replace(/\D/g,"");let o=i.substring(0,2);const s=i.substring(2);let a=(t[2]||"").replace(/\D/g,"");if(a=(s+a).substring(0,4),""===e&&3===t.length&&(e="01"),2===e.length){let t=Number.parseInt(e,10);t>12&&(t=12),t<1&&(t=1),e=t.toString().padStart(2,"0")}if(""===o&&3===t.length&&(o="01"),2===o.length){let t=Number.parseInt(o,10);t>31&&(t=31),t<1&&(t=1),o=t.toString().padStart(2,"0")}r=e,(t.length>1||o)&&(r+="/"+o),(a||t.length>2)&&(r+="/"+a)}else{let t=n.replace(/\D/g,"");if(t.length>8&&(t=t.substring(0,8)),t.length>=2){let e=Number.parseInt(t.substring(0,2),10);e>12&&(e=12),t=e.toString().padStart(2,"0")+t.substring(2)}if(t.length>=4){let e=Number.parseInt(t.substring(2,4),10);e>31&&(e=31),t=t.substring(0,2)+e.toString().padStart(2,"0")+t.substring(4)}r=t.length>=5?t.substring(0,2)+"/"+t.substring(2,4)+"/"+t.substring(4):t.length>=3?t.substring(0,2)+"/"+t.substring(2):t}if(e.value=r,n.includes("/")){let t;t=0===o?Math.min(i,2):1===o?Math.min(i,5):r.length,e.setSelectionRange(t,t)}}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}parseDateString(t){if(!this.validateDate(t))return null;const[e,n,i]=t.split("/").map(Number);return new Date(i,e-1,n)}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}validateDateConstraints(t){const e=[],n=this.params.validation;if(!n)return e;const i=this.parseDateString(t);if(!i)return e;const o=i.getFullYear();void 0!==n.minYear&&o<n.minYear&&e.push("Year must be "+n.minYear+" or later"),void 0!==n.maxYear&&o>n.maxYear&&e.push("Year must be "+n.maxYear+" or earlier");const r=this.calculateAge(i);return void 0!==n.minAge&&r<n.minAge&&e.push("Must be at least "+n.minAge+" years old"),void 0!==n.maxAge&&r>n.maxAge&&e.push("Must be no more than "+n.maxAge+" years old"),e}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":case"birthdate":return this.validateDate(i);case"email":return i.includes("@")&&(null===(t=i.split("@")[1])||void 0===t?void 0:t.includes("."));case"number":return!Number.isNaN(Number.parseFloat(i));default:return(null===(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||"birthdate"===this.params.inputType)if(this.validateDate(t)){const n=this.validateDateConstraints(t);e.push(...n)}else e.push("Please enter a valid date (MM/DD/YYYY)");if("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&&"birthdate"!==this.params.inputType||this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const elements=[];if(this.params.label){const e=document.createElement("label");e.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(e.textContent+="*"),e.setAttribute("for",this.params.name),elements.push(e)}return this.inputElement=document.createElement("input"),this.inputElement.type="birthdate"===this.params.inputType?"text":this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"!==this.params.inputType&&"birthdate"!==this.params.inputType||(this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.params.placeholder||(this.inputElement.placeholder="MM/DD/YYYY")),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",elements.push(this.inputElement),elements.push(this.errorContainer),elements}}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(bt){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 elements=[],e=this.getIconElement();e&&elements.push(e);const n=document.createElement("span");if(n.className="alert-message",n.textContent=this.params.message,elements.push(n),"detailed"===(null===(t=this.config)||void 0===t?void 0:t.alertType)&&this.params.currentTotal){const t=document.createElement("div");t.className="alert-details";const e=document.createElement("small");e.className="alert-details-text",e.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(e),elements.push(t)}return elements}}const Lt=LoggerFactory.get("ClientHelpers"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,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&&Lt.warn("Merging configurations with warnings:",i),n}const Rt=new Map([["global.layout.enablePersonalization",[i.PRODUCT,i.CART,i.CHECKOUT,i.ENGRAVING_FORM,i.ENGRAVING_VIEW,i.PRODUCT_INTERACTIONS,i.CART_ITEM,i.CHECKOUT_ITEM]],["global.layout.personalizationText",[i.PRODUCT,i.CART,i.CHECKOUT,i.ENGRAVING_FORM,i.ENGRAVING_VIEW,i.CART_ITEM]],["global.layout.personalizationCardStyle",[i.PRODUCT,i.CART,i.CHECKOUT,i.ENGRAVING_FORM,i.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[i.CART,i.CART_PROMO_CODE,i.CART_FOOTER,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[i.CART,i.CHECKOUT,i.ADDRESS,i.INPUT,i.ADDRESS_INPUT,i.CHECKOUT_DELIVER_TO,i.CHECKOUT_BUYER,i.CHECKOUT_BILLING,i.CHECKOUT_PAYMENT,i.CART_PROMO_CODE]],["global.layout.showPoweredBy",[i.CART,i.CHECKOUT,i.CHECKOUT_COMPLETED,i.POWERED_BY,i.CART_FOOTER,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[i.POWERED_BY]],["product.layout.showImages",[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[i.PRODUCT]],["product.layout.showDescription",[i.PRODUCT,i.PRODUCT_DESCRIPTION,i.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[i.PRODUCT,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[i.PRODUCT,i.PRODUCT_IMAGE_CAROUSEL,i.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[i.PRODUCT,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[i.PRODUCT,i.PRODUCT_RETAILERS,i.PRODUCT_RETAILERS_CAROUSEL,i.PRODUCT_RETAILERS_POPUP,i.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION,i.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION,i.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[i.PRODUCT,i.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[i.PRODUCT,i.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[i.CART,i.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[i.CART,i.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[i.CART,i.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[i.CART,i.CART_FOOTER]],["checkout.layout.emailOptIn",[i.CHECKOUT,i.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[i.CHECKOUT,i.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[i.CHECKOUT,i.CHECKOUT_GIFT_CARDS,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[i.CHECKOUT,i.CHECKOUT_ORDER_SUMMARY,i.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[i.CHECKOUT,i.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[i.CHECKOUT,i.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[i.CHECKOUT,i.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[i.CHECKOUT,i.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[i.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,e){const n=new Set;for(const i of Object.keys(e)){const e=Rt.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.modalCreated=![],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("Client preparation failed",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",bt.version);const t=this.clientConfig.isProduction(),e=this.clientConfig.isDebuggingEnabled();!t&&e&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled")),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),!t&&e&&this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized")),this.logger.info("🔐 Starting authentication and loading configurations...");const{success:n,configs:i}=await this.authClient.authenticateAndGetConfigs();if(!n||!i)throw this.clientPrepared=![],new SDKError("Authentication failed",!![]);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=i;this.clientConfig.set("partnerCode",o.configurations.partnerCode),this.clientConfig.set("partnerName",o.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const r=await this.fingerPrintService.getId(o.configurations.partnerCode),s=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",r),this.clientConfig.set("isLocalStorageAvailable",s);const a=s?null:await this.apiClient.getPersistedStore(r);if(await this.store.initialize({userDeviceId:r,isLocalStorageAvailable:s,persistedStore:a}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),e=o.global.layout.showPoweredBy;o=deepMergeConfigs(o,t),o.global.layout.showPoweredBy=e}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(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.ensureModalExists(),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,...o}=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:!![],...o},c=ComponentFactoryService.createElement(a);return safeReplaceChildren(s,c),t.type===i.CHECKOUT&&(this.store.set("metadata.checkout.injection",{containerId:r,injectedAt:Date.now()}),await this.commands.checkout.loadCheckout({checkoutId:void 0===t.checkoutId?"":t.checkoutId})),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=[],o=[];for(const i of e){if(!i||"object"!=typeof i){this.logger.warn("Invalid product parameter: must be an object");continue}if(!i.containerId||"string"!=typeof i.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+i.identifier+"'");continue}const t=i.containerId.replace("#","").trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+i.identifier+"'");continue}const e=document.getElementById(t);if(!e){this.logger.warn("Container with ID '"+t+"' not found for product '"+i.identifier+"'");continue}const o=n.every(e=>e.containerId!==t);if(!o){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!i.identifier||"string"!=typeof i.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!==i.identifier);r?n.push({containerId:t,identifier:i.identifier}):this.logger.warn("Duplicate product identifier '"+i.identifier+"' found, skipping")}for(const r of n){const t=ComponentFactoryService.createElement({type:i.PRODUCT,useShadowDom:!![],productId:r.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),e=document.getElementById(r.containerId);e?(e.innerHTML="",e.appendChild(t),o.push(this.createInjectedComponentWrapper(r.containerId,i.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)),o}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,i.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.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(m);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:i.PRODUCT_LIST,wrapInLceElement:!![],rows:t.rows||4,columns:t.columns||4,filters:t.filters||[],productUrl:t.productUrl});safeReplaceChildren(e,n)}async injectProductListSearch(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,i.PRODUCT_LIST_SEARCH),void 0;if(!t)throw new SDKError("Product list search requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list search container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);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 search.',!![]);const n=ComponentFactoryService.createElement({type:i.PRODUCT_LIST_SEARCH,wrapInLceElement:!![],useShadowDom:!![],isIndependentComponent:!![]});safeReplaceChildren(e,n)}async injectProductListFilters(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,i.PRODUCT_LIST_FILTERS),void 0;if(!t)throw new SDKError("Product list filters requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list filters container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(t.filters&&t.filters.length>0){const e=Object.values(m);for(const n of t.filters)if(!e.includes(n))throw new SDKError('Invalid filter "'+n+'". Valid options: '+e.join(", "),!![])}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 filters.',!![]);const n=ComponentFactoryService.createElement({type:i.PRODUCT_LIST_FILTERS,wrapInLceElement:!![],useShadowDom:!![],isIndependentComponent:!![],filters:t.filters});safeReplaceChildren(e,n)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:i.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureModalExists(){if(!this.modalCreated)try{const t=ComponentFactoryService.createElement({type:i.MODAL,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.modalCreated=!![]}catch(t){this.logger.warn("Failed to create modal:",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(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(i.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(i.CART,AddressInputComponent),ComponentFactoryService.registerComponent(i.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(i.MODAL,ModalComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(i.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(i.INPUT,InputComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(i.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(i.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(i.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(i.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(i.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(i.ALERT,AlertComponent),ComponentFactoryService.registerComponent(i.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(i.MODAL,ModalComponent),ComponentFactoryService.registerComponent(i.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(i.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(i.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(i.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(i.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(i.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(i.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(i.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(i.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(i.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(i.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_SEARCH,ProductListSearchComponent),ComponentFactoryService.registerComponent(i.PRODUCT_LIST_RETAILERS,ProductListRetailersComponent),ComponentFactoryService.registerComponent(i.CART,CartComponent),ComponentFactoryService.registerComponent(i.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(i.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(i.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(i.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(i.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(i.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(i.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(i.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(i.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(i.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(i.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(i.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}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 o=ComponentFactoryService.createElement({type:i.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:e});n.innerHTML="",safeReplaceChildren(n,o)},floatingCartButton:t=>{this.ensureCartDrawerExists();const e=ComponentFactoryService.createElement({type:i.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(e)},cartSubtotal:t=>{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 N=t=>{e.textContent=formatCentToDollarText(t)},n=this.store.get("cart.subtotal")||0;N(n),this.store.watch("cart.subtotal",()=>{const t=this.store.get("cart.subtotal")||0;N(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 k=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;k(o),this.store.watch("cart.itemsQuantity",()=>{const t=this.store.get("cart.itemsQuantity")||0;k(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,i.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:i.ADDRESS,containerId:t,options:e}):(this.injectDisabledElementsError(t,i.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:i.CART,containerId:t}):(this.injectDisabledElementsError(t,i.CART),null)}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),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:i.CHECKOUT,containerId:t,checkoutId:e}):(this.injectDisabledElementsError(t,i.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,n){try{SingletonManager.setContext({isBuilder:![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:n.env,isBuilder:![],debugMode:n.debugMode,customTheme:n.customTheme,promoTicker:n.promoTicker,proxy:n.proxy,development:n.development,checkout:n.checkout});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),injectProductListFilters:r.injectProductListFilters.bind(r),injectProductListSearch:r.injectProductListSearch.bind(r),ui:r.ui,actions:r.actions,getInjectedComponents:r.getInjectedComponents.bind(r)};window.elements=s;const a=PubSubService.getInstance();return a.publishAction(e.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:i.get("version")}),s}catch(i){return console.error("[LiquidCommerce Elements] Client initialization failed",i),null}}const Mt={SCRIPT:{CHECKOUT_PARAM:"data-checkout-param"},ELEMENT:{CHECKOUT:"data-lce-checkout"},JSON_SCRIPT:{DEVELOPMENT:"data-liquid-commerce-elements-development"}};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function getDevelopmentConfigs(){const t=document.querySelector("script["+Mt.JSON_SCRIPT.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}}function triggerAutoInit(t,e){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await t()}catch(n){console.error(e+" Failed to initialize:",n)}},50)}):setTimeout(async()=>{try{await t()}catch(n){console.error(e+" Failed to initialize:",n)}},50)}catch(n){console.error(e+" Failed to setup initialization:",n)}}async function setupCheckout(t,e,n){try{const i=document.querySelector("div["+Mt.ELEMENT.CHECKOUT+"]");if(!i)return n.requireCheckoutId||console.warn(n.errorPrefix+" No checkout container found. Add a div with data-lce-checkout attribute."),void 0;const o="lce-checkout-container";let r;i.className="lce-checkout-container",i.id=o;const s=t.getAttribute(Mt.SCRIPT.CHECKOUT_PARAM)||"lce_checkout";if(s&&startsWithLcePrefix(s)){const t=new URLSearchParams(window.location.search);if(r=t.get(s)||void 0,!r&&n.requireCheckoutId)return console.warn(n.errorPrefix+" Checkout ID not found in query parameters."),void 0}else if(console.warn(n.errorPrefix+' Ignoring checkout query parameter "'+s+'" because it does not start with "lce_" prefix.'),n.requireCheckoutId)return;await e(o,r)}catch(i){console.error(n.errorPrefix+" Failed to setup checkout:",i)}}const jt={SCRIPT:{MAIN:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode",PRODUCT:"data-product",CONTAINER:"data-container",PRODUCT_PARAM:"data-product-param",PRODUCT_FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",PROMO_CODE_PARAM:"data-promo-code-param",PROMO_CODE:"data-promo-code",PROMO_TEXT:"data-promo-text",PROMO_SEPARATOR:"data-promo-separator",PROMO_ACTIVE_FROM:"data-promo-active-from",PROMO_ACTIVE_UNTIL:"data-promo-active-until",CART_BUTTON:"data-cart-button",CART_BADGE_BUTTON:"data-cart-badge-button",CART_MOBILE_BUTTON:"data-cart-mobile-button",CART_MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",CART_BUTTON_HIDDEN:"data-cart-button-hidden",CHECKOUT_URL:"data-checkout-url"},ELEMENT:{PRODUCT:"data-lce-product",PRODUCTS_LIST:"data-liquid-commerce-elements-products-list",PRODUCTS_LIST_ROWS:"data-rows",PRODUCTS_LIST_COLUMNS:"data-columns",PRODUCTS_LIST_FILTERS:"data-filters",PRODUCTS_LIST_FILTERS_CONTAINER:"data-filters-container",PRODUCTS_LIST_FILTERS_SEARCH_CONTAINER:"data-search-container",PRODUCTS_LIST_PRODUCT_URL:"data-product-url",CART_TOGGLE_BUTTON:"data-lce-cart-toggle-button",CART_ITEMS_COUNT:"data-lce-cart-items-count"},JSON_SCRIPT:{PRODUCTS:"data-liquid-commerce-elements-products"}};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)===jt.SCRIPT.PRODUCT);for(const o of i)try{const n=o.match(/^data-product(-(.+))?$/),i=(null==n?void 0:n[2])?"-"+n[2]:"",r=""+jt.SCRIPT.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["+jt.JSON_SCRIPT.PRODUCTS+"]");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["+jt.ELEMENT.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(jt.ELEMENT.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(jt.SCRIPT.PRODUCT_PARAM),r=e.getAttribute(jt.SCRIPT.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=o.SHIPPING;if(r)if(startsWithLcePrefix(r)){const t=s.get(r);t!==o.ON_DEMAND&&t!==o.SHIPPING||(c=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+r+'" 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(jt.SCRIPT.PROMO_CODE_PARAM);if(!i)return;if(!startsWithLcePrefix(i))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+i+'" because it does not start with "lce_" prefix.'),void 0;const o=new URLSearchParams(window.location.search),r=o.get(i);if(!r)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",p=!a,m=e.getAttribute(n),f=e.getAttribute(i);if(!e.hasAttribute(n)&&!e.hasAttribute(i))return p&&t.ui.floatingCartButton(![]),void 0;if(p){if(e.hasAttribute(n)&&!m)return t.ui.floatingCartButton(![]),void 0;if(e.hasAttribute(i)&&!f)return t.ui.floatingCartButton(!![]),void 0}const g=m||f,v=!!f;if(!g)return p&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(v)),void 0;const b=["above","below","replace","inside"],x=g.match(/^(\w+):(.+)$/),w=x&&b.includes(x[1])?x[1]:"inside";let S=x?x[2]:g;/^[#.]/.test(S)||/\s/.test(S)||(S="#"+S);const E=document.querySelector(S);if(!E)return p&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+S+'" not found. Using floating button.'),t.ui.floatingCartButton(v)),void 0;const _=document.createElement("div");switch(_.classList.add("lce-cart-"+c+"-button-container"),_.id=generateElementId({prefix:"lce-cart-"+c+"-btn"}),w){case"above":null===(o=E.parentNode)||void 0===o?void 0:o.insertBefore(_,E);break;case"below":null===(r=E.parentNode)||void 0===r?void 0:r.insertBefore(_,E.nextSibling);break;case"replace":null===(s=E.parentNode)||void 0===s?void 0:s.replaceChild(_,E);break;default:E.appendChild(_)}t.ui.cartButton(_.id,v)}catch(a){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",a)}}async function setupCartButtons(t,e){e.hasAttribute(jt.SCRIPT.CART_BUTTON_HIDDEN)||(await setupCartButtonWithPosition(t,e,jt.SCRIPT.CART_BUTTON,jt.SCRIPT.CART_BADGE_BUTTON),await setupCartButtonWithPosition(t,e,jt.SCRIPT.CART_MOBILE_BUTTON,jt.SCRIPT.CART_MOBILE_BADGE_BUTTON))}async function initializeProductsList(t){try{const e=document.querySelector("div["+jt.ELEMENT.PRODUCTS_LIST+"]"),n=document.querySelector("div["+jt.ELEMENT.PRODUCTS_LIST_FILTERS_SEARCH_CONTAINER+"]"),i=document.querySelector("div["+jt.ELEMENT.PRODUCTS_LIST_FILTERS_CONTAINER+"]");if(!e)return;const o="lce-products-list-container";if(e.className="lce-products-list-container",e.id=o,n){const e="lce-product-list-search-container";n.className="lce-product-list-search-container",n.id=e,t.injectProductListSearch({containerId:e})}if(i){const e="lce-product-list-filters-container";i.className="lce-product-list-filters-container",i.id=e;const n=i.getAttribute(jt.ELEMENT.PRODUCTS_LIST_FILTERS);let o=[];n&&(o=n.split(",").map(t=>t.trim()).filter(t=>t.length>0)),t.injectProductListFilters({containerId:e,filters:o})}const r=Number.parseInt(e.getAttribute(jt.ELEMENT.PRODUCTS_LIST_ROWS)||"3",10)||3,s=Number.parseInt(e.getAttribute(jt.ELEMENT.PRODUCTS_LIST_COLUMNS)||"4",10)||4,a=e.getAttribute(jt.ELEMENT.PRODUCTS_LIST_FILTERS),c=e.getAttribute(jt.ELEMENT.PRODUCTS_LIST_PRODUCT_URL)||void 0;let p=[];a&&(p=a.split(",").map(t=>t.trim()).filter(t=>t.length>0)),t.injectProductList({containerId:o,rows:r,columns:s,filters:p,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("["+jt.ELEMENT.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("["+jt.ELEMENT.CART_ITEMS_COUNT+"]");if(o.length>0){let t=0;for(const e of o){const i=e.getAttribute(jt.ELEMENT.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(bt){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",bt)}}async function ElementsAutoInitialize(){var e,n,i,o,s;try{const a=document.querySelector("script["+jt.SCRIPT.MAIN+"]");if(!a)return;const c=a.getAttribute(jt.SCRIPT.TOKEN),p=a.getAttribute(jt.SCRIPT.ENV)||t.PRODUCTION,m=a.getAttribute(jt.SCRIPT.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 f=a.getAttribute(jt.SCRIPT.PROMO_CODE),g=a.getAttribute(jt.SCRIPT.PROMO_TEXT),v=null!==(e=a.getAttribute(jt.SCRIPT.PROMO_SEPARATOR))&&void 0!==e?e:"•",b=null!==(n=a.getAttribute(jt.SCRIPT.PROMO_ACTIVE_FROM))&&void 0!==n?n:void 0,x=null!==(i=a.getAttribute(jt.SCRIPT.PROMO_ACTIVE_UNTIL))&&void 0!==i?i:void 0,w=a.getAttribute(jt.SCRIPT.CHECKOUT_URL)||void 0,S=pairsFromMainScript(a),E=pairsFromProductsScript(),_=pairsFromAttributedElements(),F=[...S,...E,..._],I=f&&g&&b&&x?{promoCode:f,text:g.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:v,activeFrom:null===(o=new Date(b))||void 0===o?void 0:o.toISOString(),activeUntil:null===(s=new Date(x))||void 0===s?void 0:s.toISOString()}:void 0;let O=r.NONE;m&&p!==t.PRODUCTION&&(O=m),setupEventListeners();const R=await Elements(c,{env:p,debugMode:O,promoTicker:I?[I]:void 0,checkout:w?{pageUrl:w}:void 0,development:getDevelopmentConfigs()});if(!R)throw new SDKError("Elements SDK client initialization failed",!![]);setupCartButtons(R,a),0!==F.length&&R.injectProductElement(F).catch(t=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",t)}),await initializeProductsList(R),addProductToCartViaQueryParam(R,a),addPromoCodeToCartViaQueryParam(R,a),setupCheckout(a,R.injectCheckoutElement.bind(R),{requireCheckoutId:!![],errorPrefix:"[LiquidCommerce Elements Auto Initialization]"})}catch(a){console.error("[LiquidCommerce Elements Auto Initialization]",a)}}function triggerElementsAutoInit(){triggerAutoInit(ElementsAutoInitialize,"[LiquidCommerce Elements Auto Initialization]")}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:i.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:i.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:i.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,n){try{SingletonManager.setContext({isBuilder:!![]});const i=ClientConfigService.getInstance();i.initialize(t,{env:n.env,isBuilder:!![],debugMode:n.debugMode,customTheme:n.customTheme,promoTicker:n.promoTicker,checkout:n.checkout,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(e.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:i.get("version")}),s}catch(i){return console.error("[LiquidCommerce Elements] Client initialization failed",i),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(Nt){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Nt)}try{triggerElementsAutoInit()}catch(Bt){console.error("[LiquidCommerce Elements] Auto-initialization failed:",Bt)}}catch(qt){console.error("[LiquidCommerce Elements] SDK initialization failed:",qt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});