@liquidcommerce/elements-sdk 2.5.6-beta.16 → 2.5.6-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/umd/elements.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):(t="undefined"!=typeof globalThis?globalThis:t||self,n(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 n of t)"string"==typeof n?this.appendChild(document.createTextNode(n)):this.appendChild(n)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const n=document.createDocumentFragment();for(const i of t)"string"==typeof i?n.appendChild(document.createTextNode(i)):n.appendChild(i);this.insertBefore(n,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const n=this.parentNode;if(!n)return;const i=document.createDocumentFragment();for(const o of t)"string"==typeof o?i.appendChild(document.createTextNode(o)):i.appendChild(o);n.replaceChild(i,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const n=this.parentNode;if(!n)return;const i=document.createDocumentFragment();for(const o of t)"string"==typeof o?i.appendChild(document.createTextNode(o)):i.appendChild(o);n.insertBefore(i,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const n=this.parentNode;if(!n)return;const i=document.createDocumentFragment();for(const o of t)"string"==typeof o?i.appendChild(document.createTextNode(o)):i.appendChild(o);n.insertBefore(i,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const n={};for(const[i,o]of t)n[i]=o;return n})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(W){console.warn("DOM polyfills initialization failed:",W)}}function safeReplaceChildren(t,...n){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...n);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const i of n)"string"==typeof i?t.appendChild(document.createTextNode(i)):t.appendChild(i)}}catch(i){console.error("replaceChildren operation failed:",i),1===n.length&&"string"==typeof n[0]&&(t.innerHTML=n[0])}}class SDKError extends Error{constructor(t,n=![]){super(t),this.name="SDKError",this.isSdk=!![],this.reThrow=n,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(t,n){if((null==t?void 0:t.isSdk)===!![])return t instanceof SDKError&&t.reThrow?![]:!![];if(!t||"object"!=typeof t)return n?isSDKSource(n):![];const i=String((null==t?void 0:t.message)||""),o=/liquidcommerce\s+elements/i.test(i),r=String((null==t?void 0:t.stack)||""),s=(null==t?void 0:t.source)||n||"",c=[/@[/\\](?: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],d=[/\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/],u=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],h=[/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],p=isSDKSource(s),f=c.some(t=>t.test(r)),v=d.some(t=>t.test(r)),y=u.some(t=>t.test(r)),b=h.some(t=>t.test(r));return o||p||f||v||y||b}function isSDKSource(t){if(!t||"string"!=typeof t)return![];const n=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return n.some(n=>n.test(t))}const t={BETA:"beta",LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},i={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},o={DRAWER:"drawer",INPUT:"input",BIRTHDATE_INPUT:"birthdate-input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},r={ON_DEMAND:"onDemand",SHIPPING:"shipping"},s={NONE:"none",CONSOLE:"console",PANEL:"panel"},c={[t.BETA]:"https://elements-services-beta-948630220003.us-central1.run.app",[t.LOCAL]:"http://127.0.0.1:8080",[t.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[t.STAGING]:"https://staging-elements.liquidcommerce.us",[t.PRODUCTION]:"https://elements.liquidcommerce.us"},d={STANDARD:"standard"},u={PERSONALIZATION:"personalization",PRE_ORDER:"pre-order",DELIVERY_OPTIONS:"delivery-options"},h={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040};class 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,n){const i=SingletonManager.getInstances();i.has(t)||i.set(t,n());const o=i.get(t);if(!o)throw new SDKError("ElementsSdk: Instance for class "+t+" could not be created.");return o}static async getClient(t){const n=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),i="LiquidCommerceElementsClient_"+n,o=SingletonManager.getInstances();if(o.has(i))return o.get(i);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const r=new SingletonManager.clientConstructor(t);return await r.prepare(),o.set(i,r),r}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const p="lce",f={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},mainImage:null,region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:r.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,drawer:{isOpen:![],contentConfig:null},rerender:![]},v={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee:0,giftCardTotal:0,deliveryFee:0,discounts:0,quantity:0},promoCode:null,fulfillments:{},rerender:![],shouldReset:![],updatedAt:"",createdAt:"",events:[]},y={token:"",cartId:"",loading:![],updating:![],error:null,warning:[],presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddressTwo:"",promoCode:null,giftCards:[],orderNumber:null,items:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,platform:0,tax:0,engraving:0,giftCards:0,service:0,tip:0,details:{taxes:{bag:0,bottleDeposits:0,retailDelivery:0,products:0,delivery:0,shipping:0},discounts:{products:0,delivery:0,shipping:0,service:0,engraving:0}}},rerender:![],onDemandFulfillmentTipInfo:{},tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},b={drawer:{isOpen:![],contentConfig:null}},x={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},w={products:{},cart:v,address:x,checkout:y,ui:b};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,n={}){this.validateInputs(t,n),this.config=Object.freeze(this.buildConfiguration(t,n))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,n){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[t]:n})}isBeta(){return this.get("env")===t.BETA}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===s.CONSOLE||t===s.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===s.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===s.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}getProxyConfig(){return this.get("proxy")}validateInputs(n,i){if(!(null==n?void 0:n.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(i.env&&!Object.values(t).includes(i.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+i.env+'". Using default environment.'),i.env=void 0),void 0!==i.isBuilder&&"boolean"!=typeof i.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),i.isBuilder=void 0),void 0===i.debugMode||Object.values(s).includes(i.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+i.debugMode+'". Must be one of: '+Object.values(s).join(", ")+". Using default value."),i.debugMode=void 0),i.promoTicker&&"object"!=typeof i.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),i.promoTicker=void 0),i.promoTicker)if(Array.isArray(i.promoTicker)){const t=i.promoTicker.filter((t,n)=>{if("string"!=typeof t.promoCode||!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof t.separator||!t.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom is required. Skipping this promo."),![];const i="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(i instanceof Date)||Number.isNaN(i.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil is required. Skipping this promo."),![];const o="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return o instanceof Date&&!Number.isNaN(o.getTime())?i>=o?(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});i.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),i.promoTicker=void 0;i.proxy&&("object"!=typeof i.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),i.proxy=void 0):i.proxy.baseUrl&&"string"==typeof i.proxy.baseUrl?i.proxy.headers&&"object"!=typeof i.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),i.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),i.proxy=void 0))}buildConfiguration(n,i){var o,r;const d=i.env||t.STAGING,u=c[d],h=d===t.PRODUCTION,f=null!==(o=i.isBuilder)&&void 0!==o?o:![],v=p+(h?"":"_"+d)+(f?"builder":"");return{apiKey:n.trim(),env:d,isBuilder:f,debugMode:null!==(r=i.debugMode)&&void 0!==r?r:s.NONE,baseUrl:u,partnerCode:void 0,partnerName:void 0,customTheme:i.customTheme||null,proxy:i.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:v,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:i.promoTicker||null,paymentMethodId:i.paymentMethodId}}detectDeviceType(){var t,n;if("undefined"==typeof navigator)return"desktop";const i=navigator.userAgent.toLowerCase(),o="ontouchstart"in window||navigator.maxTouchPoints>0,r=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,s=(null===(n=window.screen)||void 0===n?void 0:n.height)||0,c=Math.max(r,s),d=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],u=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return d.some(t=>t.test(i))?"tablet":u.some(t=>t.test(i))||o&&c<768?"mobile":o&&c>=768&&c<=1200||o&&/macintosh/i.test(i)&&navigator.maxTouchPoints>1||/android/i.test(i)&&o&&c>=768||/windows nt/i.test(i)&&o&&c>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(i),"desktop")}}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 n=(new Date).toISOString().slice(11,23);return["%c["+n+"%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,n){if(this.sendToTelemetry("debug",t,void 0,n),!this.enableLogging)return;const[i,...o]=this.getPrefix("debug");void 0!==n?console.debug(i,...o,t,n):console.debug(i,...o,t)}info(t,n){if(!this.enableLogging)return;const[i,...o]=this.getPrefix("info");void 0!==n?console.info(i,...o,t,n):console.info(i,...o,t)}warn(t,n){if(this.sendToTelemetry("warn",t,void 0,n),!this.enableLogging)return;const[i,...o]=this.getPrefix("warn");void 0!==n?console.warn(i,...o,t,n):console.warn(i,...o,t)}error(t,n){const i=n instanceof Error,o=i?n:void 0,r=!i&&n?n:void 0;if(this.sendToTelemetry("error",t,o,r),!this.enableLogging)return;const[s,...c]=this.getPrefix("error");void 0!==n?console.error(s,...c,t,n):console.error(s,...c,t)}sendToTelemetry(t,n,i,o){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,n,{context:this.context,error:i,data:o})}catch(r){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const n=this.getInstances();if(!n.has(t)){const i=LoggerService.getInstance(t);i.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&i.setTelemetryService(this.telemetryService),n.set(t,i)}return n.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const n=this.getInstances();for(const[,i]of n)i.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const n=this.getInstances();for(const[,i]of n)i.setTelemetryService(t)}}function componentError({componentType:t,message:n}){const i=document.createElement("div");i.className=t;const o=i.attachShadow({mode:"closed"}),r=document.createElement("style");r.textContent='\n div {\n padding: 10px;\n background-color: #1d4ed81a;\n border-radius: 6px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: #d63031;\n line-height: 1.4;\n margin-bottom: 5px;\n }\n\n p {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n color: #18181B;\n line-height: 1.5;\n max-width: 350px;\n }\n ';const s=document.createElement("div"),c=document.createElement("h3");c.textContent="Component </"+t+">";const d=document.createElement("p");return d.textContent=n,s.appendChild(r),s.appendChild(c),s.appendChild(d),o.appendChild(s),i}function productionComponentError({title:t,message:n,componentType:i}){const o=document.createElement("div");o.setAttribute("data-component-type",i);const r=o.attachShadow({mode:"closed"}),s=document.createElement("style");s.textContent="\n div {\n padding: 20px;\n background-color: #1d4ed81a;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: Poppins, sans-serif;\n max-width: 512px;\n display: block;\n }\n\n h2 {\n color: #18181B;\n margin: 0 0 8px 0;\n font-size: 18px;\n font-style: normal;\n font-weight: 600;\n line-height: 18px;\n text-transform: lowercase;\n }\n\n h2::first-letter {\n text-transform: uppercase;\n }\n\n p {\n color: #18181B;\n font-size: 14px;\n font-style: italic;\n font-weight: 400;\n line-height: 20px;\n margin: 0;\n }\n ";const c=document.createElement("div"),d=document.createElement("h2");d.textContent=t;const u=document.createElement("p");return u.textContent=n,c.appendChild(s),c.appendChild(d),c.appendChild(u),r.appendChild(c),o}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,n){ComponentFactoryService.getComponentRegistry().set(t,n)}static createElement(t){try{const n=ComponentFactoryService.getComponentRegistry().get(t.type);if(!n)throw new SDKError("Component type ["+t.type+"] is not registered");const i=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(i)||window.customElements.define(i,n);const r=document.createElement(i);if(r.initialize){const{type:n,useShadowDom:o,wrapInLceElement:s,...c}=t,d={type:n,tagName:i,useShadowDom:o&&s!==!![]};r.initialize({data:c,config:d})}if(t.wrapInLceElement){const n=ComponentFactoryService.getComponentRegistry().get(o.LCE_ELEMENT),i=ComponentFactoryService.getComponentTagName(o.LCE_ELEMENT);window.customElements.get(i)||window.customElements.define(i,n);const s=document.createElement(i);return s.initialize(t.type,r),s}return r}catch(n){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",n),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==n?void 0:n.message)||n})}}static componentError({componentType:t,message:n}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+n),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:n})}static getComponentTagName(t){const n={[o.DRAWER]:"drawer-lc",[o.INPUT]:"input-lc",[o.BIRTHDATE_INPUT]:"birthdate-input-lc",[o.ENGRAVING_FORM]:"engraving-form-lc",[o.ENGRAVING_VIEW]:"engraving-view-lc",[o.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[o.POWERED_BY]:"powered-by-lc",[o.LCE_ELEMENT]:"lce-element",[o.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[o.ALERT]:"alert-lc",[o.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[o.ADDRESS]:"address-lc",[o.ADDRESS_INPUT]:"address-input-lc",[o.ADDRESS_DISPLAY]:"address-display-lc",[o.PRODUCT]:"product-lc",[o.PRODUCT_OPTIONS]:"product-options-lc",[o.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[o.PRODUCT_INTERACTIONS]:"product-interactions-lc",[o.PRODUCT_DESCRIPTION]:"product-description-lc",[o.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[o.PRODUCT_RETAILERS]:"product-retailers-lc",[o.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[o.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[o.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[o.PRODUCT_PRICE]:"product-price-lc",[o.PRODUCT_DRAWER]:"product-drawer-lc",[o.PRODUCT_LOADING]:"product-loading-lc",[o.PRODUCT_LIST]:"product-list-lc",[o.PRODUCT_LIST_CARD]:"product-list-card-lc",[o.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[o.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[o.CART]:"cart-lc",[o.CART_RETAILER]:"cart-retailer-lc",[o.CART_ITEM]:"cart-item-lc",[o.CART_FOOTER]:"cart-footer-lc",[o.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[o.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[o.CART_PROMO_CODE]:"cart-promo-code-lc",[o.CART_HEADER]:"cart-header-lc",[o.CART_BODY]:"cart-body-lc",[o.CART_FULFILLMENT]:"cart-fulfillment-lc",[o.CHECKOUT]:"checkout-lc",[o.CHECKOUT_INFORMATION]:"checkout-information-lc",[o.CHECKOUT_PAYMENT]:"checkout-payment-lc",[o.CHECKOUT_PAYMENT_SUMMARY]:"checkout-payment-summary-lc",[o.CHECKOUT_STRIPE_HANDLER]:"checkout-stripe-handler-lc",[o.CHECKOUT_STRIPE_FORM]:"checkout-stripe-form-lc",[o.CHECKOUT_BILLING]:"checkout-billing-lc",[o.CHECKOUT_ORDER_SUMMARY]:"checkout-order-summary-lc",[o.CHECKOUT_PROMO_CODE]:"checkout-promo-code-lc",[o.CHECKOUT_GIFT_CARDS]:"checkout-gift-cards-lc",[o.CHECKOUT_AMOUNTS]:"checkout-amounts-lc",[o.CHECKOUT_ITEMS]:"checkout-items-lc",[o.CHECKOUT_COMPLETED]:"checkout-completed-lc",[o.CHECKOUT_DELIVER_TO]:"checkout-deliver-to-lc",[o.CHECKOUT_DELIVER_TO_SUMMARY]:"checkout-deliver-to-summary-lc",[o.CHECKOUT_BUYER]:"checkout-buyer-lc",[o.CHECKOUT_BUYER_SUMMARY]:"checkout-buyer-summary-lc",[o.CHECKOUT_TIPS]:"checkout-tips-lc",[o.CHECKOUT_PC_GC]:"checkout-pc-gc-lc",[o.CHECKOUT_ITEM]:"checkout-item-lc",[o.CHECKOUT_ITEM_QUANTITY]:"checkout-item-quantity-lc",[o.CHECKOUT_PLACE_ORDER_BUTTON]:"checkout-place-order-button-lc",[o.CHECKOUT_HEADER]:"checkout-header-lc",[o.CHECKOUT_PRESALE_COUNTDOWN]:"checkout-presale-countdown-lc",[o.CHECKOUT_PRESALE_EXPIRED]:"checkout-presale-expired-lc",[o.CHECKOUT_SEND_AS_GIFT]:"checkout-send-as-gift-lc"};return n[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,n){this.publishSpecific("actions."+t,n)}publishForm(t,n){this.publishSpecific("forms."+t,n)}publishSpecific(t,n){const[i,o]=t.includes(".")?t.split(".",2):["actions",t];let r=o.split("_")[0];["product","cart","address","checkout"].includes(r)||(r="other");const s=Date.now(),c={eventId:"evt_"+s+"_"+Math.random().toString(36).slice(2,9),namespace:i,event:o,originalEvent:t,actionNamespace:"actions"===i?r:void 0,timestamp:s},d={data:n,metadata:c};this.dispatchNativeEvents(t,d)}dispatchNativeEvents(t,n){const[i]=t.split(".",2);try{"actions.client_ready"===t&&(this.clientReadyEvent=n);const o=new CustomEvent(this.eventPrefix+":"+t,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(o);const r=new CustomEvent(this.eventPrefix+":"+i,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(r)}catch(o){this.logger.error("Error dispatching native events for "+t,o)}}setupClientReadyBuffering(){const t=window.addEventListener,n=this.eventPrefix+":actions.client_ready";window.addEventListener=(i,o,r)=>{if(i!==n)return t.call(window,i,o,r);if(!this.clientReadyEvent)return t.call(window,i,o,r);try{const t=new CustomEvent(n,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof o?o(t):o&&"function"==typeof o.handleEvent&&o.handleEvent(t)}catch(s){this.logger.error("Error replaying CLIENT_READY event",s)}return t.call(window,i,o,r)}}}function centToDollar(t){return t/100}function formatCentToDollarText(t,n=!![]){const i=Math.floor(t/100),o=t%100;let r="$"+i.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(n||o>0)&&(r+=".",r+=o<10?"0"+o:o.toString()),r}function htmlStringToElement(t){const n=document.createElement("template");return n.innerHTML=t.trim(),n.content.firstElementChild}function format24TimeTo12$1(t){const n=t.match(/^(\d{1,2}):(\d{2})$/);if(!n)throw new SDKError("Invalid time format: "+t);const i=Number.parseInt(n[1],10),o=Number.parseInt(n[2],10);if(i<0||i>23||o<0||o>59)throw new SDKError("Invalid time values: "+t);const r=i>=12?"PM":"AM",s=i%12||12;return s+":"+o.toString().padStart(2,"0")+" "+r}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const n=new Date(t);if(Number.isNaN(n.getTime()))return"";const i=(n.getMonth()+1).toString().padStart(2,"0"),o=n.getDate().toString().padStart(2,"0"),r=n.getFullYear().toString();return i+"/"+o+"/"+r}catch(n){return""}}function buildFormattedAddressString(t){const n=[],i=[];t.one&&t.one.trim()&&i.push(t.one.trim()),t.two&&t.two.trim()&&i.push(t.two.trim()),i.length>0&&n.push(i.join(" ")),t.city&&t.city.trim()&&n.push(t.city.trim());const o=[];return t.state&&t.state.trim()&&o.push(t.state.trim()),t.zip&&t.zip.trim()&&o.push(t.zip.trim()),o.length>0&&n.push(o.join(" ")),t.country&&t.country.trim()&&n.push(t.country.trim()),n.join(", ")}function capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const n=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:n[0]||"",category2:n[1]||"",category3:n[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async getAllConfigs(){try{this.ensureClientInitialized();const t=await this.client.get("/configs");if(!this.validResponseData(t))throw this.logger.error("Invalid response data",t),new SDKError("Failed to fetch all configs: Invalid response data");return t.data}catch(t){throw this.logger.error("Error fetching configs",t),t}}async setPersistedStore(t,n){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!n||0===Object.keys(n).length)return this.logger.error("No data provided to set persisted store"),void 0;const i=await this.client.post("/configs/store/"+t,{body:n});200!==i.statusCode&&this.logger.error("Failed to set persisted store",i)}catch(i){this.logger.error("Error setting persisted store",i)}}async getPersistedStore(t){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to get persisted store"),null;const n=await this.client.get("/configs/store/"+t);return 200!==n.statusCode?(this.logger.error("Failed to fetch persisted store",n),null):n.data}catch(n){return this.logger.error("Error fetching persisted store",n),null}}async deletePersistedStore(t){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;const n=await this.client.delete("/configs/store/"+t);200!==n.statusCode&&this.logger.error("Failed to delete persisted store",n)}catch(n){this.logger.error("Error deleting persisted store",n)}}async getProductsData(t,n){try{if(this.ensureClientInitialized(),0===t.length)return this.logger.error("No product identifiers provided"),null;const i={upcs:t,ids:t,grouping:t,shouldShowOffHours:!![],isLegacy:!![],loc:n},o=await this.client.post("/cloud/catalog/availability",{body:i});return 200!==o.statusCode?(this.logger.error("Failed to fetch product data",o),null):{products:o.products,retailers:o.retailers}}catch(i){return this.logger.error("Error fetching product data",i),null}}async getCartData(t){try{this.ensureClientInitialized();const n=await this.client.get("/cloud/cart"+(t?"?id="+t:""));if(200!==n.statusCode)throw this.logger.error("Failed to fetch cart data",n),new SDKError("Failed to fetch cart data: "+n.message);return n.cart}catch(n){throw this.logger.error("Error fetching cart data",n),n}}async updateCart(t){try{this.ensureClientInitialized();const n=await this.client.put("/cloud/cart",{body:t});if(200!==n.statusCode)throw this.logger.error("Failed to update cart",n),new SDKError("Failed to update cart: "+n.message);return n.cart}catch(n){throw this.logger.error("Error updating cart",n),n}}async getAddressSuggestions(t){try{if(this.ensureClientInitialized(),!t||0===t.trim().length)return this.logger.error("Query is required to fetch address suggestions"),[];const n=await this.client.get("/cloud/address/autocomplete?input="+t);return 200!==n.statusCode?(this.logger.error("Failed to fetch address suggestions",n),[]):n.data}catch(n){return this.logger.error("Error fetching address suggestions",n),[]}}async getAddressDetails(t){try{if(this.ensureClientInitialized(),!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 n=await this.client.get("/cloud/address/details/"+t);if(200!==n.statusCode)throw this.logger.error("Failed to fetch address details",n),new SDKError("Failed to fetch address details: "+n.message);return n.data}catch(n){throw this.logger.error("Error fetching address details",n),n}}async prepareCheckout(t){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/checkout/prepare",{body:t});if(200!==n.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",n),new SDKError("Failed to fetch prepare checkout data: "+n.message);return n.checkout}catch(i){throw this.logger.error("Error fetching prepare checkout data:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),i}}async getPaymentSession(t){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/payment/session",{body:t});if(201!==n.statusCode)throw this.logger.error("Failed to get payment session",n),new SDKError("Failed to get payment session: "+n.message);return n.data}catch(i){throw this.logger.error("Error fetching payment session:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),i}}async confirmPaymentSession(t,n){try{this.ensureClientInitialized();const i=await this.client.post("/cloud/payment/confirm",{body:{confirmationTokenId:t,setupIntentId:n}});if(200!==i.statusCode)throw this.logger.error("Failed to confirm payment session",i),new SDKError("Failed to confirm payment session: "+i.message);return i.data}catch(i){throw this.logger.error("Error confirming payment session",i),i}}async checkoutComplete(t){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/checkout/complete",{body:t});if(200!==n.statusCode)throw this.logger.error("Failed to complete checkout",n),new SDKError("Failed to complete checkout: "+n.message);return n.order}catch(i){if(this.logger.error("Error completing checkout:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),null==i?void 0:i.error)throw new SDKError(i.error);throw i}}async catalogSearch(t){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/catalog/search",{body:t});if(200!==n.statusCode)throw this.logger.error("Failed to fetch catalog search data",n),new SDKError("Failed to fetch catalog search data: "+n.message);return{products:n.products,retailers:n.retailers,navigation:n.navigation}}catch(i){return this.logger.error("Error fetching catalog search data:",null!==(n=null==i?void 0:i.message)&&void 0!==n?n:i),{products:[],retailers:[],navigation:void 0}}}validResponseData(t){return t.data&&"object"==typeof t.data&&Object.keys(t.data).length>0}ensureClientInitialized(){if(!this.client)throw new SDKError("API client is not initialized")}}function fetchAdapter(t){return async(n,i)=>{var o;const r=await t(n,i);let s;if("function"==typeof(null===(o=r.headers)||void 0===o?void 0:o.entries))s=Object.fromEntries(r.headers.entries());else{s={};for(const[t,n]of r.headers)s[t]=n}return{ok:r.ok,status:r.status,statusText:r.statusText,headers:s,json:()=>r.json(),text:()=>r.text()}}}const xhrFetch=(t,n)=>new Promise((i,o)=>{const r=new XMLHttpRequest;r.open(n.method||"GET",t);for(const[t,s]of Object.entries(n.headers))r.setRequestHeader(t,s);r.onload=()=>{i({ok:r.status>=200&&r.status<300,status:r.status,statusText:r.statusText,headers:r.getAllResponseHeaders().split("\r\n").reduce((t,n)=>{const[i,o]=n.split(": ");return i&&o&&(t[i]=o),t},{}),json:()=>Promise.resolve(JSON.parse(r.responseText)),text:()=>Promise.resolve(r.responseText)})},r.onerror=()=>{o(new TypeError("Network request failed"))},r.send(n.body)});function getFetchImplementation(){return"undefined"!=typeof fetch?fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?fetchAdapter(global.fetch):window.fetch?fetchAdapter(window.fetch):xhrFetch}class AuthService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=getFetchImplementation(),this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(t))}async authenticate(){var t,n;if(this.isAuthenticating)return await new Promise(t=>{const Z=()=>{this.isAuthenticating?setTimeout(Z,100):t(void 0)};Z()}),!!this.accessToken;this.isAuthenticating=!![];try{const i=await this.request("/auth",{method:"GET"},0,!![]),o=3e5;return this.accessToken=null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.token,this.tokenExpiration=(null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.exp)-o,!![]}catch(i){return this.logger.error("Authentication failed",i),![]}finally{this.isAuthenticating=![]}}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(t,n,i=0,o=![]){o||this.accessToken&&!this.isTokenExpired()||await this.authenticate();const r=this.buildUrl(t),s={"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(),...this.getProxyHeaders(),...n.headers};o?s["X-Liquid-Api-Key"]=this.apiKey:s.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(s["X-Liquid-Api-Builder"]=!![]);const c={method:n.method,headers:s,body:n.body?JSON.stringify(n.body):void 0},d=await this.httpClient(r,c);if(d.ok)try{return await d.json()}catch(h){return this.logger.error("Failed to parse successful response data",h),{message:await d.text().catch(()=>"Success")}}let u;try{u=await d.json()}catch(p){const t=await d.text().catch(()=>"HTTP error status: "+d.status);u={message:t||"Unknown error"},this.logger.error("Failed to parse error response data",p)}if(!o){const r=2,s=(null==u?void 0:u.statusCode)>=5e3&&(null==u?void 0:u.statusCode)<=5010;if(s&&i<r)return this.logger.warn("Authorization error detected (status: "+d.status+", code: "+(null==u?void 0:u.statusCode)+"). Retry attempt "+(i+1)+"/"+r+" in 3 seconds..."),this.accessToken=null,this.tokenExpiration=null,await new Promise(t=>setTimeout(t,3e3)),this.request(t,n,i+1,o)}throw{...u,status:d.status,message:(null==u?void 0:u.message)||"Request failed"}}buildUrl(t){const n=this.clientConfig.getProxyConfig();return new URL("api"+t,n?n.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}async get(t,n){return this.request(t,{method:"GET",headers:null==n?void 0:n.headers})}async post(t,n){return this.request(t,{method:"POST",body:null==n?void 0:n.body,headers:null==n?void 0:n.headers})}async put(t,n){return this.request(t,{method:"PUT",body:null==n?void 0:n.body,headers:null==n?void 0:n.headers})}async delete(t,n){return this.request(t,{method:"DELETE",headers:null==n?void 0:n.headers})}}const C="@liquidcommerce/elements-sdk",k="LiquidCommerce Elements SDK",S="UNLICENSED",E="LiquidCommerce Team",_="2.5.6-beta.16",T="https://docs.liquidcommerce.co/elements-sdk",D={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},P={url:"https://github.com/liquidcommerce/elements-sdk/issues"},F="./dist/index.esm.js",A="./umd/elements.js",z="./dist/types/index.d.ts",O="pnpm@10.0.0",M={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},N=["dist","umd","docs","README.md","LICENSE"],R={access:"public",registry:"https://registry.npmjs.org/"},B="module",q=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],j={build:"rollup -c","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build:dev",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd","clean:hard":"rm -rf dist umd node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},U=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],G={"@biomejs/biome":"2.3.5","@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.1","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.10.1","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.53.2","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"},V={node:">=22"},H={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},W={name:C,description:k,license:S,author:E,version:_,homepage:T,repository:D,bugs:P,module:F,browser:A,types:z,packageManager:O,exports:M,files:N,publishConfig:R,type:B,sideEffects:q,scripts:j,keywords:U,devDependencies:G,engines:V,pnpm:H};class GoogleTagManagerService{constructor(){this.partnerEnableGaTracking=![],this.liquidCommerceEnableGaTracking=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){if("function"==="object".gtag)return!![];const t=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return t.length>0}isContainerLoaded(t){const n=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return n.some(n=>{const i=n.src;return i.includes("id="+t)})}isContainerInitialized(t){if(!window.dataLayer||!Array.isArray(window.dataLayer))return![];if(!this.isContainerLoaded(t))return![];const n=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));return n||window.dataLayer.length>0}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...t)=>window.dataLayer.push(t),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(t){return new Promise((n,i)=>{if(this.isContainerInitialized(t))return this.logger.info("GTM container "+t+" already loaded and initialized, skipping script injection"),n(),void 0;if(this.isContainerLoaded(t)){this.logger.info("GTM container "+t+" script present, checking initialization status");const o=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(o),clearTimeout(r),this.logger.info("GTM container "+t+" initialized successfully"),n())},100),r=setTimeout(()=>{clearInterval(o),i(new Error("GTM container "+t+" script present but failed to initialize (possible CSP or network issue)"))},1e4);return}this.logger.info("Loading GTM container "+t);const o=document.createElement("script");o.src="https://www.googletagmanager.com/gtm.js?id="+t,o.async=!![],o.crossOrigin="anonymous";const r=setTimeout(()=>{this.isContainerInitialized(t)?(this.logger.info("GTM container "+t+" initialized despite timeout warning"),n()):i(new Error("GTM script timeout: "+t+" (possible network issue or CSP blocking)"))},15e3);let s=![];o.onload=()=>{s||(s=!![],setTimeout(()=>{if(clearTimeout(r),this.isContainerInitialized(t))this.logger.info("GTM container "+t+" loaded and initialized successfully"),n();else{const o="GTM container "+t+" script loaded but failed to initialize. This may indicate a Content Security Policy (CSP) issue or network error.";this.logger.warn(o),window.dataLayer&&Array.isArray(window.dataLayer)?(this.logger.info("dataLayer available, continuing with GTM initialization"),n()):i(new Error(o))}},500))},o.onerror=o=>{s||setTimeout(()=>{if(this.isContainerLoaded(t)&&this.isContainerInitialized(t))return s||(s=!![],clearTimeout(r),this.logger.info("GTM container "+t+" loaded successfully despite error event (Safari quirk)"),n()),void 0;if(!s){s=!![],clearTimeout(r);let n="GTM script failed to load: "+t;"string"==typeof o?n+=". Error: "+o:o instanceof ErrorEvent&&o.message?n+=". Error: "+o.message:o instanceof Event&&(n+=". Event type: "+o.type);const c=n+". Possible causes: Content Security Policy (CSP) blocking, network failure, or invalid container ID.";this.logger.error(c,{event:o}),i(new Error(c))}},100)},o.addEventListener("error",n=>{s||this.logger.error("GTM script error event for "+t,n)}),document.head.appendChild(o)})}processEventQueue(){const t=Date.now(),n=this.eventQueue.filter(n=>t-n.timestamp<3e4);for(const o of n)try{const t={event:o.eventName,...o.eventData};window.dataLayer.push(t),"function"==="object".gtag&&window.gtag("event",o.eventName,o.eventData),this.logger.debug("Processed queued GTM event: "+o.eventName,{data:o.eventData})}catch(i){this.logger.error("Error processing queued event "+o.methodName,i)}this.eventQueue=[],n.length>0&&this.logger.info("Processed "+n.length+" queued GTM events")}getSendToTargets(){const t=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&(!this.isContainerLoaded(this.liquidCommerceGtmId)&&this.isGTMAlreadyLoaded()||t.push(this.liquidCommerceGtmId)),this.partnerEnableGaTracking&&this.partnerGtmId&&(this.isGTMAlreadyLoaded()||this.isContainerLoaded(this.partnerGtmId))&&t.push(this.partnerGtmId),0===t.length&&this.isGTMAlreadyLoaded()&&this.logger.debug("No specific targets configured, letting GTM route events naturally"),t}async initialize(t){if(this.isInitialized||this.isInitializing)return this.initializationPromise;if(!this.clientConfigService.isBuilder()){this.isInitializing=!![],this.initializationPromise=this.doInitialize(t);try{await this.initializationPromise}catch(n){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",n)}}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGtmId))throw new SDKError("GTM config missing required fields");if(!t.liquidCommerceEnableGaTracking&&!t.partnerEnableGaTracking)return this.logger.warn("GTM initialization skipped: No tracking enabled"),this.isInitialized=!![],this.isInitializing=![],void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerGtmId=t.partnerGtmId,this.liquidCommerceGtmId=t.liquidCommerceGtmId,this.partnerEnableGaTracking=t.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=t.liquidCommerceEnableGaTracking;const n=this.isGTMAlreadyLoaded();n&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let i=![],o="";if(t.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(t.liquidCommerceGtmId),i=!![],o=n?"GTM integrated with existing setup (Partner GTM detected, LC container: "+t.liquidCommerceGtmId+")":"GTM initialized with container "+t.liquidCommerceGtmId}catch(r){const t=(null==r?void 0:r.message)||String(r);this.logger.error("Failed to load LiquidCommerce GTM container: "+t+". Checking if partner GTM is available.",r),window.dataLayer&&Array.isArray(window.dataLayer)&&window.dataLayer.length>0&&this.logger.warn("LiquidCommerce GTM script failed, but dataLayer is available. Attempting to proceed with existing GTM setup.")}if(i||(n&&window.dataLayer&&Array.isArray(window.dataLayer)&&(this.isContainerInitialized(t.partnerGtmId||"")||window.dataLayer.length>0)&&(i=!![],o="GTM integrated with existing partner setup (LiquidCommerce container failed to load)",this.logger.info("Using partner GTM as fallback after LiquidCommerce GTM load failure")),!i&&window.dataLayer&&Array.isArray(window.dataLayer)&&(i=!![],o="GTM initialized with dataLayer (basic functionality available, container script may have failed)",this.logger.warn("LiquidCommerce GTM container failed to load, but using basic dataLayer for event tracking"))),!i)throw this.isInitializing=![],new SDKError("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(o),this.processEventQueue()}executeEvent(t,n,i){try{if(this.clientConfigService.isBuilder())return;const o=this.getSendToTargets(),r={...i,...o.length>0&&{send_to:o},tenant_source:W.description+" v"+W.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:n,eventData:r,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+n+" (initialization pending)",{data:r}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+n+" skipped: dataLayer not available"),void 0;const s={event:n,...r};window.dataLayer.push(s),"function"==="object".gtag&&window.gtag("event",n,r),this.logger.debug("Sent GTM event: "+n,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:o.length>0?o:"no targeting",data:r})}catch(o){this.logger.error("GTM "+t+" error",o)}}calculateValue(t){const n=t.reduce((t,n)=>t+(n.price||0)*(n.quantity||1),0);return Number.parseFloat(n.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,n,i){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:n,item_list_name:i,items:t})}selectItem(t,n,i){this.executeEvent("selectItem","select_item",{item_list_id:n,item_list_name:i,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,n){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:n,items:t})}addShippingInfo(t,n){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:n,items:t})}addPaymentInfo(t,n,i){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:n,coupon:i,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,n){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:n})}promoCodeFailed(t,n){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:n})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,n){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:n})}giftCardFailed(t,n){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:n})}addressUpdated(t){this.executeEvent("addressUpdated","address_updated",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,coordinates:t.coordinates})}addressFailed(t){this.executeEvent("addressFailed","address_failed",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,address_error_message:t.error})}productNoAvailability(t){this.executeEvent("productNoAvailability","product_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productSizeNoAvailability(t){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productFulfillmentNoAvailability(t){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,fulfillment_type:t.fulfillmentType,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:n,next:i})=>{const o=performance.now();try{const r=i(),s=performance.now()-o;return this.logger.info("🏪 Store "+t+" ✓ "+s.toFixed(3)+"ms",n),r}catch(r){const i=performance.now()-o;throw this.logger.error("🏪 Store "+t+" ✗ "+i.toFixed(3)+"ms",{payload:n,error:r}),r}},this.performanceMiddleware=({action:t,next:n})=>{const i=performance.now(),o=n(),r=performance.now()-i;return r>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+r.toFixed(2)+"ms"),o},this.state=w,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable:n,persistedStore:i}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+t,this.isLocalStorageAvailable=n,n?await this.loadPersistedState():i&&await this.loadFromDBPersistence(i),this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:n,hasPersistedState:null!==i,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const n=t.split(".");let i=this.state;for(const o of n){if(null==i)return;i=i[o]}return void 0!==i?Array.isArray(i)?[...i]:"object"==typeof i&&null!==i?{...i}:i:void 0}set(t,n){return this.runWithMiddleware("set",{path:t,value:n},()=>{const i=this.get(t);return this.state=this.immutableSet(this.state,t,n),this.notifyListeners(t,n,i),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,n){const i=this.get(t),o=n(i);return this.set(t,o)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const n=this.get(t);if(void 0===n)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const i=t.split(".");let o=this.state;const r=i.pop();for(const s of i){if(void 0===o[s])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];o=o[s]}if(Array.isArray(o))o=o.filter((t,n)=>n!==Number.parseInt(r,10));else{if("object"!=typeof o||null===o)return this.logger.warn('Cannot remove property "'+r+'" from non-object type at path "'+t+'".'),![];{const{[r]:t,...n}=o;o=n}}return this.state=this.immutableSet(this.state,i.join("."),o),this.notifyListeners(t,void 0,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const n=[];if("function"==typeof t){const i=t(this.state);for(const[t,o]of Object.entries(i)){const i=this.get(t);n.push({path:t,oldValue:i,newValue:o,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,o)}}else for(const[i,o]of Object.entries(t)){const t=this.get(i);n.push({path:i,oldValue:t,newValue:o,timestamp:Date.now()}),this.state=this.immutableSet(this.state,i,o)}for(const{path:t,oldValue:i,newValue:o}of n)this.notifyListeners(t,o,i);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,n){const i=t;return this.listeners.has(i)||this.listeners.set(i,new Set),this.listeners.get(i).add(n),()=>{var t;null===(t=this.listeners.get(i))||void 0===t?void 0:t.delete(n)}}watchMany(t,n){const i=[];let o;const r=t.map(t=>this.watch(t,(r,s)=>{i.push({path:t,value:r,oldValue:s}),clearTimeout(o),o=setTimeout(()=>{i.length>0&&(n([...i]),i.length=0)},0)}));return()=>{for(const t of r)t()}}createProductInstance(t){const n="products."+t,i=this.get(n);return i?!![]:this.set(n,f)}removeProductInstance(t){const n=this.get("products"),{[t]:i,...o}=n;return this.set("products",o)}getProductInstances(){return this.get("products")}getState(){return{...this.state}}setupMiddleware(){this.middleware.push(this.loggingMiddleware),this.middleware.push(this.performanceMiddleware)}runWithMiddleware(t,n,i){let o=0;const Y=()=>{if(o>=this.middleware.length)return i();const r=this.middleware[o++];return r({action:t,payload:n,state:this.getState(),next:Y})};return Y()}immutableSet(t,n,i){const o=n.split(".");if(1===o.length){if(Array.isArray(t)){const n=[...t];return n[o[0]]=i,n}return{...t,[o[0]]:i}}const[r,...s]=o,c=t[r],d=Array.isArray(c)?[]:{};if(Array.isArray(t)){const n=[...t];return n[r]=this.immutableSet(c||d,s.join("."),i),n}return{...t,[r]:this.immutableSet(c||d,s.join("."),i)}}notifyListeners(t,n,i){const o=this.listeners.get(t);if(o)for(const d of o)try{d(n,i)}catch(s){this.logger.error('Error in store listener for path "'+t+'"',s)}const r=t.split(".");for(let d=r.length-1;d>0;d--){const t=r.slice(0,d).join("."),n=this.listeners.get(t);if(n){const o=this.get(t),s=r.slice(d).join("."),u=this.immutableSet(o,s,i);for(const i of n)try{i(o,u)}catch(c){this.logger.error('Error in store listener for parent path "'+t+'"',c)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var t;const n=this.get("address.id")||"",i=this.get("cart.id")||"";if(!n&&!i)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:n,cartId:i}),void 0;try{const o=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(o,{p:n,c:i}),this.logger.info("Session data persisted to DB",{userDeviceId:o,addressId:n,cartId:i})}catch(o){this.logger.error("Failed to persist session data to DB",o)}}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(W){this.logger.error("Failed to clear localStorage entry",W)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const n=this.get("address.id")||"",i=this.get("cart.id")||"";(n||i)&&(t=n+":"+i)}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 n=localStorage.getItem(this.localStorageKey);if(!n)return;try{const t=JSON.parse(n);for(const[n,i]of Object.entries(t))this.set(n,i);return}catch(t){if(n.includes(":")){const[t,i]=n.split(":");if(void 0!==t){const n=await this.getAddressDataFromId(t);this.set("address",n)}return void 0!==i&&this.set("cart.id",i||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:n})}}catch(n){this.logger.error("Failed to load persisted state",n),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const n=await this.getAddressDataFromId(t.p);this.set("address",n)}void 0!==t.c&&this.set("cart.id",t.c||null),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(n){this.logger.error("Failed to load session data from DB persistence",n)}}async getAddressDataFromId(t){if(!t||""===t.trim())return x;try{const n=await this.api.getAddressDetails(t);return n&&0!==Object.keys(n).length?{id:t,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:{lat:n.coords.lat,long:n.coords.long}}:{...x,id:t}}catch(n){return{...x,id:t}}}}const X=[o.PRODUCT,o.PRODUCT_IMAGE_CAROUSEL,o.PRODUCT_OPTIONS,o.PRODUCT_INTERACTIONS,o.PRODUCT_DESCRIPTION,o.PRODUCT_RETAILERS,o.PRODUCT_RETAILERS_CAROUSEL,o.PRODUCT_RETAILERS_POPUP,o.PRODUCT_RETAILERS_POPUP_LIST,o.PRODUCT_PRICE,o.PRODUCT_ADD_TO_CART_SECTION,o.PRODUCT_DRAWER,o.PRODUCT_LOADING,o.ENGRAVING_FORM,o.ENGRAVING_VIEW,o.PRODUCT_LIST,o.PRODUCT_LIST_CARD,o.PRODUCT_LIST_CARD_LOADING,o.PRODUCT_LIST_FILTERS],$=[o.ADDRESS_INPUT,o.ADDRESS_DISPLAY],J=[o.CART,o.CART_RETAILER,o.CART_ITEM,o.CART_FOOTER,o.CART_ITEM_QUANTITY_PRICE,o.CART_RETAILER_SUBTOTAL,o.CART_PROMO_CODE,o.CART_HEADER,o.CART_BODY,o.CART_FULFILLMENT,o.BUTTONS_CART_OPEN],tt=[o.CHECKOUT,o.CHECKOUT_INFORMATION,o.CHECKOUT_STRIPE_HANDLER,o.CHECKOUT_STRIPE_FORM,o.CHECKOUT_PAYMENT,o.CHECKOUT_BILLING,o.CHECKOUT_ORDER_SUMMARY,o.CHECKOUT_PROMO_CODE,o.CHECKOUT_GIFT_CARDS,o.CHECKOUT_AMOUNTS,o.CHECKOUT_ITEMS,o.CHECKOUT_COMPLETED,o.CHECKOUT_DELIVER_TO,o.CHECKOUT_DELIVER_TO_SUMMARY,o.CHECKOUT_BUYER,o.CHECKOUT_TIPS,o.CHECKOUT_PC_GC,o.CHECKOUT_ITEM,o.CHECKOUT_ITEM_QUANTITY,o.CHECKOUT_PLACE_ORDER_BUTTON,o.CHECKOUT_HEADER,o.CHECKOUT_PRESALE_COUNTDOWN,o.CHECKOUT_PRESALE_EXPIRED,o.CHECKOUT_SEND_AS_GIFT];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,n="swap"){if(!t||0===t.length)return;const i=[...this.defaultFontFamilies,...t],o=i.map(t=>{const n=encodeURIComponent(t.name);return"family="+n+":wght@"+t.weights.join(";")}).join("&"),r="display="+n;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+o+"&"+r,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,n="swap"){const i=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,n),i&&i.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),n=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(!n){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 flex-direction: row;\n align-items: flex-start;\n gap: 24px;\n }\n\n .product-list-filters-container {\n width: 30%;\n height: fit-content;\n position: sticky;\n top: 24px;\n padding: 0;\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 .product-list.has-filters .product-list-cards__container {\n width: 70%;\n }\n\n /* Filters Styles */\n .product-list-filters-header,\n .product-list-filters-personalized,\n .product-list-filters-pre-order,\n .product-list-filters-delivery-options {\n padding: 16px 0 12px 0;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-delivery-options {\n border-bottom: none;\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-personalized,\n .product-list-filters-pre-order {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\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-personalized-label,\n .product-list-filters-pre-order-label {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-delivery-options-header {\n display: flex;\n align-items: center;\n }\n\n .product-list-filters-delivery-options-label {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-delivery-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-delivery-option {\n display: flex;\n align-items: center;\n gap: 14px;\n padding: 12px 16px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n\n .product-list-filters-delivery-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-delivery-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-delivery-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio-label {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-delivery-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:disabled + .product-list-filters-delivery-radio-label {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n input[type="checkbox"].product-list-filters-personalized-switch,\n input[type="checkbox"].product-list-filters-pre-order-switch {\n position: relative;\n width: 52px;\n height: 28px;\n appearance: none;\n background: var(--accent-color, #e5e7eb);\n border-radius: 14px;\n cursor: pointer;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n outline: none;\n border: 2px solid transparent;\n }\n\n input[type="checkbox"].product-list-filters-personalized-switch:checked,\n input[type="checkbox"].product-list-filters-pre-order-switch:checked {\n background: var(--primary-color, #3b82f6);\n border-color: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n }\n\n .product-list-filters-personalized-switch:disabled,\n .product-list-filters-pre-order-switch:disabled {\n background: var(--accent-color-30, #f3f4f6);\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .product-list-filters-personalized-switch::before,\n .product-list-filters-pre-order-switch::before {\n content: \'\';\n position: absolute;\n top: 2px;\n left: 2px;\n width: 20px;\n height: 20px;\n background: var(--selected-text-color, #ffffff);\n border-radius: 50%;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);\n }\n\n .product-list-filters-personalized-switch:checked::before,\n .product-list-filters-pre-order-switch:checked::before {\n transform: translateX(24px);\n }\n\n /* Product List Card Styles */\n .product-list-card.standard {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #f3f4f6);\n border-radius: var(--card-border-radius, 0.375rem);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.fill {\n background-color: #ffffff;\n }\n\n .product-list-card.standard.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card.standard.not-available:hover {\n cursor: not-allowed;\n }\n\n .product-list-card.standard .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n padding-bottom: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .product-list-card.standard .plc__content {\n width: 100%;\n padding: 0 10px;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .product-list-card.standard .plc__content .plc__title {\n width: 100%;\n height: 4.6875rem;\n font-size: 1.125rem;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n margin-bottom: 10px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n line-height: 1.38;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n .product-list-card.standard .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__image-link:hover {\n text-decoration: none;\n }\n\n .product-list-card.standard .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .product-list-card.standard .plc__title-link .plc__title {\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n font-family: var(--paragraph-font-family, Poppins);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 10px;\n font-weight: 300;\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 1rem;\n font-weight: 600;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: auto;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n padding: 0.5rem 0.375rem;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #3b82f6);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n 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 gap: 8px;\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 /* Responsive Styles */\n\n /* Mobile - 1 column (default, up to 639px) */\n @media (max-width: 639px) {\n .product-list {\n flex-direction: column;\n flex-wrap: wrap;\n }\n\n .product-list-filters-container {\n width: 100%;\n order: 1;\n position: static;\n top: unset;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: 2;\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 100%;\n }\n\n .product-list-card.standard {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n /* Small tablets - 2 columns (640px and up) */\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list {\n flex-direction: column;\n flex-wrap: wrap;\n }\n\n .product-list-filters-container {\n width: 100%;\n order: 1;\n position: static;\n top: unset;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: 2;\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 100%;\n }\n\n .product-list-card.standard {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n /* Tablets - 3 columns (768px and up) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list {\n flex-direction: row;\n flex-wrap: nowrap;\n }\n\n .product-list-filters-container {\n width: 30%;\n order: unset;\n position: sticky;\n top: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: unset;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 70%;\n }\n\n .product-list-card.standard {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n /* Desktop - Use configured columns (1024px and up) */\n @media (min-width: 1024px) {\n .product-list {\n flex-direction: row;\n flex-wrap: nowrap;\n }\n\n .product-list-filters-container {\n position: sticky;\n top: 24px;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card.standard {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n',getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+h.ADDRESS_SUGGESTIONS+";\n list-style: none;\n overflow-y: auto;\n padding: 4px 0;\n align-self: stretch;\n border-radius: 0 0 6px 6px;\n border-right: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n border-left: 1px solid var(--accent-color, #E4E4E7);\n background: var(--drawer-background-color, #FAFAFA);\n }\n\n .address-input-container .suggestions-list.show {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n .address-input-container .suggestions-list.hide {\n display: none;\n }\n\n .address-input-container .suggestions-list.show {\n display: block;\n }\n\n .address-input-container .suggestion-item {\n display: flex;\n padding: 6px 8px;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n text-align: left;\n }\n\n .address-input-container .suggestion-item > span {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n flex: 1 0 0;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n 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: "+h.ERROR_MESSAGE+";\n }\n\n .address-input-container .error-icon {\n font-size: 16px;\n margin-right: 8px;\n }\n\n .address-input-container .error-text {\n flex: 1;\n }\n\n .address-input-container .action-buttons {\n display: flex;\n justify-content: space-between;\n position: relative;\n z-index: "+h.ADDRESS_ACTIONS+";\n }\n\n .address-input-container .action-buttons > button {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 8px 16px;\n border-radius: var(--button-border-radius, 6px);\n transition: all 0.2s ease;\n width: 50%;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n 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: "+h.CART_HEADER+";\n }\n\n .cart-header-content {\n width: 100%;\n height: 48px;\n display: flex;\n align-items: center;\n align-self: stretch;\n justify-content: space-between;\n padding: 16px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .cart-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--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(--primary-color, #1E40AF);\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: "+h.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .checkout-btn-disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n /* CSS-only accordions */\n .chevron {\n transition: transform 0.3s ease;\n }\n\n /* Product section accordions */\n .section-toggle {\n display: none;\n }\n\n .section-toggle:checked + .section-header-label .chevron {\n transform: rotate(180deg);\n color: var(--default-text-color, #18181B);\n }\n\n .retailer-section.collapsed .retailer-body-container {\n max-height: 0;\n }\n\n .retailer-section.collapsed .cart-retailer-header {\n border-bottom: none;\n }\n\n .shipping-content {\n max-height: 0;\n overflow: hidden;\n transition: max-height 0.3s ease-out;\n padding-left: 20px;\n }\n\n /** * Loading spinner styles */\n .cart-loading-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: var(--drawer-background-color-30, #E4E4E7);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: "+h.CART_LOADING+";\n }\n\n /* Modern browsers with backdrop-filter support */\n @supports (backdrop-filter: blur(1px)) {\n .cart-loading-backdrop {\n background-color: var(--drawer-background-color-30, #E4E4E7);\n backdrop-filter: blur(1px);\n }\n }\n\n .cart-loading-spinner-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n }\n\n .cart-loading-spinner {\n margin-bottom: 16px;\n }\n\n .cart-spinner {\n animation: cart-spinner-rotate 2s linear infinite;\n color: var(--primary-color, #1D4ED8);\n }\n\n .cart-spinner-path {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: 0;\n stroke-linecap: round;\n animation: cart-spinner-dash 1.5s ease-in-out infinite;\n }\n\n @keyframes cart-spinner-rotate {\n 100% {\n transform: rotate(360deg);\n }\n }\n\n @keyframes cart-spinner-dash {\n 0% {\n stroke-dasharray: 1, 150;\n stroke-dashoffset: 0;\n }\n 50% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -35;\n }\n 100% {\n stroke-dasharray: 90, 150;\n stroke-dashoffset: -124;\n }\n }\n\n /*PROMO CODE */\n .promo-container {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n align-self: stretch;\n flex: 1;\n }\n\n .promo-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .promo-container-wrapper {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-code-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .promo-input-wrapper {\n flex: 1;\n }\n\n /* Style the InputComponent container */\n .promo-input-wrapper .custom-input {\n margin: 0;\n width: 100%;\n }\n\n /* Hide label in promo context since we have placeholder */\n .promo-input-wrapper .custom-input label {\n display: none;\n }\n\n /* Style the actual input inside the InputComponent */\n .promo-input-wrapper .promo-input {\n width: 100%;\n padding: 12px 16px;\n border: 1px solid #ddd;\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n transition: border-color 0.2s ease, box-shadow 0.2s ease;\n box-sizing: border-box;\n }\n\n .promo-input-wrapper .promo-input:focus {\n outline: none;\n border-color: var(--primary-color, #1D4ED8);\n }\n\n .promo-input-wrapper .promo-input:disabled {\n background-color: #f8f9fa;\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n .promo-input-wrapper .promo-input.input-error {\n border-color: #dc3545; }\n\n /* Error container styling from InputComponent */\n .promo-input-wrapper .error-container {\n margin-top: 4px;\n min-height: 20px;\n }\n\n .promo-input-wrapper .error-message {\n color: #dc3545;\n font-size: 12px;\n margin: 2px 0;\n display: block;\n }\n\n /* Apply button styling */\n .apply-button {\n display: flex;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n 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(--primary-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: "+h.LOADING_INDICATOR+";\n width: 16px;\n height: 16px;\n border: 2px solid var(--accent-color, #E4E4E7);\n border-top: 2px solid var(--accent-color, #E4E4E7);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: translateY(-50%) rotate(0deg); }\n 100% { transform: translateY(-50%) rotate(360deg); }\n }\n\n .empty-cart-content {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getCheckoutStyles=()=>"\n .checkout-container {\n width: 100%;\n height: auto;\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n align-self: stretch;\n gap: 24px;\n }\n\n .checkout-container:not(.independent) {\n padding: 24px;\n }\n\n .checkout-container.independent {\n padding: 24px;\n }\n\n .checkout-container.no-header .checkout-information-section,\n .checkout-container.no-header .checkout-summary-section {\n padding: 0;\n }\n\n .checkout-information-section {\n min-width: 320px;\n max-width: 512px;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-wrap: wrap;\n flex: 1 0 0;\n }\n\n .checkout-information-section > *:not(:first-child) {\n margin-top: 24px;\n 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: "+h.TOGGLE_SLIDER+";\n height: 16px;\n background-color: var(--accent-color, #ffffff);\n border-radius: 50%;\n transition: transform 0.2s ease;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n }\n\n .toggle-switch.active .toggle-slider {\n transform: translateX(20px);\n }\n\n .section-form-container {\n display: flex;\n flex-direction: column;\n align-self: stretch;\n }\n\n .section-form-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .textarea-message-disclaimer {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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(--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: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+h.FORM_CONTROLS+";\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-end;\n\n cursor: pointer;\n }\n\n .checkout-two-col-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -16px;\n margin-bottom: -16px;\n }\n\n .checkout-two-col-container > * {\n margin-right: 16px;\n margin-bottom: 16px;\n }\n\n .checkout-three-col-container {\n display: flex;\n flex-direction: row;\n }\n\n .checkout-three-col-container > *:not(:first-child) {\n margin-left: 16px;\n }\n\n .checkout-send-to-form.collapsed {\n display: none;\n }\n\n .checkout-send-to-title,\n .checkout-your-info-title,\n .checkout-billing-title,\n .checkout-payment-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--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: "+h.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-align: center;\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child, .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--primary-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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: '+h.CHECKOUT_HEADER+";\n background-color: var(--drawer-background-color, #F9FAFB);\n }\n\n .checkout-header-container {\n display: flex;\n min-width: 320px;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 8px;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-header-button {\n display: flex;\n height: 36px;\n padding: 12px 16px;\n padding-right: 0px;\n justify-content: center;\n align-items: center;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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: "+h.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--primary-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--primary-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-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(--primary-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .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 }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 8px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n gap: 16px;\n flex-direction: row;\n align-items: center;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n 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 gap: 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(--primary-color, #1E40AF);\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 gap: 16px;\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n gap: 4px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 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 gap: 16px;\n align-self: stretch;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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 }\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, .dark .pb-lc {\n color: #0F172A;\n }\n\n .dark .pb-text, .dark .pb-lc, .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 11px;\n font-style: normal;\n font-weight: 500;\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: 500;\n line-height: 16px;\n }\n\n .dark .pb-disclaimer-container, .dark .pb-link {\n color: #FAFAFA;;\n }\n\n .light .pb-disclaimer-container{\n color: #0F172A;\n }\n\n .light .pb-link {\n color: #1D4ED8;\n }\n\n .lce-ui-button {\n display: block;\n position: relative;\n cursor: pointer;\n width: 24px;\n height: 24px;\n }\n\n .lce-ui-button.independent {\n position: absolute;\n top: 12px;\n right: 12px;\n z-index: "+h.INDEPENDENT_BUTTON+';\n }\n\n /* Cart Button Components */\n .lce-cart-button-icon {\n display: block;\n }\n\n .lce-cart-button-badge {\n position: absolute;\n top: -6px;\n right: -6px;\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border-radius: 50%;\n width: 16px;\n height: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 10px;\n font-weight: bold;\n font-family: var(--heading-font-family, Poppins);\n pointer-events: none;\n z-index: 10;\n line-height: 1;\n }\n\n /* Global Icon Styling - Automatic Accent Color Application */\n svg {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n svg path,\n svg circle,\n svg rect,\n svg line,\n svg polygon,\n svg polyline,\n svg ellipse {\n fill: currentColor;\n stroke: currentColor;\n }\n\n /* Respect explicit fill="none" */\n svg [fill="none"] {\n fill: none !important;\n }\n\n /* Specific icon overrides for semantic colors */\n .checkbox-icon {\n color: var(--icon-color, var(--selected-text-color, #FAFAFA));\n }\n\n .error-info-icon {\n color: var(--icon-color, var(--error-color, #DC2626));\n }\n\n .success-icon {\n color: var(--icon-color, var(--success-color, #10b981));\n }\n\n .warning-icon {\n color: var(--icon-color, var(--warning-color, #EA580C));\n }\n\n .info-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .search-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .arrow-right-icon,\n .bag-icon,\n .completed-icon,\n .loading-spinner-icon,\n .trash-icon,\n .chevron-down-icon {\n color: var(--icon-color, var(--accent-color, #E4E4E7));\n }\n\n .chevron-left-icon,\n .close-icon {\n color: var(--icon-color, var(--default-text-color, #18181B));\n }\n\n\n /* Exception for icons that should not inherit color (logos, specific designs) */\n svg[data-no-color-inherit] * {\n fill: initial;\n stroke: initial;\n }\n\n /* Override for stroke-only icons */\n svg[data-stroke-only] * {\n fill: none;\n stroke: currentColor;\n }\n\n /* Override for fill-only icons */\n svg[data-fill-only] * {\n fill: currentColor;\n stroke: none;\n }\n\n /* Tablet and up */\n @media (min-width: 768px) {\n .lce-ui-button.independent {\n top: 16px;\n right: 16px;\n }\n }\n\n /* Desktop */\n @media (min-width: 1024px) {\n .lce-ui-button.independent {\n top: 20px;\n right: 20px;\n }\n }\n\n /** Engraving View Container */\n .engraving-view-container {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n .engraving-view-container {\n width: 100%;\n padding: 16px;\n }\n\n .engraving-view-container.outlined {\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container.filled {\n border-radius: var(--card-border-radius, 6px);\n background: linear-gradient(0deg, var(--alpha-50, rgba(254, 254, 254, 0.50)) 0%, var(--alpha-50, rgba(254, 254, 254, 0.50)) 100%), var(--accent-color, #E4E4E7);\n }\n\n .engraving-view-container .engraving-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n }\n\n .engraving-view-container .engraving-header {\n margin-bottom: 16px;\n }\n\n .engraving-view-container .engraving-header h3,\n .engraving-view-container .engraving-header span {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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(--primary-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: "+h.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n }\n\n .gallery-image {\n width: 60px;\n height: 60px;\n object-fit: cover;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n background: var(--accent-color, #3b82f6);\n opacity: 0.5;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n }\n\n .gallery-image-wrapper.selected .gallery-image {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--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(--primary-color, #1E40AF);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** 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: "+h.LOADING_INDICATOR+";\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n .add-to-cart-container .add-to-cart-button.processing {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .add-to-cart-container .add-to-cart-button.disabled {\n background: var(--primary-color-70, #E4E4E7);\n cursor: not-allowed;\n }\n\n .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 }\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(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+h.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n max-height: 350px;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+h.DRAWER_WRAPPER+";\n pointer-events: none;\n }\n\n .drawer-wrapper.open {\n pointer-events: auto;\n }\n\n /* Backdrop overlay */\n .drawer-backdrop {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.4);\n z-index: "+h.DRAWER_BACKDROP+";\n opacity: 0;\n visibility: hidden;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n pointer-events: none;\n }\n\n .drawer-backdrop.visible {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n /* Main drawer */\n .drawer {\n position: absolute;\n top: 0;\n right: 0;\n width: 400px;\n height: 100vh; /* Fallback for browsers that don't support dvh */\n height: 100dvh;\n z-index: "+h.DRAWER_CONTENT+";\n background-color: #ffffff;\n overflow: hidden;\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n }\n\n /* Opened drawer state */\n .drawer.open {\n transform: translateX(0);\n }\n\n .drawer.address-input .drawer-content,\n .drawer.engraving-form .drawer-content,\n .drawer.product-retailers-popup-list .drawer-content {\n padding: 16px;\n }\n\n /* Content area - fills the remaining space */\n .drawer-content {\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n background-color: var(--drawer-background-color, #FAFAFA);\n }\n\n /* Content swap animation classes */\n .drawer-content-fade-out {\n opacity: 1;\n transition: opacity 150ms ease-out;\n }\n\n .drawer-content-fade-out.fading {\n opacity: 0;\n }\n\n .drawer-content-fade-in {\n opacity: 0;\n transition: opacity 150ms ease-in;\n }\n\n .drawer-content-fade-in.visible {\n opacity: 1;\n }\n\n /* Mobile adjustments */\n @media (max-width: 576px) {\n .drawer {\n width: 100%;\n }\n }\n\n /* Accessibility - respect user's motion preferences */\n @media (prefers-reduced-motion: reduce) {\n .drawer,\n .drawer-backdrop,\n .drawer-content-fade-out,\n .drawer-content-fade-in {\n transition: none;\n }\n }\n "}const getProductLoadingStyles=()=>"\n .skeleton-container {\n min-width: 320px;\n width: 100%;\n height: auto;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n }\n\n .skeleton-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .skeleton-container .wave {\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .skeleton-container .wave::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 100%;\n height: 100%;\n background: linear-gradient(\n 90deg,\n transparent 0%,\n rgba(255, 255, 255, 0.8) 50%,\n transparent 100%\n );\n animation: wave 1.8s infinite ease-in-out;\n z-index: "+h.SKELETON_WAVE+";\n }\n\n .sc-title {\n height: 32px;\n width: 100%;\n }\n\n .sc-sizes {\n height: 36px;\n width: 100%;\n display: flex;\n }\n\n .sc-size-button {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-size-button:not(:first-child) {\n margin-left: 8px;\n }\n\n .sc-row {\n display: flex;\n background: none !important;\n height: auto;\n }\n\n .sc-row > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .sc-price {\n height: 36px;\n width: 30%;\n }\n\n .sc-personalization {\n height: 36px;\n width: 40%;\n margin-right: 0;\n margin-left: auto;\n }\n\n .sc-deliver-to {\n height: 16px;\n width: 25%;\n margin-bottom: -16px;\n }\n\n .sc-address {\n height: 16px;\n width: 75%;\n }\n\n .sc-retailers {\n height: 140px;\n width: 100%;\n }\n\n .sc-quantity {\n height: 36px;\n width: 30%;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-add-to-cart {\n height: 36px;\n flex: 1;\n background-color: #c4d1e0;\n border-radius: 6px;\n position: relative;\n overflow: hidden;\n }\n\n .sc-description-title {\n height: 16px;\n width: 45%;\n margin-bottom: -12px;\n }\n\n .sc-description-line {\n height: 16px;\n width: 100%;\n margin-bottom: -20px;\n }\n\n .sc-description-more {\n height: 16px;\n width: 30%;\n margin-top: 8px;\n }\n\n .sc-title::before { animation-delay: 0s; }\n .sc-price::before { animation-delay: 0.1s; }\n .sc-size-button::before { animation-delay: 0.2s; }\n .sc-price::before { animation-delay: 0.3s; }\n .sc-personalization::before { animation-delay: 0.4s; }\n .sc-deliver-to::before { animation-delay: 0.5s; }\n .sc-address::before { animation-delay: 0.6s; }\n .sc-retailers::before { animation-delay: 0.7s; }\n .sc-quantity::before { animation-delay: 0.8s; }\n .sc-add-to-cart::before { animation-delay: 0.9s; }\n .sc-description-title::before { animation-delay: 1.0s; }\n .sc-description-line:nth-child(10)::before { animation-delay: 1.1s; }\n .sc-description-line:nth-child(11)::before { animation-delay: 1.2s; }\n .sc-description-line:nth-child(12)::before { animation-delay: 1.3s; }\n .sc-description-more::before { animation-delay: 1.4s; }\n\n .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: "+h.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 gap: 8px;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const et={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},nt={backgroundColor:"--product-background-color"},it={backgroundColor:"--cart-background-color"},ot={backgroundColor:"--address-background-color"},rt={backgroundColor:"--checkout-background-color"},st={global:et,product:nt,cart:it,address:ot,checkout:rt};function getCSSVariableMapping(t){return st[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,n){const i={},o=getCSSVariableMapping(n);for(const[r,s]of Object.entries(o)){const n=this.getValueByPath(t,r);void 0!==n&&this.isCSSValue(n)&&(i[s]=n,this.isColorVariable(s,n)&&this.generateOpacityVariants(i,s,n))}return i}extractVariablesFromPartialTheme(t,n){const i={},o=getCSSVariableMapping(n);for(const[r,s]of Object.entries(o))if(this.hasValueAtPath(t,r)){const n=this.getValueByPath(t,r);void 0!==n&&this.isCSSValue(n)&&(i[s]=n,this.isColorVariable(s,n)&&this.generateOpacityVariants(i,s,n))}return i}generateCSSVariablesString(t){return Object.entries(t).map(([t,n])=>" "+t+": "+n+";").join("\n")}updateCSSVariablesInStylesheet(t,n){if(0!==Object.keys(n).length)try{const i=this.findOrCreateRule(t);for(const[t,o]of Object.entries(n))i.style.setProperty(t,String(o))}catch(i){this.logger.warn("Failed to update CSS variables")}}getValueByPath(t,n){return n.split(".").reduce((t,n)=>t&&void 0!==t[n]?t[n]:void 0,t)}hasValueAtPath(t,n){const i=n.split(".");let o=t;for(const r of i){if(null==o||!(r in o))return![];o=o[r]}return!![]}findOrCreateRule(t){const n=":host";for(const o of Array.from(t.cssRules))if(o instanceof CSSStyleRule&&o.selectorText===n)return o;const i=t.insertRule(n+" {}");return t.cssRules[i]}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,n,i){for(const o of this.opacityLevels){const r=n+"-"+o.suffix,s=this.addOpacityToHexColor(i,o.value);s&&(t[r]=s)}}isColorVariable(t,n){if("string"!=typeof n)return![];const i=t.toLowerCase().includes("color"),o=/^#[0-9a-f]{3,8}$/i.test(n);return i&&o}addOpacityToHexColor(t,n){if(!t.startsWith("#"))return null;let i=t.slice(1);if(3===i.length&&(i=i.split("").map(t=>t+t).join("")),6!==i.length)return null;const o=Math.round(255*n),r=o.toString(16).padStart(2,"0");return"#"+i+r}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,n){const i=this.cssProcessor.extractVariablesFromTheme(n,t),o=this.cssProcessor.generateCSSVariablesString(i),r=this.getStylesheetStyles(t).join("\n\n"),s=0===o.length?"":":host { "+o+" }",c=("\n "+s+"\n\n "+r+"\n ").trim();this.createStylesheet(t,c)}createStylesheet(t,n){try{if(this.isCSSStyleSheetSupported()){const i=new CSSStyleSheet;i.replaceSync(n),this.styleSheets.set(t,i)}else this.styleSheets.set(t,n)}catch(W){this.styleSheets.set(t,n)}}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,n,i){const o=this.styleSheets.get(t);if(o&&"string"!=typeof o){const t=this.cssProcessor.extractVariablesFromPartialTheme(n,i);this.cssProcessor.updateCSSVariablesInStylesheet(o,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles(),getProductListStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme)}updateComponentGlobalConfigs(t){var n,i;const o=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=o,((null===(n=t.theme)||void 0===n?void 0:n.headingFont)||(null===(i=t.theme)||void 0===i?void 0:i.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==X.indexOf(t)?this.getConfigs("product"):-1!==$.indexOf(t)?this.getConfigs("address"):-1!==J.indexOf(t)?this.getConfigs("cart"):-1!==tt.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const n=this.getBaseStylesheets();if(t===o.DRAWER){const t=[...n],i=this.stylesheetGenerator.getStylesheet("product"),o=this.stylesheetGenerator.getStylesheet("cart"),r=this.stylesheetGenerator.getStylesheet("checkout"),s=this.stylesheetGenerator.getStylesheet("address");return i&&t.push(i),o&&t.push(o),r&&t.push(r),s&&t.push(s),t}let i;if($.includes(t)||t===o.ADDRESS)i="address";else if(X.includes(t)||t===o.PRODUCT)i="product";else if(J.includes(t)||t===o.CART)i="cart";else{if(!tt.includes(t)&&t!==o.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),n;i="checkout"}const r=this.stylesheetGenerator.getStylesheet(i);return r?[...n,r]:n}getBaseStylesheets(){const t=[],n=this.stylesheetGenerator.getStylesheet("global"),i=this.stylesheetGenerator.getStylesheet("ui");return n&&t.push(n),i&&t.push(i),t}deepMerge(t,n){const i={...t};for(const o in n)null!==n[o]&&void 0!==n[o]&&("object"!=typeof n[o]||Array.isArray(n[o])||"object"!=typeof t[o]||Array.isArray(t[o])?i[o]=n[o]:i[o]=this.deepMerge(t[o],n[o]));return i}}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.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}const includeCartEvents=(t,n)=>t.filter(t=>n.includes(t.type)),excludeCartEvents=(t,n)=>t.filter(t=>!n.includes(t.type)),eventsForCart=t=>excludeCartEvents(t,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=t=>{const n=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],i=includeCartEvents(t,n);return i.length>0},includeCheckoutEvents=(t,n)=>t.filter(t=>n.includes(t.type)),eventsForCheckout=t=>includeCheckoutEvents(t,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=t=>includeCheckoutEvents(t,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=t=>includeCheckoutEvents(t,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=t=>{const n=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return t.some(t=>n.includes(t.type))},at={OutOfStock:"error",ItemsNotAdded:"warning",ItemsRequestedNotAdded:"warning",ItemEngravingError:"error",AddressChange:"warning",LocationAvailability:"warning",PartnerProductConfigs:"warning",RemovedExistingCartItems:"warning",RetailerMinNotMet:"warning",NoItemsInCart:"warning",InvalidId:"warning",NoId:"warning",CartCheckoutProcessed:"success",NewCart:"warning",CartError:"error",ItemQuantityChange:"warning",ItemIdNotFound:"error",ItemsRemoved:"warning",CouponProcessingError:"error",CouponNotFound:"error",CouponExpired:"error",NoApplicableDiscount:"warning",CouponNotStarted:"error",MinimumOrderValueNotMet:"warning",MinimumOrderUnitsNotMet:"warning",MinimumDistinctItemsNotMet:"warning",QuotaExceeded:"error",UserLimitExceeded:"error",NotFirstPurchase:"warning",InvalidCoupon:"error",InvalidMembership:"error",InvalidDomain:"error",InvalidRequirements:"error",InvalidOrganization:"error",ProductNotEligible:"warning",NotEnoughPreviousOrders:"warning",PresaleItemsNotAllowed:"error",PresaleLimitExceeded:"error",PresaleNotStarted:"error",PresaleExpired:"error",PresaleMixedCart:"error",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning"},ct={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:at[t.type]||"error"})),transformCheckoutEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:ct[t.type]||"error"})),transformEventsForCart=t=>{const n=eventsForCart(t);return transformCartEventsRaw(n)},transformEventsForCheckout=t=>{const n=eventsForCheckout(t);return transformCheckoutEventsRaw(n)},transformPromoCodeCheckoutEvents=t=>{const n=promoCodeCheckoutEvents(t);return transformCheckoutEventsRaw(n)},transformGiftCardCheckoutEvents=t=>{const n=giftCardCheckoutEvents(t);return transformCheckoutEventsRaw(n)};function buildCartItemStore(t){return{id:t.id,variantId:t.variantId,liquidId:t.liquidId,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,salsifyGrouping:t.salsifyGrouping,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price,quantity:t.quantity,maxQuantity:t.maxQuantity,unitPrice:t.unitPrice,mainImage:t.mainImage,attributes:t.attributes,loading:![],updating:![],error:null}}function buildCartTotals(t){return{subtotal:t.subtotal||0,total:t.total||0,shippingFee:t.shippingFee||0,platformFee:t.platformFee||0,giftCardTotal:t.giftCardTotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,discounts:t.discounts||0,quantity:t.quantity||0}}function buildRetailerStore(t){var n;return{id:t.id,name:t.name,platformFee:t.platformFee||0,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,address:t.address,total:t.total||0,deliveryFee:t.deliveryFee||0,engravingFee:t.engravingFee||0,fulfillments:(null===(n=t.fulfillments)||void 0===n?void 0:n.map(t=>t.id))||[]}}function buildFulfillmentStore(t,n){return{id:t.id,canEngrave:t.canEngrave||![],type:t.type,fees:t.fees,expectation:t.expectation,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,items:t.items||[],retailerId:n.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(t,n){var i;const o=n.formattedAddress?n:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},r={};for(const s in t.items||{}){const n=t.items[s];r[s]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,salsifyGrouping:n.salsifyGrouping,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price||0,quantity:n.quantity||0,maxQuantity:n.maxQuantity||0,unitPrice:n.unitPrice||0,mainImage:n.mainImage||"",attributes:n.attributes||{}}}return{id:t.id,promoCode:(null===(i=t.promoCode)||void 0===i?void 0:i.code)||"",items:r,location:{placesId:o.id,address:{one:o.address.one,two:o.address.two,city:o.address.city,state:o.address.state,zip:o.address.zip,country:o.address.country},coordinates:{latitude:o.coordinates.lat,longitude:o.coordinates.long}},amounts:{deliveryFee:t.totals.deliveryFee,discounts:t.totals.discounts,engravingFee:t.totals.engravingFee,giftCardTotal:0,platformFee:t.totals.platformFee,shippingFee:t.totals.shippingFee,subtotal:t.totals.subtotal,total:t.totals.total},itemCount:Object.values(r||{}).reduce((t,n)=>t+(n.quantity||0),0),updatedAt:t.updatedAt,createdAt:t.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,i=![]){var o,r,s,c,d,u;const h=this.store.get("cart");for(const n of Object.keys(h.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(h.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(h.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const p={"cart.id":t.id,"cart.error":null,"cart.totals":buildCartTotals(t),"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(r=null===(o=t.attributes)||void 0===o?void 0:o.promoCode)||void 0===r?void 0:r.value)?{code:t.attributes.promoCode.value.toUpperCase(),discountAmount:t.attributes.promoCode.discount||0,error:null}:null};if((null===(s=t.items)||void 0===s?void 0:s.length)>0)for(const n of t.items)p["cart.items."+n.id]=buildCartItemStore(n);if((null===(c=t.retailers)||void 0===c?void 0:c.length)>0)for(const n of t.retailers)if(p["cart.retailers."+n.id]=buildRetailerStore(n),(null===(d=n.fulfillments)||void 0===d?void 0:d.length)>0)for(const t of n.fulfillments)p["cart.fulfillments."+t.id]=buildFulfillmentStore(t,n);if((null===(u=t.events)||void 0===u?void 0:u.length)>0&&(p["cart.events"]=transformEventsForCart(t.events||[])),this.store.batch(p),i){const t=this.store.get("cart"),i=this.store.get("address");this.pubSub.publishAction(n.CART_LOADED,cartDataForEventFromStore(t,i))}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),n=await this.api.getCartData(t.id);this.syncCartFromResponse(n,!![]),n.id!==t.id&&await this.store.persist()}catch(t){const i=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",i),this.pubSub.publishAction(n.CART_FAILED,{message:i}),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,i){const r={type:t,data:i||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:r}),t===o.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),t===o.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===o.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==t?void 0:t.type)===o.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(t){var i,o,s,c,d,u,h,p,f,v,y,b;try{this.store.set("checkout.loading",!![]);const x=t||this.store.get("cart.id"),w=this.store.get("cart");if(0===(null===(i=Object.values(w.items))||void 0===i?void 0:i.length)&&!t)return;const C=this.themeProvider.getConfigs("checkout"),k={canEmail:C.layout.emailOptIn.checked,canSms:C.layout.smsOptIn.checked};if(!x)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const S={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.presale":null,"checkout.updating":![]},E=await this.api.prepareCheckout({cartId:x,marketingPreferences:k});if((null===(o=E.retailers)||void 0===o?void 0:o.length)>0)for(const t of E.retailers)for(const n of t.fulfillments)n.type===r.ON_DEMAND&&(S["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal});if((null===(s=E.items)||void 0===s?void 0:s.length)>0){this.store.remove("checkout.items");for(const t of E.items){const n=E.retailers.find(n=>n.id===t.retailerId),i=n.fulfillments.find(n=>n.id===t.fulfillmentId);S["checkout.items."+t.cartItemId]=this.buildCheckoutItemStore(t,n,i)}}E.isPresaleLocked&&E.presaleExpiresAt&&(S["checkout.presale"]={isLocked:E.isPresaleLocked,expiresAt:E.presaleExpiresAt}),S["checkout.token"]=E.token,S["checkout.cartId"]=E.cartId,S["checkout.isGift"]=E.isGift,S["checkout.giftRecipientForm.data"]={firstName:((null===(d=null===(c=E.giftOptions)||void 0===c?void 0:c.recipient)||void 0===d?void 0:d.name)||"").split(" ")[0],lastName:((null===(h=null===(u=E.giftOptions)||void 0===u?void 0:u.recipient)||void 0===h?void 0:h.name)||"").split(" ")[1],email:(null===(f=null===(p=E.giftOptions)||void 0===p?void 0:p.recipient)||void 0===f?void 0:f.email)||"",phone:(null===(y=null===(v=E.giftOptions)||void 0===v?void 0:v.recipient)||void 0===y?void 0:y.phone)||"",message:(null===(b=E.giftOptions)||void 0===b?void 0:b.message)||""},S["checkout.paymentForm.billingSameAsShipping"]=E.billingSameAsShipping,S["checkout.marketingPreferences"]=E.marketingPreferences,S["checkout.giftCards"]=E.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),S["checkout.promoCode"]=E.promoCode.value?{code:E.promoCode.value,discountAmount:E.promoCode.discount}:null,S["checkout.amounts"]=E.amounts,S["checkout.events"]=E.events||[],this.store.batch(S),this.pubSub.publishAction(n.CHECKOUT_LOADED,{cartId:E.cartId})}catch(x){this.store.set("checkout.error",x.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:x.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const i=this.store.get("checkout.isGift"),o=null!=t?t:!i,r={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":o,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.data":r}),this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{isActive:o})}async toggleBillingSameAsShipping(t){const i=this.store.get("checkout.paymentForm.billingSameAsShipping"),o=null!=t?t:!i;this.store.set("checkout.paymentForm.billingSameAsShipping",o),this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:o})}async toggleMarketingPreferences(t,i){const o=this.store.get("checkout.marketingPreferences."+t),r=null!=i?i:!o,s=this.store.get("checkout.marketingPreferences"),c=this.dataForCheckoutPrepare({marketingPreferences:{...s,[t]:r}}),d=await this.api.prepareCheckout(c);this.store.set("checkout.marketingPreferences",d.marketingPreferences),this.pubSub.publishAction(n.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:t,isActive:r})}async getPaymentSession(){try{const t=this.store.get("cart.id"),n=await this.api.getPaymentSession({cartId:t});this.store.batch({"checkout.paymentForm.paymentSession":{key:n.key,secret:n.secret},"checkout.paymentForm.paymentMethod":null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,n){var i,o;try{if((this.clientConfig.isBeta()||this.clientConfig.isDevelopment())&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111"}};const r=await this.api.confirmPaymentSession(t,n);return r&&r.id&&r.card&&r.card.brand&&r.card.last4?{id:r.id,card:{brand:null===(i=r.card)||void 0===i?void 0:i.brand,last4:null===(o=r.card)||void 0===o?void 0:o.last4}}:(this.store.set("checkout.error","Invalid payment method information received."),null)}catch(r){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){var i;try{this.googleTagManager.promoCodeAttempt(t);const o=this.dataForCheckoutPrepare({}),r=await this.api.prepareCheckout({...o,promoCode:t}),s=0!==r.amounts.discounts,c=null===(i=transformPromoCodeCheckoutEvents(r.events||[]))||void 0===i?void 0:i[0];if(!s)return this.store.set("checkout.promoCodeError",c?c.message:'Code "'+t+'" does not exist'),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:(null==c?void 0:c.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==c?void 0:c.message)||"not_applied"),void 0;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:r.amounts.discounts,newTotal:r.amounts.total}),this.googleTagManager.promoCodeApplied(t,r.amounts.discounts),await this.partialLoadCheckout({response:r})}catch(o){const i=(null==o?void 0:o.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",i),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:i}),this.googleTagManager.promoCodeFailed(t,i),o}}async removePromoCode(){var t,i;try{const o=this.dataForCheckoutPrepare({}),r=(null===(i=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===i?void 0:i.code)||"",s=await this.api.prepareCheckout({...o,promoCode:""});if(0!==s.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{newTotal:s.amounts.total}),this.googleTagManager.promoCodeApplied(r,0),await this.partialLoadCheckout({response:s})}catch(o){const t=(null==o?void 0:o.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const i=this.store.get("checkout.promoCode.code")||"";throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:t}),i&&this.googleTagManager.promoCodeFailed(i,t),o}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(W){const n=W.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",n),W}}async applyGiftCard(t){var i;const o=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(o);const t=this.dataForCheckoutPrepare({}),r=t.giftCards||[],s=await this.api.prepareCheckout({...t,giftCards:[...r,o]}),c=null===(i=transformGiftCardCheckoutEvents(s.events||[]))||void 0===i?void 0:i[0],d=hasAnyRetailerGiftCardRestriction(s.events||[]);if(c&&(this.store.set("checkout.giftCardError",c.message),!d))return;const u=s.giftCards.find(t=>t.code.toLowerCase()===o.toLowerCase());if(!u)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:(null==c?void 0:c.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(o,(null==c?void 0:c.message)||"not_applied"),void 0;this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:s.amounts.total}),this.googleTagManager.giftCardApplied(o,u.applied),await this.partialLoadCheckout({response:s})}catch(r){const t=(null==r?void 0:r.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:t}),this.googleTagManager.giftCardFailed(o,t),r}}async removeGiftCard(t){var i;const o=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),r=(null===(i=t.giftCards)||void 0===i?void 0:i.filter(t=>t.toLowerCase()!==o.toLowerCase()))||[],s=await this.api.prepareCheckout({...t,giftCards:r}),c=s.giftCards.find(t=>t.code.toLowerCase()===o.toLowerCase());if(c)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+o),void 0;this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:s.amounts.total}),this.googleTagManager.giftCardApplied(o,0),await this.partialLoadCheckout({response:s})}catch(r){const t=(null==r?void 0:r.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:t}),this.googleTagManager.giftCardFailed(o,t),r}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(W){throw this.store.set("checkout.error",(null==W?void 0:W.message)||"Failed to clear gift card error. Please try again."),W}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(o.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,i){var o,r,s;try{this.store.set("checkout.items."+t+".updating",!![]);const c=this.store.get("checkout.cartId"),d=this.store.get("checkout.items."+t);if(!d)throw new SDKError("Item not found");const u=d.quantity,h=d.quantity+i;if(h<1)return this.removeItem(t,!![]);const p={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:h},f=(null===(s=null===(r=null===(o=d.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];f.length>0&&(p.engravingLines=f);const v=await this.api.updateCart({id:c,items:[p],loc:this.getLocation()});this.pubSub.publishAction(i>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:d.cartItemId,quantity:h,previousQuantity:u});const y=splitCategoryPath(d.catPath),b={item_id:d.liquidId,item_name:d.name,item_brand:d.brand,item_size:d.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,quantity:Math.abs(i),price:centToDollar(d.unitPrice||0),upc:d.upc,grouping_id:d.salsifyGrouping,product_id:d.liquidId};i<0?this.googleTagManager.removeFromCart(b):i>0&&this.googleTagManager.addToCart(b),await this.partialLoadCheckout({cartResponse:v})}catch(c){throw this.store.set("checkout.items."+t+".error",c.message),c}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var i,o,r;try{const s=this.store.get("checkout.items."+t);if(!s)throw new SDKError("Item not found in checkout");if(!(null===(i=s.attributes)||void 0===i?void 0:i.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const c=(null===(r=null===(o=s.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[],d={id:s.cartItemId,fulfillmentId:s.fulfillmentId,partNumber:s.partNumber,quantity:s.quantity,engravingLines:[]},u=this.store.get("checkout.cartId"),h=await this.api.updateCart({id:u,items:[d],loc:this.getLocation()});this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:s.cartItemId,engravingLines:[],previousEngravingLines:c}),await this.partialLoadCheckout({cartResponse:h})}catch(s){throw this.store.set("checkout.items."+t+".error",s.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:s.message}),s}}async removeItem(t,i){var o,r,s;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;i||this.store.set("checkout.items."+t+".updating",!![]);const c=this.store.get("checkout.cartId"),d=this.store.get("checkout.items."+t);if(!d)throw new SDKError("Item not found");const u={id:d.cartItemId,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:0},h=(null===(s=null===(r=null===(o=d.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||void 0===s?void 0:s.filter(t=>""!==t.trim()))||[];h.length>0&&(u.engravingLines=h);const p=await this.api.updateCart({id:c,items:[u],loc:this.getLocation()});this.store.remove("checkout.items."+t),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartItemId:d.cartItemId}),await this.partialLoadCheckout({cartResponse:p})}catch(c){throw this.store.set("checkout.items."+t+".error",c.message),c}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const i=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},o=Object.values(i).map(n=>{const i=Math.round(n.subtotal*t/100);return{fulfillmentId:n.fulfillmentId,tip:i}}),r=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:o}));this.updateStoreFromCheckoutResponse(r),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to update tips. Please try again."),i}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,i){try{this.store.set("checkout.updating",!![]);const o=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},r=Object.values(o).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===t?i:n.tip})),s=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:r}));this.updateStoreFromCheckoutResponse(s),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:r})}catch(o){throw this.store.set("checkout.error",(null==o?void 0:o.message)||"Failed to update fulfillment tip. Please try again."),o}finally{this.store.set("checkout.updating",![])}}async removeFulfillmentTip(t){try{this.store.set("checkout.updating",!![]);const i=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},o=Object.values(i).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===t?0:n.tip})),r=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:o}));this.updateStoreFromCheckoutResponse(r),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:o})}catch(i){throw this.store.set("checkout.error",(null==i?void 0:i.message)||"Failed to remove fulfillment tip. Please try again."),i}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:i,customerData:o}){var r,s,c,d,u,h,p,f,v;try{this.store.set("checkout.customerForm.isSaving",!![]);const y=this.store.get("checkout.customerForm.data"),b=this.store.get("checkout.isGift"),x=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:i||void 0,customer:{...y,...o},isGift:b}),w=await this.api.prepareCheckout(x),C={id:(null===(r=w.customer)||void 0===r?void 0:r.id)||"",firstName:(null===(s=w.customer)||void 0===s?void 0:s.firstName)||"",lastName:(null===(c=w.customer)||void 0===c?void 0:c.lastName)||"",email:(null===(d=w.customer)||void 0===d?void 0:d.email)||"",phone:(null===(u=w.customer)||void 0===u?void 0:u.phone)||"",birthDate:(null===(p=null===(h=w.customer)||void 0===h?void 0:h.birthDate)||void 0===p?void 0:p.slice(0,10))||"",company:(null===(f=w.customer)||void 0===f?void 0:f.company)||""};this.store.batch({"checkout.customerForm.data":C,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddressTwo":w.shippingAddress.two,"checkout.deliveryInstructions":i}),this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,!![]);const k=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(k.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(v=k.promoCode)||void 0===v?void 0:v.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:i,...o}){var r,s,c,d,u,h;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const p=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:i||void 0,giftRecipient:o}),f=await this.api.prepareCheckout(p),v={firstName:(null==o?void 0:o.firstName)||"",lastName:(null==o?void 0:o.lastName)||"",email:(null===(s=null===(r=f.giftOptions)||void 0===r?void 0:r.recipient)||void 0===s?void 0:s.email)||"",phone:(null===(d=null===(c=f.giftOptions)||void 0===c?void 0:c.recipient)||void 0===d?void 0:d.phone)||"",message:(null===(u=f.giftOptions)||void 0===u?void 0:u.message)||""};this.store.batch({"checkout.giftRecipientForm.data":v,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddressTwo":f.shippingAddress.two,"checkout.deliveryInstructions":i}),this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,!![]);const y=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(y.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(h=y.promoCode)||void 0===h?void 0:h.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:t,paymentSession:i}){var o,r,s;try{this.store.set("checkout.paymentForm.isSaving",!![]);const c=this.store.get("checkout"),d={},u=(this.clientConfig.isBeta()||this.clientConfig.isDevelopment())&&this.clientConfig.get("paymentMethodId");let h=null,p=null;if(u||i){const t=await this.confirmPaymentSession((null==i?void 0:i.confirmationTokenId)||"",(null==i?void 0:i.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");h=t.card,p=t.id}const f=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:p||void 0}),v=await this.api.prepareCheckout(f);v.payment&&h&&(d["checkout.paymentForm.paymentMethod"]={id:v.payment,card:h}),t&&v.billingAddress&&(d["checkout.paymentForm.data"]={firstName:v.billingAddress.firstName||"",lastName:v.billingAddress.lastName||"",email:v.billingAddress.email||"",phone:v.billingAddress.phone||"",company:v.billingAddress.company||"",addressOne:v.billingAddress.one||"",addressTwo:v.billingAddress.two||"",city:v.billingAddress.city||"",state:v.billingAddress.state||"",zipCode:v.billingAddress.zip||""},this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,!![])),d["checkout.paymentForm.isEditing"]=![],d["checkout.paymentForm.isValid"]=!![],this.store.batch(d);const y=d["checkout.paymentForm.paymentMethod"]||(null===(o=c.paymentForm)||void 0===o?void 0:o.paymentMethod),b=(null===(r=null==y?void 0:y.card)||void 0===r?void 0:r.brand)?y.card.brand+" ****"+y.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(c.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}}),b,(null===(s=c.promoCode)||void 0===s?void 0:s.code)||void 0)}catch(c){throw this.logger.error("Failed to save payment form",c),this.store.set("checkout.error",c.message),c}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var t,i,r,s,c,d;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const u=this.store.get("checkout"),h=await this.api.checkoutComplete({token:u.token}),p=h.legacyOrderNumber||h.referenceId||"N/A";u.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(o.CHECKOUT_COMPLETED,{orderNumber:p,orderTotal:u.amounts.total,cardLast4:null===(r=null===(i=null===(t=null==u?void 0:u.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===i?void 0:i.card)||void 0===r?void 0:r.last4,customerEmail:u.customerForm.data.email,giftRecipientEmail:(null===(c=null===(s=null==u?void 0:u.giftRecipientForm)||void 0===s?void 0:s.data)||void 0===c?void 0:c.email)||null}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:p,orderTotal:u.amounts.total}),this.googleTagManager.purchase({transaction_id:p,tax:centToDollar(u.amounts.tax||0),shipping:centToDollar(u.amounts.shipping||0),coupon:(null===(d=u.promoCode)||void 0===d?void 0:d.code)||void 0,items:[...Object.values(u.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(u.amounts.total),subtotal:centToDollar(u.amounts.subtotal),total_before_discounts:centToDollar(u.amounts.subtotal+u.amounts.tax+u.amounts.shipping+u.amounts.delivery+u.amounts.platform+u.amounts.service),discounts:centToDollar(u.amounts.discounts),gift_cards:centToDollar(u.amounts.giftCards||0),net_total:centToDollar(u.amounts.total)})}catch(u){const t=(null==u?void 0:u.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(t){var n;const i={"checkout.amounts":t.amounts,"checkout.warning":t.warning,"checkout.events":transformEventsForCheckout(t.events||[]),"checkout.error":null};if((null===(n=t.retailers)||void 0===n?void 0:n.length)>0)for(const o of t.retailers)for(const t of o.fulfillments)t.type===r.ON_DEMAND&&(i["checkout.onDemandFulfillmentTipInfo."+t.id]={retailerId:o.id,retailerName:o.name,fulfillmentId:t.id,tip:t.tip,subtotal:t.subtotal});this.store.batch(i)}async partialLoadCheckout(t){var i,o,s,c,d;try{let n;if(this.store.set("checkout.updating",!![]),(null==t?void 0:t.cartResponse)?this.commonCommands.syncCartFromResponse(t.cartResponse):await this.commonCommands.loadCart(),null==t?void 0:t.response)n=t.response;else{const o=null!==(i=null==t?void 0:t.cartId)&&void 0!==i?i:this.store.get("checkout.cartId");if(!o)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const r=this.dataForCheckoutPrepare({});n=await this.api.prepareCheckout({...r,cartId:o})}const u={"checkout.token":n.token,"checkout.events":transformEventsForCheckout(n.events||[]),"checkout.amounts":n.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":n.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),"checkout.promoCode":(null===(s=null===(o=null==n?void 0:n.promoCode)||void 0===o?void 0:o.value)||void 0===s?void 0:s.trim())?{code:n.promoCode.value,discountAmount:n.promoCode.discount}:null};if((null===(c=n.retailers)||void 0===c?void 0:c.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const t of n.retailers)for(const n of t.fulfillments)n.type===r.ON_DEMAND&&(u["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal})}if((null===(d=n.items)||void 0===d?void 0:d.length)>0){this.store.remove("checkout.items");for(const t of n.items){const i=n.retailers.find(n=>n.id===t.retailerId),o=i.fulfillments.find(n=>n.id===t.fulfillmentId);u["checkout.items."+t.cartItemId]=this.buildCheckoutItemStore(t,i,o)}}this.store.batch(u)}catch(u){const t=(null==u?void 0:u.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:t}),u}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:n,billingData:i,marketingPreferences:o,shippingAddressTwo:r,deliveryInstructions:s,deliveryTips:c,paymentMethodId:d,isGift:u}){var h,p,f,v,y,b,x,w,C,k,S,E,_,T,D,P,F,A,z,O,M,N,R,B,q,j,U,G,V,H,W,X,$;const J=this.store.get("checkout"),tt=null!==(p=null===(h=J.paymentForm)||void 0===h?void 0:h.billingSameAsShipping)&&void 0!==p?p:!![],et={cartId:J.cartId,acceptedAccountCreation:![],hasSubstitutionPolicy:![],hasAgeVerify:!![],shippingAddressTwo:r,billingSameAsShipping:tt,marketingPreferences:o||J.marketingPreferences,promoCode:(null===(f=J.promoCode)||void 0===f?void 0:f.code)||void 0,isGift:void 0!==u?u:J.isGift,giftCards:(null===(v=null==J?void 0:J.giftCards)||void 0===v?void 0:v.map(t=>t.code))||[],deliveryTips:c||Object.values(J.onDemandFulfillmentTipInfo).map(t=>({fulfillmentId:t.fulfillmentId,tip:t.tip}))};d?et.payment=d:(null===(b=null===(y=J.paymentForm)||void 0===y?void 0:y.paymentMethod)||void 0===b?void 0:b.id)&&(et.payment=J.paymentForm.paymentMethod.id);const nt=s||J.deliveryInstructions;if(nt&&(et.deliveryInstructions=Object.values(J.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:nt}))),et.customer=t?{...t,id:(null==t?void 0:t.id)||void 0}:(null===(w=null===(x=null==J?void 0:J.customerForm)||void 0===x?void 0:x.data)||void 0===w?void 0:w.email)?{id:(null===(k=null===(C=J.customerForm)||void 0===C?void 0:C.data)||void 0===k?void 0:k.id)||void 0,firstName:null===(E=null===(S=J.customerForm)||void 0===S?void 0:S.data)||void 0===E?void 0:E.firstName,lastName:null===(T=null===(_=J.customerForm)||void 0===_?void 0:_.data)||void 0===T?void 0:T.lastName,email:null===(P=null===(D=J.customerForm)||void 0===D?void 0:D.data)||void 0===P?void 0:P.email,phone:null===(A=null===(F=J.customerForm)||void 0===F?void 0:F.data)||void 0===A?void 0:A.phone,birthDate:null===(O=null===(z=J.customerForm)||void 0===z?void 0:z.data)||void 0===O?void 0:O.birthDate,company:null===(N=null===(M=J.customerForm)||void 0===M?void 0:M.data)||void 0===N?void 0:N.company}:void 0,J.isGift&&(et.giftOptions=n?{recipient:{name:((n.firstName||"")+" "+(n.lastName||"")).trim(),email:n.email||"",phone:n.phone||""},message:n.message||""}:{recipient:{name:(((null===(B=null===(R=J.giftRecipientForm)||void 0===R?void 0:R.data)||void 0===B?void 0:B.firstName)||"")+" "+((null===(j=null===(q=J.giftRecipientForm)||void 0===q?void 0:q.data)||void 0===j?void 0:j.lastName)||"")).trim(),email:(null===(G=null===(U=J.giftRecipientForm)||void 0===U?void 0:U.data)||void 0===G?void 0:G.email)||"",phone:(null===(H=null===(V=J.giftRecipientForm)||void 0===V?void 0:V.data)||void 0===H?void 0:H.phone)||""},message:(null===(X=null===(W=J.giftRecipientForm)||void 0===W?void 0:W.data)||void 0===X?void 0:X.message)||""}),!tt)if(i)et.billingAddress={firstName:i.firstName,lastName:i.lastName,email:i.email,phone:i.phone,company:i.company,one:i.addressOne,two:i.addressTwo,city:i.city,state:i.state,zip:i.zipCode,country:"US"};else{const t=null===($=J.paymentForm)||void 0===$?void 0:$.data;et.billingAddress={firstName:null==t?void 0:t.firstName,lastName:null==t?void 0:t.lastName,email:null==t?void 0:t.email,phone:null==t?void 0:t.phone,company:null==t?void 0:t.company,one:null==t?void 0:t.addressOne,two:null==t?void 0:t.addressTwo,city:null==t?void 0:t.city,state:null==t?void 0:t.state,zip:null==t?void 0:t.zipCode,country:"US"}}return et}buildCheckoutItemStore(t,n,i){return{liquidId:t.liquidId,variantId:t.variantId,cartItemId:t.cartItemId,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes,retailerName:n.name,expectationDetail:i.expectation.detail,loading:![],updating:![],error:null}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.commonCommands=CommonCommands.getInstance(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,i){try{this.store.set("cart.items."+t+".updating",!![]);const o=this.store.get("cart.id"),r=this.store.get("cart.items."+t);if(!r)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+i),new SDKError("Item not found");const s=r.quantity+i;if(s<1)return this.removeItem(t,!![]);const c=this.buildItemUpdate(r,s),d=await this.api.updateCart({id:o,items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(d,[t]),this.updateFulfillment(r.fulfillmentId,d),this.syncRetailersFromApiResponse(d),this.syncCartMetaFromApiResponse(d),this.pubSub.publishAction(i<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{id:r.id,quantity:s,previousQuantity:r.quantity});const u=splitCategoryPath(r.catPath),h={item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_size:r.size,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:Math.abs(i),price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId};i<0?this.googleTagManager.removeFromCart(h):i>0&&this.googleTagManager.addToCart(h)}catch(o){throw this.store.set("cart.items."+t+".error",o.message),this.logger.error("Failed to update item quantity",o),o}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,i){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;i||this.store.set("cart.items."+t+".updating",!![]);const o=this.store.get("cart.id"),r=this.store.get("cart.items."+t);if(!r)throw new SDKError("Item not found");const s={itemId:r.id,fulfillmentId:r.fulfillmentId,retailerId:r.retailerId},c=this.buildItemUpdate(r,0),d=await this.api.updateCart({id:o,items:[c],loc:this.getLocation()});this.syncItemsFromApiResponse(d,[]),this.cleanupAfterItemRemoval(s,d),this.syncCartMetaFromApiResponse(d),this.pubSub.publishAction(n.CART_ITEM_REMOVED,{id:r.id});const u=splitCategoryPath(r.catPath);this.googleTagManager.removeFromCart({item_id:r.liquidId,item_name:r.name,item_brand:r.brand,item_size:r.size,item_category:u.category,item_category2:u.category2,item_category3:u.category3,quantity:r.quantity,price:centToDollar(r.unitPrice||0),upc:r.upc,grouping_id:r.salsifyGrouping,product_id:r.liquidId})}catch(o){throw this.store.set("cart.items."+t+".error",o.message),this.logger.error("Failed to remove item",o),o}}async updateItemEngraving(t,i){var o,r,s;try{const c=this.store.get("cart"),d=null===(o=c.items)||void 0===o?void 0:o[t];if(!d)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const u={id:d.id,fulfillmentId:d.fulfillmentId,partNumber:d.partNumber,quantity:d.quantity,engravingLines:i},h=await this.api.updateCart({id:c.id||"",items:[u],loc:this.getLocation()});this.syncItemsFromApiResponse(h,[t]),this.syncRetailersFromApiResponse(h),this.syncCartMetaFromApiResponse(h);const p=this.store.get("cart"),f=this.store.get("address");this.pubSub.publishAction(n.CART_UPDATED,{previous:cartDataForEventFromStore(c,f),current:cartDataForEventFromStore(p,f)}),this.pubSub.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{id:d.id,engravingLines:i,previousEngravingLines:(null===(s=null===(r=d.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||[]})}catch(c){throw this.store.set("cart.items."+t+".error",c.message),this.logger.error("Failed to update item engraving",c),c}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var i,o;try{this.store.set("cart.loading",!![]);const r=this.store.get("cart"),s={...r},c=(null===(i=t.engravingLines)||void 0===i?void 0:i.filter(t=>""!==t.trim()))||[],d=c.length>0,u=Object.values(r.items||{}).find(n=>{var i,o,r,s,u;const h=n.fulfillmentId===t.fulfillmentId&&n.partNumber===t.partNumber;if(!h)return![];if(d){const t=(null===(o=null===(i=n.attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.lines)||[];return c.join(",")===t.join(",")}return!(null===(u=null===(s=null===(r=n.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.lines)||void 0===u?void 0:u.length)}),h={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:u?t.quantity+u.quantity:t.quantity};d&&(h.engravingLines=c);const p=await this.api.updateCart({id:r.id||"",items:[h],loc:this.getLocation()}),f=null===(o=p.items)||void 0===o?void 0:o.find(t=>t.fulfillmentId===h.fulfillmentId&&t.partNumber===h.partNumber&&t.upc===h.upc);if(!f)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(p,[]);const v=this.store.get("cart.fulfillments."+t.fulfillmentId);v?this.updateFulfillment(t.fulfillmentId,p):this.addNewFulfillmentAndRetailer(t.fulfillmentId,p),this.syncRetailersFromApiResponse(p),this.syncCartMetaFromApiResponse(p);const y=this.store.get("cart"),b=this.store.get("address");this.pubSub.publishAction(n.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(n.CART_ITEM_ADDED,{id:f.id,upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(n.CART_UPDATED,{previous:cartDataForEventFromStore(s,b),current:cartDataForEventFromStore(y,b)});const x=splitCategoryPath(f.catPath);this.googleTagManager.addToCart({item_id:f.liquidId,item_name:f.name,item_brand:f.brand,item_size:f.size,item_category:x.category,item_category2:x.category2,item_category3:x.category3,item_type:f.type,item_subtype:f.subType,quantity:f.quantity,price:centToDollar(f.unitPrice||0),upc:f.upc,grouping_id:f.salsifyGrouping,product_id:f.liquidId})}catch(r){this.store.set("cart.error",r.message),this.logger.error("Failed to add item to cart",r)}finally{this.store.set("cart.loading",![])}}async addPresaleItem(t){var n;try{const i={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity};(null==t?void 0:t.engravingLines)&&(null===(n=null==t?void 0:t.engravingLines)||void 0===n?void 0:n.length)>0&&(i.engravingLines=t.engravingLines);const o=await this.api.updateCart({id:"",items:[i],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(o.id)}catch(i){throw this.store.set("cart.error",i.message),this.logger.error("Failed to add presale item to cart",i),i}}async handleGoToCheckout(){var t;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(o.CHECKOUT);const n=this.store.get("cart"),i=(null===(t=n.promoCode)||void 0===t?void 0:t.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(n.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],i)}catch(n){throw this.store.set("cart.error",n.message),this.logger.error("Failed to proceed to checkout",n),n}finally{this.store.set("cart.loading",![])}}async applyPromoCode(t){var i,o,r;if(!(null==t?void 0:t.trim()))throw new SDKError("Promo code is required");const s=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(s);const c=await this.api.updateCart({id:t,items:[],promoCode:s,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(c)),this.store.set("cart.events",transformEventsForCart(c.events||[]));const d=(null===(r=null===(o=null===(i=c.attributes)||void 0===i?void 0:i.promoCode)||void 0===o?void 0:o.value)||void 0===r?void 0:r.toLowerCase())===s.toLowerCase();d?(this.store.set("cart.promoCode",{code:s,discountAmount:c.discounts||0}),this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{discountAmount:c.discounts||0,newTotal:c.total||0}),this.googleTagManager.promoCodeApplied(s,c.discounts||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:'Code "'+s+'" does not exist'}),this.googleTagManager.promoCodeFailed(s,'Code "'+s+'" does not exist'))}catch(c){const t=(null==c?void 0:c.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",t),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:t}),this.googleTagManager.promoCodeFailed(s,t),this.logger.error("Failed to apply promo code",c),c}}async removePromoCode(){try{const t=this.store.get("cart.id"),i=await this.api.updateCart({id:t,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(i),"cart.promoCode":null}),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{newTotal:i.total||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const i=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",i);const o=this.store.get("cart.promoCode");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:i}),(null==o?void 0:o.code)&&this.googleTagManager.promoCodeFailed(o.code,i),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...y,rerender:!![]}),this.store.set("cart",{...v,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSub.publishAction(n.CART_RESET,!![])}getDetails(){var t;const n=this.store.get("cart"),i=this.store.get("address"),o=i.id?i:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},r={};for(const s in n.items||{}){const t=n.items[s];r[s]={id:t.id,variantId:t.variantId,liquidId:t.liquidId,salsifyGrouping:t.salsifyGrouping,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price||0,quantity:t.quantity||0,maxQuantity:t.maxQuantity||0,unitPrice:t.unitPrice||0,mainImage:t.mainImage||"",attributes:t.attributes||{}}}return{id:n.id,promoCode:(null===(t=n.promoCode)||void 0===t?void 0:t.code)||"",items:r,location:{placesId:o.id,address:{one:o.address.one,two:o.address.two,city:o.address.city,state:o.address.state,zip:o.address.zip,country:o.address.country},coordinates:{latitude:o.coordinates.lat,longitude:o.coordinates.long}},amounts:{deliveryFee:n.totals.deliveryFee,discounts:n.totals.discounts,engravingFee:n.totals.engravingFee,giftCardTotal:n.totals.giftCardTotal,platformFee:n.totals.platformFee,shippingFee:n.totals.shippingFee,subtotal:n.totals.subtotal,total:n.totals.total},itemCount:Object.values(r||{}).reduce((t,n)=>t+(n.quantity||0),0),updatedAt:n.updatedAt,createdAt:n.createdAt}}buildItemUpdate(t,n){var i,o,r;const s={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:n},c=(null===(r=null===(o=null===(i=t.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()))||[];return c.length>0&&(s.engravingLines=c),s}syncItemsFromApiResponse(t,n=[]){var i;const o=this.store.get("cart.items")||{},r=new Set((null===(i=t.items)||void 0===i?void 0:i.map(t=>t.id))||[]);for(const c of Object.keys(o))r.has(c)||this.store.remove("cart.items."+c);const s={};for(const c of t.items)0!==n.length&&!n.includes(c.id)&&o[c.id]||(s["cart.items."+c.id]=buildCartItemStore(c));Object.keys(s).length>0&&this.store.batch(s)}syncCartMetaFromApiResponse(t){var n,i;const o={"cart.totals":buildCartTotals(t),"cart.error":null,"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(t.events||[])},r=null===(i=null===(n=t.attributes)||void 0===n?void 0:n.promoCode)||void 0===i?void 0:i.value;if(r)o["cart.promoCode"]={code:r.toUpperCase(),discountAmount:t.discounts||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(o["cart.promoCode"]=null)}this.store.batch(o)}syncRetailersFromApiResponse(t){var n;if((null===(n=t.retailers)||void 0===n?void 0:n.length)>0){const n={};for(const i of t.retailers)n["cart.retailers."+i.id]=buildRetailerStore(i);this.store.batch(n)}}updateFulfillment(t,n){var i,o;const r=null===(i=n.retailers)||void 0===i?void 0:i.find(n=>{var i;return null===(i=n.fulfillments)||void 0===i?void 0:i.some(n=>n.id===t)}),s=null===(o=null==r?void 0:r.fulfillments)||void 0===o?void 0:o.find(n=>n.id===t);s&&r&&this.store.set("cart.fulfillments."+t,buildFulfillmentStore(s,r))}addNewFulfillmentAndRetailer(t,n){var i,o;const r=null===(i=n.retailers)||void 0===i?void 0:i.find(n=>{var i;return null===(i=n.fulfillments)||void 0===i?void 0:i.some(n=>n.id===t)}),s=null===(o=null==r?void 0:r.fulfillments)||void 0===o?void 0:o.find(n=>n.id===t);if(s&&r){const n={["cart.fulfillments."+t]:buildFulfillmentStore(s,r),["cart.retailers."+r.id]:buildRetailerStore(r)};this.store.batch(n)}}cleanupAfterItemRemoval(t,n){var i,o,r,s;const c=this.store.get("cart.fulfillments."+t.fulfillmentId),d=this.store.get("cart.retailers."+t.retailerId);if(!c||!d)return;const u=null===(i=n.retailers)||void 0===i?void 0:i.some(n=>{var i;return null===(i=n.fulfillments)||void 0===i?void 0:i.some(n=>n.id===t.fulfillmentId)}),h=null===(o=n.retailers)||void 0===o?void 0:o.some(n=>n.id===t.retailerId);if(u){this.updateFulfillment(t.fulfillmentId,n);const i=null===(s=n.retailers)||void 0===s?void 0:s.find(n=>n.id===t.retailerId);i&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(i))}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),h){const i=null===(r=n.retailers)||void 0===r?void 0:r.find(n=>n.id===t.retailerId);i&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(i))}else this.store.remove("cart.retailers."+t.retailerId)}}const lt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],dt=1440;function timeToMinutes(t){const n=t.match(/^(\d{1,2}):(\d{2})$/);if(!n)throw new SDKError("Invalid time format: "+t);const i=Number.parseInt(n[1],10),o=Number.parseInt(n[2],10);if(i<0||i>47||o<0||o>59)throw new SDKError("Invalid time values: "+t);return 60*i+o}function getCurrentTimeInTimezone$1(t){var n,i,o;const r=new Date,s={timeZone:t,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const t=new Intl.DateTimeFormat("en-US",s),c=t.formatToParts(r),d=(null===(n=c.find(t=>"weekday"===t.type))||void 0===n?void 0:n.value.toLowerCase())||"",u=(null===(i=c.find(t=>"hour"===t.type))||void 0===i?void 0:i.value)||"0",h=(null===(o=c.find(t=>"minute"===t.type))||void 0===o?void 0:o.value)||"0",p=60*Number.parseInt(u,10)+Number.parseInt(h,10);return{weekday:d,timeInMinutes:p}}catch(c){throw new SDKError("Invalid timezone: "+t)}}function format24TimeTo12(t){const n=t.match(/^(\d{1,2}):(\d{2})$/);if(!n||"object"==typeof n)return t;let i=Number.parseInt(n[1],10);const o=n[2];i>=24&&(i-=24);const r=i>=12?"PM":"AM",s=0===i?12:i>12?i-12:i;return s+":"+o+" "+r}function isWithinTimeSlot(t,n){try{const i=timeToMinutes(n.startsAt),o=timeToMinutes(n.endsAt);if(o>dt){if(t>=i||t<o-dt)return"during"}else if(o<i){if(t>=i||t<o)return"during"}else if(t>=i&&t<o)return"during";return t<i?"before":"after"}catch(i){return"after"}}function getNextOpeningTime(t,n,i=7){var o,r;const s=lt.indexOf(n);for(let d=1;d<=i;d++){const n=(s+d)%7,i=lt[n],u=t[i];if((null==u?void 0:u.active)&&u.times&&u.times.length>0)try{const t=1===d?"tomorrow":i;return"Opens "+t+" at "+format24TimeTo12(null!==(r=null===(o=null==u?void 0:u.times[0])||void 0===o?void 0:o.startsAt)&&void 0!==r?r:"")}catch(c){}}return null}function validateFulfillmentData(t){return t&&"object"==typeof t&&t.hours&&t.timezone?"string"!=typeof t.timezone?![]:!![]:![]}function getRetailerOffHours(t){var n;if(!(null==t?void 0:t.type)||(null==t?void 0:t.type)!==r.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(t))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:i,timeInMinutes:o}=getCurrentTimeInTimezone$1(t.timezone),r=t.hours[i];if(!(null==r?void 0:r.active)||!(null===(n=r.times)||void 0===n?void 0:n.length)){const n=getNextOpeningTime(t.hours,i);return{message:n,isOpen:![],isClosed:!![]}}for(const t of r.times){const n=isWithinTimeSlot(o,t);switch(n){case"before":return{message:"Opens at "+format24TimeTo12(t.startsAt),isOpen:![],isClosed:!![],openTime:t.startsAt,closeTime:t.endsAt};case"during":{let n=t.endsAt;const i=timeToMinutes(n);if(i>dt){const t=Math.floor(i/60)-24,o=i%60;n=t.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(n),isOpen:!![],isClosed:![],openTime:t.startsAt,closeTime:t.endsAt}}}}const s=getNextOpeningTime(t.hours,i);return{message:s,isOpen:![],isClosed:!![]}}catch(i){return{message:null,isOpen:![],isClosed:!![]}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,n=![]){this.store.createProductInstance(t),n&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var n;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,n)=>(t["products."+n+".loading"]=!![],t["products."+n+".error"]=null,t),{}));const i=await this.api.getProductsData(t,this.getLocation());if(!i||!i.products||0===i.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,n)=>(t["products."+n+".loading"]=![],t["products."+n+".error"]=!![],t),{})),void 0;const o=[];for(const s of i.products){const r=s.sizes.filter(n=>t.some(t=>t===(n.upc||n.id||s.salsifyGrouping))),c=t.find(t=>r.some(n=>t===n.upc||t===n.id)||t===s.salsifyGrouping),d=c||(null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.upc);await this.loadProduct(d,{products:[s],retailers:i.retailers}),o.push(d)}const r=t.filter(t=>-1===o.indexOf(t));this.store.batch(r.reduce((t,n)=>(t["products."+n+".loading"]=![],t["products."+n+".error"]="Product data not found",t),{}))}async loadProduct(t,i=null){var o,r;try{const s=this.store.get("products."+t);s.loading||this.store.set("products."+t+".loading",!![]);let c=null;if(i&&(c=i),i||(c=await this.api.getProductsData([t],this.getLocation())),!c||!(null===(o=null==c?void 0:c.products)||void 0===o?void 0:o[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const d=this.loadProductStoreUpdate(c);if(!d)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...d,identifier:t}),this.pubSub.publishAction(n.PRODUCT_LOADED,this.productDataForEventFromStore(t));const u=c.products[0],h=d.sizes[d.selectedSizeId||""],p=Boolean(this.getLocation()),f=d.selectedFulfillment,v=p&&(null==f?void 0:f.price)?f.price:(null===(r=d.priceInfo)||void 0===r?void 0:r.avg)||0,y=splitCategoryPath(u.catPath);this.googleTagManager.viewItem({item_id:null==h?void 0:h.id,item_name:u.name,item_brand:u.brand,item_size:null==h?void 0:h.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar(v),item_type:u.type,item_subtype:u.subType,upc:null==h?void 0:h.upc,grouping_id:u.salsifyGrouping,product_id:null==h?void 0:h.id})}catch(s){this.store.set("products."+t+".error",s.message),this.logger.error("Failed to load product data for ID "+t,s)}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,i){var o,s,c,d,u,h,p;const f=this.store.get("products."+t);let v=f.selectedFulfillmentType;const y=null===(o=f.sizes[i])||void 0===o?void 0:o.shippingFulfillments,b=null===(s=f.sizes[i])||void 0===s?void 0:s.onDemandFulfillments;let x=null,w=null;if(v!==r.SHIPPING||Object.values(y).length)if(v!==r.ON_DEMAND||Object.values(b).length){const t=v===r.SHIPPING?y:b,n=Object.values(t);x=n[0]||null,w=(null==x?void 0:x.fulfillmentId)||null}else{v=r.SHIPPING;const t=Object.values(y);x=t[0]||null,w=(null==x?void 0:x.fulfillmentId)||null}else{v=r.ON_DEMAND;const t=Object.values(b);x=t[0]||null,w=(null==x?void 0:x.fulfillmentId)||null}const C=v===r.SHIPPING?y:b,k=f.sizes[i],S=splitCategoryPath(f.catPath),E=(null==x?void 0:x.price)||(null===(c=f.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==k?void 0:k.id,item_name:f.name,item_brand:f.brand,item_size:null==k?void 0:k.size,item_category:S.category,item_category2:S.category2,item_category3:S.category3,price:centToDollar(E),item_type:f.type,item_subtype:f.subType,upc:null==k?void 0:k.upc,grouping_id:f.salsifyGrouping,product_id:null==k?void 0:k.id});const _=Object.keys(y).length>0,T=Object.keys(b).length>0,D=_||T;if(!D){const t=this.store.get("address");this.googleTagManager.productSizeNoAvailability({productId:null==k?void 0:k.id,productName:f.name,productBrand:f.brand,productCategory:S.category,productCategory2:S.category2,productCategory3:S.category3,productType:f.type,productSubtype:f.subType,productPrice:(null===(d=f.priceInfo)||void 0===d?void 0:d.avg)||0,sizeId:i,sizeName:null==k?void 0:k.size,upc:null==k?void 0:k.upc,groupingId:f.salsifyGrouping,address:(null==t?void 0:t.address)?{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""}:void 0,reason:"No fulfillments available for this size"})}this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:i,size:(null===(u=f.sizes[i])||void 0===u?void 0:u.size)||"",previousSizeId:f.selectedSizeId||"",previousSize:(null===(h=f.sizes[f.selectedSizeId])||void 0===h?void 0:h.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:i,["products."+t+".mainImage"]:(null===(p=f.sizes[i])||void 0===p?void 0:p.image)||null,["products."+t+".productHasAvailability"]:Object.keys(y).length+Object.keys(b).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(C).length),["products."+t+".selectedFulfillmentType"]:v,["products."+t+".selectedFulfillment"]:x,["products."+t+".selectedFulfillmentId"]:w})}async selectFulfillment(t,i){var o,s,c;const d=this.store.get("products."+t),u=null===(o=d.sizes[d.selectedSizeId])||void 0===o?void 0:o.shippingFulfillments,h=null===(s=d.sizes[d.selectedSizeId])||void 0===s?void 0:s.onDemandFulfillments,p=d.selectedFulfillmentType===r.SHIPPING?u:h,f=p[i];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:i,selectedFulfillmentType:d.selectedFulfillmentType,previousFulfillmentId:d.selectedFulfillmentId||"",previousFulfillmentType:d.selectedFulfillmentType});const v=d.sizes[d.selectedSizeId||""],y=splitCategoryPath(d.catPath),b=(null==f?void 0:f.price)||(null===(c=d.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==v?void 0:v.id,item_name:d.name,item_brand:d.brand,item_size:null==v?void 0:v.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar(b),item_type:d.type,item_subtype:d.subType,upc:null==v?void 0:v.upc,grouping_id:d.salsifyGrouping,product_id:null==v?void 0:v.id}),this.store.batch({["products."+t+".selectedFulfillment"]:f,["products."+t+".selectedFulfillmentId"]:i,["products."+t+".quantity"]:1})}async updateQuantity(t,i){var o;const r=this.store.get("products."+t),s=r.quantity,c=s+i,d=1,u=(null===(o=null==r?void 0:r.selectedFulfillment)||void 0===o?void 0:o.stock)||5,h=Math.max(d,Math.min(u,c));this.pubSub.publishAction(i<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:h,previousQuantity:s}),this.store.set("products."+t+".quantity",h)}async changeFulfillmentType(t,i){var o,s,c;const d=this.store.get("products."+t),{shippingFulfillments:u,onDemandFulfillments:h}=d.sizes[d.selectedSizeId],p=i===r.SHIPPING?u:h,f=Object.values(p);if(0===f.length){this.logger.warn("No fulfillments available for type "+i+" on product "+t);const n=this.store.get("address"),r=d.sizes[d.selectedSizeId],c=splitCategoryPath(d.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==r?void 0:r.id,productName:d.name,productBrand:d.brand,productCategory:c.category,productCategory2:c.category2,productCategory3:c.category3,productType:d.type,productSubtype:d.subType,productPrice:(null===(o=d.priceInfo)||void 0===o?void 0:o.avg)||0,sizeId:null!==(s=d.selectedSizeId)&&void 0!==s?s:void 0,sizeName:null==r?void 0:r.size,fulfillmentType:i,upc:null==r?void 0:r.upc,groupingId:d.salsifyGrouping,address:(null==n?void 0:n.address)?{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""}:void 0,reason:"No "+i+" fulfillments available for selected size"}),void 0}const v=f[0]||null,y=(null==v?void 0:v.fulfillmentId)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:i,selectedFulfillmentId:y,previousFulfillmentType:d.selectedFulfillmentType,previousFulfillmentId:d.selectedFulfillmentId,fulfillmentHasAvailability:f.length>0});const b=d.sizes[d.selectedSizeId||""],x=splitCategoryPath(d.catPath),w=(null==v?void 0:v.price)||(null===(c=d.priceInfo)||void 0===c?void 0:c.avg)||0;this.googleTagManager.viewItem({item_id:null==b?void 0:b.id,item_name:d.name,item_brand:d.brand,item_size:null==b?void 0:b.size,item_category:x.category,item_category2:x.category2,item_category3:x.category3,price:centToDollar(w),item_type:d.type,item_subtype:d.subType,upc:null==b?void 0:b.upc,grouping_id:d.salsifyGrouping,product_id:null==b?void 0:b.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:i,["products."+t+".selectedFulfillment"]:v,["products."+t+".selectedFulfillmentId"]:y,["products."+t+".fulfillmentHasAvailability"]:f.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,n,i){const o={type:n,data:i||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:o})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),n=Object.keys(t);for(const i of n)this.store.set("products."+i+".rerender",!![])}async addToCart(t,n){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(o.CART),await this.cartCommands.addItem(n),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const i=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(i.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(i){this.logger.error("Error adding to cart",i),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,n){try{this.store.set("products."+t+".updating",!![]),await this.cartCommands.addPresaleItem(n),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(o.CHECKOUT),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(i){this.logger.error("Error adding to cart",i),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const n=this.store.get("products."+t),i={},fulfillmentEventData=t=>{const n={};for(const i in t){const o=t[i];n[i]={retailerId:o.retailerId,retailerName:o.retailerName,retailerAddress:o.retailerAddress,retailerTimezone:o.timezone,price:o.price,partNumber:o.partNumber,stock:o.stock,isEngravable:o.isVariantEngravable,fulfillmentId:o.fulfillmentId,fulfillmentType:o.fulfillmentType,modalities:o.modalities||[]}}return n};for(const o in n.sizes||{}){const t=n.sizes[o];i[o]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc||"",container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.attributes.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:{engraving:t.attributes.engraving||void 0,presale:t.attributes.presale||void 0},shippingFulfillments:fulfillmentEventData(t.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(t.onDemandFulfillments||{})}}return{identifier:t,selectedSizeId:n.selectedSizeId||null,selectedFulfillmentId:n.selectedFulfillmentId||null,selectedFulfillmentType:n.selectedFulfillmentType,id:n.id,name:n.name,brand:n.brand,catPath:n.catPath,category:n.category,classification:n.classification,type:n.type,salsifyGrouping:n.salsifyGrouping,subType:n.subType,mainImage:n.mainImage||null,images:n.images||[],region:n.region,country:n.country,material:n.material,abv:n.abv,proof:n.proof,age:n.age,color:n.color,flavor:n.flavor,variety:n.variety,appellation:n.appellation,vintage:n.vintage,description:n.description,htmlDescription:n.htmlDescription,tastingNotes:n.tastingNotes,priceInfo:n.priceInfo||null,sizes:i}}findFirstAvailableSize(t){const n=Object.values(t);for(const i of n){const t=i.shippingFulfillments||{},n=i.onDemandFulfillments||{},o=Object.values(t).length,r=Object.values(n).length;if(o+r>0)return i.id}return null}loadProductStoreUpdate(t){var n,i,o,s,c,d,u,h,p,f,v;try{const{products:[y,...b],retailers:x}=t,w=this.themeProvider.getConfigs("product"),C={};let k=![],S=![],E="",_=null,T=w.layout.enableShippingFulfillment?r.SHIPPING:r.ON_DEMAND,D=null,P=null;const F={};if(x&&Array.isArray(x)&&x.length>0)for(const t of x)for(const n of t.fulfillments){const i={retailerName:t.name,retailerAddress:t.address||null,type:n.type,timezone:n.timezone||"",canEngrave:n.canEngrave||![],expectation:n.expectation,fees:n.fees,hours:n.hours,retailerId:t.id,fulfillmentId:n.id,fulfillmentType:n.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]},o=getRetailerOffHours(i);o.isClosed&&!w.layout.showOffHours||(F[n.id]=i)}if(y.sizes&&Array.isArray(y.sizes)&&y.sizes.length>0)for(const t of y.sizes){const c={},d={};for(const u of t.variants){if((null===(n=null==u?void 0:u.fulfillmentTypes)||void 0===n?void 0:n.onDemand)&&""!==u.fulfillmentTypes.onDemand){const t=u.fulfillmentTypes.onDemand,n=F[t];n?d[t]={...n,isVariantEngravable:u.isEngravable,stock:u.stock,price:u.price,retailerId:u.retailerId,fulfillmentId:t,fulfillmentType:r.ON_DEMAND,modalities:[...n.modalities,...null!==(i=null==u?void 0:u.modalities)&&void 0!==i?i:[]],partNumber:u.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId "+t)}if((null===(o=null==u?void 0:u.fulfillmentTypes)||void 0===o?void 0:o.shipping)&&""!==u.fulfillmentTypes.shipping){const t=u.fulfillmentTypes.shipping,n=F[t];n?c[t]={...n,isVariantEngravable:u.isEngravable,stock:u.stock,price:u.price,retailerId:u.retailerId,fulfillmentId:t,fulfillmentType:r.SHIPPING,modalities:[...n.modalities,...null!==(s=null==u?void 0:u.modalities)&&void 0!==s?s:[]],partNumber:u.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+t)}}C[t.id]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.attributes.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:t.attributes,loading:![],error:null,shippingFulfillments:c,onDemandFulfillments:d}}const A=Object.values(C),z=this.findFirstAvailableSize(C);E=z||A[0]&&A[0].id||"",_=(null===(c=C[E])||void 0===c?void 0:c.image)||null;const O=(null===(d=C[E])||void 0===d?void 0:d.shippingFulfillments)||{},M=(null===(u=C[E])||void 0===u?void 0:u.onDemandFulfillments)||{},N=Object.values(O).length,R=Object.values(M).length;k=N+R>0;const B=T===r.SHIPPING?Object.values(O):Object.values(M);if(S=B.length>0,P=B[0]||null,D=(null==P?void 0:P.fulfillmentId)||null,!S){const t=T===r.SHIPPING?r.ON_DEMAND:r.SHIPPING,n=t===r.SHIPPING?Object.values(O):Object.values(M);n.length>0&&(T=t,P=n[0],D=(null==P?void 0:P.fulfillmentId)||null,S=!![])}if(!k){const t=this.store.get("address"),n=splitCategoryPath(y.catPath),i=C[E];this.googleTagManager.productNoAvailability({productId:null==i?void 0:i.id,productName:y.name,productBrand:y.brand,productCategory:n.category,productCategory2:n.category2,productCategory3:n.category3,productType:y.type,productSubtype:y.subType,productPrice:(null===(h=y.priceInfo)||void 0===h?void 0:h.average)||0,upc:null==i?void 0:i.upc,groupingId:y.salsifyGrouping,address:(null==t?void 0:t.address)?{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""}:void 0,reason:"No fulfillments available for any size"})}return{identifier:"",id:y.id||"",name:y.name,description:y.description,htmlDescription:y.htmlDescription,images:y.images,priceInfo:{min:(null===(p=y.priceInfo)||void 0===p?void 0:p.minimum)||0,max:(null===(f=y.priceInfo)||void 0===f?void 0:f.maximum)||0,avg:(null===(v=y.priceInfo)||void 0===v?void 0:v.average)||0},brand:y.brand,region:y.region||"",country:y.country||"",material:y.material||"",abv:y.abv||"",proof:y.proof||"",age:y.age||"",color:y.color||"",flavor:y.flavor||"",variety:y.variety||"",appellation:y.appellation||"",vintage:y.vintage||"",tastingNotes:y.tastingNotes||"",catPath:y.catPath,category:y.category,classification:y.classification,type:y.type,subType:y.subType,salsifyGrouping:y.salsifyGrouping,sizes:C,productHasAvailability:k,fulfillmentHasAvailability:S,selectedSizeId:E,mainImage:_,selectedFulfillmentType:T,selectedFulfillmentId:D,selectedFulfillment:P,drawer:{isOpen:![],contentConfig:null},error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(y){throw this.logger.error("Product data processing error",y),y}}}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 n=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(n)),await this.cartCommands.resetCart(),await this.store.persist()}catch(i){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==i?void 0:i.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==i?void 0:i.message)||"Failed to update downstream state after address change"}),i}this.googleTagManager.addressUpdated({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},coordinates:t.coordinates}),this.pubSub.publishAction(n.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,i){try{const n=buildFormattedAddressString(t),o={id:"",formattedAddress:n,address:t,coordinates:i};await this.setSelectedAddress(o)}catch(o){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country||""},error:(null==o?void 0:o.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:t,coordinates:i,error:(null==o?void 0:o.message)||"Failed to set manual address"}),o}}async clearSelectedAddress(){this.store.set("address",x),this.pubSub.publishAction(n.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const t=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(t),this.store.clearLocalStorage()}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}}class ProductListCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}async getProductList(t){var n,i;const o=t,r=this.clientConfig.getConfigs();o.entity=null!==(i=null!==(n=window.location.hostname)&&void 0!==n?n:r.partnerName)&&void 0!==i?i:void 0,o.visitorId=r.userDeviceId,o.loc=this.getLocation(),o.isLegacy=!![];const s=await this.api.catalogSearch(o);return s.products&&s.products.length>0&&this.trackViewItemList(s.products),s}async addToCart(t){try{this.uiCommands.openDrawer(o.CART),await this.cartCommands.addItem(t)}catch(n){throw this.logger.error("Error adding product to cart from product list",n),n}}async addPresaleToCart(t){try{await this.cartCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(o.CHECKOUT)}catch(n){throw this.logger.error("Error adding presale product to cart from product list",n),n}}trackViewItemList(t){if(0!==t.length)try{const n=t.map((t,n)=>({...this.convertProductToBaseItem(t),index:n+1}));this.googleTagManager.viewItemList(n,"product_list","Product List")}catch(n){this.logger.error("Error tracking view_item_list event",n)}}trackSelectItem(t){try{const n=this.convertProductToBaseItem(t);this.googleTagManager.selectItem(n,"product_list","Product List")}catch(n){this.logger.error("Error tracking select_item event",n)}}convertProductToBaseItem(t){var n,i,o;const r=null===(n=t.sizes)||void 0===n?void 0:n[0],s=null===(i=null==r?void 0:r.variants)||void 0===i?void 0:i[0],c=splitCategoryPath(t.catPath);return{item_id:null==r?void 0:r.id,item_name:t.name,item_brand:t.brand,item_size:null==r?void 0:r.size,item_category:c.category,item_category2:c.category2,item_category3:c.category3,price:(null==s?void 0:s.price)?centToDollar(s.price):(null===(o=t.priceInfo)||void 0===o?void 0:o.average)?centToDollar(t.priceInfo.average):void 0,item_type:t.type,item_subtype:t.subType,upc:null==r?void 0:r.upc,grouping_id:t.salsifyGrouping,product_id:null==r?void 0:r.id,item_list_id:"product_list",item_list_name:"Product List"}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}class ClientActionService{constructor(){this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:t=>this.command.product.productDataForEventFromStore(t)},this.addressActions={setAddressByPlacesId:async t=>{try{if(!t||""===t.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const n=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:n.address,coordinates:n.coords,formattedAddress:n.formattedAddress})}catch(n){throw this.logger.error("Error setting address by placesId:",n),n}},setAddressManually:async(t,n)=>{try{if(!t||!n)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 n.lat||"number"!=typeof n.long)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof n.lat+", long: "+typeof n.long,!![]);if(n.lat<-90||n.lat>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+n.lat,!![]);if(n.long<-180||n.long>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+n.long,!![]);await this.command.address.setAddressManually(t,n)}catch(i){throw this.logger.error("Error setting manual address:",i),i}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(o.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(o.CART)},addProduct:async(t,i)=>{var s,c;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;const d=this.getLocation();if(void 0===d)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=i?i:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(o.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;i===!![]&&this.command.ui.openDrawer(o.CART);const u=[...new Set(t.map(t=>t.identifier))],h=await this.api.getProductsData(u,d);if(!h||!h.products||0===h.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const n of t){let t=null;for(let r=0;r<h.products.length;r++){const i=h.products[r];let o=![];for(let t=0;t<i.sizes.length;t++){const r=i.sizes[t];if(r.upc===n.identifier||r.id===n.identifier||i.salsifyGrouping===n.identifier){o=!![];break}}if(o){t=i;break}}if(!t){this.logger.warn("No product found for identifier: "+n.identifier);continue}const i=t.sizes[0];if(!i){this.logger.warn("No sizes found for product: "+n.identifier);continue}if((null===(c=null===(s=null==i?void 0:i.attributes)||void 0===s?void 0:s.presale)||void 0===c?void 0:c.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+n.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let o=null;for(let s=0;s<i.variants.length;s++){const t=i.variants[s];let c=![];if(n.fulfillmentType===r.ON_DEMAND&&(c=!(!t.fulfillmentTypes||!t.fulfillmentTypes.onDemand||""===t.fulfillmentTypes.onDemand)),n.fulfillmentType===r.SHIPPING&&(c=!(!t.fulfillmentTypes||!t.fulfillmentTypes.shipping||""===t.fulfillmentTypes.shipping)),c){o=t;break}}if(!o){this.logger.warn("No supported variant found for product: "+n.identifier+" with fulfillment type: "+n.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const d=n.fulfillmentType===r.ON_DEMAND?o.fulfillmentTypes.onDemand:o.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:i.upc,fulfillmentId:d,partNumber:o.partNumber,quantity:n.quantity,identifier:n.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(n.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:u}),this.logger.info("Products added to cart successfully:",u)}catch(d){throw this.logger.error("Error adding products to cart:",d),this.clearPendingCartOperation(),this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:d.message||"Failed to add products to cart"}),d}},applyPromoCode:async t=>{try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const 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("cart.error","Promo codes are not allowed"),void 0;const s=this.store.get("cart.promoCode");if(s&&s.code===i)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(i);const c=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{discountAmount:c.amounts.discounts,newTotal:c.amounts.total}),this.logger.info("Promo code applied successfully")}catch(i){throw this.logger.error("Failed to apply promo code:",i),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),i}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),i=t.layout.allowPromoCodes;if(!i)return this.logger.warn("Promo codes are not allowed"),this.store.set("cart.error","Promo codes are not allowed"),void 0;await this.command.cart.removePromoCode();const o=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{newTotal:o.amounts.total}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(n.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(o.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(o.CHECKOUT)},addProduct:async(t,i)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;i===!![]&&this.command.ui.openDrawer(o.CHECKOUT);const r=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:r}),this.logger.info("Products added to checkout successfully:",r)}catch(r){throw this.logger.error("Error adding products to checkout:",r),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:r.message||"Failed to add products to checkout"}),r}},addPresaleProduct:async t=>{var i,s;try{if(!t||"object"!=typeof t||!t.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;const c=this.getLocation();if(void 0===c)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(o.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const d=await this.api.getProductsData([t.identifier],c);if(!d||!d.products||0===d.products.length)return this.logger.warn("No product data found for the provided presale identifier"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No product found",isPresale:!![]}),void 0;const u=d.products[0],h=u.sizes[0];if(!h)return this.logger.warn("No sizes found for presale product: "+t.identifier),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No sizes found for product",isPresale:!![]}),void 0;if((null===(s=null===(i=null==h?void 0:h.attributes)||void 0===i?void 0:i.presale)||void 0===s?void 0:s.isActive)!==!![])return this.logger.warn("Product is not a presale item: "+t.identifier),this.store.set("checkout.error","Product is not available for presale"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0;let p=null;for(let n=0;n<h.variants.length;n++){const i=h.variants[n];let o=![];if(t.fulfillmentType===r.ON_DEMAND&&(o=!(!i.fulfillmentTypes||!i.fulfillmentTypes.onDemand||""===i.fulfillmentTypes.onDemand)),t.fulfillmentType===r.SHIPPING&&(o=!(!i.fulfillmentTypes||!i.fulfillmentTypes.shipping||""===i.fulfillmentTypes.shipping)),o){p=i;break}}if(!p)return this.logger.warn("No supported variant found for presale product: "+t.identifier+" with fulfillment type: "+t.fulfillmentType),this.store.set("checkout.error","Presale product has no availability"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0;const f=t.fulfillmentType===r.ON_DEMAND?p.fulfillmentTypes.onDemand:p.fulfillmentTypes.shipping;await this.command.cart.addPresaleItem({upc:h.upc,fulfillmentId:f,partNumber:p.partNumber,quantity:t.quantity,engravingLines:[],identifier:t.identifier}),this.command.ui.openDrawer(o.CHECKOUT),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:1,identifiers:[t.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+t.identifier)}catch(c){throw this.logger.error("Error adding presale product to checkout:",c),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:c.message||"Failed to add presale product to checkout",isPresale:!![]}),c}},applyPromoCode:async t=>{var i;try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("checkout.error","Invalid promo code provided"),void 0;const o=t.trim().toUpperCase(),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;const c=this.store.get("checkout.promoCode");if(c&&c.code===o)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const d=this.store.get("checkout"),u=null==d?void 0:d.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:(null==u?void 0:u.discountAmount)||0,newTotal:(null===(i=null==d?void 0:d.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(o){throw this.logger.error("Failed to apply checkout promo code:",o),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),o}},removePromoCode:async()=>{var t;try{const i=this.themeProvider.getConfigs("global"),o=i.layout.allowPromoCodes;if(!o)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;await this.command.checkout.removePromoCode();const r=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{newTotal:(null===(t=null==r?void 0:r.amounts)||void 0===t?void 0:t.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(i){throw this.logger.error("Failed to remove checkout promo code:",i),i}},applyGiftCard:async t=>{var i;try{const o=this.themeProvider.getConfigs("checkout"),r=o.layout.allowGiftCards;if(!r)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.applyGiftCard(t);const s=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:(null===(i=null==s?void 0:s.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Gift card applied successfully")}catch(o){throw this.logger.error("Failed to apply gift card:",o),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be applied"}),o}},removeGiftCard:async t=>{var i;try{const o=this.themeProvider.getConfigs("checkout"),r=o.layout.allowGiftCards;if(!r)return this.logger.warn("Gift cards are not allowed"),this.store.set("checkout.error","Gift cards are not allowed"),void 0;await this.command.checkout.removeGiftCard(t);const s=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:(null===(i=null==s?void 0:s.amounts)||void 0===i?void 0:i.total)||0}),this.logger.info("Gift card removed successfully")}catch(o){throw this.logger.error("Failed to remove gift card:",o),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be removed"}),o}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:(t,n)=>{this.command.checkout.toggleMarketingPreferences(t,n)},getDetails:()=>{var t,n,i;const o=this.store.get("checkout"),r=o.items||{},s={};for(const[c,d]of Object.entries(r))s[c]={liquidId:d.liquidId,variantId:d.variantId,cartItemId:c,retailerId:d.retailerId,fulfillmentId:d.fulfillmentId,salsifyGrouping:d.salsifyGrouping,name:d.name,catPath:d.catPath,volume:d.volume,uom:d.uom,proof:d.proof,abv:d.abv,containerType:d.containerType,container:d.container,size:d.size,pack:d.pack,packDesc:d.packDesc,mainImage:d.mainImage,brand:d.brand,partNumber:d.partNumber,upc:d.upc,sku:d.sku,price:d.price,unitPrice:d.unitPrice,quantity:d.quantity,unitTax:d.unitTax,bottleDeposits:d.bottleDeposits,attributes:d.attributes,retailerName:d.retailerName,expectationDetail:d.expectationDetail};return{cartId:o.cartId||"",isGift:o.isGift||![],billingSameAsShipping:o.paymentForm.billingSameAsShipping,marketingPreferences:{canEmail:(null===(t=o.marketingPreferences)||void 0===t?void 0:t.canEmail)||![],canSms:(null===(n=o.marketingPreferences)||void 0===n?void 0:n.canSms)||![]},hasPromoCode:!!(null===(i=o.promoCode)||void 0===i?void 0:i.code),hasGiftCards:Array.isArray(o.giftCards)&&o.giftCards.length>0,itemCount:Object.values(s||{}).reduce((t,n)=>t+(n.quantity||0),0),amounts:o.amounts,items:s}}},this.actions={product:this.productActions,address:this.addressActions,cart:this.cartActions,checkout:this.checkoutActions},this.store=StoreService.getInstance(),this.command=CommandService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get("ClientAction"),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}setupAddressUpdateListener(){const a=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+n.ADDRESS_UPDATED,a)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,n=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(t,n)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}const ut="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1;\n margin: 0 12px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n gap: 12px;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 2px;\n min-width: 50px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n gap: 8px;\n flex-wrap: wrap;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n gap: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n gap: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",ht="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,n=t.instances;if(n)for(const[o,r]of n)this.interceptLoggerInstance(r,o);const i=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const n=i(t);return this.interceptLoggerInstance(n,t),n}}interceptLoggerInstance(t,n){if(t.o)return;const i=t.debug.bind(t),o=t.info.bind(t),r=t.warn.bind(t),s=t.error.bind(t),m=(t,i,o)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:i,data:o,context:n});t.debug=(t,n)=>{i(t,n),this.addLogEntry(m("debug",t,n))},t.info=(t,n)=>{o(t,n),this.addLogEntry(m("info",t,n))},t.warn=(t,n)=>{r(t,n),this.addLogEntry(m("warn",t,n))},t.error=(t,n)=>{s(t,n),this.addLogEntry(m("error",t,n))},t.o=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),n=t.publishAction.bind(t);t.publishAction=(t,i)=>{n(t,i),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:i,context:"PubSub"})};const i=t.publishForm.bind(t);t.publishForm=(t,n)=>{i(t,n),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:n,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),n=t.executeEvent.bind(t);t.executeEvent=(t,i,o)=>{n(t,i,o),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+i,data:o,context:"GTM."+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 n=this.createLogElement(t);this.logContainer.appendChild(n)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(ht);t&&t.remove(),this.panelElement=document.createElement(ht);const n=window.innerWidth<=768,i=window.innerWidth<=480;i?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):n?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const t=this.panelElement.attachShadow({mode:"closed"}),n=document.createElement("style");n.textContent=ut,t.appendChild(n),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const i=this.createHeader();this.panelContainer.appendChild(i);const o=this.createToggles();this.panelContainer.appendChild(o),this.logContainer=document.createElement("div"),this.logContainer.className="logs",this.logContainer.title="Debug logs - scroll to see more",this.panelContainer.appendChild(this.logContainer);const r=this.createResizeHandle();this.panelContainer.appendChild(r),t.appendChild(this.panelContainer),this.setupShadowEventListeners(t)}createHeader(){const t=document.createElement("div");t.className="header",t.title="Drag to move panel";const n=document.createElement("div");n.className="icon",n.innerHTML="🔍",n.title="Elements Debug Console",n.style.cursor="help";const i=document.createElement("div");i.className="title-container";const o=document.createElement("div");o.className="title",o.textContent="Elements Debug Console";const r=document.createElement("div");r.className="subtitle",r.textContent="Live SDK logs, events & GTM tracking",i.appendChild(o),i.appendChild(r);const s=document.createElement("button");return s.className="minimize",s.innerHTML="−",s.title="Minimize debug panel",s.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(n),t.appendChild(i),t.appendChild(s),t}createToggles(){const t=document.createElement("div");t.className="toggles";const n=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];n.forEach(({key:n,label:i,description:o,color:r})=>{const s=document.createElement("label");s.className="toggle",s.title=o;const c=document.createElement("input");c.type="checkbox",c.checked="showLogs"!==n,c.addEventListener("change",t=>{const i=t.target;"showEvents"===n&&(this.showEvents=i.checked),"showGtmEvents"===n&&(this.showGtmEvents=i.checked),"showLogs"===n&&(this.showLogs=i.checked),this.renderLogs()});const d=document.createElement("span");d.textContent=i,d.style.color=r,s.appendChild(c),s.appendChild(d),t.appendChild(s)});const i=document.createElement("button");return i.className="clear-btn",i.innerHTML="🗑️",i.title="Clear all logs",i.addEventListener("click",()=>this.clearLogs()),t.appendChild(i),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let n=![],i=0,o=0,r=0,s=0;t.addEventListener("mousedown",t=>{n=!![],i=t.clientX,o=t.clientY,r=Number.parseInt(this.panelElement.style.width,10)||500,s=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",K),document.addEventListener("mouseup",L),t.preventDefault()});const K=t=>{if(!n||!this.panelElement)return;const c=t.clientX-i,d=t.clientY-o,u=window.innerWidth<=768,h=window.innerWidth<=480;let p,f,v,y;h?(p=280,f=window.innerWidth-20,v=200,y=.4*window.innerHeight):u?(p=300,f=window.innerWidth-30,v=200,y=.4*window.innerHeight):(p=300,f=800,v=200,y=600);const b=Math.max(p,Math.min(f,r+c)),x=Math.max(v,Math.min(y,s+d));this.panelElement.style.width=b+"px",this.panelElement.style.height=x+"px"},L=()=>{n=![],document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",L)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const n=t.querySelector(".header");if(n){let t=![],i=0,o=0,r=0,s=0;n.addEventListener("mousedown",n=>{if(n.target.classList.contains("minimize"))return;t=!![],i=n.clientX,o=n.clientY;const c=this.panelElement.getBoundingClientRect();r=c.left,s=c.top,document.addEventListener("mousemove",K),document.addEventListener("mouseup",L),n.preventDefault()});const K=n=>{if(!t||!this.panelElement)return;const c=n.clientX-i,d=n.clientY-o;this.panelElement.style.left=r+c+"px",this.panelElement.style.top=s+d+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},L=()=>{t=![],document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",L)}}}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 n=document.createElement("div");n.className="log-entry "+t.type+" "+t.level;const i=new Date(t.timestamp).toLocaleTimeString();return n.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+i+'</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 ",n}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(n){return String(t)}}escapeHtml(t){const n=document.createElement("div");return n.textContent=t,n.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.l()){const n=this.u(t);if(n)return this.h(t,n)}return this.cachedFingerprint||(this.cachedFingerprint=this.m()),this.h(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.v(),browser:this.C(),timezone:this.k()}}isLocalStorageWebApiAvailable(){return this.l()}h(t,n){return(t+"_"+n).toLowerCase()}l(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const t=window.localStorage,n="__localStorage_test_"+Date.now()+"__",i="test";t.setItem(n,i);const o=t.getItem(n);return o!==i?(this.isLocalStorageAvailable=![],![]):(t.removeItem(n),this.isLocalStorageAvailable=!![],!![])}catch(t){const i=t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name);if(i)try{const t=window.localStorage;return t&&t.length>0?(this.S()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(n){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],t instanceof DOMException){const n={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},i=n[t.name]||"Storage error: "+t.name,o=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+o+": "+i)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}u(t){try{const n=this.clientConfig.get("localStorageKeyPrefix")+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const i=localStorage.key(t);if(null==i?void 0:i.startsWith(n)){const t=i.substring(n.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(n){return null}}m(){const t=this.getFingerprintData(),n=Object.keys(t).sort().map(n=>n+":"+t[n]).join("|");return this._(n)}v(){try{const t=screen,n=t.colorDepth||24,i=t.pixelDepth||n,o=this.T(),r=Math.round(100*(window.devicePixelRatio||1));return n+"|"+i+"|"+o+"|"+r}catch(t){return"24|24|srgb|100"}}T(){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(W){}return"srgb"}C(){var t;try{const n=navigator,i=[],o=((null===(t=n.languages)||void 0===t?void 0:t[0])||n.language||"en").substring(0,2);i.push(o),i.push(n.hardwareConcurrency||4);const r=(n.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);i.push(r),i.push(n.cookieEnabled?"1":"0"),i.push(n.maxTouchPoints||0),i.push(n.deviceMemory||0),i.push(this.D()),i.push(this.S()?"webview":"browser");const s=["bluetooth"in n?"1":"0","usb"in n?"1":"0","mediaDevices"in n?"1":"0","permissions"in n?"1":"0","credentials"in n?"1":"0","storage"in n?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return i.push(s.join("")),i.join("|")}catch(n){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}D(){try{const t=navigator.userAgent.toLowerCase();return t.includes("instagram")?"ig_webview":t.includes("fban")||t.includes("fbav")?"fb_webview":t.includes("tiktok")?"tiktok_webview":t.includes("linkedin")?"linkedin_webview":t.includes("snapchat")?"snapchat_webview":t.includes("twitter")?"twitter_webview":t.includes("line/")?"line_webview":t.includes("micromessenger")?"wechat_webview":t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}S(){try{const t=navigator.userAgent.toLowerCase(),n=navigator,i=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return i.some(n=>t.includes(n))?!![]:void 0===n.standalone||n.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}k(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}_(t){const n=16777619;let i=2166136261,o=2166136261,r=2166136261,s=2166136261;for(let c=0;c<t.length;c++){const d=t.charCodeAt(c);i^=d,i=Math.imul(i,n),o^=d<<1,o=Math.imul(o,n),r^=d<<2,r=Math.imul(r,n),s^=d<<3,s=Math.imul(s,n)}return i=Math.abs(i),o=Math.abs(o),r=Math.abs(r),s=Math.abs(s),i.toString(16)+o.toString(16)+r.toString(16)+s.toString(16)}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance();const n=this.clientConfig.get("env"),i=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!![],endpoint:i,batchSize:n===t.PRODUCTION?5:10,batchInterval:n===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,n,i={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const o=Date.now();try{const r={eventId:"event_"+o+"}",timestamp:o,level:t,message:n,context:i.context,error:i.error?this.buildErrorContext(i.error):void 0,component:i.component,data:i.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(r)}catch(r){this.handleInternalError(r)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code,statusCode:t.status||t.statusCode}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){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 n=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const i=this.createBatch(n);try{this.sendBatch(i),this.stats.batchesSent++}catch(o){this.stats.failedBatches++,this.handleInternalError(o),this.eventQueue.unshift(...n),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const n=Date.now();return{batchId:"batch_"+n,timestamp:n,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const n=new Blob([JSON.stringify(t)],{type:"text/plain"}),i=navigator.sendBeacon(this.config.endpoint,n);if(i)return}catch(n){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const n=new XMLHttpRequest;if(n.open("POST",this.config.endpoint,![]),n.setRequestHeader("Content-Type","text/plain"),n.send(JSON.stringify(t)),n.status<200||n.status>=300)throw new SDKError("XHR request failed with status: "+n.status)}catch(n){throw new SDKError("Both sendBeacon and XHR failed: "+n.message)}}truncateStackTrace(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(n){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:n}){var i;this.P=Object.freeze(t),this.I=Object.freeze({type:n.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(i=null==n?void 0:n.useShadowDom)&&void 0!==i?i:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(t){return t.map(t=>this.interpolatePath(t))}interpolatePath(t){if("string"!=typeof t)return t;const n=/\{([^}]+)}/g;return t.replace(n,(n,i)=>{const o=this.P[i];return null==o?(this.logger.warn('Parameter "'+i+'" not found in component params for path "'+t+'"'),n):String(o)})}connectedCallback(){var t,n;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.I.useShadowDom?this.attachShadow({mode:this.clientConfig.isProduction()?"closed":"open"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(i){this.logger.error("Component connectedCallback error in "+((null===(n=this.I)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"connectedCallback")}}disconnectedCallback(){var t,n;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(i){this.logger.error("Component disconnectedCallback error in "+((null===(n=this.I)||void 0===n?void 0:n.tagName)||"unknown"),i),i instanceof Error&&this.captureComponentError(i,"disconnectedCallback")}}setup(){var t,n,i;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(n=this.beforeConnected)||void 0===n||n.call(this)}catch(o){this.logger.error("Component setup error in "+((null===(i=this.I)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"setup")}}cleanup(){this.isDestroyed=!![],this.renderTimeout&&cancelAnimationFrame(this.renderTimeout),this.autoDestroyTimeout&&clearTimeout(this.autoDestroyTimeout);for(const n of this.unsubscribers)try{n()}catch(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 n=this.reactiveOptions.autoDestroyPath;if(!n&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(n=this.reactiveOptions.watchStorePaths[0]),!n)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const i=this.interpolatePath(n),o=this.store.watch(i,(t,n)=>{this.isDestroyed||void 0===t&&void 0!==n&&this.handleAutoDestroy(i)});this.unsubscribers.push(o)}handleAutoDestroy(t){var n;if(this.isDestroyed)return;null===(n=this.beforeAutoDestroy)||void 0===n?void 0:n.call(this,t);const i=this.reactiveOptions.autoDestroyDelay||0;i>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},i):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(n){this.logger.error("Error during auto-destroy of "+this.I.tagName,n),n instanceof Error&&this.captureComponentError(n,"auto-destroy")}}setupStoreWatchers(){var t;try{let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.P)return;t=this.interpolateStorePaths(t);const n=this.store.watchMany(t,t=>{var n,i;try{if(this.isDestroyed)return;const i=t.map(t=>t.path).join(", "),o="store:["+i+"]",r=null===(n=this.onStoreChanged)||void 0===n?void 0:n.call(this,t);r!==![]&&this.triggerRender(o)}catch(o){this.logger.error("Store watcher callback error in "+((null===(i=this.I)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"storeWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Store watchers setup error in "+((null===(t=this.I)||void 0===t?void 0:t.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupStoreWatchers")}}setupNonRenderingWatchers(){var t;try{let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.P)return;t=this.interpolateStorePaths(t);const n=this.store.watchMany(t,t=>{var n,i;try{if(this.isDestroyed)return;null===(n=this.onStoreWatch)||void 0===n?void 0:n.call(this,t)}catch(o){this.logger.error("Non-rendering watcher callback error in "+((null===(i=this.I)||void 0===i?void 0:i.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"nonRenderingWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.I)||void 0===t?void 0:t.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"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,n;if(!this.initialized||this.isDestroyed)return;const i=performance.now();this.renderCount++;try{const n=this.template();"string"==typeof n&&(this.container.innerHTML=n),n instanceof HTMLElement&&safeReplaceChildren(this.container,n),Array.isArray(n)&&safeReplaceChildren(this.container,...n);const r=performance.now()-i;this.logRenderInfo(r);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(o){this.logger.error("❌ afterRender hook error in "+this.I.tagName,o),o instanceof Error&&this.captureComponentError(o,"afterRender")}}catch(r){const t=performance.now()-i;this.logger.error("❌ Component render error in "+this.I.tagName,r),this.captureComponentError(r,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.I.type,message:r instanceof Error?r.message:String(r)}));try{null===(n=this.onError)||void 0===n?void 0:n.call(this,r,"render")}catch(s){this.logger.error("❌ onError hook error in "+this.I.tagName,s)}}}logRenderInfo(t){const n=this.I.type,i=this.I.tagName,o=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+o+" "+n+" </"+i+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&(this.logger.warn("⚠️ Slow render in "+n+"("+i+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:t,threshold:16,componentType:n,tagName:i,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+i+":performance",component:{type:n,tagName:i,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.I.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,n,i){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.I.tagName+":"+n,component:{type:this.I.type,tagName:this.I.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:i,useShadowDom:this.I.useShadowDom}})}catch(o){}}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.add(...n)}}addHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.add(...n)}removeHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.remove(...n)}toggleHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const i of n)this.classList.toggle(i)}addHostAttribute(t,n){t&&"string"==typeof t&&n&&"string"==typeof n&&(this.setAttribute(t,String(n)),this.hostAttributes[t]=String(n))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[n,i]of Object.entries(t))n&&"string"==typeof n&&i&&"string"==typeof i&&this.setAttribute(n,String(i))}get params(){return this.P}get config(){return this.themeProvider.getComponentConfig(this.I.type)}get elementConfig(){return this.I}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,n){return this.store.set(t,n)}watchStore(t,n){const i=this.store.watch(t,n);return this.unsubscribers.push(i),i}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const n=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:o.ADDRESS_DISPLAY,isIndependentComponent:!![],options:n})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,n,i,r;const s=this.getStoreValue("address"),c=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],d=null!==(n=this.params.productId)&&void 0!==n?n:"",u=null!==(i=this.params.options)&&void 0!==i?i:{},h=null!==(r=u.showLabel)&&void 0!==r?r:!![],p=[];if(h){const t=document.createElement("span");t.textContent="Delivers to:",p.push(t)}const f=document.createElement("button");f.type="button",f.textContent=s.formattedAddress||"Select an address";const v=s.formattedAddress?"Change delivery address, currently set to "+s.formattedAddress:"Select delivery address";return f.setAttribute("aria-label",v),f.addEventListener("click",async()=>{if(c)return this.commands.ui.openDrawer(o.ADDRESS_INPUT,{productId:d,isIndependentComponent:!![]}),void 0;!c&&d&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(o.ADDRESS_INPUT,{productId:d}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(d,o.ADDRESS_INPUT,{productId:d}))}),p.push(f),p}}const ArrowRightIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="arrow-right-icon '+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:t=24,height:n=24,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 489 489" class="bag-icon '+i+'" style="'+r+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckboxIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="checkbox-icon '+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="'+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="chevron-left-icon '+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},CloseIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="close-icon '+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="error-info-icon '+i+'" style="'+r+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="info-icon '+i+'" style="'+r+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="search-icon '+i+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+r+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="success-icon '+i+'" style="'+r+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="trash-icon '+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:t=16,height:n=16,className:i="",color:o=null})=>{const r=o?"--icon-color: "+o:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="warning-icon '+i+'" style="'+r+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const n=t.target,i=n.value.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const o=/^\d/.test(i);if(i.length<this.minSearchLength||!o)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(i)},300)},this.closeDrawer=async()=>{const t=this.params.productId,n=this.clientConfig.isMobile(),i=this.isIndependentComponent();(n||i)&&this.commands.ui.closeDrawer(),!n&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(W){this.logger.error("Address edit cancellation failed",W)}},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"),n=(null==t?void 0:t.coordinates.lat)!==this.selectedAddress.coordinates.lat||(null==t?void 0:t.coordinates.long)!==this.selectedAddress.coordinates.long;n&&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 n=t.currentTarget.dataset.suggestionId;if(n)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(n);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:n,address:t.address,coordinates:t.coords,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(i){this.logger.error("Address details retrieval failed",i),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=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 n=await this.commands.address.searchAddresses(t);this.suggestions=n.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(n){this.logger.error("Address search operation failed",n),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const 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 n=this.createElement("li",{className:"suggestion-item"}),i=this.createElement("span",{textContent:t.description});n.appendChild(i),n.setAttribute("data-suggestion-id",t.id),n.setAttribute("role","option"),n.setAttribute("aria-label","Select address: "+t.description),n.setAttribute("tabindex","0"),n.addEventListener("click",this.handleSuggestionClick),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),this.suggestionsContainer.appendChild(n)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,n){const i=document.createElement(t);return n&&Object.assign(i,n),i}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 n=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),i=this.createElement("span",{className:"error-text"});return t.appendChild(n),t.appendChild(i),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,n,i;const o=this.getConfigs("global"),r=null!==(t=this.params.options)&&void 0!==t?t:{},s=null!==(n=r.showLabel)&&void 0!==n?n:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),s){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const c=this.createElement("div",{className:"input-wrapper "+o.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(i=this.selectedAddress)||void 0===i?void 0:i.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),c.appendChild(this.inputElement);const d=this.createElement("span");d.className="input-icon",d.innerHTML=SearchIcon({width:16,height:16,className:""}),c.appendChild(d),this.inputContainer.appendChild(c),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const u=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),h=[this.inputContainer,u,this.errorContainer],p=this.createElement("div",{className:"action-buttons"}),f=this.createCancelButton();p.appendChild(f);const v=this.createCheckButton();return p.appendChild(v),h.push(p),document.addEventListener("click",this.handleDocumentClick),h}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const t=[],n=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!n){const n=ComponentFactoryService.createElement({type:o.CART_HEADER});t.push(n)}const i=ComponentFactoryService.createElement({type:o.CART_BODY});t.push(i);const r=ComponentFactoryService.createElement({type:o.CART_FOOTER});return t.push(r),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=document.createElement("div");t.className="empty-cart-container";const n=document.createElement("h3");return n.className="empty-cart-content",n.textContent="Your cart is empty",t.appendChild(n),t}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:o.CART_RETAILER,retailerId:t.id})}catch(n){return this.logger.error("Cart retailer component creation failed",n),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,n){const i=this.createRetailerElement(n);i.setAttribute("data-retailer-id",t),this.container.appendChild(i)}removeRetailerElement(t){const n=this.getRetailerElementById(t);n&&n.remove()}updateRetailerElement(t,n){const i=this.getRetailerElementById(t);if(i){const o=this.createRetailerElement(n);o.setAttribute("data-retailer-id",t),i.replaceWith(o)}}hasRetailerDataChanged(t,n){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const n={};for(const[i,o]of Object.entries(t))o&&"object"==typeof o&&o.id&&(n[i]=o);return n}getValidRetailerIds(t){const n=this.getValidRetailers(t);return new Set(Object.keys(n))}onStoreChanged(t){const n=t.find(t=>"cart.retailers"===t.path),i=t.find(t=>"cart.loading"===t.path);if(n){const t=this.getValidRetailers(n.oldValue),i=this.getValidRetailers(n.value),o=this.getValidRetailerIds(n.oldValue),r=this.getValidRetailerIds(n.value),s=o.size,c=r.size,d=this.getValidRetailers(this.getStoreValue("cart.retailers")),u=Object.keys(d).length;if(c>0&&0===u)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===s&&c>0){this.container.innerHTML="";for(const[t,n]of Object.entries(i))this.addRetailerElement(t,n)}else if(s>0&&0===c)this.showEmptyCartState();else if(c>0){for(const t of o)r.has(t)||this.removeRetailerElement(t);for(const n of r){const r=i[n],s=t[n];o.has(n)?this.hasRetailerDataChanged(s,r)&&this.updateRetailerElement(n,r):this.addRetailerElement(n,r)}}else 0===s&&0===c&&this.showEmptyCartState()}if(i){const t=i.value,n=i.oldValue;t!==n&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return i||n,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},n=Object.values(t);if(0===n.length)return this.createEmptyCartElement();const i=[];for(const o of n){const t=this.createRetailerElement(o);t.setAttribute("data-retailer-id",o.id),i.push(t)}return i}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const n=t.some(t=>t.path.includes("cart.items")),i=t.some(t=>t.path.includes("cart.totals")),o=t.some(t=>t.path.includes("cart.fulfillments")),r=t.some(t=>"cart.loading"===t.path),s=t.some(t=>t.path.includes("cart.retailers"));if(n&&this.updateSubtotalItemsCount(),i&&this.subtotalPrice){const t=this.getStoreValue("cart.totals");this.subtotalPrice.textContent=""+formatCentToDollarText(t.subtotal+t.engravingFee-t.discounts)}(o||i||r||n||s)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const n=this.getStoreValue("cart.items")||{},i=Object.values(n).some(t=>t.updating);if(i)return!![];const o=this.getStoreValue("cart.fulfillments")||{},r=Object.values(o).some(t=>t.updating);if(r)return!![];const s=this.getStoreValue("cart.retailers")||{},c=Object.values(s).some(t=>t.updating);return c?!![]:![]}hasUnmetMinimum(t){var n;const i=t.subtotal;if(t.type===r.SHIPPING){const o=t.fees;if((null===(n=o.individual)||void 0===n?void 0:n.active)&&o.individual.min>0&&i<o.individual.min)return!![]}if(t.type===r.ON_DEMAND){const n=t.fees;if(n.min>0&&i<n.min)return!![]}return![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments")||{};return Object.values(t).some(t=>this.hasUnmetMinimum(t))}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},n=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),i=this.shouldDisableCheckout(),o=t||i||!n;this.checkoutButton.disabled=o,this.checkoutButton.classList.toggle("checkout-btn-disabled",o),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),n=Object.values(t).reduce((t,n)=>t+n.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+n+" item"+(1!==n?"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"),n=this.getStoreValue("cart.totals"),i=[],r=document.createElement("div");r.className="cart-footer-header";const s=document.createElement("div");s.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",s.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(n.subtotal+n.engravingFee-n.discounts),s.appendChild(this.subtotalPrice);const c=document.createElement("p");if(c.textContent="Taxes & fees will be calculated at checkout",c.className="taxes-fees-info",r.appendChild(s),r.appendChild(c),i.push(r),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:o.CART_PROMO_CODE});i.push(t)}const d=ComponentFactoryService.createElement({type:o.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(i.push(d),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))}),i.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:o.POWERED_BY,context:"general"});i.push(t)}return i}}const shouldShowMinimumPurchaseAlert=(t,n=![])=>{var i,o;const s=t.subtotal;if(t.type===r.SHIPPING){const r=t.fees;if(n&&(null===(i=r.pack)||void 0===i?void 0:i.active)&&r.pack.min>0&&s<r.pack.min)return!![];if(!n&&(null===(o=r.individual)||void 0===o?void 0:o.active)&&r.individual.min>0&&s<r.individual.min)return!![]}else if(t.type===r.ON_DEMAND){const n=t.fees;if(n.min>0&&s<n.min)return!![]}return![]},getMinimumPurchaseMessage=(t,n=![])=>{var i,o;const s=t.subtotal;if(t.type===r.SHIPPING){const r=t.fees;let c=0;if(n&&(null===(i=r.pack)||void 0===i?void 0:i.active)&&r.pack.min>0?c=r.pack.min:(null===(o=r.individual)||void 0===o?void 0:o.active)&&r.individual.min>0&&(c=r.individual.min),c>0&&s<c)return{message:"+"+formatCentToDollarText(c-s)+" needed for order minimum",type:"warning"}}if(t.type===r.ON_DEMAND){const n=t.fees,i=n.min>0?n.min:0;if(i>0&&s<i)return{message:"+"+formatCentToDollarText(i-s)+" needed for order minimum",type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(t,n=![])=>{var i,o;const s=t.subtotal;if(t.type===r.SHIPPING){const r=t.fees;if(n&&(null===(i=r.pack)||void 0===i?void 0:i.active)&&r.pack.min>0&&s<r.pack.min)return!![];if(!n&&(null===(o=r.individual)||void 0===o?void 0:o.active)&&r.individual.min>0&&s<r.individual.min)return!![]}if(t.type===r.ON_DEMAND){const n=t.fees;if(n.min>0&&s<n.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const n={warning:"warning",success:"success",info:"info"},i={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},o=n[this.params.messageType]||"warning",r=document.createElement("div");return r.className="alert-icon alert-icon-"+this.params.messageType,r.appendChild(htmlStringToElement(i[o]({width:16,height:16,className:"alert-icon-svg"}))),r}template(){var t;const n=[],i=this.getIconElement();i&&n.push(i);const o=document.createElement("span");if(o.className="alert-message",o.textContent=this.params.message,n.push(o),"detailed"===(null===(t=this.config)||void 0===t?void 0:t.alertType)&&this.params.currentTotal){const t=document.createElement("div");t.className="alert-details";const i=document.createElement("small");i.className="alert-details-text",i.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(i),n.push(t)}return n}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}getProductStore(){const t=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+t+".items")||{};return Object.values(n).find(n=>n.fulfillmentId===t)}handleItemsUpdate(t,n){const i=new Set(t||[]),r=new Set(n||[]);for(const o of i)if(!r.has(o)){const t=this.container.querySelector('[data-item-id="'+o+'"]');t&&t.remove()}for(const s of r)if(!i.has(s)){const t=ComponentFactoryService.createElement({type:o.CART_ITEM,itemId:s});t.setAttribute("data-item-id",s),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+t+".items")||[],i=this.container.querySelectorAll("[data-item-id]");for(const o of i)o.remove();for(const r of n){const t=ComponentFactoryService.createElement({type:o.CART_ITEM,itemId:r});t.setAttribute("data-item-id",r),this.container.appendChild(t)}}setupMinimumPurchaseAlert(){var t;const n=this.getFulfillmentId(),i=(null===(t=this.getProductStore())||void 0===t?void 0:t.pack)||![],r=this.getStoreValue("cart.fulfillments."+n),s=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(s&&s.remove(),shouldShowMinimumPurchaseAlert(r,i)){const t=getMinimumPurchaseMessage(r,i),n=ComponentFactoryService.createElement({type:o.PURCHASE_MIN_ALERT,message:t.message,messageType:t.type,currentTotal:r.subtotal,config:{showIcon:!![],alertType:"minimal"}});n.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(n)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const n=document.createElement("div");n.className="cart-loading-spinner-container";const i=document.createElement("div");return i.className="cart-loading-spinner",i.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(i),t.appendChild(n),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 n=this.getFulfillmentId(),i=this.getStoreValue("cart.fulfillments."+n);return(null===(t=null==i?void 0:i.items)||void 0===t?void 0:t.length)?i.items.some(t=>{const n=this.getStoreValue("cart.items."+t);return(null==n?void 0:n.updating)===!![]}):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),n=this.hasLoadingOverlay();t&&!n?this.showLoadingOverlay():!t&&n&&this.hideLoadingOverlay()}onStoreChanged(t){const n=this.getFulfillmentId(),i="cart.fulfillments."+n,o=t.find(t=>t.path===i),r=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(r.length>0&&this.checkAndUpdateLoadingState(),o){const t=o.oldValue,n=o.value,i=(null==t?void 0:t.items)||[],r=(null==n?void 0:n.items)||[],s=JSON.stringify(i)!==JSON.stringify(r);s&&(this.handleItemsUpdate(i,r),this.checkAndUpdateLoadingState());const c=this.hasFulfillmentFeesChanged(t,n),d=this.hasFulfillmentDataChanged(t,n,["items","updating"]);if(c&&!d&&this.setupMinimumPurchaseAlert(),!d)return![]}return![]}hasFulfillmentFeesChanged(t,n){return t?t.subtotal!==n.subtotal||t.shippingFee!==n.shippingFee||t.deliveryFee!==n.deliveryFee||JSON.stringify(t.fees)!==JSON.stringify(n.fees):!![]}hasFulfillmentDataChanged(t,n,i=[]){if(!t)return!![];const o=["type","canEngrave","retailerId"];for(const r of o)if(!i.includes(r)&&t[r]!==n[r])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const pt={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"},mt="America/New_York";function detectUserTimezone(t){try{if(t){const n=t.toUpperCase(),i=pt[n];return i||mt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){return mt}}function getCurrentTimeInTimezone(t){try{const n=new Date,i=n.getTime(),o=6e4*n.getTimezoneOffset(),r=new Date(i+o),s=new Date(r.toLocaleString("en-US",{timeZone:t})),c=r.getTime()-s.getTime();return new Date(i+c)}catch(n){return new Date}}function getCurrentTimeInUserTimezone(t){const n=detectUserTimezone(t);return getCurrentTimeInTimezone(n)}function isDateTimeInRange(t){const{startDate:n,endDate:i,addressState:o}=t;try{const t=getCurrentTimeInUserTimezone(o),r=!n||t>=new Date(n),s=!i||t<=new Date(i);return r&&s}catch(r){return![]}}function filterActiveItems(t,n){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:n}))}function hasActiveItems(t,n){return filterActiveItems(t,n).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,n,i;const r=this.config.layout.drawerHeaderText,s=this.getConfigs("global"),c=document.createElement("div");c.className="cart-header-content";const d=document.createElement("h2");d.className="cart-title",d.textContent=r,c.appendChild(d);const u=document.createElement("button");u.type="button",u.className="cart-header-close-btn",u.innerHTML=CloseIcon({width:16,height:16}),u.setAttribute("aria-label","Close cart drawer"),u.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),c.appendChild(u);const h=this.clientConfig.get("promoTicker"),p=null!==(n=null===(t=null==s?void 0:s.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==n?n:[],f=null!=h?h:p,v=this.store.get("address"),y=hasActiveItems(f,null===(i=null==v?void 0:v.address)||void 0===i?void 0:i.state);if(!f.length||!y)return[c];const b=ComponentFactoryService.createElement({context:"cart",type:o.PROMO_CODE_TICKER,tickers:f});return[c,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,n){var i,r,s,c,d,u,h,p,f,v;this.commands.ui.openDrawer(o.ENGRAVING_FORM,{identifier:t,context:"cart",lines:(null===(r=null===(i=n.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.lines)||[],maxLines:(null===(c=null===(s=n.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.maxLines)||1,maxCharsPerLine:(null===(u=null===(d=n.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.maxCharsPerLine)||16,fee:(null===(p=null===(h=n.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.fee)||0,location:null===(v=null===(f=n.attributes)||void 0===f?void 0:f.engraving)||void 0===v?void 0:v.location})}template(){var t,n,i,r,s,c,d,u,h;const p=this.params.itemId,f=this.getStoreValue("cart.items."+p),v=this.getConfigs("global"),y=this.getStoreValue("cart.fulfillments."+f.fulfillmentId),b=f.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(t=null==y?void 0:y.expectation)||void 0===t?void 0:t.detail)||"",x=document.createElement("article");x.className="cart-item";const w=document.createElement("div");w.className="item-image";const C=document.createElement("img");C.src=f.mainImage,C.alt=f.name,w.appendChild(C);const k=document.createElement("div");k.className="item-details";const S=document.createElement("div");S.className="item-header";const E=document.createElement("h3");E.className="item-title",E.textContent=f.name;const _=document.createElement("button");_.className="item-delete",_.innerHTML=TrashIcon({}),_.setAttribute("role","button"),_.setAttribute("tabindex","0"),_.setAttribute("aria-label","Remove "+f.name+" from cart"),_.setAttribute("aria-expanded","true"),_.addEventListener("click",async()=>{await this.commands.cart.removeItem(p)}),_.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(p))}),S.appendChild(E),S.appendChild(_);const T=document.createElement("div");T.className="item-specs",T.textContent=f.size+", "+f.container;const D=document.createElement("div");D.className="item-shipping-container";const P=document.createElement("div");if(P.className="item-shipping",P.textContent=b,D.appendChild(P),v.layout.enablePersonalization&&(null===(i=null===(n=null==f?void 0:f.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.isEngravable)&&(null===(s=null===(r=null==f?void 0:f.attributes)||void 0===r?void 0:r.engraving)||void 0===s?void 0:s.hasEngraving)===![]&&y.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=v.layout.personalizationText+" +"+formatCentToDollarText((null===(d=null===(c=f.attributes)||void 0===c?void 0:c.engraving)||void 0===d?void 0:d.fee)||0,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+f.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(p,f)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(p,f))}),D.appendChild(t)}k.appendChild(S),k.appendChild(T),k.appendChild(D),x.appendChild(w),x.appendChild(k);const F=[x],A=ComponentFactoryService.createElement({type:o.CART_ITEM_QUANTITY_PRICE,itemId:p});if((null===(h=null===(u=null==f?void 0:f.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:o.ENGRAVING_VIEW,identifier:p,context:"cart"});F.push(t)}return F.push(A),F}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const n=t.find(t=>"cart.items"===t.path);if(n){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,n=this.getStoreValue("cart.items."+t);return n||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const n=t.quantity,i=this.getAvailableQuantity(),o=i>0;return{currentQuantity:n,availableQuantity:i,canIncrease:o,canDecrease:!![]}}getAvailableQuantity(){var t,n,i,o;const r=this.getItemStore();if(!r)return 0;const s=r.partNumber,c=r.fulfillmentId,d=this.getStoreValue("cart.items")||{},u=Object.values(d).filter(t=>t.partNumber===s&&t.fulfillmentId===c),h=u.reduce((t,n)=>t+n.quantity,0),p=this.getStoreValue("products."+r.upc)||this.getStoreValue("products."+r.salsifyGrouping);if(!p)return r.maxQuantity-h;const f=null!==(o=null===(i=null===(n=null===(t=null==p?void 0:p.sizes)||void 0===t?void 0:t[r.liquidId])||void 0===n?void 0:n.attributes)||void 0===i?void 0:i.maxQuantityPerOrder)&&void 0!==o?o:0;return!f||f<=0?r.maxQuantity-h:f-h}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 n=this.calculateQuantityLimits();t>0&&!n.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),n=this.getItemStore();if(!n)return document.createElement("div");const i=document.createElement("div");return i.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async 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),i.appendChild(this.qtyDecreaseButton),i.appendChild(this.quantitySpan),i.appendChild(this.qtyIncreaseButton),i}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const n=document.createElement("div");n.className="item-price-container";const i=document.createElement("span");if(i.className="item-price",i.textContent=formatCentToDollarText(t.price),n.appendChild(i),t.quantity>1){const i=document.createElement("span");i.className="item-price-per-unit",i.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",n.appendChild(i)}return n}template(){const t=[];if(this.config.layout.showQuantityCounter){const n=this.createQuantityContainer();t.push(n)}const n=this.createPriceContainer();return t.push(n),t}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const n=t.find(t=>"cart.promoCode"===t.path);if(n){const{value:t,oldValue:i}=n,o=Boolean(null==i?void 0:i.code),r=Boolean(null==t?void 0:t.code);if(!o&&r)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(o&&!r)return this.container.innerHTML="",this.createInputContainer(),void 0;if(r&&this.promoCodePill&&t.discountAmount!==(null==i?void 0:i.discountAmount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",void 0}}createAppliedContainer(t){const n=document.createElement("div");n.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const i=document.createElement("button");i.type="button",i.classList.add("promo-remove-btn"),i.textContent="Remove",i.setAttribute("role","button"),i.setAttribute("aria-label","Remove promo code "+(null==t?void 0:t.code)),i.setAttribute("tabindex","0"),i.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),n.appendChild(this.promoCodePill),n.appendChild(i),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const n=document.createElement("div");n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),t.appendChild(n),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(),n=t.length>=3&&t.length<=255,i=this.getStoreValue("cart.loading"),o=this.getStoreValue("cart.promoCode"),r=this.getStoreValue("cart.events")||[],s=hasCartAnyPromoCodeEvents(r);this.applyButton.disabled=!n||i||Boolean(null==o?void 0:o.discountAmount)||this.isApplying||s}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:255},onChange:t=>{const n=t.toUpperCase(),i=this.promoInput;i.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const a=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.applyButton.disabled=!![],this.applyButton.setAttribute("aria-label","Applying promo code"),await this.commands.cart.applyPromoCode(t),this.applyButton.setAttribute("aria-label","Apply promo code")}catch(n){this.logger.error("Cart promo code application failed",{promoCode:t,error:n instanceof Error?n.message:String(n)})}};return this.applyButton.addEventListener("click",a),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a())}),this.applyButton}template(){const t=this.getStoreValue("cart.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodePill=null,null==t?void 0:t.code){const n=document.createElement("div");n.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const i=document.createElement("button");return i.type="button",i.classList.add("promo-remove-btn"),i.textContent="Remove",i.setAttribute("role","button"),i.setAttribute("aria-label","Remove promo code "+t.code),i.setAttribute("tabindex","0"),i.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),n.appendChild(this.promoCodePill),n.appendChild(i),n}const n=document.createElement("div");n.classList.add("promo-code-container");const i=document.createElement("div");return i.classList.add("promo-container"),i.appendChild(this.createPromoInput()),i.appendChild(this.createApplyButton()),n.appendChild(i),n}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:o.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const n=this.container.querySelectorAll("[data-fulfillment-id]");if(n.length>0){const t=n[n.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const n=this.getFulfillmentInsertionPoint();if(n){const i=this.createFulfillmentElement(t);i.setAttribute("data-fulfillment-id",t);const o=this.getFulfillmentContainer();o&&o.remove(),n.nextSibling?n.parent.insertBefore(i,n.nextSibling):n.parent.appendChild(i)}}removeFulfillmentElement(t){const n=this.getFulfillmentElementById(t);if(n){const t=n.parentElement,i=n.nextElementSibling;n.remove();const o=this.container.querySelectorAll("[data-fulfillment-id]");if(0===o.length){const n=document.createElement("div");n.id="retailer-fulfillment-container",i?t.insertBefore(n,i):t.appendChild(n)}}}handleFulfillmentsUpdate(t,n){const i=new Set(t||[]),o=new Set(n||[]);for(const r of i)o.has(r)||this.removeFulfillmentElement(r);for(const r of o)i.has(r)||this.addFulfillmentElement(r)}setupFulfillmentElements(){const t=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],i=this.container.querySelectorAll("[data-fulfillment-id]");for(const r of i)r.remove();let o=this.getFulfillmentContainer();if(!o){const t=this.container.querySelector(".retailer-body-container"),n=this.container.querySelector("#retailer-subtotal-container");o=document.createElement("div"),o.id="retailer-fulfillment-container",t&&n&&t.insertBefore(o,n)}for(const r of n)this.addFulfillmentElement(r)}setupSubtotalElement(){const t=this.getRetailerId(),n=this.container.querySelector("#retailer-subtotal-container");if(n){const i=ComponentFactoryService.createElement({type:o.CART_RETAILER_SUBTOTAL,retailerId:t});n.replaceWith(i)}}onStoreChanged(t){const n=this.getRetailerId(),i="cart.retailers."+n,o=t.find(t=>t.path===i);if(o){const t=o.oldValue,n=o.value,i=(null==t?void 0:t.fulfillments)||[],r=(null==n?void 0:n.fulfillments)||[];JSON.stringify(i)!==JSON.stringify(r)&&this.handleFulfillmentsUpdate(i,r)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),n=this.container.querySelector(".retailer-section"),i=this.container.querySelector(".section-header-label");if(t&&n&&i){const e=()=>{const n=t.checked;i.setAttribute("aria-label",n?"Expand retailer section":"Collapse retailer section"),i.setAttribute("aria-expanded",n?"false":"true")};t.addEventListener("change",()=>{t.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),e()}),i.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())}),t.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),e()}}template(){const t=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+t),i=document.createElement("section");i.className="retailer-section";const o=document.createElement("div");o.className="cart-retailer-header";const r=document.createElement("div");r.className="retailer-info";const s=document.createElement("h2");s.className="section-title",s.textContent=n.name,r.appendChild(s);const c=document.createElement("input");c.type="checkbox",c.id=n.id,c.className="section-toggle",r.appendChild(c);const d=document.createElement("label");d.htmlFor=n.id,d.className="section-header-label",d.setAttribute("role","button"),d.setAttribute("tabindex","0"),d.setAttribute("aria-label","Collapse retailer section"),d.setAttribute("aria-expanded","true");const u=document.createElement("span");u.className="chevron",u.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),d.appendChild(u),r.appendChild(d),o.appendChild(r),i.appendChild(o);const h=document.createElement("div");h.className="retailer-body-container";const p=document.createElement("div");p.id="retailer-fulfillment-container",h.appendChild(p);const f=document.createElement("div");return f.id="retailer-subtotal-container",h.appendChild(f),i.appendChild(h),i}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,n){const i=Object.values(t||{}).filter(t=>t.retailerId===n);let o=0;for(const r of i)o+=r.quantity;return o}template(){const t=this.params.retailerId,n=this.getStoreValue("cart.retailers."+t+".subtotal")||0,i=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,o=this.getStoreValue("cart.items"),r=this.getRetailerItemCount(o,t),s=1===r?"item":"items",c=document.createElement("h3");c.className="retailer-subtotal-header",c.textContent="Subtotal ("+r+" "+s+"):";const d=document.createElement("span");return d.className="retailer-subtotal-amount",d.textContent=formatCentToDollarText(n+i),[c,d]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var t,n,i;const r=this.store.get("checkout.presale"),s=this.getConfigs("global"),c=this.clientConfig.get("promoTicker"),d=null!==(n=null===(t=null==s?void 0:s.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==n?n:[],u=null!=c?c:d,h=this.store.get("address"),p=hasActiveItems(u,null===(i=null==h?void 0:h.address)||void 0===i?void 0:i.state),f=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),v=document.createElement("div");v.classList.add("checkout-container"),f&&v.classList.add("no-header"),this.params.isIndependentComponent&&v.classList.add("independent");const y=ComponentFactoryService.createElement({type:o.CHECKOUT_INFORMATION});v.appendChild(y);const b=ComponentFactoryService.createElement({type:o.CHECKOUT_ORDER_SUMMARY});if(v.appendChild(b),!r&&(!u.length||!p)&&f)return[v];const x=document.createElement("div");if(x.classList.add("checkout-header-wrapper"),!f){const t=ComponentFactoryService.createElement({type:o.CHECKOUT_HEADER});x.appendChild(t)}if(u.length&&p&&!r){const t=ComponentFactoryService.createElement({context:"checkout",type:o.PROMO_CODE_TICKER,tickers:u});x.appendChild(t)}if(r){const t=ComponentFactoryService.createElement({type:o.CHECKOUT_PRESALE_COUNTDOWN});x.appendChild(t)}return[x,v]}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,n,i;const o=this.getStoreValue("checkout"),r=Boolean(o.promoCode),s=Boolean(null===(t=o.giftCards)||void 0===t?void 0:t.length),c=this.getConfigs("global"),d=Object.keys(o.onDemandFulfillmentTipInfo||{}).length>0,u=Object.values(o.items||{}),h=[],p=document.createElement("div");p.classList.add("checkout-amount-line");const f=document.createElement("span");f.textContent="Subtotal ("+u.length+" item"+(u.length>1?"s":"")+")",p.appendChild(f);const v=document.createElement("span");v.textContent=formatCentToDollarText(o.amounts.subtotal),p.appendChild(v),h.push(p);const y=document.createElement("div");y.classList.add("checkout-amount-line");const b=document.createElement("span");b.textContent="Shipping",y.appendChild(b);const x=document.createElement("span");x.textContent=formatCentToDollarText(o.amounts.shipping),y.appendChild(x),h.push(y);const w=document.createElement("div");w.classList.add("checkout-amount-line");const C=document.createElement("span");C.textContent="Delivery",w.appendChild(C);const k=document.createElement("span");if(k.textContent=formatCentToDollarText(o.amounts.delivery),w.appendChild(k),h.push(w),(null===(n=null==o?void 0:o.amounts)||void 0===n?void 0:n.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Engraving",t.appendChild(n);const i=document.createElement("span");i.textContent=formatCentToDollarText(o.amounts.engraving),t.appendChild(i),h.push(t)}const S=document.createElement("div");S.classList.add("checkout-amount-line");const E=document.createElement("span");E.textContent="Taxes & Fees",S.appendChild(E);const _=document.createElement("span");if(_.textContent=formatCentToDollarText(o.amounts.tax+o.amounts.service+o.amounts.platform),S.appendChild(_),h.push(S),r){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Promo Code ("+(null===(i=o.promoCode)||void 0===i?void 0:i.code.toUpperCase())+")",t.appendChild(n);const r=document.createElement("span");r.textContent="-"+formatCentToDollarText(o.amounts.discounts),t.appendChild(r),h.push(t)}if(s){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Gift Cards Applied",t.appendChild(n);const i=document.createElement("span");i.textContent="-"+formatCentToDollarText(o.amounts.giftCards),t.appendChild(i),h.push(t)}if(d){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Tips",t.appendChild(n);const i=document.createElement("span");i.textContent=formatCentToDollarText(o.amounts.tip),t.appendChild(i),h.push(t)}const T=document.createElement("div");T.classList.add("checkout-separator"),h.push(T);const D=document.createElement("div");D.classList.add("checkout-amount-total");const P=document.createElement("span");P.textContent="Total",D.appendChild(P);const F=document.createElement("span");if(F.textContent=formatCentToDollarText(o.amounts.total),D.appendChild(F),h.push(D),o.presale){const t=document.createElement("div");t.classList.add("checkout-amount-due");const n=document.createElement("span");n.textContent="Amount due today",t.appendChild(n);const i=document.createElement("span");i.textContent=formatCentToDollarText(0),t.appendChild(i),h.push(t);const o=document.createElement("div");o.classList.add("checkout-presale-locked-message");const r=htmlStringToElement(InfoIcon({color:c.theme.defaultTextColor}));o.appendChild(r);const s=document.createElement("p");s.textContent="Pre-ordered items will be charged when shipped.",o.appendChild(s),h.push(o)}return h}}const ft="lce-checkout-stripe-slot",gt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},vt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},yt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};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"),n=document.createElement("div");n.classList.add("checkout-billing-same-as-shipping-toggle-container");const i=document.createElement("div");i.classList.add("checkout-checkbox-container");const o=document.createElement("span");o.id="billingSameAsShipping",o.classList.add("checkout-checkbox-visual"),o.setAttribute("role","checkbox"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Billing same as shipping checkbox"),o.setAttribute("aria-checked",t?"true":"false"),t&&o.classList.add("checked"),o.innerHTML=CheckboxIcon({width:16,height:16}),n.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),n.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const r=document.createElement("label");return r.textContent="Billing address same as shipping address",r.setAttribute("for","billingSameAsShipping"),r.classList.add("billing-checkbox-label"),i.appendChild(o),i.appendChild(r),n.appendChild(i),n}updateSaveButtonState(){const t=!Object.values(this.billingData).every(t=>t.isValid),n={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,addressOne:this.billingData.addressOne.value,addressTwo:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zipCode:this.billingData.zipCode.value};this.params.isFormValid(!t,n)}template(){const t=this.getStoreValue("checkout.paymentForm"),n=[],r=this.billingSameAsShippingToggle();if(n.push(r),t.billingSameAsShipping)return n;t.data&&(t.data.firstName&&(this.billingData.firstName={isValid:!![],value:t.data.firstName}),t.data.lastName&&(this.billingData.lastName={isValid:!![],value:t.data.lastName}),t.data.email&&(this.billingData.email={isValid:!![],value:t.data.email}),t.data.phone&&(this.billingData.phone={isValid:!![],value:t.data.phone}),t.data.company&&(this.billingData.company={isValid:!![],value:t.data.company}),t.data.addressOne&&(this.billingData.addressOne={isValid:!![],value:t.data.addressOne}),t.data.addressTwo&&(this.billingData.addressTwo={isValid:!![],value:t.data.addressTwo}),t.data.city&&(this.billingData.city={isValid:!![],value:t.data.city}),t.data.state&&(this.billingData.state={isValid:!![],value:t.data.state}),t.data.zipCode&&(this.billingData.zipCode={isValid:!![],value:t.data.zipCode})),this.updateSaveButtonState();const s=document.createElement("div");s.classList.add("section-title-container");const c=document.createElement("h3");c.textContent="Your billing info",c.classList.add("section-title"),s.appendChild(c);const d=document.createElement("p");d.textContent="Provide the info relevant to your payment method",d.classList.add("section-subtitle"),s.appendChild(d),n.push(s);const u=document.createElement("div");u.classList.add("section-form-container");const h=document.createElement("div");h.classList.add("checkout-two-col-container");const p=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:yt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:yt.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});p.setAttribute("aria-label","First name input"),h.appendChild(p);const f=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:yt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:yt.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});f.setAttribute("aria-label","Last name input"),h.appendChild(f),u.appendChild(h);const v=ComponentFactoryService.createElement({type:o.INPUT,inputType:"email",name:yt.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:yt.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});v.setAttribute("aria-label","Email input"),u.appendChild(v);const y=document.createElement("div");y.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:o.INPUT,inputType:"tel",name:yt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:yt.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});b.setAttribute("aria-label","Phone input"),y.appendChild(b);const x=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:yt.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:yt.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});x.setAttribute("aria-label","Company input"),y.appendChild(x),u.appendChild(y);const w=document.createElement("div");w.classList.add("checkout-two-col-container");const C=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:yt.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:yt.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});C.setAttribute("aria-label","Street address input"),w.appendChild(C);const k=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:yt.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:yt.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});k.setAttribute("aria-label","Apt, suite, etc. (optional) input"),w.appendChild(k),u.appendChild(w);const S=document.createElement("div");S.classList.add("checkout-three-col-container");const E=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:yt.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:yt.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});E.setAttribute("aria-label","City input"),S.appendChild(E);const _=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:yt.state,label:"State",autocomplete:!![],placeholder:"NY",validation:{required:!![],customValidator:t=>t&&2===t.length&&/^[A-Z]{2}$/.test(t)?null:"State must be 2 uppercase characters"},onChange:async t=>{this.billingData.state.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:yt.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","State input"),S.appendChild(_);const T=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:yt.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(i.BILLING,{fieldName:yt.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return T.setAttribute("aria-label","Zip Code input"),S.appendChild(T),u.appendChild(S),n.push(u),n}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(t){const n=t.find(t=>"checkout.customerForm.isSaving"===t.path);n&&(n.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const 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 n=[],r=document.createElement("div");r.classList.add("section-title-container");const s=document.createElement("h3");s.textContent="Buyer Information",s.classList.add("section-title"),r.appendChild(s);const c=document.createElement("p");c.textContent="Buyer information is used to process your order and for delivery purposes.",c.classList.add("section-subtitle"),r.appendChild(c),n.push(r);const d=document.createElement("div");d.classList.add("section-form-container");const u=document.createElement("div");u.classList.add("checkout-two-col-container");const h=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:gt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});u.appendChild(h);const p=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:gt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});u.appendChild(p),d.appendChild(u);const f=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:gt.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});d.appendChild(f);const v=ComponentFactoryService.createElement({type:o.INPUT,inputType:"email",name:gt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});d.appendChild(v);const y=ComponentFactoryService.createElement({type:o.INPUT,inputType:"tel",name:gt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});d.appendChild(y);const b=ComponentFactoryService.createElement({type:o.BIRTHDATE_INPUT,inputType:"date",name:gt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return d.appendChild(b),n.push(d),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent=this.saveButtonText,this.saveButton.addEventListener("click",async()=>{await this.commands.checkout.saveCustomerForm({customerData:{firstName:this.customerData.firstName.value,lastName:this.customerData.lastName.value,email:this.customerData.email.value,phone:this.customerData.phone.value,company:this.customerData.company.value,birthDate:this.customerData.birthDate.value},shippingAddressTwo:this.customerData.addressTwo.value,deliveryInstructions:""})}),n.push(this.saveButton),this.updateSaveButtonState(),n}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const t=[],n=this.getStoreValue("checkout.customerForm.data"),i=document.createElement("div");i.classList.add("checkout-summary-form-header");const o=document.createElement("h2");o.textContent="Buyer: "+n.firstName+" "+n.lastName,i.appendChild(o);const r=document.createElement("span");if(r.textContent="Edit",r.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),i.appendChild(r),t.push(i),n.company){const i=document.createElement("p");i.classList.add("checkout-summary-form-line"),i.textContent=n.company,t.push(i)}const s=document.createElement("p");s.classList.add("checkout-summary-form-line"),s.textContent=n.email,t.push(s);const c=document.createElement("p");c.classList.add("checkout-summary-form-line"),c.textContent=n.phone,t.push(c);const d=document.createElement("p");return d.classList.add("checkout-summary-form-line"),d.textContent=formatISODateToMMDDYYYY(n.birthDate),t.push(d),t}}const bt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],xt={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,n){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(n)?n:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(n)?n:null:"class"===t?n.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():n.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const n=t.textContent||"",i=n.replace(/<[^>]*>/g,"");if(i.trim()){const t=document.createTextNode(i);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const n=t,i=n.tagName.toLowerCase();if(bt.includes(i)){const t=document.createElement(i),o=xt[i]||[];for(const i of Array.from(n.attributes)){const n=i.name.toLowerCase();if(o.includes(n)){const o=sanitizeAttributeValue(n,i.value);null!==o&&t.setAttribute(n,o)}}"a"===i&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const i of Array.from(n.childNodes)){const n=cleanNode(i);n&&t.appendChild(n)}return t}const o=document.createDocumentFragment();for(const t of Array.from(n.childNodes)){const n=cleanNode(t);n&&o.appendChild(n)}return o.childNodes.length>0?o:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const n=new DOMParser,i=n.parseFromString(t,"text/html"),o=i.querySelector("parsererror");if(o)return console.warn("HTML parsing error detected"),"";const r=document.createDocumentFragment();for(const t of Array.from(i.body.childNodes)){const n=cleanNode(t);n&&r.appendChild(n)}const s=document.createElement("div");return s.appendChild(r),s.innerHTML}catch(n){return console.error("HTML sanitization error:",n),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,n,i,r,s,c;const d=[],u=this.getConfigs("configurations"),h=this.getConfigs("global"),p=this.getConfigs("checkout"),f=this.config.layout.exitUrl||window.location.host,v=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(n=null===(t=this.config.layout)||void 0===t?void 0:t.checkoutCompleted)||void 0===n?void 0:n.customLogo){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const n=document.createElement("img");n.src=null===(r=null===(i=this.config.layout)||void 0===i?void 0:i.checkoutCompleted)||void 0===r?void 0:r.customLogo,n.alt=u.partnerName+" Logo",t.appendChild(n),d.push(t)}const y=document.createElement("div");y.classList.add("checkout-completed-section-container");const b=document.createElement("div");b.classList.add("checkout-completed-title-container");const x=document.createElement("div");x.classList.add("checkout-completed-title-section");const w=document.createElement("h3");w.innerHTML=(null===(c=null===(s=this.config.layout)||void 0===s?void 0:s.checkoutCompleted)||void 0===c?void 0:c.customText)||"Thank You for Your Order!",x.appendChild(w);const C=document.createElement("p");C.textContent="Your payment has been successfully processed.",x.appendChild(C),b.appendChild(x),y.appendChild(b);const k=document.createElement("div");k.classList.add("checkout-completed-sub-section");const S=document.createElement("div");S.classList.add("checkout-completed-line");const E=document.createElement("h3");E.textContent="Order Number",S.appendChild(E);const _=document.createElement("span");_.textContent=this.params.orderNumber,S.appendChild(_),k.appendChild(S);const T=document.createElement("div");T.classList.add("checkout-completed-line");const D=document.createElement("h3");D.textContent="Order Amount",T.appendChild(D);const P=document.createElement("span");P.textContent=""+formatCentToDollarText(this.params.orderTotal),T.appendChild(P),k.appendChild(T);const F=document.createElement("div");F.classList.add("checkout-completed-line");const A=document.createElement("h3");A.textContent="Payment Method",F.appendChild(A);const z=document.createElement("span");z.textContent="** "+this.params.cardLast4,F.appendChild(z),k.appendChild(F),y.appendChild(k);const O=document.createElement("div");O.classList.add("checkout-completed-sub-section");const M=document.createElement("p");M.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>.",O.appendChild(M),y.appendChild(O),d.push(y);const N=document.createElement("div");N.classList.add("checkout-completed-section-container");const R=document.createElement("button");R.type="button";const B=document.createElement("span");B.textContent=v,R.setAttribute("tabindex","0"),R.setAttribute("role","button"),R.setAttribute("aria-label",v),R.appendChild(B);const q=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:h.theme.selectedTextColor}));R.appendChild(q),R.addEventListener("click",()=>{window.location.href=f}),R.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=f)}),N.appendChild(R),d.push(N);const j=document.createElement("div");j.classList.add("checkout-completed-section-container");const U=document.createElement("div");U.classList.add("checkout-completed-help-section"),j.appendChild(U);const G=document.createElement("p");G.textContent="Questions about your order? Contact us at ";const V=document.createElement("a");V.href="mailto:"+u.supportEmail,V.textContent=u.supportEmail,G.appendChild(V),U.appendChild(G);const H=document.createElement("p"),W=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(H.textContent="Order placed on "+W,U.appendChild(H),d.push(j),p.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(p.layout.legalMessage.text);const i=document.createElement("div");i.classList.add("checkout-separator"),d.push(t),d.push(n),d.push(i)}if(h.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:o.POWERED_BY,context:"general"});d.push(t)}return d}}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 n=t.find(t=>"checkout.customerForm.isSaving"===t.path),i=t.find(t=>"checkout.giftRecipientForm.isSaving"===t.path);(null==n?void 0:n.value)||(null==i?void 0:i.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const t=this.getStoreValue("checkout.isGift")||![];let n;n=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=n}template(){const t=this.getConfigs("global"),n=this.getStoreValue("checkout.isGift"),r=this.store.get("checkout.giftRecipientForm.data"),s=this.store.get("checkout.customerForm.data"),c=this.store.get("address.formattedAddress"),d=n?r:s,u=this.store.get("checkout.shippingAddressTwo"),h=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}),u&&(this.customerData.addressTwo={isValid:!![],value:u},this.giftData.addressTwo={isValid:!![],value:u}),h&&(this.customerData.deliveryInstructions={isValid:!![],value:h},this.giftData.deliveryInstructions={isValid:!![],value:h});const p=Object.keys(this.store.get("checkout.onDemandFulfillmentTipInfo")||{}).length>0,f=[],v=document.createElement("div");v.classList.add("delivery-header-container");const y=document.createElement("div");y.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),v.appendChild(b),f.push(v);const C=document.createElement("div");C.classList.add("section-form-container");const k=document.createElement("div");k.classList.add("checkout-two-col-container");const S=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:n?vt.firstName:gt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:d.firstName,onChange:t=>{n?(this.giftData.firstName.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:vt.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.firstName}))},onValidation:t=>{n?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});S.setAttribute("aria-label","First Name Input"),k.appendChild(S);const E=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:n?vt.lastName:gt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:d.lastName,onChange:t=>{n?(this.giftData.lastName.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:vt.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.lastName}))},onValidation:t=>{n?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(E.setAttribute("aria-label","Last Name Input"),k.appendChild(E),C.appendChild(k),!n){const t=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:gt.company,label:"Company (optional)",autocomplete:!![],value:d.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),C.appendChild(t)}const _=ComponentFactoryService.createElement({type:o.INPUT,inputType:"email",name:n?vt.email:gt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:d.email,onChange:t=>{n?(this.giftData.email.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:vt.email})):(this.customerData.email.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.email}))},onValidation:t=>{n?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","Email Input"),C.appendChild(_);const T=ComponentFactoryService.createElement({type:o.INPUT,inputType:"tel",name:n?vt.phone:gt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:d.phone,onChange:t=>{n?(this.giftData.phone.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:vt.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.phone}))},onValidation:t=>{n?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(T.setAttribute("aria-label","Phone Input"),C.appendChild(T),!n){const t=ComponentFactoryService.createElement({type:o.BIRTHDATE_INPUT,inputType:"date",name:gt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:d.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),C.appendChild(t)}const D=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:c,disabled:!![],className:"disabled-input"});D.setAttribute("aria-label","Delivery Address Input"),C.appendChild(D);const P=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:n?vt.addressTwo:gt.addressTwo,label:"Apt, suite, etc. (optional)",value:u,onChange:t=>{n?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(i.GIFT,{fieldName:vt.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(i.CUSTOMER,{fieldName:gt.addressTwo}))},onValidation:t=>{n?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(P.setAttribute("aria-label","Address Line 2 Input"),C.appendChild(P),n){const n=document.createElement("div");n.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const o=document.createElement("label");o.textContent="Gift Message*",o.setAttribute("for",vt.message);const s=document.createElement("textarea");s.name=vt.message,s.id=vt.message,s.rows=4,s.value=r.message||"",s.setAttribute("aria-label","Gift Message Textarea"),s.addEventListener("input",async t=>{const n=t.target.value;this.giftData.message.value=n,this.giftData.message.isValid=n.length>0,this.pubSub.publishForm(i.GIFT,{fieldName:vt.message}),this.updateSaveButtonState()});const c=document.createElement("p");c.textContent="Your gift message will be emailed to the recipient along with delivery details.",c.classList.add("textarea-message-disclaimer"),n.appendChild(o),n.appendChild(s),n.appendChild(c),C.appendChild(n)}if(p){const i=document.createElement("div");i.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const o=document.createElement("label");o.textContent="Delivery Instructions",o.setAttribute("for","delivery_instructions");const r=document.createElement("textarea");r.id="delivery_instructions",r.name="delivery_instructions",r.rows=4,r.setAttribute("aria-label","Delivery Instructions Textarea"),r.value=h,r.addEventListener("input",async t=>{const i=t.target.value;n?(this.giftData.deliveryInstructions.value=i,this.giftData.deliveryInstructions.isValid=i.length>0):(this.customerData.deliveryInstructions.value=i,this.customerData.deliveryInstructions.isValid=i.length>0)});const s=document.createElement("p");s.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",s.classList.add("textarea-message-disclaimer"),i.appendChild(o),i.appendChild(r),i.appendChild(s),C.appendChild(i)}return f.push(C),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()=>{n&&await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}),n||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})}),f.push(this.saveButton),this.updateSaveButtonState(),f}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const t=[],n=this.getStoreValue("checkout.isGift"),i=this.getStoreValue("checkout.customerForm.data"),o=this.getStoreValue("checkout.giftRecipientForm.data"),r=this.getStoreValue("address"),s=this.getStoreValue("checkout.deliveryInstructions"),c=this.getStoreValue("checkout.shippingAddressTwo"),d=document.createElement("div");d.classList.add("checkout-summary-form-header");const u=document.createElement("h2");u.textContent=n?"Delivering to: "+o.firstName+" "+o.lastName:"Delivering to: "+i.firstName+" "+i.lastName,d.appendChild(u);const h=document.createElement("span");if(h.textContent="Edit",h.addEventListener("click",async()=>{n?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()}),d.appendChild(h),t.push(d),!n&&i.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=i.company,t.push(n)}const p=document.createElement("p");p.classList.add("checkout-summary-form-line"),p.textContent=r.address.one+(c?", "+c:"")+", "+r.address.city+", "+r.address.state+", "+r.address.zip,t.push(p);const f=document.createElement("p");f.classList.add("checkout-summary-form-line"),f.textContent=n?o.email:i.email,t.push(f);const v=document.createElement("p");if(v.classList.add("checkout-summary-form-line"),v.textContent=n?o.phone:i.phone,t.push(v),!n&&i.birthDate){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=formatISODateToMMDDYYYY(i.birthDate),t.push(n)}if(n){const n=document.createElement("div");n.classList.add("checkout-summary-form-line-container");const i=document.createElement("span");i.classList.add("checkout-summary-form-line-container-label"),i.textContent="Gift Message:",n.appendChild(i);const r=document.createElement("span");r.classList.add("checkout-summary-form-line"),r.textContent=o.message||"No message provided.",n.appendChild(r),t.push(n)}if(s){const n=document.createElement("div");n.classList.add("checkout-summary-form-line-container");const i=document.createElement("span");i.classList.add("checkout-summary-form-line-container-label"),i.textContent="Delivery Instructions:",n.appendChild(i);const o=document.createElement("span");o.classList.add("checkout-summary-form-line"),o.textContent=s||"No instructions provided.",n.appendChild(o),t.push(n)}return t}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(t){var n;const i=t.find(t=>"checkout.giftCards"===t.path),o=t.find(t=>"checkout.loading"===t.path);i&&i.value.length>((null===(n=i.oldValue)||void 0===n?void 0:n.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),o&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),n=t.length>=3&&t.length<=255,i=this.getStoreValue("checkout.loading"),o=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!n||i||Boolean(o)||this.isApplying}createGiftCardInput(){return this.giftCardInput=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:"giftCards",placeholder:"Enter gift card code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const n=t.toUpperCase(),i=this.giftCardInput;i.setValue(n),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const a=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(n){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",a),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const t=[];return t.push(this.createGiftCardInput()),t.push(this.createApplyButton()),t}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.presale"),n=this.getConfigs("checkout");let i=null;if(!t){i=document.createElement("button"),i.classList.add("checkout-header-button"),i.setAttribute("aria-label","Back to Cart"),i.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(o.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),i.appendChild(t)}const r=document.createElement("h1");r.textContent=(null==n?void 0:n.layout.drawerHeaderText)||"Checkout",r.classList.add("checkout-header-title"),r.setAttribute("aria-label","Checkout Page");const s=document.createElement("button");return s.innerHTML=CloseIcon({width:16,height:16}),s.classList.add("checkout-header-button-close"),s.setAttribute("aria-label","Close Checkout"),s.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),i?[i,r,s]:[r,s]}}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"),n=this.getStoreValue("checkout.customerForm.isEditing"),i=this.getStoreValue("checkout.giftRecipientForm.isEditing"),o=this.getStoreValue("checkout.paymentForm.isEditing");t?(this.buyerForm.style.display=n?"block":"none",this.buyerSummary.style.display=n?"none":"block",this.deliveryToForm.style.display=i?"block":"none",this.deliverToSummary.style.display=i?"none":"block"):(this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=o?"block":"none",this.paymentSummary.style.display=o?"none":"block"}template(){const t=[],n=this.getStoreValue("checkout.isGift"),i=this.getStoreValue("checkout.customerForm"),r=this.getStoreValue("checkout.giftRecipientForm"),s=this.getStoreValue("checkout.paymentForm"),c=ComponentFactoryService.createElement({type:o.CHECKOUT_SEND_AS_GIFT});return t.push(c),this.deliveryToForm=ComponentFactoryService.createElement({type:o.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=n?r.isEditing?"block":"none":i.isEditing?"block":"none",t.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:o.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=n?r.isEditing?"none":"block":i.isEditing?"none":"block",t.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:o.CHECKOUT_BUYER}),this.buyerForm.style.display=n&&i.isEditing?"block":"none",t.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:o.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=n&&!i.isEditing?"block":"none",t.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:o.CHECKOUT_PAYMENT}),this.paymentForm.style.display=s.isEditing?"block":"none",t.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:o.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=s.isEditing?"none":"block",t.push(this.paymentSummary),t}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(t){var n,i,o,r;const s=t.find(t=>"checkout.items"===t.path);s&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const c=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(c){const t=c.oldValue,s=c.value;if(s.updating)return![];const d=(null==t?void 0:t.quantity)!==(null==s?void 0:s.quantity),u=(null===(i=null===(n=null==t?void 0:t.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.lines)||[],h=(null===(r=null===(o=null==s?void 0:s.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.lines)||[],p=JSON.stringify(u)!==JSON.stringify(h);(d||p)&&this.updateEngravingElement(s)}return![]}updateEngravingElement(t){var n,i;const r=this.getConfigs("global"),s=this.container.querySelector(".engraving-view-container");if(s&&s.remove(),(null===(i=null===(n=null==t?void 0:t.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.hasEngraving)===!![]&&r.layout.enablePersonalization){const n=ComponentFactoryService.createElement({type:o.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),i=this.container.querySelector(".checkout-item-card-footer");i&&i.before(n)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const n=t.fulfillmentId;if(!n)return;if(!this.container)return;const i=this.container.querySelector(".checkout-item-card-header");if(i){const r=this.getStoreValue("cart.fulfillments."+n),s=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(s&&s.remove(),shouldShowMinimumPurchaseAlert(r,t.pack)){const n=getMinimumPurchaseMessage(r,t.pack),s=ComponentFactoryService.createElement({type:o.PURCHASE_MIN_ALERT,message:n.message,messageType:n.type,currentTotal:r.subtotal,config:{showIcon:!![],alertType:"minimal"}});s.setAttribute("data-component-type","checkout-retailer-alert"),i.before(s)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),n=Object.keys(t.items).length,i=1===n;this.trashButton.disabled=i,i?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 n=document.createElement("div");n.className="cart-loading-spinner-container";const i=document.createElement("div");return i.className="cart-loading-spinner",i.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(i),t.appendChild(n),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(),n=this.hasLoadingOverlay();t&&!n?this.showLoadingOverlay():!t&&n&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,n,i;const r=this.getConfigs("global"),s=this.getStoreValue("checkout.items."+this.params.itemId),c=null===(t=null==s?void 0:s.attributes)||void 0===t?void 0:t.presale,d=(null==c?void 0:c.isActive)&&(null==c?void 0:c.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(c.estimatedShipBy):"";if(!s)return[];const u=document.createElement("div");u.classList.add("checkout-item-card-header");const h=document.createElement("div");h.classList.add("checkout-item-image");const p=document.createElement("img");p.src=s.mainImage,p.alt=s.name,p.loading="lazy",h.appendChild(p),u.appendChild(h);const f=document.createElement("div");f.classList.add("checkout-item-details-container");const v=document.createElement("h4");v.classList.add("checkout-item-title"),v.textContent=s.name,f.appendChild(v);const y=document.createElement("div");y.classList.add("checkout-item-subtitle");const b=document.createElement("span");b.textContent=c.isActive?""+d:((null==s?void 0:s.expectationDetail)||"")+",",y.appendChild(b);const x=document.createElement("span");x.textContent="From "+((null==s?void 0:s.retailerName)||""),y.appendChild(x),f.appendChild(y),u.appendChild(f),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var n;if(t.preventDefault(),t.stopPropagation(),!(null===(n=this.trashButton)||void 0===n?void 0:n.disabled))try{await this.commands.checkout.removeItem(s.cartItemId)}catch(i){this.logger.error("Checkout item removal failed",i)}}),u.appendChild(this.trashButton);const w=ComponentFactoryService.createElement({type:o.CHECKOUT_ITEM_QUANTITY,itemId:s.cartItemId}),C=[];if(C.push(u),r.layout.enablePersonalization&&(null===(i=null===(n=null==s?void 0:s.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:o.ENGRAVING_VIEW,identifier:s.cartItemId,context:"checkout"});C.push(t)}return C.push(w),C}disconnected(){this.hideLoadingOverlay()}}class CheckoutItemQuantityComponent extends BaseComponent{get hostClasses(){return["checkout-item-card-footer"]}constructor(){super({watchStorePaths:["checkout.items.{itemId}"],watchOnlyStorePaths:["checkout.items"],autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}"})}onStoreWatch(t){const n=t.find(t=>"checkout.items"===t.path);if(n){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,n,i;const o=this.getStoreValue("checkout.items."+this.params.itemId);if(!o)return 0;const r=this.getStoreValue("products");if(!r)return 0;const s=o.partNumber,c=o.fulfillmentId,d=null===(i=null===(n=null===(t=Object.values(r).find(t=>t.sizes[o.liquidId]))||void 0===t?void 0:t.sizes)||void 0===n?void 0:n[o.liquidId])||void 0===i?void 0:i.attributes.maxQuantityPerOrder;if(!d)return 0;const u=this.getStoreValue("checkout.items")||{},h=Object.values(u).filter(t=>t.partNumber===s&&t.fulfillmentId===c),p=h.reduce((t,n)=>t+n.quantity,0);return d-p}calculateQuantityLimits(){var t;const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const i=this.getStoreValue("checkout"),o=1===(null===(t=Object.values(i.items))||void 0===t?void 0:t.length),r=n.quantity,s=this.getAvailableQuantity(),c=s>0,d=!(o&&1===r);return{currentQuantity:r,availableQuantity:s,isTheOnlyItem:o,canIncrease:c,canDecrease:d}}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 n=this.calculateQuantityLimits(),i=this.params.itemId;if((!(t<0)||n.canDecrease)&&(!(t>0)||n.canIncrease)){if(!i)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:t}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(i,t)}catch(o){this.logger.error("Checkout item quantity change operation failed",o)}}}template(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return this.logger.warn("Checkout item not found during template render",{itemId:this.params.itemId}),[];const n=this.calculateQuantityLimits(),i=document.createElement("div");i.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),i.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),i.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),i.appendChild(this.increaseButton),this.updateButtonStates(n);const o=document.createElement("span");if(o.classList.add("checkout-item-price-text"),o.textContent=formatCentToDollarText(t.price),t.quantity>1){const n=document.createElement("span");n.classList.add("checkout-item-price-each-text"),n.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",o.appendChild(n)}return[i,o]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(t){return ComponentFactoryService.createElement({type:o.CHECKOUT_ITEM,itemId:t})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},n=new Map;for(const i of Object.values(t))i&&i.cartItemId&&n.set(i.cartItemId,i);return n}syncItemsWithStore(){const t=this.getItemsListContainer();if(!t)return;const n=this.getCurrentItemsMap(),i=t.querySelectorAll("[data-item-id]"),o=new Set;for(const r of i){const t=r.getAttribute("data-item-id");t&&o.add(t)}for(const r of i){const t=r.getAttribute("data-item-id");t&&!n.has(t)&&r.remove()}for(const[r]of n)if(!o.has(r)){const n=this.createItemElement(r);n.setAttribute("data-item-id",r),t.appendChild(n)}this.updateItemCount()}updateItemCount(){const t=this.getTogglerLabel();if(!t)return;const n=this.getCurrentItemsMap(),i=n.size;t.textContent=i+" item"+(1!==i?"s":"")}onStoreChanged(t){let n;for(let i=0;i<t.length;i++){const o=t[i];if("checkout"===o.path||"checkout.items"===o.path||"checkout.items."===o.path.substring(0,15)){n=o;break}}return n?(this.syncItemsWithStore(),![]):![]}handleToggle(){const t=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");if(t&&n){const i=n.classList.contains("show");n.classList.toggle("show"),t.classList.toggle("expanded"),i?(t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label","Expand checkout items")):(t.setAttribute("aria-expanded","true"),t.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const t=this.container.querySelector(".checkout-items-toggler"),n=this.container.querySelector(".checkout-items-toggler-button"),i=this.container.querySelector(".checkout-items-list");if(t&&n&&i){const o=i.classList.contains("show");n.setAttribute("tabindex","0"),n.setAttribute("aria-expanded",o?"true":"false"),n.setAttribute("aria-label",o?"Collapse checkout items":"Expand checkout items"),t.addEventListener("click",()=>this.handleToggle()),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.items"),n=Object.values(t||{}),i=document.createElement("div");i.classList.add("checkout-items-toggler");const o=document.createElement("span");o.classList.add("checkout-items-toggler-label"),o.textContent=n.length+" item"+(1!==n.length?"s":""),i.appendChild(o);const r=document.createElement("button");r.type="button",r.classList.add("checkout-items-toggler-button"),r.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),i.appendChild(r);const s=document.createElement("div");s.classList.add("checkout-items-list","show");for(const c of n){const t=this.createItemElement(c.cartItemId);t.setAttribute("data-item-id",c.cartItemId),s.appendChild(t)}return[i,s]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const n=t.find(t=>"checkout.amounts"===t.path);if(n){const t=this.getStoreValue("checkout"),n=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&n>0)}}updateZeroAmountElement(t){const n=this.container.querySelector(".checkout-zero-amount-container");if(t&&!n){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 n=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");n&&n.after(t)}else!t&&n&&n.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 n=t.classList.contains("checked");t.setAttribute("aria-checked",n?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const n=t.classList.contains("checked");t.setAttribute("aria-checked",n?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,n=this.config.layout.smsOptIn;if(!t.show&&!n.show)return null;const i=document.createElement("div");if(i.classList.add("checkout-marketing-opt-ins-container"),t.show){const n=document.createElement("div");let o;n.classList.add("checkout-checkbox-container"),o=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const r=document.createElement("span");r.id="emailOptIn",r.classList.add("checkout-checkbox-visual"),o&&r.classList.add("checked"),r.innerHTML=CheckboxIcon({width:16,height:16}),r.setAttribute("role","checkbox"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","Email opt-in checkbox"),r.setAttribute("aria-checked",o?"true":"false"),r.addEventListener("click",()=>this.handleEmailToggle(r)),r.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(r))});const s=document.createElement("label");s.setAttribute("for","emailOptIn"),s.classList.add("checkbox-label"),s.innerHTML=sanitizeHTML(t.text),s.addEventListener("click",t=>{const n=t.target,i="A"===n.tagName||n.closest("a");i||(this.commands.checkout.toggleMarketingPreferences("canEmail"),r.classList.toggle("checked"))}),n.appendChild(r),n.appendChild(s),i.appendChild(n)}if(n.show){const t=document.createElement("div");let o;t.classList.add("checkout-checkbox-container"),o=this.clientConfig.isBuilder()?n.checked:this.store.get("checkout.marketingPreferences.canSms");const r=document.createElement("span");r.classList.add("checkout-checkbox-visual"),r.id="smsOptIn",o&&r.classList.add("checked"),r.innerHTML=CheckboxIcon({width:16,height:16}),r.setAttribute("role","checkbox"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","SMS opt-in checkbox"),r.setAttribute("aria-checked",o?"true":"false"),r.addEventListener("click",()=>this.handleSmsToggle(r)),r.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(r))});const s=document.createElement("label");s.setAttribute("for","smsOptIn"),s.classList.add("checkbox-label"),s.innerHTML=sanitizeHTML(n.text),s.addEventListener("click",t=>{const n=t.target,i="A"===n.tagName||n.closest("a");i||(this.commands.checkout.toggleMarketingPreferences("canSms"),r.classList.toggle("checked"))}),t.appendChild(r),t.appendChild(s),i.appendChild(t)}return i}hasOnDemandOrder(){const t=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}template(){var t;const n=[],i=this.getConfigs("global"),r=this.getConfigs("checkout"),s=this.getConfigs("global"),c=r.layout.allowGiftCards,d=null===(t=null==s?void 0:s.layout)||void 0===t?void 0:t.allowPromoCodes,u=document.createElement("div");u.classList.add("section-title-container");const h=document.createElement("h3");h.textContent="Order Summary",h.classList.add("section-title"),u.appendChild(h),n.push(u);const p=ComponentFactoryService.createElement({type:o.CHECKOUT_ITEMS});n.push(p);const f=document.createElement("div");f.classList.add("checkout-separator");const v=document.createElement("div");if(v.classList.add("checkout-separator"),n.push(f),c||d){const t=ComponentFactoryService.createElement({type:o.CHECKOUT_PC_GC});n.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:o.CHECKOUT_TIPS});n.push(t),n.push(v)}const y=document.createElement("div");y.classList.add("section-title-container");const b=document.createElement("h3");b.textContent="100% Secure Payments",b.classList.add("disclaimer-header"),y.appendChild(b);const x=document.createElement("p");x.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.",x.classList.add("disclaimer-description"),y.appendChild(x),n.push(y);const w=ComponentFactoryService.createElement({type:o.CHECKOUT_AMOUNTS});n.push(w);const C=ComponentFactoryService.createElement({type:o.CHECKOUT_PLACE_ORDER_BUTTON});n.push(C);const k=this.marketingOptInsContainer();if(k&&n.push(k),r.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const i=document.createElement("div");i.classList.add("checkout-legal-message"),i.innerHTML=sanitizeHTML(r.layout.legalMessage.text);const o=document.createElement("div");o.classList.add("checkout-separator"),n.push(t),n.push(i),n.push(o)}if(i.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:o.POWERED_BY,context:"checkout"});n.push(t)}return n}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.betaNoticeElement=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 n of t)switch(n.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=n.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(n.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:!![];const n=(this.clientConfig.isBeta()||this.clientConfig.isDevelopment())&&this.clientConfig.get("paymentMethodId");n&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let t=!![],n="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)n="Saving...",t=!![];else if(this.stripeFormStatus.hasError)n="Fix Errors and Retry",t=![];else if(this.showingStripeSummary&&this.savedCardInfo){const n=this.isBillingSameAsShipping||this.isValidBillingForm;t=!n}else{const n=this.stripeFormStatus.isFormComplete,i=this.isBillingSameAsShipping||this.isValidBillingForm;t=!(n&&i)}this.saveButton.disabled=t,this.saveButton.textContent=n,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let t="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?t=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(t="Please complete the billing address form"),t?(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(t){this.errorMessageElement&&(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===t&&(this.errorMessageElement.style.display="none")},5e3))}template(){const t=[],n=document.createElement("div");n.classList.add("section-title-container");const i=document.createElement("h3");i.textContent="Payment",i.classList.add("section-title"),n.appendChild(i);const r=document.createElement("p");r.textContent="All transactions are secure and encrypted.",r.classList.add("section-subtitle"),n.appendChild(r),t.push(n);const s=this.clientConfig.isBeta()||this.clientConfig.isDevelopment(),c=this.clientConfig.get("paymentMethodId"),d=s&&c;if(d){this.betaNoticeElement=document.createElement("div"),this.betaNoticeElement.classList.add("beta-payment-notice"),this.betaNoticeElement.style.cssText="background-color: #fff3cd; border: 1px solid #ffc107; border-radius: 4px; padding: 16px; margin-bottom: 16px; color: #856404;";const n=document.createElement("p");n.style.cssText="margin: 0; font-weight: 500; font-size: 14px; line-height: 1.4;",n.innerHTML="⚠️ Beta Testing Mode:<br/>PM ID: "+c+"<br/>Using hardcoded Visa card ending in 1111",this.betaNoticeElement.appendChild(n),t.push(this.betaNoticeElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:o.CHECKOUT_STRIPE_HANDLER,callbacks:{onStripeFormStatusChanged:t=>{this.stripeFormStatus=t,this.updateSaveButtonState(),this.updateErrorMessage()},onSavedCardInfoChanged:t=>{this.savedCardInfo=t},onEditModeVisibilityChanged:t=>{this.showingStripeSummary=t,this.updateSaveButtonState()},onPaymentSessionConfirmed:async(t,n)=>{const i={paymentSession:{confirmationTokenId:t,setupIntentId:n}};!this.isBillingSameAsShipping&&this.billingFormData&&(i.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(i)}}}),t.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),t.push(this.errorMessageElement);const u=ComponentFactoryService.createElement({type:o.CHECKOUT_BILLING,isFormValid:(t,n)=>{this.billingFormData=n,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return t.push(u),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.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),t.push(this.saveButton),t}async handleSaveButtonClick(){var t;if(this.isSavingPayment||this.stripeFormStatus.isProcessing)return;const n=(this.clientConfig.isBeta()||this.clientConfig.isDevelopment())&&this.clientConfig.get("paymentMethodId");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(i){this.logger.error("Failed to save payment form in edit mode",i),this.showError("Failed to save payment information.")}else if(n)try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(o){this.logger.error("Failed to save payment form in beta mode",o),this.showError("Failed to save payment information.")}else this.updateErrorMessage(),this.validatePrerequisites()&&(null===(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,n,i,o;const r=[],s=this.getStoreValue("checkout.paymentForm"),c=document.createElement("div");c.classList.add("checkout-summary-form-header");const d=document.createElement("h2");d.textContent=!s.billingSameAsShipping&&s.data?"Payment: "+s.data.firstName+" "+s.data.lastName:"Payment: ",c.appendChild(d);const u=document.createElement("span");u.textContent="Edit",u.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),c.appendChild(u),r.push(c);const h=document.createElement("p");if(h.classList.add("checkout-summary-form-line"),h.textContent=capitalizeFirstLetter((null===(n=null===(t=s.paymentMethod)||void 0===t?void 0:t.card)||void 0===n?void 0:n.brand)||"")+" ending in ** "+(null===(o=null===(i=s.paymentMethod)||void 0===i?void 0:i.card)||void 0===o?void 0:o.last4),r.push(h),s.billingSameAsShipping&&!s.data){const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent="Billing address is the same as shipping address.",r.push(t)}if(!s.billingSameAsShipping&&s.data){if(s.data.company){const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent=s.data.company,r.push(t)}const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent=s.data.addressOne+(s.data.addressTwo?", "+s.data.addressTwo:"")+", "+s.data.city+", "+s.data.state+", "+s.data.zipCode,r.push(t);const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=s.data.email,r.push(n);const i=document.createElement("p");i.classList.add("checkout-summary-form-line"),i.textContent=s.data.phone,r.push(i)}return r}}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 n=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);n&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.loading")||![],n=this.store.get("checkout.error")||null;this.updateErrorDisplay(n);const i=this.determineButtonState({isCheckoutLoading:t,hasCheckoutError:!!n});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(i.state),this.placeOrderButton.disabled=i.disabled,this.placeOrderButton.textContent=i.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const n=this.errorContainer.querySelector(".error-text");n&&(this.clearErrorTimeout(),t?(n.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(n.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:t,hasCheckoutError:n}){const i=this.config.layout.placeOrderButtonText,o=this.store.get("checkout.presale");let r=![];if(!o){const t=this.getStoreValue("cart.fulfillments")||{};r=Object.values(t).some(t=>hasUnmetMinimum(t))}const s=this.store.get("checkout.isGift"),c=this.store.get("checkout.customerForm.isValid"),d=this.store.get("checkout.giftRecipientForm.isValid"),u=this.store.get("checkout.paymentForm.isValid");return r||s&&!d||!c||!u?{state:"disabled",text:i,disabled:!![]}:t?{state:"processing",text:"Placing Order...",disabled:!![]}:n?{state:"disabled",text:i,disabled:!![]}:{state:"ready",text:i,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 n=document.createElement("div");n.classList.add("checkout-error-wrapper"),n.setAttribute("role","alert"),n.style.display="none";const i=document.createElement("div");i.classList.add("checkout-error");const r=document.createElement("span");r.classList.add("icon-error"),r.innerHTML=ErrorInfoIcon({});const s=document.createElement("span");s.classList.add("error-text"),i.appendChild(r),i.appendChild(s),n.appendChild(i);const c=ComponentFactoryService.createElement({type:o.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[n,c,t]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var n;const i=t.find(t=>"checkout.presale"===t.path);if(null==i?void 0:i.value)return this.updateExpiresAt(i.value.expiresAt),!![];const o=t.find(t=>"ui.drawer"===t.path);return(null===(n=null==o?void 0:o.value)||void 0===n?void 0:n.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const t=this.store.get("checkout.presale");(null==t?void 0:t.expiresAt)&&this.updateExpiresAt(t.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var t,n;const i=[".drawer-content"];for(const r of i){const n=null===(t=this.rootElement)||void 0===t?void 0:t.closest(r);if(n&&this.isScrollable(n))return n}let o=null===(n=this.rootElement)||void 0===n?void 0:n.parentElement;for(;o&&o!==document.body;){if(this.isScrollable(o))return o;o=o.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var t,n;if(!this.scrollContainer)return;const i=this.scrollContainer.scrollTop,o=70,r=10;!this.isCurrentlyScrolled&&i>o?(this.isCurrentlyScrolled=!![],null===(t=this.rootElement)||void 0===t||t.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&i<r&&(this.isCurrentlyScrolled=![],null===(n=this.rootElement)||void 0===n||n.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(t){const n=window.getComputedStyle(t),i=n.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===i||"scroll"===i||"overlay"===i)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(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 n=new Date,i=Math.floor((this.expiresAt.getTime()-n.getTime())/1e3);i<this.totalDuration&&(this.totalDuration=Math.max(i,240)),this.startCountdown()}catch(n){this.logger.error("Failed to parse presale expiration date",n),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const t=new Date,n=Math.max(0,this.expiresAt.getTime()-t.getTime()),i=n/1e3,o=this.totalDuration-i,r=Math.max(0,Math.min(100,o/this.totalDuration*100)),s=i<60;if(s!==this.isUnderOneMinute){this.isUnderOneMinute=s;const t=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==t||t.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==t||t.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}const c=this.rootElement.querySelector("[data-timer]");c&&(c.textContent=this.formatTime(n));const d=this.rootElement.querySelector("[data-progress-fill]");d&&(d.style.width=r+"%"),0===n&&this.handleExpire()}formatTime(t){const n=Math.floor(t/1e3),i=Math.floor(n/60),o=n%60,r=Math.floor(t%1e3/10);return i.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0")+":"+r.toString().padStart(2,"0")}handleExpire(){this.clientConfig.isBuilder()||(this.stopCountdown(),this.commands.checkout.openPresaleExpiredDrawer())}template(){const t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const n=document.createElement("div");n.classList.add("checkout-presale-text-container");const i=document.createElement("div");i.classList.add("checkout-presale-heading");const o=document.createElement("h2");o.textContent="LIMITED PRE-ORDER:";const r=document.createElement("div");r.classList.add("checkout-presale-timer"),r.setAttribute("data-timer",""),r.textContent="00:00:00",i.appendChild(o),i.appendChild(r);const s=document.createElement("p");s.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",s.classList.add("checkout-presale-subtitle"),n.appendChild(i),n.appendChild(s);const c=document.createElement("div");c.className="checkout-presale-progress-bar",c.setAttribute("data-progress","");const d=document.createElement("div");return d.className="checkout-presale-progress-fill",d.setAttribute("data-progress-fill",""),d.style.width="0%",c.appendChild(d),t.appendChild(n),t.appendChild(c),t}}class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const t=[],n=this.getConfigs("global"),i=document.createElement("div");i.classList.add("checkout-completed-section-container");const r=document.createElement("div");r.classList.add("checkout-completed-title-section");const s=document.createElement("div");s.classList.add("checkout-completed-title-section");const c=document.createElement("p");c.classList.add("presale-expired-title"),c.textContent="Session Expired",s.appendChild(c);const d=document.createElement("p");d.textContent="Your reservation time has ended. The item has been released for other customers.",s.appendChild(d),r.appendChild(s),i.appendChild(r);const u=document.createElement("div");u.classList.add("checkout-completed-help-section"),u.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available.",i.appendChild(u),t.push(i);const h=document.createElement("div");h.classList.add("checkout-completed-section-container");const p=document.createElement("button");p.setAttribute("aria-label","Continue shopping"),p.type="button";const f=document.createElement("span");f.textContent="Continue Shopping",p.setAttribute("tabindex","0"),p.setAttribute("role","button"),p.setAttribute("aria-label","Continue Shopping"),p.appendChild(f);const v=htmlStringToElement(ArrowRightIcon({width:16,height:16}));p.appendChild(v),p.addEventListener("click",()=>this.handleExit()),p.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),h.appendChild(p),t.push(h);const y=document.createElement("div");y.classList.add("checkout-completed-section-container");const b=document.createElement("p");b.classList.add("checkout-completed-auto-close-text"),b.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const x=document.createElement("span");if(x.classList.add("checkout-completed-auto-close-text"),x.textContent="seconds",y.appendChild(b),y.appendChild(this.autoCloseElement),y.appendChild(x),t.push(y),n.layout.showPoweredBy){const n=document.createElement("div");n.classList.add("checkout-completed-powered-by-container");const i=ComponentFactoryService.createElement({type:o.POWERED_BY,context:"checkout"});n.appendChild(i),t.push(n)}return t}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(t){const n=t.find(t=>"checkout.promoCode"===t.path),i=t.find(t=>"checkout.loading"===t.path);if(n){const{value:t,oldValue:i}=n,o=Boolean(i),r=Boolean(t);if(!o&&r)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(o&&!r)return this.container.innerHTML="",this.createInputContainer(),void 0;r&&this.promoCodeText&&t.discountAmount!==(null==i?void 0:i.discountAmount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")")}i&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),n=t.length>=3&&t.length<=255,i=this.getStoreValue("checkout.loading"),o=this.getStoreValue("checkout.promoCode"),r=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!n||i||Boolean(o)||Boolean(r)||this.isApplying}createPromoInput(){return this.promoInput=ComponentFactoryService.createElement({type:o.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],validation:{min:3,max:255},onChange:t=>{const n=t.toUpperCase(),i=this.promoInput;i.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const a=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(n){this.logger.error("Checkout promo code application failed",{promoCode:t,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",a),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a())}),this.applyButton}createAppliedContainer(t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const i=document.createElement("button");i.type="button",i.classList.add("remove-button"),i.textContent="Remove",i.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(i),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const t=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const i=document.createElement("button");return i.type="button",i.classList.add("remove-button"),i.textContent="Remove",i.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(i),n}const n=[];return n.push(this.createPromoInput()),n.push(this.createApplyButton()),n}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const t=this.getStoreValue("checkout.isGift"),n=document.createElement("div");n.classList.add("gift-label-wrapper");const i=document.createElement("span");i.textContent="Send as Gift? (Free)",i.classList.add("gift-toggle-label"),n.appendChild(i);const o=document.createElement("span");o.textContent="With personalized note & gift receipt.",o.classList.add("gift-toggle-description"),n.appendChild(o);const r=document.createElement("div");r.classList.add("toggle-switch"),r.classList.toggle("active",t);const s=document.createElement("div");return s.classList.add("toggle-slider"),r.setAttribute("tabindex","0"),r.setAttribute("aria-label","Toggle Gift Option"),r.setAttribute("role","switch"),r.setAttribute("aria-checked",t?"true":"false"),r.appendChild(s),r.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),r.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),[n,r]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.F=![],this.A=null,this.O=null,this.M=null,this.N=![],this.L=![],this.R=![],this.B=null}async initialize({data:t}){if(this.F)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.F=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.A=window.Stripe(t.publishableKey),this.O=this.A.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.M=this.O.create("payment",t.elementOptions),this.M.mount(this),this.M.on("change",async t=>{const n=!!t.error,i=t.complete,o=n?t.error.message:null;this.L=i,this.N||await this.updateStripeFormStatus({isFormComplete:i,isProcessing:![],hasCompletedPayment:![],errorMessage:o,hasError:n})}),this.M.on("focus",async()=>{this.N||await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.R=![]}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:n}=t.detail;n&&(this.q=n,await this.refreshPaymentSession())}async handleSubmit(){var t,n;if(this.N)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.L)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.N=!![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.R&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const t=await this.createConfirmationTokenId(),n=this.q.clientSecret,i=n.split("_secret_")[0];this.R=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:t,setupIntentId:i},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(i){console.error("Payment submission error:",i),this.R=!![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==i?void 0:i.message)||"Payment processing failed. Please try again."}),((null===(t=null==i?void 0:i.message)||void 0===t?void 0:t.includes("expired"))||(null===(n=null==i?void 0:i.message)||void 0===n?void 0:n.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.N=![]}}async requestSessionRefresh(){return this.B||(this.B=new Promise((t,n)=>{const i=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",l),this.B=null,n(new Error("Session refresh timeout"))},1e4),l=()=>{clearTimeout(i),this.removeEventListener("lce:s:refreshSession",l),this.B=null,t()};this.addEventListener("lce:s:refreshSession",l,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.B}async refreshPaymentSession(){try{this.O&&this.O.update({clientSecret:this.q.clientSecret}),this.R=![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(W){console.error("Failed to refresh payment session:",W),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.M&&this.M.clear(),this.L=![],this.R=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(W){console.error("Failed to reset form:",W)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.O)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.O.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const n={elements:this.O,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:i,confirmationToken:o}=await this.A.createConfirmationToken(n);if(i)throw new SDKError(i.message||"Failed to create confirmation token");if(!o||!o.id)throw new SDKError("Invalid confirmation token received");return o.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,n;try{this.B=null,this.M&&(this.M.unmount(),this.M=null),this.O&&(null===(n=(t=this.O).destroy)||void 0===n?void 0:n.call(t),this.O=null),this.A=null,this.N=![],this.L=![],this.R=![],this.F=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(i){console.warn("Error during Stripe form cleanup:",i)}}loadStripeJS(){return new Promise((t,n)=>{const i=document.querySelector('script[src*="stripe.com"]');if(i)return i.addEventListener("load",()=>t()),i.addEventListener("error",()=>n(new Error("Failed to load Stripe.js"))),void 0;const o=document.createElement("script");o.src="https://js.stripe.com/basil/stripe.js",o.async=!![],o.onload=()=>t(),o.onerror=()=>n(new Error("Failed to load Stripe.js")),document.head.appendChild(o)})}}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 n of t)switch(n.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(n.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(n.value)}}handleSavedCardChange(t){var n,i,o,r;(null===(n=null==t?void 0:t.card)||void 0===n?void 0:n.brand)&&(null===(i=null==t?void 0:t.card)||void 0===i?void 0:i.last4)?this.savedCardInfo={brand:t.card.brand,last4:t.card.last4}:this.savedCardInfo=null,null===(r=(o=this.callbacks).onSavedCardInfoChanged)||void 0===r||r.call(o,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(t){this.isInEditMode=t,this.updateDisplayState()}updateDisplayState(){var t,n,i,o,r,s;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(n=(t=this.callbacks).onEditModeVisibilityChanged)||void 0===n||n.call(t,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(o=(i=this.callbacks).onEditModeVisibilityChanged)||void 0===o||o.call(i,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(t=>{this.logger.error("Failed to create stripe form in updateDisplayState",t)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(s=(r=this.callbacks).onEditModeVisibilityChanged)||void 0===s||s.call(r,![]))}async afterRender(){var t,n,i,o;this.isInEditMode=null!==(t=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==t?t:![];const r=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(n=null==r?void 0:r.card)||void 0===n?void 0:n.brand)&&r.card.last4&&(this.savedCardInfo={brand:r.card.brand,last4:r.card.last4}),null===(o=(i=this.callbacks).onSavedCardInfoChanged)||void 0===o||o.call(i,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 n,i;this.stripeFormStatus=t.detail.status,null===(i=(n=this.callbacks).onStripeFormStatusChanged)||void 0===i||i.call(n,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async t=>{var n,i,o,r,s;try{const{confirmationTokenId:o,setupIntentId:r}=t.detail;await(null===(i=(n=this.callbacks).onPaymentSessionConfirmed)||void 0===i?void 0:i.call(n,o,r)),this.isChangingPayment=![]}catch(c){this.logger.error("Failed to save payment form",c),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==c?void 0:c.message)||"Failed to save payment information. Please try again."},null===(r=(o=this.callbacks).onStripeFormStatusChanged)||void 0===r||r.call(o,this.stripeFormStatus),null===(s=this.stripeFormElement)||void 0===s||s.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const n=await this.doStripeConfig();null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:n}}))}catch(n){this.logger.error("Failed to refresh payment session",n)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const t=document.createElement("span");t.classList.add("stripe-summary-text"),t.textContent=capitalizeFirstLetter(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const n=document.createElement("button");n.type="button",n.classList.add("change-payment-link"),n.textContent="Change",n.addEventListener("click",()=>this.handleChangePayment()),this.stripeSummaryContainer.append(t,n),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var t,n,i,o;this.isChangingPayment=!![],this.hideStripeSummary(),this.showStripeForm(),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(n=(t=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(t,this.stripeFormStatus),null===(o=(i=this.callbacks).onEditModeVisibilityChanged)||void 0===o||o.call(i,![]),await this.createAndMountStripeForm()}template(){const t=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",t.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const n=document.createElement("slot");return n.setAttribute("name",ft),this.stripeFormContainer.appendChild(n),t.push(this.stripeFormContainer),t}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,n=null;for(;t&&t!==document.body;){const i=t.hasAttribute("checkout"),r=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(o.LCE_ELEMENT),s=t.hasAttribute("drawer"),c=(null==n?void 0:n.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(o.DRAWER),d="checkout"===(null==n?void 0:n.getAttribute("data-target"));if(i||r&&s&&c&&d)return this.rootComponent=t,t;n=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");(null==t?void 0:t.key)&&(null==t?void 0:t.secret)||await this.commands.checkout.getPaymentSession();const n=this.store.get("checkout.paymentForm.paymentSession"),i=this.getConfigs("global");return{publishableKey:n.key,clientSecret:n.secret,appearance:{theme:"stripe",variables:{fontFamily:i.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:i.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===i.layout.inputFieldStyle?"none":"1px solid "+i.theme.accentColor,backgroundColor:"filled"===i.layout.inputFieldStyle?i.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t,n,i;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 r=this.findRootComponent();if(!r)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 s=r.querySelectorAll('[slot="'+ft+'"]');if(s.length>0)for(const o of s)o.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:o.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",ft),r.appendChild(this.stripeFormElement)}catch(c){this.logger.error("Stripe form element creation failed",c),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(i=(n=this.callbacks).onStripeFormStatusChanged)||void 0===i||i.call(n,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(t){const n=this.getStoreValue("checkout.updating")||![];if(!n)try{await this.commands.checkout.updateTips(t)}catch(i){this.logger.error("Checkout tips update failed",i)}}async handleFulfillmentTipInput(t,n){const i=this.getStoreValue("checkout.updating")||![];if(i)return;const o=this.getOnDemandFulfillmentTipInfo();if(!o[t])return;const r=Math.round(100*n);try{await this.commands.checkout.updateFulfillmentTip(t,r)}catch(s){this.logger.error("Checkout fulfillment tip update failed",s)}}async removeTipFromFulfillment(t){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const i=this.getOnDemandFulfillmentTipInfo();if(i[t])try{await this.commands.checkout.removeFulfillmentTip(t)}catch(o){this.logger.error("Checkout fulfillment tip removal failed",o)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const n=[10,18,20],i=this.getStoreValue("checkout.updating")||![],o=this.getTipSelection();for(const r of n){const n=document.createElement("button");n.type="button",n.textContent=r+"%",n.classList.add("checkout-tip-button"),n.disabled=i,o===r&&n.classList.add("selected"),n.addEventListener("click",()=>this.handlePercentageSelect(r)),t.appendChild(n)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),n=this.container.querySelector(".checkout-items-toggler-button"),i=this.container.querySelector(".retailers-tips-list");t&&n&&i&&t.addEventListener("click",()=>{const t=i.classList.contains("show");i.classList.toggle("show"),t?(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-label","Expand tips section")):(n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse tips section")),n.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const n=this.getFulfillmentTipInfoArray();if(0===n.length)return t;const i=document.createElement("div");i.classList.add("checkout-tip-distribution-header");const o=document.createElement("h3");o.textContent="View Tip Distribution",o.classList.add("checkout-sub-header"),i.appendChild(o);const r=document.createElement("button");r.type="button",r.classList.add("checkout-items-toggler-button"),r.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-icon"}),i.appendChild(r),t.appendChild(i);const s=document.createElement("div");s.classList.add("retailers-tips-list","show");for(const c of n){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const n=document.createElement("h4");n.textContent=c.retailerName,n.classList.add("checkout-sub-header"),t.appendChild(n);const i=document.createElement("div");i.classList.add("checkout-tip-fulfillment-input-wrapper");const o=document.createElement("div");o.classList.add("dollar-input-container");const r=document.createElement("span");r.classList.add("dollar-sign"),r.textContent="$";const d=document.createElement("input");let u;d.type="number",d.id="tip-input-"+c.fulfillmentId,d.name="tip-"+c.fulfillmentId,d.min="0",d.step="0.01",d.placeholder="0.00",d.classList.add("dollar-input"),d.value=c.tip>0?(c.tip/100).toFixed(2):"",d.disabled=this.getStoreValue("checkout.updating")||![],d.addEventListener("wheel",t=>{t.preventDefault()}),d.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),d.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),d.addEventListener("paste",t=>{t.preventDefault()}),d.addEventListener("contextmenu",t=>{t.preventDefault()}),d.addEventListener("input",t=>{const n=t.target;let i=n.value;if(Number.parseFloat(i)<0&&(n.value=Math.abs(Number.parseFloat(i)).toString(),i=n.value),i.includes(".")){const t=i.split(".");t.length>1&&t[1].length>2&&(n.value=t[0]+"."+t[1].substring(0,2))}}),d.addEventListener("input",t=>{const n=t.target,i=Number.parseFloat(n.value)||0;u&&clearTimeout(u),u=setTimeout(()=>{this.handleFulfillmentTipInput(c.fulfillmentId,i)},500)}),o.appendChild(r),o.appendChild(d),i.appendChild(o);const h=document.createElement("button");h.type="button",h.textContent="Remove",h.classList.add("checkout-tip-remove-button"),h.disabled=this.getStoreValue("checkout.updating")||![],h.addEventListener("click",()=>this.removeTipFromFulfillment(c.fulfillmentId)),i.appendChild(h),t.appendChild(i),s.appendChild(t)}return t.appendChild(s),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),n=this.getFulfillmentTipInfoArray();if(t&&n.length>0){const t=n.some(t=>t.tip>0);if(t)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(i){this.logger.error("Default tip initialization failed",i),this.isInitialized=![]}}if(null==t)try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(o){this.logger.error("Default tip initialization failed during fallback",o),this.isInitialized=![]}}template(){const t=[],n=this.getFulfillmentTipInfoArray();if(0===n.length)return t;n.length>0&&this.initializeDefaultTip();const i=document.createElement("section");i.classList.add("checkout-tip-container");const o=document.createElement("h3");o.classList.add("checkout-sub-header"),o.textContent="Add a tip",i.appendChild(o);const r=document.createElement("div");r.classList.add("checkout-tip-config-container");const s=this.createTipSelectionButtons();r.appendChild(s),i.appendChild(r);const c=document.createElement("p");c.classList.add("checkout-tip-disclaimer"),c.textContent="Tips will be split proportionally between retailers.",i.appendChild(c);const d=this.createTipDistribution();return t.push(i,d),t}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(t){var n,i;const o=t.find(t=>"checkout.giftCardError"===t.path),r=t.find(t=>"checkout.promoCodeError"===t.path),s=t.find(t=>"checkout.giftCards"===t.path);if(s&&this.updateAppliedGiftCards(s.value),o){const t=this.container.querySelector(".input-gift-card-container");if(t){const i=t.nextElementSibling;if((null===(n=null==i?void 0:i.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==i?void 0:i.remove()),o.value){const n=this.createErrorElement(o.value);t.after(n)}const r=t.querySelector(".apply-button");r&&(r.disabled=Boolean(o.value))}}if(r){const t=this.container.querySelector(".input-promo-code-container");if(t){const n=t.nextElementSibling;if((null===(i=null==n?void 0:n.classList)||void 0===i?void 0:i.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),r.value){const n=this.createErrorElement(r.value);t.after(n)}const o=t.querySelector(".apply-button");o&&(o.disabled=Boolean(r.value))}}}updateAppliedGiftCards(t){const n=t&&t.length>0;if(!n)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",t.forEach(t=>{const n=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(n)})}createAppliedGiftCardElement(t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),n.setAttribute("data-gift-card-code",t.code);const i=document.createElement("span");i.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",n.appendChild(i);const o=document.createElement("button");return o.type="button",o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),n.appendChild(o),n}pcInputContainer(){const t=ComponentFactoryService.createElement({type:o.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return t}gcInputContainer(){const t=ComponentFactoryService.createElement({type:o.CHECKOUT_GIFT_CARDS});return t}inputContainer(){var t;const n=this.getConfigs("checkout"),i=this.getConfigs("global"),o=n.layout.allowGiftCards,r=null===(t=null==i?void 0:i.layout)||void 0===t?void 0:t.allowPromoCodes,s=document.createElement("div");s.classList.add("checkout-pc-gc-sub-container");const c=this.pcInputContainer(),d=this.gcInputContainer();r&&s.appendChild(c);const u=this.getStoreValue("checkout.promoCodeError");if(u){const t=this.createErrorElement(u);t.classList.add("promo-code-error-wrapper"),s.appendChild(t)}o&&s.appendChild(d);const h=this.getStoreValue("checkout.giftCardError");if(h){const t=this.createErrorElement(h);s.appendChild(t)}return s}createErrorElement(t){const n=document.createElement("div");n.classList.add("error-banner-checkout");const i=document.createElement("div");i.innerHTML=ErrorInfoIcon({});const o=document.createElement("p");return o.textContent=t.toString(),n.appendChild(i),n.appendChild(o),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),n.remove()},3e3),n}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const n=[];return n.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 n=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(n)}),n.push(this.appliedGiftCardsContainer)),n}disconnected(){this.appliedGiftCardsContainer=null}}function fulfillmentAddress(t,n){if(!t)return"";if(n===r.SHIPPING){const n=[t.city,t.state].filter(Boolean);return n.join(", ")}const i=[t.one,t.two,t.city,t.state].filter(Boolean);return i.join(", ")}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:n,isSelected:i,fulfillmentStatus:o,selectedSizeAttributes:s}){var c,d,u,h,p;let f=0;const v=null==s?void 0:s.presale,y=(null==v?void 0:v.isActive)&&(null==v?void 0:v.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(v.estimatedShipBy):"",b=n===r.SHIPPING,x=n===r.ON_DEMAND;b&&(f=(null===(d=null===(c=null==t?void 0:t.fees)||void 0===c?void 0:c.individual)||void 0===d?void 0:d.fee)||0),x&&(f=(null===(u=null==t?void 0:t.fees)||void 0===u?void 0:u.fee)||0);const w=fulfillmentAddress(t.retailerAddress,n);let C=null;n===r.ON_DEMAND&&o.openTime&&(null==o?void 0:o.closeTime)&&(C=o.isOpen?"Closes at "+format24TimeTo12$1(null==o?void 0:o.closeTime):"Opens at "+format24TimeTo12$1(null==o?void 0:o.openTime));const k=n===r.ON_DEMAND&&o&&o.isClosed?"closed":"",S=document.createElement("div");S.className="popup-retailer-card "+(i?"selected":"")+" "+k,S.setAttribute("data-fulfillment-id",t.fulfillmentId),S.setAttribute("role","button"),S.setAttribute("tabindex","0"),S.setAttribute("aria-pressed",i?"true":"false");const E=n===r.SHIPPING?"Shipping":"Same-day delivery";S.setAttribute("aria-label",E+" from "+t.retailerName+", "+formatCentToDollarText(null!==(h=t.price)&&void 0!==h?h:0));const _=document.createElement("div");_.className="row";const T=document.createElement("span");T.className="name",T.textContent=t.retailerName,_.appendChild(T);const D=document.createElement("span");D.className="price",D.textContent=formatCentToDollarText(null!==(p=t.price)&&void 0!==p?p:0),_.appendChild(D),S.appendChild(_);const P=document.createElement("div");P.className="row";const F=document.createElement("span");F.className="expectation",F.textContent=o.isClosed?C:(null==v?void 0:v.isActive)?y:(null==t?void 0:t.expectation.detail)||"No expectation available",P.appendChild(F);const A=document.createElement("span");if(A.className="fee",A.textContent=f>0?formatCentToDollarText(f):"Free Delivery",P.appendChild(A),S.appendChild(P),x){const t=document.createElement("div");t.className="row";const n=document.createElement("span");n.className="address",n.textContent=w,t.appendChild(n),S.appendChild(t)}return S}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:n,shippingSelected:i,onDemandSelected:o,onTabClick:s,enableShippingFulfillment:c,enableOnDemandFulfillment:d}){const u=n.length>0,h=document.createElement("div");if(h.className="fulfillment-tabs-container",h.setAttribute("role","tablist"),h.setAttribute("aria-label","Delivery method options"),c){const n=document.createElement("div");n.className="fulfillment-tab "+(i?"selected":""),n.setAttribute("data-fulfillment-type",r.SHIPPING),n.setAttribute("role","tab"),n.setAttribute("tabindex","0"),n.setAttribute("aria-selected",i?"true":"false"),n.setAttribute("aria-label","Shipping, "+t.length+" options"),n.addEventListener("click",s),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())});const o=document.createElement("span");o.className="fulfillment-tab-label "+(i?"selected":""),o.textContent="Shipping ("+t.length+")",n.appendChild(o),h.appendChild(n)}if(d){const t=document.createElement("div");t.className="fulfillment-tab "+(o?"selected":"")+" "+(u?"":"disabled"),t.setAttribute("data-fulfillment-type",r.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",o?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+n.length+" options"),u||t.setAttribute("aria-disabled","true"),t.addEventListener("click",s),t.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())});const i=document.createElement("span");i.className="fulfillment-tab-label "+(o?"selected":""),i.textContent="Same-Day Delivery ("+n.length+")",t.appendChild(i),h.appendChild(t)}return h}class ProductAddToCartSectionComponent extends BaseComponent{get hostClasses(){return["add-to-cart-container"]}get hostAttributes(){return{role:"region","aria-live":"polite","aria-atomic":"false","aria-label":"Add to cart section"}}constructor(){super({watchStorePaths:["products.{productId}.quantity","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability","cart.items","products.{productId}.updating"]})}getProductId(){return this.params.productId}getAvailableQuantity(){var t;const n=this.getProductId(),i=this.getStoreValue("products."+n);if(!i.selectedFulfillment||!i.selectedSizeId)return 0;const o=i.selectedFulfillment.partNumber,r=i.selectedFulfillment.fulfillmentId,s=null===(t=i.sizes[i.selectedSizeId].attributes)||void 0===t?void 0:t.maxQuantityPerOrder;if(!s)return 0;const c=this.getStoreValue("cart.items")||{},d=Object.values(c).filter(t=>t.partNumber===o&&t.fulfillmentId===r),u=d.reduce((t,n)=>t+n.quantity,0);return s-u}isFulfillmentClosed(){const t=this.getProductId(),n=this.getStoreValue("products."+t);if(!n.selectedFulfillment)return![];const i=getRetailerOffHours(n.selectedFulfillment);return n.selectedFulfillmentType===r.ON_DEMAND&&i&&i.isClosed}isButtonLoading(){const t=this.getProductId();return this.getStoreValue("products."+t+".updating")}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),n=this.getAvailableQuantity(),i=t<n;return{currentQuantity:t,availableQuantity:n,canIncrease:i,canDecrease:t>1}}async handleAddToCart(){var t,n,i;const o=this.getProductId(),r=this.getStoreValue("products."+o);if(!r.selectedFulfillment)return this.logger.error("Product add to cart failed: No fulfillment option selected",{productId:o,selectedSizeId:r.selectedSizeId}),void 0;const s=this.getSizeAttributes(),c=(null===(t=null==s?void 0:s.presale)||void 0===t?void 0:t.isActive)===!![],d=this.isPresaleActive(s);c&&d?await this.commands.product.addPresaleToCart(o,{upc:r.sizes[r.selectedSizeId].upc,fulfillmentId:r.selectedFulfillment.fulfillmentId,partNumber:null===(n=r.selectedFulfillment)||void 0===n?void 0:n.partNumber,quantity:r.quantity,identifier:o}):await this.commands.product.addToCart(o,{upc:r.sizes[r.selectedSizeId].upc,fulfillmentId:r.selectedFulfillment.fulfillmentId,partNumber:null===(i=r.selectedFulfillment)||void 0===i?void 0:i.partNumber,quantity:r.quantity,identifier:o})}async handleQuantityChange(t){const n=this.getProductId();await this.commands.product.updateQuantity(n,t)}calculateTotalPrice(){const t=this.getProductId(),n=this.getStoreValue("products."+t),i=n.selectedFulfillment,o=i.price*n.quantity;return{quantity:n.quantity,totalPrice:o}}createQuantityContainer(t){const n=this.calculateQuantityLimits(),i=document.createElement("div");return i.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!n.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!n.canDecrease).toString()),n.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=n.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+n.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!n.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!n.canIncrease).toString()),n.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),i.appendChild(this.qtyDecreaseButton),i.appendChild(this.quantityText),i.appendChild(this.qtyIncreaseButton),i}getSizeAttributes(){const t=this.getProductId(),n=this.getStoreValue("products."+t+".selectedSizeId"),i=this.getStoreValue("products."+t+".sizes."+n);return(null==i?void 0:i.attributes)||{}}isPresaleActive(t){const n=null==t?void 0:t.presale;if(!n)return![];if(!n.isActive)return![];if(n.canPurchaseOn){const t=new Date(n.canPurchaseOn),i=new Date;if(i.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:n}=this.calculateTotalPrice(),i=this.getSizeAttributes(),o=this.calculateQuantityLimits(),r=(null===(t=null==i?void 0:i.presale)||void 0===t?void 0:t.isActive)===!![],s=this.isPresaleActive(i),c=r?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?c+" - "+formatCentToDollarText(n):c;const d=r&&!s||0===o.availableQuantity||this.isFulfillmentClosed(),u=this.isButtonLoading(),h=this.config.layout.addToCartButtonShowTotalPrice?c+" for "+formatCentToDollarText(n):c;return this.addToCartButton.setAttribute("aria-label",h),this.addToCartButton.setAttribute("aria-busy",u.toString()),this.addToCartButton.setAttribute("aria-disabled",d.toString()),d&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),u&&(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(),n=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),i=this.getConfigs("configurations");if(!n||!i.isElementsEnabled)return[];const o=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer(this.config.layout.quantityCounterStyle);o.push(t)}const r=this.createAddToCartButton();return o.push(r),o}}class ProductDescriptionComponent extends BaseComponent{constructor(){super(...arguments),this.isCollapsed=!![]}get hostClasses(){return["product-description"]}template(){const t=this.params.productId,n=this.getStoreValue("products."+t+".description"),i=this.getStoreValue("products."+t+".htmlDescription"),o="About this product:",r="See More",s="See Less",c=document.createElement("h3");c.className="title",c.textContent=o;const d=document.createElement("div");d.className="content collapsed",d.innerHTML=""===(null==i?void 0:i.trim())?n:sanitizeHTML(i);const u=document.createElement("span");u.className="collapse-button",u.textContent=r,u.setAttribute("role","button"),u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Show more product information"),u.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,d.classList.toggle("collapsed"),u.textContent=this.isCollapsed?r:s,u.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),u.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return u.addEventListener("click",toggleContent),u.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[c,d,u]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(t){var n;const i=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!i)return![];const o=i.value,r=o.isOpen,s=null===(n=o.contentConfig)||void 0===n?void 0:n.type,c=s!==this.currentContentType;return r&&!this.isOpen?(this.currentContentType=s,this.openWithContent(o),![]):r&&this.isOpen&&!c?![]:r&&this.isOpen&&c?(this.currentContentType=s,this.openWithContent(o),![]):!r&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const n=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:n}),void 0;const{type:i,data:o}=t||{},r=ComponentFactoryService.createElement({type:i,...o});this.contentContainer&&this.contentContainer.appendChild(r),this.open()}catch(i){this.logger.error("Failed to open product drawer",i),this.commands.product.closeProductDrawer(n)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay;return["product-image-carousel",t]}constructor(){super({watchOnlyStorePaths:["products.{productId}.mainImage"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){const n=this.params.productId,i=t.find(t=>t.path==="products."+n+".mainImage");if(null==i?void 0:i.value){const t=this.params.images.indexOf(null==i?void 0:i.value);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+i.value+"')")}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let n=0;n<this.thumbnails.length;n++){const t=this.thumbnails[n];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(n)})}const t=this.container.querySelectorAll(".carousel-dot");for(let n=0;n<t.length;n++){const i=t[n];i.addEventListener("click",()=>this.selectImage(n))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var n,i;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===(n=this.thumbnails[this.currentImageIndex])||void 0===n||n.classList.remove("selected"),null===(i=this.thumbnails[t])||void 0===i||i.classList.add("selected");const o=this.container.querySelectorAll(".carousel-dot");for(let r=0;r<o.length;r++){const n=o[r];n.classList.toggle("active",r===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const n=this.thumbnails[t],i=this.galleryViewport.offsetWidth,o=n.offsetLeft+n.offsetWidth/2,r=i/2,s=r-o,c=0,d=-(this.galleryContainer.scrollWidth-i);this.translateX=Math.max(d,Math.min(c,s)),this.updateTransform(!![])}setupMainImageSwipe(){var t,n;let i=0,o=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{i=t.touches[0].clientX,o=t.touches[0].clientY},{passive:!![]}),null===(n=this.mainImageElement)||void 0===n||n.addEventListener("touchend",t=>{const n=t.changedTouches[0].clientX-i,r=t.changedTouches[0].clientY-o;Math.abs(n)>Math.abs(r)&&Math.abs(n)>50&&(n>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const 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 n="touches"in t?t.touches[0].clientX:t.clientX,i=n-this.startX;Math.abs(i)>5&&(this.hasMoved=!![]);const o=this.currentTranslateX+i,r=0,s=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(s,Math.min(r,o)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const t=[],n=this.params.images.length>1,i=document.createElement("div");if(i.className="main-image",i.title="Product main image",i.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",n){const t=document.createElement("div");t.className="carousel-dots";for(let n=0;n<this.params.images.length;n++){const i=document.createElement("button");i.type="button",i.className="carousel-dot "+(0===n?"active":""),i.setAttribute("data-index",n.toString()),t.appendChild(i)}i.appendChild(t)}this.mainImageElement=i,t.push(i);const o=document.createElement("div");o.className="gallery-viewport";const r=document.createElement("div");r.className="gallery-container";for(let s=0;s<this.params.images.length;s++){const t=this.params.images[s],n=document.createElement("div");n.className="gallery-image-wrapper "+(0===s?"selected":"");const i=document.createElement("img");i.src=t,i.className="gallery-image",i.alt="Product thumbnail "+(s+1),i.loading="lazy",n.appendChild(i),r.appendChild(n)}return o.appendChild(r),t.push(o),t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var n,i,o,s;const c=this.getProductId();if(!t.some(t=>t.path==="products."+c+".selectedFulfillmentType"))return;const d=this.getStoreValue("products."+c),u=d.sizes[d.selectedSizeId],h=this.getConfigs("global");this.addPersonalizationSpan&&(d.selectedFulfillmentType===r.SHIPPING&&h.layout.enablePersonalization&&d.productHasAvailability&&(null===(i=null===(n=null==u?void 0:u.attributes)||void 0===n?void 0:n.engraving)||void 0===i?void 0:i.status)===!![]&&(null===(o=null==d?void 0:d.selectedFulfillment)||void 0===o?void 0:o.isVariantEngravable)===!![]&&(null===(s=null==d?void 0:d.selectedFulfillment)||void 0===s?void 0:s.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),n=this.container.querySelectorAll("[select-size]");for(const i of n){const o=i.textContent||"",r=i.classList.contains("selected");i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-label","Select "+o),i.setAttribute("aria-pressed",r?"true":"false"),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}),i.addEventListener("click",async()=>{var o,r,s,c;const d=i.dataset.sizeId;if(!d)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:i.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,d);for(const t of n)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");i.classList.add("selected"),i.setAttribute("aria-pressed","true");const u=this.getStoreValue("products."+t),h=u.sizes[d],p=this.getConfigs("global");this.addPersonalizationSpan&&(p.layout.enablePersonalization&&(null===(r=null===(o=null==h?void 0:h.attributes)||void 0===o?void 0:o.engraving)||void 0===r?void 0:r.status)===!![]&&u.productHasAvailability&&(null===(s=u.selectedFulfillment)||void 0===s?void 0:s.isVariantEngravable)===!![]&&(null===(c=u.selectedFulfillment)||void 0===c?void 0:c.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,n){const i=document.createElement("div");i.className="size-container";const o=document.createElement("h3");o.className="size-label",o.textContent="Size",o.id="size-label",i.appendChild(o);const r=document.createElement("div");r.className="size-buttons-container",r.setAttribute("role","group"),r.setAttribute("aria-labelledby","size-label");for(const s of Object.values(n)){const n=document.createElement("span");n.setAttribute("data-size-id",s.id),n.setAttribute("select-size",""),n.className="size-button "+(s.id===t?"selected":"");const i=s.packDesc?" ("+s.packDesc+")":"";n.textContent=""+s.size+i,r.appendChild(n)}return i.appendChild(r),i}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,n,i,r,s;const c=this.getProductId(),d=this.getStoreValue("products."+c),u=d.sizes[d.selectedSizeId],h=this.getConfigs("global"),p=[],f=document.createElement("div");f.className="price-personalization-container";const v=ComponentFactoryService.createElement({type:o.PRODUCT_PRICE,productId:c});if(f.appendChild(v),h.layout.enablePersonalization&&d.productHasAvailability&&(null===(n=null===(t=null==u?void 0:u.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.status)===!![]&&(null===(i=null==d?void 0:d.selectedFulfillment)||void 0===i?void 0:i.canEngrave)===!![]&&(null===(r=null==d?void 0:d.selectedFulfillment)||void 0===r?void 0:r.isVariantEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var t,n,i,r,s,u,h,p;const f=d.sizes[d.selectedSizeId];await this.commands.product.openProductDrawer(c,o.ENGRAVING_FORM,{identifier:c,context:"product",lines:[],maxLines:(null===(n=null===(t=f.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.maxLines)||1,maxCharsPerLine:(null===(r=null===(i=f.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.maxCharsPerLine)||16,fee:(null===(u=null===(s=f.attributes)||void 0===s?void 0:s.engraving)||void 0===u?void 0:u.fee)||0,location:null===(p=null===(h=f.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),f.appendChild(this.addPersonalizationSpan)}p.push(f);const y=this.renderProductSizes(d.selectedSizeId,d.sizes);if(p.push(y),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:o.ADDRESS_DISPLAY,productId:c});p.push(t)}const b=ComponentFactoryService.createElement({type:o.PRODUCT_RETAILERS,productId:c});p.push(b);const x=ComponentFactoryService.createElement({type:o.PRODUCT_ADD_TO_CART_SECTION,productId:c});p.push(x);const w=null===(s=null==u?void 0:u.attributes)||void 0===s?void 0:s.presale;if((null==w?void 0:w.isActive)===!![]&&(null==w?void 0:w.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==w?void 0:w.language)||""),p.push(t)}if(this.config.layout.showDescription&&(d.description.trim().length>0||d.htmlDescription.trim().length>0)){const t=ComponentFactoryService.createElement({type:o.PRODUCT_DESCRIPTION,productId:c});p.push(t)}return p}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:n,showDescription:i,showQuantityCounter:o,fulfillmentDisplay:r,showImages:s}=this.config.layout,c=document.createElement("div");c.classList.add("product-content-wrapper");const d=document.createElement("div");if(d.classList.add("skeleton-container"),n){const t=document.createElement("div");t.classList.add("wave","sc-title"),d.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),d.appendChild(t),d}const u=document.createElement("div");u.classList.add("wave","sc-price"),d.appendChild(u);const h=document.createElement("div");h.classList.add("sc-sizes");const p=document.createElement("div");p.classList.add("wave","sc-size-button"),h.appendChild(p);const f=document.createElement("div");f.classList.add("wave","sc-size-button"),h.appendChild(f);const v=document.createElement("div");v.classList.add("wave","sc-size-button"),h.appendChild(v);const y=document.createElement("div");y.classList.add("wave","sc-size-button"),h.appendChild(y);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),h.appendChild(b),d.appendChild(h);const x=document.createElement("div");x.classList.add("sc-row");const w=document.createElement("div");w.classList.add("wave","sc-price"),x.appendChild(w);const C=document.createElement("div");C.classList.add("wave","sc-personalization"),x.appendChild(C),d.appendChild(x);const k=document.createElement("div");k.classList.add("wave","sc-deliver-to"),d.appendChild(k);const S=document.createElement("div");S.classList.add("wave","sc-address"),d.appendChild(S);const E=document.createElement("div");E.classList.add("wave","sc-retailers",r),d.appendChild(E);const _=document.createElement("div");if(_.classList.add("sc-row"),o){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),_.appendChild(t)}const T=document.createElement("div");if(T.classList.add("wave","sc-add-to-cart"),_.appendChild(T),d.appendChild(_),i){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),d.appendChild(t);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),d.appendChild(n);const i=document.createElement("div");i.classList.add("wave","sc-description-line"),d.appendChild(i);const o=document.createElement("div");o.classList.add("wave","sc-description-line"),d.appendChild(o);const r=document.createElement("div");r.classList.add("wave","sc-description-more"),d.appendChild(r)}const D=document.createElement("div");if(D.classList.add("product-content"),D.appendChild(d),c.appendChild(D),s){c.classList.add("has-images");const t=this.createImageSkeletons();c.prepend(t)}return c}createImageSkeletons(){const t=document.createElement("div");t.classList.add("product-image-carousel","skeleton");const n=document.createElement("div");n.classList.add("wave","sc-main-image"),n.title="Product main image loading";const i=document.createElement("div");i.classList.add("carousel-dots");for(let s=0;s<3;s++){const t=document.createElement("div");t.classList.add("wave","sc-carousel-dot"),i.appendChild(t)}n.appendChild(i),t.appendChild(n);const o=document.createElement("div");o.classList.add("gallery-viewport");const r=document.createElement("div");r.classList.add("gallery-container");for(let s=0;s<4;s++){const t=document.createElement("div");t.classList.add("gallery-image-wrapper");const n=document.createElement("div");n.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(n),r.appendChild(t)}return o.appendChild(r),t.appendChild(o),t}}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 n=this.getProductId(),i=t.find(t=>t.path==="products."+n+".drawer.isOpen");if(i){const t=i.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),n=this.getStoreValue("address.formattedAddress");if(n)return ComponentFactoryService.createElement({type:o.PRODUCT_INTERACTIONS,productId:this.getProductId()});const i=document.createElement("button");return i.type="button",i.className="product-options-open-address-button",i.textContent=this.config.layout.buyNowButtonText,i.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(o.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,o.ADDRESS_INPUT,{productId:t})}),i}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){var t;const n=this.getProductId(),i=this.getStoreValue("products."+n);let o=(null===(t=i.priceInfo)||void 0===t?void 0:t.avg)||0;return i.selectedFulfillment&&(o=i.selectedFulfillment.price),formatCentToDollarText(o)}}class ProductRetailersComponent extends BaseComponent{get hostClasses(){return["product-retailers"]}constructor(){super({watchStorePaths:["products.{productId}.productHasAvailability"]})}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Retailer information"}}getProductId(){return this.params.productId}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),i=this.getConfigs("product"),r=[],s=this.getConfigs("configurations");if(!n.productHasAvailability||!s.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),r.push(t),r}const c="carousel"===i.layout.fulfillmentDisplay?o.PRODUCT_RETAILERS_CAROUSEL:o.PRODUCT_RETAILERS_POPUP,d=ComponentFactoryService.createElement({type:c,productId:t});return r.push(d),r}}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 n=this.getProductId(),i=t.find(t=>t.path==="products."+n+".selectedFulfillmentId");(null==i?void 0:i.value)&&this.updateSelectedCard(i.value)}updateSelectedCard(t){for(const i of this.retailerCards)i.classList.remove("selected"),i.setAttribute("aria-pressed","false");const n=this.retailerCards.findIndex(n=>n.dataset.fulfillmentId===t);-1!==n&&(this.retailerCards[n].classList.add("selected"),this.retailerCards[n].setAttribute("aria-pressed","true"),this.scrollToIndex(n))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const n=this.retailerCards[t],i=this.listViewport.offsetWidth,o=n.offsetLeft+n.offsetWidth/2,r=i/2,s=r-o,c=0,d=-(this.listContainer.scrollWidth-i);this.translateX=Math.max(d,Math.min(c,s)),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 n="touches"in t?t.touches[0].clientX:t.clientX,i=n-this.startX;Math.abs(i)>5&&(this.hasMoved=!![]);const o=this.currentTranslateX+i,r=0,s=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(s,Math.min(r,o)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.listContainer&&(this.listContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.listContainer&&(this.listContainer.style.transition=t?"transform 0.3s ease":"none",this.listContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}async onFulfillmentTabClick(t){const n=this.getProductId(),i=t.currentTarget.dataset.fulfillmentType;if(!i)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(n,i)}async onRetailerCardClick(t){if(this.hasMoved)return;const n=this.getProductId(),i=t.currentTarget.dataset.fulfillmentId;if(!i)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const o=this.getStoreValue("products."+n+".selectedFulfillment");if(o&&o.fulfillmentId===i)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:n,fulfillmentId:i}),void 0;await this.commands.product.selectFulfillment(n,i)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:n,isSelected:i,fulfillmentStatus:o,selectedSizeAttributes:s}){var c,d,u,h,p;let f=0;const v=null==s?void 0:s.presale,y=(null==v?void 0:v.isActive)&&(null==v?void 0:v.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(v.estimatedShipBy):"",b=n===r.SHIPPING,x=n===r.ON_DEMAND;b&&(f=(null===(d=null===(c=null==t?void 0:t.fees)||void 0===c?void 0:c.individual)||void 0===d?void 0:d.fee)||0),x&&(f=(null===(u=null==t?void 0:t.fees)||void 0===u?void 0:u.fee)||0);const w=fulfillmentAddress(t.retailerAddress,n);let C=null;n===r.ON_DEMAND&&o.openTime&&(null==o?void 0:o.closeTime)&&(C=o.isOpen?"Closes at "+format24TimeTo12$1(null==o?void 0:o.closeTime):"Opens at "+format24TimeTo12$1(null==o?void 0:o.openTime));const k=n===r.ON_DEMAND&&o&&o.isClosed?"closed":"",S=document.createElement("div");S.className="carousel-retailer-card "+(i?"selected":"")+" "+k,S.setAttribute("data-fulfillment-id",t.fulfillmentId),S.setAttribute("role","button"),S.setAttribute("tabindex","0"),S.setAttribute("aria-pressed",i?"true":"false");const E=n===r.SHIPPING?"Shipping":"Same-day delivery";S.setAttribute("aria-label",E+" from "+t.retailerName+", "+formatCentToDollarText(null!==(h=t.price)&&void 0!==h?h:0));const _=document.createElement("div");_.className="retailer-header";const T=document.createElement("h3");if(T.className="name",T.textContent=t.retailerName,_.appendChild(T),x){const t=document.createElement("h3");t.className="address",t.textContent=w,_.appendChild(t)}const D=document.createElement("div");D.className="retailer-body";const P=document.createElement("span");P.className="product-price",P.textContent=formatCentToDollarText(null!==(p=t.price)&&void 0!==p?p:0);const F=document.createElement("span");F.className="shipping-price",F.textContent=f>0?"+ "+formatCentToDollarText(f):"FREE Delivery";const A=document.createElement("span");return A.className="expectation",A.textContent=o.isClosed?C:(null==v?void 0:v.isActive)?y:(null==t?void 0:t.expectation.detail)||"No expectation available",D.append(P,F,A),S.append(_,D),S}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),i=this.getStoreValue("products."+t+".sizes."+n.selectedSizeId),o=(null==i?void 0:i.attributes)||null,s=[];for(const r in i.shippingFulfillments)Object.prototype.hasOwnProperty.call(i.shippingFulfillments,r)&&s.push(i.shippingFulfillments[r]);const c=[];for(const r in i.onDemandFulfillments)Object.prototype.hasOwnProperty.call(i.onDemandFulfillments,r)&&c.push(i.onDemandFulfillments[r]);const d=n.selectedFulfillmentType===r.SHIPPING,u=n.selectedFulfillmentType===r.ON_DEMAND,h=d?s:c,p=renderFulfillmentTabsContainer({shippingFulfillments:s,onDemandFulfillments:c,shippingSelected:d,onDemandSelected:u,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!n.fulfillmentHasAvailability||0===h.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[p,t]}this.listViewport=document.createElement("div"),this.listViewport.className="carousel-fulfillment-list-viewport",this.listContainer=document.createElement("div"),this.listContainer.className="carousel-fulfillment-list-container";for(const f of h){const t=getRetailerOffHours(f),i=this.generateRetailerCard({fulfillment:f,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:f.fulfillmentId===n.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:o}),s=n.selectedFulfillmentType===r.ON_DEMAND&&t&&t.isClosed;s?i.setAttribute("aria-disabled","true"):(i.addEventListener("click",this.onRetailerCardClick.bind(this)),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())})),this.listContainer.appendChild(i)}return this.listViewport.appendChild(this.listContainer),[p,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),i=this.getStoreValue("products."+t+".sizes."+n.selectedSizeId),s=(null==i?void 0:i.attributes)||null,c=this.config.layout.enableShippingFulfillment,d=this.config.layout.enableOnDemandFulfillment,u=Object.values(i.shippingFulfillments),h=Object.values(i.onDemandFulfillments),p=(c?u.length:0)+(d?h.length:0),f=document.createElement("div");f.className="header";const v=document.createElement("span");v.className="header-label",v.textContent=n.selectedFulfillmentType===r.SHIPPING?"Shipping From:":"Delivering From:";const y=document.createElement("button");if(y.className="delivery-options",y.type="button",y.textContent="See Delivery Options ("+p+")",y.setAttribute("aria-label","View all "+p+" delivery options"),y.addEventListener("click",async()=>{0!==p&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(o.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,o.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),f.appendChild(v),f.appendChild(y),!n.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=getRetailerOffHours(n.selectedFulfillment),w=renderPopupRetailerCard({fulfillment:n.selectedFulfillment,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:![],fulfillmentStatus:x,selectedSizeAttributes:s});return b.appendChild(w),[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 n=this.getProductId(),i=t.currentTarget.dataset.fulfillmentType;if(!i)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(n,i)}async onRetailerCardClick(t){const n=this.getProductId(),i=t.currentTarget.dataset.fulfillmentId;if(!i)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const e=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(n),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},o=this.getStoreValue("products."+n+".selectedFulfillment");if(o&&o.fulfillmentId===i)return await e(),void 0;await this.commands.product.selectFulfillment(n,i),await e()}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),i=this.getStoreValue("products."+t+".sizes."+n.selectedSizeId),o=(null==i?void 0:i.attributes)||null,s=[];for(const r in i.shippingFulfillments)Object.prototype.hasOwnProperty.call(i.shippingFulfillments,r)&&s.push(i.shippingFulfillments[r]);const c=[];for(const r in i.onDemandFulfillments)Object.prototype.hasOwnProperty.call(i.onDemandFulfillments,r)&&c.push(i.onDemandFulfillments[r]);const d=n.selectedFulfillmentType===r.SHIPPING,u=n.selectedFulfillmentType===r.ON_DEMAND,h=d?s:c,p=document.createElement("h5");p.className="popup-retailers-section-title",p.textContent="Delivery Options";const f=renderFulfillmentTabsContainer({shippingFulfillments:s,onDemandFulfillments:c,shippingSelected:d,onDemandSelected:u,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!n.fulfillmentHasAvailability||0===h.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[p,f,t]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";for(const r of h){const t=getRetailerOffHours(r),i=renderPopupRetailerCard({fulfillment:r,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:r.fulfillmentId===n.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:o});i.addEventListener("click",this.onRetailerCardClick.bind(this)),i.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i.click())}),v.appendChild(i)}return[p,f,v]}}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 n=this.getProductId(),i=t.find(t=>t.path==="products."+n+".drawer.isOpen"),o=t.find(t=>t.path==="products."+n+".rerender");i&&this.titleElement&&this.titleElement.classList.toggle("hide",i.value),(null==o?void 0:o.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const n=this.getProductId(),i=this.getStoreValue("products."+n);if(!i)return ComponentFactoryService.createElement({type:o.PRODUCT_LOADING});if(i.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:o.PRODUCT});if(i.loading)return ComponentFactoryService.createElement({type:o.PRODUCT_LOADING});const r=i.sizes[i.selectedSizeId],s=document.createElement("div");s.classList.add("product-content-wrapper"),s.setAttribute("role","region"),s.setAttribute("aria-label",""+i.name);const c=document.createElement("div");if(c.classList.add("product-content"),c.setAttribute("role","region"),c.setAttribute("aria-label",""+i.name),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=i.name,this.titleElement=t,c.appendChild(t)}const d=ComponentFactoryService.createElement({type:o.PRODUCT_OPTIONS,productId:n});c.appendChild(d);const u=ComponentFactoryService.createElement({type:o.PRODUCT_DRAWER,productId:n});if(c.appendChild(u),s.appendChild(c),!this.config.layout.showImages||!(null===(t=i.images)||void 0===t?void 0:t.length))return s;s.classList.add("has-images");const h=ComponentFactoryService.createElement({type:o.PRODUCT_IMAGE_CAROUSEL,images:i.images,mainImage:r.image,productId:n});return s.prepend(h),h.setAttribute("aria-label","Product images"),s}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}class ProductListCardComponent extends BaseComponent{get hostClasses(){return["product-list-card",this.params.variant,this.params.fillCard?"fill":""]}getAvailabilityData(){var t,n,i;const o=this.params.product,r=this.getStoreValue("address.address"),s={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==r?void 0:r.state)||"",isPresale:![],isPresaleActive:![]},c=o.sizes[0];if(!c)return s;const d=c.variants[0];if(!d)return s;s.upc=c.upc;const u=c.attributes||{};s.isPresale=(null===(t=u.presale)||void 0===t?void 0:t.isActive)===!![],s.isPresaleActive=this.isPresaleActive(u);for(const h of this.params.fulfillments){const t=d.fulfillments.some(t=>t===h.id);if(t){const t="shipping"===h.type&&(null===(n=d.fulfillmentTypes)||void 0===n?void 0:n.shipping)||"onDemand"===h.type&&(null===(i=d.fulfillmentTypes)||void 0===i?void 0:i.onDemand);if(t&&d.stock>0){s.hasAvailability=!![],s.fulfillmentId=h.id,s.partNumber=d.partNumber;break}}}return s}isPresaleActive(t){const n=null==t?void 0:t.presale;if(!n)return![];if(!n.isActive)return![];if(n.canPurchaseOn){const t=new Date(n.canPurchaseOn),i=new Date;if(i.getTime()<t.getTime())return![]}return!![]}async handleAddToCart(t){if(!t.hasAvailability)return;const n=this.params.product.salsifyGrouping||this.params.product.id||"";t.isPresale&&t.isPresaleActive?await this.commands.productList.addPresaleToCart({upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:n}):await this.commands.productList.addToCart({upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:n})}template(){var t,n,i,o;const r=this.params.product,s=r.sizes[0],c=s?s.image:r.images[0],d=r.name,u=s?s.size:null,h=null!==(i=null===(n=null===(t=null==s?void 0:s.variants)||void 0===t?void 0:t[0])||void 0===n?void 0:n.price)&&void 0!==i?i:(null===(o=r.priceInfo)||void 0===o?void 0:o.average)||0,p=this.getAvailabilityData();return this.createVariantStandard({image:c,name:d,size:u,price:h,availability:p})}generateProductUrl(){var t;if(!this.params.productUrl)return null;const n=this.params.product,i=null===(t=n.sizes)||void 0===t?void 0:t[0],o=this.params.productUrl;if(o.includes("{upc}")){const t=(null==i?void 0:i.upc)||"";return t?o.replace("{upc}",t):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(o.includes("{grouping}")){const t=n.salsifyGrouping||"";return t?o.replace("{grouping}",t):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(t){const{image:n,name:i,size:o,price:r,availability:s}=t,c=[],d=this.generateProductUrl(),u=document.createElement("div");u.className="plc__image-content";const h=document.createElement("div");h.className="plc__image-wrapper";const p=document.createElement("img");if(p.className="plc__image",p.src=n,p.alt=i,p.loading="lazy",h.appendChild(p),u.appendChild(h),d){const t=document.createElement("a");t.href=d,t.className="plc__image-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(u),c.push(t)}else c.push(u);const f=document.createElement("div");f.className="plc__content";const v=document.createElement("h3");if(v.className="plc__title",v.textContent=i,d){const t=document.createElement("a");t.href=d,t.className="plc__title-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(v),f.appendChild(t)}else f.appendChild(v);const y=document.createElement("div");y.className="plc__size-price-wrapper";const b=document.createElement("div");b.className="plc__price",b.textContent=formatCentToDollarText(r),y.appendChild(b);const x=document.createElement("div");x.className="plc__size",x.textContent=o||"",y.appendChild(x),f.appendChild(y),c.push(f);const w=document.createElement("button");return w.type="button",w.className="plc__button",w.disabled=!s.hasAvailability,s.hasAvailability?w.textContent="Add to Cart":(w.textContent="Not Available In "+s.state.toUpperCase(),this.addHostClasses("not-available")),w.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleAddToCart(s)}),c.push(w),c}}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(t){const n=document.createElement("div");n.classList.add("slc__card");const i=document.createElement("div");i.className="slc__image-content";const o=document.createElement("div");o.className="slc__image-wrapper";const r=document.createElement("div");r.classList.add("wave","slc__image"),o.appendChild(r),i.appendChild(o);const s=document.createElement("div");s.className="slc__content";const c=document.createElement("div");c.className="slc__title-container";const d=document.createElement("div");d.classList.add("wave","slc__title","slc__title-line-1"),c.appendChild(d);const u=document.createElement("div");u.classList.add("wave","slc__title","slc__title-line-2"),c.appendChild(u),s.appendChild(c);const h=document.createElement("div");h.className="slc__size-price-wrapper";const p=document.createElement("div");p.classList.add("wave","slc__price"),h.appendChild(p);const f=document.createElement("div");f.classList.add("wave","slc__size"),h.appendChild(f),s.appendChild(h);const v=document.createElement("div");return v.classList.add("wave","slc__button"),n.appendChild(i),n.appendChild(s),n.appendChild(v),n}template(){const t=[],n=100/this.params.columns;this.container.style.setProperty("--card-width",n+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const i=this.params.rows*this.params.columns;for(let o=0;o<i;o++){const n=this.createSkeletonCard(o);t.push(n)}return t}}class ProductListFiltersComponent extends BaseComponent{get hostClasses(){return["product-list-filters-container"]}isSameDayDeliveryDisabled(){var t,n;return!(!(null===(t=this.params.currentFilters)||void 0===t?void 0:t.personalized)&&!(null===(n=this.params.currentFilters)||void 0===n?void 0:n.preOrder))}isPersonalizationDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}isPreOrderDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}template(){var t,n,i;const o=[],r=document.createElement("div");r.className="product-list-filters-header";const s=document.createElement("h3");if(s.className="product-list-filters-title",s.textContent="Filters",r.appendChild(s),o.push(r),this.params.enablePersonalized){const n=document.createElement("div");n.className="product-list-filters-personalized";const i=document.createElement("label");i.className="product-list-filters-personalized-label",i.setAttribute("for","personalized-switch"),i.textContent="Personalized Bottles",n.appendChild(i);const r=document.createElement("input");if(r.type="checkbox",r.id="personalized-switch",r.className="product-list-filters-personalized-switch",r.disabled=this.isPersonalizationDisabled(),r.checked=(null===(t=this.params.currentFilters)||void 0===t?void 0:t.personalized)||![],r.addEventListener("change",t=>{var n,i;const o=t.target;null===(i=(n=this.params).onPersonalizedChange)||void 0===i?void 0:i.call(n,o.checked)}),n.appendChild(r),this.isPersonalizationDisabled()){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",n.appendChild(t)}o.push(n)}if(this.params.enablePreOrder){const t=document.createElement("div");t.className="product-list-filters-pre-order";const i=document.createElement("label");i.className="product-list-filters-pre-order-label",i.setAttribute("for","pre-order-switch"),i.textContent="Pre-Order",t.appendChild(i);const r=document.createElement("input");if(r.type="checkbox",r.id="pre-order-switch",r.className="product-list-filters-pre-order-switch",r.disabled=this.isPreOrderDisabled(),r.checked=(null===(n=this.params.currentFilters)||void 0===n?void 0:n.preOrder)||![],r.addEventListener("change",t=>{var n,i;const o=t.target;null===(i=(n=this.params).onPreOrderChange)||void 0===i?void 0:i.call(n,o.checked)}),t.appendChild(r),this.isPreOrderDisabled()){const n=document.createElement("div");n.className="product-list-filters-warning",n.textContent="(Not Available With Same-Day Delivery)",t.appendChild(n)}o.push(t)}if(this.params.enableDeliveryOptions){const t=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],n=document.createElement("div");n.className="product-list-filters-delivery-options";const r=document.createElement("div");r.className="product-list-filters-delivery-options-header";const s=document.createElement("h3");s.className="product-list-filters-delivery-options-label",s.textContent="Delivery Options",r.appendChild(s),n.appendChild(r);const c=document.createElement("div");c.className="product-list-filters-delivery-options-list";for(const o of t){const t=document.createElement("div");t.className="product-list-filters-delivery-option";const n=document.createElement("input");n.type="radio",n.id="delivery-"+o.value,n.name="delivery-options",n.value=o.value,n.className="product-list-filters-delivery-radio";const r="onDemand"===o.value&&this.isSameDayDeliveryDisabled();n.disabled=r,n.checked=o.value===((null===(i=this.params.currentFilters)||void 0===i?void 0:i.deliveryOptions)||"all"),n.addEventListener("change",t=>{var n,i;const o=t.target;null===(i=(n=this.params).onDeliveryOptionsChange)||void 0===i?void 0:i.call(n,o.value)});const s=document.createElement("label");s.htmlFor="delivery-"+o.value,s.className="product-list-filters-delivery-radio-label "+(r?"disabled":""),s.textContent=o.label,t.appendChild(n),t.appendChild(s),c.appendChild(t)}n.appendChild(c),o.push(n)}return o}}var wt;(function(t){t.IDLE="idle",t.LOADING_INITIAL="loading_initial",t.LOADING_MORE="loading_more",t.ERROR="error"})(wt||(wt={}));class ProductListComponent extends BaseComponent{get hostClasses(){const t=["product-list"];return this.params.filters.length>0&&t.push("has-filters"),t}constructor(){super({watchOnlyStorePaths:["address"]}),this.products=[],this.retailers=[],this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.currentFilters={personalized:![],preOrder:![],deliveryOptions:"all"},this.cardsContainer=null,this.filtersContainer=null,this.sentinelElement=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels=new Map,this.loadingState=wt.IDLE,this.scrollObserver=null,this.initializationPromise=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise}disconnectedCallback(){super.disconnectedCallback(),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(wt.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(wt.IDLE)}catch(W){this.logger.error("Error initializing product list:",W),this.setLoadingState(wt.ERROR),this.showErrorState("Failed to load products")}}template(){const t=[];return this.params.filters.length>0&&t.push(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),t.push(this.cardsContainer),this.renderCurrentState(),t}setLoadingState(t){this.loadingState=t,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case wt.LOADING_INITIAL:this.renderLoadingState();break;case wt.ERROR:break;case wt.IDLE:case wt.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){var t;try{const n=this.buildApiParams(0),i=await this.commands.productList.getProductList(n);this.products=i.products||[],this.retailers=i.retailers||[],this.updatePagination(i.navigation),this.syncFiltersFromResponse((null===(t=i.navigation)||void 0===t?void 0:t.filters)||[])}catch(n){throw this.logger.error("Error loading initial products:",n),this.products=[],this.retailers=[],this.pagination.hasMorePages=![],n}}async loadMoreProducts(){if(this.loadingState!==wt.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(wt.LOADING_MORE);const t=this.pagination.currentPage+1,n=this.buildApiParams(t),i=await this.commands.productList.getProductList(n);i.products&&i.products.length>0?(this.products.push(...i.products),this.mergeRetailers(i.retailers||[]),this.updatePagination(i.navigation),this.appendNewProducts(i.products)):(this.pagination.hasMorePages=![],this.updatePagination(i.navigation)),this.setLoadingState(wt.IDLE)}catch(t){this.logger.error("Error loading more products:",t),this.setLoadingState(wt.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(t){const n=new Map(this.retailers.map(t=>[t.id,t]));for(const i of t)n.has(i.id)||(this.retailers.push(i),n.set(i.id,i))}updatePagination(t){var n,i,o,r;t&&(this.pagination={currentPage:null!==(n=t.currentPage)&&void 0!==n?n:0,totalPages:null!==(i=t.totalPages)&&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})}buildApiParams(t){return{page:t,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()}}buildFiltersFromState(){const t=[{key:"availability",values:"IN_STOCK"}];return this.currentFilters.personalized&&t.push({key:"engraving",values:"YES"}),this.currentFilters.preOrder&&t.push({key:"presale",values:"YES"}),"all"!==this.currentFilters.deliveryOptions&&t.push({key:"fulfillment",values:[this.currentFilters.deliveryOptions]}),t}syncFiltersFromResponse(t){if(t)for(const n of t)switch(n.key){case"engraving":this.currentFilters.personalized="YES"===n.values;break;case"presale":this.currentFilters.preOrder="YES"===n.values;break;case"fulfillment":Array.isArray(n.values)&&(n.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":n.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers=[],this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(wt.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(wt.IDLE)}catch(W){this.logger.error("Error handling filter change:",W),this.setLoadingState(wt.ERROR),this.showErrorState("Error updating filters")}}resetPagination(){this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]}}updateFiltersUI(){this.filtersContainer&&(this.updatePersonalizedSwitch(),this.updatePreOrderSwitch(),this.updateDeliveryOptions())}updatePersonalizedSwitch(){this.personalizedSwitch&&(this.personalizedSwitch.checked=this.currentFilters.personalized,this.personalizedSwitch.disabled=this.isPersonalizationDisabled())}updatePreOrderSwitch(){this.preOrderSwitch&&(this.preOrderSwitch.checked=this.currentFilters.preOrder,this.preOrderSwitch.disabled=this.isPreOrderDisabled())}updateDeliveryOptions(){0!==this.deliveryRadios.length&&this.deliveryRadios.forEach(t=>{const n="onDemand"===t.value&&this.isSameDayDeliveryDisabled();t.disabled=n,n&&"onDemand"===t.value||(t.checked=t.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(t,n)})}updateRadioLabel(t,n){const i=this.deliveryRadioLabels.get(t.id);i&&(i.className="product-list-filters-delivery-radio-label "+(n?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}createCardsContainer(){const t=document.createElement("div");t.className="product-list-cards__container";const n=100/this.params.columns;return t.style.setProperty("--card-width",n+"%"),t.style.setProperty("--columns",""+this.params.columns),t}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const t=ComponentFactoryService.createElement({type:o.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.params.columns,fillCard:this.params.fillCard,filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(t)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const t=this.createInfoElement("No products found");return this.cardsContainer.appendChild(t),void 0}for(const t of this.products){const n=this.createProductCard(t);n&&this.cardsContainer.appendChild(n)}}}appendNewProducts(t){if(this.cardsContainer&&0!==t.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const n of t){const t=this.createProductCard(n);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){var n;try{const i=null===(n=t.sizes)||void 0===n?void 0:n[0];if(!i)return this.logger.warn("Product "+t.id+" has no sizes"),null;const r=new Map(this.retailers.flatMap(t=>t.fulfillments.map(t=>[t.id,t]))),s=new Set(i.variants.flatMap(t=>t.fulfillments)),c=Array.from(s).map(t=>r.get(t)).filter(t=>Boolean(t));return ComponentFactoryService.createElement({type:o.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:t,fulfillments:c,productUrl:this.params.productUrl})}catch(i){return this.logger.error("Error creating product card for product "+t.id+":",i),null}}createFiltersContainer(){return this.filtersContainer=ComponentFactoryService.createElement({type:o.PRODUCT_LIST_FILTERS,enablePersonalized:this.params.filters.includes(u.PERSONALIZATION),enablePreOrder:this.params.filters.includes(u.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(u.DELIVERY_OPTIONS),currentFilters:this.currentFilters,onPersonalizedChange:async t=>{this.currentFilters.personalized=t,await this.onFilterChange()},onPreOrderChange:async t=>{this.currentFilters.preOrder=t,await this.onFilterChange()},onDeliveryOptionsChange:async t=>{this.currentFilters.deliveryOptions=t,"onDemand"===t&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),await this.onFilterChange()}}),this.storeFilterElementReferences(),this.filtersContainer}storeFilterElementReferences(){if(!this.filtersContainer)return;this.personalizedSwitch=this.filtersContainer.querySelector("#personalized-switch"),this.preOrderSwitch=this.filtersContainer.querySelector("#pre-order-switch");const t=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(t),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(t=>{var n;const i=null===(n=this.filtersContainer)||void 0===n?void 0:n.querySelector('label[for="'+t.id+'"]');i&&this.deliveryRadioLabels.set(t.id,i)})}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(t=>{const n=t[0];n.isIntersecting&&this.loadingState===wt.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 n;t.innerHTML="",n=this.loadingState===wt.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),t.appendChild(n)}showSentinelError(t){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const n=this.createErrorElement(t);this.sentinelElement.appendChild(n)}createLoadingElement(t){const n=document.createElement("div");n.className="product-list-sentinel-container";const i=document.createElement("div");i.className="product-list-sentinel-spinner";const o=document.createElement("div");return o.className="product-list-sentinel-text",o.textContent=t,n.appendChild(i),n.appendChild(o),n}createErrorElement(t){const n=document.createElement("div");n.className="product-list-sentinel-error-container";const i=document.createElement("div");i.className="product-list-sentinel-error-icon",i.innerHTML="⚠";const o=document.createElement("div");return o.className="product-list-sentinel-error-text",o.textContent=t,n.appendChild(i),n.appendChild(o),n}createInfoElement(t,n=![]){const i=document.createElement("div");if(i.className="product-list-sentinel-info-container",!n&&t.includes("Scroll")){const t=document.createElement("div");t.className="product-list-sentinel-icon",t.innerHTML="↓",i.appendChild(t)}else if(n){const t=document.createElement("div");t.className="product-list-sentinel-divider",i.appendChild(t)}const o=document.createElement("div");return o.className=n?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",o.textContent=t,i.appendChild(o),i}showErrorState(t){if(!this.cardsContainer)return;this.clearCardsContainer();const n=this.createErrorElement(t);this.cardsContainer.appendChild(n)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}async onStoreWatch(t){const n=t.find(t=>"address"===t.path);if(n&&void 0!==n.value&&this.cardsContainer)try{this.resetPagination(),this.products=[],this.retailers=[],this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(i){this.logger.error("Error reloading products after address change:",i),this.setLoadingState(wt.ERROR),this.cardsContainer&&this.showErrorState("Failed to reload products")}}doCleanup(){this.cleanupScrollObserver(),this.products=[],this.retailers=[],this.cardsContainer=null,this.filtersContainer=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels.clear(),this.initializationPromise=null}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,n;const i=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],o=null!==(n=this.params.showFirstEvent)&&void 0!==n?n:!![];if(i){const t=this.store.get(this.params.errorStorePath)||[],n=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return o?n.slice(0,1):n}const r=this.store.get(this.params.errorStorePath);return r?[{message:r,level:"error"}]:[]}createErrorElement(t){const n=document.createElement("div");n.classList.add("alert-container","alert-"+t.level);const i=document.createElement("span");i.classList.add("alert-icon"),i.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const o=document.createElement("span");return o.classList.add("alert-text"),o.textContent=t.message,n.appendChild(i),n.appendChild(o),n}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const n=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},n)}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 n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];n?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(o.CART)});const n=document.createElement("span");if(n.className="lce-cart-button-icon",n.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",[n,t]}return[n]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const n=this.getStoreValue("cart.totals.quantity")||0;t.textContent=n.toString(),t.style.visibility=n>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const n=this.getStoreValue("cart.totals.quantity")||0;t.textContent=n.toString(),t.style.visibility=n>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var n;const i=t.find(t=>"ui.drawer"===t.path);if(!i)return![];const o=i.value,r=o.isOpen,s=null===(n=o.contentConfig)||void 0===n?void 0:n.type,c=s!==this.currentContentType;return r&&!this.isOpen?(this.currentContentType=s,this.openWithContent(o),![]):r&&this.isOpen&&!c?![]:r&&this.isOpen&&c?(this.currentContentType=s,this.openWithContent(o),![]):!r&&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:n,data:i}=t||{};let o;o=this.isElementsEnabled()?ComponentFactoryService.createElement({type:n,...i}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({message:"Elements is not enabled.",componentType:n}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(o,n):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(o),this.updateDrawerContentTypeClass(n),this.open()),this.addHostAttribute("data-target",n.toString().toLowerCase())}catch(n){this.logger.error("Drawer content loading failed",n),this.commands.ui.closeDrawer()}}animateContentSwap(t,n){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const i=this.contentContainer.firstElementChild;i.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{i.classList.add("fading")}),setTimeout(()=>{i.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(n),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 n=["drawer"];this.isOpen&&n.push("open"),n.push(t.toString().toLowerCase()),this.drawerElement.className=n.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const n=this.themeProvider.getConfigs("configurations");return null!==(t=null==n?void 0:n.isElementsEnabled)&&void 0!==t?t:![]}catch(n){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",n),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["engraving-form"]}beforeConnected(){var t;if(this.engravingLines=this.params.lines,"product"===this.params.context){const n=this.store.get("products."+this.params.identifier);this.fulfillmentId=n.selectedFulfillmentId,this.partNumber=(null===(t=n.selectedFulfillment)||void 0===t?void 0:t.partNumber)||null}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,n;if("product"===this.params.context){const i=this.store.get("products."+this.params.identifier),o=i.sizes[i.selectedSizeId],r=o.shippingFulfillments[this.fulfillmentId],s=r.price,c=(null===(n=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.fee)||0;return s+c}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier),n=t.unitPrice,i=t.attributes.engraving.fee||0;return n+i}return 0}productInformationSection(){const t=[];let n="",i="";if("product"===this.params.context){const o=this.store.get("products."+this.params.identifier);o.mainImage?t.push(o.mainImage):t.push(...o.images||[]),n=o.name,i=o.sizes[o.selectedSizeId].size}if("cart"===this.params.context){const o=this.store.get("cart.items."+this.params.identifier);o.mainImage&&t.push(o.mainImage),n=o.name,i=o.size}const o=document.createElement("div");if(o.className="product-info-section",t.length>0){const i=document.createElement("div");i.className="product-image-container";const r=document.createElement("img");r.src=t[0],r.alt=n,r.loading="lazy",r.className="product-image",i.appendChild(r),o.appendChild(i)}const r=document.createElement("div");r.className="product-details-container";const s=document.createElement("div");s.className="product-header";const c=document.createElement("h4");c.className="product-title",c.textContent=n,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),s.appendChild(c),s.appendChild(this.productPriceSpan),r.appendChild(s);const d=document.createElement("p");d.className="product-size-text",d.textContent=i,r.appendChild(d);const u=document.createElement("p");return u.className="engraving-fees-disclaimer",u.textContent="Personalization fees included in total, varies by retailer.",r.appendChild(u),o.appendChild(r),o}addToCartButtonText(t){if("product"!==this.params.context)return"Save";const n=this.getConfigs("product"),i=n.layout.addToCartButtonText;return n.layout.addToCartButtonShowTotalPrice?i+" - "+formatCentToDollarText(t):i}retailersSection(){var t,n,i,o,r,s,c;const d=this.store.get("products."+this.params.identifier),u=d.sizes[d.selectedSizeId],h=Object.values(u.shippingFulfillments).filter(t=>t.isVariantEngravable&&t.canEngrave),p=document.createElement("div");p.className="fulfillment-section";const f=document.createElement("p");if(f.className="shipping-from-text",f.innerHTML="Shipping from: <b>"+(null===(t=d.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",p.appendChild(f),1===h.length)return p;const v=document.createElement("div");v.className="fulfillment-options-container",p.appendChild(v);const y=document.createElement("span");y.className="see-more-fulfillments",y.textContent="See More Delivery Options ("+h.length+")",y.setAttribute("role","button"),y.setAttribute("tabindex","0"),y.setAttribute("aria-label","See More Delivery Options ("+h.length+")"),y.setAttribute("aria-expanded","false");const I=()=>{const t=v.classList.contains("expanded");v.classList.toggle("expanded"),t?(y.textContent="See More Delivery Options ("+h.length+")",y.setAttribute("aria-label","See More Delivery Options ("+h.length+")"),y.setAttribute("aria-expanded","false")):(y.textContent="See Less Delivery Options",y.setAttribute("aria-label","See Less Delivery Options"),y.setAttribute("aria-expanded","true"))};y.addEventListener("click",I),y.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I())}),p.appendChild(y);for(const b of h){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",b.fulfillmentId),b.fulfillmentId===(null===(n=d.selectedFulfillment)||void 0===n?void 0:n.fulfillmentId)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+b.retailerName+", "+formatCentToDollarText(b.price+((null===(o=null===(i=d.sizes[d.selectedSizeId].attributes)||void 0===i?void 0:i.engraving)||void 0===o?void 0:o.fee)||0))+", "+b.expectation.engraving),t.setAttribute("aria-pressed",b.fulfillmentId===(null===(r=d.selectedFulfillment)||void 0===r?void 0:r.fulfillmentId)?"true":"false");const Q=()=>{this.fulfillmentId=b.fulfillmentId,this.partNumber=b.partNumber;const n=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(n),this.productPriceSpan.textContent=formatCentToDollarText(n);const i=v.querySelector(".fulfillment-option.selected");i&&(i.classList.remove("selected"),i.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),f.innerHTML="Shipping from: <b>"+b.retailerName+"</b>"};t.addEventListener("click",Q),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Q())});const u=b.price+((null===(c=null===(s=d.sizes[d.selectedSizeId].attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.fee)||0),h=document.createElement("div");h.className="option-row row-1",t.appendChild(h);const p=document.createElement("span");p.className="retailer-name",p.textContent=b.retailerName,h.appendChild(p);const y=document.createElement("span");y.className="fulfillment-price",y.textContent=formatCentToDollarText(u),h.appendChild(y),t.appendChild(h);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.expectation.engraving,x.appendChild(w),t.appendChild(x),v.appendChild(t)}return p}engravingLinesSection(){var t;const{lines:n,maxLines:i,location:o,maxCharsPerLine:r}=this.params,s=document.createElement("div");s.className="engraving-section";const c=document.createElement("p");if(c.className="engraving-title",c.textContent="Personalize Your Bottle",s.appendChild(c),o&&(null===(t=null==o?void 0:o.trim())||void 0===t?void 0:t.length)>0){const t=document.createElement("p");t.className="engraving-location-text",t.textContent="Your message will appear "+o.toLowerCase()+".",s.appendChild(t)}const d=Array.from({length:i},(t,i)=>{const o=i+1,s=document.createElement("div");s.className="engraving-input-wrapper",s.setAttribute("data-line-number",o.toString());const c=document.createElement("input");c.type="text",c.id="engraving-line-"+o,c.dataset.lineNumber=o.toString(),c.maxLength=r,c.value=n[i]||"",c.placeholder=o>1?"Line "+o+" (optional)":"Line "+o,c.className="engraving-input",c.autocomplete="off",c.setAttribute("aria-label",o>1?"Engraving line "+o+", optional, maximum "+r+" characters":"Engraving line "+o+", maximum "+r+" characters");const d=document.createElement("span");return d.className="engraving-char-count",d.textContent=c.value.length+"/"+r,d.setAttribute("aria-live","polite"),d.setAttribute("aria-atomic","true"),c.addEventListener("input",()=>{d.textContent=c.value.length+"/"+r,this.engravingLines[i]=c.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),s.appendChild(c),s.appendChild(d),s}),u=document.createElement("div");return u.className="engraving-inputs-container",u.append(...d),s.appendChild(u),s}actionButtonsSection(){const{identifier:t,context:n}=this.params,i=document.createElement("div");i.className="action-buttons-container";const r=document.createElement("button");r.type="button",r.className="cancel-action-button",r.textContent="Cancel",r.setAttribute("aria-label","Cancel personalization and close");const Y=async()=>{"product"===n&&await this.commands.product.closeProductDrawer(t),"cart"===n&&this.commands.ui.openDrawer(o.CART)};r.addEventListener("click",Y),r.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),Y())}),i.appendChild(r),this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.disabled=this.engravingLines.length<=0,this.addToCartButton.textContent=this.addToCartButtonText(this.calculateTotalPrice()),this.addToCartButton.setAttribute("aria-label","product"===n?"Add personalized item to cart":"Update personalization and return to cart");const m=async()=>{const i=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);if("product"===n&&this.fulfillmentId&&this.partNumber){const n=this.store.get("products."+t);await this.commands.product.addToCart(t,{upc:n.sizes[n.selectedSizeId].upc,fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:i,identifier:t}),await this.commands.product.closeProductDrawer(t)}"cart"===n&&(await this.commands.cart.updateItemEngraving(t,i),this.commands.ui.openDrawer(o.CART))};return this.addToCartButton.addEventListener("click",m),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),m())}),i.appendChild(this.addToCartButton),i}template(){const t=[],n=this.productInformationSection();if(t.push(n),"product"===this.params.context){const n=this.retailersSection();t.push(n)}const i=this.engravingLinesSection();t.push(i);const o=this.actionButtonsSection();t.push(o);const r=document.createElement("p");return r.className="engraving-disclaimer",r.innerHTML="Personalized orders require up to 10 business days to be processed and then shipped. Tracking information will be provided once processed. <b>Personalized bottle orders cannot be cancelled.</b>",t.push(r),t}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["engraving-view-container",t.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const t=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+t),i=(null==n?void 0:n.attributes.engraving.fee)||0,o=(null==n?void 0:n.quantity)||1;return{quantity:o,fee:i,total:i*o}}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+t),i=(null==n?void 0:n.attributes.engraving.fee)||0,o=(null==n?void 0:n.quantity)||1;return{quantity:o,fee:i,total:i*o}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+t);return(null==n?void 0:n.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+t);return(null==n?void 0:n.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,n,i,r,s,c,d,u,h,p,f,v,y,b,x,w,C,k,S,E;const _=this.params.identifier,T={identifier:_,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const o=this.getStoreValue("cart.items."+_);T.lines=(null===(n=null===(t=null==o?void 0:o.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.lines)||[],T.maxLines=(null===(r=null===(i=null==o?void 0:o.attributes)||void 0===i?void 0:i.engraving)||void 0===r?void 0:r.maxLines)||1,T.maxCharsPerLine=(null===(c=null===(s=null==o?void 0:o.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.maxCharsPerLine)||16,T.fee=(null===(u=null===(d=null==o?void 0:o.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.fee)||0,T.location=(null===(p=null===(h=null==o?void 0:o.attributes)||void 0===h?void 0:h.engraving)||void 0===p?void 0:p.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+_);T.lines=(null===(v=null===(f=null==t?void 0:t.attributes)||void 0===f?void 0:f.engraving)||void 0===v?void 0:v.lines)||[],T.maxLines=(null===(b=null===(y=null==t?void 0:t.attributes)||void 0===y?void 0:y.engraving)||void 0===b?void 0:b.maxLines)||1,T.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,T.fee=(null===(k=null===(C=null==t?void 0:t.attributes)||void 0===C?void 0:C.engraving)||void 0===k?void 0:k.fee)||0,T.location=(null===(E=null===(S=null==t?void 0:t.attributes)||void 0===S?void 0:S.engraving)||void 0===E?void 0:E.location)||""}this.commands.ui.openDrawer(o.ENGRAVING_FORM,T)}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(),n=this.engravingLines();if(0===n.length)return"";const i=document.createElement("div");i.className="engraving-header";const o=document.createElement("h3");o.textContent="Personalization";const r=document.createElement("span");if(r.className="engraving-fee",1===t.quantity&&(r.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){r.textContent=formatCentToDollarText(t.total,![]);const n=document.createElement("span");n.className="engraving-fee-each",n.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",r.appendChild(n)}i.appendChild(o),i.appendChild(r);const s=document.createElement("div");s.className="engraving-body";const c=document.createElement("div");c.className="engraving-lines";for(const h of n){const t=document.createElement("span");t.className="engraving-line",t.textContent=h,c.appendChild(t)}const d=document.createElement("div");d.className="engraving-actions";const u=document.createElement("button");u.type="button",u.classList.add("remove-button"),u.textContent="Remove",u.setAttribute("aria-label","Remove engraving");const g=async()=>{await this.handleRemove()};if(u.addEventListener("click",g),u.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await g())}),d.appendChild(u),"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())}),d.appendChild(t)}return s.appendChild(c),s.appendChild(d),[i,s]}}class BirthdateInputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input","birthdate",t.layout.inputFieldStyle]}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const t=this.params.value.split("-");3===t.length&&(this.yearInput.value=t[0],this.monthInput.value=t[1],this.dayInput.value=t[2])}}setupEventListeners(){this.monthInput.addEventListener("input",t=>{this.formatMonth(t),this.handleNavigation(t,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",t=>{this.formatDay(t),this.handleNavigation(t,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",t=>{this.formatYear(t),this.handleChange()});const t=[this.monthInput,this.dayInput,this.yearInput];for(const n of t)n.addEventListener("blur",()=>this.validateInput()),n.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(t){const n=t.target;let i=n.value.replace(/\D/g,"");if(i.length>2&&(i=i.substring(0,2)),1===i.length&&Number.parseInt(i,10)<10)i="0"+i;else if(2===i.length){const t=Number.parseInt(i,10);t>12?i="12":t<1&&"00"!==i&&(i="01")}n.value=i}formatDay(t){const n=t.target;let i=n.value.replace(/\D/g,"");if(i.length>2&&(i=i.substring(0,2)),1===i.length&&Number.parseInt(i,10)<10)i="0"+i;else if(2===i.length){const t=Number.parseInt(i,10);t>31?i="31":t<1&&"00"!==i&&(i="01")}n.value=i}formatYear(t){const n=t.target;let i=n.value.replace(/\D/g,"");i.length>4&&(i=i.substring(0,4)),n.value=i}handleNavigation(t,n){const i=t.target,o=i===this.yearInput?4:2;i.value.length===o&&n&&n.focus()}handleChange(){if(this.clearErrors(),this.scheduleValidation(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}isFieldsComplete(){const t=this.monthInput.value,n=this.dayInput.value,i=this.yearInput.value;return 2===t.length&&2===n.length&&4===i.length}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldsComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}getFormattedValue(){const t=this.monthInput.value.padStart(2,"0"),n=this.dayInput.value.padStart(2,"0"),i=this.yearInput.value;return t&&n&&i&&4===i.length?i+"-"+t+"-"+n:""}validateDate(t,n,i){if(!t||!n||!i||4!==i.length)return![];const o=Number.parseInt(t,10),r=Number.parseInt(n,10),s=Number.parseInt(i,10);if(o<1||o>12||r<1||r>31||s<1e3)return![];const c=new Date(s,o-1,r);return c.getFullYear()===s&&c.getMonth()===o-1&&c.getDate()===r}calculateAge(t){const n=new Date;let i=n.getFullYear()-t.getFullYear();const o=n.getMonth()-t.getMonth();return(o<0||0===o&&n.getDate()<t.getDate())&&i--,i}validateInput(){const t=this.monthInput.value,n=this.dayInput.value,i=this.yearInput.value,o=[],r=this.params.validation;if(!r)return this.showErrors([]),!![];const s=2===t.length&&2===n.length&&4===i.length,c=t||n||i;if(r.required&&!c)o.push("Please enter a complete date (MM/DD/YYYY)");else if(c&&!s)o.push("Please enter a complete date (MM/DD/YYYY)");else if(s)if(this.validateDate(t,n,i)){const s=Number.parseInt(t,10),c=Number.parseInt(n,10),d=Number.parseInt(i,10),u=new Date(d,s-1,c);if(void 0!==r.minYear&&d<r.minYear&&o.push("Year must be "+r.minYear+" or later"),void 0!==r.maxYear&&d>r.maxYear&&o.push("Year must be "+r.maxYear+" or earlier"),void 0!==r.minAge||void 0!==r.maxAge){const t=this.calculateAge(u);void 0!==r.minAge&&t<r.minAge&&o.push("Must be at least "+r.minAge+" years old"),void 0!==r.maxAge&&t>r.maxAge&&o.push("Must be no more than "+r.maxAge+" years old")}if(r.customValidator){const t=r.customValidator(this.getFormattedValue());t&&o.push(t)}}else o.push("Please enter a valid date");this.showErrors(o);const d=0===o.length;return this.params.onValidation&&this.params.onValidation(d,o),d}showErrors(t){this.errorContainer.innerHTML="";const n=[this.monthInput,this.dayInput,this.yearInput];if(t.length>0){this.errorContainer.classList.add("show");for(const t of n)t.classList.add("input-error");for(const n of t){const t=document.createElement("div");t.className="error-message",t.textContent=n,this.errorContainer.appendChild(t)}}else for(const i of n)i.classList.remove("input-error")}clearErrors(){const t=[this.monthInput,this.dayInput,this.yearInput],n=t.some(t=>t.classList.contains("input-error"));if(n){for(const n of t)n.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(t){if(t){const n=t.split("/");3===n.length&&(this.monthInput.value=n[0],this.dayInput.value=n[1],this.yearInput.value=n[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var t;const n=[];if(this.params.label){const i=document.createElement("label");i.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(i.textContent+="*"),i.setAttribute("for",this.params.name+"-month"),n.push(i)}const i=document.createElement("div");i.className="date-input-container";const o=document.createElement("input");o.type="text",o.placeholder="MM",o.name=this.params.name+"-month",o.id=this.params.name+"-month",o.maxLength=2,o.className="date-field month-field",o.setAttribute("data-field","month"),o.inputMode="numeric";const r=document.createElement("span");r.className="date-separator",r.textContent="/";const s=document.createElement("input");s.type="text",s.placeholder="DD",s.name=this.params.name+"-day",s.id=this.params.name+"-day",s.maxLength=2,s.className="date-field day-field",s.setAttribute("data-field","day"),s.inputMode="numeric";const c=document.createElement("span");c.className="date-separator",c.textContent="/";const d=document.createElement("input");d.type="text",d.placeholder="YYYY",d.name=this.params.name+"-year",d.id=this.params.name+"-year",d.maxLength=4,d.className="date-field year-field",d.setAttribute("data-field","year"),d.inputMode="numeric",this.params.disabled&&(o.disabled=!![],s.disabled=!![],d.disabled=!![]),this.params.className&&(i.className+=" "+this.params.className),i.appendChild(o),i.appendChild(r),i.appendChild(s),i.appendChild(c),i.appendChild(d);const u=document.createElement("div");return u.className="error-container",n.push(i),n.push(u),n}}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 n=t.target,i=n.selectionStart||0,o=n.value;i>0&&/\D/.test(o[i-1])&&setTimeout(()=>{const t=Math.max(0,i-2);n.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const n=t.target;let i=n.value.replace(/\D/g,"");i.length>10&&(i=i.substring(0,10)),i.length>=6?i="("+i.substring(0,3)+") "+i.substring(3,6)+"-"+i.substring(6):i.length>=3&&(i="("+i.substring(0,3)+") "+i.substring(3)),n.value=i}formatDate(t){const n=t.target;let i=n.value.replace(/\D/g,"");i.length>8&&(i=i.substring(0,8)),i.length>=5?i=i.substring(0,2)+"/"+i.substring(2,4)+"/"+i.substring(4):i.length>=3&&(i=i.substring(0,2)+"/"+i.substring(2)),n.value=i}validateEmail(t){const n=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return n.test(t)}validateTel(t){const n=/^\(\d{3}\) \d{3}-\d{4}$/;return n.test(t)}validateDate(t){const n=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!n.test(t))return![];const[i,o,r]=t.split("/").map(Number),s=new Date(r,i-1,o);return s.getFullYear()===r&&s.getMonth()===i-1&&s.getDate()===o}isFieldComplete(){var t,n,i;const o=this.inputElement.value.trim();if(!o)return![];switch(this.params.inputType){case"tel":return this.validateTel(o);case"date":return this.validateDate(o);case"email":return o.includes("@")&&(null===(t=o.split("@")[1])||void 0===t?void 0:t.includes("."));case"number":return!Number.isNaN(Number.parseFloat(o));default:return(null===(n=this.params.validation)||void 0===n?void 0:n.max)&&o.length>=this.params.validation.max||(null===(i=this.params.validation)||void 0===i?void 0:i.min)&&o.length>=this.params.validation.min?!![]:o.length>=3}}validateInput(){const t=this.inputElement.value,n=[],i=this.params.validation;if(!i)return this.showErrors([]),!![];if(i.required&&!t.trim()&&n.push("This field is required"),!i.required&&!t.trim())return this.showErrors([]),!![];if(t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||n.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||n.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(t)||n.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const o=Number.parseFloat(t);Number.isNaN(o)?t.trim()&&n.push("Please enter a valid number"):(void 0!==i.min&&o<i.min&&n.push("Value must be at least "+i.min),void 0!==i.max&&o>i.max&&n.push("Value must be no more than "+i.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==i.min&&t.length<i.min&&n.push("Must be at least "+i.min+" characters"),void 0!==i.max&&t.length>i.max&&n.push("Must be no more than "+i.max+" characters")),i.pattern){const o=new RegExp(i.pattern);o.test(t)||n.push("Invalid format")}if(i.customValidator){const o=i.customValidator(t);o&&n.push(o)}}this.showErrors(n);const o=0===n.length;return this.params.onValidation&&this.params.onValidation(o,n),o}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 n of t){const t=document.createElement("div");t.className="error-message",t.textContent=n,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===this.params.inputType&&this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const n=[];if(this.params.label){const i=document.createElement("label");i.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(i.textContent+="*"),i.setAttribute("for",this.params.name),n.push(i)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"===this.params.inputType&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("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",n.push(this.inputElement),n.push(this.errorContainer),n}}class LceElementComponent extends HTMLElement{constructor(){super(),this.F=![],this.j=null;const t=ClientConfigService.getInstance();this.U=this.attachShadow({mode:t.isProduction()?"closed":"open"})}initialize(t,n){if(this.F)return;if(!t||"string"!=typeof t)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(n&&n instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.U)throw new SDKError("LceElementComponent: Shadow DOM container is not available");n&&"function"==typeof n.rerender&&(this.j=t=>{n.rerender(t||"LceElementRerender")}),this.U.appendChild(n),this.applyBasicStyles();const i=ThemeProviderService.getInstance(),o=i.getStylesheet(t);this.applyThemeStyles(o),this.F=!![],this.U=null}rerender(t){this.j&&this.j(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 n=new CSSStyleSheet;n.replaceSync(t),this.U.adoptedStyleSheets=[n,...this.U.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(W){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.U.adoptedStyleSheets=[...this.U.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const n=document.createElement("style");n.textContent=t,this.U&&this.U.appendChild(n)}}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 n=document.createElement("span");n.className="pb-text",n.textContent="Powered by",t.appendChild(n);const i=document.createElement("span");i.className="pb-lc",i.textContent="LiquidCommerce",t.appendChild(i);const o=document.createElement("span");return o.className="pb-dot",o.textContent=".",t.appendChild(o),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const n=this.getDisclaimerConfig();return n.parts.forEach(n=>{"text"===n.type?t.appendChild(document.createTextNode(n.content)):"link"===n.type&&t.appendChild(this.createLink(n.href,n.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,n){const i=document.createElement("a");return i.href=t,i.target="_blank",i.rel="noopener noreferrer",i.className="pb-link",i.textContent=n,i.setAttribute("role","link"),i.setAttribute("aria-label","Read "+n),i}template(){const t=this.createPoweredBySection(),n=this.createDisclaimerSection();return[t,n]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const n=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!n||!this.applyButton||!this.currentActiveTicker)return;const i=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);i&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!i&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const n=this.store.get("cart.promoCode"),i=this.store.get("checkout.promoCode");return(null==n?void 0:n.code)===t||(null==i?void 0:i.code)===t}getActiveTickers(){var t;const n=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var i;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(i=null==n?void 0:n.address)||void 0===i?void 0:i.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const n=document.createElement("div");n.classList.add("promo-ticker__text-group");const i=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const o of i){const i=o.trim();if(!i)continue;const r=document.createElement("span");r.classList.add("promo-ticker__text-item"),r.textContent=i,n.appendChild(r);const s=document.createElement("span");s.classList.add("promo-ticker__separator"),s.textContent=t.separator,n.appendChild(s)}return n}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 n=document.createElement("div");n.classList.add("promo-ticker__content");const i=document.createElement("div");i.classList.add("promo-ticker__track");for(let r=0;r<5;r++)i.appendChild(this.generateTextContent(this.currentActiveTicker));n.appendChild(i);const o=document.createElement("button");return o.type="button",o.classList.add("promo-ticker__cta"),o.textContent="APPLY",o.setAttribute("aria-label","Apply promo code"),this.promoCodeApplied&&(o.disabled=!![],o.textContent="APPLIED"),o.addEventListener("click",()=>this.handlePromoClick()),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=o,[n,o]}}const Ct=LoggerFactory.get("ElementsClientHelper"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,n){if(!t||!n)return t;const i={...t},o=[];for(const r in n){const s=n[r],c=i[r];if(!(r in t)){o.push('Property "'+r+'" does not exist in target schema, skipping merge.');continue}const d=getType(s),u=getType(c);d===u?isObject(s)&&isObject(c)?i[r]=deepMergeConfigs(c,s):i[r]=s:o.push('Type mismatch for key "'+r+'": source is '+d+", target is "+u+". Skipping merge.")}return o.length>0&&Ct.warn("Merging configurations with warnings:",o),i}const kt=new Map([["global.layout.enablePersonalization",[o.PRODUCT,o.CART,o.CHECKOUT,o.ENGRAVING_FORM,o.ENGRAVING_VIEW,o.PRODUCT_INTERACTIONS,o.CART_ITEM,o.CHECKOUT_ITEM]],["global.layout.personalizationText",[o.PRODUCT,o.CART,o.CHECKOUT,o.ENGRAVING_FORM,o.ENGRAVING_VIEW,o.CART_ITEM]],["global.layout.personalizationCardStyle",[o.PRODUCT,o.CART,o.CHECKOUT,o.ENGRAVING_FORM,o.ENGRAVING_VIEW]],["global.layout.allowPromoCodes",[o.CART,o.CART_PROMO_CODE,o.CART_FOOTER,o.CHECKOUT_ORDER_SUMMARY,o.CHECKOUT_PC_GC]],["global.layout.inputFieldStyle",[o.CART,o.CHECKOUT,o.ADDRESS,o.INPUT,o.BIRTHDATE_INPUT,o.ADDRESS_INPUT,o.CHECKOUT_DELIVER_TO,o.CHECKOUT_BUYER,o.CHECKOUT_BILLING,o.CHECKOUT_PAYMENT,o.CART_PROMO_CODE]],["global.layout.showPoweredBy",[o.CART,o.CHECKOUT,o.CHECKOUT_COMPLETED,o.POWERED_BY,o.CART_FOOTER,o.CHECKOUT_ORDER_SUMMARY,o.CHECKOUT_PRESALE_EXPIRED]],["global.layout.poweredByMode",[o.POWERED_BY]],["product.layout.showImages",[o.PRODUCT,o.PRODUCT_IMAGE_CAROUSEL]],["product.layout.showTitle",[o.PRODUCT]],["product.layout.showDescription",[o.PRODUCT,o.PRODUCT_DESCRIPTION,o.PRODUCT_INTERACTIONS]],["product.layout.showQuantityCounter",[o.PRODUCT,o.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.showOffHours",[o.PRODUCT,o.PRODUCT_RETAILERS,o.PRODUCT_RETAILERS_CAROUSEL,o.PRODUCT_RETAILERS_POPUP,o.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.quantityCounterStyle",[o.PRODUCT,o.PRODUCT_ADD_TO_CART_SECTION]],["product.layout.fulfillmentDisplay",[o.PRODUCT,o.PRODUCT_IMAGE_CAROUSEL,o.PRODUCT_RETAILERS]],["product.layout.enableShippingFulfillment",[o.PRODUCT,o.PRODUCT_RETAILERS,o.PRODUCT_RETAILERS_CAROUSEL,o.PRODUCT_RETAILERS_POPUP,o.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.enableOnDemandFulfillment",[o.PRODUCT,o.PRODUCT_RETAILERS,o.PRODUCT_RETAILERS_CAROUSEL,o.PRODUCT_RETAILERS_POPUP,o.PRODUCT_RETAILERS_POPUP_LIST]],["product.layout.addToCartButtonText",[o.PRODUCT,o.PRODUCT_ADD_TO_CART_SECTION,o.ENGRAVING_FORM]],["product.layout.addToCartButtonShowTotalPrice",[o.PRODUCT,o.PRODUCT_ADD_TO_CART_SECTION,o.ENGRAVING_FORM]],["product.layout.buyNowButtonText",[o.PRODUCT,o.PRODUCT_OPTIONS]],["product.layout.preSaleButtonText",[o.PRODUCT,o.PRODUCT_ADD_TO_CART_SECTION]],["cart.layout.showQuantityCounter",[o.CART,o.CART_ITEM_QUANTITY_PRICE]],["cart.layout.quantityCounterStyle",[o.CART,o.CART_ITEM_QUANTITY_PRICE]],["cart.layout.drawerHeaderText",[o.CART,o.CART_HEADER]],["cart.layout.goToCheckoutButtonText",[o.CART,o.CART_FOOTER]],["checkout.layout.emailOptIn",[o.CHECKOUT,o.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.smsOptIn",[o.CHECKOUT,o.CHECKOUT_ORDER_SUMMARY]],["checkout.layout.allowGiftCards",[o.CHECKOUT,o.CHECKOUT_GIFT_CARDS,o.CHECKOUT_ORDER_SUMMARY,o.CHECKOUT_PC_GC]],["checkout.layout.legalMessage",[o.CHECKOUT,o.CHECKOUT_ORDER_SUMMARY,o.CHECKOUT_COMPLETED]],["checkout.layout.exitUrl",[o.CHECKOUT,o.CHECKOUT_COMPLETED]],["checkout.layout.thankYouButtonText",[o.CHECKOUT,o.CHECKOUT_COMPLETED]],["checkout.layout.drawerHeaderText",[o.CHECKOUT,o.CHECKOUT_HEADER]],["checkout.layout.placeOrderButtonText",[o.CHECKOUT,o.CHECKOUT_PLACE_ORDER_BUTTON]],["checkout.layout.checkoutCompleted",[o.CHECKOUT_COMPLETED]]]);function getComponentTypesForLayoutFields(t,n){const i=new Set;for(const o of Object.keys(n)){const n=kt.get(t+"."+o);if(n)for(const t of n)i.add(t)}return Array.from(i)}class ElementsBaseClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],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.authService=AuthService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Failed to prepare client",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",W.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),this.logger.info("🔐 Starting authentication...");const t=await this.authService.authenticate();if(!t)throw this.clientPrepared=![],new SDKError("Unable to authenticate with the provided API key.",!![]);this.logger.info("✅ Authentication completed"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authService),this.logger.info("✅ API client setup completed"),this.logger.info("⚙️ Loading configurations...");let n=await this.apiClient.getAllConfigs();this.logger.info("✅ Configurations loaded"),this.clientConfig.set("partnerCode",n.configurations.partnerCode),this.clientConfig.set("partnerName",n.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const i=await this.fingerPrintService.getId(n.configurations.partnerCode),o=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",i),this.clientConfig.set("isLocalStorageAvailable",o);const r=o?null:await this.apiClient.getPersistedStore(i);if(await this.store.initialize({userDeviceId:i,isLocalStorageAvailable:o,persistedStore:r}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),i=n.global.layout.showPoweredBy;n=deepMergeConfigs(n,t),n.global.layout.showPoweredBy=i}await this.themeProvider.initialize(n),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");if(!this.gtmInitialized)try{await this.googleTagManager.initialize({partnerName:t.partnerName,partnerGtmId:t.googleTagManagerId,partnerEnableGaTracking:t.enablePartnerGaTracking,liquidCommerceEnableGaTracking:t.enableLiquidCommerceGaTracking,liquidCommerceGtmId:t.liquidCommerceGoogleTagManagerId}),this.gtmInitialized=!![]}catch(n){this.logger.error("GTM initialization failed",n)}this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t||"object"!=typeof t)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof t,!![]);const{type:n,containerId:i,...r}=t;if(!i||"string"!=typeof i)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof i?'"'+i+'"':i),!![]);if(!n)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const s=i.replace("#",""),c=document.getElementById(s);if(!c)return console.warn("Container with ID '"+s+"' not found"),null;c.innerHTML="";const d={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...r},u=ComponentFactoryService.createElement(d);return safeReplaceChildren(c,u),t.type===o.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(s,t.type,u)}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 n=t.slice(0,20),i=[],r=[];for(const o of n){if(!o||"object"!=typeof o){this.logger.warn("Invalid product parameter: must be an object");continue}if(!o.containerId||"string"!=typeof o.containerId){this.logger.warn("Container ID is required and must be a string for product with ID '"+o.identifier+"'");continue}const t=o.containerId.replace("#","").trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+o.identifier+"'");continue}const n=document.getElementById(t);if(!n){this.logger.warn("Container with ID '"+t+"' not found for product '"+o.identifier+"'");continue}const r=i.every(n=>n.containerId!==t);if(!r){this.logger.warn("Duplicate container ID '"+t+"' found, skipping");continue}if(!o.identifier||"string"!=typeof o.identifier){this.logger.warn("Product identifier is required and must be a string for container ID '"+t+"'");continue}const s=i.every(t=>t.identifier!==o.identifier);s?i.push({containerId:t,identifier:o.identifier}):this.logger.warn("Duplicate product identifier '"+o.identifier+"' found, skipping")}for(const s of i){const t=ComponentFactoryService.createElement({type:o.PRODUCT,useShadowDom:!![],productId:s.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),n=document.getElementById(s.containerId);n?(n.innerHTML="",n.appendChild(t),r.push(this.createInjectedComponentWrapper(s.containerId,o.PRODUCT,t)),await this.commands.product.createProductInstance(s.identifier,!![])):this.logger.warn("Product ("+s.identifier+") container with ID '"+s.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(i.map(t=>t.identifier)),r}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,o.CHECKOUT),void 0;if(!t)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(t.rows&&("number"!=typeof t.rows||t.rows<1||t.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+t.rows,!![]);if(t.columns&&("number"!=typeof t.columns||t.columns<1||t.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+t.columns,!![]);if(t.cardVariant&&!Object.values(d).includes(t.cardVariant))throw new SDKError('Invalid card variant "'+t.cardVariant+'". Valid options: '+Object.values(d).join(", "),!![]);if(t.filters&&!Array.isArray(t.filters))throw new SDKError("Filters must be an array. Received: "+typeof t.filters,!![]);if(t.filters&&t.filters.length>0){const n=Object.values(u);for(const i of t.filters)if(!n.includes(i))throw new SDKError('Invalid filter "'+i+'". Valid options: '+n.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 n=document.getElementById(t.containerId.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list.',!![]);const i=ComponentFactoryService.createElement({type:o.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:t.cardVariant||d.STANDARD,fillCard:t.fillCard||![],rows:t.rows||4,columns:t.columns||4,filters:t.filters||[],productUrl:t.productUrl});safeReplaceChildren(n,i)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:o.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(t,n,i){const o={getType:()=>n,getElement:()=>document.getElementById(t),rerender:()=>{try{i&&"function"==typeof i.rerender?i.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+t+"' does not support rerender")}catch(n){this.logger.warn("Failed to rerender component in container '"+t+"'")}}};return this.injectedComponents.set(t,o),o}rerenderInjectedComponentsByType(t){for(const[n,i]of this.injectedComponents)i.getType()===t&&i.rerender()}isElementsEnabled(){var t;try{const n=this.themeProvider.getConfigs("configurations");return null!==(t=null==n?void 0:n.isElementsEnabled)&&void 0!==t?t:![]}catch(n){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",n),!![]}}injectDisabledElementsError(t,n){const i=document.getElementById(t.replace("#",""));if(!i)return this.logger.warn("Container with ID '"+t+"' not found for disabled elements error"),void 0;let o;o=this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({message:"Elements is not enabled.",componentType:n}),i.innerHTML="",safeReplaceChildren(i,o)}registerEssentialComponents(){ComponentFactoryService.registerComponent(o.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(o.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(o.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(o.CART,AddressInputComponent),ComponentFactoryService.registerComponent(o.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_FILTERS,ProductListFiltersComponent)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(o.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(o.INPUT,InputComponent),ComponentFactoryService.registerComponent(o.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(o.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(o.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(o.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(o.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(o.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(o.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(o.ALERT,AlertComponent),ComponentFactoryService.registerComponent(o.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(o.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(o.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(o.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(o.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(o.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(o.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(o.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(o.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(o.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(o.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(o.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(o.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(o.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(o.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(o.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST,ProductListComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_CARD,ProductListCardComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_FILTERS,ProductListFiltersComponent),ComponentFactoryService.registerComponent(o.PRODUCT_LIST_CARD_LOADING,ProductListCardLoadingComponent),ComponentFactoryService.registerComponent(o.CART,CartComponent),ComponentFactoryService.registerComponent(o.CART_RETAILER,CartRetailerComponent),ComponentFactoryService.registerComponent(o.CART_ITEM,CartItemComponent),ComponentFactoryService.registerComponent(o.CART_FOOTER,CartFooterComponent),ComponentFactoryService.registerComponent(o.CART_ITEM_QUANTITY_PRICE,CartItemQuantityPriceComponent),ComponentFactoryService.registerComponent(o.CART_RETAILER_SUBTOTAL,CartRetailerSubtotalComponent),ComponentFactoryService.registerComponent(o.CART_PROMO_CODE,CartPromoCodeComponent),ComponentFactoryService.registerComponent(o.CART_HEADER,CartHeaderComponent),ComponentFactoryService.registerComponent(o.CART_BODY,CartBodyComponent),ComponentFactoryService.registerComponent(o.CART_FULFILLMENT,CartFulfillmentComponent),ComponentFactoryService.registerComponent(o.CHECKOUT,CheckoutComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_INFORMATION,CheckoutInformationComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PAYMENT,CheckoutPaymentComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PAYMENT_SUMMARY,CheckoutPaymentSummaryComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_STRIPE_HANDLER,CheckoutStripeHandlerComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_STRIPE_FORM,CheckoutStripeFormComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_BILLING,CheckoutBillingComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_ORDER_SUMMARY,CheckoutOrderSummaryComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PROMO_CODE,CheckoutPromoCodeComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_GIFT_CARDS,CheckoutGiftCardsComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_AMOUNTS,CheckoutAmountsComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_ITEMS,CheckoutItemsComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_COMPLETED,CheckoutCompletedComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_DELIVER_TO,CheckoutDeliverToComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_DELIVER_TO_SUMMARY,CheckoutDeliverToSummaryComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_BUYER,CheckoutBuyer),ComponentFactoryService.registerComponent(o.CHECKOUT_BUYER_SUMMARY,CheckoutBuyerSummaryComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_TIPS,CheckoutTipsComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PC_GC,CheckoutPcGcComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_ITEM,CheckoutItemComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_ITEM_QUANTITY,CheckoutItemQuantityComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PLACE_ORDER_BUTTON,CheckoutPlaceOrderButtonComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_HEADER,CheckoutHeaderComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PRESALE_COUNTDOWN,CheckoutPresaleCountdownComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_PRESALE_EXPIRED,CheckoutPresaleExpiredComponent),ComponentFactoryService.registerComponent(o.CHECKOUT_SEND_AS_GIFT,CheckoutSendAsGiftComponent)}}class ElementsClient extends ElementsBaseClient{constructor(){super(...arguments),this.ui={cartButton:(t,n)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);this.ensureCartDrawerExists();const i=document.getElementById(t.replace("#",""));if(!i)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before adding the cart button.',!![]);const r=ComponentFactoryService.createElement({type:o.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:n});i.innerHTML="",safeReplaceChildren(i,r)},floatingCartButton:t=>{this.ensureCartDrawerExists();const n=ComponentFactoryService.createElement({type:o.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(n)},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 n=document.getElementById(t.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart subtotal.',!![]);n.innerHTML="",n.classList.add("lce-cart-subtotal");const Z=t=>{n.textContent=formatCentToDollarText(t)},i=this.store.get("cart.totals.subtotal")||0;Z(i),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.subtotal")||0;Z(t)})},cartItemsCount:(t,n)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);let i=!![];n&&"boolean"==typeof n.hideZero&&(i=n.hideZero);const o=document.getElementById(t.replace("#",""));if(!o)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart items count.',!![]);o.innerHTML="",o.classList.add("lce-cart-items-count");const Y=t=>{o.textContent=t.toString(),0===t?(i&&(o.style.visibility="hidden"),o.classList.add("no-items")):(i&&(o.style.visibility="visible"),o.classList.remove("no-items"))},r=this.store.get("cart.totals.quantity")||0;Y(r),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.quantity")||0;Y(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 n of t)this.injectDisabledElementsError(n.containerId,o.PRODUCT);return[]}return await this.processInjectProduct(t)}async injectAddressElement(t,n){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:o.ADDRESS,containerId:t,options:n}):(this.injectDisabledElementsError(t,o.ADDRESS),null)}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:o.CART,containerId:t}):(this.injectDisabledElementsError(t,o.CART),null)}async injectCheckoutElement(t){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:o.CHECKOUT,containerId:t}):(this.injectDisabledElementsError(t,o.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,i){try{SingletonManager.setContext({isBuilder:![]});const o=ClientConfigService.getInstance();o.initialize(t,{env:i.env,isBuilder:![],debugMode:i.debugMode,customTheme:i.customTheme,proxy:i.proxy,promoTicker:i.promoTicker,paymentMethodId:i.paymentMethodId});const r=o.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const s=await SingletonManager.getClient(r);if(!s.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const c={injectProductElement:s.injectProductElement.bind(s),injectAddressElement:s.injectAddressElement.bind(s),injectCartElement:s.injectCartElement.bind(s),injectCheckoutElement:s.injectCheckoutElement.bind(s),injectProductList:s.injectProductList.bind(s),ui:s.ui,actions:s.actions,getInjectedComponents:s.getInjectedComponents.bind(s)};window.elements=c;const d=PubSubService.getInstance();return d.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:o.get("version")}),c}catch(o){try{const t=LoggerFactory.get("ElementsClientInit");t.error("Elements Client Initialization failed",o)}catch(r){console.error("[LiquidCommerce Elements] Client initialization failed:",null==o?void 0:o.message)}try{const t=ClientConfigService.getInstance(),i=PubSubService.getInstance();i.publishAction(n.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==o?void 0:o.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(s){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}const St={CORE:{MAIN_SCRIPT:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode",PAYMENT_METHOD_ID:"data-pm-id"},PROMO_TICKER:{CODE:"data-promo-code",TEXT:"data-promo-text",SEPARATOR:"data-promo-separator",ACTIVE_FROM:"data-promo-active-from",ACTIVE_UNTIL:"data-promo-active-until",CODE_PARAM:"data-promo-code-param"},PRODUCT:{PRODUCT:"data-product",CONTAINER:"data-container",PARAM:"data-product-param",FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",LCE_PRODUCT:"data-lce-product"},PRODUCT_LIST:{LIST:"data-liquid-commerce-elements-products-list",SCRIPT:"data-liquid-commerce-elements-products",CARD:"data-card",CARD_FILL:"data-card-fill",ROWS:"data-rows",COLUMNS:"data-columns",FILTERS:"data-filters",PRODUCT_URL:"data-product-url"},CART:{BUTTON:"data-cart-button",BADGE_BUTTON:"data-cart-badge-button",MOBILE_BUTTON:"data-cart-mobile-button",MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",BUTTON_HIDDEN:"data-cart-button-hidden",TOGGLE_BUTTON:"data-lce-cart-toggle-button",ITEMS_COUNT:"data-lce-cart-items-count"}};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function generateElementId({prefix:t,index:n}){const i=Math.random().toString(36).substring(2,7),o=void 0!==t?t:"",r=void 0!==n?n:"",s=o&&r?"-":"";return""+o+s+r+i}function pairsFromMainScript(t){const n=[];try{const o=t.getAttributeNames().filter(t=>t.substring(0,12)===St.PRODUCT.PRODUCT);for(const r of o)try{const i=r.match(/^data-product(-(.+))?$/),o=(null==i?void 0:i[2])?"-"+i[2]:"",s=""+St.PRODUCT.CONTAINER+o;if(t.hasAttribute(s)){const i=t.getAttribute(s),o=t.getAttribute(r);i&&o&&n.push({containerId:i,identifier:o})}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",i)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",o)}return n}function pairsFromProductsScript(){const t=[];try{const i=document.querySelectorAll("script["+St.PRODUCT_LIST.SCRIPT+"]");for(const o of i)try{const n=JSON.parse(o.textContent||"[]");if(!Array.isArray(n))continue;for(const i of n)i.containerId&&i.identifier&&t.push({containerId:i.containerId,identifier:i.identifier})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",i)}return t}function pairsFromAttributedElements(){const t=[];try{const i=document.querySelectorAll("div["+St.PRODUCT.LCE_PRODUCT+"]");let o=0;for(const r of i)try{const n=generateElementId({prefix:"lce-p",index:o});r.setAttribute("id",n);const i=r.getAttribute(St.PRODUCT.LCE_PRODUCT);n&&i&&t.push({containerId:n,identifier:i}),o+=1}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",n)}}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",i)}return t}async function addProductToCartViaQueryParam(t,n){try{const o=n.getAttribute(St.PRODUCT.PARAM),s=n.getAttribute(St.PRODUCT.FULFILLMENT_TYPE_PARAM);if(!o)return;if(!startsWithLcePrefix(o))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product query parameter "'+o+'" because it does not start with "lce_" prefix.'),void 0;const c=new URLSearchParams(window.location.search),d=c.get(o);if(!d)return;let u=r.SHIPPING;if(s)if(startsWithLcePrefix(s)){const t=c.get(s);t!==r.ON_DEMAND&&t!==r.SHIPPING||(u=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+s+'" because it does not start with "lce_" prefix.');try{await t.actions.cart.addProduct([{identifier:d,fulfillmentType:u,quantity:1}],!![])}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",i)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",o)}}async function addPromoCodeToCartViaQueryParam(t,n){try{const o=n.getAttribute(St.PROMO_TICKER.CODE_PARAM);if(!o)return;if(!startsWithLcePrefix(o))return console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring promo code query parameter "'+o+'" because it does not start with "lce_" prefix.'),void 0;const r=new URLSearchParams(window.location.search),s=r.get(o);if(!s)return;try{await t.actions.cart.applyPromoCode(s)}catch(i){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",i)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",o)}}async function setupCartButtonWithPosition(t,n,i,o){var r,s,c;try{const d=i.includes("mobile"),u=d?"mobile":"desktop",h=!d,p=n.getAttribute(i),f=n.getAttribute(o);if(!n.hasAttribute(i)&&!n.hasAttribute(o))return;if(h){if(n.hasAttribute(i)&&!p)return t.ui.floatingCartButton(![]),void 0;if(n.hasAttribute(o)&&!f)return t.ui.floatingCartButton(!![]),void 0}const v=p||f,y=!!f;if(!v)return h&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(y)),void 0;const b=["above","below","replace","inside"],x=v.match(/^(\w+):(.+)$/),w=x&&b.includes(x[1])?x[1]:"inside";let C=x?x[2]:v;/^[#.]/.test(C)||/\s/.test(C)||(C="#"+C);const k=document.querySelector(C);if(!k)return h&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+C+'" not found. Using floating button.'),t.ui.floatingCartButton(y)),void 0;const S=document.createElement("div");switch(S.classList.add("lce-cart-"+u+"-button-container"),S.id=generateElementId({prefix:"lce-cart-"+u+"-btn"}),w){case"above":null===(r=k.parentNode)||void 0===r?void 0:r.insertBefore(S,k);break;case"below":null===(s=k.parentNode)||void 0===s?void 0:s.insertBefore(S,k.nextSibling);break;case"replace":null===(c=k.parentNode)||void 0===c?void 0:c.replaceChild(S,k);break;default:k.appendChild(S)}t.ui.cartButton(S.id,y)}catch(d){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",d)}}async function setupCartButtons(t,n){n.hasAttribute(St.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(t,n,St.CART.BUTTON,St.CART.BADGE_BUTTON),await setupCartButtonWithPosition(t,n,St.CART.MOBILE_BUTTON,St.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(t){try{const n=document.querySelector("div["+St.PRODUCT_LIST.LIST+"]");if(!n)return;const i="lce-products-list-container";n.className="lce-products-list-container",n.id=i;const o=n.getAttribute(St.PRODUCT_LIST.CARD)||"standard",r=n.hasAttribute(St.PRODUCT_LIST.CARD_FILL),s=Number.parseInt(n.getAttribute(St.PRODUCT_LIST.ROWS)||"3",10)||3,c=Number.parseInt(n.getAttribute(St.PRODUCT_LIST.COLUMNS)||"4",10)||4,d=n.getAttribute(St.PRODUCT_LIST.FILTERS),u=n.getAttribute(St.PRODUCT_LIST.PRODUCT_URL)||void 0;let h=[];d&&(h=d.split(",").map(t=>t.trim()).filter(t=>t.length>0)),await t.injectProductList({containerId:i,rows:s,columns:c,cardVariant:o,fillCard:r,filters:h,productUrl:u})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",n)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async t=>{const n=t.detail;if(!n.data.isReady)return;const i=window.elements,o=document.querySelectorAll("["+St.CART.TOGGLE_BUTTON+"]");if(o.length>0)for(const s of o)s.addEventListener("click",async t=>{t.stopPropagation(),t.preventDefault(),i.actions.cart.toggleCart()});const r=document.querySelectorAll("["+St.CART.ITEMS_COUNT+"]");if(r.length>0){let t=0;for(const n of r){const o=n.getAttribute(St.CART.ITEMS_COUNT),r=!(o&&"keep-zero"===o),s=Boolean(null==n?void 0:n.id);let c;s?c=n.id:(c=generateElementId({prefix:"lce-cart-items-count",index:t}),n.id=c),i.ui.cartItemsCount(c,{hideZero:r}),t+=1}}})}catch(W){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",W)}}async function ElementsAutoInitialize(){var n,i,o,r,c,d,u;try{const u=document.querySelector("script["+St.CORE.MAIN_SCRIPT+"]");if(!u)return;const h=u.getAttribute(St.CORE.TOKEN),p=u.getAttribute(St.CORE.ENV)||t.PRODUCTION,f=u.getAttribute(St.CORE.DEBUG_MODE),v=null!==(n=u.getAttribute(St.CORE.PAYMENT_METHOD_ID))&&void 0!==n?n:void 0;if(!h)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const y=u.getAttribute(St.PROMO_TICKER.CODE),b=u.getAttribute(St.PROMO_TICKER.TEXT),x=null!==(i=u.getAttribute(St.PROMO_TICKER.SEPARATOR))&&void 0!==i?i:"•",w=null!==(o=u.getAttribute(St.PROMO_TICKER.ACTIVE_FROM))&&void 0!==o?o:void 0,C=null!==(r=u.getAttribute(St.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==r?r:void 0,k=pairsFromMainScript(u),S=pairsFromProductsScript(),E=pairsFromAttributedElements(),_=[...k,...S,...E],T=y&&b&&w&&C?{promoCode:y,text:b.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:x,activeFrom:null===(c=new Date(w))||void 0===c?void 0:c.toISOString(),activeUntil:null===(d=new Date(C))||void 0===d?void 0:d.toISOString()}:void 0;let D=s.NONE;f&&p!==t.PRODUCTION&&(D=f),setupEventListeners();const P=await Elements(h,{env:p,debugMode:D,promoTicker:T?[T]:void 0,paymentMethodId:v});if(!P)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);setupCartButtons(P,u),0!==_.length&&P.injectProductElement(_).catch(t=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",t)}),initializeProductsList(P),addProductToCartViaQueryParam(P,u),addPromoCodeToCartViaQueryParam(P,u)}catch(h){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(u=null==h?void 0:h.message)&&void 0!==u?u:String(h))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(W){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",W)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(W){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",W)}},50)}catch(W){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",W)}}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 n of getComponentTypesForLayoutFields("global.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(n){throw this.logger.error("❌ Failed to update global theme configuration",n),new SDKError("Failed to update global configuration: "+n.message,!![])}}async updateProductComponent(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 n of getComponentTypesForLayoutFields("product.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(n){throw this.logger.error("❌ Failed to update product component theme",n),new SDKError("Failed to update product configuration: "+n.message,!![])}}updateCartComponent(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 n of getComponentTypesForLayoutFields("cart.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(n){throw this.logger.error("❌ Failed to update cart component theme",n),new SDKError("Failed to update cart configuration: "+n.message,!![])}}updateCheckoutComponent(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 n of getComponentTypesForLayoutFields("checkout.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(n){throw this.logger.error("❌ Failed to update checkout component theme",n),new SDKError("Failed to update checkout configuration: "+n.message,!![])}}updateAddressComponent(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(n){throw this.logger.error("❌ Failed to update address component theme",n),new SDKError("Failed to update address configuration: "+n.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,n){if(!t||"string"!=typeof t)throw new SDKError("Address element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:o.ADDRESS,containerId:t,options:n})}async injectCartElement(t){if(!t||"string"!=typeof t)throw new SDKError("Cart element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return await this.processInjectElement({type:o.CART,containerId:t})}async injectCheckoutElement(t,n){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const i=await this.processInjectElement({type:o.CHECKOUT,containerId:t});if(null==n?void 0:n.simulatePresale){const t=n.presaleExpiresInMinutes||15,i=new Date;i.setMinutes(i.getMinutes()+t),this.store.set("checkout.presale",{isLocked:!![],expiresAt:i.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+t+" minutes")}return i}}async function ElementsBuilder(t,i){try{SingletonManager.setContext({isBuilder:!![]});const o=ClientConfigService.getInstance();o.initialize(t,{env:i.env,isBuilder:!![],debugMode:i.debugMode,customTheme:i.customTheme,proxy:void 0,promoTicker:i.promoTicker,paymentMethodId:i.paymentMethodId});const r=o.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const s=await SingletonManager.getClient(r);if(!s.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const c={updateComponentGlobalConfigs:s.updateComponentGlobalConfigs.bind(s),updateProductComponent:s.updateProductComponent.bind(s),updateAddressComponent:s.updateAddressComponent.bind(s),updateCartComponent:s.updateCartComponent.bind(s),updateCheckoutComponent:s.updateCheckoutComponent.bind(s),injectElement:s.injectElement.bind(s),injectProductElement:s.injectProductElement.bind(s),injectAddressElement:s.injectAddressElement.bind(s),injectCartElement:s.injectCartElement.bind(s),injectCheckoutElement:s.injectCheckoutElement.bind(s),injectProductList:s.injectProductList.bind(s),actions:s.actions};window.elementsBuilder=c;const d=PubSubService.getInstance();return d.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:o.get("version")}),c}catch(o){try{const t=LoggerFactory.get("ElementsBuilderClientInit");t.error("Elements Builder Client Initialization failed",o)}catch(r){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==o?void 0:o.message)}try{const t=ClientConfigService.getInstance(),i=PubSubService.getInstance();i.publishAction(n.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==o?void 0:o.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(s){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const t=window.onerror;window.onerror=(n,i,o,r,s)=>isSDKError(s,i)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:n,source:i,lineno:o,colno:r,error:s}),!![]):t?t(n,i,o,r,s):![];const n=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;n&&n.call(window,t)};try{initializeDOMPolyfills()}catch(Et){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Et)}try{triggerElementsAutoInit()}catch(_t){console.error("[LiquidCommerce Elements] Auto-initialization failed:",_t)}}catch(Tt){console.error("[LiquidCommerce Elements] SDK initialization failed:",Tt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):(t="undefined"!=typeof globalThis?globalThis:t||self,n(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 n of t)"string"==typeof n?this.appendChild(document.createTextNode(n)):this.appendChild(n)})}function polyfillPrepend(){"undefined"!=typeof Element&&"prepend"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.prepend=function(...t){const n=document.createDocumentFragment();for(const o of t)"string"==typeof o?n.appendChild(document.createTextNode(o)):n.appendChild(o);this.insertBefore(n,this.firstChild)})}function polyfillRemove(){"undefined"!=typeof Element&&"remove"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.remove=function(){this.parentNode&&this.parentNode.removeChild(this)})}function polyfillReplaceWith(){"undefined"!=typeof Element&&"replaceWith"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.replaceWith=function(...t){const n=this.parentNode;if(!n)return;const o=document.createDocumentFragment();for(const s of t)"string"==typeof s?o.appendChild(document.createTextNode(s)):o.appendChild(s);n.replaceChild(o,this)})}function polyfillBefore(){"undefined"!=typeof Element&&"before"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.before=function(...t){const n=this.parentNode;if(!n)return;const o=document.createDocumentFragment();for(const s of t)"string"==typeof s?o.appendChild(document.createTextNode(s)):o.appendChild(s);n.insertBefore(o,this)})}function polyfillAfter(){"undefined"!=typeof Element&&"after"in Element.prototype||"undefined"!=typeof Element&&(Element.prototype.after=function(...t){const n=this.parentNode;if(!n)return;const o=document.createDocumentFragment();for(const s of t)"string"==typeof s?o.appendChild(document.createTextNode(s)):o.appendChild(s);n.insertBefore(o,this.nextSibling)})}function polyfillObjectFromEntries(){"undefined"!=typeof Object&&"fromEntries"in Object||"undefined"!=typeof Object&&(Object.fromEntries=t=>{const n={};for(const[o,s]of t)n[o]=s;return n})}function initializeDOMPolyfills(){try{polyfillReplaceChildren(),polyfillPrepend(),polyfillRemove(),polyfillReplaceWith(),polyfillBefore(),polyfillAfter(),polyfillObjectFromEntries()}catch(Z){console.warn("DOM polyfills initialization failed:",Z)}}function safeReplaceChildren(t,...n){try{if("replaceChildren"in t&&"function"==typeof t.replaceChildren)t.replaceChildren(...n);else{for(;t.firstChild;)t.removeChild(t.firstChild);for(const o of n)"string"==typeof o?t.appendChild(document.createTextNode(o)):t.appendChild(o)}}catch(o){console.error("replaceChildren operation failed:",o),1===n.length&&"string"==typeof n[0]&&(t.innerHTML=n[0])}}class SDKError extends Error{constructor(t,n=![]){super(t),this.name="SDKError",this.isSdk=!![],this.reThrow=n,Error.captureStackTrace&&Error.captureStackTrace(this,SDKError),Object.setPrototypeOf(this,SDKError.prototype)}}function isSDKError(t,n){if((null==t?void 0:t.isSdk)===!![])return t instanceof SDKError&&t.reThrow?![]:!![];if(!t||"object"!=typeof t)return n?isSDKSource(n):![];const o=String((null==t?void 0:t.message)||""),s=/liquidcommerce\s+elements/i.test(o),c=String((null==t?void 0:t.stack)||""),l=(null==t?void 0:t.source)||n||"",d=[/@[/\\](?: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/],h=[/(?:service|commands|component)\.(?:ts|js)/,/auto-initialize\.(?:ts|js)/,/elements-(?:base-|builder-)?client\.(?:ts|js)/],m=[/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],f=isSDKSource(l),g=d.some(t=>t.test(c)),v=u.some(t=>t.test(c)),y=h.some(t=>t.test(c)),b=m.some(t=>t.test(c));return s||f||g||v||y||b}function isSDKSource(t){if(!t||"string"!=typeof t)return![];const n=[/\/elements\.js$/i,/\/index\.esm\.js$/i,/@liquidcommerce\/elements-sdk/i,/node_modules[/\\]@liquidcommerce[/\\]elements-sdk/i,/@liquidcommerce[/\\]elements-sdk[/\\]/i,/\/elements-sdk[/\\]/i,/elements-sdk[/\\]src/i,/elements[-.]?[a-z0-9]*\.js$/i,/chunk.*elements/i,/elements.*chunk/i,/\?.*elements\.js/i,/#.*elements\.js/i];return n.some(n=>n.test(t))}const t={BETA:"beta",LOCAL:"local",DEVELOPMENT:"development",STAGING:"staging",PRODUCTION:"production"},n={CLIENT_READY:"client_ready",ADDRESS_UPDATED:"address_updated",ADDRESS_CLEARED:"address_cleared",ADDRESS_FAILED:"address_failed",PRODUCT_LOADED:"product_loaded",PRODUCT_QUANTITY_INCREASE:"product_quantity_increase",PRODUCT_QUANTITY_DECREASE:"product_quantity_decrease",PRODUCT_ADD_TO_CART:"product_add_to_cart",PRODUCT_SIZE_CHANGED:"product_size_changed",PRODUCT_FULFILLMENT_TYPE_CHANGED:"product_fulfillment_type_changed",PRODUCT_FULFILLMENT_CHANGED:"product_fulfillment_changed",CART_LOADED:"cart_loaded",CART_CLOSED:"cart_closed",CART_OPENED:"cart_opened",CART_UPDATED:"cart_updated",CART_FAILED:"cart_failed",CART_RESET:"cart_reset",CART_ITEM_ADDED:"cart_item_added",CART_ITEM_REMOVED:"cart_item_removed",CART_ITEM_QUANTITY_INCREASE:"cart_item_quantity_increase",CART_ITEM_QUANTITY_DECREASE:"cart_item_quantity_decrease",CART_ITEM_ENGRAVING_UPDATED:"cart_item_engraving_updated",CART_PROMO_CODE_APPLIED:"cart_promo_code_applied",CART_PROMO_CODE_REMOVED:"cart_promo_code_removed",CART_PROMO_CODE_FAILED:"cart_promo_code_failed",CART_PRODUCT_ADD_SUCCESS:"cart_product_add_success",CART_PRODUCT_ADD_FAILED:"cart_product_add_failed",CHECKOUT_LOADED:"checkout_loaded",CHECKOUT_OPENED:"checkout_opened",CHECKOUT_CLOSED:"checkout_closed",CHECKOUT_FAILED:"checkout_failed",CHECKOUT_IS_GIFT_TOGGLED:"checkout_is_gift_toggled",CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED:"checkout_billing_same_as_shipping_toggled",CHECKOUT_MARKETING_PREFERENCES_TOGGLED:"checkout_marketing_preferences_toggled",CHECKOUT_CUSTOMER_INFORMATION_UPDATED:"checkout_customer_information_updated",CHECKOUT_GIFT_INFORMATION_UPDATED:"checkout_gift_information_updated",CHECKOUT_BILLING_INFORMATION_UPDATED:"checkout_billing_information_updated",CHECKOUT_ITEM_REMOVED:"checkout_item_removed",CHECKOUT_ITEM_QUANTITY_INCREASE:"checkout_item_quantity_increase",CHECKOUT_ITEM_QUANTITY_DECREASE:"checkout_item_quantity_decrease",CHECKOUT_ITEM_ENGRAVING_UPDATED:"checkout_item_engraving_updated",CHECKOUT_TIP_UPDATED:"checkout_tip_updated",CHECKOUT_SUBMIT_STARTED:"checkout_submit_started",CHECKOUT_SUBMIT_COMPLETED:"checkout_submit_completed",CHECKOUT_SUBMIT_FAILED:"checkout_submit_failed",CHECKOUT_PROMO_CODE_APPLIED:"checkout_promo_code_applied",CHECKOUT_PROMO_CODE_REMOVED:"checkout_promo_code_removed",CHECKOUT_PROMO_CODE_FAILED:"checkout_promo_code_failed",CHECKOUT_GIFT_CARD_APPLIED:"checkout_gift_card_applied",CHECKOUT_GIFT_CARD_REMOVED:"checkout_gift_card_removed",CHECKOUT_GIFT_CARD_FAILED:"checkout_gift_card_failed",CHECKOUT_PRODUCT_ADD_SUCCESS:"checkout_product_add_success",CHECKOUT_PRODUCT_ADD_FAILED:"checkout_product_add_failed"},o={CUSTOMER:"customer",GIFT:"gift",BILLING:"billing"},s={DRAWER:"drawer",INPUT:"input",BIRTHDATE_INPUT:"birthdate-input",ENGRAVING_FORM:"engraving-form",ENGRAVING_VIEW:"engraving-view",BUTTONS_CART_OPEN:"buttons-cart-open",POWERED_BY:"powered-by",LCE_ELEMENT:"lce-element",PURCHASE_MIN_ALERT:"purchase-min-alert",ALERT:"alert",PROMO_CODE_TICKER:"promo-code-ticker",ADDRESS:"address",ADDRESS_INPUT:"address-input",ADDRESS_DISPLAY:"address-display",PRODUCT:"product",PRODUCT_IMAGE_CAROUSEL:"product-image-carousel",PRODUCT_OPTIONS:"product-options",PRODUCT_INTERACTIONS:"product-interactions",PRODUCT_DESCRIPTION:"product-description",PRODUCT_RETAILERS:"product-retailers",PRODUCT_RETAILERS_CAROUSEL:"product-retailers-carousel",PRODUCT_RETAILERS_POPUP:"product-retailers-popup",PRODUCT_RETAILERS_POPUP_LIST:"product-retailers-popup-list",PRODUCT_PRICE:"product-price",PRODUCT_ADD_TO_CART_SECTION:"product-add-to-cart-section",PRODUCT_DRAWER:"product-drawer",PRODUCT_LOADING:"product-loading",PRODUCT_LIST:"product-list",PRODUCT_LIST_CARD:"product-list-card",PRODUCT_LIST_FILTERS:"product-list-filters",PRODUCT_LIST_CARD_LOADING:"product-list-card-loading",CART:"cart",CART_RETAILER:"cart-retailer",CART_ITEM:"cart-item",CART_FOOTER:"cart-footer",CART_ITEM_QUANTITY_PRICE:"cart-item-quantity-price",CART_RETAILER_SUBTOTAL:"cart-retailer-subtotal",CART_PROMO_CODE:"cart-promo-code",CART_HEADER:"cart-header",CART_BODY:"cart-body",CART_FULFILLMENT:"cart-fulfillment",CHECKOUT:"checkout",CHECKOUT_INFORMATION:"checkout-information",CHECKOUT_STRIPE_HANDLER:"checkout-stripe-handler",CHECKOUT_STRIPE_FORM:"checkout-stripe-form",CHECKOUT_PAYMENT:"checkout-payment",CHECKOUT_PAYMENT_SUMMARY:"checkout-payment-summary",CHECKOUT_BILLING:"checkout-billing",CHECKOUT_ORDER_SUMMARY:"checkout-order-summary",CHECKOUT_PROMO_CODE:"checkout-promo-code",CHECKOUT_GIFT_CARDS:"checkout-gift-cards",CHECKOUT_AMOUNTS:"checkout-amounts",CHECKOUT_ITEMS:"checkout-items",CHECKOUT_COMPLETED:"checkout-completed",CHECKOUT_DELIVER_TO:"checkout-deliver-to",CHECKOUT_DELIVER_TO_SUMMARY:"checkout-deliver-to-summary",CHECKOUT_BUYER:"checkout-buyer",CHECKOUT_BUYER_SUMMARY:"checkout-buyer-summary",CHECKOUT_TIPS:"checkout-tips",CHECKOUT_PC_GC:"checkout-pc-gc",CHECKOUT_ITEM:"checkout-item",CHECKOUT_ITEM_QUANTITY:"checkout-item-quantity",CHECKOUT_PLACE_ORDER_BUTTON:"checkout-place-order-button",CHECKOUT_HEADER:"checkout-header",CHECKOUT_PRESALE_COUNTDOWN:"checkout-presale-countdown",CHECKOUT_PRESALE_EXPIRED:"checkout-presale-expired",CHECKOUT_SEND_AS_GIFT:"checkout-send-as-gift"},c={ON_DEMAND:"onDemand",SHIPPING:"shipping"},l={NONE:"none",CONSOLE:"console",PANEL:"panel"},d={[t.BETA]:"https://elements-services-beta-948630220003.us-central1.run.app",[t.LOCAL]:"http://127.0.0.1:8080",[t.DEVELOPMENT]:"https://dev-elements.liquidcommerce.us",[t.STAGING]:"https://staging-elements.liquidcommerce.us",[t.PRODUCTION]:"https://elements.liquidcommerce.us"},u={STANDARD:"standard"},h={PERSONALIZATION:"personalization",PRE_ORDER:"pre-order",DELIVERY_OPTIONS:"delivery-options"},m={DRAWER_WRAPPER:2147483640,DRAWER_CONTENT:5952,DRAWER_BACKDROP:5951,ADDRESS_SUGGESTIONS:5850,PRODUCT_DRAWER:5840,CART_LOADING:5750,LOADING_INDICATOR:5730,ERROR_MESSAGE:5650,CAROUSEL_CONTROLS:5580,PROGRESS_BAR:5560,CHECKOUT_HEADER:5920,INDEPENDENT_BUTTON:5910,CART_HEADER:5920,TOGGLE_SLIDER:5150,FORM_CONTROLS:5130,ADDRESS_ACTIONS:5050,SKELETON_WAVE:5040};class SingletonManager{static getInstances(){return"builder"===SingletonManager.currentContext?(SingletonManager.builderClientInstances||(SingletonManager.builderClientInstances=new Map),SingletonManager.builderClientInstances):(SingletonManager.regularClientInstances||(SingletonManager.regularClientInstances=new Map),SingletonManager.regularClientInstances)}constructor(){}static setContext({isBuilder:t}){SingletonManager.currentContext=t?"builder":"regular"}static setClientConstructor(t){SingletonManager.clientConstructor=t}static getClientConstructor(){return SingletonManager.clientConstructor}static getClassInstance(t,n){const o=SingletonManager.getInstances();o.has(t)||o.set(t,n());const s=o.get(t);if(!s)throw new SDKError("ElementsSdk: Instance for class "+t+" could not be created.");return s}static async getClient(t){const n=[t.apiKey,t.env,t.isBuilder,t.debugMode].join("_"),o="LiquidCommerceElementsClient_"+n,s=SingletonManager.getInstances();if(s.has(o))return s.get(o);if(!SingletonManager.clientConstructor)throw new SDKError("LiquidCommerce Elements: Client constructor is not set.");const c=new SingletonManager.clientConstructor(t);return await c.prepare(),s.set(o,c),c}}SingletonManager.clientConstructor=null,SingletonManager.regularClientInstances=null,SingletonManager.builderClientInstances=null,SingletonManager.currentContext="regular";const f="lce",g={identifier:"",id:"",brand:"",category:"",catPath:"",classification:"",type:"",subType:"",salsifyGrouping:"",name:"",description:"",htmlDescription:"",images:[],sizes:{},mainImage:null,region:"",country:"",material:"",abv:"",proof:"",age:"",color:"",flavor:"",variety:"",appellation:"",vintage:"",tastingNotes:"",productHasAvailability:![],fulfillmentHasAvailability:![],quantity:1,selectedFulfillmentType:c.SHIPPING,selectedSizeId:null,selectedFulfillmentId:null,selectedFulfillment:null,loading:![],updating:![],error:null,drawer:{isOpen:![],contentConfig:null},rerender:![]},v={id:null,loading:![],error:null,items:{},retailers:{},totals:{subtotal:0,total:0,shippingFee:0,platformFee:0,engravingFee:0,giftCardTotal:0,deliveryFee:0,discounts:0,quantity:0},promoCode:null,fulfillments:{},rerender:![],shouldReset:![],updatedAt:"",createdAt:"",events:[]},y={token:"",cartId:"",loading:![],updating:![],error:null,warning:[],presale:null,isGift:![],marketingPreferences:{canEmail:![],canSms:![]},customerForm:{data:{firstName:"",lastName:"",email:"",phone:"",birthDate:"",company:""},isEditing:!![],isValid:![],isSaving:![]},giftRecipientForm:{data:{firstName:"",lastName:"",email:"",phone:"",message:""},isEditing:!![],isValid:![],isSaving:![]},paymentForm:{paymentSession:null,paymentMethod:null,data:null,billingSameAsShipping:!![],isEditing:!![],isValid:![],isSaving:![]},shippingAddressTwo:"",promoCode:null,giftCards:[],orderNumber:null,items:{},amounts:{total:0,subtotal:0,shipping:0,discounts:0,delivery:0,platform:0,tax:0,engraving:0,giftCards:0,service:0,tip:0,details:{taxes:{bag:0,bottleDeposits:0,retailDelivery:0,products:0,delivery:0,shipping:0},discounts:{products:0,delivery:0,shipping:0,service:0,engraving:0}}},rerender:![],onDemandFulfillmentTipInfo:{},tipSelection:10,deliveryInstructions:"",giftCardError:null,promoCodeError:null,events:[]},b={drawer:{isOpen:![],contentConfig:null}},x={id:"",formattedAddress:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},w={products:{},cart:v,address:x,checkout:y,ui:b};class ClientConfigService{constructor(){this.config=null}static getInstance(){return SingletonManager.getClassInstance("ClientConfigService",()=>new ClientConfigService)}initialize(t,n={}){this.validateInputs(t,n),this.config=Object.freeze(this.buildConfiguration(t,n))}getConfigs(){return{...this.config}}get(t){return this.config[t]}set(t,n){if(!this.config)throw new SDKError("Configuration service is not ready. Please initialize first.");this.config=Object.freeze({...this.config,[t]:n})}isBeta(){return this.get("env")===t.BETA}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===l.CONSOLE||t===l.PANEL}isDebugPanelEnabled(){return this.get("debugMode")===l.PANEL}debuggingDisabled(){const t=this.get("debugMode");return t===l.NONE}hasCustomTheme(){return null!==this.get("customTheme")}isMobile(){return"mobile"===this.get("deviceType")}isLocalStorageAvailable(){return Boolean(this.get("isLocalStorageAvailable"))}getProxyConfig(){return this.get("proxy")}validateInputs(n,o){if(!(null==n?void 0:n.trim()))throw new SDKError("API key is required. Please provide a valid API key.",!![]);if(o.env&&!Object.values(t).includes(o.env)&&(console.warn('[LiquidCommerce Elements] Invalid environment "'+o.env+'". Using default environment.'),o.env=void 0),void 0!==o.isBuilder&&"boolean"!=typeof o.isBuilder&&(console.warn("[LiquidCommerce Elements] isBuilder must be a boolean. Using default value."),o.isBuilder=void 0),void 0===o.debugMode||Object.values(l).includes(o.debugMode)||(console.warn('[LiquidCommerce Elements] Invalid debugMode "'+o.debugMode+'". Must be one of: '+Object.values(l).join(", ")+". Using default value."),o.debugMode=void 0),o.promoTicker&&"object"!=typeof o.promoTicker&&(console.warn("[LiquidCommerce Elements] promoTicker must be an object. Skipping promoTicker configuration."),o.promoTicker=void 0),o.promoTicker)if(Array.isArray(o.promoTicker)){const t=o.promoTicker.filter((t,n)=>{if("string"!=typeof t.promoCode||!t.promoCode.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].promoCode is required and must be a non-empty string. Skipping this promo."),![];if(!Array.isArray(t.text)||0===t.text.length||!t.text.every(t=>"string"==typeof t&&t.trim()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].text is required and must be a non-empty array of strings. Skipping this promo."),![];if("string"!=typeof t.separator||!t.separator.trim())return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].separator is required and must be a non-empty string. Skipping this promo."),![];if(!t.activeFrom)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom is required. Skipping this promo."),![];const o="string"==typeof t.activeFrom?new Date(t.activeFrom):t.activeFrom;if(!(o instanceof Date)||Number.isNaN(o.getTime()))return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be a valid Date object or ISO date string. Skipping this promo."),![];if(!t.activeUntil)return console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil is required. Skipping this promo."),![];const s="string"==typeof t.activeUntil?new Date(t.activeUntil):t.activeUntil;return s instanceof Date&&!Number.isNaN(s.getTime())?o>=s?(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeFrom must be earlier than activeUntil. Skipping this promo."),![]):!![]:(console.warn("[LiquidCommerce Elements] promoTicker["+n+"].activeUntil must be a valid Date object or ISO date string. Skipping this promo."),![])});o.promoTicker=t.length>0?t:void 0}else console.warn("[LiquidCommerce Elements] promoTicker must be an array. Skipping promoTicker configuration."),o.promoTicker=void 0;o.proxy&&("object"!=typeof o.proxy?(console.warn("[LiquidCommerce Elements] proxy must be an object. Skipping proxy configuration."),o.proxy=void 0):o.proxy.baseUrl&&"string"==typeof o.proxy.baseUrl?o.proxy.headers&&"object"!=typeof o.proxy.headers&&(console.warn("[LiquidCommerce Elements] proxy.headers must be an object. Skipping proxy configuration."),o.proxy=void 0):(console.warn("[LiquidCommerce Elements] proxy.baseUrl is required and must be a string. Skipping proxy configuration."),o.proxy=void 0))}buildConfiguration(n,o){var s,c;const u=o.env||t.STAGING,h=d[u],m=u===t.PRODUCTION,g=null!==(s=o.isBuilder)&&void 0!==s?s:![],v=f+(m?"":"_"+u)+(g?"builder":"");return{apiKey:n.trim(),env:u,isBuilder:g,debugMode:null!==(c=o.debugMode)&&void 0!==c?c:l.NONE,baseUrl:h,partnerCode:void 0,partnerName:void 0,customTheme:o.customTheme||null,proxy:o.proxy||null,deviceType:this.detectDeviceType(),userDeviceId:void 0,localStorageKeyPrefix:v,isLocalStorageAvailable:void 0,version:void 0,clientPrepared:![],promoTicker:o.promoTicker||null,paymentMethodId:o.paymentMethodId}}detectDeviceType(){var t,n;if("undefined"==typeof navigator)return"desktop";const o=navigator.userAgent.toLowerCase(),s="ontouchstart"in window||navigator.maxTouchPoints>0,c=(null===(t=window.screen)||void 0===t?void 0:t.width)||0,l=(null===(n=window.screen)||void 0===n?void 0:n.height)||0,d=Math.max(c,l),u=[/ipad/,/android(?!.*mobile)/,/tablet/,/kindle/,/playbook/,/silk/,/gt-p\d{4}/,/nexus (7|9|10)/,/xoom/,/sch-i800/,/galaxy tab/,/surface/,/googletv/,/appletv/,/hbbtv/,/roku/,/smarttv/,/webtv/],h=[/android.*mobile/,/iphone/,/ipod/,/blackberry/,/opera mini/,/opera mobi/,/iemobile/,/mobile/,/webos/,/palm/,/symbian/,/nokia/,/fennec/,/maemo/,/windows phone/,/windows ce/,/htc/,/samsung.*mobile/,/lg.*mobile/,/motorola/,/sony.*mobile/,/watch/,/applewatch/,/wearos/,/tizen/];return u.some(t=>t.test(o))?"tablet":h.some(t=>t.test(o))||s&&d<768?"mobile":s&&d>=768&&d<=1200||s&&/macintosh/i.test(o)&&navigator.maxTouchPoints>1||/android/i.test(o)&&s&&d>=768||/windows nt/i.test(o)&&s&&d>=768?"tablet":(/automotive|carplay|android auto|car browser/i.test(o),"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 n=(new Date).toISOString().slice(11,23);return["%c["+n+"%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,n){if(this.sendToTelemetry("debug",t,void 0,n),!this.enableLogging)return;const[o,...s]=this.getPrefix("debug");void 0!==n?console.debug(o,...s,t,n):console.debug(o,...s,t)}info(t,n){if(!this.enableLogging)return;const[o,...s]=this.getPrefix("info");void 0!==n?console.info(o,...s,t,n):console.info(o,...s,t)}warn(t,n){if(this.sendToTelemetry("warn",t,void 0,n),!this.enableLogging)return;const[o,...s]=this.getPrefix("warn");void 0!==n?console.warn(o,...s,t,n):console.warn(o,...s,t)}error(t,n){const o=n instanceof Error,s=o?n:void 0,c=!o&&n?n:void 0;if(this.sendToTelemetry("error",t,s,c),!this.enableLogging)return;const[l,...d]=this.getPrefix("error");void 0!==n?console.error(l,...d,t,n):console.error(l,...d,t)}sendToTelemetry(t,n,o,s){if(this.telemetryService&&this.telemetryService.isEnabled())try{this.telemetryService.captureEvent(t,n,{context:this.context,error:o,data:s})}catch(c){}}}class LoggerFactory{static getInstances(){return LoggerFactory.instances||(LoggerFactory.instances=new Map),LoggerFactory.instances}static get(t){const n=this.getInstances();if(!n.has(t)){const o=LoggerService.getInstance(t);o.setEnableLogging(this.enableLoggingGlobally),this.telemetryService&&o.setTelemetryService(this.telemetryService),n.set(t,o)}return n.get(t)}static setEnableLogging(t){this.enableLoggingGlobally=t;const n=this.getInstances();for(const[,o]of n)o.setEnableLogging(t)}static setTelemetryService(t){this.telemetryService=t;const n=this.getInstances();for(const[,o]of n)o.setTelemetryService(t)}}function componentError({componentType:t,message:n}){const o=document.createElement("div");o.className=t;const s=o.attachShadow({mode:"closed"}),c=document.createElement("style");c.textContent='\n div {\n padding: 10px;\n background-color: #1d4ed81a;\n border-radius: 6px;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n text-align: center;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n }\n\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n color: #d63031;\n line-height: 1.4;\n margin-bottom: 5px;\n }\n\n p {\n margin: 0;\n font-size: 14px;\n font-weight: 400;\n color: #18181B;\n line-height: 1.5;\n max-width: 350px;\n }\n ';const l=document.createElement("div"),d=document.createElement("h3");d.textContent="Component </"+t+">";const u=document.createElement("p");return u.textContent=n,l.appendChild(c),l.appendChild(d),l.appendChild(u),s.appendChild(l),o}function productionComponentError({title:t,message:n,componentType:o}){const s=document.createElement("div");s.setAttribute("data-component-type",o);const c=s.attachShadow({mode:"closed"}),l=document.createElement("style");l.textContent="\n div {\n padding: 20px;\n background-color: #1d4ed81a;\n border-radius: 8px;\n box-sizing: border-box;\n font-family: Poppins, sans-serif;\n max-width: 512px;\n display: block;\n }\n\n h2 {\n color: #18181B;\n margin: 0 0 8px 0;\n font-size: 18px;\n font-style: normal;\n font-weight: 600;\n line-height: 18px;\n text-transform: lowercase;\n }\n\n h2::first-letter {\n text-transform: uppercase;\n }\n\n p {\n color: #18181B;\n font-size: 14px;\n font-style: italic;\n font-weight: 400;\n line-height: 20px;\n margin: 0;\n }\n ";const d=document.createElement("div"),u=document.createElement("h2");u.textContent=t;const h=document.createElement("p");return h.textContent=n,d.appendChild(l),d.appendChild(u),d.appendChild(h),c.appendChild(d),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(t,n){ComponentFactoryService.getComponentRegistry().set(t,n)}static createElement(t){try{const n=ComponentFactoryService.getComponentRegistry().get(t.type);if(!n)throw new SDKError("Component type ["+t.type+"] is not registered");const o=ComponentFactoryService.getComponentTagName(t.type);window.customElements.get(o)||window.customElements.define(o,n);const c=document.createElement(o);if(c.initialize){const{type:n,useShadowDom:s,wrapInLceElement:l,...d}=t,u={type:n,tagName:o,useShadowDom:s&&l!==!![]};c.initialize({data:d,config:u})}if(t.wrapInLceElement){const n=ComponentFactoryService.getComponentRegistry().get(s.LCE_ELEMENT),o=ComponentFactoryService.getComponentTagName(s.LCE_ELEMENT);window.customElements.get(o)||window.customElements.define(o,n);const l=document.createElement(o);return l.initialize(t.type,c),l}return c}catch(n){return ComponentFactoryService.logger.error("Failed to create component </"+t.type+">",n),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==n?void 0:n.message)||n})}}static componentError({componentType:t,message:n}){return ComponentFactoryService.logger.error("Component type "+t+" failed to load: "+n),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:n})}static getComponentTagName(t){const n={[s.DRAWER]:"drawer-lc",[s.INPUT]:"input-lc",[s.BIRTHDATE_INPUT]:"birthdate-input-lc",[s.ENGRAVING_FORM]:"engraving-form-lc",[s.ENGRAVING_VIEW]:"engraving-view-lc",[s.BUTTONS_CART_OPEN]:"buttons-cart-open-lc",[s.POWERED_BY]:"powered-by-lc",[s.LCE_ELEMENT]:"lce-element",[s.PURCHASE_MIN_ALERT]:"purchase-min-alert-lc",[s.ALERT]:"alert-lc",[s.PROMO_CODE_TICKER]:"promo-code-ticker-lc",[s.ADDRESS]:"address-lc",[s.ADDRESS_INPUT]:"address-input-lc",[s.ADDRESS_DISPLAY]:"address-display-lc",[s.PRODUCT]:"product-lc",[s.PRODUCT_OPTIONS]:"product-options-lc",[s.PRODUCT_IMAGE_CAROUSEL]:"product-image-carousel-lc",[s.PRODUCT_INTERACTIONS]:"product-interactions-lc",[s.PRODUCT_DESCRIPTION]:"product-description-lc",[s.PRODUCT_ADD_TO_CART_SECTION]:"product-add-to-cart-section-lc",[s.PRODUCT_RETAILERS]:"product-retailers-lc",[s.PRODUCT_RETAILERS_CAROUSEL]:"product-retailers-carousel-lc",[s.PRODUCT_RETAILERS_POPUP]:"product-retailers-popup-lc",[s.PRODUCT_RETAILERS_POPUP_LIST]:"product-retailers-popup-list-lc",[s.PRODUCT_PRICE]:"product-price-lc",[s.PRODUCT_DRAWER]:"product-drawer-lc",[s.PRODUCT_LOADING]:"product-loading-lc",[s.PRODUCT_LIST]:"product-list-lc",[s.PRODUCT_LIST_CARD]:"product-list-card-lc",[s.PRODUCT_LIST_FILTERS]:"product-list-filters-lc",[s.PRODUCT_LIST_CARD_LOADING]:"product-list-card-loading-lc",[s.CART]:"cart-lc",[s.CART_RETAILER]:"cart-retailer-lc",[s.CART_ITEM]:"cart-item-lc",[s.CART_FOOTER]:"cart-footer-lc",[s.CART_ITEM_QUANTITY_PRICE]:"cart-item-quantity-price-lc",[s.CART_RETAILER_SUBTOTAL]:"cart-retailer-subtotal-lc",[s.CART_PROMO_CODE]:"cart-promo-code-lc",[s.CART_HEADER]:"cart-header-lc",[s.CART_BODY]:"cart-body-lc",[s.CART_FULFILLMENT]:"cart-fulfillment-lc",[s.CHECKOUT]:"checkout-lc",[s.CHECKOUT_INFORMATION]:"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 n[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,n){this.publishSpecific("actions."+t,n)}publishForm(t,n){this.publishSpecific("forms."+t,n)}publishSpecific(t,n){const[o,s]=t.includes(".")?t.split(".",2):["actions",t];let c=s.split("_")[0];["product","cart","address","checkout"].includes(c)||(c="other");const l=Date.now(),d={eventId:"evt_"+l+"_"+Math.random().toString(36).slice(2,9),namespace:o,event:s,originalEvent:t,actionNamespace:"actions"===o?c:void 0,timestamp:l},u={data:n,metadata:d};this.dispatchNativeEvents(t,u)}dispatchNativeEvents(t,n){const[o]=t.split(".",2);try{"actions.client_ready"===t&&(this.clientReadyEvent=n);const s=new CustomEvent(this.eventPrefix+":"+t,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(s);const c=new CustomEvent(this.eventPrefix+":"+o,{detail:n,bubbles:!![],cancelable:!![]});window.dispatchEvent(c)}catch(s){this.logger.error("Error dispatching native events for "+t,s)}}setupClientReadyBuffering(){const t=window.addEventListener,n=this.eventPrefix+":actions.client_ready";window.addEventListener=(o,s,c)=>{if(o!==n)return t.call(window,o,s,c);if(!this.clientReadyEvent)return t.call(window,o,s,c);try{const t=new CustomEvent(n,{detail:this.clientReadyEvent,bubbles:!![],cancelable:!![]});"function"==typeof s?s(t):s&&"function"==typeof s.handleEvent&&s.handleEvent(t)}catch(l){this.logger.error("Error replaying CLIENT_READY event",l)}return t.call(window,o,s,c)}}}function centToDollar(t){return t/100}function formatCentToDollarText(t,n=!![]){const o=Math.floor(t/100),s=t%100;let c="$"+o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",");return(n||s>0)&&(c+=".",c+=s<10?"0"+s:s.toString()),c}function htmlStringToElement(t){const n=document.createElement("template");return n.innerHTML=t.trim(),n.content.firstElementChild}function format24TimeTo12$1(t){const n=t.match(/^(\d{1,2}):(\d{2})$/);if(!n)throw new SDKError("Invalid time format: "+t);const o=Number.parseInt(n[1],10),s=Number.parseInt(n[2],10);if(o<0||o>23||s<0||s>59)throw new SDKError("Invalid time values: "+t);const c=o>=12?"PM":"AM",l=o%12||12;return l+":"+s.toString().padStart(2,"0")+" "+c}function formatISODateToMMDDYYYY(t){if(!t)return"";try{const n=new Date(t);if(Number.isNaN(n.getTime()))return"";const o=(n.getMonth()+1).toString().padStart(2,"0"),s=n.getDate().toString().padStart(2,"0"),c=n.getFullYear().toString();return o+"/"+s+"/"+c}catch(n){return""}}function buildFormattedAddressString(t){const n=[],o=[];t.one&&t.one.trim()&&o.push(t.one.trim()),t.two&&t.two.trim()&&o.push(t.two.trim()),o.length>0&&n.push(o.join(" ")),t.city&&t.city.trim()&&n.push(t.city.trim());const s=[];return t.state&&t.state.trim()&&s.push(t.state.trim()),t.zip&&t.zip.trim()&&s.push(t.zip.trim()),s.length>0&&n.push(s.join(" ")),t.country&&t.country.trim()&&n.push(t.country.trim()),n.join(", ")}function capitalizeFirstLetter(t){return t?t.toLowerCase().split(" ").map(t=>t.charAt(0).toUpperCase()+t.substring(1)).join(" "):t}function splitCategoryPath(t){const n=(null==t?void 0:t.split(" > ").map(t=>capitalizeFirstLetter(t.trim())))||[];return{category:n[0]||"",category2:n[1]||"",category3:n[2]||""}}class ApiClientService{constructor(){this.client=null,this.logger=LoggerFactory.get("ApiClient")}static getInstance(){return SingletonManager.getClassInstance("ApiClientService",()=>new ApiClientService)}async setClient(t){this.client=t}async getAllConfigs(){try{this.ensureClientInitialized();const t=await this.client.get("/configs");if(!this.validResponseData(t))throw this.logger.error("Invalid response data",t),new SDKError("Failed to fetch all configs: Invalid response data");return t.data}catch(t){throw this.logger.error("Error fetching configs",t),t}}async setPersistedStore(t,n){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to set persisted store"),void 0;if(!n||0===Object.keys(n).length)return this.logger.error("No data provided to set persisted store"),void 0;const o=await this.client.post("/configs/store/"+t,{body:n});200!==o.statusCode&&this.logger.error("Failed to set persisted store",o)}catch(o){this.logger.error("Error setting persisted store",o)}}async getPersistedStore(t){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to get persisted store"),null;const n=await this.client.get("/configs/store/"+t);return 200!==n.statusCode?(this.logger.error("Failed to fetch persisted store",n),null):n.data}catch(n){return this.logger.error("Error fetching persisted store",n),null}}async deletePersistedStore(t){try{if(this.ensureClientInitialized(),!t)return this.logger.error("User device ID is required to delete persisted store"),void 0;const n=await this.client.delete("/configs/store/"+t);200!==n.statusCode&&this.logger.error("Failed to delete persisted store",n)}catch(n){this.logger.error("Error deleting persisted store",n)}}async getProductsData(t,n){try{if(this.ensureClientInitialized(),0===t.length)return this.logger.error("No product identifiers provided"),null;const o={upcs:t,ids:t,grouping:t,shouldShowOffHours:!![],isLegacy:!![],loc:n},s=await this.client.post("/cloud/catalog/availability",{body:o});return 200!==s.statusCode?(this.logger.error("Failed to fetch product data",s),null):{products:s.products,retailers:s.retailers}}catch(o){return this.logger.error("Error fetching product data",o),null}}async getCartData(t){try{this.ensureClientInitialized();const n=await this.client.get("/cloud/cart"+(t?"?id="+t:""));if(200!==n.statusCode)throw this.logger.error("Failed to fetch cart data",n),new SDKError("Failed to fetch cart data: "+n.message);return n.cart}catch(n){throw this.logger.error("Error fetching cart data",n),n}}async updateCart(t){try{this.ensureClientInitialized();const n=await this.client.put("/cloud/cart",{body:t});if(200!==n.statusCode)throw this.logger.error("Failed to update cart",n),new SDKError("Failed to update cart: "+n.message);return n.cart}catch(n){throw this.logger.error("Error updating cart",n),n}}async getAddressSuggestions(t){try{if(this.ensureClientInitialized(),!t||0===t.trim().length)return this.logger.error("Query is required to fetch address suggestions"),[];const n=await this.client.get("/cloud/address/autocomplete?input="+t);return 200!==n.statusCode?(this.logger.error("Failed to fetch address suggestions",n),[]):n.data}catch(n){return this.logger.error("Error fetching address suggestions",n),[]}}async getAddressDetails(t){try{if(this.ensureClientInitialized(),!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 n=await this.client.get("/cloud/address/details/"+t);if(200!==n.statusCode)throw this.logger.error("Failed to fetch address details",n),new SDKError("Failed to fetch address details: "+n.message);return n.data}catch(n){throw this.logger.error("Error fetching address details",n),n}}async prepareCheckout(t){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/checkout/prepare",{body:t});if(200!==n.statusCode)throw this.logger.error("Failed to fetch prepare checkout data",n),new SDKError("Failed to fetch prepare checkout data: "+n.message);return n.checkout}catch(o){throw this.logger.error("Error fetching prepare checkout data:",null!==(n=null==o?void 0:o.message)&&void 0!==n?n:o),o}}async getPaymentSession(t){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/payment/session",{body:t});if(201!==n.statusCode)throw this.logger.error("Failed to get payment session",n),new SDKError("Failed to get payment session: "+n.message);return n.data}catch(o){throw this.logger.error("Error fetching payment session:",null!==(n=null==o?void 0:o.message)&&void 0!==n?n:o),o}}async confirmPaymentSession(t,n){try{this.ensureClientInitialized();const o=await this.client.post("/cloud/payment/confirm",{body:{confirmationTokenId:t,setupIntentId:n}});if(200!==o.statusCode)throw this.logger.error("Failed to confirm payment session",o),new SDKError("Failed to confirm payment session: "+o.message);return o.data}catch(o){throw this.logger.error("Error confirming payment session",o),o}}async checkoutComplete(t){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/checkout/complete",{body:t});if(200!==n.statusCode)throw this.logger.error("Failed to complete checkout",n),new SDKError("Failed to complete checkout: "+n.message);return n.order}catch(o){if(this.logger.error("Error completing checkout:",null!==(n=null==o?void 0:o.message)&&void 0!==n?n:o),null==o?void 0:o.error)throw new SDKError(o.error);throw o}}async catalogSearch(t){var n;try{this.ensureClientInitialized();const n=await this.client.post("/cloud/catalog/search",{body:t});if(200!==n.statusCode)throw this.logger.error("Failed to fetch catalog search data",n),new SDKError("Failed to fetch catalog search data: "+n.message);return{products:n.products,retailers:n.retailers,navigation:n.navigation}}catch(o){return this.logger.error("Error fetching catalog search data:",null!==(n=null==o?void 0:o.message)&&void 0!==n?n:o),{products:[],retailers:[],navigation:void 0}}}validResponseData(t){return t.data&&"object"==typeof t.data&&Object.keys(t.data).length>0}ensureClientInitialized(){if(!this.client)throw new SDKError("API client is not initialized")}}function fetchAdapter(t){return async(n,o)=>{var s;const c=await t(n,o);let l;if("function"==typeof(null===(s=c.headers)||void 0===s?void 0:s.entries))l=Object.fromEntries(c.headers.entries());else{l={};for(const[t,n]of c.headers)l[t]=n}return{ok:c.ok,status:c.status,statusText:c.statusText,headers:l,json:()=>c.json(),text:()=>c.text()}}}const xhrFetch=(t,n)=>new Promise((o,s)=>{const c=new XMLHttpRequest;c.open(n.method||"GET",t);for(const[t,l]of Object.entries(n.headers))c.setRequestHeader(t,l);c.onload=()=>{o({ok:c.status>=200&&c.status<300,status:c.status,statusText:c.statusText,headers:c.getAllResponseHeaders().split("\r\n").reduce((t,n)=>{const[o,s]=n.split(": ");return o&&s&&(t[o]=s),t},{}),json:()=>Promise.resolve(JSON.parse(c.responseText)),text:()=>Promise.resolve(c.responseText)})},c.onerror=()=>{s(new TypeError("Network request failed"))},c.send(n.body)});function getFetchImplementation(){return"undefined"!=typeof fetch?fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?fetchAdapter(global.fetch):window.fetch?fetchAdapter(window.fetch):xhrFetch}class AuthService{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=![],this.apiKey=t.apiKey,this.baseUrl=t.baseUrl,this.env=t.env,this.httpClient=getFetchImplementation(),this.logger=LoggerFactory.get("Auth"),this.clientConfig=ClientConfigService.getInstance()}static getInstance(t){return SingletonManager.getClassInstance("AuthService",()=>new AuthService(t))}async authenticate(){var t,n;if(this.isAuthenticating)return await new Promise(t=>{const Y=()=>{this.isAuthenticating?setTimeout(Y,100):t(void 0)};Y()}),!!this.accessToken;this.isAuthenticating=!![];try{const o=await this.request("/auth",{method:"GET"},0,!![]),s=3e5;return this.accessToken=null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.token,this.tokenExpiration=(null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.exp)-s,!![]}catch(o){return this.logger.error("Authentication failed",o),![]}finally{this.isAuthenticating=![]}}isTokenExpired(){return this.tokenExpiration?Date.now()>=this.tokenExpiration:!![]}async request(t,n,o=0,s=![]){s||this.accessToken&&!this.isTokenExpired()||await this.authenticate();const c=this.buildUrl(t),l={"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(),...this.getProxyHeaders(),...n.headers};s?l["X-Liquid-Api-Key"]=this.apiKey:l.Authorization="Bearer "+this.accessToken,this.clientConfig.isBuilder()&&(l["X-Liquid-Api-Builder"]=!![]);const d={method:n.method,headers:l,body:n.body?JSON.stringify(n.body):void 0},u=await this.httpClient(c,d);if(u.ok)try{return await u.json()}catch(m){return this.logger.error("Failed to parse successful response data",m),{message:await u.text().catch(()=>"Success")}}let h;try{h=await u.json()}catch(f){const t=await u.text().catch(()=>"HTTP error status: "+u.status);h={message:t||"Unknown error"},this.logger.error("Failed to parse error response data",f)}if(!s){const c=2,l=(null==h?void 0:h.statusCode)>=5e3&&(null==h?void 0:h.statusCode)<=5010;if(l&&o<c)return this.logger.warn("Authorization error detected (status: "+u.status+", code: "+(null==h?void 0:h.statusCode)+"). Retry attempt "+(o+1)+"/"+c+" in 3 seconds..."),this.accessToken=null,this.tokenExpiration=null,await new Promise(t=>setTimeout(t,3e3)),this.request(t,n,o+1,s)}throw{...h,status:u.status,message:(null==h?void 0:h.message)||"Request failed"}}buildUrl(t){const n=this.clientConfig.getProxyConfig();return new URL("api"+t,n?n.baseUrl:this.baseUrl).toString()}getProxyHeaders(){const t=this.clientConfig.getProxyConfig();return t?{"X-Liquid-Proxy":"true","X-Liquid-Proxy-Target":this.baseUrl,...t.headers}:{}}async get(t,n){return this.request(t,{method:"GET",headers:null==n?void 0:n.headers})}async post(t,n){return this.request(t,{method:"POST",body:null==n?void 0:n.body,headers:null==n?void 0:n.headers})}async put(t,n){return this.request(t,{method:"PUT",body:null==n?void 0:n.body,headers:null==n?void 0:n.headers})}async delete(t,n){return this.request(t,{method:"DELETE",headers:null==n?void 0:n.headers})}}const E="@liquidcommerce/elements-sdk",_="LiquidCommerce Elements SDK",T="UNLICENSED",D="LiquidCommerce Team",P="2.5.6-beta.18",F="https://docs.liquidcommerce.co/elements-sdk",A={type:"git",url:"git+https://github.com/liquidcommerce/elements-sdk.git"},z={url:"https://github.com/liquidcommerce/elements-sdk/issues"},O="./dist/index.esm.js",N="./umd/elements.js",L="./dist/types/index.d.ts",R="pnpm@10.0.0",B={".":{types:"./dist/types/index.d.ts",import:"./dist/index.esm.js",browser:"./umd/elements.js",default:"./dist/index.esm.js"},"./package.json":"./package.json"},q=["dist","umd","docs","README.md","LICENSE"],j={access:"public",registry:"https://registry.npmjs.org/"},U="module",G=["dist/index.esm.js","umd/elements.js","src/index.ts","src/index.umd.ts"],V={build:"rollup -c","build:dev":"rollup -c --environment NODE_ENV:development",dev:"rollup -c -w","type-check":"tsc --noEmit",lint:"pnpm biome lint --write",format:"biome format --write",check:"pnpm biome check --write .",fl:"pnpm check && pnpm build:dev",changelog:"conventional-changelog -p angular -i CHANGELOG.md -s",clean:"rm -rf dist umd","clean:hard":"rm -rf dist umd node_modules && pnpm install && pnpm build",prepublishOnly:"pnpm run build","deprecate:old":'npm deprecate @liquidcommerceteam/elements-sdk@"*" "Package moved to @liquidcommerce/elements-sdk"',prepare:"husky"},K=["liquidcommerce","alcohol","beverage","alcohol tech","elements","custom web components","embeddable components","embeddable web components","embeddable commerce"],H={"@biomejs/biome":"2.3.5","@commitlint/cli":"^20.1.0","@commitlint/config-conventional":"^20.0.0","@rollup/plugin-alias":"^6.0.0","@rollup/plugin-commonjs":"^29.0.0","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^16.0.3","@rollup/plugin-replace":"^6.0.3","@rollup/plugin-terser":"^0.4.4","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^10.0.1","@semantic-release/github":"^12.0.2","@semantic-release/npm":"^13.1.1","@semantic-release/release-notes-generator":"^14.1.0","@types/core-js":"^2.5.8","@types/node":"^24.10.1","conventional-changelog-cli":"^5.0.0",husky:"^9.1.7",process:"^0.11.10",rollup:"^4.53.2","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"},W={node:">=22"},Q={peerDependencyRules:{ignoreMissing:[]},onlyBuiltDependencies:["@biomejs/biome","javascript-obfuscator"],overrides:{"@conventional-changelog/git-client@<2.0.0":">=2.0.0"}},Z={name:E,description:_,license:T,author:D,version:P,homepage:F,repository:A,bugs:z,module:O,browser:N,types:L,packageManager:R,exports:B,files:q,publishConfig:j,type:U,sideEffects:G,scripts:V,keywords:K,devDependencies:H,engines:W,pnpm:Q};class GoogleTagManagerService{constructor(){this.partnerEnableGaTracking=![],this.liquidCommerceEnableGaTracking=![],this.isInitialized=![],this.isInitializing=![],this.currency="USD",this.eventQueue=[],this.logger=LoggerFactory.get("GoogleTagManager"),this.clientConfigService=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("GoogleTagManagerService",()=>new GoogleTagManagerService)}waitForDOMReady(){return new Promise(t=>{if("loading"!==document.readyState)return t(),void 0;document.addEventListener("DOMContentLoaded",()=>t())})}isGTMAlreadyLoaded(){if("function"==="object".gtag)return!![];const t=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return t.length>0}isContainerLoaded(t){const n=Array.from(document.querySelectorAll('script[src*="googletagmanager.com/gtm.js"]'));return n.some(n=>{const o=n.src;return o.includes("id="+t)})}isContainerInitialized(t){if(!window.dataLayer||!Array.isArray(window.dataLayer))return![];if(!this.isContainerLoaded(t))return![];const n=window.dataLayer.some(t=>t&&"object"==typeof t&&("gtm.start"in t||"gtm.js"===t.event));return n||window.dataLayer.length>0}initializeGtag(){window.dataLayer||(window.dataLayer=[]),window.gtag?this.logger.info("GTM already initialized, using existing gtag function"):(window.gtag=(...t)=>window.dataLayer.push(t),this.logger.info("Initialized gtag function and dataLayer"))}loadGTMScript(t){return new Promise((n,o)=>{if(this.isContainerInitialized(t))return this.logger.info("GTM container "+t+" already loaded and initialized, skipping script injection"),n(),void 0;if(this.isContainerLoaded(t)){this.logger.info("GTM container "+t+" script present, checking initialization status");const s=setInterval(()=>{this.isContainerInitialized(t)&&(clearInterval(s),clearTimeout(c),this.logger.info("GTM container "+t+" initialized successfully"),n())},100),c=setTimeout(()=>{clearInterval(s),o(new Error("GTM container "+t+" script present but failed to initialize (possible CSP or network issue)"))},1e4);return}this.logger.info("Loading GTM container "+t);const s=document.createElement("script");s.src="https://www.googletagmanager.com/gtm.js?id="+t,s.async=!![],s.crossOrigin="anonymous";const c=setTimeout(()=>{this.isContainerInitialized(t)?(this.logger.info("GTM container "+t+" initialized despite timeout warning"),n()):o(new Error("GTM script timeout: "+t+" (possible network issue or CSP blocking)"))},15e3);let l=![];s.onload=()=>{l||(l=!![],setTimeout(()=>{if(clearTimeout(c),this.isContainerInitialized(t))this.logger.info("GTM container "+t+" loaded and initialized successfully"),n();else{const s="GTM container "+t+" script loaded but failed to initialize. This may indicate a Content Security Policy (CSP) issue or network error.";this.logger.warn(s),window.dataLayer&&Array.isArray(window.dataLayer)?(this.logger.info("dataLayer available, continuing with GTM initialization"),n()):o(new Error(s))}},500))},s.onerror=s=>{l||setTimeout(()=>{if(this.isContainerLoaded(t)&&this.isContainerInitialized(t))return l||(l=!![],clearTimeout(c),this.logger.info("GTM container "+t+" loaded successfully despite error event (Safari quirk)"),n()),void 0;if(!l){l=!![],clearTimeout(c);let n="GTM script failed to load: "+t;"string"==typeof s?n+=". Error: "+s:s instanceof ErrorEvent&&s.message?n+=". Error: "+s.message:s instanceof Event&&(n+=". Event type: "+s.type);const d=n+". Possible causes: Content Security Policy (CSP) blocking, network failure, or invalid container ID.";this.logger.error(d,{event:s}),o(new Error(d))}},100)},s.addEventListener("error",n=>{l||this.logger.error("GTM script error event for "+t,n)}),document.head.appendChild(s)})}processEventQueue(){const t=Date.now(),n=this.eventQueue.filter(n=>t-n.timestamp<3e4);for(const s of n)try{const t={event:s.eventName,...s.eventData};window.dataLayer.push(t),"function"==="object".gtag&&window.gtag("event",s.eventName,s.eventData),this.logger.debug("Processed queued GTM event: "+s.eventName,{data:s.eventData})}catch(o){this.logger.error("Error processing queued event "+s.methodName,o)}this.eventQueue=[],n.length>0&&this.logger.info("Processed "+n.length+" queued GTM events")}getSendToTargets(){const t=[];return this.liquidCommerceEnableGaTracking&&this.liquidCommerceGtmId&&(!this.isContainerLoaded(this.liquidCommerceGtmId)&&this.isGTMAlreadyLoaded()||t.push(this.liquidCommerceGtmId)),this.partnerEnableGaTracking&&this.partnerGtmId&&(this.isGTMAlreadyLoaded()||this.isContainerLoaded(this.partnerGtmId))&&t.push(this.partnerGtmId),0===t.length&&this.isGTMAlreadyLoaded()&&this.logger.debug("No specific targets configured, letting GTM route events naturally"),t}async initialize(t){if(this.isInitialized||this.isInitializing)return this.initializationPromise;if(!this.clientConfigService.isBuilder()){this.isInitializing=!![],this.initializationPromise=this.doInitialize(t);try{await this.initializationPromise}catch(n){this.isInitializing=![],this.initializationPromise=void 0,this.logger.error("GTM initialization failed",n)}}}async doInitialize(t){if(!(null==t?void 0:t.partnerName)||!(null==t?void 0:t.liquidCommerceGtmId))throw new SDKError("GTM config missing required fields");if(!t.liquidCommerceEnableGaTracking&&!t.partnerEnableGaTracking)return this.logger.warn("GTM initialization skipped: No tracking enabled"),this.isInitialized=!![],this.isInitializing=![],void 0;await this.waitForDOMReady(),this.partnerName=t.partnerName,this.partnerGtmId=t.partnerGtmId,this.liquidCommerceGtmId=t.liquidCommerceGtmId,this.partnerEnableGaTracking=t.partnerEnableGaTracking,this.liquidCommerceEnableGaTracking=t.liquidCommerceEnableGaTracking;const n=this.isGTMAlreadyLoaded();n&&this.logger.info("Partner GTM detected, integrating with existing setup"),this.initializeGtag();let o=![],s="";if(t.liquidCommerceEnableGaTracking)try{await this.loadGTMScript(t.liquidCommerceGtmId),o=!![],s=n?"GTM integrated with existing setup (Partner GTM detected, LC container: "+t.liquidCommerceGtmId+")":"GTM initialized with container "+t.liquidCommerceGtmId}catch(c){const t=(null==c?void 0:c.message)||String(c);this.logger.error("Failed to load LiquidCommerce GTM container: "+t+". Checking if partner GTM is available.",c),window.dataLayer&&Array.isArray(window.dataLayer)&&window.dataLayer.length>0&&this.logger.warn("LiquidCommerce GTM script failed, but dataLayer is available. Attempting to proceed with existing GTM setup.")}if(o||(n&&window.dataLayer&&Array.isArray(window.dataLayer)&&(this.isContainerInitialized(t.partnerGtmId||"")||window.dataLayer.length>0)&&(o=!![],s="GTM integrated with existing partner setup (LiquidCommerce container failed to load)",this.logger.info("Using partner GTM as fallback after LiquidCommerce GTM load failure")),!o&&window.dataLayer&&Array.isArray(window.dataLayer)&&(o=!![],s="GTM initialized with dataLayer (basic functionality available, container script may have failed)",this.logger.warn("LiquidCommerce GTM container failed to load, but using basic dataLayer for event tracking"))),!o)throw this.isInitializing=![],new SDKError("GTM initialization failed: No working GTM configuration available");this.isInitialized=!![],this.isInitializing=![],this.logger.info(s),this.processEventQueue()}executeEvent(t,n,o){try{if(this.clientConfigService.isBuilder())return;const s=this.getSendToTargets(),c={...o,...s.length>0&&{send_to:s},tenant_source:Z.description+" v"+Z.version,tenant_name:this.partnerName};if(!this.isInitialized)return this.eventQueue.length>=100&&this.eventQueue.shift(),this.eventQueue.push({methodName:t,eventName:n,eventData:c,timestamp:Date.now()}),this.logger.debug("Queued GTM event: "+n+" (initialization pending)",{data:c}),void 0;if(!window.dataLayer||!Array.isArray(window.dataLayer))return this.logger.warn("GTM event "+n+" skipped: dataLayer not available"),void 0;const l={event:n,...c};window.dataLayer.push(l),"function"==="object".gtag&&window.gtag("event",n,c),this.logger.debug("Sent GTM event: "+n,{method:"function"==="object".gtag?"dataLayer + gtag":"dataLayer only",targets:s.length>0?s:"no targeting",data:c})}catch(s){this.logger.error("GTM "+t+" error",s)}}calculateValue(t){const n=t.reduce((t,n)=>t+(n.price||0)*(n.quantity||1),0);return Number.parseFloat(n.toFixed(2))}viewItem(t){this.executeEvent("viewItem","view_item",{currency:this.currency,value:this.calculateValue([t]),items:[t]})}viewItemList(t,n,o){this.executeEvent("viewItemList","view_item_list",{currency:this.currency,item_list_id:n,item_list_name:o,items:t})}selectItem(t,n,o){this.executeEvent("selectItem","select_item",{item_list_id:n,item_list_name:o,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,n){this.executeEvent("beginCheckout","begin_checkout",{currency:this.currency,value:this.calculateValue(t),coupon:n,items:t})}addShippingInfo(t,n){this.executeEvent("addShippingInfo","add_shipping_info",{currency:this.currency,value:this.calculateValue(t),coupon:n,items:t})}addPaymentInfo(t,n,o){this.executeEvent("addPaymentInfo","add_payment_info",{currency:this.currency,value:this.calculateValue(t),payment_type:n,coupon:o,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,n){this.executeEvent("promoCodeApplied","promo_code_applied",{promo_code:t,discount_amount:n})}promoCodeFailed(t,n){this.executeEvent("promoCodeFailed","promo_code_failed",{promo_code:t,reason:n})}giftCardAttempt(t){this.executeEvent("giftCardAttempt","gift_card_attempt",{gift_card_code:t})}giftCardApplied(t,n){this.executeEvent("giftCardApplied","gift_card_applied",{gift_card_code:t,applied_amount:n})}giftCardFailed(t,n){this.executeEvent("giftCardFailed","gift_card_failed",{gift_card_code:t,reason:n})}addressUpdated(t){this.executeEvent("addressUpdated","address_updated",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,coordinates:t.coordinates})}addressFailed(t){this.executeEvent("addressFailed","address_failed",{address_id:t.googlePlacesId,formatted_address:t.formattedAddress,address:t.address,address_error_message:t.error})}productNoAvailability(t){this.executeEvent("productNoAvailability","product_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productSizeNoAvailability(t){this.executeEvent("productSizeNoAvailability","product_size_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}productFulfillmentNoAvailability(t){this.executeEvent("productFulfillmentNoAvailability","product_fulfillment_no_availability",{product_id:t.productId,product_name:t.productName,product_brand:t.productBrand,product_category:t.productCategory,product_category2:t.productCategory2,product_category3:t.productCategory3,product_type:t.productType,product_subtype:t.productSubtype,product_price:t.productPrice,size_id:t.sizeId,size_name:t.sizeName,fulfillment_type:t.fulfillmentType,upc:t.upc,grouping_id:t.groupingId,address:t.address,availability_reason:t.reason})}}class StoreService{constructor(){this.middleware=[],this.isLocalStorageAvailable=![],this.loggingMiddleware=({action:t,payload:n,next:o})=>{const s=performance.now();try{const c=o(),l=performance.now()-s;return this.logger.info("🏪 Store "+t+" ✓ "+l.toFixed(3)+"ms",n),c}catch(c){const o=performance.now()-s;throw this.logger.error("🏪 Store "+t+" ✗ "+o.toFixed(3)+"ms",{payload:n,error:c}),c}},this.performanceMiddleware=({action:t,next:n})=>{const o=performance.now(),s=n(),c=performance.now()-o;return c>16&&this.logger.warn('⚠️ Slow store operation "'+t+'": '+c.toFixed(2)+"ms"),s},this.state=w,this.listeners=new Map,this.logger=LoggerFactory.get("Store"),this.clientConfig=ClientConfigService.getInstance(),this.api=ApiClientService.getInstance(),this.setupMiddleware()}static getInstance(){return SingletonManager.getClassInstance("StoreService",()=>new StoreService)}async initialize({userDeviceId:t,isLocalStorageAvailable:n,persistedStore:o}){this.localStorageKey=this.clientConfig.get("localStorageKeyPrefix")+"_"+t,this.isLocalStorageAvailable=n,n?await this.loadPersistedState():o&&await this.loadFromDBPersistence(o),this.logger.info("Store service initialized successfully",{userDeviceId:t,isLocalStorageAvailable:n,hasPersistedState:null!==o,localStorageKey:this.localStorageKey})}get(t){if(!t)return{...this.state};const n=t.split(".");let o=this.state;for(const s of n){if(null==o)return;o=o[s]}return void 0!==o?Array.isArray(o)?[...o]:"object"==typeof o&&null!==o?{...o}:o:void 0}set(t,n){return this.runWithMiddleware("set",{path:t,value:n},()=>{const o=this.get(t);return this.state=this.immutableSet(this.state,t,n),this.notifyListeners(t,n,o),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}update(t,n){const o=this.get(t),s=n(o);return this.set(t,s)}remove(t){return this.runWithMiddleware("remove",{path:t},()=>{const n=this.get(t);if(void 0===n)return this.logger.warn('No value found at path "'+t+'" to remove.'),![];const o=t.split(".");let s=this.state;const c=o.pop();for(const l of o){if(void 0===s[l])return this.logger.warn('Path "'+t+'" does not exist in the state.'),![];s=s[l]}if(Array.isArray(s))s=s.filter((t,n)=>n!==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 "'+t+'".'),![];{const{[c]:t,...n}=s;s=n}}return this.state=this.immutableSet(this.state,o.join("."),s),this.notifyListeners(t,void 0,n),this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}batch(t){return this.runWithMiddleware("batch",{updates:t},()=>{const n=[];if("function"==typeof t){const o=t(this.state);for(const[t,s]of Object.entries(o)){const o=this.get(t);n.push({path:t,oldValue:o,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,t,s)}}else for(const[o,s]of Object.entries(t)){const t=this.get(o);n.push({path:o,oldValue:t,newValue:s,timestamp:Date.now()}),this.state=this.immutableSet(this.state,o,s)}for(const{path:t,oldValue:o,newValue:s}of n)this.notifyListeners(t,s,o);return this.isLocalStorageAvailable&&this.debouncedSave(),!![]})}watch(t,n){const o=t;return this.listeners.has(o)||this.listeners.set(o,new Set),this.listeners.get(o).add(n),()=>{var t;null===(t=this.listeners.get(o))||void 0===t?void 0:t.delete(n)}}watchMany(t,n){const o=[];let s;const c=t.map(t=>this.watch(t,(c,l)=>{o.push({path:t,value:c,oldValue:l}),clearTimeout(s),s=setTimeout(()=>{o.length>0&&(n([...o]),o.length=0)},0)}));return()=>{for(const t of c)t()}}createProductInstance(t){const n="products."+t,o=this.get(n);return o?!![]:this.set(n,g)}removeProductInstance(t){const n=this.get("products"),{[t]:o,...s}=n;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(t,n,o){let s=0;const a=()=>{if(s>=this.middleware.length)return o();const c=this.middleware[s++];return c({action:t,payload:n,state:this.getState(),next:a})};return a()}immutableSet(t,n,o){const s=n.split(".");if(1===s.length){if(Array.isArray(t)){const n=[...t];return n[s[0]]=o,n}return{...t,[s[0]]:o}}const[c,...l]=s,d=t[c],u=Array.isArray(d)?[]:{};if(Array.isArray(t)){const n=[...t];return n[c]=this.immutableSet(d||u,l.join("."),o),n}return{...t,[c]:this.immutableSet(d||u,l.join("."),o)}}notifyListeners(t,n,o){const s=this.listeners.get(t);if(s)for(const u of s)try{u(n,o)}catch(l){this.logger.error('Error in store listener for path "'+t+'"',l)}const c=t.split(".");for(let u=c.length-1;u>0;u--){const t=c.slice(0,u).join("."),n=this.listeners.get(t);if(n){const s=this.get(t),l=c.slice(u).join("."),h=this.immutableSet(s,l,o);for(const o of n)try{o(s,h)}catch(d){this.logger.error('Error in store listener for parent path "'+t+'"',d)}}}}debouncedSave(){this.saveTimeout&&clearTimeout(this.saveTimeout),this.saveTimeout=setTimeout(()=>this.saveStore(),50)}forceSave(){this.saveTimeout&&(clearTimeout(this.saveTimeout),this.saveTimeout=void 0),this.saveStore()}async persist(){var t;const n=this.get("address.id")||"",o=this.get("cart.id")||"";if(!n&&!o)return this.logger.info("No session data to persist (both IDs are empty), skipping"),void 0;if(this.isLocalStorageAvailable)return this.forceSave(),this.logger.info("Session data persisted to localStorage",{addressId:n,cartId:o}),void 0;try{const s=null!==(t=this.clientConfig.get("userDeviceId"))&&void 0!==t?t:"not_defined";await this.api.setPersistedStore(s,{p:n,c:o}),this.logger.info("Session data persisted to DB",{userDeviceId:s,addressId:n,cartId:o})}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(Z){this.logger.error("Failed to clear localStorage entry",Z)}}saveStore(){if(this.isLocalStorageAvailable&&this.localStorageKey)try{let t="";if(this.clientConfig.debuggingDisabled()){const n=this.get("address.id")||"",o=this.get("cart.id")||"";(n||o)&&(t=n+":"+o)}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 n=localStorage.getItem(this.localStorageKey);if(!n)return;try{const t=JSON.parse(n);for(const[n,o]of Object.entries(t))this.set(n,o);return}catch(t){if(n.includes(":")){const[t,o]=n.split(":");if(void 0!==t){const n=await this.getAddressDataFromId(t);this.set("address",n)}return void 0!==o&&this.set("cart.id",o||null),void 0}this.logger.warn("Unrecognized localStorage format, skipping load",{saved:n})}}catch(n){this.logger.error("Failed to load persisted state",n),localStorage.removeItem(this.localStorageKey)}}async loadFromDBPersistence(t){try{if(void 0!==t.p){const n=await this.getAddressDataFromId(t.p);this.set("address",n)}void 0!==t.c&&this.set("cart.id",t.c||null),this.logger.info("Session data loaded from DB persistence",{addressId:t.p,cartId:t.c})}catch(n){this.logger.error("Failed to load session data from DB persistence",n)}}async getAddressDataFromId(t){if(!t||""===t.trim())return x;try{const n=await this.api.getAddressDetails(t);return n&&0!==Object.keys(n).length?{id:t,formattedAddress:n.formattedAddress,address:{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""},coordinates:{lat:n.coords.lat,long:n.coords.long}}:{...x,id:t}}catch(n){return{...x,id:t}}}}const X=[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,s.PRODUCT_LIST,s.PRODUCT_LIST_CARD,s.PRODUCT_LIST_CARD_LOADING,s.PRODUCT_LIST_FILTERS],$=[s.ADDRESS_INPUT,s.ADDRESS_DISPLAY],J=[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],tt=[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];class FontManagerService{constructor(){this.googleFontsUrl="",this.defaultFontFamilies=[{name:"Poppins",weights:[400,500,600,700]}],this.fontsLinkAttribute="data-lce-fonts"}loadGoogleFonts(t,n="swap"){if(!t||0===t.length)return;const o=[...this.defaultFontFamilies,...t],s=o.map(t=>{const n=encodeURIComponent(t.name);return"family="+n+":wght@"+t.weights.join(";")}).join("&"),c="display="+n;this.googleFontsUrl="https://fonts.googleapis.com/css2?"+s+"&"+c,this.injectGoogleFontsResourceHints(),this.injectGoogleFontsLink()}updateGoogleFonts(t,n="swap"){const o=document.querySelector("link["+this.fontsLinkAttribute+"]");this.loadGoogleFonts(t,n),o&&o.remove()}injectGoogleFontsResourceHints(){const t=document.querySelector('link[href="https://fonts.googleapis.com"][rel="preconnect"]'),n=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(!n){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 flex-direction: row;\n align-items: flex-start;\n gap: 24px;\n }\n\n .product-list-filters-container {\n width: 30%;\n height: fit-content;\n position: sticky;\n top: 24px;\n padding: 0;\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 .product-list.has-filters .product-list-cards__container {\n width: 70%;\n }\n\n /* Filters Styles */\n .product-list-filters-header,\n .product-list-filters-personalized,\n .product-list-filters-pre-order,\n .product-list-filters-delivery-options {\n padding: 16px 0 12px 0;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n }\n\n .product-list-filters-delivery-options {\n border-bottom: none;\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-personalized,\n .product-list-filters-pre-order {\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\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-personalized-label,\n .product-list-filters-pre-order-label {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n align-items: center;\n line-height: 1.5;\n flex: 1;\n }\n\n .product-list-filters-warning {\n font-size: 12px;\n color: var(--default-text-color-70, #9ca3af);\n font-family: var(--paragraph-font-family, Poppins);\n font-style: normal;\n margin: 0;\n padding: 0;\n }\n\n .product-list-filters-delivery-options-header {\n display: flex;\n align-items: center;\n }\n\n .product-list-filters-delivery-options-label {\n font-size: 18px;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--heading-font-family, Poppins);\n }\n\n .product-list-filters-delivery-options-list {\n display: flex;\n flex-direction: column;\n }\n\n .product-list-filters-delivery-option {\n display: flex;\n align-items: center;\n gap: 14px;\n padding: 12px 16px;\n border-radius: var(--button-border-radius, 8px);\n cursor: pointer;\n }\n\n .product-list-filters-delivery-option:hover {\n background-color: var(--accent-color-30, #f8fafc);\n }\n\n .product-list-filters-delivery-radio {\n width: 18px;\n height: 18px;\n margin: 0;\n cursor: pointer;\n accent-color: var(--primary-color, #3b82f6);\n }\n\n .product-list-filters-delivery-radio:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio-label {\n font-size: 15px;\n font-weight: 500;\n color: var(--default-text-color, #374151);\n font-family: var(--paragraph-font-family, Poppins);\n margin: 0;\n cursor: pointer;\n flex: 1;\n }\n\n .product-list-filters-delivery-radio-label.disabled {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n .product-list-filters-delivery-radio:disabled + .product-list-filters-delivery-radio-label {\n color: var(--default-text-color-70, #9ca3af);\n cursor: not-allowed;\n }\n\n input[type="checkbox"].product-list-filters-personalized-switch,\n input[type="checkbox"].product-list-filters-pre-order-switch {\n position: relative;\n width: 52px;\n height: 28px;\n appearance: none;\n background: var(--accent-color, #e5e7eb);\n border-radius: 14px;\n cursor: pointer;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n outline: none;\n border: 2px solid transparent;\n }\n\n input[type="checkbox"].product-list-filters-personalized-switch:checked,\n input[type="checkbox"].product-list-filters-pre-order-switch:checked {\n background: var(--primary-color, #3b82f6);\n border-color: var(--primary-color-30, rgba(59, 130, 246, 0.3));\n }\n\n .product-list-filters-personalized-switch:disabled,\n .product-list-filters-pre-order-switch:disabled {\n background: var(--accent-color-30, #f3f4f6);\n cursor: not-allowed;\n opacity: 0.5;\n }\n\n .product-list-filters-personalized-switch::before,\n .product-list-filters-pre-order-switch::before {\n content: \'\';\n position: absolute;\n top: 2px;\n left: 2px;\n width: 20px;\n height: 20px;\n background: var(--selected-text-color, #ffffff);\n border-radius: 50%;\n transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);\n }\n\n .product-list-filters-personalized-switch:checked::before,\n .product-list-filters-pre-order-switch:checked::before {\n transform: translateX(24px);\n }\n\n /* Product List Card Styles */\n .product-list-card.standard {\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n border: 1px solid var(--accent-color, #f3f4f6);\n border-radius: var(--card-border-radius, 0.375rem);\n cursor: pointer;\n overflow: hidden;\n }\n\n .product-list-card.fill {\n background-color: #ffffff;\n }\n\n .product-list-card.standard.not-available {\n cursor: not-allowed;\n }\n\n .product-list-card.standard.not-available:hover {\n cursor: not-allowed;\n }\n\n .product-list-card.standard .plc__image-content {\n width: 100%;\n height: 100%;\n padding: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper {\n width: 100%;\n height: 14rem;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border-bottom: 1px solid var(--accent-color, #f3f4f6);\n padding-bottom: 10px;\n }\n\n .product-list-card.standard .plc__image-wrapper .plc__image {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n .product-list-card.standard .plc__content {\n width: 100%;\n padding: 0 10px;\n display: flex;\n flex-direction: column;\n margin-bottom: 10px;\n }\n\n .product-list-card.standard .plc__content .plc__title {\n width: 100%;\n height: 4.6875rem;\n font-size: 1.125rem;\n font-weight: 600;\n color: var(--default-text-color, #111827);\n font-family: var(--paragraph-font-family, Poppins);\n text-transform: uppercase;\n margin-bottom: 10px;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n line-height: 1.38;\n word-wrap: break-word;\n word-break: break-word;\n }\n\n .product-list-card.standard .plc__image-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__image-link:hover {\n text-decoration: none;\n }\n\n .product-list-card.standard .plc__title-link {\n text-decoration: none;\n display: block;\n color: inherit;\n width: 100%;\n }\n\n .product-list-card.standard .plc__title-link:hover {\n text-decoration: underline;\n }\n\n .product-list-card.standard .plc__title-link .plc__title {\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n font-family: var(--paragraph-font-family, Poppins);\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: auto;\n color: var(--default-text-color, #111827);\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 10px;\n font-weight: 300;\n }\n\n .plc__size-price-wrapper .plc__size {\n font-size: 1rem;\n font-weight: 600;\n }\n\n .plc__button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: auto;\n white-space: nowrap;\n text-align: center;\n font-size: 0.875rem;\n line-height: 1.25rem;\n font-weight: 600;\n text-transform: capitalize;\n color: var(--selected-text-color, #ffffff);\n background-color: var(--primary-color, #3b82f6);\n padding: 0.5rem 0.375rem;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n }\n\n .plc__button:hover {\n background-color: var(--primary-color-70, #3b82f6);\n }\n\n .plc__button:disabled {\n pointer-events: none;\n opacity: 0.5;\n }\n\n /* Infinite Scroll Sentinel Styles */\n .product-list-scroll-sentinel {\n width: 100%;\n flex: 0 0 100%;\n min-height: 80px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 24px 16px;\n margin: 16px auto;\n box-sizing: border-box;\n }\n\n .product-list-sentinel-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n 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 gap: 8px;\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 /* Responsive Styles */\n\n /* Mobile - 1 column (default, up to 639px) */\n @media (max-width: 639px) {\n .product-list {\n flex-direction: column;\n flex-wrap: wrap;\n }\n\n .product-list-filters-container {\n width: 100%;\n order: 1;\n position: static;\n top: unset;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: 2;\n --columns: 1;\n --gap-per-card: 0px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 100%;\n }\n\n .product-list-card.standard {\n width: 100%;\n flex: 0 0 100%;\n }\n }\n\n /* Small tablets - 2 columns (640px and up) */\n @media (min-width: 640px) and (max-width: 767px) {\n .product-list {\n flex-direction: column;\n flex-wrap: wrap;\n }\n\n .product-list-filters-container {\n width: 100%;\n order: 1;\n position: static;\n top: unset;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: 2;\n --columns: 2;\n --gap-per-card: 12px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 100%;\n }\n\n .product-list-card.standard {\n width: calc(50% - 12px);\n flex: 0 0 calc(50% - 12px);\n }\n }\n\n /* Tablets - 3 columns (768px and up) */\n @media (min-width: 768px) and (max-width: 1023px) {\n .product-list {\n flex-direction: row;\n flex-wrap: nowrap;\n }\n\n .product-list-filters-container {\n width: 30%;\n order: unset;\n position: sticky;\n top: 24px;\n }\n\n .product-list-cards__container {\n width: 100%;\n order: unset;\n --columns: 3;\n --gap-per-card: 16px;\n }\n\n .product-list.has-filters .product-list-cards__container {\n width: 70%;\n }\n\n .product-list-card.standard {\n width: calc(33.333% - 16px);\n flex: 0 0 calc(33.333% - 16px);\n }\n }\n\n /* Desktop - Use configured columns (1024px and up) */\n @media (min-width: 1024px) {\n .product-list {\n flex-direction: row;\n flex-wrap: nowrap;\n }\n\n .product-list-filters-container {\n position: sticky;\n top: 24px;\n }\n\n .product-list-cards__container {\n --gap-per-card: calc(24px * (var(--columns, 4) - 1) / var(--columns, 4));\n }\n\n .product-list-card.standard {\n width: calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n flex: 0 0 calc(var(--card-width, 25%) - var(--gap-per-card, 18px));\n }\n }\n',getAddressStyles=()=>"\n .address-input-container {\n width: 100%;\n max-width: 100%;\n min-width: 320px;\n height: 100%;\n font-family: var(--heading-font-family, Poppins);\n position: relative;\n display: flex;\n flex-direction: column;\n }\n\n .address-input-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .address-input-container .input-title {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n padding-bottom: 8px;\n text-align: left;\n }\n\n .address-input-container .input-section {\n position: relative;\n }\n\n .address-input-container .input-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n align-self: stretch;\n padding: 4px 12px;\n border-radius: var(--card-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n }\n\n .address-input-container .input-wrapper.filled {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-wrapper.outlined {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .address-input-container .input-icon {\n display: flex;\n margin-left: 4px;\n }\n\n .address-input-container .input-icon svg {\n stroke: var(--default-text-color, #18181B);\n }\n\n /* Remove bottom border radius when suggestions are shown */\n .address-input-container .suggestions-list.show ~ .input-wrapper,\n .address-input-container .input-section.suggestions-expanded .input-wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n /* Alternative approach using a modifier class */\n .address-input-container .input-wrapper.suggestions-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .address-input-container .input-field {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n width: 100%;\n border: none\n }\n\n .address-input-container .input-field:focus {\n outline: none;\n border: none;\n box-shadow: none;\n }\n\n .address-input-container .suggestions-list {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: "+m.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: "+m.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: "+m.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(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n 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: "+m.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(--primary-color, #1E40AF);\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: "+m.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: "+m.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(--primary-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: "+m.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: "+m.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(--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: 100%;\n }\n\n .checkout-send-as-gift-toggle-container {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: "+m.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: "+m.LOADING_INDICATOR+';\n width: 18px;\n height: 18px;\n border: 2px solid transparent;\n border-top: 2px solid var(--selected-text-color);\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n /* Disabled state - very muted */\n .checkout-place-order-button.disabled {\n background: var(--primary-color-70, #D1D5DB);\n cursor: not-allowed;\n }\n\n /* Focus states for accessibility */\n .checkout-place-order-button:focus {\n outline: none;\n box-shadow: 0 0 0 3px var(--primary-color-70);\n }\n\n .checkout-place-order-button.disabled:focus {\n box-shadow: none;\n }\n\n .checkout-marketing-opt-ins-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-marketing-opt-ins-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-billing-same-as-shipping-toggle-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n cursor: pointer;\n }\n\n .checkout-billing-same-as-shipping-toggle-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-toggler {\n display: flex;\n height: 14px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n cursor: pointer;\n }\n\n .checkout-items-toggler-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .checkout-items-list {\n display: none;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-items-list > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-items-list.show {\n display: flex;\n }\n\n .checkout-item-card {\n display: flex;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-item-card > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .checkout-item-card-header {\n display: flex;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-item-card-header > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-item-details-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .checkout-item-card-footer {\n display: flex;\n height: 36px;\n align-items: center;\n align-content: center;\n justify-content: space-between;\n align-self: stretch;\n flex-wrap: wrap;\n margin-right: -8px;\n margin-bottom: -8px;\n }\n\n .checkout-item-card-footer > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .checkout-item-image {\n display: flex;\n width: 64px;\n height: 70px;\n flex-direction: column;\n align-items: center;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .checkout-item-image img {\n max-width: 100%;\n max-height: 100%;\n object-fit: contain;\n }\n\n .checkout-item-card .checkout-item-subtitle {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .checkout-item-card .checkout-item-title,\n .checkout-item-card .checkout-item-subtitle > span,\n .checkout-item-price-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n word-break: break-word;\n }\n\n .checkout-item-price-each-text {\n font-weight: 500;\n }\n\n .checkout-item-card .checkout-item-subtitle > span {\n font-weight: 400 !important;\n }\n\n .checkout-item-quantity-container {\n display: flex;\n width: 106px;\n align-items: center;\n }\n\n .billing-checkbox-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-item-quantity-container .quantity-decrease,\n .checkout-item-quantity-container .quantity-increase {\n display: flex;\n width: 36px;\n height: 36px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n\n cursor: pointer;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-item-quantity-container .quantity-decrease {\n border-radius: var(--button-border-radius, 6px) 0px 0px var(--button-border-radius, 6px);\n }\n\n .checkout-item-quantity-container .quantity-increase {\n border-radius: 0px var(--button-border-radius, 6px) var(--button-border-radius, 6px) 0px;\n }\n\n .checkout-item-quantity-container .quantity-decrease.disabled,\n .checkout-item-quantity-container .quantity-increase.disabled {\n opacity: 0.7;\n cursor: not-allowed;\n }\n\n .checkout-item-quantity-container .product-count {\n display: flex;\n padding: 6px 8px;\n justify-content: center;\n align-items: center;\n flex: 1 0 0;\n align-self: stretch;\n\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container {\n display: flex;\n align-items: center;\n border: 1px solid var(--accent-color, #E4E4E7);\n border-radius: var(--button-border-radius, 6px);\n align-self: stretch;\n flex: 1 0 0;\n max-width: 100px;\n\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .dollar-input-container:focus-within {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n }\n\n .dollar-sign {\n font-size: 14px;\n font-weight: 500;\n user-select: none;\n pointer-events: none;\n }\n\n .dollar-input {\n flex: 1;\n border: none;\n outline: none;\n background: transparent;\n }\n\n .dollar-input::placeholder {\n color: var(--default-text-color-70, #18181B);\n }\n\n .dollar-input::-webkit-outer-spin-button,\n .dollar-input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n .dollar-input[type=number] {\n -moz-appearance: textfield;\n }\n\n .dollar-input:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) {\n opacity: 0.6;\n }\n\n .dollar-input-container:has(.dollar-input:disabled) .dollar-sign {\n color: var(--default-text-color-70, #18181B);\n }\n\n /* Checkout Thank You Page */\n .checkout-completed-container {\n display: flex;\n min-height: 100vh; /* Fallback for browsers that don\'t support dvh */\n min-height: 100dvh;\n min-width: 320px;\n flex-direction: column;\n justify-content: center;\n flex: 1 0 0;\n align-self: stretch;\n }\n\n .checkout-completed-header-container {\n display: flex;\n padding: 24px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-header-container > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-completed-header-container img {\n width: 200px;\n height: auto;\n object-fit: contain;\n flex-shrink: 0;\n }\n\n .checkout-completed-sub-section {\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n flex-shrink: 0;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .checkout-completed-sub-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-sub-section p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n }\n\n .checkout-completed-section-container {\n display: flex;\n padding: 24px;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-section-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-help-section > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .checkout-completed-help-section {\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 100%;\n text-align: center;\n }\n\n .checkout-completed-section-container button {\n display: flex;\n height: 36px;\n min-width: 182px;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n }\n\n .checkout-completed-section-container button svg {\n stroke: var(--selected-text-color, #1D4ED8);\n fill: var(--selected-text-color, #1D4ED8);\n }\n\n .checkout-completed-section-container button span {\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-right: 8px;\n }\n\n .checkout-completed-title-container {\n display: flex;\n flex-direction: column;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-title-container > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .checkout-completed-title-section {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n text-align: center;\n }\n\n .checkout-completed-title-section .presale-expired-title {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .checkout-completed-title-section\n color: var(--default-text-color, #18181B);\n }\n\n .checkout-completed-title-section p:first-child, .checkout-completed-auto-close-seconds {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section h3 {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 600;\n line-height: 32px;\n }\n\n .checkout-completed-title-section p, .checkout-completed-auto-close-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .checkout-completed-line {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .checkout-completed-line span {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-completed-line:first-child span {\n font-weight: 600;\n }\n\n .checkout-completed-line h3 {\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-payment-form-error {\n color: var(--error-color, #EF4444);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 20px;\n margin-top: 8px;\n }\n\n .checkout-error-wrapper {\n animation: slideIn 0.2s ease-out;\n display: flex;\n align-self: stretch;\n margin-bottom: 8px;\n }\n\n .checkout-error-wrapper > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error {\n display: flex;\n padding: 12px 16px;\n }\n\n .checkout-error > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-error\n border-radius: var(--button-border-radius, 6px);\n font-size: 14px;\n line-height: 1.5;\n font-family: var(--body-font-family, inherit);\n flex: 1;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n\n background: var(--error-color-30, #DC2626);\n border: 1px solid var(--error-color, #DC2626);\n }\n\n .checkout-error .icon-error {\n flex-shrink: 0;\n width: 16px;\n height: 16px;\n display: inline-block;\n }\n\n .checkout-error .error-text {\n font-family: var(--body-font-family, inherit);\n }\n\n .checkout-error-wrapper[style*="display: none"] {\n display: none !important;\n }\n\n .checkout-checkbox-container {\n display: flex;\n align-items: flex-start;\n }\n\n .checkout-checkbox-container > *:not(:first-child) {\n margin-left: 12px;\n }\n\n .checkout-checkbox-visual {\n width: 16px;\n height: 16px;\n border: 1px solid var(--primary-color, #1D4ED8);\n border-radius: 2px;\n background: var(--primary-color, #1D4ED8);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n flex-shrink: 0;\n transition: all 0.2s ease;\n margin-top: 3px;\n }\n\n .checkout-checkbox-visual svg {\n opacity: 1;\n transition: opacity 0.2s ease;\n }\n\n .checkout-checkbox-visual:not(.checked) {\n background: transparent;\n }\n\n .checkout-checkbox-visual:not(.checked) svg {\n opacity: 0;\n }\n\n .checkbox-label {\n cursor: pointer;\n user-select: none;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkbox-label a {\n color: var(--primary-color, #1D4ED8);\n }\n\n .checkbox-label strong {\n font-weight: 600;\n }\n\n .checkbox-label em {\n font-style: italic;\n }\n\n .error-banner-checkout {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n color: var(--default-text-color, #18181B);\n padding: 8px 16px;\n flex-grow: 1;\n align-self: stretch;\n word-break: break-word;\n\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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: '+m.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: "+m.PROGRESS_BAR+';\n background: var(--primary-color, #16a34a);\n transition: width 0.1s linear;\n border-radius: inherit;\n }\n\n .checkout-presale-heading {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n align-self: stretch;\n }\n\n .checkout-presale-timer {\n font-variant-numeric: tabular-nums;\n letter-spacing: 0.02em;\n font-variant-numeric: tabular-nums;\n font-feature-settings: "tnum" 1, "kern" 0;\n min-width: 76px;\n white-space: nowrap;\n\n &.time-warning {\n color: var(--error-color, #EF4444);\n }\n }\n\n .checkout-presale-subtitle {\n transition: opacity 0.3s ease, max-height 0.3s ease;\n opacity: 1;\n max-height: 100px;\n overflow: hidden;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n\n .checkout-presale-countdown.is-scrolled .checkout-presale-subtitle {\n opacity: 0;\n max-height: 0;\n }\n\n .checkout-completed-container .powered-by-container {\n margin-top: auto;\n padding: 24px;\n }\n\n .checkout-completed-container .checkout-legal-message {\n padding: 0 24px;\n }\n\n .checkout-legal-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n line-height: 20px;\n text-align: center;\n word-break: break-word;\n margin: 10px 0 !important;\n }\n\n .checkout-legal-message + .checkout-separator {\n margin-top: 0 !important;\n }\n\n .checkout-legal-message a {\n color: var(--primary-color, #1D4ED8);\n }\n\n .checkout-legal-message strong {\n font-weight: 600;\n }\n\n .checkout-legal-message em {\n font-style: italic;\n }\n\n .checkout-amount-due {\n display: flex;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-amount-due span:first-child {\n color: var(--default-text-color-70, #18181B);\n }\n\n .checkout-amount-due span:last-child {\n color: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-presale-locked-message {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n align-self: stretch;\n }\n\n .checkout-presale-locked-message > *:not(:first-child) {\n margin-left: 8px;\n }\n\n .checkout-presale-locked-message p {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 13px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-presale-locked-message svg {\n width: 16px;\n height: 16px;\n stroke-width: 0.5px;\n stroke: var(--default-text-color, #1D4ED8);\n }\n\n .checkout-zero-amount-container {\n display: flex;\n padding: 0 24px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n color: var(--default-text-color-70, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: italic;\n font-weight: 500;\n line-height: 20px;\n }\n\n .checkout-items-toggler-button .chevron-icon {\n transition: transform 0.3s ease;\n transform-origin: center;\n }\n\n .checkout-items-toggler-button.expanded .chevron-icon {\n transform: rotate(180deg); /* Chevron now points up */\n }\n\n .checkout-summary-form-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .checkout-summary-form-header {\n width: 100%;\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n margin-bottom: 8px;\n }\n\n .checkout-summary-form-header h2 {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n text-align: left;\n }\n\n .checkout-summary-form-header span {\n color: var(--primary-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .checkout-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(--primary-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n cursor: pointer;\n }\n\n .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 }\n ',getGlobalStyles=()=>"\n html, body, div, span, applet, object, iframe,\n h1, h2, h3, h4, h5, h6, p, blockquote, pre,\n a, abbr, acronym, address, big, cite, code,\n del, dfn, em, img, ins, kbd, q, s, samp,\n small, strike, strong, sub, sup, tt, var,\n b, u, i, center,\n dl, dt, dd, ol, ul, li,\n fieldset, form, label, legend,\n table, caption, tbody, tfoot, thead, tr, th, td,\n article, aside, canvas, details, embed,\n figure, figcaption, footer, header, hgroup,\n menu, nav, output, ruby, section, summary,\n time, mark, audio, video {\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n }\n\n *, :after, :before {\n box-sizing: border-box;\n }\n\n article, aside, details, figcaption, figure,\n footer, header, hgroup, menu, nav, section {\n display: block;\n }\n body {\n line-height: 1;\n }\n ol, ul {\n list-style: none;\n }\n blockquote, q {\n quotes: none;\n }\n blockquote:before, blockquote:after,\n q:before, q:after {\n content: '';\n content: none;\n }\n table {\n border-collapse: collapse;\n border-spacing: 0;\n }\n\n button {\n background: none;\n border: none;\n padding: 0;\n font: inherit;\n color: inherit;\n cursor: pointer;\n }\n\n input,\n textarea {\n background: none;\n border: none;\n padding: 0;\n resize: none;\n }\n\n input[type=\"checkbox\"] {\n /* Add if not using autoprefixer */\n -webkit-appearance: none;\n appearance: none;\n /* For iOS < 15 to remove gradient background */\n background-color: #fff;\n /* Not removed via appearance */\n margin: 0;\n }\n\n .custom-input {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: flex-start;\n align-self: stretch;\n flex: 1 0 0;\n font-family: var(--heading-font-family, Poppins);\n }\n\n .disabled-input {\n opacity: 0.5;\n pointer-events: disable;\n }\n\n .custom-input.birthdate .date-input-container {\n display: flex;\n height: 36px;\n align-items: center;\n align-self: stretch;\n }\n\n .date-input-container .month-field,\n .date-input-container .day-field {\n flex: 0 1 50px;\n max-width: 50px;\n }\n\n .date-input-container .year-field {\n flex: 1 0 70px;\n max-width: 70px;\n }\n\n .date-input-container .date-separator {\n color: var(--accent-color, #18181B);\n font-size: 14px;\n line-height: 24px;\n margin: 0 8px;\n }\n\n .custom-input.birthdate input {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n align-items: flex-start;\n font-size: 16px;\n height: 36px;\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n padding: 4px 11px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);\n min-width: 53px;\n }\n\n .custom-input.birthdate.outlined input {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.birthdate.filled input {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input label {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n color: var(--default-text-color, #18181B);\n text-align: left;\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n font-family: var(--paragraph-font-family, Poppins);\n text-overflow: ellipsis;\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 14px;\n padding-bottom: 2px;\n margin-bottom: 6px;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .custom-input label {\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n\n .custom-input > input,\n .custom-input textarea {\n width: 100%;\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n font-size: 16px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-weight: 500;\n }\n\n .custom-input.outlined > input,\n .custom-input.outlined textarea {\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .custom-input.filled > input,\n .custom-input.filled textarea {\n background-color: var(--accent-color, #E4E4E7);\n }\n\n .custom-input input:focus,\n .custom-input textarea:focus,\n .custom-input select:focus {\n outline: none;\n border-color: var(--primary-color, #3b82f6);\n }\n\n .custom-input input:disabled,\n .custom-input select:disabled {\n cursor: not-allowed;\n }\n\n .custom-input.textarea textarea {\n height: auto;\n }\n\n .custom-input input.input-error {\n border-color: var(--error-color, #EF4444);\n }\n\n .custom-input .error-container {\n display: none;\n }\n\n .custom-input .error-container.show {\n display: block;\n margin-top: 8px;\n }\n\n .custom-input .error-message {\n color: var(--error-color, #EF4444);\n font-size: 0.875rem;\n margin-bottom: 0.25rem;\n }\n\n p > strong {\n font-weight: 700;\n }\n\n /* Alert Styles\n ** Global styles for alerts\n */\n\n .alert {\n display: flex;\n flex-direction: row;\n padding: 8px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--border-radius-rounded, 6px);\n margin-bottom: 8px;\n }\n\n .alert-warning {\n border: 1px solid var(--warning-color, #EA580C);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--warning-color, #EA580C);\n }\n\n .alert-success {\n border: 1px solid var(--success-color, #10b981);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--success-color, #10b981);\n }\n\n .alert-info {\n border: 1px solid var(--base-blue, #3b82f6);\n background: linear-gradient(0deg, var(--alpha-20, rgba(254, 254, 254, 0.80)) 0%, var(--alpha-20, rgba(254, 254, 254, 0.80)) 100%), var(--base-blue, #3b82f6);\n }\n\n .alert-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 13px;\n word-break: break-word;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n flex: 1;\n }\n\n .alert-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 50%;\n flex-shrink: 0;\n margin-right: 8px;\n }\n\n .alert-icon-warning {\n color: var(--warning-color, #EA580C);\n }\n\n .alert-icon-success {\n color: var(--success-color, #10b981);\n }\n\n .alert-icon-info {\n color: var(--base-blue, #3b82f6);\n }\n\n .alert-icon svg {\n width: 16px;\n height: 16px;\n }\n\n .alert-icon-svg {\n width: 12px;\n height: 12px;\n fill: currentColor;\n }\n\n .alert-details {\n margin-top: 8px;\n padding-left: 24px;\n }\n\n .alert-details-text {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: var(--typography-base-sizes-small-font-size, 12px);\n font-weight: var(--font-weight-normal, 400);\n opacity: 0.8;\n }\n\n /** Engraving FORM **/\n\n .engraving-form {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .engraving-form > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .engraving-form .product-info-section,\n .engraving-form .fulfillment-section,\n .engraving-form .engraving-section {\n display: flex;\n padding: 16px 16px;\n align-items: flex-start;\n align-self: stretch;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .engraving-form .product-info-section {\n gap: 16px;\n flex-direction: row;\n align-items: center;\n }\n\n .product-details-container {\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: flex-start;\n flex: 1 0 0;\n }\n\n .product-details-container > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .engraving-form .product-info-section .product-image-container {\n display: flex;\n width: 68px;\n height: 68px;\n flex-direction: column;\n align-items: flex-start;\n aspect-ratio: 1/1;\n }\n\n .engraving-form .product-info-section .product-image-container .product-image {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: var(--card-border-radius, 6px);\n }\n\n .product-details-container .product-header {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-details-container .product-title,\n .product-details-container .product-price {\n color: var(--default-text-color, #18181B);\n font-feature-settings: 'haln' on;\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px;\n }\n\n .product-details-container .product-price {\n margin-left: 4px;\n 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 gap: 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(--primary-color, #1E40AF);\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 gap: 16px;\n margin-top: 16px;\n }\n\n .engraving-input-wrapper {\n display: flex;\n height: 36px;\n padding: 4px 12px;\n align-items: center;\n gap: 4px;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);\n }\n\n .engraving-input-wrapper .engraving-input {\n flex: 1;\n border: none;\n outline: none;\n overflow: hidden;\n color: var(--default-text-color, #18181B);\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 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 gap: 16px;\n align-self: stretch;\n }\n\n .action-buttons-container .cancel-action-button {\n width: 20%;\n padding: 8px 16px;\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 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, .dark .pb-lc {\n color: #0F172A;\n }\n\n .dark .pb-text, .dark .pb-lc, .dark .pb-dot {\n color: #FAFAFA;\n }\n\n .light .pb-dot {\n color: #1D4ED8;\n }\n\n .pb-disclaimer-container {\n align-self: stretch;\n text-align: center;\n font-family: var(--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: "+m.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(--primary-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: "+m.CAROUSEL_CONTROLS+";\n display: flex;\n border-radius: 20px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 10px;\n }\n\n .carousel-dots .carousel-dot:first-child {\n margin-left: 0;\n }\n\n .carousel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n border: none;\n background: var(--accent-color, #828a97ff);\n cursor: pointer;\n transition: background-color 0.2s ease;\n }\n\n .carousel-dot.active {\n background: var(--primary-color, #3b82f6);\n }\n\n .gallery-viewport {\n display: none;\n overflow: hidden;\n width: 100%;\n height: 80px;\n flex-shrink: 0;\n margin-top: 12px;\n }\n\n .gallery-container {\n display: flex;\n cursor: grab;\n touch-action: pan-y pinch-zoom;\n }\n\n .gallery-container:active {\n cursor: grabbing;\n }\n\n .gallery-container .gallery-image-wrapper {\n margin-left: 8px;\n }\n\n .gallery-container .gallery-image-wrapper:first-child {\n margin-left: 0;\n }\n\n .gallery-image-wrapper {\n flex: 0 0 auto;\n }\n\n .gallery-image {\n width: 60px;\n height: 60px;\n object-fit: cover;\n border: 1px solid transparent;\n border-radius: var(--card-border-radius, 6px);\n cursor: pointer;\n background: var(--accent-color, #3b82f6);\n opacity: 0.5;\n transition: opacity 0.2s ease;\n user-select: none;\n -webkit-user-drag: none;\n }\n\n .gallery-image-wrapper.selected .gallery-image {\n opacity: 1;\n border-color: var(--primary-color, #3b82f6);\n }\n\n /* Small mobile screens */\n @media (min-width: 480px) {\n .carousel-dot {\n width: 8px;\n height: 8px;\n }\n\n .carousel-dots .carousel-dot {\n margin-left: 8px;\n }\n }\n\n /* Tablet and desktop */\n @media (min-width: 769px) {\n .carousel-dots {\n display: none;\n }\n\n .gallery-viewport {\n display: block;\n }\n\n .gallery-image {\n width: 80px;\n height: 80px;\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .gallery-image,\n .carousel-dot {\n transition: none;\n }\n }\n",getProductStyles=()=>"\n .product-content-wrapper {\n width: 100%;\n min-width: 320px;\n height: auto;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n }\n\n .product-content-wrapper .product-image-carousel {\n margin-right: 40px;\n }\n\n .product-content {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n position: relative;\n overflow: hidden;\n }\n\n .product-content > .product-title + .product-options:not(.hide-content) {\n margin-top: 24px;\n }\n\n @media (min-width: 769px) {\n .product-content-wrapper {\n flex-direction: row;\n align-items: stretch;\n }\n\n .product-content-wrapper.has-images .product-image-carousel {\n width: 45%;\n }\n\n .product-content-wrapper.has-images .product-content {\n width: 55%;\n }\n }\n\n .product-interactions {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .product-interactions > *:not(:first-child) {\n margin-top: 24px;\n }\n\n .size-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .size-container .size-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container {\n display: flex;\n align-items: flex-start;\n align-content: flex-start;\n align-self: stretch;\n flex-wrap: wrap;\n margin-bottom: -8px;\n }\n\n .size-container .size-buttons-container .size-button {\n display: flex;\n padding: 8px 16px;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n border-radius: var(--button-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .size-container .size-buttons-container > * {\n margin-right: 8px;\n margin-bottom: 8px;\n }\n\n .size-container .size-buttons-container > *:last-child {\n margin-right: 0;\n }\n\n .size-container .size-buttons-container .size-button.selected {\n background: var(--primary-color, #1D4ED8);\n color: var(--selected-text-color, #FAFAFA);\n border: 1px solid transparent;\n }\n\n .price-personalization-container {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n }\n\n .add-personalization-span {\n color: var(--primary-color, #1E40AF);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight:400;\n line-height: 20px;\n text-decoration-line: underline;\n text-decoration-style: solid;\n text-decoration-skip-ink: none;\n text-decoration-thickness: auto;\n text-underline-offset: auto;\n text-underline-position: from-font;\n cursor: pointer;\n }\n\n /** 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: "+m.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 }\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(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /* Product Drawer container */\n .product-drawer-container {\n width: 100%;\n height: 0;\n z-index: "+m.PRODUCT_DRAWER+";\n transform: translateX(100%);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Opened drawer state */\n .product-drawer-container.open {\n transform: translateX(0);\n height: 100%;\n }\n\n /* Expanded drawer state when address suggestions are shown */\n .product-drawer-container.open:has(.suggestions-expanded) {\n height: 230px;\n }\n\n /* Content area - fills the remaining space */\n .product-drawer-content {\n position: relative;\n display: block;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n overflow-y: auto;\n }\n\n .product-options {\n width: 100%;\n min-width: 320px;\n transform: translateX(0);\n transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);\n visibility: visible;\n height: auto;\n }\n\n .product-options.hide-content {\n transform: translateX(-100%);\n visibility: hidden;\n height: 0;\n }\n\n .product-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n .product-options-open-address-button {\n width: 100%;\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n align-self: stretch;\n border-radius: var(--button-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 1.5px 3px 0px rgba(0, 0, 0, 0.10), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);\n color: var(--selected-text-color, #FAFAFA);\n font-family: var(--heading-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n",getProductRetailersStyles=()=>"\n .product-retailers {\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n\n .retailers-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-container > *:not(:first-child) {\n margin-top: 8px;\n }\n\n /** Fulfillment Tab Container **/\n .fulfillment-tabs-container {\n display: flex;\n width: 100%;\n align-items: flex-end;\n flex-shrink: 0;\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n }\n\n .fulfillment-tabs-container .fulfillment-tab {\n display: flex;\n padding: 8px 16px;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n }\n\n .fulfillment-tabs-container .fulfillment-tab.selected {\n border-bottom: 2px solid var(--primary-color, #1D4ED8);\n margin-bottom: -1px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .fulfillment-tabs-container .fulfillment-tab .fulfillment-tab-label.selected {\n font-weight: 600;\n }\n\n /** Carousel Mode **/\n .retailers-container .carousel-fulfillment-list-container {\n display: flex;\n flex-direction: row;\n align-self: stretch;\n touch-action: pan-y pinch-zoom;\n cursor: grab;\n }\n\n .retailers-container .carousel-fulfillment-list-container.active {\n cursor: grabbing;\n }\n\n .carousel-fulfillment-list-viewport {\n overflow: hidden;\n width: 100%;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card {\n display: flex;\n width: 200px;\n min-height: 200px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n flex-shrink: 0;\n transition: all 0.2s ease;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n cursor: pointer;\n scroll-snap-align: center;\n\n -webkit-touch-callout:none;\n -webkit-user-select:none;\n -moz-user-select:none;\n -ms-user-select:none;\n user-select:none;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card:not(:first-child) {\n margin-left: 8px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.closed {\n opacity: 0.7;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n background: var(--primary-color, #1D4ED8);\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n border: 1px solid transparent;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .name {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n text-overflow: ellipsis;\n align-self: stretch;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-weight: 500;\n font-style: normal;\n line-height: 20px;\n }\n\n .retailers-container .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-header .name {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-header .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n font-weight: 400;\n text-overflow: ellipsis;\n /* Cross-browser fallback */\n max-height: 2.8em;\n line-height: 1.4;\n word-wrap: break-word;\n align-self: stretch;\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-style: normal;\n line-height: 14px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body > *:not(:first-child) {\n margin-top: 4px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .product-price {\n font-family: var(--heading-font-family, Poppins);\n font-size: 24px;\n font-style: normal;\n font-weight: 500;\n line-height: 32px;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card.selected .retailer-body .product-price {\n font-weight: 600;\n }\n\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .shipping-price,\n .carousel-fulfillment-list-container .carousel-retailer-card .retailer-body .expectation {\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n\n /************************* Popup Mode *************************/\n .retailers-container .header {\n display: flex;\n height: 36px;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .retailers-container .header .header-label {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 600;\n line-height: 100%;\n }\n\n .retailers-container .header .delivery-options {\n color: var(--primary-color, #1D4ED8);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n /** Popup Fulfillment List Container **/\n .retailers-popup-list-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n }\n\n .retailers-popup-list-container > *:not(:first-child) {\n margin-top: 16px;\n }\n\n .retailers-popup-list-container .popup-retailers-section-title {\n color: var(--default-text-color, #18181B);\n font-family: var(--heading-font-family, Poppins);\n font-size: 16px;\n font-style: normal;\n font-weight: 600;\n line-height: 24px;\n }\n\n .popup-fulfillment-list-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n align-self: stretch;\n max-height: 350px;\n }\n\n .drawer-content .popup-fulfillment-list-container {\n max-height: 100%;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card {\n width: 100%;\n display: flex;\n min-width: 216px;\n padding: 16px;\n flex-direction: column;\n align-items: flex-start;\n align-self: stretch;\n cursor: pointer;\n border-radius: var(--card-border-radius, 6px);\n border: 1px solid var(--accent-color, #E4E4E7);\n color: var(--default-text-color, #18181B);\n flex-shrink: 0;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card:not(:first-child) {\n margin-top: 16px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card > *:not(:first-child) {\n margin-top: 8px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.closed {\n opacity: 0.7;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card.selected {\n color: var(--selected-text-color, #FAFAFA);\n border-radius: var(--card-border-radius, 6px);\n background: var(--primary-color, #1D4ED8);\n border: 1px solid transparent;\n box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.06) inset;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .row {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-self: stretch;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .fee,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n text-overflow: ellipsis;\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .price {\n font-weight: 600;\n }\n\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n /* Cross-browser single-line fallback */\n white-space: nowrap;\n text-overflow: ellipsis;\n max-width: 100%;\n }\n\n /* Enhanced fallback for browsers without line-clamp */\n @supports not (-webkit-line-clamp: 1) {\n .popup-fulfillment-list-container .popup-retailer-card .name,\n .popup-fulfillment-list-container .popup-retailer-card .expectation,\n .popup-fulfillment-list-container .popup-retailer-card .address {\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .fulfillments-no-availability-message {\n color: var(--default-text-color, #18181B);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 20px;\n }\n";function getDrawerStyles(){return"\n /* Drawer wrapper container */\n .drawer-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: "+m.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: "+m.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: "+m.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: "+m.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: "+m.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 gap: 8px;\n margin-bottom: 20px;\n width: 100%;\n }\n\n .slc__title {\n height: 18px;\n background-color: #c4d1e0;\n }\n\n .slc__title-line-1 {\n width: 90%;\n }\n\n .slc__title-line-2 {\n width: 75%;\n }\n\n .slc__price {\n width: 60px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__size-price-wrapper {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n }\n\n .slc__size {\n width: 45px;\n height: 20px;\n background-color: #c4d1e0;\n }\n\n .slc__button {\n width: 100%;\n height: 42px;\n margin-top: 10px;\n background-color: var(--primary-color, #3b82f6);\n opacity: 0.7;\n }\n\n .slc__card:nth-child(1) .slc__image::before { animation-delay: 0s; }\n .slc__card:nth-child(1) .slc__title-line-1::before { animation-delay: 0.05s; }\n .slc__card:nth-child(1) .slc__title-line-2::before { animation-delay: 0.1s; }\n .slc__card:nth-child(1) .slc__price::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__size::before { animation-delay: 0.2s; }\n .slc__card:nth-child(1) .slc__button::before { animation-delay: 0.25s; }\n\n .slc__card:nth-child(2) .slc__image::before { animation-delay: 0.05s; }\n .slc__card:nth-child(2) .slc__title-line-1::before { animation-delay: 0.1s; }\n .slc__card:nth-child(2) .slc__title-line-2::before { animation-delay: 0.15s; }\n .slc__card:nth-child(2) .slc__price::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__size::before { animation-delay: 0.25s; }\n .slc__card:nth-child(2) .slc__button::before { animation-delay: 0.3s; }\n\n .slc__card:nth-child(3) .slc__image::before { animation-delay: 0.1s; }\n .slc__card:nth-child(3) .slc__title-line-1::before { animation-delay: 0.15s; }\n .slc__card:nth-child(3) .slc__title-line-2::before { animation-delay: 0.2s; }\n .slc__card:nth-child(3) .slc__price::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__size::before { animation-delay: 0.3s; }\n .slc__card:nth-child(3) .slc__button::before { animation-delay: 0.35s; }\n\n .slc__card:nth-child(4) .slc__image::before { animation-delay: 0.15s; }\n .slc__card:nth-child(4) .slc__title-line-1::before { animation-delay: 0.2s; }\n .slc__card:nth-child(4) .slc__title-line-2::before { animation-delay: 0.25s; }\n .slc__card:nth-child(4) .slc__price::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__size::before { animation-delay: 0.35s; }\n .slc__card:nth-child(4) .slc__button::before { animation-delay: 0.4s; }\n\n .slc__card:nth-child(n+5) .slc__image::before { animation-delay: 0.2s; }\n .slc__card:nth-child(n+5) .slc__title-line-1::before { animation-delay: 0.25s; }\n .slc__card:nth-child(n+5) .slc__title-line-2::before { animation-delay: 0.3s; }\n .slc__card:nth-child(n+5) .slc__price::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__size::before { animation-delay: 0.4s; }\n .slc__card:nth-child(n+5) .slc__button::before { animation-delay: 0.45s; }\n";function getPromoCodeTickerStyles(){return"\n .promo-ticker {\n display: flex;\n align-items: stretch;\n width: 100%;\n height: 30px;\n background: var(--accent-color-70, #fff);\n position: relative;\n overflow: hidden;\n }\n\n .promo-ticker__content {\n width: calc(100% - 55px);\n display: flex;\n align-items: center;\n overflow: hidden;\n position: relative;\n border-top: 1px solid var(--accent-color, #E4E4E7);\n border-bottom: 1px solid var(--accent-color, #E4E4E7);\n transition: width 0.3s ease;\n }\n\n .promo-ticker:has(.promo-ticker__cta:disabled) .promo-ticker__content {\n width: calc(100% - 60px);\n }\n\n .promo-ticker__content::before,\n .promo-ticker__content::after {\n content: '';\n position: absolute;\n top: 0;\n width: 60px;\n height: 100%;\n z-index: 2;\n pointer-events: none;\n }\n\n .promo-ticker__content::before {\n left: 0;\n background: linear-gradient(90deg, var(--accent-color-70, #fff) 0%, transparent 100%);\n }\n\n .promo-ticker__content::after {\n right: 0;\n background: linear-gradient(90deg, transparent 0%, var(--accent-color-70, #fff) 100%);\n }\n\n .promo-ticker__track {\n display: flex;\n animation: promo-scroll 30s linear infinite;\n will-change: transform;\n }\n\n .promo-ticker__content:hover .promo-ticker__track {\n animation-play-state: paused;\n }\n\n .promo-ticker__text-group {\n display: flex;\n align-items: center;\n color: var(--default-text-color, #fff);\n font-family: var(--paragraph-font-family, Poppins);\n font-size: 12px;\n font-weight: 500;\n white-space: nowrap;\n letter-spacing: 0.5px;\n text-transform: uppercase;\n }\n\n .promo-ticker__text-item {\n display: inline-flex;\n align-items: center;\n }\n\n .promo-ticker__separator {\n margin: 0 16px;\n color: var(--default-text-color, #fff);\n font-size: 12px;\n }\n\n @keyframes promo-scroll {\n 0% { transform: translateX(0); }\n 100% { transform: translateX(-50%); }\n }\n\n .promo-ticker__cta {\n width: 55px;\n height: 100%;\n background-color: var(--primary-color, #FF5733);\n color: var(--selected-text-color, #fff);\n font-family: var(--heading-font-family, Poppins);\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n user-select: none;\n position: absolute;\n right: 0;\n top: 0;\n transition: width 0.3s ease;\n }\n\n .promo-ticker__cta:disabled {\n width: 60px;\n background-color: var(--primary-color-70, #FF5733);\n cursor: not-allowed;\n }\n "}const et={"headingFont.name":"--heading-font-family","paragraphFont.name":"--paragraph-font-family",buttonCornerRadius:"--button-border-radius",cardCornerRadius:"--card-border-radius",primaryColor:"--primary-color",accentColor:"--accent-color",defaultTextColor:"--default-text-color",selectedTextColor:"--selected-text-color",errorColor:"--error-color",warningColor:"--warning-color",successColor:"--success-color",drawerBackgroundColor:"--drawer-background-color"},nt={backgroundColor:"--product-background-color"},it={backgroundColor:"--cart-background-color"},ot={backgroundColor:"--address-background-color"},rt={backgroundColor:"--checkout-background-color"},st={global:et,product:nt,cart:it,address:ot,checkout:rt};function getCSSVariableMapping(t){return st[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,n){const o={},s=getCSSVariableMapping(n);for(const[c,l]of Object.entries(s)){const n=this.getValueByPath(t,c);void 0!==n&&this.isCSSValue(n)&&(o[l]=n,this.isColorVariable(l,n)&&this.generateOpacityVariants(o,l,n))}return o}extractVariablesFromPartialTheme(t,n){const o={},s=getCSSVariableMapping(n);for(const[c,l]of Object.entries(s))if(this.hasValueAtPath(t,c)){const n=this.getValueByPath(t,c);void 0!==n&&this.isCSSValue(n)&&(o[l]=n,this.isColorVariable(l,n)&&this.generateOpacityVariants(o,l,n))}return o}generateCSSVariablesString(t){return Object.entries(t).map(([t,n])=>" "+t+": "+n+";").join("\n")}updateCSSVariablesInStylesheet(t,n){if(0!==Object.keys(n).length)try{const o=this.findOrCreateRule(t);for(const[t,s]of Object.entries(n))o.style.setProperty(t,String(s))}catch(o){this.logger.warn("Failed to update CSS variables")}}getValueByPath(t,n){return n.split(".").reduce((t,n)=>t&&void 0!==t[n]?t[n]:void 0,t)}hasValueAtPath(t,n){const o=n.split(".");let s=t;for(const c of o){if(null==s||!(c in s))return![];s=s[c]}return!![]}findOrCreateRule(t){const n=":host";for(const s of Array.from(t.cssRules))if(s instanceof CSSStyleRule&&s.selectorText===n)return s;const o=t.insertRule(n+" {}");return t.cssRules[o]}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,n,o){for(const s of this.opacityLevels){const c=n+"-"+s.suffix,l=this.addOpacityToHexColor(o,s.value);l&&(t[c]=l)}}isColorVariable(t,n){if("string"!=typeof n)return![];const o=t.toLowerCase().includes("color"),s=/^#[0-9a-f]{3,8}$/i.test(n);return o&&s}addOpacityToHexColor(t,n){if(!t.startsWith("#"))return null;let o=t.slice(1);if(3===o.length&&(o=o.split("").map(t=>t+t).join("")),6!==o.length)return null;const s=Math.round(255*n),c=s.toString(16).padStart(2,"0");return"#"+o+c}}class StylesheetGeneratorService{constructor(){this.cssProcessor=new CssVariableProcessorService,this.styleSheets=new Map}getStylesheet(t){return this.styleSheets.get(t)}generateSpecificStylesheet(t,n){const o=this.cssProcessor.extractVariablesFromTheme(n,t),s=this.cssProcessor.generateCSSVariablesString(o),c=this.getStylesheetStyles(t).join("\n\n"),l=0===s.length?"":":host { "+s+" }",d=("\n "+l+"\n\n "+c+"\n ").trim();this.createStylesheet(t,d)}createStylesheet(t,n){try{if(this.isCSSStyleSheetSupported()){const o=new CSSStyleSheet;o.replaceSync(n),this.styleSheets.set(t,o)}else this.styleSheets.set(t,n)}catch(Z){this.styleSheets.set(t,n)}}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,n,o){const s=this.styleSheets.get(t);if(s&&"string"!=typeof s){const t=this.cssProcessor.extractVariablesFromPartialTheme(n,o);this.cssProcessor.updateCSSVariablesInStylesheet(s,t)}}getStylesheetStyles(t){switch(t){case"global":return[getGlobalStyles()];case"ui":return[getDrawerStyles(),getProductLoadingStyles(),getProductListCardLoadingStyles(),getPromoCodeTickerStyles()];case"product":return[getProductStyles(),getImageCarouselStyle(),getAddressStyles(),getProductRetailersStyles(),getProductListStyles()];case"address":return[getAddressStyles()];case"cart":return[getCartStyles()];case"checkout":return[getCheckoutStyles()];default:return[]}}}class ThemeProviderService{constructor(){this.logger=LoggerFactory.get("ThemeProvider"),this.stylesheetGenerator=new StylesheetGeneratorService,this.fontManager=new FontManagerService}static getInstance(){return SingletonManager.getClassInstance("ThemeProviderService",()=>new ThemeProviderService)}async initialize(t){this.data=t,this.fontManager.loadGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),this.stylesheetGenerator.generateSpecificStylesheet("global",this.data.global.theme),this.stylesheetGenerator.generateSpecificStylesheet("ui",{}),this.stylesheetGenerator.generateSpecificStylesheet("product",this.data.product.theme),this.stylesheetGenerator.generateSpecificStylesheet("cart",this.data.cart.theme),this.stylesheetGenerator.generateSpecificStylesheet("checkout",this.data.checkout.theme),this.stylesheetGenerator.generateSpecificStylesheet("address",this.data.address.theme)}updateComponentGlobalConfigs(t){var n,o;const s=this.data.global.layout.showPoweredBy;this.data.global=this.deepMerge(this.getConfigs("global"),t),this.data.global.layout.showPoweredBy=s,((null===(n=t.theme)||void 0===n?void 0:n.headingFont)||(null===(o=t.theme)||void 0===o?void 0:o.paragraphFont))&&this.fontManager.updateGoogleFonts([this.data.global.theme.headingFont,this.data.global.theme.paragraphFont]),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("global",t.theme,"global")}updateProductComponent(t){this.data.product=this.deepMerge(this.getConfigs("product"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("product",t.theme,"product")}updateAddressComponent(t){this.data.address=this.deepMerge(this.getConfigs("address"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("address",t.theme,"address")}updateCartComponent(t){this.data.cart=this.deepMerge(this.getConfigs("cart"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("cart",t.theme,"cart")}updateCheckoutComponent(t){this.data.checkout=this.deepMerge(this.getConfigs("checkout"),t),t.theme&&this.stylesheetGenerator.updateVariablesInStylesheet("checkout",t.theme,"checkout")}getConfigs(t){return"all"===t?this.data:this.data[t]}getComponentConfig(t){return-1!==X.indexOf(t)?this.getConfigs("product"):-1!==$.indexOf(t)?this.getConfigs("address"):-1!==J.indexOf(t)?this.getConfigs("cart"):-1!==tt.indexOf(t)?this.getConfigs("checkout"):void 0}getStylesheet(t){const n=this.getBaseStylesheets();if(t===s.DRAWER){const t=[...n],o=this.stylesheetGenerator.getStylesheet("product"),s=this.stylesheetGenerator.getStylesheet("cart"),c=this.stylesheetGenerator.getStylesheet("checkout"),l=this.stylesheetGenerator.getStylesheet("address");return o&&t.push(o),s&&t.push(s),c&&t.push(c),l&&t.push(l),t}let o;if($.includes(t)||t===s.ADDRESS)o="address";else if(X.includes(t)||t===s.PRODUCT)o="product";else if(J.includes(t)||t===s.CART)o="cart";else{if(!tt.includes(t)&&t!==s.CHECKOUT)return this.logger.warn("No stylesheets found for component type: "+t+", returning base stylesheets only."),n;o="checkout"}const c=this.stylesheetGenerator.getStylesheet(o);return c?[...n,c]:n}getBaseStylesheets(){const t=[],n=this.stylesheetGenerator.getStylesheet("global"),o=this.stylesheetGenerator.getStylesheet("ui");return n&&t.push(n),o&&t.push(o),t}deepMerge(t,n){const o={...t};for(const s in n)null!==n[s]&&void 0!==n[s]&&("object"!=typeof n[s]||Array.isArray(n[s])||"object"!=typeof t[s]||Array.isArray(t[s])?o[s]=n[s]:o[s]=this.deepMerge(t[s],n[s]));return o}}class BaseCommand{constructor(){this.store=StoreService.getInstance(),this.api=ApiClientService.getInstance(),this.logger=LoggerFactory.get("BaseCommand"),this.pubSub=PubSubService.getInstance(),this.googleTagManager=GoogleTagManagerService.getInstance(),this.clientConfig=ClientConfigService.getInstance(),this.themeProvider=ThemeProviderService.getInstance()}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}const includeCartEvents=(t,n)=>t.filter(t=>n.includes(t.type)),excludeCartEvents=(t,n)=>t.filter(t=>!n.includes(t.type)),eventsForCart=t=>excludeCartEvents(t,["NewCart","ItemsRemoved","CartError","NoId","InvalidId","NoItemsInCart","RemovedExistingCartItems","PartnerProductConfigs","RetailerMinNotMet","AddressChange"]),hasCartAnyPromoCodeEvents=t=>{const n=["CouponProcessingError","CouponNotFound","CouponExpired","NoApplicableDiscount","CouponNotStarted","MinimumOrderValueNotMet","MinimumOrderUnitsNotMet","MinimumDistinctItemsNotMet","QuotaExceeded","UserLimitExceeded","NotFirstPurchase","InvalidCoupon","InvalidMembership","InvalidDomain","InvalidRequirements","InvalidOrganization","ProductNotEligible","NotEnoughPreviousOrders","RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"],o=includeCartEvents(t,n);return o.length>0},includeCheckoutEvents=(t,n)=>t.filter(t=>n.includes(t.type)),eventsForCheckout=t=>includeCheckoutEvents(t,["RetailerOnDemandHoursNotAvailable","ItemQuantityChange","MaxQuantityPerOrderExceeded"]),promoCodeCheckoutEvents=t=>includeCheckoutEvents(t,["RetailerDoesNotAllowPromos","RetailersDoNotAllowPromos"]),giftCardCheckoutEvents=t=>includeCheckoutEvents(t,["ErrorProcessingGiftCards","InvalidGiftCardCodes","InvalidGiftCardPartner","InactiveGiftCard","GiftCardAlreadyInUse","GiftCardExpired","GiftCardBalanceDepleted","RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"]),hasAnyRetailerGiftCardRestriction=t=>{const n=["RetailerDoesNotAllowGiftCards","RetailersDoNotAllowGiftCards"];return t.some(t=>n.includes(t.type))},at={OutOfStock:"error",ItemsNotAdded:"warning",ItemsRequestedNotAdded:"warning",ItemEngravingError:"error",AddressChange:"warning",LocationAvailability:"warning",PartnerProductConfigs:"warning",RemovedExistingCartItems:"warning",RetailerMinNotMet:"warning",NoItemsInCart:"warning",InvalidId:"warning",NoId:"warning",CartCheckoutProcessed:"success",NewCart:"warning",CartError:"error",ItemQuantityChange:"warning",ItemIdNotFound:"error",ItemsRemoved:"warning",CouponProcessingError:"error",CouponNotFound:"error",CouponExpired:"error",NoApplicableDiscount:"warning",CouponNotStarted:"error",MinimumOrderValueNotMet:"warning",MinimumOrderUnitsNotMet:"warning",MinimumDistinctItemsNotMet:"warning",QuotaExceeded:"error",UserLimitExceeded:"error",NotFirstPurchase:"warning",InvalidCoupon:"error",InvalidMembership:"error",InvalidDomain:"error",InvalidRequirements:"error",InvalidOrganization:"error",ProductNotEligible:"warning",NotEnoughPreviousOrders:"warning",PresaleItemsNotAllowed:"error",PresaleLimitExceeded:"error",PresaleNotStarted:"error",PresaleExpired:"error",PresaleMixedCart:"error",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning"},ct={ErrorProcessingGiftCards:"error",InvalidGiftCardCodes:"error",InvalidGiftCardPartner:"error",InactiveGiftCard:"error",GiftCardAlreadyInUse:"error",GiftCardExpired:"error",GiftCardBalanceDepleted:"error",RetailerOnDemandHoursNotAvailable:"warning",ItemQuantityChange:"warning",MaxQuantityPerOrderExceeded:"warning",RetailerDoesNotAllowPromos:"warning",RetailersDoNotAllowPromos:"warning",RetailerDoesNotAllowGiftCards:"warning",RetailersDoNotAllowGiftCards:"warning"},transformCartEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:at[t.type]||"error"})),transformCheckoutEventsRaw=t=>t.map(t=>({type:t.type,message:t.message,level:ct[t.type]||"error"})),transformEventsForCart=t=>{const n=eventsForCart(t);return transformCartEventsRaw(n)},transformEventsForCheckout=t=>{const n=eventsForCheckout(t);return transformCheckoutEventsRaw(n)},transformPromoCodeCheckoutEvents=t=>{const n=promoCodeCheckoutEvents(t);return transformCheckoutEventsRaw(n)},transformGiftCardCheckoutEvents=t=>{const n=giftCardCheckoutEvents(t);return transformCheckoutEventsRaw(n)};function buildCartItemStore(t){return{id:t.id,variantId:t.variantId,liquidId:t.liquidId,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,salsifyGrouping:t.salsifyGrouping,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price,quantity:t.quantity,maxQuantity:t.maxQuantity,unitPrice:t.unitPrice,mainImage:t.mainImage,attributes:t.attributes,loading:![],updating:![],error:null}}function buildCartTotals(t){return{subtotal:t.subtotal||0,total:t.total||0,shippingFee:t.shippingFee||0,platformFee:t.platformFee||0,giftCardTotal:t.giftCardTotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,discounts:t.discounts||0,quantity:t.quantity||0}}function buildRetailerStore(t){var n;return{id:t.id,name:t.name,platformFee:t.platformFee||0,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,address:t.address,total:t.total||0,deliveryFee:t.deliveryFee||0,engravingFee:t.engravingFee||0,fulfillments:(null===(n=t.fulfillments)||void 0===n?void 0:n.map(t=>t.id))||[]}}function buildFulfillmentStore(t,n){return{id:t.id,canEngrave:t.canEngrave||![],type:t.type,fees:t.fees,expectation:t.expectation,shippingFee:t.shippingFee||0,subtotal:t.subtotal||0,engravingFee:t.engravingFee||0,deliveryFee:t.deliveryFee||0,items:t.items||[],retailerId:n.id,loading:![],error:null,updating:![]}}function cartDataForEventFromStore(t,n){var o;const s=n.formattedAddress?n:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},c={};for(const l in t.items||{}){const n=t.items[l];c[l]={id:n.id,variantId:n.variantId,liquidId:n.liquidId,retailerId:n.retailerId,partNumber:n.partNumber,fulfillmentId:n.fulfillmentId,upc:n.upc,sku:n.sku,salsifyGrouping:n.salsifyGrouping,catPath:n.catPath,volume:n.volume,uom:n.uom,pack:n.pack,packDesc:n.packDesc,container:n.container,containerType:n.containerType,name:n.name,brand:n.brand,size:n.size,price:n.price||0,quantity:n.quantity||0,maxQuantity:n.maxQuantity||0,unitPrice:n.unitPrice||0,mainImage:n.mainImage||"",attributes:n.attributes||{}}}return{id:t.id,promoCode:(null===(o=t.promoCode)||void 0===o?void 0:o.code)||"",items:c,location:{placesId:s.id,address:{one:s.address.one,two:s.address.two,city:s.address.city,state:s.address.state,zip:s.address.zip,country:s.address.country},coordinates:{latitude:s.coordinates.lat,longitude:s.coordinates.long}},amounts:{deliveryFee:t.totals.deliveryFee,discounts:t.totals.discounts,engravingFee:t.totals.engravingFee,giftCardTotal:0,platformFee:t.totals.platformFee,shippingFee:t.totals.shippingFee,subtotal:t.totals.subtotal,total:t.totals.total},itemCount:Object.values(c||{}).reduce((t,n)=>t+(n.quantity||0),0),updatedAt:t.updatedAt,createdAt:t.createdAt}}class CommonCommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("CommonCommands",()=>new CommonCommands)}syncCartFromResponse(t,o=![]){var s,c,l,d,u,h;const m=this.store.get("cart");for(const n of Object.keys(m.items||{}))this.store.remove("cart.items."+n);for(const n of Object.keys(m.retailers||{}))this.store.remove("cart.retailers."+n);for(const n of Object.keys(m.fulfillments||{}))this.store.remove("cart.fulfillments."+n);const f={"cart.id":t.id,"cart.error":null,"cart.totals":buildCartTotals(t),"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":[],"cart.promoCode":(null===(c=null===(s=t.attributes)||void 0===s?void 0:s.promoCode)||void 0===c?void 0:c.value)?{code:t.attributes.promoCode.value.toUpperCase(),discountAmount:t.attributes.promoCode.discount||0,error:null}:null};if((null===(l=t.items)||void 0===l?void 0:l.length)>0)for(const n of t.items)f["cart.items."+n.id]=buildCartItemStore(n);if((null===(d=t.retailers)||void 0===d?void 0:d.length)>0)for(const n of t.retailers)if(f["cart.retailers."+n.id]=buildRetailerStore(n),(null===(u=n.fulfillments)||void 0===u?void 0:u.length)>0)for(const t of n.fulfillments)f["cart.fulfillments."+t.id]=buildFulfillmentStore(t,n);if((null===(h=t.events)||void 0===h?void 0:h.length)>0&&(f["cart.events"]=transformEventsForCart(t.events||[])),this.store.batch(f),o){const t=this.store.get("cart"),o=this.store.get("address");this.pubSub.publishAction(n.CART_LOADED,cartDataForEventFromStore(t,o))}}async loadCart(){try{this.store.set("cart.loading",!![]);const t=this.store.get("cart"),n=await this.api.getCartData(t.id);this.syncCartFromResponse(n,!![]),n.id!==t.id&&await this.store.persist()}catch(t){const o=(null==t?void 0:t.message)||"Failed to load cart";this.store.set("cart.error",o),this.pubSub.publishAction(n.CART_FAILED,{message:o}),this.logger.error("Load cart failed",t)}finally{this.store.set("cart.loading",![])}}}class UICommands extends BaseCommand{static getInstance(){return SingletonManager.getClassInstance("UICommands",()=>new UICommands)}openDrawer(t,o){const c={type:t,data:o||{}};this.store.set("ui.drawer",{isOpen:!![],contentConfig:c}),t===s.CART&&this.pubSub.publishAction(n.CART_OPENED,!![]),t===s.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_OPENED,!![])}closeDrawer(){this.store.set("ui.drawer.isOpen",![]);const t=this.store.get("ui.drawer.contentConfig");(null==t?void 0:t.type)===s.CART&&this.pubSub.publishAction(n.CART_CLOSED,!![]),(null==t?void 0:t.type)===s.CHECKOUT&&this.pubSub.publishAction(n.CHECKOUT_CLOSED,!![])}}class CheckoutCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.commonCommands=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CheckoutCommands",()=>new CheckoutCommands)}async loadCheckout(t){var o,s,l,d,u,h,m,f,g,v,y,b;try{this.store.set("checkout.loading",!![]);const x=t||this.store.get("cart.id"),w=this.store.get("cart");if(0===(null===(o=Object.values(w.items))||void 0===o?void 0:o.length)&&!t)return;const E=this.themeProvider.getConfigs("checkout"),_={canEmail:E.layout.emailOptIn.checked,canSms:E.layout.smsOptIn.checked};if(!x)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const T={"checkout.error":null,"checkout.onDemandFulfillmentTipInfo":{},"checkout.giftCardError":null,"checkout.promoCodeError":null,"checkout.presale":null,"checkout.updating":![]},D=await this.api.prepareCheckout({cartId:x,marketingPreferences:_});if((null===(s=D.retailers)||void 0===s?void 0:s.length)>0)for(const t of D.retailers)for(const n of t.fulfillments)n.type===c.ON_DEMAND&&(T["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal});if((null===(l=D.items)||void 0===l?void 0:l.length)>0){this.store.remove("checkout.items");for(const t of D.items){const n=D.retailers.find(n=>n.id===t.retailerId),o=n.fulfillments.find(n=>n.id===t.fulfillmentId);T["checkout.items."+t.cartItemId]=this.buildCheckoutItemStore(t,n,o)}}D.isPresaleLocked&&D.presaleExpiresAt&&(T["checkout.presale"]={isLocked:D.isPresaleLocked,expiresAt:D.presaleExpiresAt}),T["checkout.token"]=D.token,T["checkout.cartId"]=D.cartId,T["checkout.isGift"]=D.isGift,T["checkout.giftRecipientForm.data"]={firstName:((null===(u=null===(d=D.giftOptions)||void 0===d?void 0:d.recipient)||void 0===u?void 0:u.name)||"").split(" ")[0],lastName:((null===(m=null===(h=D.giftOptions)||void 0===h?void 0:h.recipient)||void 0===m?void 0:m.name)||"").split(" ")[1],email:(null===(g=null===(f=D.giftOptions)||void 0===f?void 0:f.recipient)||void 0===g?void 0:g.email)||"",phone:(null===(y=null===(v=D.giftOptions)||void 0===v?void 0:v.recipient)||void 0===y?void 0:y.phone)||"",message:(null===(b=D.giftOptions)||void 0===b?void 0:b.message)||""},T["checkout.paymentForm.billingSameAsShipping"]=D.billingSameAsShipping,T["checkout.marketingPreferences"]=D.marketingPreferences,T["checkout.giftCards"]=D.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),T["checkout.promoCode"]=D.promoCode.value?{code:D.promoCode.value,discountAmount:D.promoCode.discount}:null,T["checkout.amounts"]=D.amounts,T["checkout.events"]=D.events||[],this.store.batch(T),this.pubSub.publishAction(n.CHECKOUT_LOADED,{cartId:D.cartId})}catch(x){this.store.set("checkout.error",x.message),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:x.message})}finally{this.store.set("checkout.loading",![])}}async toggleIsGift(t){const o=this.store.get("checkout.isGift"),s=null!=t?t:!o,c={firstName:"",lastName:"",email:"",phone:"",message:""};this.store.batch({"checkout.isGift":s,"checkout.customerForm.isEditing":!![],"checkout.giftRecipientForm.isEditing":!![],"checkout.giftRecipientForm.data":c}),this.pubSub.publishAction(n.CHECKOUT_IS_GIFT_TOGGLED,{isActive:s})}async toggleBillingSameAsShipping(t){const o=this.store.get("checkout.paymentForm.billingSameAsShipping"),s=null!=t?t:!o;this.store.set("checkout.paymentForm.billingSameAsShipping",s),this.pubSub.publishAction(n.CHECKOUT_BILLING_SAME_AS_SHIPPING_TOGGLED,{isActive:s})}async toggleMarketingPreferences(t,o){const s=this.store.get("checkout.marketingPreferences."+t),c=null!=o?o:!s,l=this.store.get("checkout.marketingPreferences"),d=this.dataForCheckoutPrepare({marketingPreferences:{...l,[t]:c}}),u=await this.api.prepareCheckout(d);this.store.set("checkout.marketingPreferences",u.marketingPreferences),this.pubSub.publishAction(n.CHECKOUT_MARKETING_PREFERENCES_TOGGLED,{fieldName:t,isActive:c})}async getPaymentSession(){try{const t=this.store.get("cart.id"),n=await this.api.getPaymentSession({cartId:t});this.store.batch({"checkout.paymentForm.paymentSession":{key:n.key,secret:n.secret},"checkout.paymentForm.paymentMethod":null})}catch(t){throw this.store.batch({"checkout.error":t.message,"checkout.loading":![]}),t}}async confirmPaymentSession(t,n){var o,s;try{if((this.clientConfig.isBeta()||this.clientConfig.isDevelopment())&&this.clientConfig.get("paymentMethodId"))return{id:this.clientConfig.get("paymentMethodId"),card:{brand:"visa",last4:"1111"}};const c=await this.api.confirmPaymentSession(t,n);return c&&c.id&&c.card&&c.card.brand&&c.card.last4?{id:c.id,card:{brand:null===(o=c.card)||void 0===o?void 0:o.brand,last4:null===(s=c.card)||void 0===s?void 0:s.last4}}:(this.store.set("checkout.error","Invalid payment method information received."),null)}catch(c){return this.store.set("checkout.error","Failed to confirm payment method. Please try again."),null}}async applyPromoCode(t){var o;try{this.googleTagManager.promoCodeAttempt(t);const s=this.dataForCheckoutPrepare({}),c=await this.api.prepareCheckout({...s,promoCode:t}),l=0!==c.amounts.discounts,d=null===(o=transformPromoCodeCheckoutEvents(c.events||[]))||void 0===o?void 0:o[0];if(!l)return this.store.set("checkout.promoCodeError",d?d.message:'Code "'+t+'" does not exist'),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:(null==d?void 0:d.message)||'Code "'+t+'" does not exist'}),this.googleTagManager.promoCodeFailed(t,(null==d?void 0:d.message)||"not_applied"),void 0;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:c.amounts.discounts,newTotal:c.amounts.total}),this.googleTagManager.promoCodeApplied(t,c.amounts.discounts),await this.partialLoadCheckout({response:c})}catch(s){const o=(null==s?void 0:s.message)||"Failed to apply promo code. Please try again.";throw this.store.set("checkout.error",o),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:o}),this.googleTagManager.promoCodeFailed(t,o),s}}async removePromoCode(){var t,o;try{const s=this.dataForCheckoutPrepare({}),c=(null===(o=null===(t=this.store.get("checkout"))||void 0===t?void 0:t.promoCode)||void 0===o?void 0:o.code)||"",l=await this.api.prepareCheckout({...s,promoCode:""});if(0!==l.amounts.discounts)return this.store.set("checkout.promoCodeError","Failed to remove promo code"),void 0;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_REMOVED,{newTotal:l.amounts.total}),this.googleTagManager.promoCodeApplied(c,0),await this.partialLoadCheckout({response:l})}catch(s){const t=(null==s?void 0:s.message)||"Failed to remove promo code. Please try again.";this.store.set("checkout.error",t);const o=this.store.get("checkout.promoCode.code")||"";throw this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:t}),o&&this.googleTagManager.promoCodeFailed(o,t),s}}async clearPromoCodeError(){try{this.store.set("checkout.promoCodeError",null)}catch(Z){const n=Z.message||"Failed to clear promo code error. Please try again.";throw this.store.set("checkout.error",n),Z}}async applyGiftCard(t){var o;const s=t.trim().toUpperCase();try{this.googleTagManager.giftCardAttempt(s);const t=this.dataForCheckoutPrepare({}),c=t.giftCards||[],l=await this.api.prepareCheckout({...t,giftCards:[...c,s]}),d=null===(o=transformGiftCardCheckoutEvents(l.events||[]))||void 0===o?void 0:o[0],u=hasAnyRetailerGiftCardRestriction(l.events||[]);if(d&&(this.store.set("checkout.giftCardError",d.message),!u))return;const h=l.giftCards.find(t=>t.code.toLowerCase()===s.toLowerCase());if(!h)return this.store.set("checkout.giftCardError","Gift card could not be applied"),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:(null==d?void 0:d.message)||"Gift card could not be applied"}),this.googleTagManager.giftCardFailed(s,(null==d?void 0:d.message)||"not_applied"),void 0;this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:l.amounts.total}),this.googleTagManager.giftCardApplied(s,h.applied),await this.partialLoadCheckout({response:l})}catch(c){const t=(null==c?void 0:c.message)||"Failed to apply gift card. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:t}),this.googleTagManager.giftCardFailed(s,t),c}}async removeGiftCard(t){var o;const s=t.trim().toUpperCase();try{const t=this.dataForCheckoutPrepare({}),c=(null===(o=t.giftCards)||void 0===o?void 0:o.filter(t=>t.toLowerCase()!==s.toLowerCase()))||[],l=await this.api.prepareCheckout({...t,giftCards:c}),d=l.giftCards.find(t=>t.code.toLowerCase()===s.toLowerCase());if(d)return this.store.set("checkout.giftCardError","Failed to remove gift card: "+s),void 0;this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:l.amounts.total}),this.googleTagManager.giftCardApplied(s,0),await this.partialLoadCheckout({response:l})}catch(c){const t=(null==c?void 0:c.message)||"Failed to remove gift card. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:t}),this.googleTagManager.giftCardFailed(s,t),c}}async clearGiftCardError(){try{this.store.set("checkout.giftCardError",null)}catch(Z){throw this.store.set("checkout.error",(null==Z?void 0:Z.message)||"Failed to clear gift card error. Please try again."),Z}}openPresaleExpiredDrawer(){this.uiCommands.openDrawer(s.CHECKOUT_PRESALE_EXPIRED)}rerenderCheckout(){this.store.set("checkout.rerender",!![])}async updateCheckoutItemQuantity(t,o){var s,c,l;try{this.store.set("checkout.items."+t+".updating",!![]);const d=this.store.get("checkout.cartId"),u=this.store.get("checkout.items."+t);if(!u)throw new SDKError("Item not found");const h=u.quantity,m=u.quantity+o;if(m<1)return this.removeItem(t,!![]);const f={id:u.cartItemId,fulfillmentId:u.fulfillmentId,partNumber:u.partNumber,quantity:m},g=(null===(l=null===(c=null===(s=u.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.lines)||void 0===l?void 0:l.filter(t=>""!==t.trim()))||[];g.length>0&&(f.engravingLines=g);const v=await this.api.updateCart({id:d,items:[f],loc:this.getLocation()});this.pubSub.publishAction(o>0?n.CHECKOUT_ITEM_QUANTITY_INCREASE:n.CHECKOUT_ITEM_QUANTITY_DECREASE,{cartItemId:u.cartItemId,quantity:m,previousQuantity:h});const y=splitCategoryPath(u.catPath),b={item_id:u.liquidId,item_name:u.name,item_brand:u.brand,item_size:u.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,quantity:Math.abs(o),price:centToDollar(u.unitPrice||0),upc:u.upc,grouping_id:u.salsifyGrouping,product_id:u.liquidId};o<0?this.googleTagManager.removeFromCart(b):o>0&&this.googleTagManager.addToCart(b),await this.partialLoadCheckout({cartResponse:v})}catch(d){throw this.store.set("checkout.items."+t+".error",d.message),d}finally{this.store.set("checkout.items."+t+".updating",![])}}async removeItemEngraving(t){var o,s,c;try{const l=this.store.get("checkout.items."+t);if(!l)throw new SDKError("Item not found in checkout");if(!(null===(o=l.attributes)||void 0===o?void 0:o.engraving))return this.logger.warn("No engraving found for checkout item",{productItemId:t}),void 0;const d=(null===(c=null===(s=l.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.lines)||[],u={id:l.cartItemId,fulfillmentId:l.fulfillmentId,partNumber:l.partNumber,quantity:l.quantity,engravingLines:[]},h=this.store.get("checkout.cartId"),m=await this.api.updateCart({id:h,items:[u],loc:this.getLocation()});this.pubSub.publishAction(n.CHECKOUT_ITEM_ENGRAVING_UPDATED,{cartItemId:l.cartItemId,engravingLines:[],previousEngravingLines:d}),await this.partialLoadCheckout({cartResponse:m})}catch(l){throw this.store.set("checkout.items."+t+".error",l.message),this.logger.error("Failed to remove engraving from checkout item",{productItemId:t,error:l.message}),l}}async removeItem(t,o){var s,c,l;try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;o||this.store.set("checkout.items."+t+".updating",!![]);const d=this.store.get("checkout.cartId"),u=this.store.get("checkout.items."+t);if(!u)throw new SDKError("Item not found");const h={id:u.cartItemId,fulfillmentId:u.fulfillmentId,partNumber:u.partNumber,quantity:0},m=(null===(l=null===(c=null===(s=u.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.lines)||void 0===l?void 0:l.filter(t=>""!==t.trim()))||[];m.length>0&&(h.engravingLines=m);const f=await this.api.updateCart({id:d,items:[h],loc:this.getLocation()});this.store.remove("checkout.items."+t),this.pubSub.publishAction(n.CHECKOUT_ITEM_REMOVED,{cartItemId:u.cartItemId}),await this.partialLoadCheckout({cartResponse:f})}catch(d){throw this.store.set("checkout.items."+t+".error",d.message),d}}async updateTips(t){try{this.store.set("checkout.updating",!![]),this.store.set("checkout.tipSelection",t);const o=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},s=Object.values(o).map(n=>{const o=Math.round(n.subtotal*t/100);return{fulfillmentId:n.fulfillmentId,tip:o}}),c=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:s}));this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:s})}catch(o){throw this.store.set("checkout.error",(null==o?void 0:o.message)||"Failed to update tips. Please try again."),o}finally{this.store.set("checkout.updating",![])}}async updateFulfillmentTip(t,o){try{this.store.set("checkout.updating",!![]);const s=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},c=Object.values(s).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===t?o:n.tip})),l=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:c}));this.updateStoreFromCheckoutResponse(l),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:c})}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(t){try{this.store.set("checkout.updating",!![]);const o=this.store.get("checkout.onDemandFulfillmentTipInfo")||{},s=Object.values(o).map(n=>({fulfillmentId:n.fulfillmentId,tip:n.fulfillmentId===t?0:n.tip})),c=await this.api.prepareCheckout(this.dataForCheckoutPrepare({deliveryTips:s}));this.updateStoreFromCheckoutResponse(c),this.pubSub.publishAction(n.CHECKOUT_TIP_UPDATED,{deliveryTips:s})}catch(o){throw this.store.set("checkout.error",(null==o?void 0:o.message)||"Failed to remove fulfillment tip. Please try again."),o}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:o,customerData:s}){var c,l,d,u,h,m,f,g,v;try{this.store.set("checkout.customerForm.isSaving",!![]);const y=this.store.get("checkout.customerForm.data"),b=this.store.get("checkout.isGift"),x=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:o||void 0,customer:{...y,...s},isGift:b}),w=await this.api.prepareCheckout(x),E={id:(null===(c=w.customer)||void 0===c?void 0:c.id)||"",firstName:(null===(l=w.customer)||void 0===l?void 0:l.firstName)||"",lastName:(null===(d=w.customer)||void 0===d?void 0:d.lastName)||"",email:(null===(u=w.customer)||void 0===u?void 0:u.email)||"",phone:(null===(h=w.customer)||void 0===h?void 0:h.phone)||"",birthDate:(null===(f=null===(m=w.customer)||void 0===m?void 0:m.birthDate)||void 0===f?void 0:f.slice(0,10))||"",company:(null===(g=w.customer)||void 0===g?void 0:g.company)||""};this.store.batch({"checkout.customerForm.data":E,"checkout.customerForm.isEditing":![],"checkout.customerForm.isValid":!![],"checkout.shippingAddressTwo":w.shippingAddress.two,"checkout.deliveryInstructions":o}),this.pubSub.publishAction(n.CHECKOUT_CUSTOMER_INFORMATION_UPDATED,!![]);const _=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(_.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(v=_.promoCode)||void 0===v?void 0:v.code)||void 0)}finally{this.store.set("checkout.customerForm.isSaving",![])}}async editGiftRecipientForm(){this.store.set("checkout.giftRecipientForm.isEditing",!![])}async saveGiftRecipientForm({shippingAddressTwo:t,deliveryInstructions:o,...s}){var c,l,d,u,h,m;try{this.store.set("checkout.giftRecipientForm.isSaving",!![]);const f=this.dataForCheckoutPrepare({shippingAddressTwo:t,deliveryInstructions:o||void 0,giftRecipient:s}),g=await this.api.prepareCheckout(f),v={firstName:(null==s?void 0:s.firstName)||"",lastName:(null==s?void 0:s.lastName)||"",email:(null===(l=null===(c=g.giftOptions)||void 0===c?void 0:c.recipient)||void 0===l?void 0:l.email)||"",phone:(null===(u=null===(d=g.giftOptions)||void 0===d?void 0:d.recipient)||void 0===u?void 0:u.phone)||"",message:(null===(h=g.giftOptions)||void 0===h?void 0:h.message)||""};this.store.batch({"checkout.giftRecipientForm.data":v,"checkout.giftRecipientForm.isEditing":![],"checkout.giftRecipientForm.isValid":!![],"checkout.shippingAddressTwo":g.shippingAddress.two,"checkout.deliveryInstructions":o}),this.pubSub.publishAction(n.CHECKOUT_GIFT_INFORMATION_UPDATED,!![]);const y=this.store.get("checkout");this.googleTagManager.addShippingInfo([...Object.values(y.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],(null===(m=y.promoCode)||void 0===m?void 0:m.code)||void 0)}finally{this.store.set("checkout.giftRecipientForm.isSaving",![])}}async editPaymentForm(){this.store.set("checkout.paymentForm.isEditing",!![])}async savePaymentForm({billingFormData:t,paymentSession:o}){var s,c,l;try{this.store.set("checkout.paymentForm.isSaving",!![]);const d=this.store.get("checkout"),u={},h=(this.clientConfig.isBeta()||this.clientConfig.isDevelopment())&&this.clientConfig.get("paymentMethodId");let m=null,f=null;if(h||o){const t=await this.confirmPaymentSession((null==o?void 0:o.confirmationTokenId)||"",(null==o?void 0:o.setupIntentId)||"");if(!t)throw new Error("Failed to confirm payment method");m=t.card,f=t.id}const g=this.dataForCheckoutPrepare({billingData:t,paymentMethodId:f||void 0}),v=await this.api.prepareCheckout(g);v.payment&&m&&(u["checkout.paymentForm.paymentMethod"]={id:v.payment,card:m}),t&&v.billingAddress&&(u["checkout.paymentForm.data"]={firstName:v.billingAddress.firstName||"",lastName:v.billingAddress.lastName||"",email:v.billingAddress.email||"",phone:v.billingAddress.phone||"",company:v.billingAddress.company||"",addressOne:v.billingAddress.one||"",addressTwo:v.billingAddress.two||"",city:v.billingAddress.city||"",state:v.billingAddress.state||"",zipCode:v.billingAddress.zip||""},this.pubSub.publishAction(n.CHECKOUT_BILLING_INFORMATION_UPDATED,!![])),u["checkout.paymentForm.isEditing"]=![],u["checkout.paymentForm.isValid"]=!![],this.store.batch(u);const y=u["checkout.paymentForm.paymentMethod"]||(null===(s=d.paymentForm)||void 0===s?void 0:s.paymentMethod),b=(null===(c=null==y?void 0:y.card)||void 0===c?void 0:c.brand)?y.card.brand+" ****"+y.card.last4:"card";this.googleTagManager.addPaymentInfo(Object.values(d.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}}),b,(null===(l=d.promoCode)||void 0===l?void 0:l.code)||void 0)}catch(d){throw this.logger.error("Failed to save payment form",d),this.store.set("checkout.error",d.message),d}finally{this.store.set("checkout.paymentForm.isSaving",![])}}async checkoutComplete(){var t,o,c,l,d,u;try{this.store.set("checkout.loading",!![]),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_STARTED,{started:!![]});const h=this.store.get("checkout"),m=await this.api.checkoutComplete({token:h.token}),f=m.legacyOrderNumber||m.referenceId||"N/A";h.presale||this.store.set("cart.shouldReset",!![]),this.uiCommands.openDrawer(s.CHECKOUT_COMPLETED,{orderNumber:f,orderTotal:h.amounts.total,cardLast4:null===(c=null===(o=null===(t=null==h?void 0:h.paymentForm)||void 0===t?void 0:t.paymentMethod)||void 0===o?void 0:o.card)||void 0===c?void 0:c.last4,customerEmail:h.customerForm.data.email,giftRecipientEmail:(null===(d=null===(l=null==h?void 0:h.giftRecipientForm)||void 0===l?void 0:l.data)||void 0===d?void 0:d.email)||null}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_COMPLETED,{orderNumber:f,orderTotal:h.amounts.total}),this.googleTagManager.purchase({transaction_id:f,tax:centToDollar(h.amounts.tax||0),shipping:centToDollar(h.amounts.shipping||0),coupon:(null===(u=h.promoCode)||void 0===u?void 0:u.code)||void 0,items:[...Object.values(h.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],value:centToDollar(h.amounts.total),subtotal:centToDollar(h.amounts.subtotal),total_before_discounts:centToDollar(h.amounts.subtotal+h.amounts.tax+h.amounts.shipping+h.amounts.delivery+h.amounts.platform+h.amounts.service),discounts:centToDollar(h.amounts.discounts),gift_cards:centToDollar(h.amounts.giftCards||0),net_total:centToDollar(h.amounts.total)})}catch(h){const t=(null==h?void 0:h.message)||"Checkout complete failed";this.store.batch({"checkout.error":t}),this.pubSub.publishAction(n.CHECKOUT_SUBMIT_FAILED,{message:t})}finally{this.store.set("checkout.loading",![])}}updateStoreFromCheckoutResponse(t){var n;const o={"checkout.amounts":t.amounts,"checkout.warning":t.warning,"checkout.events":transformEventsForCheckout(t.events||[]),"checkout.error":null};if((null===(n=t.retailers)||void 0===n?void 0:n.length)>0)for(const s of t.retailers)for(const t of s.fulfillments)t.type===c.ON_DEMAND&&(o["checkout.onDemandFulfillmentTipInfo."+t.id]={retailerId:s.id,retailerName:s.name,fulfillmentId:t.id,tip:t.tip,subtotal:t.subtotal});this.store.batch(o)}async partialLoadCheckout(t){var o,s,l,d,u;try{let n;if(this.store.set("checkout.updating",!![]),(null==t?void 0:t.cartResponse)?this.commonCommands.syncCartFromResponse(t.cartResponse):await this.commonCommands.loadCart(),null==t?void 0:t.response)n=t.response;else{const s=null!==(o=null==t?void 0:t.cartId)&&void 0!==o?o:this.store.get("checkout.cartId");if(!s)return this.store.set("checkout.error","Cart ID is not provided"),void 0;const c=this.dataForCheckoutPrepare({});n=await this.api.prepareCheckout({...c,cartId:s})}const h={"checkout.token":n.token,"checkout.events":transformEventsForCheckout(n.events||[]),"checkout.amounts":n.amounts,"checkout.error":null,"checkout.promoCodeError":null,"checkout.giftCardError":null,"checkout.giftCards":n.giftCards.map(t=>({code:t.code,discountAmount:t.applied})),"checkout.promoCode":(null===(l=null===(s=null==n?void 0:n.promoCode)||void 0===s?void 0:s.value)||void 0===l?void 0:l.trim())?{code:n.promoCode.value,discountAmount:n.promoCode.discount}:null};if((null===(d=n.retailers)||void 0===d?void 0:d.length)>0){this.store.remove("checkout.onDemandFulfillmentTipInfo");for(const t of n.retailers)for(const n of t.fulfillments)n.type===c.ON_DEMAND&&(h["checkout.onDemandFulfillmentTipInfo."+n.id]={retailerId:t.id,retailerName:t.name,fulfillmentId:n.id,tip:n.tip,subtotal:n.subtotal})}if((null===(u=n.items)||void 0===u?void 0:u.length)>0){this.store.remove("checkout.items");for(const t of n.items){const o=n.retailers.find(n=>n.id===t.retailerId),s=o.fulfillments.find(n=>n.id===t.fulfillmentId);h["checkout.items."+t.cartItemId]=this.buildCheckoutItemStore(t,o,s)}}this.store.batch(h)}catch(h){const t=(null==h?void 0:h.message)||"Failed to load checkout data. Please try again.";throw this.store.set("checkout.error",t),this.pubSub.publishAction(n.CHECKOUT_FAILED,{message:t}),h}finally{this.store.set("checkout.updating",![])}}dataForCheckoutPrepare({customer:t,giftRecipient:n,billingData:o,marketingPreferences:s,shippingAddressTwo:c,deliveryInstructions:l,deliveryTips:d,paymentMethodId:u,isGift:h}){var m,f,g,v,y,b,x,w,E,_,T,D,P,F,A,z,O,N,L,R,B,q,j,U,G,V,K,H,W,Q,Z,X,$;const J=this.store.get("checkout"),tt=null!==(f=null===(m=J.paymentForm)||void 0===m?void 0:m.billingSameAsShipping)&&void 0!==f?f:!![],et={cartId:J.cartId,acceptedAccountCreation:![],hasSubstitutionPolicy:![],hasAgeVerify:!![],shippingAddressTwo:c,billingSameAsShipping:tt,marketingPreferences:s||J.marketingPreferences,promoCode:(null===(g=J.promoCode)||void 0===g?void 0:g.code)||void 0,isGift:void 0!==h?h:J.isGift,giftCards:(null===(v=null==J?void 0:J.giftCards)||void 0===v?void 0:v.map(t=>t.code))||[],deliveryTips:d||Object.values(J.onDemandFulfillmentTipInfo).map(t=>({fulfillmentId:t.fulfillmentId,tip:t.tip}))};u?et.payment=u:(null===(b=null===(y=J.paymentForm)||void 0===y?void 0:y.paymentMethod)||void 0===b?void 0:b.id)&&(et.payment=J.paymentForm.paymentMethod.id);const nt=l||J.deliveryInstructions;if(nt&&(et.deliveryInstructions=Object.values(J.items||{}).map(t=>({fulfillmentId:t.fulfillmentId,instructions:nt}))),et.customer=t?{...t,id:(null==t?void 0:t.id)||void 0}:(null===(w=null===(x=null==J?void 0:J.customerForm)||void 0===x?void 0:x.data)||void 0===w?void 0:w.email)?{id:(null===(_=null===(E=J.customerForm)||void 0===E?void 0:E.data)||void 0===_?void 0:_.id)||void 0,firstName:null===(D=null===(T=J.customerForm)||void 0===T?void 0:T.data)||void 0===D?void 0:D.firstName,lastName:null===(F=null===(P=J.customerForm)||void 0===P?void 0:P.data)||void 0===F?void 0:F.lastName,email:null===(z=null===(A=J.customerForm)||void 0===A?void 0:A.data)||void 0===z?void 0:z.email,phone:null===(N=null===(O=J.customerForm)||void 0===O?void 0:O.data)||void 0===N?void 0:N.phone,birthDate:null===(R=null===(L=J.customerForm)||void 0===L?void 0:L.data)||void 0===R?void 0:R.birthDate,company:null===(q=null===(B=J.customerForm)||void 0===B?void 0:B.data)||void 0===q?void 0:q.company}:void 0,J.isGift&&(et.giftOptions=n?{recipient:{name:((n.firstName||"")+" "+(n.lastName||"")).trim(),email:n.email||"",phone:n.phone||""},message:n.message||""}:{recipient:{name:(((null===(U=null===(j=J.giftRecipientForm)||void 0===j?void 0:j.data)||void 0===U?void 0:U.firstName)||"")+" "+((null===(V=null===(G=J.giftRecipientForm)||void 0===G?void 0:G.data)||void 0===V?void 0:V.lastName)||"")).trim(),email:(null===(H=null===(K=J.giftRecipientForm)||void 0===K?void 0:K.data)||void 0===H?void 0:H.email)||"",phone:(null===(Q=null===(W=J.giftRecipientForm)||void 0===W?void 0:W.data)||void 0===Q?void 0:Q.phone)||""},message:(null===(X=null===(Z=J.giftRecipientForm)||void 0===Z?void 0:Z.data)||void 0===X?void 0:X.message)||""}),!tt)if(o)et.billingAddress={firstName:o.firstName,lastName:o.lastName,email:o.email,phone:o.phone,company:o.company,one:o.addressOne,two:o.addressTwo,city:o.city,state:o.state,zip:o.zipCode,country:"US"};else{const t=null===($=J.paymentForm)||void 0===$?void 0:$.data;et.billingAddress={firstName:null==t?void 0:t.firstName,lastName:null==t?void 0:t.lastName,email:null==t?void 0:t.email,phone:null==t?void 0:t.phone,company:null==t?void 0:t.company,one:null==t?void 0:t.addressOne,two:null==t?void 0:t.addressTwo,city:null==t?void 0:t.city,state:null==t?void 0:t.state,zip:null==t?void 0:t.zipCode,country:"US"}}return et}buildCheckoutItemStore(t,n,o){return{liquidId:t.liquidId,variantId:t.variantId,cartItemId:t.cartItemId,retailerId:t.retailerId,fulfillmentId:t.fulfillmentId,salsifyGrouping:t.salsifyGrouping,name:t.name,catPath:t.catPath,volume:t.volume,uom:t.uom,proof:t.proof,abv:t.abv,containerType:t.containerType,container:t.container,size:t.size,pack:t.pack,packDesc:t.packDesc,mainImage:t.mainImage,brand:t.brand,partNumber:t.partNumber,upc:t.upc,sku:t.sku,price:t.price,unitPrice:t.unitPrice,quantity:t.quantity,unitTax:t.unitTax,bottleDeposits:t.bottleDeposits,attributes:t.attributes,retailerName:n.name,expectationDetail:o.expectation.detail,loading:![],updating:![],error:null}}}class CartCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.checkoutCommands=CheckoutCommands.getInstance(),this.commonCommands=CommonCommands.getInstance(),this.store.watch("cart.shouldReset",async t=>{t===!![]&&await this.resetCart()})}static getInstance(){return SingletonManager.getClassInstance("CartCommands",()=>new CartCommands)}async updateItemQuantity(t,o){try{this.store.set("cart.items."+t+".updating",!![]);const s=this.store.get("cart.id"),c=this.store.get("cart.items."+t);if(!c)throw this.logger.error("Cart item not found: "+t+" - cannot update quantity by "+o),new SDKError("Item not found");const l=c.quantity+o;if(l<1)return this.removeItem(t,!![]);const d=this.buildItemUpdate(c,l),u=await this.api.updateCart({id:s,items:[d],loc:this.getLocation()});this.syncItemsFromApiResponse(u,[t]),this.updateFulfillment(c.fulfillmentId,u),this.syncRetailersFromApiResponse(u),this.syncCartMetaFromApiResponse(u),this.pubSub.publishAction(o<0?n.CART_ITEM_QUANTITY_DECREASE:n.CART_ITEM_QUANTITY_INCREASE,{id:c.id,quantity:l,previousQuantity:c.quantity});const h=splitCategoryPath(c.catPath),m={item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:Math.abs(o),price:centToDollar(c.unitPrice||0),upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId};o<0?this.googleTagManager.removeFromCart(m):o>0&&this.googleTagManager.addToCart(m)}catch(s){throw this.store.set("cart.items."+t+".error",s.message),this.logger.error("Failed to update item quantity",s),s}finally{this.store.set("cart.items."+t+".updating",![])}}async removeItem(t,o){try{if(this.clientConfig.isBuilder())return this.logger.warn("Remove item is not available in builder mode"),void 0;o||this.store.set("cart.items."+t+".updating",!![]);const s=this.store.get("cart.id"),c=this.store.get("cart.items."+t);if(!c)throw new SDKError("Item not found");const l={itemId:c.id,fulfillmentId:c.fulfillmentId,retailerId:c.retailerId},d=this.buildItemUpdate(c,0),u=await this.api.updateCart({id:s,items:[d],loc:this.getLocation()});this.syncItemsFromApiResponse(u,[]),this.cleanupAfterItemRemoval(l,u),this.syncCartMetaFromApiResponse(u),this.pubSub.publishAction(n.CART_ITEM_REMOVED,{id:c.id});const h=splitCategoryPath(c.catPath);this.googleTagManager.removeFromCart({item_id:c.liquidId,item_name:c.name,item_brand:c.brand,item_size:c.size,item_category:h.category,item_category2:h.category2,item_category3:h.category3,quantity:c.quantity,price:centToDollar(c.unitPrice||0),upc:c.upc,grouping_id:c.salsifyGrouping,product_id:c.liquidId})}catch(s){throw this.store.set("cart.items."+t+".error",s.message),this.logger.error("Failed to remove item",s),s}}async updateItemEngraving(t,o){var s,c,l;try{const d=this.store.get("cart"),u=null===(s=d.items)||void 0===s?void 0:s[t];if(!u)throw new SDKError("Item not found");this.store.set("cart.items."+t+".updating",!![]);const h={id:u.id,fulfillmentId:u.fulfillmentId,partNumber:u.partNumber,quantity:u.quantity,engravingLines:o},m=await this.api.updateCart({id:d.id||"",items:[h],loc:this.getLocation()});this.syncItemsFromApiResponse(m,[t]),this.syncRetailersFromApiResponse(m),this.syncCartMetaFromApiResponse(m);const f=this.store.get("cart"),g=this.store.get("address");this.pubSub.publishAction(n.CART_UPDATED,{previous:cartDataForEventFromStore(d,g),current:cartDataForEventFromStore(f,g)}),this.pubSub.publishAction(n.CART_ITEM_ENGRAVING_UPDATED,{id:u.id,engravingLines:o,previousEngravingLines:(null===(l=null===(c=u.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.lines)||[]})}catch(d){throw this.store.set("cart.items."+t+".error",d.message),this.logger.error("Failed to update item engraving",d),d}finally{this.store.set("cart.items."+t+".updating",![])}}async addItem(t){var o,s;try{this.store.set("cart.loading",!![]);const c=this.store.get("cart"),l={...c},d=(null===(o=t.engravingLines)||void 0===o?void 0:o.filter(t=>""!==t.trim()))||[],u=d.length>0,h=Object.values(c.items||{}).find(n=>{var o,s,c,l,h;const m=n.fulfillmentId===t.fulfillmentId&&n.partNumber===t.partNumber;if(!m)return![];if(u){const t=(null===(s=null===(o=n.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||[];return d.join(",")===t.join(",")}return!(null===(h=null===(l=null===(c=n.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.lines)||void 0===h?void 0:h.length)}),m={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:h?t.quantity+h.quantity:t.quantity};u&&(m.engravingLines=d);const f=await this.api.updateCart({id:c.id||"",items:[m],loc:this.getLocation()}),g=null===(s=f.items)||void 0===s?void 0:s.find(t=>t.fulfillmentId===m.fulfillmentId&&t.partNumber===m.partNumber&&t.upc===m.upc);if(!g)throw new SDKError("Added item not found in cart response");this.syncItemsFromApiResponse(f,[]);const v=this.store.get("cart.fulfillments."+t.fulfillmentId);v?this.updateFulfillment(t.fulfillmentId,f):this.addNewFulfillmentAndRetailer(t.fulfillmentId,f),this.syncRetailersFromApiResponse(f),this.syncCartMetaFromApiResponse(f);const y=this.store.get("cart"),b=this.store.get("address");this.pubSub.publishAction(n.PRODUCT_ADD_TO_CART,{...t}),this.pubSub.publishAction(n.CART_ITEM_ADDED,{id:g.id,upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,engravingLines:t.engravingLines}),this.pubSub.publishAction(n.CART_UPDATED,{previous:cartDataForEventFromStore(l,b),current:cartDataForEventFromStore(y,b)});const x=splitCategoryPath(g.catPath);this.googleTagManager.addToCart({item_id:g.liquidId,item_name:g.name,item_brand:g.brand,item_size:g.size,item_category:x.category,item_category2:x.category2,item_category3:x.category3,item_type:g.type,item_subtype:g.subType,quantity:g.quantity,price:centToDollar(g.unitPrice||0),upc:g.upc,grouping_id:g.salsifyGrouping,product_id:g.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 addPresaleItem(t){var n;try{const o={upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity};(null==t?void 0:t.engravingLines)&&(null===(n=null==t?void 0:t.engravingLines)||void 0===n?void 0:n.length)>0&&(o.engravingLines=t.engravingLines);const s=await this.api.updateCart({id:"",items:[o],loc:this.getLocation()});await this.checkoutCommands.loadCheckout(s.id)}catch(o){throw this.store.set("cart.error",o.message),this.logger.error("Failed to add presale item to cart",o),o}}async handleGoToCheckout(){var t;try{this.store.set("cart.loading",!![]),await this.checkoutCommands.loadCheckout(),this.uiCommands.openDrawer(s.CHECKOUT);const n=this.store.get("cart"),o=(null===(t=n.promoCode)||void 0===t?void 0:t.code)||void 0;this.googleTagManager.beginCheckout([...Object.values(n.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})],o)}catch(n){throw this.store.set("cart.error",n.message),this.logger.error("Failed to proceed to checkout",n),n}finally{this.store.set("cart.loading",![])}}async applyPromoCode(t){var o,s,c;if(!(null==t?void 0:t.trim()))throw new SDKError("Promo code is required");const l=t.trim().toUpperCase();try{const t=this.store.get("cart.id");this.googleTagManager.promoCodeAttempt(l);const d=await this.api.updateCart({id:t,items:[],promoCode:l,loc:this.getLocation()});this.store.set("cart.totals",buildCartTotals(d)),this.store.set("cart.events",transformEventsForCart(d.events||[]));const u=(null===(c=null===(s=null===(o=d.attributes)||void 0===o?void 0:o.promoCode)||void 0===s?void 0:s.value)||void 0===c?void 0:c.toLowerCase())===l.toLowerCase();u?(this.store.set("cart.promoCode",{code:l,discountAmount:d.discounts||0}),this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{discountAmount:d.discounts||0,newTotal:d.total||0}),this.googleTagManager.promoCodeApplied(l,d.discounts||0)):(this.store.set("cart.promoCode",null),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:'Code "'+l+'" does not exist'}),this.googleTagManager.promoCodeFailed(l,'Code "'+l+'" does not exist'))}catch(d){const t=(null==d?void 0:d.message)||"Failed to apply promo code. Please try again.";throw this.store.set("cart.error",t),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:t}),this.googleTagManager.promoCodeFailed(l,t),this.logger.error("Failed to apply promo code",d),d}}async removePromoCode(){try{const t=this.store.get("cart.id"),o=await this.api.updateCart({id:t,items:[],promoCode:"",loc:this.getLocation()});this.store.batch({"cart.totals":buildCartTotals(o),"cart.promoCode":null}),this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{newTotal:o.total||0}),this.googleTagManager.promoCodeApplied("",0)}catch(t){const o=(null==t?void 0:t.message)||"Failed to remove promo code. Please try again.";this.store.set("cart.error",o);const s=this.store.get("cart.promoCode");throw this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:o}),(null==s?void 0:s.code)&&this.googleTagManager.promoCodeFailed(s.code,o),this.logger.error("Failed to remove promo code",t),t}}rerenderCart(){this.store.set("cart.rerender",!![])}async resetCart(){this.store.set("checkout",{...y,rerender:!![]}),this.store.set("cart",{...v,rerender:!![]}),await this.commonCommands.loadCart(),this.pubSub.publishAction(n.CART_RESET,!![])}getDetails(){var t;const n=this.store.get("cart"),o=this.store.get("address"),s=o.id?o:{id:"",address:{one:"",two:"",city:"",state:"",zip:"",country:""},coordinates:{lat:0,long:0}},c={};for(const l in n.items||{}){const t=n.items[l];c[l]={id:t.id,variantId:t.variantId,liquidId:t.liquidId,salsifyGrouping:t.salsifyGrouping,retailerId:t.retailerId,partNumber:t.partNumber,fulfillmentId:t.fulfillmentId,upc:t.upc,sku:t.sku,catPath:t.catPath,volume:t.volume,uom:t.uom,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,name:t.name,brand:t.brand,size:t.size,price:t.price||0,quantity:t.quantity||0,maxQuantity:t.maxQuantity||0,unitPrice:t.unitPrice||0,mainImage:t.mainImage||"",attributes:t.attributes||{}}}return{id:n.id,promoCode:(null===(t=n.promoCode)||void 0===t?void 0:t.code)||"",items:c,location:{placesId:s.id,address:{one:s.address.one,two:s.address.two,city:s.address.city,state:s.address.state,zip:s.address.zip,country:s.address.country},coordinates:{latitude:s.coordinates.lat,longitude:s.coordinates.long}},amounts:{deliveryFee:n.totals.deliveryFee,discounts:n.totals.discounts,engravingFee:n.totals.engravingFee,giftCardTotal:n.totals.giftCardTotal,platformFee:n.totals.platformFee,shippingFee:n.totals.shippingFee,subtotal:n.totals.subtotal,total:n.totals.total},itemCount:Object.values(c||{}).reduce((t,n)=>t+(n.quantity||0),0),updatedAt:n.updatedAt,createdAt:n.createdAt}}buildItemUpdate(t,n){var o,s,c;const l={id:t.id,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:n},d=(null===(c=null===(s=null===(o=t.attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.lines)||void 0===c?void 0:c.filter(t=>""!==t.trim()))||[];return d.length>0&&(l.engravingLines=d),l}syncItemsFromApiResponse(t,n=[]){var o;const s=this.store.get("cart.items")||{},c=new Set((null===(o=t.items)||void 0===o?void 0:o.map(t=>t.id))||[]);for(const d of Object.keys(s))c.has(d)||this.store.remove("cart.items."+d);const l={};for(const d of t.items)0!==n.length&&!n.includes(d.id)&&s[d.id]||(l["cart.items."+d.id]=buildCartItemStore(d));Object.keys(l).length>0&&this.store.batch(l)}syncCartMetaFromApiResponse(t){var n,o;const s={"cart.totals":buildCartTotals(t),"cart.error":null,"cart.updatedAt":t.updatedAt||(new Date).toISOString(),"cart.createdAt":t.createdAt||(new Date).toISOString(),"cart.events":transformEventsForCart(t.events||[])},c=null===(o=null===(n=t.attributes)||void 0===n?void 0:n.promoCode)||void 0===o?void 0:o.value;if(c)s["cart.promoCode"]={code:c.toUpperCase(),discountAmount:t.discounts||0};else{const t=this.store.get("cart.promoCode");(null==t?void 0:t.code)&&(s["cart.promoCode"]=null)}this.store.batch(s)}syncRetailersFromApiResponse(t){var n;if((null===(n=t.retailers)||void 0===n?void 0:n.length)>0){const n={};for(const o of t.retailers)n["cart.retailers."+o.id]=buildRetailerStore(o);this.store.batch(n)}}updateFulfillment(t,n){var o,s;const c=null===(o=n.retailers)||void 0===o?void 0:o.find(n=>{var o;return null===(o=n.fulfillments)||void 0===o?void 0:o.some(n=>n.id===t)}),l=null===(s=null==c?void 0:c.fulfillments)||void 0===s?void 0:s.find(n=>n.id===t);l&&c&&this.store.set("cart.fulfillments."+t,buildFulfillmentStore(l,c))}addNewFulfillmentAndRetailer(t,n){var o,s;const c=null===(o=n.retailers)||void 0===o?void 0:o.find(n=>{var o;return null===(o=n.fulfillments)||void 0===o?void 0:o.some(n=>n.id===t)}),l=null===(s=null==c?void 0:c.fulfillments)||void 0===s?void 0:s.find(n=>n.id===t);if(l&&c){const n={["cart.fulfillments."+t]:buildFulfillmentStore(l,c),["cart.retailers."+c.id]:buildRetailerStore(c)};this.store.batch(n)}}cleanupAfterItemRemoval(t,n){var o,s,c,l;const d=this.store.get("cart.fulfillments."+t.fulfillmentId),u=this.store.get("cart.retailers."+t.retailerId);if(!d||!u)return;const h=null===(o=n.retailers)||void 0===o?void 0:o.some(n=>{var o;return null===(o=n.fulfillments)||void 0===o?void 0:o.some(n=>n.id===t.fulfillmentId)}),m=null===(s=n.retailers)||void 0===s?void 0:s.some(n=>n.id===t.retailerId);if(h){this.updateFulfillment(t.fulfillmentId,n);const o=null===(l=n.retailers)||void 0===l?void 0:l.find(n=>n.id===t.retailerId);o&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(o))}else if(this.store.remove("cart.fulfillments."+t.fulfillmentId),m){const o=null===(c=n.retailers)||void 0===c?void 0:c.find(n=>n.id===t.retailerId);o&&this.store.set("cart.retailers."+t.retailerId,buildRetailerStore(o))}else this.store.remove("cart.retailers."+t.retailerId)}}const lt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],dt=1440;function timeToMinutes(t){const n=t.match(/^(\d{1,2}):(\d{2})$/);if(!n)throw new SDKError("Invalid time format: "+t);const o=Number.parseInt(n[1],10),s=Number.parseInt(n[2],10);if(o<0||o>47||s<0||s>59)throw new SDKError("Invalid time values: "+t);return 60*o+s}function getCurrentTimeInTimezone$1(t){var n,o,s;const c=new Date,l={timeZone:t,weekday:"long",hour:"2-digit",minute:"2-digit",hour12:![]};try{const t=new Intl.DateTimeFormat("en-US",l),d=t.formatToParts(c),u=(null===(n=d.find(t=>"weekday"===t.type))||void 0===n?void 0:n.value.toLowerCase())||"",h=(null===(o=d.find(t=>"hour"===t.type))||void 0===o?void 0:o.value)||"0",m=(null===(s=d.find(t=>"minute"===t.type))||void 0===s?void 0:s.value)||"0",f=60*Number.parseInt(h,10)+Number.parseInt(m,10);return{weekday:u,timeInMinutes:f}}catch(d){throw new SDKError("Invalid timezone: "+t)}}function format24TimeTo12(t){const n=t.match(/^(\d{1,2}):(\d{2})$/);if(!n||"object"==typeof n)return t;let o=Number.parseInt(n[1],10);const s=n[2];o>=24&&(o-=24);const c=o>=12?"PM":"AM",l=0===o?12:o>12?o-12:o;return l+":"+s+" "+c}function isWithinTimeSlot(t,n){try{const o=timeToMinutes(n.startsAt),s=timeToMinutes(n.endsAt);if(s>dt){if(t>=o||t<s-dt)return"during"}else if(s<o){if(t>=o||t<s)return"during"}else if(t>=o&&t<s)return"during";return t<o?"before":"after"}catch(o){return"after"}}function getNextOpeningTime(t,n,o=7){var s,c;const l=lt.indexOf(n);for(let u=1;u<=o;u++){const n=(l+u)%7,o=lt[n],h=t[o];if((null==h?void 0:h.active)&&h.times&&h.times.length>0)try{const t=1===u?"tomorrow":o;return"Opens "+t+" at "+format24TimeTo12(null!==(c=null===(s=null==h?void 0:h.times[0])||void 0===s?void 0:s.startsAt)&&void 0!==c?c:"")}catch(d){}}return null}function validateFulfillmentData(t){return t&&"object"==typeof t&&t.hours&&t.timezone?"string"!=typeof t.timezone?![]:!![]:![]}function getRetailerOffHours(t){var n;if(!(null==t?void 0:t.type)||(null==t?void 0:t.type)!==c.ON_DEMAND)return{message:null,isOpen:!![],isClosed:![]};if(!validateFulfillmentData(t))return{message:null,isOpen:![],isClosed:!![]};try{const{weekday:o,timeInMinutes:s}=getCurrentTimeInTimezone$1(t.timezone),c=t.hours[o];if(!(null==c?void 0:c.active)||!(null===(n=c.times)||void 0===n?void 0:n.length)){const n=getNextOpeningTime(t.hours,o);return{message:n,isOpen:![],isClosed:!![]}}for(const t of c.times){const n=isWithinTimeSlot(s,t);switch(n){case"before":return{message:"Opens at "+format24TimeTo12(t.startsAt),isOpen:![],isClosed:!![],openTime:t.startsAt,closeTime:t.endsAt};case"during":{let n=t.endsAt;const o=timeToMinutes(n);if(o>dt){const t=Math.floor(o/60)-24,s=o%60;n=t.toString().padStart(2,"0")+":"+s.toString().padStart(2,"0")}return{message:"Closes at "+format24TimeTo12(n),isOpen:!![],isClosed:![],openTime:t.startsAt,closeTime:t.endsAt}}}}const l=getNextOpeningTime(t.hours,o);return{message:l,isOpen:![],isClosed:!![]}}catch(o){return{message:null,isOpen:![],isClosed:!![]}}}class ProductCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductCommands",()=>new ProductCommands)}async createProductInstance(t,n=![]){this.store.createProductInstance(t),n&&this.store.set("products."+t+".loading",!![])}async loadMultipleProducts(t){var n;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,n)=>(t["products."+n+".loading"]=!![],t["products."+n+".error"]=null,t),{}));const o=await this.api.getProductsData(t,this.getLocation());if(!o||!o.products||0===o.products.length)return this.logger.warn("No product data found for the provided product IDs."),this.store.batch(t.reduce((t,n)=>(t["products."+n+".loading"]=![],t["products."+n+".error"]=!![],t),{})),void 0;const s=[];for(const l of o.products){const c=l.sizes.filter(n=>t.some(t=>t===(n.upc||n.id||l.salsifyGrouping))),d=t.find(t=>c.some(n=>t===n.upc||t===n.id)||t===l.salsifyGrouping),u=d||(null===(n=null==c?void 0:c[0])||void 0===n?void 0:n.upc);await this.loadProduct(u,{products:[l],retailers:o.retailers}),s.push(u)}const c=t.filter(t=>-1===s.indexOf(t));this.store.batch(c.reduce((t,n)=>(t["products."+n+".loading"]=![],t["products."+n+".error"]="Product data not found",t),{}))}async loadProduct(t,o=null){var s,c;try{const l=this.store.get("products."+t);l.loading||this.store.set("products."+t+".loading",!![]);let d=null;if(o&&(d=o),o||(d=await this.api.getProductsData([t],this.getLocation())),!d||!(null===(s=null==d?void 0:d.products)||void 0===s?void 0:s[0]))return this.store.set("products."+t+".error","Product data not found"),void 0;const u=this.loadProductStoreUpdate(d);if(!u)return this.store.set("products."+t+".error","Failed to process product data"),void 0;this.store.set("products."+t,{...u,identifier:t}),this.pubSub.publishAction(n.PRODUCT_LOADED,this.productDataForEventFromStore(t));const h=d.products[0],m=u.sizes[u.selectedSizeId||""],f=Boolean(this.getLocation()),g=u.selectedFulfillment,v=f&&(null==g?void 0:g.price)?g.price:(null===(c=u.priceInfo)||void 0===c?void 0:c.avg)||0,y=splitCategoryPath(h.catPath);this.googleTagManager.viewItem({item_id:null==m?void 0:m.id,item_name:h.name,item_brand:h.brand,item_size:null==m?void 0:m.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar(v),item_type:h.type,item_subtype:h.subType,upc:null==m?void 0:m.upc,grouping_id:h.salsifyGrouping,product_id:null==m?void 0:m.id})}catch(l){this.store.set("products."+t+".error",l.message),this.logger.error("Failed to load product data for ID "+t,l)}finally{this.store.set("products."+t+".loading",![])}}async selectSize(t,o){var s,l,d,u,h,m,f;const g=this.store.get("products."+t);let v=g.selectedFulfillmentType;const y=null===(s=g.sizes[o])||void 0===s?void 0:s.shippingFulfillments,b=null===(l=g.sizes[o])||void 0===l?void 0:l.onDemandFulfillments;let x=null,w=null;if(v!==c.SHIPPING||Object.values(y).length)if(v!==c.ON_DEMAND||Object.values(b).length){const t=v===c.SHIPPING?y:b,n=Object.values(t);x=n[0]||null,w=(null==x?void 0:x.fulfillmentId)||null}else{v=c.SHIPPING;const t=Object.values(y);x=t[0]||null,w=(null==x?void 0:x.fulfillmentId)||null}else{v=c.ON_DEMAND;const t=Object.values(b);x=t[0]||null,w=(null==x?void 0:x.fulfillmentId)||null}const E=v===c.SHIPPING?y:b,_=g.sizes[o],T=splitCategoryPath(g.catPath),D=(null==x?void 0:x.price)||(null===(d=g.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==_?void 0:_.id,item_name:g.name,item_brand:g.brand,item_size:null==_?void 0:_.size,item_category:T.category,item_category2:T.category2,item_category3:T.category3,price:centToDollar(D),item_type:g.type,item_subtype:g.subType,upc:null==_?void 0:_.upc,grouping_id:g.salsifyGrouping,product_id:null==_?void 0:_.id});const P=Object.keys(y).length>0,F=Object.keys(b).length>0,A=P||F;if(!A){const t=this.store.get("address");this.googleTagManager.productSizeNoAvailability({productId:null==_?void 0:_.id,productName:g.name,productBrand:g.brand,productCategory:T.category,productCategory2:T.category2,productCategory3:T.category3,productType:g.type,productSubtype:g.subType,productPrice:(null===(u=g.priceInfo)||void 0===u?void 0:u.avg)||0,sizeId:o,sizeName:null==_?void 0:_.size,upc:null==_?void 0:_.upc,groupingId:g.salsifyGrouping,address:(null==t?void 0:t.address)?{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""}:void 0,reason:"No fulfillments available for this size"})}this.pubSub.publishAction(n.PRODUCT_SIZE_CHANGED,{identifier:t,selectedSizeId:o,size:(null===(h=g.sizes[o])||void 0===h?void 0:h.size)||"",previousSizeId:g.selectedSizeId||"",previousSize:(null===(m=g.sizes[g.selectedSizeId])||void 0===m?void 0:m.size)||""}),this.store.batch({["products."+t+".selectedSizeId"]:o,["products."+t+".mainImage"]:(null===(f=g.sizes[o])||void 0===f?void 0:f.image)||null,["products."+t+".productHasAvailability"]:Object.keys(y).length+Object.keys(b).length>0,["products."+t+".fulfillmentHasAvailability"]:Boolean(Object.keys(E).length),["products."+t+".selectedFulfillmentType"]:v,["products."+t+".selectedFulfillment"]:x,["products."+t+".selectedFulfillmentId"]:w})}async selectFulfillment(t,o){var s,l,d;const u=this.store.get("products."+t),h=null===(s=u.sizes[u.selectedSizeId])||void 0===s?void 0:s.shippingFulfillments,m=null===(l=u.sizes[u.selectedSizeId])||void 0===l?void 0:l.onDemandFulfillments,f=u.selectedFulfillmentType===c.SHIPPING?h:m,g=f[o];this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_CHANGED,{identifier:t,selectedFulfillmentId:o,selectedFulfillmentType:u.selectedFulfillmentType,previousFulfillmentId:u.selectedFulfillmentId||"",previousFulfillmentType:u.selectedFulfillmentType});const v=u.sizes[u.selectedSizeId||""],y=splitCategoryPath(u.catPath),b=(null==g?void 0:g.price)||(null===(d=u.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==v?void 0:v.id,item_name:u.name,item_brand:u.brand,item_size:null==v?void 0:v.size,item_category:y.category,item_category2:y.category2,item_category3:y.category3,price:centToDollar(b),item_type:u.type,item_subtype:u.subType,upc:null==v?void 0:v.upc,grouping_id:u.salsifyGrouping,product_id:null==v?void 0:v.id}),this.store.batch({["products."+t+".selectedFulfillment"]:g,["products."+t+".selectedFulfillmentId"]:o,["products."+t+".quantity"]:1})}async updateQuantity(t,o){var s;const c=this.store.get("products."+t),l=c.quantity,d=l+o,u=1,h=(null===(s=null==c?void 0:c.selectedFulfillment)||void 0===s?void 0:s.stock)||5,m=Math.max(u,Math.min(h,d));this.pubSub.publishAction(o<0?n.PRODUCT_QUANTITY_DECREASE:n.PRODUCT_QUANTITY_INCREASE,{identifier:t,quantity:m,previousQuantity:l}),this.store.set("products."+t+".quantity",m)}async changeFulfillmentType(t,o){var s,l,d;const u=this.store.get("products."+t),{shippingFulfillments:h,onDemandFulfillments:m}=u.sizes[u.selectedSizeId],f=o===c.SHIPPING?h:m,g=Object.values(f);if(0===g.length){this.logger.warn("No fulfillments available for type "+o+" on product "+t);const n=this.store.get("address"),c=u.sizes[u.selectedSizeId],d=splitCategoryPath(u.catPath);return this.googleTagManager.productFulfillmentNoAvailability({productId:null==c?void 0:c.id,productName:u.name,productBrand:u.brand,productCategory:d.category,productCategory2:d.category2,productCategory3:d.category3,productType:u.type,productSubtype:u.subType,productPrice:(null===(s=u.priceInfo)||void 0===s?void 0:s.avg)||0,sizeId:null!==(l=u.selectedSizeId)&&void 0!==l?l:void 0,sizeName:null==c?void 0:c.size,fulfillmentType:o,upc:null==c?void 0:c.upc,groupingId:u.salsifyGrouping,address:(null==n?void 0:n.address)?{one:n.address.one,two:n.address.two,city:n.address.city,state:n.address.state,zip:n.address.zip,country:n.address.country||""}:void 0,reason:"No "+o+" fulfillments available for selected size"}),void 0}const v=g[0]||null,y=(null==v?void 0:v.fulfillmentId)||null;this.pubSub.publishAction(n.PRODUCT_FULFILLMENT_TYPE_CHANGED,{identifier:t,selectedFulfillmentType:o,selectedFulfillmentId:y,previousFulfillmentType:u.selectedFulfillmentType,previousFulfillmentId:u.selectedFulfillmentId,fulfillmentHasAvailability:g.length>0});const b=u.sizes[u.selectedSizeId||""],x=splitCategoryPath(u.catPath),w=(null==v?void 0:v.price)||(null===(d=u.priceInfo)||void 0===d?void 0:d.avg)||0;this.googleTagManager.viewItem({item_id:null==b?void 0:b.id,item_name:u.name,item_brand:u.brand,item_size:null==b?void 0:b.size,item_category:x.category,item_category2:x.category2,item_category3:x.category3,price:centToDollar(w),item_type:u.type,item_subtype:u.subType,upc:null==b?void 0:b.upc,grouping_id:u.salsifyGrouping,product_id:null==b?void 0:b.id}),this.store.batch({["products."+t+".selectedFulfillmentType"]:o,["products."+t+".selectedFulfillment"]:v,["products."+t+".selectedFulfillmentId"]:y,["products."+t+".fulfillmentHasAvailability"]:g.length>0})}async removeProduct(t){this.store.removeProductInstance(t)}async openProductDrawer(t,n,o){const s={type:n,data:o||{}};this.store.batch({["products."+t+".drawer.isOpen"]:!![],["products."+t+".drawer.contentConfig"]:s})}async closeProductDrawer(t){this.store.set("products."+t+".drawer.isOpen",![])}async rerenderAllProducts(){const t=this.store.getProductInstances(),n=Object.keys(t);for(const o of n)this.store.set("products."+o+".rerender",!![])}async addToCart(t,n){try{this.store.set("products."+t+".updating",!![]),this.uiCommands.openDrawer(s.CART),await this.cartCommands.addItem(n),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]});const o=this.store.get("cart");this.googleTagManager.viewCart([...Object.values(o.items||{}).map(t=>{const n=splitCategoryPath(t.catPath);return{item_id:t.liquidId,item_name:t.name,item_brand:t.brand,item_size:t.size,item_category:n.category,item_category2:n.category2,item_category3:n.category3,quantity:t.quantity,price:centToDollar(t.unitPrice||0),upc:t.upc,grouping_id:t.salsifyGrouping,product_id:t.liquidId}})])}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+t+".updating",![])}}async addPresaleToCart(t,n){try{this.store.set("products."+t+".updating",!![]),await this.cartCommands.addPresaleItem(n),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(s.CHECKOUT),this.store.batch({["products."+t+".quantity"]:1,["products."+t+".updating"]:![]})}catch(o){this.logger.error("Error adding to cart",o),this.store.set("products."+t+".updating",![])}}productDataForEventFromStore(t){const n=this.store.get("products."+t),o={},fulfillmentEventData=t=>{const n={};for(const o in t){const s=t[o];n[o]={retailerId:s.retailerId,retailerName:s.retailerName,retailerAddress:s.retailerAddress,retailerTimezone:s.timezone,price:s.price,partNumber:s.partNumber,stock:s.stock,isEngravable:s.isVariantEngravable,fulfillmentId:s.fulfillmentId,fulfillmentType:s.fulfillmentType,modalities:s.modalities||[]}}return n};for(const s in n.sizes||{}){const t=n.sizes[s];o[s]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc||"",container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.attributes.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:{engraving:t.attributes.engraving||void 0,presale:t.attributes.presale||void 0},shippingFulfillments:fulfillmentEventData(t.shippingFulfillments||{}),onDemandFulfillments:fulfillmentEventData(t.onDemandFulfillments||{})}}return{identifier:t,selectedSizeId:n.selectedSizeId||null,selectedFulfillmentId:n.selectedFulfillmentId||null,selectedFulfillmentType:n.selectedFulfillmentType,id:n.id,name:n.name,brand:n.brand,catPath:n.catPath,category:n.category,classification:n.classification,type:n.type,salsifyGrouping:n.salsifyGrouping,subType:n.subType,mainImage:n.mainImage||null,images:n.images||[],region:n.region,country:n.country,material:n.material,abv:n.abv,proof:n.proof,age:n.age,color:n.color,flavor:n.flavor,variety:n.variety,appellation:n.appellation,vintage:n.vintage,description:n.description,htmlDescription:n.htmlDescription,tastingNotes:n.tastingNotes,priceInfo:n.priceInfo||null,sizes:o}}findFirstAvailableSize(t){const n=Object.values(t);for(const o of n){const t=o.shippingFulfillments||{},n=o.onDemandFulfillments||{},s=Object.values(t).length,c=Object.values(n).length;if(s+c>0)return o.id}return null}loadProductStoreUpdate(t){var n,o,s,l,d,u,h,m,f,g,v;try{const{products:[y,...b],retailers:x}=t,w=this.themeProvider.getConfigs("product"),E={};let _=![],T=![],D="",P=null,F=w.layout.enableShippingFulfillment?c.SHIPPING:c.ON_DEMAND,A=null,z=null;const O={};if(x&&Array.isArray(x)&&x.length>0)for(const t of x)for(const n of t.fulfillments){const o={retailerName:t.name,retailerAddress:t.address||null,type:n.type,timezone:n.timezone||"",canEngrave:n.canEngrave||![],expectation:n.expectation,fees:n.fees,hours:n.hours,retailerId:t.id,fulfillmentId:n.id,fulfillmentType:n.type,isVariantEngravable:![],stock:0,price:0,partNumber:"",modalities:[]},s=getRetailerOffHours(o);s.isClosed&&!w.layout.showOffHours||(O[n.id]=o)}if(y.sizes&&Array.isArray(y.sizes)&&y.sizes.length>0)for(const t of y.sizes){const d={},u={};for(const h of t.variants){if((null===(n=null==h?void 0:h.fulfillmentTypes)||void 0===n?void 0:n.onDemand)&&""!==h.fulfillmentTypes.onDemand){const t=h.fulfillmentTypes.onDemand,n=O[t];n?u[t]={...n,isVariantEngravable:h.isEngravable,stock:h.stock,price:h.price,retailerId:h.retailerId,fulfillmentId:t,fulfillmentType:c.ON_DEMAND,modalities:[...n.modalities,...null!==(o=null==h?void 0:h.modalities)&&void 0!==o?o:[]],partNumber:h.partNumber}:this.logger.warn("No retailer info found for onDemand fulfillmentId "+t)}if((null===(s=null==h?void 0:h.fulfillmentTypes)||void 0===s?void 0:s.shipping)&&""!==h.fulfillmentTypes.shipping){const t=h.fulfillmentTypes.shipping,n=O[t];n?d[t]={...n,isVariantEngravable:h.isEngravable,stock:h.stock,price:h.price,retailerId:h.retailerId,fulfillmentId:t,fulfillmentType:c.SHIPPING,modalities:[...n.modalities,...null!==(l=null==h?void 0:h.modalities)&&void 0!==l?l:[]],partNumber:h.partNumber}:this.logger.warn("No retailer info found for shipping fulfillmentId "+t)}}E[t.id]={id:t.id,upc:t.upc,size:t.size,pack:t.pack,packDesc:t.packDesc,container:t.container,containerType:t.containerType,maxQuantityPerOrder:t.attributes.maxQuantityPerOrder||0,image:t.image,uom:t.uom,volume:t.volume,attributes:t.attributes,loading:![],error:null,shippingFulfillments:d,onDemandFulfillments:u}}const N=Object.values(E),L=this.findFirstAvailableSize(E);D=L||N[0]&&N[0].id||"",P=(null===(d=E[D])||void 0===d?void 0:d.image)||null;const R=(null===(u=E[D])||void 0===u?void 0:u.shippingFulfillments)||{},B=(null===(h=E[D])||void 0===h?void 0:h.onDemandFulfillments)||{},q=Object.values(R).length,j=Object.values(B).length;_=q+j>0;const U=F===c.SHIPPING?Object.values(R):Object.values(B);if(T=U.length>0,z=U[0]||null,A=(null==z?void 0:z.fulfillmentId)||null,!T){const t=F===c.SHIPPING?c.ON_DEMAND:c.SHIPPING,n=t===c.SHIPPING?Object.values(R):Object.values(B);n.length>0&&(F=t,z=n[0],A=(null==z?void 0:z.fulfillmentId)||null,T=!![])}if(!_){const t=this.store.get("address"),n=splitCategoryPath(y.catPath),o=E[D];this.googleTagManager.productNoAvailability({productId:null==o?void 0:o.id,productName:y.name,productBrand:y.brand,productCategory:n.category,productCategory2:n.category2,productCategory3:n.category3,productType:y.type,productSubtype:y.subType,productPrice:(null===(m=y.priceInfo)||void 0===m?void 0:m.average)||0,upc:null==o?void 0:o.upc,groupingId:y.salsifyGrouping,address:(null==t?void 0:t.address)?{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""}:void 0,reason:"No fulfillments available for any size"})}return{identifier:"",id:y.id||"",name:y.name,description:y.description,htmlDescription:y.htmlDescription,images:y.images,priceInfo:{min:(null===(f=y.priceInfo)||void 0===f?void 0:f.minimum)||0,max:(null===(g=y.priceInfo)||void 0===g?void 0:g.maximum)||0,avg:(null===(v=y.priceInfo)||void 0===v?void 0:v.average)||0},brand:y.brand,region:y.region||"",country:y.country||"",material:y.material||"",abv:y.abv||"",proof:y.proof||"",age:y.age||"",color:y.color||"",flavor:y.flavor||"",variety:y.variety||"",appellation:y.appellation||"",vintage:y.vintage||"",tastingNotes:y.tastingNotes||"",catPath:y.catPath,category:y.category,classification:y.classification,type:y.type,subType:y.subType,salsifyGrouping:y.salsifyGrouping,sizes:E,productHasAvailability:_,fulfillmentHasAvailability:T,selectedSizeId:D,mainImage:P,selectedFulfillmentType:F,selectedFulfillmentId:A,selectedFulfillment:z,drawer:{isOpen:![],contentConfig:null},error:null,loading:![],updating:![],quantity:1,rerender:![]}}catch(y){throw this.logger.error("Product data processing error",y),y}}}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 n=this.store.get("products");await this.productCommands.loadMultipleProducts(Object.keys(n)),await this.cartCommands.resetCart(),await this.store.persist()}catch(o){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==o?void 0:o.message)||"Failed to update downstream state after address change"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates,error:(null==o?void 0:o.message)||"Failed to update downstream state after address change"}),o}this.googleTagManager.addressUpdated({googlePlacesId:t.id,formattedAddress:t.formattedAddress,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},coordinates:t.coordinates}),this.pubSub.publishAction(n.ADDRESS_UPDATED,{googlePlacesId:t.id,address:{one:t.address.one,two:t.address.two,city:t.address.city,state:t.address.state,zip:t.address.zip,country:t.address.country||""},coordinates:t.coordinates,formattedAddress:t.formattedAddress})}async setAddressManually(t,o){try{const n=buildFormattedAddressString(t),s={id:"",formattedAddress:n,address:t,coordinates:o};await this.setSelectedAddress(s)}catch(s){throw this.googleTagManager.addressFailed({googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:{one:t.one,two:t.two,city:t.city,state:t.state,zip:t.zip,country:t.country||""},error:(null==s?void 0:s.message)||"Failed to set manual address"}),this.pubSub.publishAction(n.ADDRESS_FAILED,{googlePlacesId:"",formattedAddress:buildFormattedAddressString(t),address:t,coordinates:o,error:(null==s?void 0:s.message)||"Failed to set manual address"}),s}}async clearSelectedAddress(){this.store.set("address",x),this.pubSub.publishAction(n.ADDRESS_CLEARED,!![]),await this.cartCommands.resetCart();const t=this.clientConfig.get("userDeviceId");await this.api.deletePersistedStore(t),this.store.clearLocalStorage()}getDetails(){const t=this.store.get("address");return t.id?{id:t.id,formattedAddress:t.formattedAddress,address:t.address,coordinates:t.coordinates}:null}}class ProductListCommands extends BaseCommand{constructor(){super(),this.uiCommands=UICommands.getInstance(),this.cartCommands=CartCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("ProductListCommands",()=>new ProductListCommands)}async getProductList(t){var n,o;const s=t,c=this.clientConfig.getConfigs();s.entity=null!==(o=null!==(n=window.location.hostname)&&void 0!==n?n:c.partnerName)&&void 0!==o?o:void 0,s.visitorId=c.userDeviceId,s.loc=this.getLocation(),s.isLegacy=!![];const l=await this.api.catalogSearch(s);return l.products&&l.products.length>0&&this.trackViewItemList(l.products),l}async addToCart(t){try{this.uiCommands.openDrawer(s.CART),await this.cartCommands.addItem(t)}catch(n){throw this.logger.error("Error adding product to cart from product list",n),n}}async addPresaleToCart(t){try{await this.cartCommands.addPresaleItem(t),this.clientConfig.isBuilder()||this.uiCommands.openDrawer(s.CHECKOUT)}catch(n){throw this.logger.error("Error adding presale product to cart from product list",n),n}}trackViewItemList(t){if(0!==t.length)try{const n=t.map((t,n)=>({...this.convertProductToBaseItem(t),index:n+1}));this.googleTagManager.viewItemList(n,"product_list","Product List")}catch(n){this.logger.error("Error tracking view_item_list event",n)}}trackSelectItem(t){try{const n=this.convertProductToBaseItem(t);this.googleTagManager.selectItem(n,"product_list","Product List")}catch(n){this.logger.error("Error tracking select_item event",n)}}convertProductToBaseItem(t){var n,o,s;const c=null===(n=t.sizes)||void 0===n?void 0:n[0],l=null===(o=null==c?void 0:c.variants)||void 0===o?void 0:o[0],d=splitCategoryPath(t.catPath);return{item_id:null==c?void 0:c.id,item_name:t.name,item_brand:t.brand,item_size:null==c?void 0:c.size,item_category:d.category,item_category2:d.category2,item_category3:d.category3,price:(null==l?void 0:l.price)?centToDollar(l.price):(null===(s=t.priceInfo)||void 0===s?void 0:s.average)?centToDollar(t.priceInfo.average):void 0,item_type:t.type,item_subtype:t.subType,upc:null==c?void 0:c.upc,grouping_id:t.salsifyGrouping,product_id:null==c?void 0:c.id,item_list_id:"product_list",item_list_name:"Product List"}}}class CommandService{constructor(){this.ui=UICommands.getInstance(),this.address=AddressCommands.getInstance(),this.product=ProductCommands.getInstance(),this.productList=ProductListCommands.getInstance(),this.cart=CartCommands.getInstance(),this.checkout=CheckoutCommands.getInstance(),this.common=CommonCommands.getInstance()}static getInstance(){return SingletonManager.getClassInstance("CommandService",()=>new CommandService)}}class ClientActionService{constructor(){this.pendingCartParams=null,this.pendingCartOpenFlag=![],this.productActions={getDetails:t=>this.command.product.productDataForEventFromStore(t)},this.addressActions={setAddressByPlacesId:async t=>{try{if(!t||""===t.trim())throw new SDKError("Valid Google Places ID is required. Received empty or invalid value.",!![]);const n=await this.command.address.getAddressDetails(t);await this.command.address.setSelectedAddress({id:t,address:n.address,coordinates:n.coords,formattedAddress:n.formattedAddress})}catch(n){throw this.logger.error("Error setting address by placesId:",n),n}},setAddressManually:async(t,n)=>{try{if(!t||!n)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 n.lat||"number"!=typeof n.long)throw new SDKError("Coordinates must have numeric latitude and longitude. Received lat: "+typeof n.lat+", long: "+typeof n.long,!![]);if(n.lat<-90||n.lat>90)throw new SDKError("Latitude must be between -90 and 90. Received: "+n.lat,!![]);if(n.long<-180||n.long>180)throw new SDKError("Longitude must be between -180 and 180. Received: "+n.long,!![]);await this.command.address.setAddressManually(t,n)}catch(o){throw this.logger.error("Error setting manual address:",o),o}},clear:async()=>{await this.command.address.clearSelectedAddress()},getDetails:()=>this.command.address.getDetails()},this.cartActions={openCart:()=>{this.command.ui.openDrawer(s.CART)},closeCart:()=>{this.command.ui.closeDrawer()},toggleCart:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(s.CART)},addProduct:async(t,o)=>{var l,d;try{if(!t||0===t.length)return this.logger.warn("No products provided to add to cart"),void 0;const u=this.getLocation();if(void 0===u)return this.pendingCartParams=t,this.pendingCartOpenFlag=null!=o?o:![],this.logger.info("Location not available, opening address drawer before adding to cart"),this.command.ui.openDrawer(s.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;o===!![]&&this.command.ui.openDrawer(s.CART);const h=[...new Set(t.map(t=>t.identifier))],m=await this.api.getProductsData(h,u);if(!m||!m.products||0===m.products.length)return this.logger.warn("No product data found for the provided identifiers"),this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{identifiers:[],error:"No products provided"}),void 0;for(const n of t){let t=null;for(let c=0;c<m.products.length;c++){const o=m.products[c];let s=![];for(let t=0;t<o.sizes.length;t++){const c=o.sizes[t];if(c.upc===n.identifier||c.id===n.identifier||o.salsifyGrouping===n.identifier){s=!![];break}}if(s){t=o;break}}if(!t){this.logger.warn("No product found for identifier: "+n.identifier);continue}const o=t.sizes[0];if(!o){this.logger.warn("No sizes found for product: "+n.identifier);continue}if((null===(d=null===(l=null==o?void 0:o.attributes)||void 0===l?void 0:l.presale)||void 0===d?void 0:d.isActive)===!![]){this.logger.warn("Product is a presale item and cannot be added to cart: "+n.identifier),this.store.set("cart.error","Presale products cannot be added to cart");continue}let s=null;for(let l=0;l<o.variants.length;l++){const t=o.variants[l];let d=![];if(n.fulfillmentType===c.ON_DEMAND&&(d=!(!t.fulfillmentTypes||!t.fulfillmentTypes.onDemand||""===t.fulfillmentTypes.onDemand)),n.fulfillmentType===c.SHIPPING&&(d=!(!t.fulfillmentTypes||!t.fulfillmentTypes.shipping||""===t.fulfillmentTypes.shipping)),d){s=t;break}}if(!s){this.logger.warn("No supported variant found for product: "+n.identifier+" with fulfillment type: "+n.fulfillmentType),this.store.set("cart.error","Product has no availability");continue}const u=n.fulfillmentType===c.ON_DEMAND?s.fulfillmentTypes.onDemand:s.fulfillmentTypes.shipping;await this.command.cart.addItem({upc:o.upc,fulfillmentId:u,partNumber:s.partNumber,quantity:n.quantity,identifier:n.identifier})}this.clearPendingCartOperation(),this.pubSub.publishAction(n.CART_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:h}),this.logger.info("Products added to cart successfully:",h)}catch(u){throw this.logger.error("Error adding products to cart:",u),this.clearPendingCartOperation(),this.pubSub.publishAction(n.CART_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:u.message||"Failed to add products to cart"}),u}},applyPromoCode:async t=>{try{if(!t||""===t.trim())return this.logger.warn("Invalid promo code provided"),this.store.set("cart.error","Invalid promo code provided"),void 0;const o=t.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 l=this.store.get("cart.promoCode");if(l&&l.code===o)return this.logger.info("Promo code is already applied"),void 0;await this.command.cart.applyPromoCode(o);const d=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_APPLIED,{discountAmount:d.amounts.discounts,newTotal:d.amounts.total}),this.logger.info("Promo code applied successfully")}catch(o){throw this.logger.error("Failed to apply promo code:",o),this.pubSub.publishAction(n.CART_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),o}},removePromoCode:async()=>{try{const t=this.themeProvider.getConfigs("global"),o=t.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;await this.command.cart.removePromoCode();const s=this.command.cart.getDetails();this.pubSub.publishAction(n.CART_PROMO_CODE_REMOVED,{newTotal:s.amounts.total}),this.logger.info("Promo code removed successfully")}catch(t){throw this.logger.error("Failed to remove promo code:",t),t}},resetCart:async()=>{await this.command.cart.resetCart(),this.pubSub.publishAction(n.CART_RESET,!![])},getDetails:()=>this.command.cart.getDetails()},this.checkoutActions={openCheckout:()=>{this.command.ui.openDrawer(s.CHECKOUT)},closeCheckout:()=>{this.command.ui.closeDrawer()},toggleCheckout:()=>{const t=this.store.get("ui.drawer.isOpen");t?this.command.ui.closeDrawer():this.command.ui.openDrawer(s.CHECKOUT)},addProduct:async(t,o)=>{try{if(!t||0===t.length)return this.logger.warn("No products provided to add to checkout"),void 0;o===!![]&&this.command.ui.openDrawer(s.CHECKOUT);const c=t.map(t=>t.identifier);await this.cartActions.addProduct(t),await this.command.checkout.loadCheckout(),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:t.length,identifiers:c}),this.logger.info("Products added to checkout successfully:",c)}catch(c){throw this.logger.error("Error adding products to checkout:",c),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:t.map(t=>t.identifier),error:c.message||"Failed to add products to checkout"}),c}},addPresaleProduct:async t=>{var o,l;try{if(!t||"object"!=typeof t||!t.identifier)return this.logger.warn("No presale product provided to add to checkout"),void 0;const d=this.getLocation();if(void 0===d)return this.logger.info("Location not available, opening address drawer before adding presale product to checkout"),this.command.ui.openDrawer(s.ADDRESS_INPUT,{isIndependentComponent:!![]}),void 0;const u=await this.api.getProductsData([t.identifier],d);if(!u||!u.products||0===u.products.length)return this.logger.warn("No product data found for the provided presale identifier"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No product found",isPresale:!![]}),void 0;const h=u.products[0],m=h.sizes[0];if(!m)return this.logger.warn("No sizes found for presale product: "+t.identifier),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"No sizes found for product",isPresale:!![]}),void 0;if((null===(l=null===(o=null==m?void 0:m.attributes)||void 0===o?void 0:o.presale)||void 0===l?void 0:l.isActive)!==!![])return this.logger.warn("Product is not a presale item: "+t.identifier),this.store.set("checkout.error","Product is not available for presale"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Product is not available for presale",isPresale:!![]}),void 0;let f=null;for(let n=0;n<m.variants.length;n++){const o=m.variants[n];let s=![];if(t.fulfillmentType===c.ON_DEMAND&&(s=!(!o.fulfillmentTypes||!o.fulfillmentTypes.onDemand||""===o.fulfillmentTypes.onDemand)),t.fulfillmentType===c.SHIPPING&&(s=!(!o.fulfillmentTypes||!o.fulfillmentTypes.shipping||""===o.fulfillmentTypes.shipping)),s){f=o;break}}if(!f)return this.logger.warn("No supported variant found for presale product: "+t.identifier+" with fulfillment type: "+t.fulfillmentType),this.store.set("checkout.error","Presale product has no availability"),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:"Presale product has no availability",isPresale:!![]}),void 0;const g=t.fulfillmentType===c.ON_DEMAND?f.fulfillmentTypes.onDemand:f.fulfillmentTypes.shipping;await this.command.cart.addPresaleItem({upc:m.upc,fulfillmentId:g,partNumber:f.partNumber,quantity:t.quantity,engravingLines:[],identifier:t.identifier}),this.command.ui.openDrawer(s.CHECKOUT),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_SUCCESS,{itemsAdded:1,identifiers:[t.identifier],isPresale:!![]}),this.logger.info("Presale product added to checkout successfully: "+t.identifier)}catch(d){throw this.logger.error("Error adding presale product to checkout:",d),this.pubSub.publishAction(n.CHECKOUT_PRODUCT_ADD_FAILED,{identifiers:[t.identifier],error:d.message||"Failed to add presale product to checkout",isPresale:!![]}),d}},applyPromoCode:async t=>{var o;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 s=t.trim().toUpperCase(),c=this.themeProvider.getConfigs("global"),l=c.layout.allowPromoCodes;if(!l)return this.logger.warn("Promo codes are not allowed"),this.store.set("checkout.error","Promo codes are not allowed"),void 0;const d=this.store.get("checkout.promoCode");if(d&&d.code===s)return this.logger.info("Promo code is already applied"),void 0;await this.command.checkout.applyPromoCode(t);const u=this.store.get("checkout"),h=null==u?void 0:u.promoCode;this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_APPLIED,{discountAmount:(null==h?void 0:h.discountAmount)||0,newTotal:(null===(o=null==u?void 0:u.amounts)||void 0===o?void 0:o.total)||0}),this.logger.info("Checkout promo code applied successfully")}catch(s){throw this.logger.error("Failed to apply checkout promo code:",s),this.pubSub.publishAction(n.CHECKOUT_PROMO_CODE_FAILED,{error:"Promo code could not be applied"}),s}},removePromoCode:async()=>{var t;try{const o=this.themeProvider.getConfigs("global"),s=o.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(n.CHECKOUT_PROMO_CODE_REMOVED,{newTotal:(null===(t=null==c?void 0:c.amounts)||void 0===t?void 0:t.total)||0}),this.logger.info("Checkout promo code removed successfully")}catch(o){throw this.logger.error("Failed to remove checkout promo code:",o),o}},applyGiftCard:async t=>{var o;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(t);const l=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_APPLIED,{newTotal:(null===(o=null==l?void 0:l.amounts)||void 0===o?void 0:o.total)||0}),this.logger.info("Gift card applied successfully")}catch(s){throw this.logger.error("Failed to apply gift card:",s),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be applied"}),s}},removeGiftCard:async t=>{var o;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(t);const l=this.store.get("checkout");this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_REMOVED,{newTotal:(null===(o=null==l?void 0:l.amounts)||void 0===o?void 0:o.total)||0}),this.logger.info("Gift card removed successfully")}catch(s){throw this.logger.error("Failed to remove gift card:",s),this.pubSub.publishAction(n.CHECKOUT_GIFT_CARD_FAILED,{error:"Gift card could not be removed"}),s}},toggleIsGift:async t=>{await this.command.checkout.toggleIsGift(t)},toggleBillingSameAsShipping:async t=>{await this.command.checkout.toggleBillingSameAsShipping(t)},toggleMarketingPreferences:(t,n)=>{this.command.checkout.toggleMarketingPreferences(t,n)},getDetails:()=>{var t,n,o;const s=this.store.get("checkout"),c=s.items||{},l={};for(const[d,u]of Object.entries(c))l[d]={liquidId:u.liquidId,variantId:u.variantId,cartItemId:d,retailerId:u.retailerId,fulfillmentId:u.fulfillmentId,salsifyGrouping:u.salsifyGrouping,name:u.name,catPath:u.catPath,volume:u.volume,uom:u.uom,proof:u.proof,abv:u.abv,containerType:u.containerType,container:u.container,size:u.size,pack:u.pack,packDesc:u.packDesc,mainImage:u.mainImage,brand:u.brand,partNumber:u.partNumber,upc:u.upc,sku:u.sku,price:u.price,unitPrice:u.unitPrice,quantity:u.quantity,unitTax:u.unitTax,bottleDeposits:u.bottleDeposits,attributes:u.attributes,retailerName:u.retailerName,expectationDetail:u.expectationDetail};return{cartId:s.cartId||"",isGift:s.isGift||![],billingSameAsShipping:s.paymentForm.billingSameAsShipping,marketingPreferences:{canEmail:(null===(t=s.marketingPreferences)||void 0===t?void 0:t.canEmail)||![],canSms:(null===(n=s.marketingPreferences)||void 0===n?void 0:n.canSms)||![]},hasPromoCode:!!(null===(o=s.promoCode)||void 0===o?void 0:o.code),hasGiftCards:Array.isArray(s.giftCards)&&s.giftCards.length>0,itemCount:Object.values(l||{}).reduce((t,n)=>t+(n.quantity||0),0),amounts:s.amounts,items:l}}},this.actions={product:this.productActions,address:this.addressActions,cart:this.cartActions,checkout:this.checkoutActions},this.store=StoreService.getInstance(),this.command=CommandService.getInstance(),this.api=ApiClientService.getInstance(),this.pubSub=PubSubService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.logger=LoggerFactory.get("ClientAction"),this.setupAddressUpdateListener()}static getInstance(){return SingletonManager.getClassInstance("ClientActionService",()=>new ClientActionService)}setupAddressUpdateListener(){const p=async()=>{this.pendingCartParams&&(this.logger.info("Address updated, retrying pending cart operation"),await this.retryPendingCartOperation())};window.addEventListener("lce:actions."+n.ADDRESS_UPDATED,p)}async retryPendingCartOperation(){if(this.pendingCartParams)try{const t=this.pendingCartParams,n=this.pendingCartOpenFlag;this.clearPendingCartOperation(),await this.cartActions.addProduct(t,n)}catch(t){this.logger.error("Failed to retry cart operation after address update",t)}}clearPendingCartOperation(){this.pendingCartParams=null,this.pendingCartOpenFlag=![]}getLocation(){const t=this.store.get("address");if(t.address.one&&t.coordinates.long&&t.coordinates.lat)return{coords:t.coordinates,address:t.address}}}const ut="\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1;\n margin: 0 12px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n gap: 12px;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 2px;\n min-width: 50px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n gap: 8px;\n flex-wrap: wrap;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n gap: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n gap: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n",ht="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,n=t.instances;if(n)for(const[s,c]of n)this.interceptLoggerInstance(c,s);const o=LoggerFactory.get.bind(LoggerFactory);LoggerFactory.get=t=>{const n=o(t);return this.interceptLoggerInstance(n,t),n}}interceptLoggerInstance(t,n){if(t.o)return;const o=t.debug.bind(t),s=t.info.bind(t),c=t.warn.bind(t),l=t.error.bind(t),I=(t,o,s)=>({id:"logger_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"logger",level:t,message:o,data:s,context:n});t.debug=(t,n)=>{o(t,n),this.addLogEntry(I("debug",t,n))},t.info=(t,n)=>{s(t,n),this.addLogEntry(I("info",t,n))},t.warn=(t,n)=>{c(t,n),this.addLogEntry(I("warn",t,n))},t.error=(t,n)=>{l(t,n),this.addLogEntry(I("error",t,n))},t.o=!![]}interceptPubSubEvents(){const t=PubSubService.getInstance(),n=t.publishAction.bind(t);t.publishAction=(t,o)=>{n(t,o),this.addLogEntry({id:"action_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"event",level:"info",message:"Action: "+t,data:o,context:"PubSub"})};const o=t.publishForm.bind(t);t.publishForm=(t,n)=>{o(t,n),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:n,context:"PubSub"})}}interceptGtmEvents(){const t=GoogleTagManagerService.getInstance(),n=t.executeEvent.bind(t);t.executeEvent=(t,o,s)=>{n(t,o,s),this.addLogEntry({id:"gtm_"+Date.now()+"_"+Math.random().toString(36).slice(2,9),timestamp:Date.now(),type:"gtm",level:"info",message:"GTM Event: "+o,data:s,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 n=this.createLogElement(t);this.logContainer.appendChild(n)}),this.logContainer.scrollTop=this.logContainer.scrollHeight}clearLogs(){this.logs=[],this.renderLogs()}createPanel(){const t=document.querySelector(ht);t&&t.remove(),this.panelElement=document.createElement(ht);const n=window.innerWidth<=768,o=window.innerWidth<=480;o?(this.panelElement.style.top="10px",this.panelElement.style.left="10px",this.panelElement.style.width="calc(100vw - 20px)",this.panelElement.style.height="40vh"):n?(this.panelElement.style.top="15px",this.panelElement.style.left="15px",this.panelElement.style.width="calc(100vw - 30px)",this.panelElement.style.height="40vh"):(this.panelElement.style.top="20px",this.panelElement.style.left="20px",this.panelElement.style.width="500px",this.panelElement.style.height="600px"),this.createPanelContent(),document.body.appendChild(this.panelElement),this.isVisible=!![]}createPanelContent(){if(!this.panelElement)return;const t=this.panelElement.attachShadow({mode:"closed"}),n=document.createElement("style");n.textContent=ut,t.appendChild(n),this.floatingButton=this.createFloatingButton(),t.appendChild(this.floatingButton),this.panelContainer=document.createElement("div"),this.panelContainer.className="panel";const o=this.createHeader();this.panelContainer.appendChild(o);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),t.appendChild(this.panelContainer),this.setupShadowEventListeners(t)}createHeader(){const t=document.createElement("div");t.className="header",t.title="Drag to move panel";const n=document.createElement("div");n.className="icon",n.innerHTML="🔍",n.title="Elements Debug Console",n.style.cursor="help";const o=document.createElement("div");o.className="title-container";const 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",o.appendChild(s),o.appendChild(c);const l=document.createElement("button");return l.className="minimize",l.innerHTML="−",l.title="Minimize debug panel",l.addEventListener("click",()=>this.toggleVisibility()),t.appendChild(n),t.appendChild(o),t.appendChild(l),t}createToggles(){const t=document.createElement("div");t.className="toggles";const n=[{key:"showLogs",label:"Logs",description:"SDK internal logs and debug messages",color:"#8b5cf6"},{key:"showEvents",label:"Events",description:"User actions and form interactions",color:"#10b981"},{key:"showGtmEvents",label:"GTM Events",description:"Google Tag Manager tracking events",color:"#f59e0b"}];n.forEach(({key:n,label:o,description:s,color:c})=>{const l=document.createElement("label");l.className="toggle",l.title=s;const d=document.createElement("input");d.type="checkbox",d.checked="showLogs"!==n,d.addEventListener("change",t=>{const o=t.target;"showEvents"===n&&(this.showEvents=o.checked),"showGtmEvents"===n&&(this.showGtmEvents=o.checked),"showLogs"===n&&(this.showLogs=o.checked),this.renderLogs()});const u=document.createElement("span");u.textContent=o,u.style.color=c,l.appendChild(d),l.appendChild(u),t.appendChild(l)});const o=document.createElement("button");return o.className="clear-btn",o.innerHTML="🗑️",o.title="Clear all logs",o.addEventListener("click",()=>this.clearLogs()),t.appendChild(o),t}createResizeHandle(){const t=document.createElement("div");t.className="resize-handle",t.title="Drag to resize panel",t.style.cursor="nw-resize";let n=![],o=0,s=0,c=0,l=0;t.addEventListener("mousedown",t=>{n=!![],o=t.clientX,s=t.clientY,c=Number.parseInt(this.panelElement.style.width,10)||500,l=Number.parseInt(this.panelElement.style.height,10)||300,document.addEventListener("mousemove",r),document.addEventListener("mouseup",M),t.preventDefault()});const r=t=>{if(!n||!this.panelElement)return;const d=t.clientX-o,u=t.clientY-s,h=window.innerWidth<=768,m=window.innerWidth<=480;let f,g,v,y;m?(f=280,g=window.innerWidth-20,v=200,y=.4*window.innerHeight):h?(f=300,g=window.innerWidth-30,v=200,y=.4*window.innerHeight):(f=300,g=800,v=200,y=600);const b=Math.max(f,Math.min(g,c+d)),x=Math.max(v,Math.min(y,l+u));this.panelElement.style.width=b+"px",this.panelElement.style.height=x+"px"},M=()=>{n=![],document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",M)};return t}setupShadowEventListeners(t){if(!this.panelElement)return;const n=t.querySelector(".header");if(n){let t=![],o=0,s=0,c=0,l=0;n.addEventListener("mousedown",n=>{if(n.target.classList.contains("minimize"))return;t=!![],o=n.clientX,s=n.clientY;const d=this.panelElement.getBoundingClientRect();c=d.left,l=d.top,document.addEventListener("mousemove",r),document.addEventListener("mouseup",M),n.preventDefault()});const r=n=>{if(!t||!this.panelElement)return;const d=n.clientX-o,u=n.clientY-s;this.panelElement.style.left=c+d+"px",this.panelElement.style.top=l+u+"px",this.panelElement.style.right="auto",this.panelElement.style.bottom="auto"},M=()=>{t=![],document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",M)}}}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 n=document.createElement("div");n.className="log-entry "+t.type+" "+t.level;const o=new Date(t.timestamp).toLocaleTimeString();return n.innerHTML='\n <div class="log-meta">\n <div class="log-type '+t.type+'">'+t.type.toUpperCase()+'</div>\n <div class="log-timestamp">'+o+'</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 ",n}formatJsonData(t){try{return"object"==typeof t&&null!==t?JSON.stringify(t,null,2):String(t)}catch(n){return String(t)}}escapeHtml(t){const n=document.createElement("div");return n.textContent=t,n.innerHTML}}class FingerPrintService{constructor(){this.isLocalStorageAvailable=null,this.cachedFingerprint=null,this.clientConfig=ClientConfigService.getInstance()}static getInstance(){return SingletonManager.getClassInstance("FingerPrintService",()=>new FingerPrintService)}async getId(t){if(this.l()){const n=this.u(t);if(n)return this.h(t,n)}return this.cachedFingerprint||(this.cachedFingerprint=this.m()),this.h(t,this.cachedFingerprint)}getFingerprintData(){return{screen:this.v(),browser:this.C(),timezone:this.k()}}isLocalStorageWebApiAvailable(){return this.l()}h(t,n){return(t+"_"+n).toLowerCase()}l(){if(null!==this.isLocalStorageAvailable)return this.isLocalStorageAvailable;try{0;const t=window.localStorage,n="__localStorage_test_"+Date.now()+"__",o="test";t.setItem(n,o);const s=t.getItem(n);return s!==o?(this.isLocalStorageAvailable=![],![]):(t.removeItem(n),this.isLocalStorageAvailable=!![],!![])}catch(t){const o=t instanceof DOMException&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name);if(o)try{const t=window.localStorage;return t&&t.length>0?(this.S()&&console.warn("localStorage is full in webview environment - consider data cleanup"),this.isLocalStorageAvailable=!![],!![]):(console.warn("localStorage reports zero quota - likely Safari private mode or similar restriction"),this.isLocalStorageAvailable=![],![])}catch(n){return this.isLocalStorageAvailable=![],![]}if(this.isLocalStorageAvailable=![],t instanceof DOMException){const n={SecurityError:"Access denied due to security policies (third-party cookies, Firefox cookie settings, or iframe restrictions)",InvalidStateError:"Invalid state error",InvalidAccessError:"Invalid access to storage",NotFoundError:"Storage not found"},o=n[t.name]||"Storage error: "+t.name,s=this.S()?"webview":"browser";console.warn("localStorage unavailable in "+s+": "+o)}else console.warn("localStorage unavailable:",t.message||"Unknown error");return![]}}u(t){try{const n=this.clientConfig.get("localStorageKeyPrefix")+"_"+t.toLowerCase()+"_";for(let t=0;t<localStorage.length;t++){const o=localStorage.key(t);if(null==o?void 0:o.startsWith(n)){const t=o.substring(n.length);if(t&&/^[a-f0-9]+$/.test(t))return t}}return null}catch(n){return null}}m(){const t=this.getFingerprintData(),n=Object.keys(t).sort().map(n=>n+":"+t[n]).join("|");return this._(n)}v(){try{const t=screen,n=t.colorDepth||24,o=t.pixelDepth||n,s=this.T(),c=Math.round(100*(window.devicePixelRatio||1));return n+"|"+o+"|"+s+"|"+c}catch(t){return"24|24|srgb|100"}}T(){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(Z){}return"srgb"}C(){var t;try{const n=navigator,o=[],s=((null===(t=n.languages)||void 0===t?void 0:t[0])||n.language||"en").substring(0,2);o.push(s),o.push(n.hardwareConcurrency||4);const c=(n.platform||"unknown").toLowerCase().replace(/\s+/g,"_").substring(0,10);o.push(c),o.push(n.cookieEnabled?"1":"0"),o.push(n.maxTouchPoints||0),o.push(n.deviceMemory||0),o.push(this.D()),o.push(this.S()?"webview":"browser");const l=["bluetooth"in n?"1":"0","usb"in n?"1":"0","mediaDevices"in n?"1":"0","permissions"in n?"1":"0","credentials"in n?"1":"0","storage"in n?"1":"0","ServiceWorker"in window?"1":"0","PushManager"in window?"1":"0"];return o.push(l.join("")),o.join("|")}catch(n){return"en|4|unknown|1|0|0|unknown|webview|00000000"}}D(){try{const t=navigator.userAgent.toLowerCase();return t.includes("instagram")?"ig_webview":t.includes("fban")||t.includes("fbav")?"fb_webview":t.includes("tiktok")?"tiktok_webview":t.includes("linkedin")?"linkedin_webview":t.includes("snapchat")?"snapchat_webview":t.includes("twitter")?"twitter_webview":t.includes("line/")?"line_webview":t.includes("micromessenger")?"wechat_webview":t.includes("firefox")?"gecko":t.includes("edg/")?"edge":t.includes("opr/")||t.includes("opera")?"opera":t.includes("chrome")&&!t.includes("edg")?"blink":t.includes("safari")&&!t.includes("chrome")?"webkit":"unknown"}catch(t){return"unknown"}}S(){try{const t=navigator.userAgent.toLowerCase(),n=navigator,o=["wv","instagram","fban","fbav","tiktok","linkedin","snapchat","twitter","line/","micromessenger","kakaotalk","telegram"];return o.some(n=>t.includes(n))?!![]:void 0===n.standalone||n.standalone?window.self!==window.top?!![]:![]:!![]}catch(t){return![]}}k(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC";return t.replace(/\//g,"_").substring(0,30)}catch(t){return"UTC"}}_(t){const n=16777619;let o=2166136261,s=2166136261,c=2166136261,l=2166136261;for(let d=0;d<t.length;d++){const u=t.charCodeAt(d);o^=u,o=Math.imul(o,n),s^=u<<1,s=Math.imul(s,n),c^=u<<2,c=Math.imul(c,n),l^=u<<3,l=Math.imul(l,n)}return o=Math.abs(o),s=Math.abs(s),c=Math.abs(c),l=Math.abs(l),o.toString(16)+s.toString(16)+c.toString(16)+l.toString(16)}}class TelemetryService{constructor(){this.eventQueue=[],this.batchTimer=null,this.stats={totalEvents:0,eventsByLevel:{debug:0,log:0,info:0,warn:0,error:0,fatal:0},batchesSent:0,failedBatches:0,queuedEvents:0,droppedEvents:0},this.isShuttingDown=![],this.clientConfig=ClientConfigService.getInstance(),this.store=StoreService.getInstance();const n=this.clientConfig.get("env"),o=new URL("/api/telemetry",this.clientConfig.get("baseUrl")).toString();this.config={enabled:!![],endpoint:o,batchSize:n===t.PRODUCTION?5:10,batchInterval:n===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,n,o={}){if(!this.isEnabled()||this.isShuttingDown)return;if(!this.shouldCapture(t))return;const s=Date.now();try{const c={eventId:"event_"+s+"}",timestamp:s,level:t,message:n,context:o.context,error:o.error?this.buildErrorContext(o.error):void 0,component:o.component,data:o.data,metadata:{sdk:this.buildSDKContext(),user:this.buildUserContext(),browser:this.buildBrowserContext()}};this.addToQueue(c)}catch(c){this.handleInternalError(c)}}buildErrorContext(t){return{name:t.name,message:t.message,stack:this.truncateStackTrace(t.stack),code:t.code,statusCode:t.status||t.statusCode}}buildSDKContext(){return{version:this.clientConfig.get("version")||"unknown",env:this.clientConfig.get("env"),isBuilder:this.clientConfig.get("isBuilder"),partnerCode:this.clientConfig.get("partnerCode")}}buildUserContext(){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 n=this.eventQueue.splice(0,this.config.batchSize);this.stats.queuedEvents=this.eventQueue.length;const o=this.createBatch(n);try{this.sendBatch(o),this.stats.batchesSent++}catch(s){this.stats.failedBatches++,this.handleInternalError(s),this.eventQueue.unshift(...n),this.stats.queuedEvents=this.eventQueue.length}}createBatch(t){const n=Date.now();return{batchId:"batch_"+n,timestamp:n,events:t}}sendBatch(t){if("undefined"!=typeof navigator&&navigator.sendBeacon)try{const n=new Blob([JSON.stringify(t)],{type:"text/plain"}),o=navigator.sendBeacon(this.config.endpoint,n);if(o)return}catch(n){return this.sendBatchViaXHR(t),void 0}this.sendBatchViaXHR(t)}sendBatchViaXHR(t){try{const n=new XMLHttpRequest;if(n.open("POST",this.config.endpoint,![]),n.setRequestHeader("Content-Type","text/plain"),n.send(JSON.stringify(t)),n.status<200||n.status>=300)throw new SDKError("XHR request failed with status: "+n.status)}catch(n){throw new SDKError("Both sendBeacon and XHR failed: "+n.message)}}truncateStackTrace(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(n){this.stats.failedBatches++}}}}class BaseComponent extends HTMLElement{get hostClasses(){return[]}get hostAttributes(){return{}}constructor(t={}){super(),this.initialized=![],this.isDestroyed=![],this.renderScheduled=![],this.unsubscribers=[],this.lastRenderTrigger="initial",this.renderCount=0,this.store=StoreService.getInstance(),this.commands=CommandService.getInstance(),this.themeProvider=ThemeProviderService.getInstance(),this.pubSub=PubSubService.getInstance(),this.logger=LoggerFactory.get("BaseComponent"),this.clientConfig=ClientConfigService.getInstance(),this.telemetry=TelemetryService.getInstance(),this.reactiveOptions={watchStorePaths:[],watchOnlyStorePaths:[],autoDestroy:![],autoDestroyDelay:0,...t}}initialize({data:t,config:n}){var o;this.P=Object.freeze(t),this.I=Object.freeze({type:n.type,tagName:this.tagName.toLowerCase(),useShadowDom:null!==(o=null==n?void 0:n.useShadowDom)&&void 0!==o?o:![]}),this.initialized&&(this.setup(),this.triggerRender("initialize"))}interpolateStorePaths(t){return t.map(t=>this.interpolatePath(t))}interpolatePath(t){if("string"!=typeof t)return t;const n=/\{([^}]+)}/g;return t.replace(n,(n,o)=>{const s=this.P[o];return null==s?(this.logger.warn('Parameter "'+o+'" not found in component params for path "'+t+'"'),n):String(s)})}connectedCallback(){var t,n;try{if(this.isDestroyed)return;this.initialized=!![],this.container=this.I.useShadowDom?this.attachShadow({mode:this.clientConfig.isProduction()?"closed":"open"}):this,this.setup(),this.triggerRender("connected"),null===(t=this.connected)||void 0===t||t.call(this)}catch(o){this.logger.error("Component connectedCallback error in "+((null===(n=this.I)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"connectedCallback")}}disconnectedCallback(){var t,n;try{this.cleanup(),null===(t=this.disconnected)||void 0===t||t.call(this)}catch(o){this.logger.error("Component disconnectedCallback error in "+((null===(n=this.I)||void 0===n?void 0:n.tagName)||"unknown"),o),o instanceof Error&&this.captureComponentError(o,"disconnectedCallback")}}setup(){var t,n,o;try{this.updateHostClasses(),this.updateHostAttributes(),null===(t=this.beforeSetupStoreWatchers)||void 0===t||t.call(this),this.setupStoreWatchers(),this.setupNonRenderingWatchers(),this.setupAutoDestroy(),null===(n=this.beforeConnected)||void 0===n||n.call(this)}catch(s){this.logger.error("Component setup error in "+((null===(o=this.I)||void 0===o?void 0:o.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 n of this.unsubscribers)try{n()}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 n=this.reactiveOptions.autoDestroyPath;if(!n&&(null===(t=this.reactiveOptions.watchStorePaths)||void 0===t?void 0:t.length)&&(n=this.reactiveOptions.watchStorePaths[0]),!n)return this.logger.warn("AutoDestroy enabled but no path specified and no watchStorePaths found"),void 0;const o=this.interpolatePath(n),s=this.store.watch(o,(t,n)=>{this.isDestroyed||void 0===t&&void 0!==n&&this.handleAutoDestroy(o)});this.unsubscribers.push(s)}handleAutoDestroy(t){var n;if(this.isDestroyed)return;null===(n=this.beforeAutoDestroy)||void 0===n?void 0:n.call(this,t);const o=this.reactiveOptions.autoDestroyDelay||0;o>0?this.autoDestroyTimeout=setTimeout(()=>{this.destroyComponent()},o):this.destroyComponent()}destroyComponent(){var t;if(!this.isDestroyed)try{null===(t=this.onAutoDestroy)||void 0===t?void 0:t.call(this),this.remove()}catch(n){this.logger.error("Error during auto-destroy of "+this.I.tagName,n),n instanceof Error&&this.captureComponentError(n,"auto-destroy")}}setupStoreWatchers(){var t;try{let t=this.reactiveOptions.watchStorePaths;if(!(null==t?void 0:t.length)||!this.P)return;t=this.interpolateStorePaths(t);const n=this.store.watchMany(t,t=>{var n,o;try{if(this.isDestroyed)return;const o=t.map(t=>t.path).join(", "),s="store:["+o+"]",c=null===(n=this.onStoreChanged)||void 0===n?void 0:n.call(this,t);c!==![]&&this.triggerRender(s)}catch(s){this.logger.error("Store watcher callback error in "+((null===(o=this.I)||void 0===o?void 0:o.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"storeWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Store watchers setup error in "+((null===(t=this.I)||void 0===t?void 0:t.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"setupStoreWatchers")}}setupNonRenderingWatchers(){var t;try{let t=this.reactiveOptions.watchOnlyStorePaths;if(!(null==t?void 0:t.length)||!this.P)return;t=this.interpolateStorePaths(t);const n=this.store.watchMany(t,t=>{var n,o;try{if(this.isDestroyed)return;null===(n=this.onStoreWatch)||void 0===n?void 0:n.call(this,t)}catch(s){this.logger.error("Non-rendering watcher callback error in "+((null===(o=this.I)||void 0===o?void 0:o.tagName)||"unknown"),s),s instanceof Error&&this.captureComponentError(s,"nonRenderingWatcher")}});this.unsubscribers.push(n)}catch(n){this.logger.error("Non-rendering watchers setup error in "+((null===(t=this.I)||void 0===t?void 0:t.tagName)||"unknown"),n),n instanceof Error&&this.captureComponentError(n,"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,n;if(!this.initialized||this.isDestroyed)return;const o=performance.now();this.renderCount++;try{const n=this.template();"string"==typeof n&&(this.container.innerHTML=n),n instanceof HTMLElement&&safeReplaceChildren(this.container,n),Array.isArray(n)&&safeReplaceChildren(this.container,...n);const c=performance.now()-o;this.logRenderInfo(c);try{null===(t=this.afterRender)||void 0===t?void 0:t.call(this)}catch(s){this.logger.error("❌ afterRender hook error in "+this.I.tagName,s),s instanceof Error&&this.captureComponentError(s,"afterRender")}}catch(c){const t=performance.now()-o;this.logger.error("❌ Component render error in "+this.I.tagName,c),this.captureComponentError(c,"render",t),safeReplaceChildren(this.container,ComponentFactoryService.componentError({componentType:this.I.type,message:c instanceof Error?c.message:String(c)}));try{null===(n=this.onError)||void 0===n?void 0:n.call(this,c,"render")}catch(l){this.logger.error("❌ onError hook error in "+this.I.tagName,l)}}}logRenderInfo(t){const n=this.I.type,o=this.I.tagName,s=t>16?"🐌":t>8?"⚡":"🚀";this.logger.debug("Rendered "+s+" "+n+" </"+o+"> | #"+this.renderCount+" | "+t.toFixed(2)+"ms | "+this.lastRenderTrigger),t>16&&(this.logger.warn("⚠️ Slow render in "+n+"("+o+"): "+t.toFixed(2)+"ms triggered by "+this.lastRenderTrigger,{duration:t,threshold:16,componentType:n,tagName:o,renderTrigger:this.lastRenderTrigger,renderCount:this.renderCount}),this.telemetry.captureEvent("warn","Slow render: "+t.toFixed(2)+"ms",{context:"Component:"+o+":performance",component:{type:n,tagName:o,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:t,useShadowDom:this.I.useShadowDom}}))}rerender(t){this.triggerRender(t?"manual:rerender:"+t:"manual:rerender()")}captureComponentError(t,n,o){if(this.telemetry.isEnabled())try{this.telemetry.captureEvent("error",t.message,{context:"Component:"+this.I.tagName+":"+n,component:{type:this.I.type,tagName:this.I.tagName,renderCount:this.renderCount,renderTrigger:this.lastRenderTrigger,renderDuration:o,useShadowDom:this.I.useShadowDom}})}catch(s){}}updateHostClasses(){const t=this.hostClasses;if(t.length>0){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.add(...n)}}addHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.add(...n)}removeHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());n.length>0&&this.classList.remove(...n)}toggleHostClasses(...t){const n=t.filter(t=>t&&"string"==typeof t&&t.trim());for(const o of n)this.classList.toggle(o)}addHostAttribute(t,n){t&&"string"==typeof t&&n&&"string"==typeof n&&(this.setAttribute(t,String(n)),this.hostAttributes[t]=String(n))}removeHostAttribute(t){t&&"string"==typeof t&&(this.removeAttribute(t),delete this.hostAttributes[t])}updateHostAttributes(){const t=this.hostAttributes;for(const[n,o]of Object.entries(t))n&&"string"==typeof n&&o&&"string"==typeof o&&this.setAttribute(n,String(o))}get params(){return this.P}get config(){return this.themeProvider.getComponentConfig(this.I.type)}get elementConfig(){return this.I}getConfigs(t){return this.themeProvider.getConfigs(t)}getStoreValue(t){return this.store.get(t)}setStoreValue(t,n){return this.store.set(t,n)}watchStore(t,n){const o=this.store.watch(t,n);return this.unsubscribers.push(o),o}}class AddressComponent extends BaseComponent{constructor(){super({watchOnlyStorePaths:["address"]})}template(){var t;const n=null!==(t=this.params.options)&&void 0!==t?t:{};return ComponentFactoryService.createElement({type:s.ADDRESS_DISPLAY,isIndependentComponent:!![],options:n})}}class AddressDisplayComponent extends BaseComponent{get hostClasses(){return["address-display-container"]}constructor(){super({watchStorePaths:["address"]})}template(){var t,n,o,c;const l=this.getStoreValue("address"),d=null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![],u=null!==(n=this.params.productId)&&void 0!==n?n:"",h=null!==(o=this.params.options)&&void 0!==o?o:{},m=null!==(c=h.showLabel)&&void 0!==c?c:!![],f=[];if(m){const t=document.createElement("span");t.textContent="Delivers to:",f.push(t)}const g=document.createElement("button");g.type="button",g.textContent=l.formattedAddress||"Select an address";const v=l.formattedAddress?"Change delivery address, currently set to "+l.formattedAddress:"Select delivery address";return g.setAttribute("aria-label",v),g.addEventListener("click",async()=>{if(d)return this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:u,isIndependentComponent:!![]}),void 0;!d&&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}))}),f.push(g),f}}const ArrowRightIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="arrow-right-icon '+o+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.52794 2.86225C7.78829 2.6019 8.2104 2.6019 8.47075 2.86225L13.1374 7.52892C13.3978 7.78927 13.3978 8.21138 13.1374 8.47173L8.47075 13.1384C8.2104 13.3987 7.78829 13.3987 7.52794 13.1384C7.26759 12.878 7.26759 12.4559 7.52794 12.1956L11.0565 8.66699H3.33268C2.96449 8.66699 2.66602 8.36851 2.66602 8.00033C2.66602 7.63214 2.96449 7.33366 3.33268 7.33366H11.0565L7.52794 3.80506C7.26759 3.54471 7.26759 3.1226 7.52794 2.86225Z"/>\n </svg>\n '},BagIcon=({width:t=24,height:n=24,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 489 489" class="bag-icon '+o+'" style="'+c+'" data-fill-only>\n <path d="M440.1,422.7l-28-315.3c-0.6-7-6.5-12.3-13.4-12.3h-57.6C340.3,42.5,297.3,0,244.5,0s-95.8,42.5-96.6,95.1H90.3 c-7,0-12.8,5.3-13.4,12.3l-28,315.3c0,0.4-0.1,0.8-0.1,1.2c0,35.9,32.9,65.1,73.4,65.1h244.6c40.5,0,73.4-29.2,73.4-65.1 C440.2,423.5,440.2,423.1,440.1,422.7z M244.5,27c37.9,0,68.8,30.4,69.6,68.1H174.9C175.7,57.4,206.6,27,244.5,27z M366.8,462 H122.2c-25.4,0-46-16.8-46.4-37.5l26.8-302.3h45.2v41c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h139.3v41 c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5v-41h45.2l26.9,302.3C412.8,445.2,392.1,462,366.8,462z"/>\n </svg>\n'},CheckboxIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="checkbox-icon '+o+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 3.52885C14.0651 3.7892 14.0651 4.21131 13.8047 4.47166L6.4714 11.805C6.21106 12.0653 5.78894 12.0653 5.5286 11.805L2.19526 8.47166C1.93491 8.21131 1.93491 7.7892 2.19526 7.52885C2.45561 7.2685 2.87772 7.2685 3.13807 7.52885L6 10.3908L12.8619 3.52885C13.1223 3.2685 13.5444 3.2685 13.8047 3.52885Z"/>\n </svg>\n '},ChevronDownIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="'+o+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52827 5.52876C3.78862 5.26841 4.21073 5.26841 4.47108 5.52876L7.99967 9.05735L11.5283 5.52876C11.7886 5.26841 12.2107 5.26841 12.4711 5.52876C12.7314 5.78911 12.7314 6.21122 12.4711 6.47157L8.47108 10.4716C8.21073 10.7319 7.78862 10.7319 7.52827 10.4716L3.52827 6.47157C3.26792 6.21122 3.26792 5.78911 3.52827 5.52876Z" fill="#18181B"/>\n </svg>\n '},ChevronLeftIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="chevron-left-icon '+o+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M10.4721 3.52864C10.7324 3.78899 10.7324 4.2111 10.4721 4.47145L6.94346 8.00004L10.4721 11.5286C10.7324 11.789 10.7324 12.2111 10.4721 12.4714C10.2117 12.7318 9.7896 12.7318 9.52925 12.4714L5.52925 8.47145C5.2689 8.2111 5.2689 7.78899 5.52925 7.52864L9.52925 3.52864C9.7896 3.26829 10.2117 3.26829 10.4721 3.52864Z"/>\n </svg>\n '},CloseIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="close-icon '+o+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52925 3.52864C3.7896 3.26829 4.21171 3.26829 4.47206 3.52864L8.00065 7.05723L11.5292 3.52864C11.7896 3.26829 12.2117 3.26829 12.4721 3.52864C12.7324 3.78899 12.7324 4.2111 12.4721 4.47145L8.94346 8.00004L12.4721 11.5286C12.7324 11.789 12.7324 12.2111 12.4721 12.4714C12.2117 12.7318 11.7896 12.7318 11.5292 12.4714L8.00065 8.94285L4.47206 12.4714C4.21171 12.7318 3.7896 12.7318 3.52925 12.4714C3.2689 12.2111 3.2689 11.789 3.52925 11.5286L7.05784 8.00004L3.52925 4.47145C3.2689 4.2111 3.2689 3.78899 3.52925 3.52864Z"/>\n </svg>\n '},ErrorInfoIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="error-info-icon '+o+'" style="'+c+'" data-fill-only>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00033 1.99996C4.68662 1.99996 2.00033 4.68625 2.00033 7.99996C2.00033 11.3137 4.68662 14 8.00033 14C11.314 14 14.0003 11.3137 14.0003 7.99996C14.0003 4.68625 11.314 1.99996 8.00033 1.99996ZM0.666992 7.99996C0.666992 3.94987 3.95024 0.666626 8.00033 0.666626C12.0504 0.666626 15.3337 3.94987 15.3337 7.99996C15.3337 12.05 12.0504 15.3333 8.00033 15.3333C3.95024 15.3333 0.666992 12.05 0.666992 7.99996ZM8.00033 4.66663C8.36852 4.66663 8.66699 4.9651 8.66699 5.33329V7.99996C8.66699 8.36815 8.36852 8.66663 8.00033 8.66663C7.63213 8.66663 7.33366 8.36815 7.33366 7.99996V5.33329C7.33366 4.9651 7.63213 4.66663 8.00033 4.66663ZM7.33366 10.6666C7.33366 10.2984 7.63213 9.99996 8.00033 9.99996H8.00699C8.37518 9.99996 8.67366 10.2984 8.67366 10.6666C8.67366 11.0348 8.37518 11.3333 8.00699 11.3333H8.00033C7.63213 11.3333 7.33366 11.0348 7.33366 10.6666Z"/>\n</svg>'},InfoIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="info-icon '+o+'" style="'+c+'" data-fill-only>\n <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>\n <path d="m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/>\n </svg>\n '},SearchIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s||"currentColor";return'<svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="search-icon '+o+'">\n <path d="M14.0001 14L11.1335 11.1333M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" fill="none" stroke="'+c+'" stroke-width="1.33" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>'},SuccessIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="success-icon '+o+'" style="'+c+'" data-fill-only>\n <path d="M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z"/>\n </svg>\n '},TrashIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="trash-icon '+o+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M6.22157 2.22161C6.06513 2.37804 6.00016 2.55036 6.00016 2.66687V3.33354H10.0002V2.66687C10.0002 2.55036 9.93519 2.37804 9.77876 2.22161C9.62232 2.06517 9.45001 2.0002 9.3335 2.0002H6.66683C6.55032 2.0002 6.378 2.06517 6.22157 2.22161ZM11.3335 3.33354V2.66687C11.3335 2.11672 11.0651 1.62236 10.7216 1.2788C10.378 0.935235 9.88365 0.66687 9.3335 0.66687H6.66683C6.11668 0.66687 5.62232 0.935235 5.27876 1.2788C4.93519 1.62236 4.66683 2.11672 4.66683 2.66687V3.33354H2.00016C1.63197 3.33354 1.3335 3.63201 1.3335 4.0002C1.3335 4.36839 1.63197 4.66687 2.00016 4.66687H2.66683V13.3335C2.66683 13.8837 2.93519 14.378 3.27876 14.7216C3.62232 15.0652 4.11668 15.3335 4.66683 15.3335H11.3335C11.8837 15.3335 12.378 15.0652 12.7216 14.7216C13.0651 14.378 13.3335 13.8837 13.3335 13.3335V4.66687H14.0002C14.3684 4.66687 14.6668 4.36839 14.6668 4.0002C14.6668 3.63201 14.3684 3.33354 14.0002 3.33354H11.3335ZM4.00016 4.66687V13.3335C4.00016 13.45 4.06513 13.6224 4.22157 13.7788C4.378 13.9352 4.55032 14.0002 4.66683 14.0002H11.3335C11.45 14.0002 11.6223 13.9352 11.7788 13.7788C11.9352 13.6224 12.0002 13.45 12.0002 13.3335V4.66687H4.00016ZM6.66683 6.66687C7.03502 6.66687 7.3335 6.96535 7.3335 7.33354V11.3335C7.3335 11.7017 7.03502 12.0002 6.66683 12.0002C6.29864 12.0002 6.00016 11.7017 6.00016 11.3335V7.33354C6.00016 6.96535 6.29864 6.66687 6.66683 6.66687ZM9.3335 6.66687C9.70169 6.66687 10.0002 6.96535 10.0002 7.33354V11.3335C10.0002 11.7017 9.70169 12.0002 9.3335 12.0002C8.96531 12.0002 8.66683 11.7017 8.66683 11.3335V7.33354C8.66683 6.96535 8.96531 6.66687 9.3335 6.66687Z"/>\n </svg>\n '},WarningIcon=({width:t=16,height:n=16,className:o="",color:s=null})=>{const c=s?"--icon-color: "+s:"";return'\n <svg xmlns="http://www.w3.org/2000/svg" width="'+t+'" height="'+n+'" viewBox="0 0 16 16" class="warning-icon '+o+'" style="'+c+'" data-fill-only>\n <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99984 2.00033C4.68613 2.00033 1.99984 4.68662 1.99984 8.00033C1.99984 11.314 4.68613 14.0003 7.99984 14.0003C11.3135 14.0003 13.9998 11.314 13.9998 8.00033C13.9998 4.68662 11.3135 2.00033 7.99984 2.00033ZM0.666504 8.00033C0.666504 3.95024 3.94975 0.666992 7.99984 0.666992C12.0499 0.666992 15.3332 3.95024 15.3332 8.00033C15.3332 12.0504 12.0499 15.3337 7.99984 15.3337C3.94975 15.3337 0.666504 12.0504 0.666504 8.00033ZM7.99984 4.66699C8.36803 4.66699 8.6665 4.96547 8.6665 5.33366V8.00033C8.6665 8.36852 8.36803 8.66699 7.99984 8.66699C7.63165 8.66699 7.33317 8.36852 7.33317 8.00033V5.33366C7.33317 4.96547 7.63165 4.66699 7.99984 4.66699ZM7.33317 10.667C7.33317 10.2988 7.63165 10.0003 7.99984 10.0003H8.0065C8.37469 10.0003 8.67317 10.2988 8.67317 10.667C8.67317 11.0352 8.37469 11.3337 8.0065 11.3337H7.99984C7.63165 11.3337 7.33317 11.0352 7.33317 10.667Z"/>\n </svg>\n '};class AddressInputComponent extends BaseComponent{constructor(){super({watchStorePaths:["address"]}),this.suggestions=[],this.error=null,this.selectedAddress=null,this.minSearchLength=3,this.isIndependentComponent=()=>{var t;return null!==(t=this.params.isIndependentComponent)&&void 0!==t?t:![]},this.handleInputChange=t=>{const n=t.target,o=n.value.trim();this.searchTimeout&&clearTimeout(this.searchTimeout),this.selectedAddress=null,this.error=null,this.updateErrorDisplay();const s=/^\d/.test(o);if(o.length<this.minSearchLength||!s)return this.suggestions=[],this.hideSuggestions(),void 0;this.searchTimeout=setTimeout(async()=>{await this.searchAddresses(o)},300)},this.closeDrawer=async()=>{const t=this.params.productId,n=this.clientConfig.isMobile(),o=this.isIndependentComponent();(n||o)&&this.commands.ui.closeDrawer(),!n&&t&&await this.commands.product.closeProductDrawer(t)},this.handleCancel=async()=>{try{await this.closeDrawer(),this.suggestions=[],this.error=null,this.hideSuggestions(),this.updateErrorDisplay()}catch(Z){this.logger.error("Address edit cancellation failed",Z)}},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"),n=(null==t?void 0:t.coordinates.lat)!==this.selectedAddress.coordinates.lat||(null==t?void 0:t.coordinates.long)!==this.selectedAddress.coordinates.long;n&&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 n=t.currentTarget.dataset.suggestionId;if(n)try{this.error=null,this.updateErrorDisplay();const t=await this.commands.address.getAddressDetails(n);if(0===Object.keys(t).length)return this.error="No details found for the selected address.",this.updateErrorDisplay(),void 0;this.selectedAddress={id:n,address:t.address,coordinates:t.coords,formattedAddress:t.formattedAddress},this.inputElement.value=this.selectedAddress.formattedAddress,this.hideSuggestions()}catch(o){this.logger.error("Address details retrieval failed",o),this.error="Failed to get address details. Please try again.",this.updateErrorDisplay()}},this.handleDocumentClick=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 n=await this.commands.address.searchAddresses(t);this.suggestions=n.slice(0,5),this.updateSuggestionsDisplay(),this.showSuggestions()}catch(n){this.logger.error("Address search operation failed",n),this.error="Failed to search addresses. Please try again.",this.suggestions=[],this.updateErrorDisplay(),this.updateSuggestionsDisplay()}}updateErrorDisplay(){if(!this.errorContainer)return;if(!this.error)return this.errorContainer.style.display="none",void 0;this.errorContainer.style.display="block";const 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 n=this.createElement("li",{className:"suggestion-item"}),o=this.createElement("span",{textContent:t.description});n.appendChild(o),n.setAttribute("data-suggestion-id",t.id),n.setAttribute("role","option"),n.setAttribute("aria-label","Select address: "+t.description),n.setAttribute("tabindex","0"),n.addEventListener("click",this.handleSuggestionClick),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())}),this.suggestionsContainer.appendChild(n)}}}showSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("hide"),this.suggestionsContainer.classList.add("show")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","true"),this.inputContainer&&this.inputContainer.classList.add("suggestions-expanded")}hideSuggestions(){this.suggestionsContainer&&(this.suggestionsContainer.classList.remove("show"),this.suggestionsContainer.classList.add("hide")),this.inputElement&&this.inputElement.setAttribute("aria-expanded","false"),this.inputContainer&&this.inputContainer.classList.remove("suggestions-expanded")}createElement(t,n){const o=document.createElement(t);return n&&Object.assign(o,n),o}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 n=this.createElement("span",{className:"error-icon",textContent:"⚠️"}),o=this.createElement("span",{className:"error-text"});return t.appendChild(n),t.appendChild(o),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,n,o;const s=this.getConfigs("global"),c=null!==(t=this.params.options)&&void 0!==t?t:{},l=null!==(n=c.showLabel)&&void 0!==n?n:!![];if(this.inputContainer=this.createElement("div",{className:"input-section"}),l){const t=this.createElement("h2",{className:"input-title",textContent:"Enter delivery address"});this.inputContainer.appendChild(t)}const d=this.createElement("div",{className:"input-wrapper "+s.layout.inputFieldStyle});this.inputElement=this.createElement("input",{type:"text",id:"address-input",className:"input-field",value:(null===(o=this.selectedAddress)||void 0===o?void 0:o.formattedAddress)||"",autocomplete:"off",placeholder:"Enter an address"}),this.inputElement.setAttribute("role","combobox"),this.inputElement.setAttribute("aria-label","Enter delivery address"),this.inputElement.setAttribute("aria-autocomplete","list"),this.inputElement.setAttribute("aria-controls","address-suggestions"),this.inputElement.setAttribute("aria-expanded","false"),this.inputElement.setAttribute("aria-haspopup","listbox"),this.inputElement.addEventListener("input",this.handleInputChange),d.appendChild(this.inputElement);const u=this.createElement("span");u.className="input-icon",u.innerHTML=SearchIcon({width:16,height:16,className:""}),d.appendChild(u),this.inputContainer.appendChild(d),this.suggestionsContainer=this.createElement("ul",{className:"suggestions-list hide"}),this.suggestionsContainer.setAttribute("id","address-suggestions"),this.suggestionsContainer.setAttribute("role","listbox"),this.suggestionsContainer.setAttribute("aria-label","Address suggestions"),this.inputContainer.appendChild(this.suggestionsContainer),this.errorContainer=this.createErrorContainer();const h=this.createElement("span",{className:"privacy-notice",textContent:"This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply."}),m=[this.inputContainer,h,this.errorContainer],f=this.createElement("div",{className:"action-buttons"}),g=this.createCancelButton();f.appendChild(g);const v=this.createCheckButton();return f.appendChild(v),m.push(f),document.addEventListener("click",this.handleDocumentClick),m}disconnected(){this.searchTimeout&&clearTimeout(this.searchTimeout),document.removeEventListener("click",this.handleDocumentClick)}}class CartComponent extends BaseComponent{get hostClasses(){const t=["cart-container"];return this.params.isIndependentComponent&&!this.clientConfig.isBuilder()&&t.push("cart-no-header"),this.params.isIndependentComponent&&t.push("independent"),t}constructor(){super({watchStorePaths:["cart.rerender"]})}template(){const t=[],n=this.params.isIndependentComponent&&!this.clientConfig.isBuilder();if(!n){const n=ComponentFactoryService.createElement({type:s.CART_HEADER});t.push(n)}const o=ComponentFactoryService.createElement({type:s.CART_BODY});t.push(o);const c=ComponentFactoryService.createElement({type:s.CART_FOOTER});return t.push(c),t}}class CartBodyComponent extends BaseComponent{get hostClasses(){return["cart-body"]}constructor(){super({watchStorePaths:["cart.retailers","cart.loading"]})}createEmptyCartElement(){const t=document.createElement("div");t.className="empty-cart-container";const n=document.createElement("h3");return n.className="empty-cart-content",n.textContent="Your cart is empty",t.appendChild(n),t}createLoadingElement(){const t=document.createElement("div");return t.setAttribute("data-component-type","cart-body-loading"),t.innerHTML=this.loadingTemplate(),t}loadingTemplate(){return'\n <div class="cart-loading-backdrop">\n <div class="cart-loading-spinner-container">\n <div class="cart-loading-spinner">\n <svg class="cart-spinner" width="50" height="50" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n </div>\n </div>\n </div>\n '}createRetailerElement(t){try{return ComponentFactoryService.createElement({type:s.CART_RETAILER,retailerId:t.id})}catch(n){return this.logger.error("Cart retailer component creation failed",n),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,n){const o=this.createRetailerElement(n);o.setAttribute("data-retailer-id",t),this.container.appendChild(o)}removeRetailerElement(t){const n=this.getRetailerElementById(t);n&&n.remove()}updateRetailerElement(t,n){const o=this.getRetailerElementById(t);if(o){const s=this.createRetailerElement(n);s.setAttribute("data-retailer-id",t),o.replaceWith(s)}}hasRetailerDataChanged(t,n){return t?![]:!![]}getValidRetailers(t){if(!t)return{};const n={};for(const[o,s]of Object.entries(t))s&&"object"==typeof s&&s.id&&(n[o]=s);return n}getValidRetailerIds(t){const n=this.getValidRetailers(t);return new Set(Object.keys(n))}onStoreChanged(t){const n=t.find(t=>"cart.retailers"===t.path),o=t.find(t=>"cart.loading"===t.path);if(n){const t=this.getValidRetailers(n.oldValue),o=this.getValidRetailers(n.value),s=this.getValidRetailerIds(n.oldValue),c=this.getValidRetailerIds(n.value),l=s.size,d=c.size,u=this.getValidRetailers(this.getStoreValue("cart.retailers")),h=Object.keys(u).length;if(d>0&&0===h)return this.showEmptyCartState(),![];if(this.removeLoadingOverlay(),0===l&&d>0){this.container.innerHTML="";for(const[t,n]of Object.entries(o))this.addRetailerElement(t,n)}else if(l>0&&0===d)this.showEmptyCartState();else if(d>0){for(const t of s)c.has(t)||this.removeRetailerElement(t);for(const n of c){const c=o[n],l=t[n];s.has(n)?this.hasRetailerDataChanged(l,c)&&this.updateRetailerElement(n,c):this.addRetailerElement(n,c)}}else 0===l&&0===d&&this.showEmptyCartState()}if(o){const t=o.value,n=o.oldValue;t!==n&&(t?this.addLoadingOverlay():this.removeLoadingOverlay())}return o||n,![]}afterRender(){this.setupEmptyCartListeners();const t=this.getStoreValue("cart.loading");t&&this.addLoadingOverlay()}template(){const t=this.getStoreValue("cart.retailers")||{},n=Object.values(t);if(0===n.length)return this.createEmptyCartElement();const o=[];for(const s of n){const t=this.createRetailerElement(s);t.setAttribute("data-retailer-id",s.id),o.push(t)}return o}}class CartFooterComponent extends BaseComponent{get hostClasses(){return["cart-footer"]}constructor(){super({watchOnlyStorePaths:["cart.items","cart.totals","cart.fulfillments","cart.loading","cart.retailers"]})}onStoreWatch(t){const n=t.some(t=>t.path.includes("cart.items")),o=t.some(t=>t.path.includes("cart.totals")),s=t.some(t=>t.path.includes("cart.fulfillments")),c=t.some(t=>"cart.loading"===t.path),l=t.some(t=>t.path.includes("cart.retailers"));if(n&&this.updateSubtotalItemsCount(),o&&this.subtotalPrice){const t=this.getStoreValue("cart.totals");this.subtotalPrice.textContent=""+formatCentToDollarText(t.subtotal+t.engravingFee-t.discounts)}(s||o||c||n||l)&&this.updateCheckoutButtonState()}afterRender(){this.updateSubtotalItemsCount(),this.updateCheckoutButtonState()}isAnythingLoading(){const t=this.getStoreValue("cart.loading");if(t)return!![];const n=this.getStoreValue("cart.items")||{},o=Object.values(n).some(t=>t.updating);if(o)return!![];const s=this.getStoreValue("cart.fulfillments")||{},c=Object.values(s).some(t=>t.updating);if(c)return!![];const l=this.getStoreValue("cart.retailers")||{},d=Object.values(l).some(t=>t.updating);return d?!![]:![]}hasUnmetMinimum(t){var n;const o=t.subtotal;if(t.type===c.SHIPPING){const s=t.fees;if((null===(n=s.individual)||void 0===n?void 0:n.active)&&s.individual.min>0&&o<s.individual.min)return!![]}if(t.type===c.ON_DEMAND){const n=t.fees;if(n.min>0&&o<n.min)return!![]}return![]}shouldDisableCheckout(){const t=this.getStoreValue("cart.fulfillments")||{};return Object.values(t).some(t=>this.hasUnmetMinimum(t))}updateCheckoutButtonState(){const t=this.getStoreValue("cart.items")||{},n=Object.keys(t).length>0;if(this.checkoutButton){const t=this.isAnythingLoading(),o=this.shouldDisableCheckout(),s=t||o||!n;this.checkoutButton.disabled=s,this.checkoutButton.classList.toggle("checkout-btn-disabled",s),this.checkoutButton.classList.toggle("loading",t)}}updateSubtotalItemsCount(){const t=this.getStoreValue("cart.items"),n=Object.values(t).reduce((t,n)=>t+n.quantity,0);this.subtotalText&&(this.subtotalText.textContent="Subtotal ("+n+" item"+(1!==n?"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"),n=this.getStoreValue("cart.totals"),o=[],c=document.createElement("div");c.className="cart-footer-header";const l=document.createElement("div");l.className="cart-footer-items-price",this.subtotalText=document.createElement("span"),this.subtotalText.className="subtotal-text",this.subtotalText.textContent="Subtotal (0 items):",l.appendChild(this.subtotalText),this.subtotalPrice=document.createElement("span"),this.subtotalPrice.className="subtotal-price",this.subtotalPrice.textContent=formatCentToDollarText(n.subtotal+n.engravingFee-n.discounts),l.appendChild(this.subtotalPrice);const d=document.createElement("p");if(d.textContent="Taxes & fees will be calculated at checkout",d.className="taxes-fees-info",c.appendChild(l),c.appendChild(d),o.push(c),t.layout.allowPromoCodes){const t=ComponentFactoryService.createElement({type:s.CART_PROMO_CODE});o.push(t)}const u=ComponentFactoryService.createElement({type:s.ALERT,errorStorePath:"cart.events",fromEvents:!![],showFirstEvent:![]});if(o.push(u),this.checkoutButton=document.createElement("button"),this.checkoutButton.type="button",this.checkoutButton.className="checkout-button",this.checkoutButton.setAttribute("aria-label","Go to checkout"),this.checkoutButton.textContent=this.config.layout.goToCheckoutButtonText||"Go to Checkout",this.checkoutButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleCheckout(t)}),this.checkoutButton.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.handleCheckout(t))}),o.push(this.checkoutButton),t.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"general"});o.push(t)}return o}}const shouldShowMinimumPurchaseAlert=(t,n=![])=>{var o,s;const l=t.subtotal;if(t.type===c.SHIPPING){const c=t.fees;if(n&&(null===(o=c.pack)||void 0===o?void 0:o.active)&&c.pack.min>0&&l<c.pack.min)return!![];if(!n&&(null===(s=c.individual)||void 0===s?void 0:s.active)&&c.individual.min>0&&l<c.individual.min)return!![]}else if(t.type===c.ON_DEMAND){const n=t.fees;if(n.min>0&&l<n.min)return!![]}return![]},getMinimumPurchaseMessage=(t,n=![])=>{var o,s;const l=t.subtotal;if(t.type===c.SHIPPING){const c=t.fees;let d=0;if(n&&(null===(o=c.pack)||void 0===o?void 0:o.active)&&c.pack.min>0?d=c.pack.min:(null===(s=c.individual)||void 0===s?void 0:s.active)&&c.individual.min>0&&(d=c.individual.min),d>0&&l<d)return{message:"+"+formatCentToDollarText(d-l)+" needed for order minimum",type:"warning"}}if(t.type===c.ON_DEMAND){const n=t.fees,o=n.min>0?n.min:0;if(o>0&&l<o)return{message:"+"+formatCentToDollarText(o-l)+" needed for order minimum",type:"warning"}}return{message:"",type:"warning"}},hasUnmetMinimum=(t,n=![])=>{var o,s;const l=t.subtotal;if(t.type===c.SHIPPING){const c=t.fees;if(n&&(null===(o=c.pack)||void 0===o?void 0:o.active)&&c.pack.min>0&&l<c.pack.min)return!![];if(!n&&(null===(s=c.individual)||void 0===s?void 0:s.active)&&c.individual.min>0&&l<c.individual.min)return!![]}if(t.type===c.ON_DEMAND){const n=t.fees;if(n.min>0&&l<n.min)return!![]}return![]};class PurchaseMinAlertComponent extends BaseComponent{get hostClasses(){return["alert","alert-"+this.params.messageType]}getIconElement(){const t=this.config||{};if(t.showIcon===![])return null;const n={warning:"warning",success:"success",info:"info"},o={warning:WarningIcon,success:SuccessIcon,info:InfoIcon},s=n[this.params.messageType]||"warning",c=document.createElement("div");return c.className="alert-icon alert-icon-"+this.params.messageType,c.appendChild(htmlStringToElement(o[s]({width:16,height:16,className:"alert-icon-svg"}))),c}template(){var t;const n=[],o=this.getIconElement();o&&n.push(o);const s=document.createElement("span");if(s.className="alert-message",s.textContent=this.params.message,n.push(s),"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 o=document.createElement("small");o.className="alert-details-text",o.textContent="Current subtotal: "+formatCentToDollarText(this.params.currentTotal),t.appendChild(o),n.push(t)}return n}}class CartFulfillmentComponent extends BaseComponent{get hostClasses(){return["retailer-fulfillment-container"]}constructor(){super({watchStorePaths:["cart.fulfillments.{fulfillmentId}","cart.items"],autoDestroy:!![],autoDestroyPath:"cart.fulfillments.{fulfillmentId}"})}getFulfillmentId(){return this.params.fulfillmentId}getProductStore(){const t=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+t+".items")||{};return Object.values(n).find(n=>n.fulfillmentId===t)}handleItemsUpdate(t,n){const o=new Set(t||[]),c=new Set(n||[]);for(const s of o)if(!c.has(s)){const t=this.container.querySelector('[data-item-id="'+s+'"]');t&&t.remove()}for(const l of c)if(!o.has(l)){const t=ComponentFactoryService.createElement({type:s.CART_ITEM,itemId:l});t.setAttribute("data-item-id",l),this.container.appendChild(t)}}setupItemElements(){const t=this.getFulfillmentId(),n=this.getStoreValue("cart.fulfillments."+t+".items")||[],o=this.container.querySelectorAll("[data-item-id]");for(const s of o)s.remove();for(const c of n){const t=ComponentFactoryService.createElement({type:s.CART_ITEM,itemId:c});t.setAttribute("data-item-id",c),this.container.appendChild(t)}}setupMinimumPurchaseAlert(){var t;const n=this.getFulfillmentId(),o=(null===(t=this.getProductStore())||void 0===t?void 0:t.pack)||![],c=this.getStoreValue("cart.fulfillments."+n),l=this.container.querySelector('[data-component-type="cart-retailer-alert"]');if(l&&l.remove(),shouldShowMinimumPurchaseAlert(c,o)){const t=getMinimumPurchaseMessage(c,o),n=ComponentFactoryService.createElement({type:s.PURCHASE_MIN_ALERT,message:t.message,messageType:t.type,currentTotal:c.subtotal,config:{showIcon:!![],alertType:"minimal"}});n.setAttribute("data-component-type","cart-retailer-alert"),this.container.prepend(n)}}createLoadingOverlay(){const t=document.createElement("div");t.className="cart-loading-backdrop",t.setAttribute("data-loading-id","fulfillment-loading-overlay");const n=document.createElement("div");n.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(o),t.appendChild(n),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 n=this.getFulfillmentId(),o=this.getStoreValue("cart.fulfillments."+n);return(null===(t=null==o?void 0:o.items)||void 0===t?void 0:t.length)?o.items.some(t=>{const n=this.getStoreValue("cart.items."+t);return(null==n?void 0:n.updating)===!![]}):![]}checkAndUpdateLoadingState(){const t=this.isAnyItemUpdating(),n=this.hasLoadingOverlay();t&&!n?this.showLoadingOverlay():!t&&n&&this.hideLoadingOverlay()}onStoreChanged(t){const n=this.getFulfillmentId(),o="cart.fulfillments."+n,s=t.find(t=>t.path===o),c=t.filter(t=>"cart.items"===t.path||t.path.startsWith("cart.items."));if(c.length>0&&this.checkAndUpdateLoadingState(),s){const t=s.oldValue,n=s.value,o=(null==t?void 0:t.items)||[],c=(null==n?void 0:n.items)||[],l=JSON.stringify(o)!==JSON.stringify(c);l&&(this.handleItemsUpdate(o,c),this.checkAndUpdateLoadingState());const d=this.hasFulfillmentFeesChanged(t,n),u=this.hasFulfillmentDataChanged(t,n,["items","updating"]);if(d&&!u&&this.setupMinimumPurchaseAlert(),!u)return![]}return![]}hasFulfillmentFeesChanged(t,n){return t?t.subtotal!==n.subtotal||t.shippingFee!==n.shippingFee||t.deliveryFee!==n.deliveryFee||JSON.stringify(t.fees)!==JSON.stringify(n.fees):!![]}hasFulfillmentDataChanged(t,n,o=[]){if(!t)return!![];const s=["type","canEngrave","retailerId"];for(const c of s)if(!o.includes(c)&&t[c]!==n[c])return!![];return![]}afterRender(){this.setupItemElements(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState()}disconnected(){this.hideLoadingOverlay()}template(){return[]}}const pt={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"},mt="America/New_York";function detectUserTimezone(t){try{if(t){const n=t.toUpperCase(),o=pt[n];return o||mt}return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(n){return mt}}function getCurrentTimeInTimezone(t){try{const n=new Date,o=n.getTime(),s=6e4*n.getTimezoneOffset(),c=new Date(o+s),l=new Date(c.toLocaleString("en-US",{timeZone:t})),d=c.getTime()-l.getTime();return new Date(o+d)}catch(n){return new Date}}function getCurrentTimeInUserTimezone(t){const n=detectUserTimezone(t);return getCurrentTimeInTimezone(n)}function isDateTimeInRange(t){const{startDate:n,endDate:o,addressState:s}=t;try{const t=getCurrentTimeInUserTimezone(s),c=!n||t>=new Date(n),l=!o||t<=new Date(o);return c&&l}catch(c){return![]}}function filterActiveItems(t,n){return t.filter(t=>isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:n}))}function hasActiveItems(t,n){return filterActiveItems(t,n).length>0}class CartHeaderComponent extends BaseComponent{get hostClasses(){return["cart-header"]}template(){var t,n,o;const c=this.config.layout.drawerHeaderText,l=this.getConfigs("global"),d=document.createElement("div");d.className="cart-header-content";const u=document.createElement("h2");u.className="cart-title",u.textContent=c,d.appendChild(u);const h=document.createElement("button");h.type="button",h.className="cart-header-close-btn",h.innerHTML=CloseIcon({width:16,height:16}),h.setAttribute("aria-label","Close cart drawer"),h.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),d.appendChild(h);const m=this.clientConfig.get("promoTicker"),f=null!==(n=null===(t=null==l?void 0:l.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==n?n:[],g=null!=m?m:f,v=this.store.get("address"),y=hasActiveItems(g,null===(o=null==v?void 0:v.address)||void 0===o?void 0:o.state);if(!g.length||!y)return[d];const b=ComponentFactoryService.createElement({context:"cart",type:s.PROMO_CODE_TICKER,tickers:g});return[d,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,n){var o,c,l,d,u,h,m,f,g,v;this.commands.ui.openDrawer(s.ENGRAVING_FORM,{identifier:t,context:"cart",lines:(null===(c=null===(o=n.attributes)||void 0===o?void 0:o.engraving)||void 0===c?void 0:c.lines)||[],maxLines:(null===(d=null===(l=n.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.maxLines)||1,maxCharsPerLine:(null===(h=null===(u=n.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.maxCharsPerLine)||16,fee:(null===(f=null===(m=n.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.fee)||0,location:null===(v=null===(g=n.attributes)||void 0===g?void 0:g.engraving)||void 0===v?void 0:v.location})}template(){var t,n,o,c,l,d,u,h,m;const f=this.params.itemId,g=this.getStoreValue("cart.items."+f),v=this.getConfigs("global"),y=this.getStoreValue("cart.fulfillments."+g.fulfillmentId),b=g.attributes.engraving.hasEngraving?"Ships in 10 days":(null===(t=null==y?void 0:y.expectation)||void 0===t?void 0:t.detail)||"",x=document.createElement("article");x.className="cart-item";const w=document.createElement("div");w.className="item-image";const E=document.createElement("img");E.src=g.mainImage,E.alt=g.name,w.appendChild(E);const _=document.createElement("div");_.className="item-details";const T=document.createElement("div");T.className="item-header";const D=document.createElement("h3");D.className="item-title",D.textContent=g.name;const P=document.createElement("button");P.className="item-delete",P.innerHTML=TrashIcon({}),P.setAttribute("role","button"),P.setAttribute("tabindex","0"),P.setAttribute("aria-label","Remove "+g.name+" from cart"),P.setAttribute("aria-expanded","true"),P.addEventListener("click",async()=>{await this.commands.cart.removeItem(f)}),P.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.commands.cart.removeItem(f))}),T.appendChild(D),T.appendChild(P);const F=document.createElement("div");F.className="item-specs",F.textContent=g.size+", "+g.container;const A=document.createElement("div");A.className="item-shipping-container";const z=document.createElement("div");if(z.className="item-shipping",z.textContent=b,A.appendChild(z),v.layout.enablePersonalization&&(null===(o=null===(n=null==g?void 0:g.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.isEngravable)&&(null===(l=null===(c=null==g?void 0:g.attributes)||void 0===c?void 0:c.engraving)||void 0===l?void 0:l.hasEngraving)===![]&&y.canEngrave){const t=document.createElement("span");t.className="cart-add-personalization-span",t.textContent=v.layout.personalizationText+" +"+formatCentToDollarText((null===(u=null===(d=g.attributes)||void 0===d?void 0:d.engraving)||void 0===u?void 0:u.fee)||0,![]),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Add personalization to "+g.name),t.addEventListener("click",()=>this.handleOpenEngravingForm(f,g)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleOpenEngravingForm(f,g))}),A.appendChild(t)}_.appendChild(T),_.appendChild(F),_.appendChild(A),x.appendChild(w),x.appendChild(_);const O=[x],N=ComponentFactoryService.createElement({type:s.CART_ITEM_QUANTITY_PRICE,itemId:f});if((null===(m=null===(h=null==g?void 0:g.attributes)||void 0===h?void 0:h.engraving)||void 0===m?void 0:m.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:f,context:"cart"});O.push(t)}return O.push(N),O}}class CartItemQuantityPriceComponent extends BaseComponent{get hostClasses(){return["quantity-price"]}constructor(){super({watchStorePaths:["cart.items.{itemId}"],watchOnlyStorePaths:["cart.items"]})}onStoreWatch(t){const n=t.find(t=>"cart.items"===t.path);if(n){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getItemStore(){const t=this.params.itemId,n=this.getStoreValue("cart.items."+t);return n||null}calculateQuantityLimits(){const t=this.getItemStore();if(!t)return{currentQuantity:0,availableQuantity:0,canIncrease:![],canDecrease:!![]};const n=t.quantity,o=this.getAvailableQuantity(),s=o>0;return{currentQuantity:n,availableQuantity:o,canIncrease:s,canDecrease:!![]}}getAvailableQuantity(){var t,n,o,s;const c=this.getItemStore();if(!c)return 0;const l=c.partNumber,d=c.fulfillmentId,u=this.getStoreValue("cart.items")||{},h=Object.values(u).filter(t=>t.partNumber===l&&t.fulfillmentId===d),m=h.reduce((t,n)=>t+n.quantity,0),f=this.getStoreValue("products."+c.upc)||this.getStoreValue("products."+c.salsifyGrouping);if(!f)return c.maxQuantity-m;const g=null!==(s=null===(o=null===(n=null===(t=null==f?void 0:f.sizes)||void 0===t?void 0:t[c.liquidId])||void 0===n?void 0:n.attributes)||void 0===o?void 0:o.maxQuantityPerOrder)&&void 0!==s?s:0;return!g||g<=0?c.maxQuantity-m:g-m}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 n=this.calculateQuantityLimits();t>0&&!n.canIncrease||await this.commands.cart.updateItemQuantity(this.params.itemId,t)}createQuantityContainer(){const t=this.calculateQuantityLimits(),n=this.getItemStore();if(!n)return document.createElement("div");const o=document.createElement("div");return o.className="item-quantity "+this.config.layout.quantityCounterStyle,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-btn-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.addEventListener("click",async 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),o.appendChild(this.qtyDecreaseButton),o.appendChild(this.quantitySpan),o.appendChild(this.qtyIncreaseButton),o}createPriceContainer(){const t=this.getItemStore();if(!t)return document.createElement("div");const n=document.createElement("div");n.className="item-price-container";const o=document.createElement("span");if(o.className="item-price",o.textContent=formatCentToDollarText(t.price),n.appendChild(o),t.quantity>1){const o=document.createElement("span");o.className="item-price-per-unit",o.textContent="("+formatCentToDollarText(t.unitPrice)+" ea)",n.appendChild(o)}return n}template(){const t=[];if(this.config.layout.showQuantityCounter){const n=this.createQuantityContainer();t.push(n)}const n=this.createPriceContainer();return t.push(n),t}}class CartPromoCodeComponent extends BaseComponent{get hostClasses(){return["promo-container-wrapper"]}constructor(){super({watchOnlyStorePaths:["cart.promoCode"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodePill=null}onStoreWatch(t){const n=t.find(t=>"cart.promoCode"===t.path);if(n){const{value:t,oldValue:o}=n,s=Boolean(null==o?void 0:o.code),c=Boolean(null==t?void 0:t.code);if(!s&&c)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(s&&!c)return this.container.innerHTML="",this.createInputContainer(),void 0;if(c&&this.promoCodePill&&t.discountAmount!==(null==o?void 0:o.discountAmount))return this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",void 0}}createAppliedContainer(t){const n=document.createElement("div");n.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("promo-remove-btn"),o.textContent="Remove",o.setAttribute("role","button"),o.setAttribute("aria-label","Remove promo code "+(null==t?void 0:t.code)),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),n.appendChild(this.promoCodePill),n.appendChild(o),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){const t=document.createElement("div");t.classList.add("promo-code-container");const n=document.createElement("div");n.classList.add("promo-container"),n.appendChild(this.createPromoInput()),n.appendChild(this.createApplyButton()),t.appendChild(n),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(),n=t.length>=3&&t.length<=255,o=this.getStoreValue("cart.loading"),s=this.getStoreValue("cart.promoCode"),c=this.getStoreValue("cart.events")||[],l=hasCartAnyPromoCodeEvents(c);this.applyButton.disabled=!n||o||Boolean(null==s?void 0:s.discountAmount)||this.isApplying||l}createPromoInput(){const t=this.getConfigs("global");return this.promoInput=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"promoCode",placeholder:"Enter promo code",autocomplete:![],className:"promo-input "+t.layout.inputFieldStyle,validation:{min:3,max:255},onChange:t=>{const n=t.toUpperCase(),o=this.promoInput;o.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const p=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(n){this.logger.error("Cart promo code application failed",{promoCode:t,error:n instanceof Error?n.message:String(n)})}};return this.applyButton.addEventListener("click",p),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p())}),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 n=document.createElement("div");n.classList.add("promo-applied-container"),this.promoCodePill=document.createElement("div"),this.promoCodePill.classList.add("promo-code-pill"),this.promoCodePill.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("promo-remove-btn"),o.textContent="Remove",o.setAttribute("role","button"),o.setAttribute("aria-label","Remove promo code "+t.code),o.setAttribute("tabindex","0"),o.addEventListener("click",async()=>{await this.commands.cart.removePromoCode()}),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||this.commands.cart.removePromoCode()}),n.appendChild(this.promoCodePill),n.appendChild(o),n}const n=document.createElement("div");n.classList.add("promo-code-container");const o=document.createElement("div");return o.classList.add("promo-container"),o.appendChild(this.createPromoInput()),o.appendChild(this.createApplyButton()),n.appendChild(o),n}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodePill=null}}class CartRetailerComponent extends BaseComponent{constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerId(){return this.params.retailerId}createFulfillmentElement(t){return ComponentFactoryService.createElement({type:s.CART_FULFILLMENT,fulfillmentId:t})}getFulfillmentElementById(t){return this.container.querySelector('[data-fulfillment-id="'+t+'"]')}getFulfillmentContainer(){return this.container.querySelector("#retailer-fulfillment-container")}getFulfillmentInsertionPoint(){const t=this.getFulfillmentContainer();if(t)return{parent:t.parentElement,nextSibling:t.nextElementSibling};const n=this.container.querySelectorAll("[data-fulfillment-id]");if(n.length>0){const t=n[n.length-1];return{parent:t.parentElement,nextSibling:t.nextElementSibling}}return null}addFulfillmentElement(t){const n=this.getFulfillmentInsertionPoint();if(n){const o=this.createFulfillmentElement(t);o.setAttribute("data-fulfillment-id",t);const s=this.getFulfillmentContainer();s&&s.remove(),n.nextSibling?n.parent.insertBefore(o,n.nextSibling):n.parent.appendChild(o)}}removeFulfillmentElement(t){const n=this.getFulfillmentElementById(t);if(n){const t=n.parentElement,o=n.nextElementSibling;n.remove();const s=this.container.querySelectorAll("[data-fulfillment-id]");if(0===s.length){const n=document.createElement("div");n.id="retailer-fulfillment-container",o?t.insertBefore(n,o):t.appendChild(n)}}}handleFulfillmentsUpdate(t,n){const o=new Set(t||[]),s=new Set(n||[]);for(const c of o)s.has(c)||this.removeFulfillmentElement(c);for(const c of s)o.has(c)||this.addFulfillmentElement(c)}setupFulfillmentElements(){const t=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+t+".fulfillments")||[],o=this.container.querySelectorAll("[data-fulfillment-id]");for(const c of o)c.remove();let s=this.getFulfillmentContainer();if(!s){const t=this.container.querySelector(".retailer-body-container"),n=this.container.querySelector("#retailer-subtotal-container");s=document.createElement("div"),s.id="retailer-fulfillment-container",t&&n&&t.insertBefore(s,n)}for(const c of n)this.addFulfillmentElement(c)}setupSubtotalElement(){const t=this.getRetailerId(),n=this.container.querySelector("#retailer-subtotal-container");if(n){const o=ComponentFactoryService.createElement({type:s.CART_RETAILER_SUBTOTAL,retailerId:t});n.replaceWith(o)}}onStoreChanged(t){const n=this.getRetailerId(),o="cart.retailers."+n,s=t.find(t=>t.path===o);if(s){const t=s.oldValue,n=s.value,o=(null==t?void 0:t.fulfillments)||[],c=(null==n?void 0:n.fulfillments)||[];JSON.stringify(o)!==JSON.stringify(c)&&this.handleFulfillmentsUpdate(o,c)}return![]}afterRender(){this.setupFulfillmentElements(),this.setupSubtotalElement(),this.setupSectionToggle()}setupSectionToggle(){const t=this.container.querySelector(".section-toggle"),n=this.container.querySelector(".retailer-section"),o=this.container.querySelector(".section-header-label");if(t&&n&&o){const k=()=>{const n=t.checked;o.setAttribute("aria-label",n?"Expand retailer section":"Collapse retailer section"),o.setAttribute("aria-expanded",n?"false":"true")};t.addEventListener("change",()=>{t.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),k()}),o.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())}),t.checked?n.classList.add("collapsed"):n.classList.remove("collapsed"),k()}}template(){const t=this.getRetailerId(),n=this.getStoreValue("cart.retailers."+t),o=document.createElement("section");o.className="retailer-section";const s=document.createElement("div");s.className="cart-retailer-header";const c=document.createElement("div");c.className="retailer-info";const l=document.createElement("h2");l.className="section-title",l.textContent=n.name,c.appendChild(l);const d=document.createElement("input");d.type="checkbox",d.id=n.id,d.className="section-toggle",c.appendChild(d);const u=document.createElement("label");u.htmlFor=n.id,u.className="section-header-label",u.setAttribute("role","button"),u.setAttribute("tabindex","0"),u.setAttribute("aria-label","Collapse retailer section"),u.setAttribute("aria-expanded","true");const h=document.createElement("span");h.className="chevron",h.innerHTML=ChevronDownIcon({width:20,height:20,className:"chevron-down-icon"}),u.appendChild(h),c.appendChild(u),s.appendChild(c),o.appendChild(s);const m=document.createElement("div");m.className="retailer-body-container";const f=document.createElement("div");f.id="retailer-fulfillment-container",m.appendChild(f);const g=document.createElement("div");return g.id="retailer-subtotal-container",m.appendChild(g),o.appendChild(m),o}}class CartRetailerSubtotalComponent extends BaseComponent{get hostClasses(){return["retailer-subtotal-container"]}constructor(){super({watchStorePaths:["cart.retailers.{retailerId}"],autoDestroy:!![],autoDestroyPath:"cart.retailers.{retailerId}"})}getRetailerItemCount(t,n){const o=Object.values(t||{}).filter(t=>t.retailerId===n);let s=0;for(const c of o)s+=c.quantity;return s}template(){const t=this.params.retailerId,n=this.getStoreValue("cart.retailers."+t+".subtotal")||0,o=this.getStoreValue("cart.retailers."+t+".engravingFee")||0,s=this.getStoreValue("cart.items"),c=this.getRetailerItemCount(s,t),l=1===c?"item":"items",d=document.createElement("h3");d.className="retailer-subtotal-header",d.textContent="Subtotal ("+c+" "+l+"):";const u=document.createElement("span");return u.className="retailer-subtotal-amount",u.textContent=formatCentToDollarText(n+o),[d,u]}}class CheckoutComponent extends BaseComponent{constructor(){super({watchStorePaths:["checkout.rerender","checkout.presale"]})}template(){var t,n,o;const c=this.store.get("checkout.presale"),l=this.getConfigs("global"),d=this.clientConfig.get("promoTicker"),u=null!==(n=null===(t=null==l?void 0:l.experienceFeatures)||void 0===t?void 0:t.promoTicker)&&void 0!==n?n:[],h=null!=d?d:u,m=this.store.get("address"),f=hasActiveItems(h,null===(o=null==m?void 0:m.address)||void 0===o?void 0:o.state),g=this.params.isIndependentComponent&&!this.clientConfig.isBuilder(),v=document.createElement("div");v.classList.add("checkout-container"),g&&v.classList.add("no-header"),this.params.isIndependentComponent&&v.classList.add("independent");const y=ComponentFactoryService.createElement({type:s.CHECKOUT_INFORMATION});v.appendChild(y);const b=ComponentFactoryService.createElement({type:s.CHECKOUT_ORDER_SUMMARY});if(v.appendChild(b),!c&&(!h.length||!f)&&g)return[v];const x=document.createElement("div");if(x.classList.add("checkout-header-wrapper"),!g){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_HEADER});x.appendChild(t)}if(h.length&&f&&!c){const t=ComponentFactoryService.createElement({context:"checkout",type:s.PROMO_CODE_TICKER,tickers:h});x.appendChild(t)}if(c){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_PRESALE_COUNTDOWN});x.appendChild(t)}return[x,v]}}class CheckoutAmountsComponent extends BaseComponent{get hostClasses(){return["checkout-amounts-container"]}constructor(){super({watchStorePaths:["checkout.amounts"]})}template(){var t,n,o;const s=this.getStoreValue("checkout"),c=Boolean(s.promoCode),l=Boolean(null===(t=s.giftCards)||void 0===t?void 0:t.length),d=this.getConfigs("global"),u=Object.keys(s.onDemandFulfillmentTipInfo||{}).length>0,h=Object.values(s.items||{}),m=[],f=document.createElement("div");f.classList.add("checkout-amount-line");const g=document.createElement("span");g.textContent="Subtotal ("+h.length+" item"+(h.length>1?"s":"")+")",f.appendChild(g);const v=document.createElement("span");v.textContent=formatCentToDollarText(s.amounts.subtotal),f.appendChild(v),m.push(f);const y=document.createElement("div");y.classList.add("checkout-amount-line");const b=document.createElement("span");b.textContent="Shipping",y.appendChild(b);const x=document.createElement("span");x.textContent=formatCentToDollarText(s.amounts.shipping),y.appendChild(x),m.push(y);const w=document.createElement("div");w.classList.add("checkout-amount-line");const E=document.createElement("span");E.textContent="Delivery",w.appendChild(E);const _=document.createElement("span");if(_.textContent=formatCentToDollarText(s.amounts.delivery),w.appendChild(_),m.push(w),(null===(n=null==s?void 0:s.amounts)||void 0===n?void 0:n.engraving)>0){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Engraving",t.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(s.amounts.engraving),t.appendChild(o),m.push(t)}const T=document.createElement("div");T.classList.add("checkout-amount-line");const D=document.createElement("span");D.textContent="Taxes & Fees",T.appendChild(D);const P=document.createElement("span");if(P.textContent=formatCentToDollarText(s.amounts.tax+s.amounts.service+s.amounts.platform),T.appendChild(P),m.push(T),c){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Promo Code ("+(null===(o=s.promoCode)||void 0===o?void 0:o.code.toUpperCase())+")",t.appendChild(n);const c=document.createElement("span");c.textContent="-"+formatCentToDollarText(s.amounts.discounts),t.appendChild(c),m.push(t)}if(l){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Gift Cards Applied",t.appendChild(n);const o=document.createElement("span");o.textContent="-"+formatCentToDollarText(s.amounts.giftCards),t.appendChild(o),m.push(t)}if(u){const t=document.createElement("div");t.classList.add("checkout-amount-line");const n=document.createElement("span");n.textContent="Tips",t.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(s.amounts.tip),t.appendChild(o),m.push(t)}const F=document.createElement("div");F.classList.add("checkout-separator"),m.push(F);const A=document.createElement("div");A.classList.add("checkout-amount-total");const z=document.createElement("span");z.textContent="Total",A.appendChild(z);const O=document.createElement("span");if(O.textContent=formatCentToDollarText(s.amounts.total),A.appendChild(O),m.push(A),s.presale){const t=document.createElement("div");t.classList.add("checkout-amount-due");const n=document.createElement("span");n.textContent="Amount due today",t.appendChild(n);const o=document.createElement("span");o.textContent=formatCentToDollarText(0),t.appendChild(o),m.push(t);const s=document.createElement("div");s.classList.add("checkout-presale-locked-message");const c=htmlStringToElement(InfoIcon({color:d.theme.defaultTextColor}));s.appendChild(c);const l=document.createElement("p");l.textContent="Pre-ordered items will be charged when shipped.",s.appendChild(l),m.push(s)}return m}}const ft="lce-checkout-stripe-slot",gt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",birthDate:"birthDate",addressTwo:"addressTwo",company:"company"},vt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",addressTwo:"addressTwo",message:"message"},yt={firstName:"firstName",lastName:"lastName",email:"email",phone:"phone",company:"company",addressOne:"addressOne",addressTwo:"addressTwo",city:"city",state:"state",zipCode:"zipCode"};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"),n=document.createElement("div");n.classList.add("checkout-billing-same-as-shipping-toggle-container");const o=document.createElement("div");o.classList.add("checkout-checkbox-container");const 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",t?"true":"false"),t&&s.classList.add("checked"),s.innerHTML=CheckboxIcon({width:16,height:16}),n.addEventListener("click",async()=>{await this.commands.checkout.toggleBillingSameAsShipping()}),n.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleBillingSameAsShipping())});const c=document.createElement("label");return c.textContent="Billing address same as shipping address",c.setAttribute("for","billingSameAsShipping"),c.classList.add("billing-checkbox-label"),o.appendChild(s),o.appendChild(c),n.appendChild(o),n}updateSaveButtonState(){const t=!Object.values(this.billingData).every(t=>t.isValid),n={firstName:this.billingData.firstName.value,lastName:this.billingData.lastName.value,email:this.billingData.email.value,phone:this.billingData.phone.value,company:this.billingData.company.value,addressOne:this.billingData.addressOne.value,addressTwo:this.billingData.addressTwo.value,city:this.billingData.city.value,state:this.billingData.state.value,zipCode:this.billingData.zipCode.value};this.params.isFormValid(!t,n)}template(){const t=this.getStoreValue("checkout.paymentForm"),n=[],c=this.billingSameAsShippingToggle();if(n.push(c),t.billingSameAsShipping)return n;t.data&&(t.data.firstName&&(this.billingData.firstName={isValid:!![],value:t.data.firstName}),t.data.lastName&&(this.billingData.lastName={isValid:!![],value:t.data.lastName}),t.data.email&&(this.billingData.email={isValid:!![],value:t.data.email}),t.data.phone&&(this.billingData.phone={isValid:!![],value:t.data.phone}),t.data.company&&(this.billingData.company={isValid:!![],value:t.data.company}),t.data.addressOne&&(this.billingData.addressOne={isValid:!![],value:t.data.addressOne}),t.data.addressTwo&&(this.billingData.addressTwo={isValid:!![],value:t.data.addressTwo}),t.data.city&&(this.billingData.city={isValid:!![],value:t.data.city}),t.data.state&&(this.billingData.state={isValid:!![],value:t.data.state}),t.data.zipCode&&(this.billingData.zipCode={isValid:!![],value:t.data.zipCode})),this.updateSaveButtonState();const l=document.createElement("div");l.classList.add("section-title-container");const d=document.createElement("h3");d.textContent="Your billing info",d.classList.add("section-title"),l.appendChild(d);const u=document.createElement("p");u.textContent="Provide the info relevant to your payment method",u.classList.add("section-subtitle"),l.appendChild(u),n.push(l);const h=document.createElement("div");h.classList.add("section-form-container");const m=document.createElement("div");m.classList.add("checkout-two-col-container");const f=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:yt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.firstName.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.firstName})},onValidation:t=>{this.billingData.firstName.isValid=t,this.updateSaveButtonState()}});f.setAttribute("aria-label","First name input"),m.appendChild(f);const g=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:yt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.lastName.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.lastName})},onValidation:t=>{this.billingData.lastName.isValid=t,this.updateSaveButtonState()}});g.setAttribute("aria-label","Last name input"),m.appendChild(g),h.appendChild(m);const v=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:yt.email,label:"Email",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.email.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.email})},onValidation:t=>{this.billingData.email.isValid=t,this.updateSaveButtonState()}});v.setAttribute("aria-label","Email input"),h.appendChild(v);const y=document.createElement("div");y.classList.add("checkout-two-col-container");const b=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:yt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.phone.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.phone})},onValidation:t=>{this.billingData.phone.isValid=t,this.updateSaveButtonState()}});b.setAttribute("aria-label","Phone input"),y.appendChild(b);const x=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:yt.company,label:"Company (optional)",autocomplete:!![],onChange:async t=>{this.billingData.company.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.company})},onValidation:t=>{this.billingData.company.isValid=t,this.updateSaveButtonState()}});x.setAttribute("aria-label","Company input"),y.appendChild(x),h.appendChild(y);const w=document.createElement("div");w.classList.add("checkout-two-col-container");const E=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:yt.addressOne,label:"Street Address",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.addressOne.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.addressOne})},onValidation:t=>{this.billingData.addressOne.isValid=t,this.updateSaveButtonState()}});E.setAttribute("aria-label","Street address input"),w.appendChild(E);const _=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:yt.addressTwo,label:"Apt, suite, etc. (optional)",onChange:async t=>{this.billingData.addressTwo.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.addressTwo})},onValidation:t=>{this.billingData.addressTwo.isValid=t,this.updateSaveButtonState()}});_.setAttribute("aria-label","Apt, suite, etc. (optional) input"),w.appendChild(_),h.appendChild(w);const T=document.createElement("div");T.classList.add("checkout-three-col-container");const D=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:yt.city,label:"City",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.city.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.city})},onValidation:t=>{this.billingData.city.isValid=t,this.updateSaveButtonState()}});D.setAttribute("aria-label","City input"),T.appendChild(D);const P=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:yt.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(o.BILLING,{fieldName:yt.state})},onValidation:t=>{this.billingData.state.isValid=t,this.updateSaveButtonState()}});P.setAttribute("aria-label","State input"),T.appendChild(P);const F=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:yt.zipCode,label:"Zip Code",autocomplete:!![],validation:{required:!![]},onChange:async t=>{this.billingData.zipCode.value=t,this.pubSub.publishForm(o.BILLING,{fieldName:yt.zipCode})},onValidation:t=>{this.billingData.zipCode.isValid=t,this.updateSaveButtonState()}});return F.setAttribute("aria-label","Zip Code input"),T.appendChild(F),h.appendChild(T),n.push(h),n}}class CheckoutBuyer extends BaseComponent{get hostClasses(){return["checkout-buyer-information"]}constructor(){super({watchStorePaths:["checkout.customerForm.data"],watchOnlyStorePaths:["checkout.customerForm.isSaving"]}),this.customerData={firstName:{isValid:![],value:""},lastName:{isValid:![],value:""},email:{isValid:![],value:""},phone:{isValid:![],value:""},addressTwo:{isValid:![],value:""},company:{isValid:![],value:""},birthDate:{isValid:![],value:""}},this.saveButtonText="Save Buyer Information"}onStoreWatch(t){const n=t.find(t=>"checkout.customerForm.isSaving"===t.path);n&&(n.value?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState()))}updateSaveButtonState(){this.saveButton.disabled=!(this.customerData.firstName.isValid&&this.customerData.lastName.isValid&&this.customerData.email.isValid&&this.customerData.phone.isValid&&this.customerData.birthDate.isValid)}template(){const 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 n=[],c=document.createElement("div");c.classList.add("section-title-container");const l=document.createElement("h3");l.textContent="Buyer Information",l.classList.add("section-title"),c.appendChild(l);const d=document.createElement("p");d.textContent="Buyer information is used to process your order and for delivery purposes.",d.classList.add("section-subtitle"),c.appendChild(d),n.push(c);const u=document.createElement("div");u.classList.add("section-form-container");const h=document.createElement("div");h.classList.add("checkout-two-col-container");const m=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:gt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:t.firstName,onChange:async t=>{this.customerData.firstName.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.firstName})},onValidation:t=>{this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});h.appendChild(m);const f=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:gt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:t.lastName,onChange:async t=>{this.customerData.lastName.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.lastName})},onValidation:t=>{this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});h.appendChild(f),u.appendChild(h);const g=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:gt.company,label:"Company (optional)",autocomplete:!![],value:t.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});u.appendChild(g);const v=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:gt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:t.email,onChange:async t=>{this.customerData.email.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.email})},onValidation:t=>{this.customerData.email.isValid=t,this.updateSaveButtonState()}});u.appendChild(v);const y=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:gt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:t.phone,onChange:async t=>{this.customerData.phone.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.phone})},onValidation:t=>{this.customerData.phone.isValid=t,this.updateSaveButtonState()}});u.appendChild(y);const b=ComponentFactoryService.createElement({type:s.BIRTHDATE_INPUT,inputType:"date",name:gt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:t.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});return u.appendChild(b),n.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:""})}),n.push(this.saveButton),this.updateSaveButtonState(),n}}class CheckoutBuyerSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.customerForm"]})}template(){const t=[],n=this.getStoreValue("checkout.customerForm.data"),o=document.createElement("div");o.classList.add("checkout-summary-form-header");const s=document.createElement("h2");s.textContent="Buyer: "+n.firstName+" "+n.lastName,o.appendChild(s);const c=document.createElement("span");if(c.textContent="Edit",c.addEventListener("click",async()=>{await this.commands.checkout.editCustomerForm()}),o.appendChild(c),t.push(o),n.company){const o=document.createElement("p");o.classList.add("checkout-summary-form-line"),o.textContent=n.company,t.push(o)}const l=document.createElement("p");l.classList.add("checkout-summary-form-line"),l.textContent=n.email,t.push(l);const d=document.createElement("p");d.classList.add("checkout-summary-form-line"),d.textContent=n.phone,t.push(d);const u=document.createElement("p");return u.classList.add("checkout-summary-form-line"),u.textContent=formatISODateToMMDDYYYY(n.birthDate),t.push(u),t}}const bt=["span","p","a","b","i","div","strong","em","u","br","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","code","pre","img"],xt={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,n){return"href"===t?/^(https?:\/\/[^\s<>"']+|mailto:[^\s<>"']+|tel:[^\s<>"']+|\/[^\s<>"']*|#[^\s<>"']*)$/i.test(n)?n:null:"src"===t?/^https?:\/\/[^\s<>"']+$/i.test(n)?n:null:"class"===t?n.replace(/[^a-zA-Z0-9\s\-_]/g,"").trim():n.replace(/[<>"']/g,"").trim()}function cleanNode(t){if(t.nodeType===Node.TEXT_NODE){const n=t.textContent||"",o=n.replace(/<[^>]*>/g,"");if(o.trim()){const t=document.createTextNode(o);return t}return null}if(t.nodeType===Node.ELEMENT_NODE){const n=t,o=n.tagName.toLowerCase();if(bt.includes(o)){const t=document.createElement(o),s=xt[o]||[];for(const o of Array.from(n.attributes)){const n=o.name.toLowerCase();if(s.includes(n)){const s=sanitizeAttributeValue(n,o.value);null!==s&&t.setAttribute(n,s)}}"a"===o&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"));for(const o of Array.from(n.childNodes)){const n=cleanNode(o);n&&t.appendChild(n)}return t}const s=document.createDocumentFragment();for(const t of Array.from(n.childNodes)){const n=cleanNode(t);n&&s.appendChild(n)}return s.childNodes.length>0?s:null}return null}function sanitizeHTML(t){if(!t||"string"!=typeof t)return"";try{const n=new DOMParser,o=n.parseFromString(t,"text/html"),s=o.querySelector("parsererror");if(s)return console.warn("HTML parsing error detected"),"";const c=document.createDocumentFragment();for(const t of Array.from(o.body.childNodes)){const n=cleanNode(t);n&&c.appendChild(n)}const l=document.createElement("div");return l.appendChild(c),l.innerHTML}catch(n){return console.error("HTML sanitization error:",n),""}}class CheckoutCompletedComponent extends BaseComponent{get hostClasses(){return["checkout-completed-container"]}template(){var t,n,o,c,l,d;const u=[],h=this.getConfigs("configurations"),m=this.getConfigs("global"),f=this.getConfigs("checkout"),g=this.config.layout.exitUrl||window.location.host,v=this.config.layout.thankYouButtonText||"Continue Shopping";if(null===(n=null===(t=this.config.layout)||void 0===t?void 0:t.checkoutCompleted)||void 0===n?void 0:n.customLogo){const t=document.createElement("div");t.classList.add("checkout-completed-header-container");const n=document.createElement("img");n.src=null===(c=null===(o=this.config.layout)||void 0===o?void 0:o.checkoutCompleted)||void 0===c?void 0:c.customLogo,n.alt=h.partnerName+" Logo",t.appendChild(n),u.push(t)}const y=document.createElement("div");y.classList.add("checkout-completed-section-container");const b=document.createElement("div");b.classList.add("checkout-completed-title-container");const x=document.createElement("div");x.classList.add("checkout-completed-title-section");const w=document.createElement("h3");w.innerHTML=(null===(d=null===(l=this.config.layout)||void 0===l?void 0:l.checkoutCompleted)||void 0===d?void 0:d.customText)||"Thank You for Your Order!",x.appendChild(w);const E=document.createElement("p");E.textContent="Your payment has been successfully processed.",x.appendChild(E),b.appendChild(x),y.appendChild(b);const _=document.createElement("div");_.classList.add("checkout-completed-sub-section");const T=document.createElement("div");T.classList.add("checkout-completed-line");const D=document.createElement("h3");D.textContent="Order Number",T.appendChild(D);const P=document.createElement("span");P.textContent=this.params.orderNumber,T.appendChild(P),_.appendChild(T);const F=document.createElement("div");F.classList.add("checkout-completed-line");const A=document.createElement("h3");A.textContent="Order Amount",F.appendChild(A);const z=document.createElement("span");z.textContent=""+formatCentToDollarText(this.params.orderTotal),F.appendChild(z),_.appendChild(F);const O=document.createElement("div");O.classList.add("checkout-completed-line");const N=document.createElement("h3");N.textContent="Payment Method",O.appendChild(N);const L=document.createElement("span");L.textContent="** "+this.params.cardLast4,O.appendChild(L),_.appendChild(O),y.appendChild(_);const R=document.createElement("div");R.classList.add("checkout-completed-sub-section");const B=document.createElement("p");B.innerHTML=this.params.giftRecipientEmail?"Order updates and your gift message will be sent to <strong>"+this.params.giftRecipientEmail+"</strong>.<br><br>A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.":"A confirmation email and receipt has been sent to <strong>"+this.params.customerEmail+"</strong>.",R.appendChild(B),y.appendChild(R),u.push(y);const q=document.createElement("div");q.classList.add("checkout-completed-section-container");const j=document.createElement("button");j.type="button";const U=document.createElement("span");U.textContent=v,j.setAttribute("tabindex","0"),j.setAttribute("role","button"),j.setAttribute("aria-label",v),j.appendChild(U);const G=htmlStringToElement(ArrowRightIcon({width:16,height:16,color:m.theme.selectedTextColor}));j.appendChild(G),j.addEventListener("click",()=>{window.location.href=g}),j.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),window.location.href=g)}),q.appendChild(j),u.push(q);const V=document.createElement("div");V.classList.add("checkout-completed-section-container");const K=document.createElement("div");K.classList.add("checkout-completed-help-section"),V.appendChild(K);const H=document.createElement("p");H.textContent="Questions about your order? Contact us at ";const W=document.createElement("a");W.href="mailto:"+h.supportEmail,W.textContent=h.supportEmail,H.appendChild(W),K.appendChild(H);const Q=document.createElement("p"),Z=(new Date).toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});if(Q.textContent="Order placed on "+Z,K.appendChild(Q),u.push(V),f.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const n=document.createElement("div");n.classList.add("checkout-legal-message"),n.innerHTML=sanitizeHTML(f.layout.legalMessage.text);const o=document.createElement("div");o.classList.add("checkout-separator"),u.push(t),u.push(n),u.push(o)}if(m.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"general"});u.push(t)}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(t){const n=t.find(t=>"checkout.customerForm.isSaving"===t.path),o=t.find(t=>"checkout.giftRecipientForm.isSaving"===t.path);(null==n?void 0:n.value)||(null==o?void 0:o.value)?(this.saveButton.textContent="Saving...",this.saveButton.disabled=!![]):(this.saveButton.textContent=this.saveButtonText,this.updateSaveButtonState())}updateSaveButtonState(){const t=this.getStoreValue("checkout.isGift")||![];let n;n=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=n}template(){const t=this.getConfigs("global"),n=this.getStoreValue("checkout.isGift"),c=this.store.get("checkout.giftRecipientForm.data"),l=this.store.get("checkout.customerForm.data"),d=this.store.get("address.formattedAddress"),u=n?c:l,h=this.store.get("checkout.shippingAddressTwo"),m=this.store.get("checkout.deliveryInstructions");l.firstName&&(this.customerData.firstName={isValid:!![],value:l.firstName}),l.lastName&&(this.customerData.lastName={isValid:!![],value:l.lastName}),l.email&&(this.customerData.email={isValid:!![],value:l.email}),l.phone&&(this.customerData.phone={isValid:!![],value:l.phone}),l.company&&(this.customerData.company={isValid:!![],value:l.company}),l.birthDate&&(this.customerData.birthDate={isValid:!![],value:l.birthDate}),c.firstName&&(this.giftData.firstName={isValid:!![],value:c.firstName}),c.lastName&&(this.giftData.lastName={isValid:!![],value:c.lastName}),c.email&&(this.giftData.email={isValid:!![],value:c.email}),c.phone&&(this.giftData.phone={isValid:!![],value:c.phone}),c.message&&(this.giftData.message={isValid:!![],value:c.message}),h&&(this.customerData.addressTwo={isValid:!![],value:h},this.giftData.addressTwo={isValid:!![],value:h}),m&&(this.customerData.deliveryInstructions={isValid:!![],value:m},this.giftData.deliveryInstructions={isValid:!![],value:m});const f=Object.keys(this.store.get("checkout.onDemandFulfillmentTipInfo")||{}).length>0,g=[],v=document.createElement("div");v.classList.add("delivery-header-container");const y=document.createElement("div");y.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),v.appendChild(b),g.push(v);const E=document.createElement("div");E.classList.add("section-form-container");const _=document.createElement("div");_.classList.add("checkout-two-col-container");const T=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:n?vt.firstName:gt.firstName,label:"First Name",autocomplete:!![],validation:{required:!![]},value:u.firstName,onChange:t=>{n?(this.giftData.firstName.value=t,this.pubSub.publishForm(o.GIFT,{fieldName:vt.firstName})):(this.customerData.firstName.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.firstName}))},onValidation:t=>{n?this.giftData.firstName.isValid=t:this.customerData.firstName.isValid=t,this.updateSaveButtonState()}});T.setAttribute("aria-label","First Name Input"),_.appendChild(T);const D=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:n?vt.lastName:gt.lastName,label:"Last Name",autocomplete:!![],validation:{required:!![]},value:u.lastName,onChange:t=>{n?(this.giftData.lastName.value=t,this.pubSub.publishForm(o.GIFT,{fieldName:vt.lastName})):(this.customerData.lastName.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.lastName}))},onValidation:t=>{n?this.giftData.lastName.isValid=t:this.customerData.lastName.isValid=t,this.updateSaveButtonState()}});if(D.setAttribute("aria-label","Last Name Input"),_.appendChild(D),E.appendChild(_),!n){const t=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:gt.company,label:"Company (optional)",autocomplete:!![],value:u.company,onChange:async t=>{this.customerData.company.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.company})},onValidation:t=>{this.customerData.company.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Company Input"),E.appendChild(t)}const P=ComponentFactoryService.createElement({type:s.INPUT,inputType:"email",name:n?vt.email:gt.email,label:"Email",autocomplete:!![],validation:{required:!![]},value:u.email,onChange:t=>{n?(this.giftData.email.value=t,this.pubSub.publishForm(o.GIFT,{fieldName:vt.email})):(this.customerData.email.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.email}))},onValidation:t=>{n?this.giftData.email.isValid=t:this.customerData.email.isValid=t,this.updateSaveButtonState()}});P.setAttribute("aria-label","Email Input"),E.appendChild(P);const F=ComponentFactoryService.createElement({type:s.INPUT,inputType:"tel",name:n?vt.phone:gt.phone,label:"Phone",autocomplete:!![],validation:{required:!![]},value:u.phone,onChange:t=>{n?(this.giftData.phone.value=t,this.pubSub.publishForm(o.GIFT,{fieldName:vt.phone})):(this.customerData.phone.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.phone}))},onValidation:t=>{n?this.giftData.phone.isValid=t:this.customerData.phone.isValid=t,this.updateSaveButtonState()}});if(F.setAttribute("aria-label","Phone Input"),E.appendChild(F),!n){const t=ComponentFactoryService.createElement({type:s.BIRTHDATE_INPUT,inputType:"date",name:gt.birthDate,label:"Birthdate",validation:{required:!![],minAge:21,minYear:1930},value:u.birthDate,onChange:async t=>{this.customerData.birthDate.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.birthDate})},onValidation:t=>{this.customerData.birthDate.isValid=t,this.updateSaveButtonState()}});t.setAttribute("aria-label","Birthdate Input"),E.appendChild(t)}const A=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:"address_one",label:"Delivery address",value:d,disabled:!![],className:"disabled-input"});A.setAttribute("aria-label","Delivery Address Input"),E.appendChild(A);const z=ComponentFactoryService.createElement({type:s.INPUT,inputType:"text",name:n?vt.addressTwo:gt.addressTwo,label:"Apt, suite, etc. (optional)",value:h,onChange:t=>{n?(this.giftData.addressTwo.value=t,this.pubSub.publishForm(o.GIFT,{fieldName:vt.addressTwo})):(this.customerData.addressTwo.value=t,this.pubSub.publishForm(o.CUSTOMER,{fieldName:gt.addressTwo}))},onValidation:t=>{n?this.giftData.addressTwo.isValid=t:this.customerData.addressTwo.isValid=t,this.updateSaveButtonState()}});if(z.setAttribute("aria-label","Address Line 2 Input"),E.appendChild(z),n){const n=document.createElement("div");n.classList.add("custom-input","textarea",t.layout.inputFieldStyle);const s=document.createElement("label");s.textContent="Gift Message*",s.setAttribute("for",vt.message);const l=document.createElement("textarea");l.name=vt.message,l.id=vt.message,l.rows=4,l.value=c.message||"",l.setAttribute("aria-label","Gift Message Textarea"),l.addEventListener("input",async t=>{const n=t.target.value;this.giftData.message.value=n,this.giftData.message.isValid=n.length>0,this.pubSub.publishForm(o.GIFT,{fieldName:vt.message}),this.updateSaveButtonState()});const d=document.createElement("p");d.textContent="Your gift message will be emailed to the recipient along with delivery details.",d.classList.add("textarea-message-disclaimer"),n.appendChild(s),n.appendChild(l),n.appendChild(d),E.appendChild(n)}if(f){const o=document.createElement("div");o.classList.add("custom-input","textarea",t.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=m,c.addEventListener("input",async t=>{const o=t.target.value;n?(this.giftData.deliveryInstructions.value=o,this.giftData.deliveryInstructions.isValid=o.length>0):(this.customerData.deliveryInstructions.value=o,this.customerData.deliveryInstructions.isValid=o.length>0)});const l=document.createElement("p");l.textContent="Include gate codes, apartment numbers, or preferred drop-off locations for your driver.",l.classList.add("textarea-message-disclaimer"),o.appendChild(s),o.appendChild(c),o.appendChild(l),E.appendChild(o)}return g.push(E),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()=>{n&&await this.commands.checkout.saveGiftRecipientForm({firstName:this.giftData.firstName.value,lastName:this.giftData.lastName.value,email:this.giftData.email.value,phone:this.giftData.phone.value,message:this.giftData.message.value,shippingAddressTwo:this.giftData.addressTwo.value,deliveryInstructions:this.giftData.deliveryInstructions.value}),n||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})}),g.push(this.saveButton),this.updateSaveButtonState(),g}}class CheckoutDeliverToSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-form-container"]}constructor(){super({watchStorePaths:["checkout.isGift","checkout.customerForm","checkout.giftRecipientForm","checkout.deliveryInstructions"]})}template(){const t=[],n=this.getStoreValue("checkout.isGift"),o=this.getStoreValue("checkout.customerForm.data"),s=this.getStoreValue("checkout.giftRecipientForm.data"),c=this.getStoreValue("address"),l=this.getStoreValue("checkout.deliveryInstructions"),d=this.getStoreValue("checkout.shippingAddressTwo"),u=document.createElement("div");u.classList.add("checkout-summary-form-header");const h=document.createElement("h2");h.textContent=n?"Delivering to: "+s.firstName+" "+s.lastName:"Delivering to: "+o.firstName+" "+o.lastName,u.appendChild(h);const m=document.createElement("span");if(m.textContent="Edit",m.addEventListener("click",async()=>{n?await this.commands.checkout.editGiftRecipientForm():await this.commands.checkout.editCustomerForm()}),u.appendChild(m),t.push(u),!n&&o.company){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=o.company,t.push(n)}const f=document.createElement("p");f.classList.add("checkout-summary-form-line"),f.textContent=c.address.one+(d?", "+d:"")+", "+c.address.city+", "+c.address.state+", "+c.address.zip,t.push(f);const g=document.createElement("p");g.classList.add("checkout-summary-form-line"),g.textContent=n?s.email:o.email,t.push(g);const v=document.createElement("p");if(v.classList.add("checkout-summary-form-line"),v.textContent=n?s.phone:o.phone,t.push(v),!n&&o.birthDate){const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=formatISODateToMMDDYYYY(o.birthDate),t.push(n)}if(n){const n=document.createElement("div");n.classList.add("checkout-summary-form-line-container");const o=document.createElement("span");o.classList.add("checkout-summary-form-line-container-label"),o.textContent="Gift Message:",n.appendChild(o);const c=document.createElement("span");c.classList.add("checkout-summary-form-line"),c.textContent=s.message||"No message provided.",n.appendChild(c),t.push(n)}if(l){const n=document.createElement("div");n.classList.add("checkout-summary-form-line-container");const o=document.createElement("span");o.classList.add("checkout-summary-form-line-container-label"),o.textContent="Delivery Instructions:",n.appendChild(o);const s=document.createElement("span");s.classList.add("checkout-summary-form-line"),s.textContent=l||"No instructions provided.",n.appendChild(s),t.push(n)}return t}}class CheckoutGiftCardsComponent extends BaseComponent{get hostClasses(){return["input-gift-card-container"]}constructor(){super({watchOnlyStorePaths:["checkout.giftCards","checkout.giftCardError","checkout.loading"]}),this.isApplying=![],this.giftCardInput=null,this.applyButton=null}onStoreWatch(t){var n;const o=t.find(t=>"checkout.giftCards"===t.path),s=t.find(t=>"checkout.loading"===t.path);o&&o.value.length>((null===(n=o.oldValue)||void 0===n?void 0:n.length)||0)&&this.giftCardInput&&this.giftCardInput.setValue(""),s&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.giftCardInput)return;const t=this.giftCardInput.getValue().trim(),n=t.length>=3&&t.length<=255,o=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.giftCardError");this.applyButton.disabled=!n||o||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:t=>{const n=t.toUpperCase(),o=this.giftCardInput;o.setValue(n),this.updateApplyButtonState()}}),this.giftCardInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply gift card");const p=async()=>{const t=this.giftCardInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyGiftCard(t)}catch(n){this.logger.error("Checkout gift card application failed",{giftCardCode:t,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",p),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p())}),this.applyButton}template(){this.giftCardInput=null,this.applyButton=null;const t=[];return t.push(this.createGiftCardInput()),t.push(this.createApplyButton()),t}disconnected(){this.giftCardInput=null,this.applyButton=null}}class CheckoutHeaderComponent extends BaseComponent{get hostClasses(){return["checkout-header-container"]}template(){const t=this.store.get("checkout.presale"),n=this.getConfigs("checkout");let o=null;if(!t){o=document.createElement("button"),o.classList.add("checkout-header-button"),o.setAttribute("aria-label","Back to Cart"),o.addEventListener("click",()=>{if(this.clientConfig.isBuilder())return this.logger.info("Back To Cart Button Is Disabled In Builder Mode"),void 0;this.commands.ui.openDrawer(s.CART)});const t=document.createElement("span");t.innerHTML=ChevronLeftIcon({}),o.appendChild(t)}const c=document.createElement("h1");c.textContent=(null==n?void 0:n.layout.drawerHeaderText)||"Checkout",c.classList.add("checkout-header-title"),c.setAttribute("aria-label","Checkout Page");const l=document.createElement("button");return l.innerHTML=CloseIcon({width:16,height:16}),l.classList.add("checkout-header-button-close"),l.setAttribute("aria-label","Close Checkout"),l.addEventListener("click",()=>{this.commands.ui.closeDrawer()}),o?[o,c,l]:[c,l]}}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"),n=this.getStoreValue("checkout.customerForm.isEditing"),o=this.getStoreValue("checkout.giftRecipientForm.isEditing"),s=this.getStoreValue("checkout.paymentForm.isEditing");t?(this.buyerForm.style.display=n?"block":"none",this.buyerSummary.style.display=n?"none":"block",this.deliveryToForm.style.display=o?"block":"none",this.deliverToSummary.style.display=o?"none":"block"):(this.deliveryToForm.style.display=n?"block":"none",this.deliverToSummary.style.display=n?"none":"block",this.buyerForm.style.display="none",this.buyerSummary.style.display="none"),this.paymentForm.style.display=s?"block":"none",this.paymentSummary.style.display=s?"none":"block"}template(){const t=[],n=this.getStoreValue("checkout.isGift"),o=this.getStoreValue("checkout.customerForm"),c=this.getStoreValue("checkout.giftRecipientForm"),l=this.getStoreValue("checkout.paymentForm"),d=ComponentFactoryService.createElement({type:s.CHECKOUT_SEND_AS_GIFT});return t.push(d),this.deliveryToForm=ComponentFactoryService.createElement({type:s.CHECKOUT_DELIVER_TO}),this.deliveryToForm.style.display=n?c.isEditing?"block":"none":o.isEditing?"block":"none",t.push(this.deliveryToForm),this.deliverToSummary=ComponentFactoryService.createElement({type:s.CHECKOUT_DELIVER_TO_SUMMARY}),this.deliverToSummary.style.display=n?c.isEditing?"none":"block":o.isEditing?"none":"block",t.push(this.deliverToSummary),this.buyerForm=ComponentFactoryService.createElement({type:s.CHECKOUT_BUYER}),this.buyerForm.style.display=n&&o.isEditing?"block":"none",t.push(this.buyerForm),this.buyerSummary=ComponentFactoryService.createElement({type:s.CHECKOUT_BUYER_SUMMARY}),this.buyerSummary.style.display=n&&!o.isEditing?"block":"none",t.push(this.buyerSummary),this.paymentForm=ComponentFactoryService.createElement({type:s.CHECKOUT_PAYMENT}),this.paymentForm.style.display=l.isEditing?"block":"none",t.push(this.paymentForm),this.paymentSummary=ComponentFactoryService.createElement({type:s.CHECKOUT_PAYMENT_SUMMARY}),this.paymentSummary.style.display=l.isEditing?"none":"block",t.push(this.paymentSummary),t}}class CheckoutItemComponent extends BaseComponent{get hostClasses(){return["checkout-item-card"]}constructor(){super({autoDestroy:!![],autoDestroyPath:"checkout.items.{itemId}",watchStorePaths:["checkout.items.{itemId}","checkout.items"]}),this.trashButton=null}onStoreChanged(t){var n,o,s,c;const l=t.find(t=>"checkout.items"===t.path);l&&(this.updateTrashButtonState(),this.setupMinimumPurchaseAlert(),this.checkAndUpdateLoadingState());const d=t.find(t=>t.path==="checkout.items."+this.params.itemId);if(d){const t=d.oldValue,l=d.value;if(l.updating)return![];const u=(null==t?void 0:t.quantity)!==(null==l?void 0:l.quantity),h=(null===(o=null===(n=null==t?void 0:t.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.lines)||[],m=(null===(c=null===(s=null==l?void 0:l.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.lines)||[],f=JSON.stringify(h)!==JSON.stringify(m);(u||f)&&this.updateEngravingElement(l)}return![]}updateEngravingElement(t){var n,o;const c=this.getConfigs("global"),l=this.container.querySelector(".engraving-view-container");if(l&&l.remove(),(null===(o=null===(n=null==t?void 0:t.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.hasEngraving)===!![]&&c.layout.enablePersonalization){const n=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:t.cartItemId,context:"checkout"}),o=this.container.querySelector(".checkout-item-card-footer");o&&o.before(n)}}setupMinimumPurchaseAlert(){const t=this.getStoreValue("checkout.items."+this.params.itemId);if(!t)return;const n=t.fulfillmentId;if(!n)return;if(!this.container)return;const o=this.container.querySelector(".checkout-item-card-header");if(o){const c=this.getStoreValue("cart.fulfillments."+n),l=this.container.querySelector('[data-component-type="checkout-retailer-alert"]');if(l&&l.remove(),shouldShowMinimumPurchaseAlert(c,t.pack)){const n=getMinimumPurchaseMessage(c,t.pack),l=ComponentFactoryService.createElement({type:s.PURCHASE_MIN_ALERT,message:n.message,messageType:n.type,currentTotal:c.subtotal,config:{showIcon:!![],alertType:"minimal"}});l.setAttribute("data-component-type","checkout-retailer-alert"),o.before(l)}}}updateTrashButtonState(){if(!this.trashButton)return;const t=this.getStoreValue("checkout"),n=Object.keys(t.items).length,o=1===n;this.trashButton.disabled=o,o?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 n=document.createElement("div");n.className="cart-loading-spinner-container";const o=document.createElement("div");return o.className="cart-loading-spinner",o.innerHTML='\n <svg class="cart-spinner" width="32" height="32" viewBox="0 0 50 50">\n <circle\n class="cart-spinner-path"\n cx="25"\n cy="25"\n r="20"\n fill="none"\n stroke-width="3"\n stroke-linecap="round"\n stroke-dasharray="31.416"\n stroke-dashoffset="31.416"\n />\n </svg>\n ',n.appendChild(o),t.appendChild(n),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(),n=this.hasLoadingOverlay();t&&!n?this.showLoadingOverlay():!t&&n&&this.hideLoadingOverlay()}afterRender(){this.updateTrashButtonState(),this.checkAndUpdateLoadingState()}template(){var t,n,o;const c=this.getConfigs("global"),l=this.getStoreValue("checkout.items."+this.params.itemId),d=null===(t=null==l?void 0:l.attributes)||void 0===t?void 0:t.presale,u=(null==d?void 0:d.isActive)&&(null==d?void 0:d.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(d.estimatedShipBy):"";if(!l)return[];const h=document.createElement("div");h.classList.add("checkout-item-card-header");const m=document.createElement("div");m.classList.add("checkout-item-image");const f=document.createElement("img");f.src=l.mainImage,f.alt=l.name,f.loading="lazy",m.appendChild(f),h.appendChild(m);const g=document.createElement("div");g.classList.add("checkout-item-details-container");const v=document.createElement("h4");v.classList.add("checkout-item-title"),v.textContent=l.name,g.appendChild(v);const y=document.createElement("div");y.classList.add("checkout-item-subtitle");const b=document.createElement("span");b.textContent=d.isActive?""+u:((null==l?void 0:l.expectationDetail)||"")+",",y.appendChild(b);const x=document.createElement("span");x.textContent="From "+((null==l?void 0:l.retailerName)||""),y.appendChild(x),g.appendChild(y),h.appendChild(g),this.trashButton=document.createElement("button"),this.trashButton.type="button",this.trashButton.innerHTML=TrashIcon({}),this.trashButton.addEventListener("click",async t=>{var n;if(t.preventDefault(),t.stopPropagation(),!(null===(n=this.trashButton)||void 0===n?void 0:n.disabled))try{await this.commands.checkout.removeItem(l.cartItemId)}catch(o){this.logger.error("Checkout item removal failed",o)}}),h.appendChild(this.trashButton);const w=ComponentFactoryService.createElement({type:s.CHECKOUT_ITEM_QUANTITY,itemId:l.cartItemId}),E=[];if(E.push(h),c.layout.enablePersonalization&&(null===(o=null===(n=null==l?void 0:l.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.hasEngraving)===!![]){const t=ComponentFactoryService.createElement({type:s.ENGRAVING_VIEW,identifier:l.cartItemId,context:"checkout"});E.push(t)}return E.push(w),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 n=t.find(t=>"checkout.items"===t.path);if(n){const t=this.calculateQuantityLimits();this.updateButtonStates(t)}}getAvailableQuantity(){var t,n,o;const s=this.getStoreValue("checkout.items."+this.params.itemId);if(!s)return 0;const c=this.getStoreValue("products");if(!c)return 0;const l=s.partNumber,d=s.fulfillmentId,u=null===(o=null===(n=null===(t=Object.values(c).find(t=>t.sizes[s.liquidId]))||void 0===t?void 0:t.sizes)||void 0===n?void 0:n[s.liquidId])||void 0===o?void 0:o.attributes.maxQuantityPerOrder;if(!u)return 0;const h=this.getStoreValue("checkout.items")||{},m=Object.values(h).filter(t=>t.partNumber===l&&t.fulfillmentId===d),f=m.reduce((t,n)=>t+n.quantity,0);return u-f}calculateQuantityLimits(){var t;const n=this.getStoreValue("checkout.items."+this.params.itemId);if(!n)return{currentQuantity:0,availableQuantity:0,isTheOnlyItem:![],canIncrease:![],canDecrease:![]};const o=this.getStoreValue("checkout"),s=1===(null===(t=Object.values(o.items))||void 0===t?void 0:t.length),c=n.quantity,l=this.getAvailableQuantity(),d=l>0,u=!(s&&1===c);return{currentQuantity:c,availableQuantity:l,isTheOnlyItem:s,canIncrease:d,canDecrease:u}}updateButtonStates(t){this.decreaseButton&&(this.decreaseButton.disabled=!t.canDecrease,this.decreaseButton.classList.toggle("disabled",!t.canDecrease)),this.increaseButton&&(this.increaseButton.disabled=!t.canIncrease,this.increaseButton.classList.toggle("disabled",!t.canIncrease),t.canIncrease?this.increaseButton.setAttribute("aria-label","Increase quantity"):this.increaseButton.setAttribute("aria-label","Cannot increase quantity above maximum")),this.quantitySpan&&(this.quantitySpan.textContent=t.currentQuantity.toString(),this.quantitySpan.setAttribute("aria-label","Current quantity: "+t.currentQuantity))}async handleQuantityChange(t){const n=this.calculateQuantityLimits(),o=this.params.itemId;if((!(t<0)||n.canDecrease)&&(!(t>0)||n.canIncrease)){if(!o)return this.logger.error("Checkout item quantity change failed: Item ID not found in component params",{componentParams:this.params,delta:t}),void 0;try{await this.commands.checkout.updateCheckoutItemQuantity(o,t)}catch(s){this.logger.error("Checkout item quantity change operation failed",s)}}}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 n=this.calculateQuantityLimits(),o=document.createElement("div");o.classList.add("checkout-item-quantity-container"),this.decreaseButton=document.createElement("button"),this.decreaseButton.type="button",this.decreaseButton.classList.add("quantity-decrease"),this.decreaseButton.textContent="-",this.decreaseButton.setAttribute("aria-label","Decrease quantity"),this.decreaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(-1)}),o.appendChild(this.decreaseButton),this.quantitySpan=document.createElement("span"),this.quantitySpan.classList.add("product-count"),o.appendChild(this.quantitySpan),this.increaseButton=document.createElement("button"),this.increaseButton.type="button",this.increaseButton.classList.add("quantity-increase"),this.increaseButton.textContent="+",this.increaseButton.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleQuantityChange(1)}),o.appendChild(this.increaseButton),this.updateButtonStates(n);const s=document.createElement("span");if(s.classList.add("checkout-item-price-text"),s.textContent=formatCentToDollarText(t.price),t.quantity>1){const n=document.createElement("span");n.classList.add("checkout-item-price-each-text"),n.textContent=" ("+formatCentToDollarText(t.unitPrice)+" ea)",s.appendChild(n)}return[o,s]}}class CheckoutItemsComponent extends BaseComponent{get hostClasses(){return["checkout-items-container"]}constructor(){super({watchStorePaths:["checkout.items"]})}createItemElement(t){return ComponentFactoryService.createElement({type:s.CHECKOUT_ITEM,itemId:t})}getItemsListContainer(){return this.container.querySelector(".checkout-items-list")}getTogglerLabel(){return this.container.querySelector(".checkout-items-toggler-label")}getCurrentItemsMap(){const t=this.getStoreValue("checkout.items")||{},n=new Map;for(const o of Object.values(t))o&&o.cartItemId&&n.set(o.cartItemId,o);return n}syncItemsWithStore(){const t=this.getItemsListContainer();if(!t)return;const n=this.getCurrentItemsMap(),o=t.querySelectorAll("[data-item-id]"),s=new Set;for(const c of o){const t=c.getAttribute("data-item-id");t&&s.add(t)}for(const c of o){const t=c.getAttribute("data-item-id");t&&!n.has(t)&&c.remove()}for(const[c]of n)if(!s.has(c)){const n=this.createItemElement(c);n.setAttribute("data-item-id",c),t.appendChild(n)}this.updateItemCount()}updateItemCount(){const t=this.getTogglerLabel();if(!t)return;const n=this.getCurrentItemsMap(),o=n.size;t.textContent=o+" item"+(1!==o?"s":"")}onStoreChanged(t){let n;for(let o=0;o<t.length;o++){const s=t[o];if("checkout"===s.path||"checkout.items"===s.path||"checkout.items."===s.path.substring(0,15)){n=s;break}}return n?(this.syncItemsWithStore(),![]):![]}handleToggle(){const t=this.container.querySelector(".checkout-items-toggler-button"),n=this.container.querySelector(".checkout-items-list");if(t&&n){const o=n.classList.contains("show");n.classList.toggle("show"),t.classList.toggle("expanded"),o?(t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label","Expand checkout items")):(t.setAttribute("aria-expanded","true"),t.setAttribute("aria-label","Collapse checkout items"))}}setupToggler(){const t=this.container.querySelector(".checkout-items-toggler"),n=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".checkout-items-list");if(t&&n&&o){const s=o.classList.contains("show");n.setAttribute("tabindex","0"),n.setAttribute("aria-expanded",s?"true":"false"),n.setAttribute("aria-label",s?"Collapse checkout items":"Expand checkout items"),t.addEventListener("click",()=>this.handleToggle()),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleToggle())})}}afterRender(){this.setupToggler(),this.syncItemsWithStore()}template(){const t=this.getStoreValue("checkout.items"),n=Object.values(t||{}),o=document.createElement("div");o.classList.add("checkout-items-toggler");const s=document.createElement("span");s.classList.add("checkout-items-toggler-label"),s.textContent=n.length+" item"+(1!==n.length?"s":""),o.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"}),o.appendChild(c);const l=document.createElement("div");l.classList.add("checkout-items-list","show");for(const d of n){const t=this.createItemElement(d.cartItemId);t.setAttribute("data-item-id",d.cartItemId),l.appendChild(t)}return[o,l]}}class CheckoutOrderSummaryComponent extends BaseComponent{get hostClasses(){return["checkout-summary-section"]}constructor(){super({watchOnlyStorePaths:["checkout.amounts"]})}onStoreWatch(t){const n=t.find(t=>"checkout.amounts"===t.path);if(n){const t=this.getStoreValue("checkout"),n=Object.values(t.items||{}).length;this.updateZeroAmountElement(0===t.amounts.total&&n>0)}}updateZeroAmountElement(t){const n=this.container.querySelector(".checkout-zero-amount-container");if(t&&!n){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 n=this.container.querySelector("checkout-amounts-lc, .checkout-amounts-container");n&&n.after(t)}else!t&&n&&n.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 n=t.classList.contains("checked");t.setAttribute("aria-checked",n?"true":"false")}handleSmsToggle(t){this.commands.checkout.toggleMarketingPreferences("canSms"),t.classList.toggle("checked");const n=t.classList.contains("checked");t.setAttribute("aria-checked",n?"true":"false")}marketingOptInsContainer(){const t=this.config.layout.emailOptIn,n=this.config.layout.smsOptIn;if(!t.show&&!n.show)return null;const o=document.createElement("div");if(o.classList.add("checkout-marketing-opt-ins-container"),t.show){const n=document.createElement("div");let s;n.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?t.checked:this.store.get("checkout.marketingPreferences.canEmail");const c=document.createElement("span");c.id="emailOptIn",c.classList.add("checkout-checkbox-visual"),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",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEmailToggle(c))});const l=document.createElement("label");l.setAttribute("for","emailOptIn"),l.classList.add("checkbox-label"),l.innerHTML=sanitizeHTML(t.text),l.addEventListener("click",t=>{const n=t.target,o="A"===n.tagName||n.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canEmail"),c.classList.toggle("checked"))}),n.appendChild(c),n.appendChild(l),o.appendChild(n)}if(n.show){const t=document.createElement("div");let s;t.classList.add("checkout-checkbox-container"),s=this.clientConfig.isBuilder()?n.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",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleSmsToggle(c))});const l=document.createElement("label");l.setAttribute("for","smsOptIn"),l.classList.add("checkbox-label"),l.innerHTML=sanitizeHTML(n.text),l.addEventListener("click",t=>{const n=t.target,o="A"===n.tagName||n.closest("a");o||(this.commands.checkout.toggleMarketingPreferences("canSms"),c.classList.toggle("checked"))}),t.appendChild(c),t.appendChild(l),o.appendChild(t)}return o}hasOnDemandOrder(){const t=this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{};return Object.keys(t).length>0}template(){var t;const n=[],o=this.getConfigs("global"),c=this.getConfigs("checkout"),l=this.getConfigs("global"),d=c.layout.allowGiftCards,u=null===(t=null==l?void 0:l.layout)||void 0===t?void 0:t.allowPromoCodes,h=document.createElement("div");h.classList.add("section-title-container");const m=document.createElement("h3");m.textContent="Order Summary",m.classList.add("section-title"),h.appendChild(m),n.push(h);const f=ComponentFactoryService.createElement({type:s.CHECKOUT_ITEMS});n.push(f);const g=document.createElement("div");g.classList.add("checkout-separator");const v=document.createElement("div");if(v.classList.add("checkout-separator"),n.push(g),d||u){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_PC_GC});n.push(t)}if(this.hasOnDemandOrder()){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_TIPS});n.push(t),n.push(v)}const y=document.createElement("div");y.classList.add("section-title-container");const b=document.createElement("h3");b.textContent="100% Secure Payments",b.classList.add("disclaimer-header"),y.appendChild(b);const x=document.createElement("p");x.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.",x.classList.add("disclaimer-description"),y.appendChild(x),n.push(y);const w=ComponentFactoryService.createElement({type:s.CHECKOUT_AMOUNTS});n.push(w);const E=ComponentFactoryService.createElement({type:s.CHECKOUT_PLACE_ORDER_BUTTON});n.push(E);const _=this.marketingOptInsContainer();if(_&&n.push(_),c.layout.legalMessage.show){const t=document.createElement("div");t.classList.add("checkout-separator");const o=document.createElement("div");o.classList.add("checkout-legal-message"),o.innerHTML=sanitizeHTML(c.layout.legalMessage.text),n.push(t),n.push(o)}const T=document.createElement("div");if(T.classList.add("checkout-separator"),n.push(T),o.layout.showPoweredBy){const t=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"checkout"});n.push(t)}return n}}class CheckoutPaymentComponent extends BaseComponent{get hostClasses(){return["checkout-payment-form"]}constructor(){super({watchOnlyStorePaths:["checkout.paymentForm.isSaving","checkout.paymentForm.billingSameAsShipping"]}),this.stripeHandlerElement=null,this.betaNoticeElement=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 n of t)switch(n.path){case"checkout.paymentForm.isSaving":this.isSavingPayment=n.value,this.updateSaveButtonState();break;case"checkout.paymentForm.billingSameAsShipping":this.handleBillingSameAsShippingChange(n.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:!![];const n=(this.clientConfig.isBeta()||this.clientConfig.isDevelopment())&&this.clientConfig.get("paymentMethodId");n&&(this.stripeFormStatus={isFormComplete:!![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null}),this.updateSaveButtonState()}updateSaveButtonState(){if(!this.saveButton)return;let t=!![],n="Save Payment Information";if(this.isSavingPayment||this.stripeFormStatus.isProcessing)n="Saving...",t=!![];else if(this.stripeFormStatus.hasError)n="Fix Errors and Retry",t=![];else if(this.showingStripeSummary&&this.savedCardInfo){const n=this.isBillingSameAsShipping||this.isValidBillingForm;t=!n}else{const n=this.stripeFormStatus.isFormComplete,o=this.isBillingSameAsShipping||this.isValidBillingForm;t=!(n&&o)}this.saveButton.disabled=t,this.saveButton.textContent=n,this.saveButton.classList.toggle("processing",this.isSavingPayment||this.stripeFormStatus.isProcessing),this.saveButton.classList.toggle("error",this.stripeFormStatus.hasError)}updateErrorMessage(){if(!this.errorMessageElement)return;let t="";this.stripeFormStatus.hasError&&this.stripeFormStatus.errorMessage?t=this.stripeFormStatus.errorMessage:this.isBillingSameAsShipping||this.isValidBillingForm||!this.stripeFormStatus.isFormComplete||(t="Please complete the billing address form"),t?(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block"):(this.errorMessageElement.textContent="",this.errorMessageElement.style.display="none")}showError(t){this.errorMessageElement&&(this.errorMessageElement.textContent=t,this.errorMessageElement.style.display="block",setTimeout(()=>{this.errorMessageElement&&this.errorMessageElement.textContent===t&&(this.errorMessageElement.style.display="none")},5e3))}template(){const t=[],n=document.createElement("div");n.classList.add("section-title-container");const o=document.createElement("h3");o.textContent="Payment",o.classList.add("section-title"),n.appendChild(o);const c=document.createElement("p");c.textContent="All transactions are secure and encrypted.",c.classList.add("section-subtitle"),n.appendChild(c),t.push(n);const l=this.clientConfig.isBeta()||this.clientConfig.isDevelopment(),d=this.clientConfig.get("paymentMethodId"),u=l&&d;if(u){this.betaNoticeElement=document.createElement("div"),this.betaNoticeElement.classList.add("beta-payment-notice"),this.betaNoticeElement.style.cssText="background-color: #fff3cd; border: 1px solid #ffc107; border-radius: 4px; padding: 16px; margin-bottom: 16px; color: #856404;";const n=document.createElement("p");n.style.cssText="margin: 0; font-weight: 500; font-size: 14px; line-height: 1.4;",n.innerHTML="⚠️ Beta Testing Mode:<br/>PM ID: "+d+"<br/>Using hardcoded Visa card ending in 1111",this.betaNoticeElement.appendChild(n),t.push(this.betaNoticeElement)}else this.stripeHandlerElement=ComponentFactoryService.createElement({type:s.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,n)=>{const o={paymentSession:{confirmationTokenId:t,setupIntentId:n}};!this.isBillingSameAsShipping&&this.billingFormData&&(o.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(o)}}}),t.push(this.stripeHandlerElement);this.errorMessageElement=document.createElement("div"),this.errorMessageElement.classList.add("payment-error-message"),this.errorMessageElement.style.display="none",this.errorMessageElement.setAttribute("role","alert"),t.push(this.errorMessageElement);const h=ComponentFactoryService.createElement({type:s.CHECKOUT_BILLING,isFormValid:(t,n)=>{this.billingFormData=n,this.isValidBillingForm=t,this.updateSaveButtonState(),this.updateErrorMessage()}});return t.push(h),this.saveButton=document.createElement("button"),this.saveButton.type="button",this.saveButton.classList.add("save-form-info-button"),this.saveButton.textContent="Save Payment Information",this.saveButton.setAttribute("aria-label","Save payment information"),this.saveButton.addEventListener("click",async()=>{await this.handleSaveButtonClick()}),t.push(this.saveButton),t}async handleSaveButtonClick(){var t;if(this.isSavingPayment||this.stripeFormStatus.isProcessing)return;const n=(this.clientConfig.isBeta()||this.clientConfig.isDevelopment())&&this.clientConfig.get("paymentMethodId");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(o){this.logger.error("Failed to save payment form in edit mode",o),this.showError("Failed to save payment information.")}else if(n)try{const t={};!this.isBillingSameAsShipping&&this.isValidBillingForm&&this.billingFormData&&(t.billingFormData=this.billingFormData),await this.commands.checkout.savePaymentForm(t)}catch(s){this.logger.error("Failed to save payment form in beta mode",s),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,n,o,s;const c=[],l=this.getStoreValue("checkout.paymentForm"),d=document.createElement("div");d.classList.add("checkout-summary-form-header");const u=document.createElement("h2");u.textContent=!l.billingSameAsShipping&&l.data?"Payment: "+l.data.firstName+" "+l.data.lastName:"Payment: ",d.appendChild(u);const h=document.createElement("span");h.textContent="Edit",h.addEventListener("click",async()=>{await this.commands.checkout.editPaymentForm()}),d.appendChild(h),c.push(d);const m=document.createElement("p");if(m.classList.add("checkout-summary-form-line"),m.textContent=capitalizeFirstLetter((null===(n=null===(t=l.paymentMethod)||void 0===t?void 0:t.card)||void 0===n?void 0:n.brand)||"")+" ending in ** "+(null===(s=null===(o=l.paymentMethod)||void 0===o?void 0:o.card)||void 0===s?void 0:s.last4),c.push(m),l.billingSameAsShipping&&!l.data){const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent="Billing address is the same as shipping address.",c.push(t)}if(!l.billingSameAsShipping&&l.data){if(l.data.company){const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent=l.data.company,c.push(t)}const t=document.createElement("p");t.classList.add("checkout-summary-form-line"),t.textContent=l.data.addressOne+(l.data.addressTwo?", "+l.data.addressTwo:"")+", "+l.data.city+", "+l.data.state+", "+l.data.zipCode,c.push(t);const n=document.createElement("p");n.classList.add("checkout-summary-form-line"),n.textContent=l.data.email,c.push(n);const o=document.createElement("p");o.classList.add("checkout-summary-form-line"),o.textContent=l.data.phone,c.push(o)}return c}}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 n=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);n&&this.updateButtonState()}updateButtonState(){if(!this.placeOrderButton)return;const t=this.store.get("checkout.loading")||![],n=this.store.get("checkout.error")||null;this.updateErrorDisplay(n);const o=this.determineButtonState({isCheckoutLoading:t,hasCheckoutError:!!n});this.placeOrderButton.classList.remove("processing","ready","disabled"),this.placeOrderButton.classList.add(o.state),this.placeOrderButton.disabled=o.disabled,this.placeOrderButton.textContent=o.text}clearErrorTimeout(){null!==this.errorTimeoutId&&(clearTimeout(this.errorTimeoutId),this.errorTimeoutId=null)}updateErrorDisplay(t){if(!this.errorContainer)return;const n=this.errorContainer.querySelector(".error-text");n&&(this.clearErrorTimeout(),t?(n.textContent=t,this.errorContainer.style.display="block",this.errorTimeoutId=setTimeout(async()=>{this.errorTimeoutId=null,await this.commands.checkout.clearCheckoutError()},3e3)):(n.textContent="",this.errorContainer.style.display="none"))}determineButtonState({isCheckoutLoading:t,hasCheckoutError:n}){const o=this.config.layout.placeOrderButtonText,s=this.store.get("checkout.presale");let c=![];if(!s){const t=this.getStoreValue("cart.fulfillments")||{};c=Object.values(t).some(t=>hasUnmetMinimum(t))}const l=this.store.get("checkout.isGift"),d=this.store.get("checkout.customerForm.isValid"),u=this.store.get("checkout.giftRecipientForm.isValid"),h=this.store.get("checkout.paymentForm.isValid");return c||l&&!u||!d||!h?{state:"disabled",text:o,disabled:!![]}:t?{state:"processing",text:"Placing Order...",disabled:!![]}:n?{state:"disabled",text:o,disabled:!![]}:{state:"ready",text:o,disabled:![]}}async handlePlaceOrderClick(){try{if(this.clientConfig.isBuilder())return this.logger.info("Checkout Place Order Button Is Disabled In Builder Mode"),void 0;const 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 n=document.createElement("div");n.classList.add("checkout-error-wrapper"),n.setAttribute("role","alert"),n.style.display="none";const o=document.createElement("div");o.classList.add("checkout-error");const c=document.createElement("span");c.classList.add("icon-error"),c.innerHTML=ErrorInfoIcon({});const l=document.createElement("span");l.classList.add("error-text"),o.appendChild(c),o.appendChild(l),n.appendChild(o);const d=ComponentFactoryService.createElement({type:s.ALERT,errorStorePath:"checkout.events",fromEvents:!![],showFirstEvent:![]});return[n,d,t]}}class CheckoutPresaleCountdownComponent extends BaseComponent{get hostClasses(){return["checkout-presale-countdown-container"]}constructor(){super({watchStorePaths:["checkout.presale","ui.drawer"]}),this.countdownInterval=null,this.expiresAt=null,this.totalDuration=300,this.rootElement=null,this.scrollHandler=null,this.scrollContainer=null,this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]}onStoreChanged(t){var n;const o=t.find(t=>"checkout.presale"===t.path);if(null==o?void 0:o.value)return this.updateExpiresAt(o.value.expiresAt),!![];const s=t.find(t=>"ui.drawer"===t.path);return(null===(n=null==s?void 0:s.value)||void 0===n?void 0:n.isOpen)===![]&&(this.stopCountdown(),this.cleanupScrollListener(),this.isCurrentlyScrolled=![],this.isUnderOneMinute=![]),![]}afterRender(){const t=this.store.get("checkout.presale");(null==t?void 0:t.expiresAt)&&this.updateExpiresAt(t.expiresAt),this.setupDrawerScrollDetection()}disconnected(){this.stopCountdown(),this.cleanupScrollListener()}setupDrawerScrollDetection(){const findScrollContainer=()=>{var t,n;const o=[".drawer-content"];for(const c of o){const n=null===(t=this.rootElement)||void 0===t?void 0:t.closest(c);if(n&&this.isScrollable(n))return n}let s=null===(n=this.rootElement)||void 0===n?void 0:n.parentElement;for(;s&&s!==document.body;){if(this.isScrollable(s))return s;s=s.parentElement}return null};if(this.scrollContainer=findScrollContainer(),!this.scrollContainer)return this.logger.warn("Could not find scrollable drawer container"),void 0;this.scrollHandler=()=>{var t,n;if(!this.scrollContainer)return;const o=this.scrollContainer.scrollTop,s=70,c=10;!this.isCurrentlyScrolled&&o>s?(this.isCurrentlyScrolled=!![],null===(t=this.rootElement)||void 0===t||t.classList.add("is-scrolled"),this.addHostClasses("is-scrolled")):this.isCurrentlyScrolled&&o<c&&(this.isCurrentlyScrolled=![],null===(n=this.rootElement)||void 0===n||n.classList.remove("is-scrolled"),this.removeHostClasses("is-scrolled"))},this.scrollContainer.addEventListener("scroll",this.scrollHandler,{passive:!![]}),this.scrollHandler()}isScrollable(t){const n=window.getComputedStyle(t),o=n.overflowY;return t.scrollHeight>=t.clientHeight&&("auto"===o||"scroll"===o||"overlay"===o)}cleanupScrollListener(){this.scrollHandler&&this.scrollContainer&&(this.scrollContainer.removeEventListener("scroll",this.scrollHandler),this.scrollHandler=null,this.scrollContainer=null)}updateExpiresAt(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 n=new Date,o=Math.floor((this.expiresAt.getTime()-n.getTime())/1e3);o<this.totalDuration&&(this.totalDuration=Math.max(o,240)),this.startCountdown()}catch(n){this.logger.error("Failed to parse presale expiration date",n),this.handleExpire()}}startCountdown(){this.updateCountdown(),this.countdownInterval=window.setInterval(()=>{this.updateCountdown()},10)}stopCountdown(){this.countdownInterval&&(clearInterval(this.countdownInterval),this.countdownInterval=null)}updateCountdown(){if(!this.expiresAt||!this.rootElement)return;const t=new Date,n=Math.max(0,this.expiresAt.getTime()-t.getTime()),o=n/1e3,s=this.totalDuration-o,c=Math.max(0,Math.min(100,s/this.totalDuration*100)),l=o<60;if(l!==this.isUnderOneMinute){this.isUnderOneMinute=l;const t=this.rootElement.querySelector(".checkout-presale-timer");this.isUnderOneMinute?(this.rootElement.classList.add("time-warning"),null==t||t.classList.add("time-warning"),this.addHostClasses("time-warning")):(this.rootElement.classList.remove("time-warning"),null==t||t.classList.remove("time-warning"),this.removeHostClasses("time-warning"))}const d=this.rootElement.querySelector("[data-timer]");d&&(d.textContent=this.formatTime(n));const u=this.rootElement.querySelector("[data-progress-fill]");u&&(u.style.width=c+"%"),0===n&&this.handleExpire()}formatTime(t){const n=Math.floor(t/1e3),o=Math.floor(n/60),s=n%60,c=Math.floor(t%1e3/10);return o.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 t=document.createElement("div");t.classList.add("checkout-presale-countdown"),this.rootElement=t;const n=document.createElement("div");n.classList.add("checkout-presale-text-container");const o=document.createElement("div");o.classList.add("checkout-presale-heading");const s=document.createElement("h2");s.textContent="LIMITED PRE-ORDER:";const c=document.createElement("div");c.classList.add("checkout-presale-timer"),c.setAttribute("data-timer",""),c.textContent="00:00:00",o.appendChild(s),o.appendChild(c);const l=document.createElement("p");l.textContent="Please complete your transaction within the time limit. Time expiration or page refresh will release the product to other customers.",l.classList.add("checkout-presale-subtitle"),n.appendChild(o),n.appendChild(l);const d=document.createElement("div");d.className="checkout-presale-progress-bar",d.setAttribute("data-progress","");const u=document.createElement("div");return u.className="checkout-presale-progress-fill",u.setAttribute("data-progress-fill",""),u.style.width="0%",d.appendChild(u),t.appendChild(n),t.appendChild(d),t}}class CheckoutPresaleExpiredComponent extends BaseComponent{constructor(){super(...arguments),this.autoCloseInterval=null,this.autoCloseSeconds=10,this.autoCloseElement=null}get hostClasses(){return["checkout-completed-container"]}get hostAttributes(){return{role:"alert","aria-live":"assertive"}}afterRender(){this.startAutoCloseCountdown()}disconnected(){this.stopAutoCloseCountdown()}handleExit(){this.stopAutoCloseCountdown(),this.commands.ui.closeDrawer()}startAutoCloseCountdown(){this.updateAutoCloseDisplay(),this.autoCloseInterval=window.setInterval(()=>{this.autoCloseSeconds--,this.updateAutoCloseDisplay(),this.autoCloseSeconds<=0&&this.handleExit()},1e3)}stopAutoCloseCountdown(){null!==this.autoCloseInterval&&(clearInterval(this.autoCloseInterval),this.autoCloseInterval=null)}updateAutoCloseDisplay(){this.autoCloseElement&&(this.autoCloseElement.textContent=""+this.autoCloseSeconds)}template(){const t=[],n=this.getConfigs("global"),o=document.createElement("div");o.classList.add("checkout-completed-section-container");const c=document.createElement("div");c.classList.add("checkout-completed-title-section");const l=document.createElement("div");l.classList.add("checkout-completed-title-section");const d=document.createElement("p");d.classList.add("presale-expired-title"),d.textContent="Session Expired",l.appendChild(d);const u=document.createElement("p");u.textContent="Your reservation time has ended. The item has been released for other customers.",l.appendChild(u),c.appendChild(l),o.appendChild(c);const h=document.createElement("div");h.classList.add("checkout-completed-help-section"),h.textContent="To ensure fair access for all customers, we can only hold items for a limited time. You can try to reserve the item again if it's still available.",o.appendChild(h),t.push(o);const m=document.createElement("div");m.classList.add("checkout-completed-section-container");const f=document.createElement("button");f.setAttribute("aria-label","Continue shopping"),f.type="button";const g=document.createElement("span");g.textContent="Continue Shopping",f.setAttribute("tabindex","0"),f.setAttribute("role","button"),f.setAttribute("aria-label","Continue Shopping"),f.appendChild(g);const v=htmlStringToElement(ArrowRightIcon({width:16,height:16}));f.appendChild(v),f.addEventListener("click",()=>this.handleExit()),f.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleExit())}),m.appendChild(f),t.push(m);const y=document.createElement("div");y.classList.add("checkout-completed-section-container");const b=document.createElement("p");b.classList.add("checkout-completed-auto-close-text"),b.textContent="This view will close automatically in:",this.autoCloseElement=document.createElement("div"),this.autoCloseElement.classList.add("checkout-completed-auto-close-seconds"),this.autoCloseElement.setAttribute("aria-live","polite"),this.autoCloseElement.setAttribute("aria-atomic","true"),this.autoCloseElement.textContent=""+this.autoCloseSeconds;const x=document.createElement("span");if(x.classList.add("checkout-completed-auto-close-text"),x.textContent="seconds",y.appendChild(b),y.appendChild(this.autoCloseElement),y.appendChild(x),t.push(y),n.layout.showPoweredBy){const n=document.createElement("div");n.classList.add("checkout-completed-powered-by-container");const o=ComponentFactoryService.createElement({type:s.POWERED_BY,context:"checkout"});n.appendChild(o),t.push(n)}return t}}class CheckoutPromoCodeComponent extends BaseComponent{get hostClasses(){return["input-promo-code-container"]}constructor(){super({watchOnlyStorePaths:["checkout.promoCode","checkout.loading"]}),this.isApplying=![],this.promoInput=null,this.applyButton=null,this.promoCodeText=null}onStoreWatch(t){const n=t.find(t=>"checkout.promoCode"===t.path),o=t.find(t=>"checkout.loading"===t.path);if(n){const{value:t,oldValue:o}=n,s=Boolean(o),c=Boolean(t);if(!s&&c)return this.container.innerHTML="",this.createAppliedContainer(t),void 0;if(s&&!c)return this.container.innerHTML="",this.createInputContainer(),void 0;c&&this.promoCodeText&&t.discountAmount!==(null==o?void 0:o.discountAmount)&&(this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")")}o&&this.updateApplyButtonState()}updateApplyButtonState(){if(!this.applyButton||!this.promoInput)return;const t=this.promoInput.getValue().trim(),n=t.length>=3&&t.length<=255,o=this.getStoreValue("checkout.loading"),s=this.getStoreValue("checkout.promoCode"),c=this.getStoreValue("checkout.promoCodeError");this.applyButton.disabled=!n||o||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:t=>{const n=t.toUpperCase(),o=this.promoInput;o.setValue(n),this.updateApplyButtonState()}}),this.promoInput}createApplyButton(){this.applyButton=document.createElement("button"),this.applyButton.type="button",this.applyButton.classList.add("apply-button"),this.applyButton.disabled=!![],this.applyButton.textContent="Apply",this.applyButton.setAttribute("tabindex","0"),this.applyButton.setAttribute("role","button"),this.applyButton.setAttribute("aria-label","Apply promo code");const p=async()=>{const t=this.promoInput.getValue().trim().toUpperCase();if(t)try{this.isApplying=!![],this.updateApplyButtonState(),await this.commands.checkout.applyPromoCode(t)}catch(n){this.logger.error("Checkout promo code application failed",{promoCode:t,error:n instanceof Error?n.message:String(n)})}finally{this.isApplying=![],this.updateApplyButtonState()}};return this.applyButton.addEventListener("click",p),this.applyButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),p())}),this.applyButton}createAppliedContainer(t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=(null==t?void 0:t.code)+" (- "+formatCentToDollarText((null==t?void 0:t.discountAmount)||0)+")";const o=document.createElement("button");o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(o),this.container.appendChild(n),this.promoInput=null,this.applyButton=null}createInputContainer(){this.container.appendChild(this.createPromoInput()),this.container.appendChild(this.createApplyButton()),this.promoCodeText=null}template(){const t=this.getStoreValue("checkout.promoCode");if(this.promoInput=null,this.applyButton=null,this.promoCodeText=null,t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),this.promoCodeText=document.createElement("span"),this.promoCodeText.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")";const o=document.createElement("button");return o.type="button",o.classList.add("remove-button"),o.textContent="Remove",o.addEventListener("click",async()=>{await this.commands.checkout.removePromoCode()}),n.appendChild(this.promoCodeText),n.appendChild(o),n}const n=[];return n.push(this.createPromoInput()),n.push(this.createApplyButton()),n}disconnected(){this.promoInput=null,this.applyButton=null,this.promoCodeText=null}}class CheckoutSendAsGiftComponent extends BaseComponent{get hostClasses(){return["gift-toggle-container"]}constructor(){super({watchStorePaths:["checkout.isGift"]})}template(){const t=this.getStoreValue("checkout.isGift"),n=document.createElement("div");n.classList.add("gift-label-wrapper");const o=document.createElement("span");o.textContent="Send as Gift? (Free)",o.classList.add("gift-toggle-label"),n.appendChild(o);const s=document.createElement("span");s.textContent="With personalized note & gift receipt.",s.classList.add("gift-toggle-description"),n.appendChild(s);const c=document.createElement("div");c.classList.add("toggle-switch"),c.classList.toggle("active",t);const l=document.createElement("div");return l.classList.add("toggle-slider"),c.setAttribute("tabindex","0"),c.setAttribute("aria-label","Toggle Gift Option"),c.setAttribute("role","switch"),c.setAttribute("aria-checked",t?"true":"false"),c.appendChild(l),c.addEventListener("click",async()=>{await this.commands.checkout.toggleIsGift()}),c.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await this.commands.checkout.toggleIsGift())}),[n,c]}}class CheckoutStripeFormComponent extends HTMLElement{constructor(){super(...arguments),this.F=![],this.A=null,this.O=null,this.M=null,this.N=![],this.L=![],this.R=![],this.B=null}async initialize({data:t}){if(this.F)return console.warn("Stripe form already initialized, ignoring subsequent calls"),void 0;this.q=t.stripeConfig,await this.initializeStripe(),this.setupEventListeners(),this.F=!![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}async initializeStripe(){try{window.Stripe||await this.loadStripeJS();const t=this.q;this.A=window.Stripe(t.publishableKey),this.O=this.A.elements({clientSecret:t.clientSecret,appearance:t.appearance}),this.M=this.O.create("payment",t.elementOptions),this.M.mount(this),this.M.on("change",async t=>{const n=!!t.error,o=t.complete,s=n?t.error.message:null;this.L=o,this.N||await this.updateStripeFormStatus({isFormComplete:o,isProcessing:![],hasCompletedPayment:![],errorMessage:s,hasError:n})}),this.M.on("focus",async()=>{this.N||await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}),this.R=![]}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:n}=t.detail;n&&(this.q=n,await this.refreshPaymentSession())}async handleSubmit(){var t,n;if(this.N)return console.warn("Payment already processing, ignoring duplicate submission"),void 0;if(!this.L)return await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Please complete all required payment fields"}),void 0;this.N=!![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:!![],hasCompletedPayment:![],hasError:![],errorMessage:"Processing payment..."});try{this.R&&(console.log("Session already used, requesting refresh..."),await this.requestSessionRefresh());const t=await this.createConfirmationTokenId(),n=this.q.clientSecret,o=n.split("_secret_")[0];this.R=!![],this.dispatchEvent(new CustomEvent("lce:s:ps-confirmed",{detail:{confirmationTokenId:t,setupIntentId:o},bubbles:!![],composed:!![]})),await this.updateStripeFormStatus({isFormComplete:!![],isProcessing:![],hasCompletedPayment:!![],hasError:![],errorMessage:null})}catch(o){console.error("Payment submission error:",o),this.R=!![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==o?void 0:o.message)||"Payment processing failed. Please try again."}),((null===(t=null==o?void 0:o.message)||void 0===t?void 0:t.includes("expired"))||(null===(n=null==o?void 0:o.message)||void 0===n?void 0:n.includes("invalid")))&&setTimeout(()=>this.requestSessionRefresh(),1e3)}finally{this.N=![]}}async requestSessionRefresh(){return this.B||(this.B=new Promise((t,n)=>{const o=setTimeout(()=>{this.removeEventListener("lce:s:refreshSession",e),this.B=null,n(new Error("Session refresh timeout"))},1e4),e=()=>{clearTimeout(o),this.removeEventListener("lce:s:refreshSession",e),this.B=null,t()};this.addEventListener("lce:s:refreshSession",e,{once:!![]}),this.dispatchEvent(new CustomEvent("lce:s:requestSessionRefresh",{bubbles:!![],composed:!![]}))})),this.B}async refreshPaymentSession(){try{this.O&&this.O.update({clientSecret:this.q.clientSecret}),this.R=![],await this.updateStripeFormStatus({isFormComplete:this.L,isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(Z){console.error("Failed to refresh payment session:",Z),await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:"Failed to refresh payment session"})}}async resetForm(){try{this.M&&this.M.clear(),this.L=![],this.R=![],await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(Z){console.error("Failed to reset form:",Z)}}async updateStripeFormStatus(t){this.dispatchEvent(new CustomEvent("lce:s:updateStripeFormStatus",{detail:{status:t},bubbles:!![],composed:!![]}))}async createConfirmationTokenId(){if(!this.O)throw new SDKError("Payment elements not initialized");try{const{error:t}=await this.O.submit();if(t)throw new SDKError(t.message||"Failed to submit payment information");const n={elements:this.O,params:{payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:o,confirmationToken:s}=await this.A.createConfirmationToken(n);if(o)throw new SDKError(o.message||"Failed to create confirmation token");if(!s||!s.id)throw new SDKError("Invalid confirmation token received");return s.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,n;try{this.B=null,this.M&&(this.M.unmount(),this.M=null),this.O&&(null===(n=(t=this.O).destroy)||void 0===n?void 0:n.call(t),this.O=null),this.A=null,this.N=![],this.L=![],this.R=![],this.F=![],this.isConnected&&await this.updateStripeFormStatus({isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null})}catch(o){console.warn("Error during Stripe form cleanup:",o)}}loadStripeJS(){return new Promise((t,n)=>{const o=document.querySelector('script[src*="stripe.com"]');if(o)return o.addEventListener("load",()=>t()),o.addEventListener("error",()=>n(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=()=>t(),s.onerror=()=>n(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(t){for(const n of t)switch(n.path){case"checkout.paymentForm.paymentMethod":this.handleSavedCardChange(n.value);break;case"checkout.paymentForm.isEditing":this.handleEditModeChange(n.value)}}handleSavedCardChange(t){var n,o,s,c;(null===(n=null==t?void 0:t.card)||void 0===n?void 0:n.brand)&&(null===(o=null==t?void 0:t.card)||void 0===o?void 0:o.last4)?this.savedCardInfo={brand:t.card.brand,last4:t.card.last4}:this.savedCardInfo=null,null===(c=(s=this.callbacks).onSavedCardInfoChanged)||void 0===c||c.call(s,this.savedCardInfo),this.updateDisplayState()}handleEditModeChange(t){this.isInEditMode=t,this.updateDisplayState()}updateDisplayState(){var t,n,o,s,c,l;this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment?(this.showStripeSummary(),this.hideStripeForm(),null===(n=(t=this.callbacks).onEditModeVisibilityChanged)||void 0===n||n.call(t,!![])):this.isInEditMode||this.isChangingPayment?(this.hideStripeSummary(),this.showStripeForm(),null===(s=(o=this.callbacks).onEditModeVisibilityChanged)||void 0===s||s.call(o,![]),this.stripeFormElement||this.isCreatingStripeForm||this.createAndMountStripeForm().catch(t=>{this.logger.error("Failed to create stripe form in updateDisplayState",t)})):(this.hideStripeSummary(),this.hideStripeForm(),null===(l=(c=this.callbacks).onEditModeVisibilityChanged)||void 0===l||l.call(c,![]))}async afterRender(){var t,n,o,s;this.isInEditMode=null!==(t=this.getStoreValue("checkout.paymentForm.isEditing"))&&void 0!==t?t:![];const c=this.getStoreValue("checkout.paymentForm.paymentMethod");(null===(n=null==c?void 0:c.card)||void 0===n?void 0:n.brand)&&c.card.last4&&(this.savedCardInfo={brand:c.card.brand,last4:c.card.last4}),null===(s=(o=this.callbacks).onSavedCardInfoChanged)||void 0===s||s.call(o,this.savedCardInfo),this.updateDisplayState(),(this.isInEditMode&&!this.savedCardInfo||this.isChangingPayment)&&await this.createAndMountStripeForm()}setupStripeFormEventListeners(){if(!this.stripeFormElement)return this.logger.warn("Cannot set up event listeners: Stripe form element is null"),void 0;this.stripeFormElement.addEventListener("lce:s:updateStripeFormStatus",t=>{var n,o;this.stripeFormStatus=t.detail.status,null===(o=(n=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(n,this.stripeFormStatus)}),this.stripeFormElement.addEventListener("lce:s:ps-confirmed",async t=>{var n,o,s,c,l;try{const{confirmationTokenId:s,setupIntentId:c}=t.detail;await(null===(o=(n=this.callbacks).onPaymentSessionConfirmed)||void 0===o?void 0:o.call(n,s,c)),this.isChangingPayment=![]}catch(d){this.logger.error("Failed to save payment form",d),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:!![],errorMessage:(null==d?void 0:d.message)||"Failed to save payment information. Please try again."},null===(c=(s=this.callbacks).onStripeFormStatusChanged)||void 0===c||c.call(s,this.stripeFormStatus),null===(l=this.stripeFormElement)||void 0===l||l.dispatchEvent(new CustomEvent("lce:s:reset",{bubbles:!![],composed:!![]}))}}),this.stripeFormElement.addEventListener("lce:s:requestSessionRefresh",async()=>{var t;try{const n=await this.doStripeConfig();null===(t=this.stripeFormElement)||void 0===t?void 0:t.dispatchEvent(new CustomEvent("lce:s:refreshSession",{detail:{stripeConfig:n}}))}catch(n){this.logger.error("Failed to refresh payment session",n)}})}showStripeSummary(){if(!this.stripeSummaryContainer||!this.savedCardInfo)return;this.stripeSummaryContainer.innerHTML="";const t=document.createElement("span");t.classList.add("stripe-summary-text"),t.textContent=capitalizeFirstLetter(this.savedCardInfo.brand||"")+" ending in "+this.savedCardInfo.last4;const n=document.createElement("button");n.type="button",n.classList.add("change-payment-link"),n.textContent="Change",n.addEventListener("click",()=>this.handleChangePayment()),this.stripeSummaryContainer.append(t,n),this.stripeSummaryContainer.style.display="flex"}hideStripeSummary(){this.stripeSummaryContainer&&(this.stripeSummaryContainer.style.display="none",this.stripeSummaryContainer.innerHTML="")}showStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="block")}hideStripeForm(){this.stripeFormContainer&&(this.stripeFormContainer.style.display="none"),this.removeExistingStripeForm()}async handleChangePayment(){var t,n,o,s;this.isChangingPayment=!![],this.hideStripeSummary(),this.showStripeForm(),this.stripeFormStatus={isFormComplete:![],isProcessing:![],hasCompletedPayment:![],hasError:![],errorMessage:null},null===(n=(t=this.callbacks).onStripeFormStatusChanged)||void 0===n||n.call(t,this.stripeFormStatus),null===(s=(o=this.callbacks).onEditModeVisibilityChanged)||void 0===s||s.call(o,![]),await this.createAndMountStripeForm()}template(){const t=[];this.stripeSummaryContainer=document.createElement("div"),this.stripeSummaryContainer.classList.add("stripe-summary-container"),this.stripeSummaryContainer.style.display="none",t.push(this.stripeSummaryContainer),this.stripeFormContainer=document.createElement("div"),this.stripeFormContainer.classList.add("stripe-form-container");const n=document.createElement("slot");return n.setAttribute("name",ft),this.stripeFormContainer.appendChild(n),t.push(this.stripeFormContainer),t}submitStripeForm(){this.stripeFormElement&&this.stripeFormStatus.isFormComplete&&!this.stripeFormStatus.hasCompletedPayment&&this.stripeFormElement.dispatchEvent(new CustomEvent("lce:s:submit"))}getStripeFormStatus(){return{...this.stripeFormStatus}}findRootComponent(){if(this.rootComponent)return this.rootComponent;let t=this,n=null;for(;t&&t!==document.body;){const o=t.hasAttribute("checkout"),c=t.tagName.toLowerCase()===ComponentFactoryService.getComponentTagName(s.LCE_ELEMENT),l=t.hasAttribute("drawer"),d=(null==n?void 0:n.tagName.toLowerCase())===ComponentFactoryService.getComponentTagName(s.DRAWER),u="checkout"===(null==n?void 0:n.getAttribute("data-target"));if(o||c&&l&&d&&u)return this.rootComponent=t,t;n=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");(null==t?void 0:t.key)&&(null==t?void 0:t.secret)||await this.commands.checkout.getPaymentSession();const n=this.store.get("checkout.paymentForm.paymentSession"),o=this.getConfigs("global");return{publishableKey:n.key,clientSecret:n.secret,appearance:{theme:"stripe",variables:{fontFamily:o.theme.paragraphFont.name+", system-ui, sans-serif",borderRadius:o.theme.buttonCornerRadius},rules:{".Input":{border:"filled"===o.layout.inputFieldStyle?"none":"1px solid "+o.theme.accentColor,backgroundColor:"filled"===o.layout.inputFieldStyle?o.theme.accentColor:"transparent"}}},elementOptions:{layout:"tabs",defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}}}}async createAndMountStripeForm(){var t,n,o;if(this.isCreatingStripeForm)return this.logger.info("Stripe form creation already in progress, skipping"),void 0;if(this.isInEditMode&&this.savedCardInfo&&!this.isChangingPayment)return this.logger.info("In edit mode with saved card, skipping stripe form creation"),void 0;const c=this.findRootComponent();if(!c)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 l=c.querySelectorAll('[slot="'+ft+'"]');if(l.length>0)for(const s of l)s.remove();this.isCreatingStripeForm=!![];try{const t=await this.doStripeConfig();this.stripeFormElement=ComponentFactoryService.createElement({type:s.CHECKOUT_STRIPE_FORM,stripeConfig:t}),this.setupStripeFormEventListeners(),this.stripeFormElement.setAttribute("slot",ft),c.appendChild(this.stripeFormElement)}catch(d){this.logger.error("Stripe form element creation failed",d),this.stripeFormStatus={...this.stripeFormStatus,hasError:!![],errorMessage:"Failed to initialize payment form. Please reload the page."},null===(o=(n=this.callbacks).onStripeFormStatusChanged)||void 0===o||o.call(n,this.stripeFormStatus),this.stripeFormElement=null}finally{this.isCreatingStripeForm=![]}}disconnected(){var t;this.removeExistingStripeForm(),this.rootComponent=null,this.isCreatingStripeForm=![],this.isChangingPayment=![],null===(t=super.disconnected)||void 0===t||t.call(this)}}class CheckoutTipsComponent extends BaseComponent{get hostClasses(){return["checkout-tips-container"]}constructor(){super({watchStorePaths:["checkout.onDemandFulfillmentTipInfo","checkout.tipSelection","checkout.updating","checkout.amounts"]}),this.isInitialized=![]}afterRender(){this.setupToggler()}getTipSelection(){const t=this.getStoreValue("checkout.tipSelection");return null!=t?t:10}getOnDemandFulfillmentTipInfo(){return this.getStoreValue("checkout.onDemandFulfillmentTipInfo")||{}}getFulfillmentTipInfoArray(){return Object.values(this.getOnDemandFulfillmentTipInfo())}async handlePercentageSelect(t){const n=this.getStoreValue("checkout.updating")||![];if(!n)try{await this.commands.checkout.updateTips(t)}catch(o){this.logger.error("Checkout tips update failed",o)}}async handleFulfillmentTipInput(t,n){const o=this.getStoreValue("checkout.updating")||![];if(o)return;const s=this.getOnDemandFulfillmentTipInfo();if(!s[t])return;const c=Math.round(100*n);try{await this.commands.checkout.updateFulfillmentTip(t,c)}catch(l){this.logger.error("Checkout fulfillment tip update failed",l)}}async removeTipFromFulfillment(t){const n=this.getStoreValue("checkout.updating")||![];if(n)return;const o=this.getOnDemandFulfillmentTipInfo();if(o[t])try{await this.commands.checkout.removeFulfillmentTip(t)}catch(s){this.logger.error("Checkout fulfillment tip removal failed",s)}}createTipSelectionButtons(){const t=document.createElement("div");t.classList.add("checkout-tip-selection-container");const n=[10,18,20],o=this.getStoreValue("checkout.updating")||![],s=this.getTipSelection();for(const c of n){const n=document.createElement("button");n.type="button",n.textContent=c+"%",n.classList.add("checkout-tip-button"),n.disabled=o,s===c&&n.classList.add("selected"),n.addEventListener("click",()=>this.handlePercentageSelect(c)),t.appendChild(n)}return t}setupToggler(){const t=this.container.querySelector(".checkout-tip-distribution-header"),n=this.container.querySelector(".checkout-items-toggler-button"),o=this.container.querySelector(".retailers-tips-list");t&&n&&o&&t.addEventListener("click",()=>{const t=o.classList.contains("show");o.classList.toggle("show"),t?(n.setAttribute("aria-expanded","false"),n.setAttribute("aria-label","Expand tips section")):(n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse tips section")),n.classList.toggle("expanded")})}createTipDistribution(){const t=document.createElement("section");t.classList.add("checkout-tip-distribution-container");const n=this.getFulfillmentTipInfoArray();if(0===n.length)return t;const o=document.createElement("div");o.classList.add("checkout-tip-distribution-header");const s=document.createElement("h3");s.textContent="View Tip Distribution",s.classList.add("checkout-sub-header"),o.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"}),o.appendChild(c),t.appendChild(o);const l=document.createElement("div");l.classList.add("retailers-tips-list","show");for(const d of n){const t=document.createElement("div");t.classList.add("checkout-tip-distribution-item");const n=document.createElement("h4");n.textContent=d.retailerName,n.classList.add("checkout-sub-header"),t.appendChild(n);const o=document.createElement("div");o.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 h;u.type="number",u.id="tip-input-"+d.fulfillmentId,u.name="tip-"+d.fulfillmentId,u.min="0",u.step="0.01",u.placeholder="0.00",u.classList.add("dollar-input"),u.value=d.tip>0?(d.tip/100).toFixed(2):"",u.disabled=this.getStoreValue("checkout.updating")||![],u.addEventListener("wheel",t=>{t.preventDefault()}),u.addEventListener("keydown",t=>{"-"!==t.key&&"+"!==t.key||t.preventDefault()}),u.addEventListener("keydown",t=>{"ArrowUp"!==t.key&&"ArrowDown"!==t.key||t.preventDefault()}),u.addEventListener("paste",t=>{t.preventDefault()}),u.addEventListener("contextmenu",t=>{t.preventDefault()}),u.addEventListener("input",t=>{const n=t.target;let o=n.value;if(Number.parseFloat(o)<0&&(n.value=Math.abs(Number.parseFloat(o)).toString(),o=n.value),o.includes(".")){const t=o.split(".");t.length>1&&t[1].length>2&&(n.value=t[0]+"."+t[1].substring(0,2))}}),u.addEventListener("input",t=>{const n=t.target,o=Number.parseFloat(n.value)||0;h&&clearTimeout(h),h=setTimeout(()=>{this.handleFulfillmentTipInput(d.fulfillmentId,o)},500)}),s.appendChild(c),s.appendChild(u),o.appendChild(s);const m=document.createElement("button");m.type="button",m.textContent="Remove",m.classList.add("checkout-tip-remove-button"),m.disabled=this.getStoreValue("checkout.updating")||![],m.addEventListener("click",()=>this.removeTipFromFulfillment(d.fulfillmentId)),o.appendChild(m),t.appendChild(o),l.appendChild(t)}return t.appendChild(l),t}async initializeDefaultTip(){if(this.isInitialized)return;const t=this.getStoreValue("checkout.tipSelection"),n=this.getFulfillmentTipInfoArray();if(t&&n.length>0){const t=n.some(t=>t.tip>0);if(t)this.isInitialized=!![];else try{this.isInitialized=!![],await this.commands.checkout.updateTips(10)}catch(o){this.logger.error("Default tip initialization failed",o),this.isInitialized=![]}}if(null==t)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 t=[],n=this.getFulfillmentTipInfoArray();if(0===n.length)return t;n.length>0&&this.initializeDefaultTip();const o=document.createElement("section");o.classList.add("checkout-tip-container");const s=document.createElement("h3");s.classList.add("checkout-sub-header"),s.textContent="Add a tip",o.appendChild(s);const c=document.createElement("div");c.classList.add("checkout-tip-config-container");const l=this.createTipSelectionButtons();c.appendChild(l),o.appendChild(c);const d=document.createElement("p");d.classList.add("checkout-tip-disclaimer"),d.textContent="Tips will be split proportionally between retailers.",o.appendChild(d);const u=this.createTipDistribution();return t.push(o,u),t}}class CheckoutPcGcComponent extends BaseComponent{get hostClasses(){return["checkout-sections-container"]}constructor(){super({watchOnlyStorePaths:["checkout.loading","checkout.giftCardError","checkout.promoCodeError","checkout.giftCards"]}),this.appliedGiftCardsContainer=null}onStoreWatch(t){var n,o;const s=t.find(t=>"checkout.giftCardError"===t.path),c=t.find(t=>"checkout.promoCodeError"===t.path),l=t.find(t=>"checkout.giftCards"===t.path);if(l&&this.updateAppliedGiftCards(l.value),s){const t=this.container.querySelector(".input-gift-card-container");if(t){const o=t.nextElementSibling;if((null===(n=null==o?void 0:o.classList)||void 0===n?void 0:n.contains("error-banner-checkout"))&&(null==o?void 0:o.remove()),s.value){const n=this.createErrorElement(s.value);t.after(n)}const c=t.querySelector(".apply-button");c&&(c.disabled=Boolean(s.value))}}if(c){const t=this.container.querySelector(".input-promo-code-container");if(t){const n=t.nextElementSibling;if((null===(o=null==n?void 0:n.classList)||void 0===o?void 0:o.contains("error-banner-checkout"))&&(null==n?void 0:n.remove()),c.value){const n=this.createErrorElement(c.value);t.after(n)}const s=t.querySelector(".apply-button");s&&(s.disabled=Boolean(c.value))}}}updateAppliedGiftCards(t){const n=t&&t.length>0;if(!n)return this.appliedGiftCardsContainer&&(this.appliedGiftCardsContainer.remove(),this.appliedGiftCardsContainer=null),void 0;this.appliedGiftCardsContainer||(this.appliedGiftCardsContainer=document.createElement("div"),this.appliedGiftCardsContainer.classList.add("checkout-pc-gc-sub-container"),this.container.appendChild(this.appliedGiftCardsContainer)),this.appliedGiftCardsContainer.innerHTML="",t.forEach(t=>{const n=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(n)})}createAppliedGiftCardElement(t){const n=document.createElement("div");n.classList.add("checkout-pc-gc-applied"),n.setAttribute("data-gift-card-code",t.code);const o=document.createElement("span");o.textContent=t.code+" (- "+formatCentToDollarText(t.discountAmount)+")",n.appendChild(o);const s=document.createElement("button");return s.type="button",s.textContent="Remove",s.addEventListener("click",async()=>{await this.commands.checkout.removeGiftCard(t.code)}),n.appendChild(s),n}pcInputContainer(){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_PROMO_CODE,classList:["input-promo-code-container"]});return t}gcInputContainer(){const t=ComponentFactoryService.createElement({type:s.CHECKOUT_GIFT_CARDS});return t}inputContainer(){var t;const n=this.getConfigs("checkout"),o=this.getConfigs("global"),s=n.layout.allowGiftCards,c=null===(t=null==o?void 0:o.layout)||void 0===t?void 0:t.allowPromoCodes,l=document.createElement("div");l.classList.add("checkout-pc-gc-sub-container");const d=this.pcInputContainer(),u=this.gcInputContainer();c&&l.appendChild(d);const h=this.getStoreValue("checkout.promoCodeError");if(h){const t=this.createErrorElement(h);t.classList.add("promo-code-error-wrapper"),l.appendChild(t)}s&&l.appendChild(u);const m=this.getStoreValue("checkout.giftCardError");if(m){const t=this.createErrorElement(m);l.appendChild(t)}return l}createErrorElement(t){const n=document.createElement("div");n.classList.add("error-banner-checkout");const o=document.createElement("div");o.innerHTML=ErrorInfoIcon({});const s=document.createElement("p");return s.textContent=t.toString(),n.appendChild(o),n.appendChild(s),setTimeout(async()=>{await this.commands.checkout.clearPromoCodeError(),await this.commands.checkout.clearGiftCardError(),n.remove()},3e3),n}template(){const t=this.getStoreValue("checkout.giftCards");this.appliedGiftCardsContainer=null;const n=[];return n.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 n=this.createAppliedGiftCardElement(t);this.appliedGiftCardsContainer.appendChild(n)}),n.push(this.appliedGiftCardsContainer)),n}disconnected(){this.appliedGiftCardsContainer=null}}function fulfillmentAddress(t,n){if(!t)return"";if(n===c.SHIPPING){const n=[t.city,t.state].filter(Boolean);return n.join(", ")}const o=[t.one,t.two,t.city,t.state].filter(Boolean);return o.join(", ")}function renderPopupRetailerCard({fulfillment:t,selectedFulfillmentType:n,isSelected:o,fulfillmentStatus:s,selectedSizeAttributes:l}){var d,u,h,m,f;let g=0;const v=null==l?void 0:l.presale,y=(null==v?void 0:v.isActive)&&(null==v?void 0:v.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(v.estimatedShipBy):"",b=n===c.SHIPPING,x=n===c.ON_DEMAND;b&&(g=(null===(u=null===(d=null==t?void 0:t.fees)||void 0===d?void 0:d.individual)||void 0===u?void 0:u.fee)||0),x&&(g=(null===(h=null==t?void 0:t.fees)||void 0===h?void 0:h.fee)||0);const w=fulfillmentAddress(t.retailerAddress,n);let E=null;n===c.ON_DEMAND&&s.openTime&&(null==s?void 0:s.closeTime)&&(E=s.isOpen?"Closes at "+format24TimeTo12$1(null==s?void 0:s.closeTime):"Opens at "+format24TimeTo12$1(null==s?void 0:s.openTime));const _=n===c.ON_DEMAND&&s&&s.isClosed?"closed":"",T=document.createElement("div");T.className="popup-retailer-card "+(o?"selected":"")+" "+_,T.setAttribute("data-fulfillment-id",t.fulfillmentId),T.setAttribute("role","button"),T.setAttribute("tabindex","0"),T.setAttribute("aria-pressed",o?"true":"false");const D=n===c.SHIPPING?"Shipping":"Same-day delivery";T.setAttribute("aria-label",D+" from "+t.retailerName+", "+formatCentToDollarText(null!==(m=t.price)&&void 0!==m?m:0));const P=document.createElement("div");P.className="row";const F=document.createElement("span");F.className="name",F.textContent=t.retailerName,P.appendChild(F);const A=document.createElement("span");A.className="price",A.textContent=formatCentToDollarText(null!==(f=t.price)&&void 0!==f?f:0),P.appendChild(A),T.appendChild(P);const z=document.createElement("div");z.className="row";const O=document.createElement("span");O.className="expectation",O.textContent=s.isClosed?E:(null==v?void 0:v.isActive)?y:(null==t?void 0:t.expectation.detail)||"No expectation available",z.appendChild(O);const N=document.createElement("span");if(N.className="fee",N.textContent=g>0?formatCentToDollarText(g):"Free Delivery",z.appendChild(N),T.appendChild(z),x){const t=document.createElement("div");t.className="row";const n=document.createElement("span");n.className="address",n.textContent=w,t.appendChild(n),T.appendChild(t)}return T}function renderFulfillmentTabsContainer({shippingFulfillments:t,onDemandFulfillments:n,shippingSelected:o,onDemandSelected:s,onTabClick:l,enableShippingFulfillment:d,enableOnDemandFulfillment:u}){const h=n.length>0,m=document.createElement("div");if(m.className="fulfillment-tabs-container",m.setAttribute("role","tablist"),m.setAttribute("aria-label","Delivery method options"),d){const n=document.createElement("div");n.className="fulfillment-tab "+(o?"selected":""),n.setAttribute("data-fulfillment-type",c.SHIPPING),n.setAttribute("role","tab"),n.setAttribute("tabindex","0"),n.setAttribute("aria-selected",o?"true":"false"),n.setAttribute("aria-label","Shipping, "+t.length+" options"),n.addEventListener("click",l),n.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),n.click())});const s=document.createElement("span");s.className="fulfillment-tab-label "+(o?"selected":""),s.textContent="Shipping ("+t.length+")",n.appendChild(s),m.appendChild(n)}if(u){const t=document.createElement("div");t.className="fulfillment-tab "+(s?"selected":"")+" "+(h?"":"disabled"),t.setAttribute("data-fulfillment-type",c.ON_DEMAND),t.setAttribute("role","tab"),t.setAttribute("tabindex","0"),t.setAttribute("aria-selected",s?"true":"false"),t.setAttribute("aria-label","Same-day delivery, "+n.length+" options"),h||t.setAttribute("aria-disabled","true"),t.addEventListener("click",l),t.addEventListener("keydown",n=>{"Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t.click())});const o=document.createElement("span");o.className="fulfillment-tab-label "+(s?"selected":""),o.textContent="Same-Day Delivery ("+n.length+")",t.appendChild(o),m.appendChild(t)}return m}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 n=this.getProductId(),o=this.getStoreValue("products."+n);if(!o.selectedFulfillment||!o.selectedSizeId)return 0;const s=o.selectedFulfillment.partNumber,c=o.selectedFulfillment.fulfillmentId,l=null===(t=o.sizes[o.selectedSizeId].attributes)||void 0===t?void 0:t.maxQuantityPerOrder;if(!l)return 0;const d=this.getStoreValue("cart.items")||{},u=Object.values(d).filter(t=>t.partNumber===s&&t.fulfillmentId===c),h=u.reduce((t,n)=>t+n.quantity,0);return l-h}isFulfillmentClosed(){const t=this.getProductId(),n=this.getStoreValue("products."+t);if(!n.selectedFulfillment)return![];const o=getRetailerOffHours(n.selectedFulfillment);return n.selectedFulfillmentType===c.ON_DEMAND&&o&&o.isClosed}isButtonLoading(){const t=this.getProductId();return this.getStoreValue("products."+t+".updating")}calculateQuantityLimits(){const{quantity:t}=this.calculateTotalPrice(),n=this.getAvailableQuantity(),o=t<n;return{currentQuantity:t,availableQuantity:n,canIncrease:o,canDecrease:t>1}}async handleAddToCart(){var t,n,o;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 l=this.getSizeAttributes(),d=(null===(t=null==l?void 0:l.presale)||void 0===t?void 0:t.isActive)===!![],u=this.isPresaleActive(l);d&&u?await this.commands.product.addPresaleToCart(s,{upc:c.sizes[c.selectedSizeId].upc,fulfillmentId:c.selectedFulfillment.fulfillmentId,partNumber:null===(n=c.selectedFulfillment)||void 0===n?void 0:n.partNumber,quantity:c.quantity,identifier:s}):await this.commands.product.addToCart(s,{upc:c.sizes[c.selectedSizeId].upc,fulfillmentId:c.selectedFulfillment.fulfillmentId,partNumber:null===(o=c.selectedFulfillment)||void 0===o?void 0:o.partNumber,quantity:c.quantity,identifier:s})}async handleQuantityChange(t){const n=this.getProductId();await this.commands.product.updateQuantity(n,t)}calculateTotalPrice(){const t=this.getProductId(),n=this.getStoreValue("products."+t),o=n.selectedFulfillment,s=o.price*n.quantity;return{quantity:n.quantity,totalPrice:s}}createQuantityContainer(t){const n=this.calculateQuantityLimits(),o=document.createElement("div");return o.className="quantity-container "+t,this.qtyDecreaseButton=document.createElement("button"),this.qtyDecreaseButton.type="button",this.qtyDecreaseButton.className="quantity-decrease",this.qtyDecreaseButton.textContent="−",this.qtyDecreaseButton.disabled=!n.canDecrease,this.qtyDecreaseButton.setAttribute("aria-label","Decrease quantity"),this.qtyDecreaseButton.setAttribute("aria-disabled",(!n.canDecrease).toString()),n.canDecrease||(this.qtyDecreaseButton.disabled=!![],this.qtyDecreaseButton.classList.add("disabled")),this.qtyDecreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(-1)}),this.quantityText=document.createElement("span"),this.quantityText.className="product-count",this.quantityText.textContent=n.currentQuantity.toString(),this.quantityText.setAttribute("role","status"),this.quantityText.setAttribute("aria-label","Current quantity: "+n.currentQuantity),this.qtyIncreaseButton=document.createElement("button"),this.qtyIncreaseButton.type="button",this.qtyIncreaseButton.className="quantity-increase",this.qtyIncreaseButton.textContent="+",this.qtyIncreaseButton.disabled=!n.canIncrease,this.qtyIncreaseButton.setAttribute("aria-label","Increase quantity"),this.qtyIncreaseButton.setAttribute("aria-disabled",(!n.canIncrease).toString()),n.canIncrease||(this.qtyIncreaseButton.disabled=!![],this.qtyIncreaseButton.classList.add("disabled")),this.qtyIncreaseButton.addEventListener("click",async t=>{t.preventDefault(),await this.handleQuantityChange(1)}),o.appendChild(this.qtyDecreaseButton),o.appendChild(this.quantityText),o.appendChild(this.qtyIncreaseButton),o}getSizeAttributes(){const t=this.getProductId(),n=this.getStoreValue("products."+t+".selectedSizeId"),o=this.getStoreValue("products."+t+".sizes."+n);return(null==o?void 0:o.attributes)||{}}isPresaleActive(t){const n=null==t?void 0:t.presale;if(!n)return![];if(!n.isActive)return![];if(n.canPurchaseOn){const t=new Date(n.canPurchaseOn),o=new Date;if(o.getTime()<t.getTime())return![]}return!![]}createAddToCartButton(){var t;const{totalPrice:n}=this.calculateTotalPrice(),o=this.getSizeAttributes(),s=this.calculateQuantityLimits(),c=(null===(t=null==o?void 0:o.presale)||void 0===t?void 0:t.isActive)===!![],l=this.isPresaleActive(o),d=c?this.config.layout.preSaleButtonText:this.config.layout.addToCartButtonText;this.addToCartButton=document.createElement("button"),this.addToCartButton.type="button",this.addToCartButton.className="add-to-cart-button",this.addToCartButton.textContent=this.config.layout.addToCartButtonShowTotalPrice?d+" - "+formatCentToDollarText(n):d;const u=c&&!l||0===s.availableQuantity||this.isFulfillmentClosed(),h=this.isButtonLoading(),m=this.config.layout.addToCartButtonShowTotalPrice?d+" for "+formatCentToDollarText(n):d;return this.addToCartButton.setAttribute("aria-label",m),this.addToCartButton.setAttribute("aria-busy",h.toString()),this.addToCartButton.setAttribute("aria-disabled",u.toString()),u&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("disabled")),h&&(this.addToCartButton.disabled=!![],this.addToCartButton.classList.add("loading")),this.addToCartButton.addEventListener("click",async t=>{if(t.preventDefault(),this.clientConfig.isBuilder())return this.logger.info("Product Add To Cart Button Is Disabled In Builder Mode"),void 0;await this.handleAddToCart()}),this.addToCartButton}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t+".fulfillmentHasAvailability"),o=this.getConfigs("configurations");if(!n||!o.isElementsEnabled)return[];const s=[];if(this.config.layout.showQuantityCounter){const t=this.createQuantityContainer(this.config.layout.quantityCounterStyle);s.push(t)}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 t=this.params.productId,n=this.getStoreValue("products."+t+".description"),o=this.getStoreValue("products."+t+".htmlDescription"),s="About this product:",c="See More",l="See Less",d=document.createElement("h3");d.className="title",d.textContent=s;const u=document.createElement("div");u.className="content collapsed",u.innerHTML=""===(null==o?void 0:o.trim())?n:sanitizeHTML(o);const h=document.createElement("span");h.className="collapse-button",h.textContent=c,h.setAttribute("role","button"),h.setAttribute("tabindex","0"),h.setAttribute("aria-label","Show more product information"),h.setAttribute("aria-expanded","false");const toggleContent=()=>{this.isCollapsed=!this.isCollapsed,u.classList.toggle("collapsed"),h.textContent=this.isCollapsed?c:l,h.setAttribute("aria-label",this.isCollapsed?"Show more product information":"Show less product information"),h.setAttribute("aria-expanded",this.isCollapsed?"false":"true")};return h.addEventListener("click",toggleContent),h.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),toggleContent())}),[d,u,h]}}class ProductDrawerComponent extends BaseComponent{get hostClasses(){return["product-drawer-container"]}constructor(){super({watchStorePaths:["products.{productId}.drawer"]}),this.isOpen=![],this.contentContainer=null,this.currentContentType=null}getProductId(){return this.params.productId}onStoreChanged(t){var n;const o=t.find(t=>t.path==="products."+this.getProductId()+".drawer");if(!o)return![];const s=o.value,c=s.isOpen,l=null===(n=s.contentConfig)||void 0===n?void 0:n.type,d=l!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=l,this.openWithContent(s),![]):c&&this.isOpen&&!d?![]:c&&this.isOpen&&d?(this.currentContentType=l,this.openWithContent(s),![]):!c&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){const n=this.getProductId();try{if(this.contentContainer&&(this.contentContainer.innerHTML=""),!t)return this.logger.warn("Product drawer opening attempted without content configuration",{productId:n}),void 0;const{type:o,data:s}=t||{},c=ComponentFactoryService.createElement({type:o,...s});this.contentContainer&&this.contentContainer.appendChild(c),this.open()}catch(o){this.logger.error("Failed to open product drawer",o),this.commands.product.closeProductDrawer(n)}}open(){this.isOpen=!![],this.updateDrawerState()}close(){this.isOpen=![],this.updateDrawerState()}updateDrawerState(){this.isOpen&&this.container.classList.add("open"),this.isOpen||this.container.classList.remove("open")}template(){const t=document.createElement("div");return t.classList.add("product-drawer-content"),this.contentContainer=t,t}}class ProductImageCarouselComponent extends BaseComponent{get hostClasses(){const t=this.config.layout.fulfillmentDisplay;return["product-image-carousel",t]}constructor(){super({watchOnlyStorePaths:["products.{productId}.mainImage"]}),this.mainImageElement=null,this.galleryViewport=null,this.galleryContainer=null,this.thumbnails=[],this.currentImageIndex=0,this.isDragging=![],this.hasMoved=![],this.startX=0,this.currentTranslateX=0,this.translateX=0}afterRender(){this.cacheElements(),this.setupEventListeners(),this.scrollToIndex(0)}onStoreWatch(t){const n=this.params.productId,o=t.find(t=>t.path==="products."+n+".mainImage");if(null==o?void 0:o.value){const t=this.params.images.indexOf(null==o?void 0:o.value);-1!==t?this.selectImage(t):this.mainImageElement&&(this.mainImageElement.style="--bg-image: url('"+o.value+"')")}}cacheElements(){this.galleryViewport=this.container.querySelector(".gallery-viewport"),this.galleryContainer=this.container.querySelector(".gallery-container"),this.thumbnails=Array.from(this.container.querySelectorAll(".gallery-image-wrapper"))}setupEventListeners(){for(let n=0;n<this.thumbnails.length;n++){const t=this.thumbnails[n];t.addEventListener("click",()=>{this.hasMoved||this.selectImage(n)})}const t=this.container.querySelectorAll(".carousel-dot");for(let n=0;n<t.length;n++){const o=t[n];o.addEventListener("click",()=>this.selectImage(n))}this.setupMainImageSwipe(),this.galleryContainer&&this.setupGalleryDrag()}selectImage(t){var n,o;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===(n=this.thumbnails[this.currentImageIndex])||void 0===n||n.classList.remove("selected"),null===(o=this.thumbnails[t])||void 0===o||o.classList.add("selected");const s=this.container.querySelectorAll(".carousel-dot");for(let c=0;c<s.length;c++){const n=s[c];n.classList.toggle("active",c===t)}this.currentImageIndex=t,this.galleryViewport&&this.scrollToIndex(t)}scrollToIndex(t){if(!this.galleryViewport||!this.thumbnails[t])return;const n=this.thumbnails[t],o=this.galleryViewport.offsetWidth,s=n.offsetLeft+n.offsetWidth/2,c=o/2,l=c-s,d=0,u=-(this.galleryContainer.scrollWidth-o);this.translateX=Math.max(u,Math.min(d,l)),this.updateTransform(!![])}setupMainImageSwipe(){var t,n;let o=0,s=0;null===(t=this.mainImageElement)||void 0===t?void 0:t.addEventListener("touchstart",t=>{o=t.touches[0].clientX,s=t.touches[0].clientY},{passive:!![]}),null===(n=this.mainImageElement)||void 0===n||n.addEventListener("touchend",t=>{const n=t.changedTouches[0].clientX-o,c=t.changedTouches[0].clientY-s;Math.abs(n)>Math.abs(c)&&Math.abs(n)>50&&(n>0?this.previousImage():this.nextImage())},{passive:!![]})}setupGalleryDrag(){if(this.galleryContainer){this.galleryContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.galleryContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this));for(const 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 n="touches"in t?t.touches[0].clientX:t.clientX,o=n-this.startX;Math.abs(o)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+o,c=0,l=-(this.galleryContainer.scrollWidth-this.galleryViewport.offsetWidth);this.translateX=Math.max(l,Math.min(c,s)),this.updateTransform(![])}handleDragEnd(){this.isDragging=![],this.galleryContainer&&(this.galleryContainer.style.cursor=""),setTimeout(()=>{this.hasMoved=![]},10)}updateTransform(t){this.galleryContainer&&(this.galleryContainer.style.transition=t?"transform 0.3s ease":"none",this.galleryContainer.style.transform="translate3d("+this.translateX+"px, 0, 0)")}nextImage(){this.selectImage((this.currentImageIndex+1)%this.params.images.length)}previousImage(){this.selectImage(0===this.currentImageIndex?this.params.images.length-1:this.currentImageIndex-1)}template(){const t=[],n=this.params.images.length>1,o=document.createElement("div");if(o.className="main-image",o.title="Product main image",o.style="--bg-image: url('"+(this.params.mainImage||this.params.images[0])+"')",n){const t=document.createElement("div");t.className="carousel-dots";for(let n=0;n<this.params.images.length;n++){const o=document.createElement("button");o.type="button",o.className="carousel-dot "+(0===n?"active":""),o.setAttribute("data-index",n.toString()),t.appendChild(o)}o.appendChild(t)}this.mainImageElement=o,t.push(o);const s=document.createElement("div");s.className="gallery-viewport";const c=document.createElement("div");c.className="gallery-container";for(let l=0;l<this.params.images.length;l++){const t=this.params.images[l],n=document.createElement("div");n.className="gallery-image-wrapper "+(0===l?"selected":"");const o=document.createElement("img");o.src=t,o.className="gallery-image",o.alt="Product thumbnail "+(l+1),o.loading="lazy",n.appendChild(o),c.appendChild(n)}return s.appendChild(c),t.push(s),t}}class ProductInteractionsComponent extends BaseComponent{get hostClasses(){return["product-interactions"]}constructor(){super({watchOnlyStorePaths:["products.{productId}.selectedFulfillmentType"]}),this.addPersonalizationSpan=null}onStoreWatch(t){var n,o,s,l;const d=this.getProductId();if(!t.some(t=>t.path==="products."+d+".selectedFulfillmentType"))return;const u=this.getStoreValue("products."+d),h=u.sizes[u.selectedSizeId],m=this.getConfigs("global");this.addPersonalizationSpan&&(u.selectedFulfillmentType===c.SHIPPING&&m.layout.enablePersonalization&&u.productHasAvailability&&(null===(o=null===(n=null==h?void 0:h.attributes)||void 0===n?void 0:n.engraving)||void 0===o?void 0:o.status)===!![]&&(null===(s=null==u?void 0:u.selectedFulfillment)||void 0===s?void 0:s.isVariantEngravable)===!![]&&(null===(l=null==u?void 0:u.selectedFulfillment)||void 0===l?void 0:l.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")}getProductId(){return this.params.productId}afterRender(){this.setupSizeButtonsEventListener()}setupSizeButtonsEventListener(){const t=this.getProductId(),n=this.container.querySelectorAll("[select-size]");for(const o of n){const s=o.textContent||"",c=o.classList.contains("selected");o.setAttribute("role","button"),o.setAttribute("tabindex","0"),o.setAttribute("aria-label","Select "+s),o.setAttribute("aria-pressed",c?"true":"false"),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o.click())}),o.addEventListener("click",async()=>{var s,c,l,d;const u=o.dataset.sizeId;if(!u)return this.logger.warn("Product size selection failed: Size ID not found in button element",{productId:t,buttonElement:o.outerHTML.substring(0,100)}),void 0;await this.commands.product.selectSize(t,u);for(const t of n)t.classList.remove("selected"),t.setAttribute("aria-pressed","false");o.classList.add("selected"),o.setAttribute("aria-pressed","true");const h=this.getStoreValue("products."+t),m=h.sizes[u],f=this.getConfigs("global");this.addPersonalizationSpan&&(f.layout.enablePersonalization&&(null===(c=null===(s=null==m?void 0:m.attributes)||void 0===s?void 0:s.engraving)||void 0===c?void 0:c.status)===!![]&&h.productHasAvailability&&(null===(l=h.selectedFulfillment)||void 0===l?void 0:l.isVariantEngravable)===!![]&&(null===(d=h.selectedFulfillment)||void 0===d?void 0:d.canEngrave)===!![]?this.addPersonalizationSpan.style.display="inline":this.addPersonalizationSpan.style.display="none")})}}renderProductSizes(t,n){const o=document.createElement("div");o.className="size-container";const s=document.createElement("h3");s.className="size-label",s.textContent="Size",s.id="size-label",o.appendChild(s);const c=document.createElement("div");c.className="size-buttons-container",c.setAttribute("role","group"),c.setAttribute("aria-labelledby","size-label");for(const l of Object.values(n)){const n=document.createElement("span");n.setAttribute("data-size-id",l.id),n.setAttribute("select-size",""),n.className="size-button "+(l.id===t?"selected":"");const o=l.packDesc?" ("+l.packDesc+")":"";n.textContent=""+l.size+o,c.appendChild(n)}return o.appendChild(c),o}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,n,o,c,l;const d=this.getProductId(),u=this.getStoreValue("products."+d),h=u.sizes[u.selectedSizeId],m=this.getConfigs("global"),f=[],g=document.createElement("div");g.className="price-personalization-container";const v=ComponentFactoryService.createElement({type:s.PRODUCT_PRICE,productId:d});if(g.appendChild(v),m.layout.enablePersonalization&&u.productHasAvailability&&(null===(n=null===(t=null==h?void 0:h.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.status)===!![]&&(null===(o=null==u?void 0:u.selectedFulfillment)||void 0===o?void 0:o.canEngrave)===!![]&&(null===(c=null==u?void 0:u.selectedFulfillment)||void 0===c?void 0:c.isVariantEngravable)===!![]){this.addPersonalizationSpan=document.createElement("span"),this.addPersonalizationSpan.className="add-personalization-span",this.addPersonalizationSpan.textContent="Personalize Your Bottle",this.addPersonalizationSpan.setAttribute("role","button"),this.addPersonalizationSpan.setAttribute("tabindex","0"),this.addPersonalizationSpan.setAttribute("aria-label","Personalize Your Bottle");const addPersonalization=async()=>{var t,n,o,c,l,h,m,f;const g=u.sizes[u.selectedSizeId];await this.commands.product.openProductDrawer(d,s.ENGRAVING_FORM,{identifier:d,context:"product",lines:[],maxLines:(null===(n=null===(t=g.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.maxLines)||1,maxCharsPerLine:(null===(c=null===(o=g.attributes)||void 0===o?void 0:o.engraving)||void 0===c?void 0:c.maxCharsPerLine)||16,fee:(null===(h=null===(l=g.attributes)||void 0===l?void 0:l.engraving)||void 0===h?void 0:h.fee)||0,location:null===(f=null===(m=g.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.location})};this.addPersonalizationSpan.addEventListener("click",async()=>{await addPersonalization()}),this.addPersonalizationSpan.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await addPersonalization())}),g.appendChild(this.addPersonalizationSpan)}f.push(g);const y=this.renderProductSizes(u.selectedSizeId,u.sizes);if(f.push(y),!this.hasIndependentAddressComponent()){const t=ComponentFactoryService.createElement({type:s.ADDRESS_DISPLAY,productId:d});f.push(t)}const b=ComponentFactoryService.createElement({type:s.PRODUCT_RETAILERS,productId:d});f.push(b);const x=ComponentFactoryService.createElement({type:s.PRODUCT_ADD_TO_CART_SECTION,productId:d});f.push(x);const w=null===(l=null==h?void 0:h.attributes)||void 0===l?void 0:l.presale;if((null==w?void 0:w.isActive)===!![]&&(null==w?void 0:w.language)){const t=document.createElement("div");t.className="product-presale-notice",t.innerHTML=sanitizeHTML((null==w?void 0:w.language)||""),f.push(t)}if(this.config.layout.showDescription&&(u.description.trim().length>0||u.htmlDescription.trim().length>0)){const t=ComponentFactoryService.createElement({type:s.PRODUCT_DESCRIPTION,productId:d});f.push(t)}return f}}class ProductLoadingComponent extends BaseComponent{template(){const t=Boolean(this.getStoreValue("address")),{showTitle:n,showDescription:o,showQuantityCounter:s,fulfillmentDisplay:c,showImages:l}=this.config.layout,d=document.createElement("div");d.classList.add("product-content-wrapper");const u=document.createElement("div");if(u.classList.add("skeleton-container"),n){const t=document.createElement("div");t.classList.add("wave","sc-title"),u.appendChild(t)}if(!t){const t=document.createElement("div");return t.classList.add("wave","sc-add-to-cart"),u.appendChild(t),u}const h=document.createElement("div");h.classList.add("wave","sc-price"),u.appendChild(h);const 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 y=document.createElement("div");y.classList.add("wave","sc-size-button"),m.appendChild(y);const b=document.createElement("div");b.classList.add("wave","sc-size-button"),m.appendChild(b),u.appendChild(m);const x=document.createElement("div");x.classList.add("sc-row");const w=document.createElement("div");w.classList.add("wave","sc-price"),x.appendChild(w);const E=document.createElement("div");E.classList.add("wave","sc-personalization"),x.appendChild(E),u.appendChild(x);const _=document.createElement("div");_.classList.add("wave","sc-deliver-to"),u.appendChild(_);const T=document.createElement("div");T.classList.add("wave","sc-address"),u.appendChild(T);const D=document.createElement("div");D.classList.add("wave","sc-retailers",c),u.appendChild(D);const P=document.createElement("div");if(P.classList.add("sc-row"),s){const t=document.createElement("div");t.classList.add("wave","sc-quantity"),P.appendChild(t)}const F=document.createElement("div");if(F.classList.add("wave","sc-add-to-cart"),P.appendChild(F),u.appendChild(P),o){const t=document.createElement("div");t.classList.add("wave","sc-description-title"),u.appendChild(t);const n=document.createElement("div");n.classList.add("wave","sc-description-line"),u.appendChild(n);const o=document.createElement("div");o.classList.add("wave","sc-description-line"),u.appendChild(o);const s=document.createElement("div");s.classList.add("wave","sc-description-line"),u.appendChild(s);const c=document.createElement("div");c.classList.add("wave","sc-description-more"),u.appendChild(c)}const A=document.createElement("div");if(A.classList.add("product-content"),A.appendChild(u),d.appendChild(A),l){d.classList.add("has-images");const t=this.createImageSkeletons();d.prepend(t)}return d}createImageSkeletons(){const t=document.createElement("div");t.classList.add("product-image-carousel","skeleton");const n=document.createElement("div");n.classList.add("wave","sc-main-image"),n.title="Product main image loading";const o=document.createElement("div");o.classList.add("carousel-dots");for(let l=0;l<3;l++){const t=document.createElement("div");t.classList.add("wave","sc-carousel-dot"),o.appendChild(t)}n.appendChild(o),t.appendChild(n);const s=document.createElement("div");s.classList.add("gallery-viewport");const c=document.createElement("div");c.classList.add("gallery-container");for(let l=0;l<4;l++){const t=document.createElement("div");t.classList.add("gallery-image-wrapper");const n=document.createElement("div");n.classList.add("wave","sc-gallery-thumbnail"),t.appendChild(n),c.appendChild(t)}return s.appendChild(c),t.appendChild(s),t}}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 n=this.getProductId(),o=t.find(t=>t.path==="products."+n+".drawer.isOpen");if(o){const t=o.value===!![];t&&this.addHostClasses("hide-content"),t||this.removeHostClasses("hide-content")}}template(){const t=this.getProductId(),n=this.getStoreValue("address.formattedAddress");if(n)return ComponentFactoryService.createElement({type:s.PRODUCT_INTERACTIONS,productId:this.getProductId()});const o=document.createElement("button");return o.type="button",o.className="product-options-open-address-button",o.textContent=this.config.layout.buyNowButtonText,o.addEventListener("click",async()=>{this.clientConfig.isMobile()&&this.commands.ui.openDrawer(s.ADDRESS_INPUT,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,s.ADDRESS_INPUT,{productId:t})}),o}}class ProductPriceComponent extends BaseComponent{get hostClasses(){return["main-product-price"]}get hostAttributes(){return{role:"status","aria-live":"polite","aria-atomic":"true","aria-label":"Product price"}}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.selectedFulfillmentId","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){var t;const n=this.getProductId(),o=this.getStoreValue("products."+n);let s=(null===(t=o.priceInfo)||void 0===t?void 0:t.avg)||0;return o.selectedFulfillment&&(s=o.selectedFulfillment.price),formatCentToDollarText(s)}}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(),n=this.getStoreValue("products."+t),o=this.getConfigs("product"),c=[],l=this.getConfigs("configurations");if(!n.productHasAvailability||!l.isElementsEnabled){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),c.push(t),c}const d="carousel"===o.layout.fulfillmentDisplay?s.PRODUCT_RETAILERS_CAROUSEL:s.PRODUCT_RETAILERS_POPUP,u=ComponentFactoryService.createElement({type:d,productId:t});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 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 n=this.getProductId(),o=t.find(t=>t.path==="products."+n+".selectedFulfillmentId");(null==o?void 0:o.value)&&this.updateSelectedCard(o.value)}updateSelectedCard(t){for(const o of this.retailerCards)o.classList.remove("selected"),o.setAttribute("aria-pressed","false");const n=this.retailerCards.findIndex(n=>n.dataset.fulfillmentId===t);-1!==n&&(this.retailerCards[n].classList.add("selected"),this.retailerCards[n].setAttribute("aria-pressed","true"),this.scrollToIndex(n))}scrollToIndex(t){if(!this.listViewport||!this.retailerCards[t])return;const n=this.retailerCards[t],o=this.listViewport.offsetWidth,s=n.offsetLeft+n.offsetWidth/2,c=o/2,l=c-s,d=0,u=-(this.listContainer.scrollWidth-o);this.translateX=Math.max(u,Math.min(d,l)),this.updateTransform(!![])}setupDrag(){this.listContainer&&(this.listContainer.addEventListener("mousedown",this.handleDragStart.bind(this)),window.addEventListener("mousemove",this.handleDragMove.bind(this)),window.addEventListener("mouseup",this.handleDragEnd.bind(this)),this.listContainer.addEventListener("touchstart",this.handleDragStart.bind(this),{passive:!![]}),window.addEventListener("touchmove",this.handleDragMove.bind(this),{passive:![]}),window.addEventListener("touchend",this.handleDragEnd.bind(this)))}handleDragStart(t){this.isDragging=!![],this.hasMoved=![],this.startX="touches"in t?t.touches[0].clientX:t.clientX,this.currentTranslateX=this.translateX,this.listContainer&&(this.listContainer.style.cursor="grabbing")}handleDragMove(t){if(!this.isDragging||!this.listViewport)return;"touchmove"===t.type&&t.preventDefault();const n="touches"in t?t.touches[0].clientX:t.clientX,o=n-this.startX;Math.abs(o)>5&&(this.hasMoved=!![]);const s=this.currentTranslateX+o,c=0,l=-(this.listContainer.scrollWidth-this.listViewport.offsetWidth);this.translateX=Math.max(l,Math.min(c,s)),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 n=this.getProductId(),o=t.currentTarget.dataset.fulfillmentType;if(!o)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(n,o)}async onRetailerCardClick(t){if(this.hasMoved)return;const n=this.getProductId(),o=t.currentTarget.dataset.fulfillmentId;if(!o)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const s=this.getStoreValue("products."+n+".selectedFulfillment");if(s&&s.fulfillmentId===o)return this.logger.info("Product retailer selection skipped: Same fulfillment already selected",{productId:n,fulfillmentId:o}),void 0;await this.commands.product.selectFulfillment(n,o)}generateRetailerCard({fulfillment:t,selectedFulfillmentType:n,isSelected:o,fulfillmentStatus:s,selectedSizeAttributes:l}){var d,u,h,m,f;let g=0;const v=null==l?void 0:l.presale,y=(null==v?void 0:v.isActive)&&(null==v?void 0:v.estimatedShipBy)?"Ships by "+formatISODateToMMDDYYYY(v.estimatedShipBy):"",b=n===c.SHIPPING,x=n===c.ON_DEMAND;b&&(g=(null===(u=null===(d=null==t?void 0:t.fees)||void 0===d?void 0:d.individual)||void 0===u?void 0:u.fee)||0),x&&(g=(null===(h=null==t?void 0:t.fees)||void 0===h?void 0:h.fee)||0);const w=fulfillmentAddress(t.retailerAddress,n);let E=null;n===c.ON_DEMAND&&s.openTime&&(null==s?void 0:s.closeTime)&&(E=s.isOpen?"Closes at "+format24TimeTo12$1(null==s?void 0:s.closeTime):"Opens at "+format24TimeTo12$1(null==s?void 0:s.openTime));const _=n===c.ON_DEMAND&&s&&s.isClosed?"closed":"",T=document.createElement("div");T.className="carousel-retailer-card "+(o?"selected":"")+" "+_,T.setAttribute("data-fulfillment-id",t.fulfillmentId),T.setAttribute("role","button"),T.setAttribute("tabindex","0"),T.setAttribute("aria-pressed",o?"true":"false");const D=n===c.SHIPPING?"Shipping":"Same-day delivery";T.setAttribute("aria-label",D+" from "+t.retailerName+", "+formatCentToDollarText(null!==(m=t.price)&&void 0!==m?m:0));const P=document.createElement("div");P.className="retailer-header";const F=document.createElement("h3");if(F.className="name",F.textContent=t.retailerName,P.appendChild(F),x){const t=document.createElement("h3");t.className="address",t.textContent=w,P.appendChild(t)}const A=document.createElement("div");A.className="retailer-body";const z=document.createElement("span");z.className="product-price",z.textContent=formatCentToDollarText(null!==(f=t.price)&&void 0!==f?f:0);const O=document.createElement("span");O.className="shipping-price",O.textContent=g>0?"+ "+formatCentToDollarText(g):"FREE Delivery";const N=document.createElement("span");return N.className="expectation",N.textContent=s.isClosed?E:(null==v?void 0:v.isActive)?y:(null==t?void 0:t.expectation.detail)||"No expectation available",A.append(z,O,N),T.append(P,A),T}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),o=this.getStoreValue("products."+t+".sizes."+n.selectedSizeId),s=(null==o?void 0:o.attributes)||null,l=[];for(const c in o.shippingFulfillments)Object.prototype.hasOwnProperty.call(o.shippingFulfillments,c)&&l.push(o.shippingFulfillments[c]);const d=[];for(const c in o.onDemandFulfillments)Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,c)&&d.push(o.onDemandFulfillments[c]);const u=n.selectedFulfillmentType===c.SHIPPING,h=n.selectedFulfillmentType===c.ON_DEMAND,m=u?l:d,f=renderFulfillmentTabsContainer({shippingFulfillments:l,onDemandFulfillments:d,shippingSelected:u,onDemandSelected:h,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!n.fulfillmentHasAvailability||0===m.length){const t=document.createElement("p");return t.className="product-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[f,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 g of m){const t=getRetailerOffHours(g),o=this.generateRetailerCard({fulfillment:g,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:g.fulfillmentId===n.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:s}),l=n.selectedFulfillmentType===c.ON_DEMAND&&t&&t.isClosed;l?o.setAttribute("aria-disabled","true"):(o.addEventListener("click",this.onRetailerCardClick.bind(this)),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o.click())})),this.listContainer.appendChild(o)}return this.listViewport.appendChild(this.listContainer),[f,this.listViewport]}}class ProductRetailersPopupComponent extends BaseComponent{get hostClasses(){return["retailers-container","popup"]}constructor(){super({watchStorePaths:["products.{productId}.selectedSizeId","products.{productId}.selectedFulfillmentType","products.{productId}.selectedFulfillment","products.{productId}.fulfillmentHasAvailability"]})}getProductId(){return this.params.productId}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),o=this.getStoreValue("products."+t+".sizes."+n.selectedSizeId),l=(null==o?void 0:o.attributes)||null,d=this.config.layout.enableShippingFulfillment,u=this.config.layout.enableOnDemandFulfillment,h=Object.values(o.shippingFulfillments),m=Object.values(o.onDemandFulfillments),f=(d?h.length:0)+(u?m.length:0),g=document.createElement("div");g.className="header";const v=document.createElement("span");v.className="header-label",v.textContent=n.selectedFulfillmentType===c.SHIPPING?"Shipping From:":"Delivering From:";const y=document.createElement("button");if(y.className="delivery-options",y.type="button",y.textContent="See Delivery Options ("+f+")",y.setAttribute("aria-label","View all "+f+" delivery options"),y.addEventListener("click",async()=>{0!==f&&(this.clientConfig.isMobile()&&this.commands.ui.openDrawer(s.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}),this.clientConfig.isMobile()||await this.commands.product.openProductDrawer(t,s.PRODUCT_RETAILERS_POPUP_LIST,{productId:t}))}),g.appendChild(v),g.appendChild(y),!n.fulfillmentHasAvailability){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[g,t]}const b=document.createElement("div");b.className="popup-fulfillment-list-container";const x=getRetailerOffHours(n.selectedFulfillment),w=renderPopupRetailerCard({fulfillment:n.selectedFulfillment,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:![],fulfillmentStatus:x,selectedSizeAttributes:l});return b.appendChild(w),[g,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 n=this.getProductId(),o=t.currentTarget.dataset.fulfillmentType;if(!o)return this.logger.warn("Product fulfillment type selection failed: Type not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;await this.commands.product.changeFulfillmentType(n,o)}async onRetailerCardClick(t){const n=this.getProductId(),o=t.currentTarget.dataset.fulfillmentId;if(!o)return this.logger.warn("Product retailer selection failed: Fulfillment ID not found in target element",{productId:n,targetElement:t.currentTarget.outerHTML.substring(0,100)}),void 0;const k=async()=>{this.clientConfig.isMobile()||await this.commands.product.closeProductDrawer(n),this.clientConfig.isMobile()&&this.commands.ui.closeDrawer()},s=this.getStoreValue("products."+n+".selectedFulfillment");if(s&&s.fulfillmentId===o)return await k(),void 0;await this.commands.product.selectFulfillment(n,o),await k()}template(){const t=this.getProductId(),n=this.getStoreValue("products."+t),o=this.getStoreValue("products."+t+".sizes."+n.selectedSizeId),s=(null==o?void 0:o.attributes)||null,l=[];for(const c in o.shippingFulfillments)Object.prototype.hasOwnProperty.call(o.shippingFulfillments,c)&&l.push(o.shippingFulfillments[c]);const d=[];for(const c in o.onDemandFulfillments)Object.prototype.hasOwnProperty.call(o.onDemandFulfillments,c)&&d.push(o.onDemandFulfillments[c]);const u=n.selectedFulfillmentType===c.SHIPPING,h=n.selectedFulfillmentType===c.ON_DEMAND,m=u?l:d,f=document.createElement("h5");f.className="popup-retailers-section-title",f.textContent="Delivery Options";const g=renderFulfillmentTabsContainer({shippingFulfillments:l,onDemandFulfillments:d,shippingSelected:u,onDemandSelected:h,onTabClick:this.onFulfillmentTabClick.bind(this),enableShippingFulfillment:this.config.layout.enableShippingFulfillment,enableOnDemandFulfillment:this.config.layout.enableOnDemandFulfillment});if(!n.fulfillmentHasAvailability||0===m.length){const t=document.createElement("p");return t.className="fulfillments-no-availability-message",t.innerHTML=sanitizeHTML(this.config.layout.noAvailabilityText),[f,g,t]}const v=document.createElement("div");v.className="popup-fulfillment-list-container";for(const c of m){const t=getRetailerOffHours(c),o=renderPopupRetailerCard({fulfillment:c,selectedFulfillmentType:n.selectedFulfillmentType,isSelected:c.fulfillmentId===n.selectedFulfillmentId,fulfillmentStatus:t,selectedSizeAttributes:s});o.addEventListener("click",this.onRetailerCardClick.bind(this)),o.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),o.click())}),v.appendChild(o)}return[f,g,v]}}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 n=this.getProductId(),o=t.find(t=>t.path==="products."+n+".drawer.isOpen"),s=t.find(t=>t.path==="products."+n+".rerender");o&&this.titleElement&&this.titleElement.classList.toggle("hide",o.value),(null==s?void 0:s.value)===!![]&&this.rerender("ProductComponentRerender")}template(){var t;const n=this.getProductId(),o=this.getStoreValue("products."+n);if(!o)return ComponentFactoryService.createElement({type:s.PRODUCT_LOADING});if(o.error)return productionComponentError({title:"Product Unavailable",message:"We're sorry, this product is currently unavailable.",componentType:s.PRODUCT});if(o.loading)return ComponentFactoryService.createElement({type:s.PRODUCT_LOADING});const c=o.sizes[o.selectedSizeId],l=document.createElement("div");l.classList.add("product-content-wrapper"),l.setAttribute("role","region"),l.setAttribute("aria-label",""+o.name);const d=document.createElement("div");if(d.classList.add("product-content"),d.setAttribute("role","region"),d.setAttribute("aria-label",""+o.name),this.config.layout.showTitle){const t=document.createElement("h1");t.classList.add("product-title"),t.textContent=o.name,this.titleElement=t,d.appendChild(t)}const u=ComponentFactoryService.createElement({type:s.PRODUCT_OPTIONS,productId:n});d.appendChild(u);const h=ComponentFactoryService.createElement({type:s.PRODUCT_DRAWER,productId:n});if(d.appendChild(h),l.appendChild(d),!this.config.layout.showImages||!(null===(t=o.images)||void 0===t?void 0:t.length))return l;l.classList.add("has-images");const m=ComponentFactoryService.createElement({type:s.PRODUCT_IMAGE_CAROUSEL,images:o.images,mainImage:c.image,productId:n});return l.prepend(m),m.setAttribute("aria-label","Product images"),l}async disconnected(){const t=this.getProductId();t&&await this.commands.product.removeProduct(t)}}class ProductListCardComponent extends BaseComponent{get hostClasses(){return["product-list-card",this.params.variant,this.params.fillCard?"fill":""]}getAvailabilityData(){var t,n,o;const s=this.params.product,c=this.getStoreValue("address.address"),l={hasAvailability:![],upc:"",fulfillmentId:"",partNumber:"",quantity:1,state:(null==c?void 0:c.state)||"",isPresale:![],isPresaleActive:![]},d=s.sizes[0];if(!d)return l;const u=d.variants[0];if(!u)return l;l.upc=d.upc;const h=d.attributes||{};l.isPresale=(null===(t=h.presale)||void 0===t?void 0:t.isActive)===!![],l.isPresaleActive=this.isPresaleActive(h);for(const m of this.params.fulfillments){const t=u.fulfillments.some(t=>t===m.id);if(t){const t="shipping"===m.type&&(null===(n=u.fulfillmentTypes)||void 0===n?void 0:n.shipping)||"onDemand"===m.type&&(null===(o=u.fulfillmentTypes)||void 0===o?void 0:o.onDemand);if(t&&u.stock>0){l.hasAvailability=!![],l.fulfillmentId=m.id,l.partNumber=u.partNumber;break}}}return l}isPresaleActive(t){const n=null==t?void 0:t.presale;if(!n)return![];if(!n.isActive)return![];if(n.canPurchaseOn){const t=new Date(n.canPurchaseOn),o=new Date;if(o.getTime()<t.getTime())return![]}return!![]}async handleAddToCart(t){if(!t.hasAvailability)return;const n=this.params.product.salsifyGrouping||this.params.product.id||"";t.isPresale&&t.isPresaleActive?await this.commands.productList.addPresaleToCart({upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:n}):await this.commands.productList.addToCart({upc:t.upc,fulfillmentId:t.fulfillmentId,partNumber:t.partNumber,quantity:t.quantity,identifier:n})}template(){var t,n,o,s;const c=this.params.product,l=c.sizes[0],d=l?l.image:c.images[0],u=c.name,h=l?l.size:null,m=null!==(o=null===(n=null===(t=null==l?void 0:l.variants)||void 0===t?void 0:t[0])||void 0===n?void 0:n.price)&&void 0!==o?o:(null===(s=c.priceInfo)||void 0===s?void 0:s.average)||0,f=this.getAvailabilityData();return this.createVariantStandard({image:d,name:u,size:h,price:m,availability:f})}generateProductUrl(){var t;if(!this.params.productUrl)return null;const n=this.params.product,o=null===(t=n.sizes)||void 0===t?void 0:t[0],s=this.params.productUrl;if(s.includes("{upc}")){const t=(null==o?void 0:o.upc)||"";return t?s.replace("{upc}",t):(this.logger.warn("Product URL template requires {upc} but product has no UPC"),null)}if(s.includes("{grouping}")){const t=n.salsifyGrouping||"";return t?s.replace("{grouping}",t):(this.logger.warn("Product URL template requires {grouping} but product has no salsifyGrouping"),null)}return null}createVariantStandard(t){const{image:n,name:o,size:s,price:c,availability:l}=t,d=[],u=this.generateProductUrl(),h=document.createElement("div");h.className="plc__image-content";const m=document.createElement("div");m.className="plc__image-wrapper";const f=document.createElement("img");if(f.className="plc__image",f.src=n,f.alt=o,f.loading="lazy",m.appendChild(f),h.appendChild(m),u){const t=document.createElement("a");t.href=u,t.className="plc__image-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(h),d.push(t)}else d.push(h);const g=document.createElement("div");g.className="plc__content";const v=document.createElement("h3");if(v.className="plc__title",v.textContent=o,u){const t=document.createElement("a");t.href=u,t.className="plc__title-link",t.target="_blank",t.rel="noopener noreferrer",t.addEventListener("click",()=>{this.commands.productList.trackSelectItem(this.params.product)}),t.appendChild(v),g.appendChild(t)}else g.appendChild(v);const y=document.createElement("div");y.className="plc__size-price-wrapper";const b=document.createElement("div");b.className="plc__price",b.textContent=formatCentToDollarText(c),y.appendChild(b);const x=document.createElement("div");x.className="plc__size",x.textContent=s||"",y.appendChild(x),g.appendChild(y),d.push(g);const w=document.createElement("button");return w.type="button",w.className="plc__button",w.disabled=!l.hasAvailability,l.hasAvailability?w.textContent="Add to Cart":(w.textContent="Not Available In "+l.state.toUpperCase(),this.addHostClasses("not-available")),w.addEventListener("click",async t=>{t.preventDefault(),t.stopPropagation(),await this.handleAddToCart(l)}),d.push(w),d}}class ProductListCardLoadingComponent extends BaseComponent{get hostClasses(){return["product-list-card-loading__container"]}createSkeletonCard(t){const n=document.createElement("div");n.classList.add("slc__card");const o=document.createElement("div");o.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),o.appendChild(s);const l=document.createElement("div");l.className="slc__content";const d=document.createElement("div");d.className="slc__title-container";const u=document.createElement("div");u.classList.add("wave","slc__title","slc__title-line-1"),d.appendChild(u);const h=document.createElement("div");h.classList.add("wave","slc__title","slc__title-line-2"),d.appendChild(h),l.appendChild(d);const m=document.createElement("div");m.className="slc__size-price-wrapper";const f=document.createElement("div");f.classList.add("wave","slc__price"),m.appendChild(f);const g=document.createElement("div");g.classList.add("wave","slc__size"),m.appendChild(g),l.appendChild(m);const v=document.createElement("div");return v.classList.add("wave","slc__button"),n.appendChild(o),n.appendChild(l),n.appendChild(v),n}template(){const t=[],n=100/this.params.columns;this.container.style.setProperty("--card-width",n+"%"),this.container.style.setProperty("--columns",""+this.params.columns);const o=this.params.rows*this.params.columns;for(let s=0;s<o;s++){const n=this.createSkeletonCard(s);t.push(n)}return t}}class ProductListFiltersComponent extends BaseComponent{get hostClasses(){return["product-list-filters-container"]}isSameDayDeliveryDisabled(){var t,n;return!(!(null===(t=this.params.currentFilters)||void 0===t?void 0:t.personalized)&&!(null===(n=this.params.currentFilters)||void 0===n?void 0:n.preOrder))}isPersonalizationDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}isPreOrderDisabled(){var t;return"onDemand"===(null===(t=this.params.currentFilters)||void 0===t?void 0:t.deliveryOptions)}template(){var t,n,o;const s=[],c=document.createElement("div");c.className="product-list-filters-header";const l=document.createElement("h3");if(l.className="product-list-filters-title",l.textContent="Filters",c.appendChild(l),s.push(c),this.params.enablePersonalized){const n=document.createElement("div");n.className="product-list-filters-personalized";const o=document.createElement("label");o.className="product-list-filters-personalized-label",o.setAttribute("for","personalized-switch"),o.textContent="Personalized Bottles",n.appendChild(o);const c=document.createElement("input");if(c.type="checkbox",c.id="personalized-switch",c.className="product-list-filters-personalized-switch",c.disabled=this.isPersonalizationDisabled(),c.checked=(null===(t=this.params.currentFilters)||void 0===t?void 0:t.personalized)||![],c.addEventListener("change",t=>{var n,o;const s=t.target;null===(o=(n=this.params).onPersonalizedChange)||void 0===o?void 0:o.call(n,s.checked)}),n.appendChild(c),this.isPersonalizationDisabled()){const t=document.createElement("div");t.className="product-list-filters-warning",t.textContent="(Not Available With Same-Day Delivery)",n.appendChild(t)}s.push(n)}if(this.params.enablePreOrder){const t=document.createElement("div");t.className="product-list-filters-pre-order";const o=document.createElement("label");o.className="product-list-filters-pre-order-label",o.setAttribute("for","pre-order-switch"),o.textContent="Pre-Order",t.appendChild(o);const c=document.createElement("input");if(c.type="checkbox",c.id="pre-order-switch",c.className="product-list-filters-pre-order-switch",c.disabled=this.isPreOrderDisabled(),c.checked=(null===(n=this.params.currentFilters)||void 0===n?void 0:n.preOrder)||![],c.addEventListener("change",t=>{var n,o;const s=t.target;null===(o=(n=this.params).onPreOrderChange)||void 0===o?void 0:o.call(n,s.checked)}),t.appendChild(c),this.isPreOrderDisabled()){const n=document.createElement("div");n.className="product-list-filters-warning",n.textContent="(Not Available With Same-Day Delivery)",t.appendChild(n)}s.push(t)}if(this.params.enableDeliveryOptions){const t=[{value:"all",label:"All"},{value:"shipping",label:"Shipping"},{value:"onDemand",label:"Same-Day Delivery"}],n=document.createElement("div");n.className="product-list-filters-delivery-options";const c=document.createElement("div");c.className="product-list-filters-delivery-options-header";const l=document.createElement("h3");l.className="product-list-filters-delivery-options-label",l.textContent="Delivery Options",c.appendChild(l),n.appendChild(c);const d=document.createElement("div");d.className="product-list-filters-delivery-options-list";for(const s of t){const t=document.createElement("div");t.className="product-list-filters-delivery-option";const n=document.createElement("input");n.type="radio",n.id="delivery-"+s.value,n.name="delivery-options",n.value=s.value,n.className="product-list-filters-delivery-radio";const c="onDemand"===s.value&&this.isSameDayDeliveryDisabled();n.disabled=c,n.checked=s.value===((null===(o=this.params.currentFilters)||void 0===o?void 0:o.deliveryOptions)||"all"),n.addEventListener("change",t=>{var n,o;const s=t.target;null===(o=(n=this.params).onDeliveryOptionsChange)||void 0===o?void 0:o.call(n,s.value)});const l=document.createElement("label");l.htmlFor="delivery-"+s.value,l.className="product-list-filters-delivery-radio-label "+(c?"disabled":""),l.textContent=s.label,t.appendChild(n),t.appendChild(l),d.appendChild(t)}n.appendChild(d),s.push(n)}return s}}var wt;(function(t){t.IDLE="idle",t.LOADING_INITIAL="loading_initial",t.LOADING_MORE="loading_more",t.ERROR="error"})(wt||(wt={}));class ProductListComponent extends BaseComponent{get hostClasses(){const t=["product-list"];return this.params.filters.length>0&&t.push("has-filters"),t}constructor(){super({watchOnlyStorePaths:["address"]}),this.products=[],this.retailers=[],this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]},this.currentFilters={personalized:![],preOrder:![],deliveryOptions:"all"},this.cardsContainer=null,this.filtersContainer=null,this.sentinelElement=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels=new Map,this.loadingState=wt.IDLE,this.scrollObserver=null,this.initializationPromise=null}async connected(){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeComponent(),await this.initializationPromise}disconnectedCallback(){super.disconnectedCallback(),this.doCleanup()}async initializeComponent(){try{this.setLoadingState(wt.LOADING_INITIAL),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll()),this.setLoadingState(wt.IDLE)}catch(Z){this.logger.error("Error initializing product list:",Z),this.setLoadingState(wt.ERROR),this.showErrorState("Failed to load products")}}template(){const t=[];return this.params.filters.length>0&&t.push(this.createFiltersContainer()),this.cardsContainer=this.createCardsContainer(),t.push(this.cardsContainer),this.renderCurrentState(),t}setLoadingState(t){this.loadingState=t,this.cardsContainer&&this.renderCurrentState()}renderCurrentState(){if(this.cardsContainer)switch(this.loadingState){case wt.LOADING_INITIAL:this.renderLoadingState();break;case wt.ERROR:break;case wt.IDLE:case wt.LOADING_MORE:this.updateSentinel()}}async loadInitialProducts(){var t;try{const n=this.buildApiParams(0),o=await this.commands.productList.getProductList(n);this.products=o.products||[],this.retailers=o.retailers||[],this.updatePagination(o.navigation),this.syncFiltersFromResponse((null===(t=o.navigation)||void 0===t?void 0:t.filters)||[])}catch(n){throw this.logger.error("Error loading initial products:",n),this.products=[],this.retailers=[],this.pagination.hasMorePages=![],n}}async loadMoreProducts(){if(this.loadingState!==wt.LOADING_MORE&&this.pagination.hasMorePages)try{this.setLoadingState(wt.LOADING_MORE);const t=this.pagination.currentPage+1,n=this.buildApiParams(t),o=await this.commands.productList.getProductList(n);o.products&&o.products.length>0?(this.products.push(...o.products),this.mergeRetailers(o.retailers||[]),this.updatePagination(o.navigation),this.appendNewProducts(o.products)):(this.pagination.hasMorePages=![],this.updatePagination(o.navigation)),this.setLoadingState(wt.IDLE)}catch(t){this.logger.error("Error loading more products:",t),this.setLoadingState(wt.ERROR),this.showSentinelError("Error loading products")}}mergeRetailers(t){const n=new Map(this.retailers.map(t=>[t.id,t]));for(const o of t)n.has(o.id)||(this.retailers.push(o),n.set(o.id,o))}updatePagination(t){var n,o,s,c;t&&(this.pagination={currentPage:null!==(n=t.currentPage)&&void 0!==n?n:0,totalPages:null!==(o=t.totalPages)&&void 0!==o?o:0,hasMorePages:(null!==(s=t.currentPage)&&void 0!==s?s:0)<(null!==(c=t.totalPages)&&void 0!==c?c:1)-1})}buildApiParams(t){return{page:t,perPage:this.params.rows*this.params.columns,filters:this.buildFiltersFromState()}}buildFiltersFromState(){const t=[{key:"availability",values:"IN_STOCK"}];return this.currentFilters.personalized&&t.push({key:"engraving",values:"YES"}),this.currentFilters.preOrder&&t.push({key:"presale",values:"YES"}),"all"!==this.currentFilters.deliveryOptions&&t.push({key:"fulfillment",values:[this.currentFilters.deliveryOptions]}),t}syncFiltersFromResponse(t){if(t)for(const n of t)switch(n.key){case"engraving":this.currentFilters.personalized="YES"===n.values;break;case"presale":this.currentFilters.preOrder="YES"===n.values;break;case"fulfillment":Array.isArray(n.values)&&(n.values.includes("onDemand")?this.currentFilters.deliveryOptions="onDemand":n.values.includes("shipping")?this.currentFilters.deliveryOptions="shipping":this.currentFilters.deliveryOptions="all")}}async onFilterChange(){try{this.updateFiltersUI(),this.resetPagination(),this.products=[],this.retailers=[],this.cleanupScrollObserver(),this.clearCardsContainer(),this.setLoadingState(wt.LOADING_INITIAL),await this.loadInitialProducts(),this.renderProducts(),this.setupInfiniteScroll(),this.setLoadingState(wt.IDLE)}catch(Z){this.logger.error("Error handling filter change:",Z),this.setLoadingState(wt.ERROR),this.showErrorState("Error updating filters")}}resetPagination(){this.pagination={currentPage:0,totalPages:0,hasMorePages:!![]}}updateFiltersUI(){this.filtersContainer&&(this.updatePersonalizedSwitch(),this.updatePreOrderSwitch(),this.updateDeliveryOptions())}updatePersonalizedSwitch(){this.personalizedSwitch&&(this.personalizedSwitch.checked=this.currentFilters.personalized,this.personalizedSwitch.disabled=this.isPersonalizationDisabled())}updatePreOrderSwitch(){this.preOrderSwitch&&(this.preOrderSwitch.checked=this.currentFilters.preOrder,this.preOrderSwitch.disabled=this.isPreOrderDisabled())}updateDeliveryOptions(){0!==this.deliveryRadios.length&&this.deliveryRadios.forEach(t=>{const n="onDemand"===t.value&&this.isSameDayDeliveryDisabled();t.disabled=n,n&&"onDemand"===t.value||(t.checked=t.value===this.currentFilters.deliveryOptions),this.updateRadioLabel(t,n)})}updateRadioLabel(t,n){const o=this.deliveryRadioLabels.get(t.id);o&&(o.className="product-list-filters-delivery-radio-label "+(n?"disabled":""))}isPersonalizationDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isPreOrderDisabled(){return"onDemand"===this.currentFilters.deliveryOptions}isSameDayDeliveryDisabled(){return this.currentFilters.personalized||this.currentFilters.preOrder}createCardsContainer(){const t=document.createElement("div");t.className="product-list-cards__container";const n=100/this.params.columns;return t.style.setProperty("--card-width",n+"%"),t.style.setProperty("--columns",""+this.params.columns),t}renderLoadingState(){if(!this.cardsContainer)return;this.clearCardsContainer();const t=ComponentFactoryService.createElement({type:s.PRODUCT_LIST_CARD_LOADING,cardVariant:this.params.cardVariant,rows:this.params.rows,columns:this.params.columns,fillCard:this.params.fillCard,filters:this.params.filters,productUrl:this.params.productUrl});this.cardsContainer.appendChild(t)}renderProducts(){if(this.cardsContainer){if(this.clearCardsContainer(),0===this.products.length){const t=this.createInfoElement("No products found");return this.cardsContainer.appendChild(t),void 0}for(const t of this.products){const n=this.createProductCard(t);n&&this.cardsContainer.appendChild(n)}}}appendNewProducts(t){if(this.cardsContainer&&0!==t.length){this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&this.sentinelElement.remove();for(const n of t){const t=this.createProductCard(n);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){var n;try{const o=null===(n=t.sizes)||void 0===n?void 0:n[0];if(!o)return this.logger.warn("Product "+t.id+" has no sizes"),null;const c=new Map(this.retailers.flatMap(t=>t.fulfillments.map(t=>[t.id,t]))),l=new Set(o.variants.flatMap(t=>t.fulfillments)),d=Array.from(l).map(t=>c.get(t)).filter(t=>Boolean(t));return ComponentFactoryService.createElement({type:s.PRODUCT_LIST_CARD,variant:this.params.cardVariant,fillCard:this.params.fillCard,product:t,fulfillments:d,productUrl:this.params.productUrl})}catch(o){return this.logger.error("Error creating product card for product "+t.id+":",o),null}}createFiltersContainer(){return this.filtersContainer=ComponentFactoryService.createElement({type:s.PRODUCT_LIST_FILTERS,enablePersonalized:this.params.filters.includes(h.PERSONALIZATION),enablePreOrder:this.params.filters.includes(h.PRE_ORDER),enableDeliveryOptions:this.params.filters.includes(h.DELIVERY_OPTIONS),currentFilters:this.currentFilters,onPersonalizedChange:async t=>{this.currentFilters.personalized=t,await this.onFilterChange()},onPreOrderChange:async t=>{this.currentFilters.preOrder=t,await this.onFilterChange()},onDeliveryOptionsChange:async t=>{this.currentFilters.deliveryOptions=t,"onDemand"===t&&(this.currentFilters.personalized=![],this.currentFilters.preOrder=![]),await this.onFilterChange()}}),this.storeFilterElementReferences(),this.filtersContainer}storeFilterElementReferences(){if(!this.filtersContainer)return;this.personalizedSwitch=this.filtersContainer.querySelector("#personalized-switch"),this.preOrderSwitch=this.filtersContainer.querySelector("#pre-order-switch");const t=this.filtersContainer.querySelectorAll('input[name="delivery-options"]');this.deliveryRadios=Array.from(t),this.deliveryRadioLabels.clear(),this.deliveryRadios.forEach(t=>{var n;const o=null===(n=this.filtersContainer)||void 0===n?void 0:n.querySelector('label[for="'+t.id+'"]');o&&this.deliveryRadioLabels.set(t.id,o)})}setupInfiniteScroll(){this.cardsContainer&&this.pagination.hasMorePages&&(this.cleanupScrollObserver(),this.sentinelElement=this.createScrollSentinel(),this.cardsContainer.appendChild(this.sentinelElement),this.scrollObserver=new IntersectionObserver(t=>{const n=t[0];n.isIntersecting&&this.loadingState===wt.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 n;t.innerHTML="",n=this.loadingState===wt.LOADING_MORE?this.createLoadingElement("Loading more products..."):this.pagination.hasMorePages?this.createInfoElement("Scroll for more products"):this.createInfoElement("No more products",!![]),t.appendChild(n)}showSentinelError(t){if(!this.sentinelElement)return;this.sentinelElement.innerHTML="";const n=this.createErrorElement(t);this.sentinelElement.appendChild(n)}createLoadingElement(t){const n=document.createElement("div");n.className="product-list-sentinel-container";const o=document.createElement("div");o.className="product-list-sentinel-spinner";const s=document.createElement("div");return s.className="product-list-sentinel-text",s.textContent=t,n.appendChild(o),n.appendChild(s),n}createErrorElement(t){const n=document.createElement("div");n.className="product-list-sentinel-error-container";const o=document.createElement("div");o.className="product-list-sentinel-error-icon",o.innerHTML="⚠";const s=document.createElement("div");return s.className="product-list-sentinel-error-text",s.textContent=t,n.appendChild(o),n.appendChild(s),n}createInfoElement(t,n=![]){const o=document.createElement("div");if(o.className="product-list-sentinel-info-container",!n&&t.includes("Scroll")){const t=document.createElement("div");t.className="product-list-sentinel-icon",t.innerHTML="↓",o.appendChild(t)}else if(n){const t=document.createElement("div");t.className="product-list-sentinel-divider",o.appendChild(t)}const s=document.createElement("div");return s.className=n?"product-list-sentinel-info-text no-more":"product-list-sentinel-info-text",s.textContent=t,o.appendChild(s),o}showErrorState(t){if(!this.cardsContainer)return;this.clearCardsContainer();const n=this.createErrorElement(t);this.cardsContainer.appendChild(n)}clearCardsContainer(){if(this.cardsContainer)for(this.sentinelElement&&this.sentinelElement.parentNode===this.cardsContainer&&(this.sentinelElement.remove(),this.sentinelElement=null);this.cardsContainer.firstChild;)this.cardsContainer.removeChild(this.cardsContainer.firstChild)}cleanupScrollObserver(){this.scrollObserver&&(this.scrollObserver.disconnect(),this.scrollObserver=null),this.sentinelElement&&(this.sentinelElement=null)}async onStoreWatch(t){const n=t.find(t=>"address"===t.path);if(n&&void 0!==n.value&&this.cardsContainer)try{this.resetPagination(),this.products=[],this.retailers=[],this.cleanupScrollObserver(),this.clearCardsContainer(),this.renderLoadingState(),await this.loadInitialProducts(),this.cardsContainer&&(this.renderProducts(),this.setupInfiniteScroll())}catch(o){this.logger.error("Error reloading products after address change:",o),this.setLoadingState(wt.ERROR),this.cardsContainer&&this.showErrorState("Failed to reload products")}}doCleanup(){this.cleanupScrollObserver(),this.products=[],this.retailers=[],this.cardsContainer=null,this.filtersContainer=null,this.personalizedSwitch=null,this.preOrderSwitch=null,this.deliveryRadios=[],this.deliveryRadioLabels.clear(),this.initializationPromise=null}}class AlertComponent extends BaseComponent{constructor(){super(...arguments),this.hideTimeout=null,this.elements=[]}get hostClasses(){return["alert-wrapper","hidden"]}get hostAttributes(){return{role:"alert","aria-live":"polite"}}beforeSetupStoreWatchers(){this.reactiveOptions.watchStorePaths=[this.params.errorStorePath]}afterRender(){this.updateAlert()}onStoreWatch(t){t.length>0&&this.updateAlert()}getErrorMessages(){var t,n;const o=null!==(t=this.params.fromEvents)&&void 0!==t?t:![],s=null!==(n=this.params.showFirstEvent)&&void 0!==n?n:!![];if(o){const t=this.store.get(this.params.errorStorePath)||[],n=t.filter(t=>null==t?void 0:t.message).map(t=>({message:t.message,level:t.level||"error",type:t.type}));return s?n.slice(0,1):n}const c=this.store.get(this.params.errorStorePath);return c?[{message:c,level:"error"}]:[]}createErrorElement(t){const n=document.createElement("div");n.classList.add("alert-container","alert-"+t.level);const o=document.createElement("span");o.classList.add("alert-icon"),o.innerHTML=ErrorInfoIcon({className:t.level+"-icon"});const s=document.createElement("span");return s.classList.add("alert-text"),s.textContent=t.message,n.appendChild(o),n.appendChild(s),n}scheduleHide(){var t;this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null);const n=null!==(t=this.params.autoHideDelay)&&void 0!==t?t:3e3;this.hideTimeout=setTimeout(()=>{this.hideAllErrors(),this.hideTimeout=null},n)}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 n=null!==(t=this.params.fromEvents)&&void 0!==t?t:![];n?this.store.set(this.params.errorStorePath,[]):this.store.set(this.params.errorStorePath,null)}updateAlert(){const t=this.getErrorMessages();if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),this.elements.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t)}),this.elements=[],0===t.length)return this.addHostClasses("hidden"),this.removeHostClasses("alert-success","alert-info","alert-warning","alert-error"),void 0;this.removeHostClasses("hidden"),this.elements=t.map(t=>this.createErrorElement(t)),this.elements.forEach(t=>{this.container.appendChild(t)}),this.scheduleHide()}template(){return[]}disconnectedCallback(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null),super.disconnectedCallback()}}class ButtonsOpenCartComponent extends BaseComponent{get hostClasses(){return["lce-ui-button",...this.params.classes||[]]}template(){const t=this.getConfigs("global");this.addEventListener("click",()=>{this.commands.ui.openDrawer(s.CART)});const n=document.createElement("span");if(n.className="lce-cart-button-icon",n.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",[n,t]}return[n]}afterRender(){this.params.showItemsCount&&this.setupCartBadge()}setupCartBadge(){const t=this.container.querySelector(".lce-cart-button-badge");if(!t)return;const n=this.getStoreValue("cart.totals.quantity")||0;t.textContent=n.toString(),t.style.visibility=n>0?"visible":"hidden",this.store.watch("cart.totals",()=>{const n=this.getStoreValue("cart.totals.quantity")||0;t.textContent=n.toString(),t.style.visibility=n>0?"visible":"hidden"})}}class DrawerComponent extends BaseComponent{constructor(){super({watchStorePaths:["ui.drawer"]}),this.isOpen=![],this.wrapperElement=null,this.drawerElement=null,this.backdropElement=null,this.contentContainer=null,this.currentContentType=null,this.isTransitioning=![],this.boundHandleKeydown=this.handleKeydown.bind(this)}disconnected(){this.backdropElement&&this.backdropElement.removeEventListener("click",this.handleBackdropClick.bind(this)),document.removeEventListener("keydown",this.boundHandleKeydown)}onStoreChanged(t){var n;const o=t.find(t=>"ui.drawer"===t.path);if(!o)return![];const s=o.value,c=s.isOpen,l=null===(n=s.contentConfig)||void 0===n?void 0:n.type,d=l!==this.currentContentType;return c&&!this.isOpen?(this.currentContentType=l,this.openWithContent(s),![]):c&&this.isOpen&&!d?![]:c&&this.isOpen&&d?(this.currentContentType=l,this.openWithContent(s),![]):!c&&this.isOpen?(this.close(),this.currentContentType=null,![]):![]}openWithContent({contentConfig:t}){try{if(!t)return this.logger.warn("Drawer opening attempted without content configuration"),void 0;const{type:n,data:o}=t||{};let s;s=this.isElementsEnabled()?ComponentFactoryService.createElement({type:n,...o}):this.clientConfig.isProduction()?productionComponentError({title:"Element Unavailable",message:"We're sorry, this element is currently unavailable.",componentType:n}):componentError({message:"Elements is not enabled.",componentType:n}),this.isOpen&&this.contentContainer&&this.contentContainer.firstElementChild?this.animateContentSwap(s,n):(this.cleanupCurrentContent(),this.contentContainer&&this.contentContainer.appendChild(s),this.updateDrawerContentTypeClass(n),this.open()),this.addHostAttribute("data-target",n.toString().toLowerCase())}catch(n){this.logger.error("Drawer content loading failed",n),this.commands.ui.closeDrawer()}}animateContentSwap(t,n){if(!this.contentContainer||this.isTransitioning)return;this.isTransitioning=!![];const o=this.contentContainer.firstElementChild;o.classList.add("drawer-content-fade-out"),requestAnimationFrame(()=>{o.classList.add("fading")}),setTimeout(()=>{o.remove(),t.classList.add("drawer-content-fade-in"),this.contentContainer.appendChild(t),this.updateDrawerContentTypeClass(n),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 n=["drawer"];this.isOpen&&n.push("open"),n.push(t.toString().toLowerCase()),this.drawerElement.className=n.join(" ")}updateDrawerState(){this.wrapperElement&&this.drawerElement&&this.backdropElement&&(this.isOpen&&(this.wrapperElement.classList.add("open"),this.backdropElement.classList.add("visible"),document.body.style.overflow="hidden",this.currentContentType&&this.updateDrawerContentTypeClass(this.currentContentType)),this.isOpen||(this.wrapperElement.classList.remove("open"),this.backdropElement.classList.remove("visible"),document.body.style.overflow="",this.drawerElement.className="drawer"))}isElementsEnabled(){var t;try{const n=this.themeProvider.getConfigs("configurations");return null!==(t=null==n?void 0:n.isElementsEnabled)&&void 0!==t?t:![]}catch(n){return this.logger.error("Could not check elements enabled status, defaulting to not enabled",n),!![]}}template(){return this.wrapperElement=document.createElement("div"),this.wrapperElement.classList.add("drawer-wrapper"),this.backdropElement=document.createElement("div"),this.backdropElement.classList.add("drawer-backdrop"),this.backdropElement.addEventListener("click",this.handleBackdropClick.bind(this)),this.drawerElement=document.createElement("div"),this.drawerElement.classList.add("drawer"),this.contentContainer=document.createElement("div"),this.contentContainer.classList.add("drawer-content"),this.drawerElement.append(this.contentContainer),this.wrapperElement.append(this.backdropElement),this.wrapperElement.append(this.drawerElement),document.addEventListener("keydown",this.boundHandleKeydown),this.wrapperElement}}class EngravingFormComponent extends BaseComponent{constructor(){super(...arguments),this.engravingLines=[],this.fulfillmentId=null,this.partNumber=null}get hostClasses(){return["engraving-form"]}beforeConnected(){var t;if(this.engravingLines=this.params.lines,"product"===this.params.context){const n=this.store.get("products."+this.params.identifier);this.fulfillmentId=n.selectedFulfillmentId,this.partNumber=(null===(t=n.selectedFulfillment)||void 0===t?void 0:t.partNumber)||null}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier);this.fulfillmentId=t.fulfillmentId,this.partNumber=t.partNumber}}calculateTotalPrice(){var t,n;if("product"===this.params.context){const o=this.store.get("products."+this.params.identifier),s=o.sizes[o.selectedSizeId],c=s.shippingFulfillments[this.fulfillmentId],l=c.price,d=(null===(n=null===(t=null==s?void 0:s.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.fee)||0;return l+d}if("cart"===this.params.context){const t=this.store.get("cart.items."+this.params.identifier),n=t.unitPrice,o=t.attributes.engraving.fee||0;return n+o}return 0}productInformationSection(){const t=[];let n="",o="";if("product"===this.params.context){const s=this.store.get("products."+this.params.identifier);s.mainImage?t.push(s.mainImage):t.push(...s.images||[]),n=s.name,o=s.sizes[s.selectedSizeId].size}if("cart"===this.params.context){const s=this.store.get("cart.items."+this.params.identifier);s.mainImage&&t.push(s.mainImage),n=s.name,o=s.size}const s=document.createElement("div");if(s.className="product-info-section",t.length>0){const o=document.createElement("div");o.className="product-image-container";const c=document.createElement("img");c.src=t[0],c.alt=n,c.loading="lazy",c.className="product-image",o.appendChild(c),s.appendChild(o)}const c=document.createElement("div");c.className="product-details-container";const l=document.createElement("div");l.className="product-header";const d=document.createElement("h4");d.className="product-title",d.textContent=n,this.productPriceSpan=document.createElement("span"),this.productPriceSpan.className="product-price",this.productPriceSpan.textContent=formatCentToDollarText(this.calculateTotalPrice()),l.appendChild(d),l.appendChild(this.productPriceSpan),c.appendChild(l);const u=document.createElement("p");u.className="product-size-text",u.textContent=o,c.appendChild(u);const h=document.createElement("p");return h.className="engraving-fees-disclaimer",h.textContent="Personalization fees included in total, varies by retailer.",c.appendChild(h),s.appendChild(c),s}addToCartButtonText(t){if("product"!==this.params.context)return"Save";const n=this.getConfigs("product"),o=n.layout.addToCartButtonText;return n.layout.addToCartButtonShowTotalPrice?o+" - "+formatCentToDollarText(t):o}retailersSection(){var t,n,o,s,c,l,d;const u=this.store.get("products."+this.params.identifier),h=u.sizes[u.selectedSizeId],m=Object.values(h.shippingFulfillments).filter(t=>t.isVariantEngravable&&t.canEngrave),f=document.createElement("div");f.className="fulfillment-section";const g=document.createElement("p");if(g.className="shipping-from-text",g.innerHTML="Shipping from: <b>"+(null===(t=u.selectedFulfillment)||void 0===t?void 0:t.retailerName)+"</b>",f.appendChild(g),1===m.length)return f;const v=document.createElement("div");v.className="fulfillment-options-container",f.appendChild(v);const y=document.createElement("span");y.className="see-more-fulfillments",y.textContent="See More Delivery Options ("+m.length+")",y.setAttribute("role","button"),y.setAttribute("tabindex","0"),y.setAttribute("aria-label","See More Delivery Options ("+m.length+")"),y.setAttribute("aria-expanded","false");const C=()=>{const t=v.classList.contains("expanded");v.classList.toggle("expanded"),t?(y.textContent="See More Delivery Options ("+m.length+")",y.setAttribute("aria-label","See More Delivery Options ("+m.length+")"),y.setAttribute("aria-expanded","false")):(y.textContent="See Less Delivery Options",y.setAttribute("aria-label","See Less Delivery Options"),y.setAttribute("aria-expanded","true"))};y.addEventListener("click",C),y.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),C())}),f.appendChild(y);for(const b of m){const t=document.createElement("div");t.className="fulfillment-option",t.setAttribute("data-fulfillment-id",b.fulfillmentId),b.fulfillmentId===(null===(n=u.selectedFulfillment)||void 0===n?void 0:n.fulfillmentId)&&t.classList.add("selected"),t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label","Select delivery from "+b.retailerName+", "+formatCentToDollarText(b.price+((null===(s=null===(o=u.sizes[u.selectedSizeId].attributes)||void 0===o?void 0:o.engraving)||void 0===s?void 0:s.fee)||0))+", "+b.expectation.engraving),t.setAttribute("aria-pressed",b.fulfillmentId===(null===(c=u.selectedFulfillment)||void 0===c?void 0:c.fulfillmentId)?"true":"false");const i=()=>{this.fulfillmentId=b.fulfillmentId,this.partNumber=b.partNumber;const n=this.calculateTotalPrice();this.addToCartButton.textContent=this.addToCartButtonText(n),this.productPriceSpan.textContent=formatCentToDollarText(n);const o=v.querySelector(".fulfillment-option.selected");o&&(o.classList.remove("selected"),o.setAttribute("aria-pressed","false")),t.classList.add("selected"),t.setAttribute("aria-pressed","true"),g.innerHTML="Shipping from: <b>"+b.retailerName+"</b>"};t.addEventListener("click",i),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),i())});const h=b.price+((null===(d=null===(l=u.sizes[u.selectedSizeId].attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.fee)||0),m=document.createElement("div");m.className="option-row row-1",t.appendChild(m);const f=document.createElement("span");f.className="retailer-name",f.textContent=b.retailerName,m.appendChild(f);const y=document.createElement("span");y.className="fulfillment-price",y.textContent=formatCentToDollarText(h),m.appendChild(y),t.appendChild(m);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.expectation.engraving,x.appendChild(w),t.appendChild(x),v.appendChild(t)}return f}engravingLinesSection(){var t;const{lines:n,maxLines:o,location:s,maxCharsPerLine:c}=this.params,l=document.createElement("div");l.className="engraving-section";const d=document.createElement("p");if(d.className="engraving-title",d.textContent="Personalize Your Bottle",l.appendChild(d),s&&(null===(t=null==s?void 0:s.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 "+s.toLowerCase()+".",l.appendChild(t)}const u=Array.from({length:o},(t,o)=>{const s=o+1,l=document.createElement("div");l.className="engraving-input-wrapper",l.setAttribute("data-line-number",s.toString());const d=document.createElement("input");d.type="text",d.id="engraving-line-"+s,d.dataset.lineNumber=s.toString(),d.maxLength=c,d.value=n[o]||"",d.placeholder=s>1?"Line "+s+" (optional)":"Line "+s,d.className="engraving-input",d.autocomplete="off",d.setAttribute("aria-label",s>1?"Engraving line "+s+", optional, maximum "+c+" characters":"Engraving line "+s+", maximum "+c+" characters");const u=document.createElement("span");return u.className="engraving-char-count",u.textContent=d.value.length+"/"+c,u.setAttribute("aria-live","polite"),u.setAttribute("aria-atomic","true"),d.addEventListener("input",()=>{u.textContent=d.value.length+"/"+c,this.engravingLines[o]=d.value.trim().toUpperCase(),this.addToCartButton.disabled=this.engravingLines.length<=0}),l.appendChild(d),l.appendChild(u),l}),h=document.createElement("div");return h.className="engraving-inputs-container",h.append(...u),l.appendChild(h),l}actionButtonsSection(){const{identifier:t,context:n}=this.params,o=document.createElement("div");o.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 a=async()=>{"product"===n&&await this.commands.product.closeProductDrawer(t),"cart"===n&&this.commands.ui.openDrawer(s.CART)};c.addEventListener("click",a),c.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),a())}),o.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"===n?"Add personalized item to cart":"Update personalization and return to cart");const I=async()=>{const o=this.engravingLines.map(t=>t.trim().toUpperCase()).filter(t=>t&&t.length>0);if("product"===n&&this.fulfillmentId&&this.partNumber){const n=this.store.get("products."+t);await this.commands.product.addToCart(t,{upc:n.sizes[n.selectedSizeId].upc,fulfillmentId:this.fulfillmentId,partNumber:this.partNumber,quantity:1,engravingLines:o,identifier:t}),await this.commands.product.closeProductDrawer(t)}"cart"===n&&(await this.commands.cart.updateItemEngraving(t,o),this.commands.ui.openDrawer(s.CART))};return this.addToCartButton.addEventListener("click",I),this.addToCartButton.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),I())}),o.appendChild(this.addToCartButton),o}template(){const t=[],n=this.productInformationSection();if(t.push(n),"product"===this.params.context){const n=this.retailersSection();t.push(n)}const o=this.engravingLinesSection();t.push(o);const s=this.actionButtonsSection();t.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>",t.push(c),t}}class EngravingViewComponent extends BaseComponent{get hostClasses(){const t=this.getConfigs("global");return["engraving-view-container",t.layout.personalizationCardStyle,this.params.context]}engravingQuantityFee(){const t=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+t),o=(null==n?void 0:n.attributes.engraving.fee)||0,s=(null==n?void 0:n.quantity)||1;return{quantity:s,fee:o,total:o*s}}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+t),o=(null==n?void 0:n.attributes.engraving.fee)||0,s=(null==n?void 0:n.quantity)||1;return{quantity:s,fee:o,total:o*s}}return{quantity:0,fee:0,total:0}}engravingLines(){const t=this.params.identifier;if("cart"===this.params.context){const n=this.getStoreValue("cart.items."+t);return(null==n?void 0:n.attributes.engraving.lines)||[]}if("checkout"===this.params.context){const n=this.getStoreValue("checkout.items."+t);return(null==n?void 0:n.attributes.engraving.lines)||[]}return[]}handleEdit(){var t,n,o,c,l,d,u,h,m,f,g,v,y,b,x,w,E,_,T,D;const P=this.params.identifier,F={identifier:P,context:this.params.context,lines:[],maxLines:1,maxCharsPerLine:16,fee:0,location:""};if("cart"===this.params.context){const s=this.getStoreValue("cart.items."+P);F.lines=(null===(n=null===(t=null==s?void 0:s.attributes)||void 0===t?void 0:t.engraving)||void 0===n?void 0:n.lines)||[],F.maxLines=(null===(c=null===(o=null==s?void 0:s.attributes)||void 0===o?void 0:o.engraving)||void 0===c?void 0:c.maxLines)||1,F.maxCharsPerLine=(null===(d=null===(l=null==s?void 0:s.attributes)||void 0===l?void 0:l.engraving)||void 0===d?void 0:d.maxCharsPerLine)||16,F.fee=(null===(h=null===(u=null==s?void 0:s.attributes)||void 0===u?void 0:u.engraving)||void 0===h?void 0:h.fee)||0,F.location=(null===(f=null===(m=null==s?void 0:s.attributes)||void 0===m?void 0:m.engraving)||void 0===f?void 0:f.location)||""}if("checkout"===this.params.context){const t=this.getStoreValue("checkout.items."+P);F.lines=(null===(v=null===(g=null==t?void 0:t.attributes)||void 0===g?void 0:g.engraving)||void 0===v?void 0:v.lines)||[],F.maxLines=(null===(b=null===(y=null==t?void 0:t.attributes)||void 0===y?void 0:y.engraving)||void 0===b?void 0:b.maxLines)||1,F.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,F.fee=(null===(_=null===(E=null==t?void 0:t.attributes)||void 0===E?void 0:E.engraving)||void 0===_?void 0:_.fee)||0,F.location=(null===(D=null===(T=null==t?void 0:t.attributes)||void 0===T?void 0:T.engraving)||void 0===D?void 0:D.location)||""}this.commands.ui.openDrawer(s.ENGRAVING_FORM,F)}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(),n=this.engravingLines();if(0===n.length)return"";const o=document.createElement("div");o.className="engraving-header";const s=document.createElement("h3");s.textContent="Personalization";const c=document.createElement("span");if(c.className="engraving-fee",1===t.quantity&&(c.textContent=formatCentToDollarText(t.total,![])),t.quantity>1){c.textContent=formatCentToDollarText(t.total,![]);const n=document.createElement("span");n.className="engraving-fee-each",n.textContent=" ("+formatCentToDollarText(t.fee,![])+" ea)",c.appendChild(n)}o.appendChild(s),o.appendChild(c);const l=document.createElement("div");l.className="engraving-body";const d=document.createElement("div");d.className="engraving-lines";for(const m of n){const t=document.createElement("span");t.className="engraving-line",t.textContent=m,d.appendChild(t)}const u=document.createElement("div");u.className="engraving-actions";const h=document.createElement("button");h.type="button",h.classList.add("remove-button"),h.textContent="Remove",h.setAttribute("aria-label","Remove engraving");const S=async()=>{await this.handleRemove()};if(h.addEventListener("click",S),h.addEventListener("keydown",async t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),await S())}),u.appendChild(h),"checkout"!==this.params.context){const t=document.createElement("button");t.type="button",t.classList.add("edit-button"),t.textContent="Edit",t.setAttribute("aria-label","Edit engraving"),t.addEventListener("click",this.handleEdit.bind(this)),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handleEdit())}),u.appendChild(t)}return l.appendChild(d),l.appendChild(u),[o,l]}}class BirthdateInputComponent extends BaseComponent{constructor(){super(...arguments),this.validationTimeout=null}get hostClasses(){const t=this.getConfigs("global");return["custom-input","birthdate",t.layout.inputFieldStyle]}afterRender(){this.monthInput=this.container.querySelector('input[data-field="month"]'),this.dayInput=this.container.querySelector('input[data-field="day"]'),this.yearInput=this.container.querySelector('input[data-field="year"]'),this.errorContainer=this.container.querySelector("div.error-container"),this.setupEventListeners(),this.populateInitialValue()}populateInitialValue(){if(this.params.value){const t=this.params.value.split("-");3===t.length&&(this.yearInput.value=t[0],this.monthInput.value=t[1],this.dayInput.value=t[2])}}setupEventListeners(){this.monthInput.addEventListener("input",t=>{this.formatMonth(t),this.handleNavigation(t,this.dayInput),this.handleChange()}),this.dayInput.addEventListener("input",t=>{this.formatDay(t),this.handleNavigation(t,this.yearInput),this.handleChange()}),this.yearInput.addEventListener("input",t=>{this.formatYear(t),this.handleChange()}),this.monthInput.addEventListener("blur",()=>{this.padMonthOnBlur(),this.validateInput()}),this.dayInput.addEventListener("blur",()=>{this.padDayOnBlur(),this.validateInput()}),this.yearInput.addEventListener("blur",()=>{this.validateInput()});const t=[this.monthInput,this.dayInput,this.yearInput];for(const n of t)n.addEventListener("focus",()=>this.clearErrors());this.dayInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.dayInput.value&&0===this.dayInput.selectionStart&&(this.monthInput.focus(),this.monthInput.setSelectionRange(this.monthInput.value.length,this.monthInput.value.length))}),this.yearInput.addEventListener("keydown",t=>{"Backspace"===t.key&&""===this.yearInput.value&&0===this.yearInput.selectionStart&&(this.dayInput.focus(),this.dayInput.setSelectionRange(this.dayInput.value.length,this.dayInput.value.length))})}formatMonth(t){const n=t.target;let o=n.value.replace(/\D/g,"");if(o.length>2&&(o=o.substring(0,2)),1===o.length){const t=Number.parseInt(o,10);t>=2&&t<=9&&(o="0"+o)}else if(2===o.length){const t=Number.parseInt(o,10);t>12?o="12":t<1&&"00"!==o&&(o="01")}n.value=o}formatDay(t){const n=t.target;let o=n.value.replace(/\D/g,"");if(o.length>2&&(o=o.substring(0,2)),1===o.length){const t=Number.parseInt(o,10);t>=4&&t<=9&&(o="0"+o)}else if(2===o.length){const t=Number.parseInt(o,10);t>31?o="31":t<1&&"00"!==o&&(o="01")}n.value=o}formatYear(t){const n=t.target;let o=n.value.replace(/\D/g,"");o.length>4&&(o=o.substring(0,4)),n.value=o}padMonthOnBlur(){const t=this.monthInput.value;if(1===t.length){const n=Number.parseInt(t,10);if(n>=0&&n<=9&&(this.monthInput.value="0"+t,this.params.onChange)){const t=this.getFormattedValue();this.params.onChange(t)}}}padDayOnBlur(){const t=this.dayInput.value;if(1===t.length){const n=Number.parseInt(t,10);if(n>=0&&n<=9&&(this.dayInput.value="0"+t,this.params.onChange)){const t=this.getFormattedValue();this.params.onChange(t)}}}handleNavigation(t,n){const o=t.target,s=o===this.yearInput?4:2;o.value.length===s&&n&&n.focus()}handleChange(){if(this.clearErrors(),this.scheduleValidation(),this.params.onChange){const t=this.getFormattedValue();this.params.onChange(t)}}isFieldsComplete(){const t=this.monthInput.value,n=this.dayInput.value,o=this.yearInput.value;return 2===t.length&&2===n.length&&4===o.length}scheduleValidation(){if(null!==this.validationTimeout&&clearTimeout(this.validationTimeout),this.isFieldsComplete())return this.validateInput(),void 0;this.validationTimeout=setTimeout(()=>{this.validateInput(),this.validationTimeout=null},500)}getFormattedValue(){const t=this.monthInput.value.padStart(2,"0"),n=this.dayInput.value.padStart(2,"0"),o=this.yearInput.value;return t&&n&&o&&4===o.length?o+"-"+t+"-"+n:""}validateDate(t,n,o){if(!t||!n||!o||4!==o.length)return![];const s=Number.parseInt(t,10),c=Number.parseInt(n,10),l=Number.parseInt(o,10);if(s<1||s>12||c<1||c>31||l<1e3)return![];const d=new Date(l,s-1,c);return d.getFullYear()===l&&d.getMonth()===s-1&&d.getDate()===c}calculateAge(t){const n=new Date;let o=n.getFullYear()-t.getFullYear();const s=n.getMonth()-t.getMonth();return(s<0||0===s&&n.getDate()<t.getDate())&&o--,o}validateInput(){const t=this.monthInput.value,n=this.dayInput.value,o=this.yearInput.value,s=[],c=this.params.validation;if(!c)return this.showErrors([]),!![];const l=2===t.length&&2===n.length&&4===o.length,d=t||n||o;if(c.required&&!d)s.push("Please enter a complete date (MM/DD/YYYY)");else if(d&&!l)s.push("Please enter a complete date (MM/DD/YYYY)");else if(l)if(this.validateDate(t,n,o)){const l=Number.parseInt(t,10),d=Number.parseInt(n,10),u=Number.parseInt(o,10),h=new Date(u,l-1,d);if(void 0!==c.minYear&&u<c.minYear&&s.push("Year must be "+c.minYear+" or later"),void 0!==c.maxYear&&u>c.maxYear&&s.push("Year must be "+c.maxYear+" or earlier"),void 0!==c.minAge||void 0!==c.maxAge){const t=this.calculateAge(h);void 0!==c.minAge&&t<c.minAge&&s.push("Must be at least "+c.minAge+" years old"),void 0!==c.maxAge&&t>c.maxAge&&s.push("Must be no more than "+c.maxAge+" years old")}if(c.customValidator){const t=c.customValidator(this.getFormattedValue());t&&s.push(t)}}else s.push("Please enter a valid date");this.showErrors(s);const u=0===s.length;return this.params.onValidation&&this.params.onValidation(u,s),u}showErrors(t){this.errorContainer.innerHTML="";const n=[this.monthInput,this.dayInput,this.yearInput];if(t.length>0){this.errorContainer.classList.add("show");for(const t of n)t.classList.add("input-error");for(const n of t){const t=document.createElement("div");t.className="error-message",t.textContent=n,this.errorContainer.appendChild(t)}}else for(const o of n)o.classList.remove("input-error")}clearErrors(){const t=[this.monthInput,this.dayInput,this.yearInput],n=t.some(t=>t.classList.contains("input-error"));if(n){for(const n of t)n.classList.remove("input-error");this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show")}}getValue(){return this.getFormattedValue()}setValue(t){if(t){const n=t.split("/");3===n.length&&(this.monthInput.value=n[0],this.dayInput.value=n[1],this.yearInput.value=n[2])}else this.monthInput.value="",this.dayInput.value="",this.yearInput.value=""}validate(){return this.validateInput()}focus(){this.monthInput.focus()}disable(){this.monthInput.disabled=!![],this.dayInput.disabled=!![],this.yearInput.disabled=!![]}enable(){this.monthInput.disabled=![],this.dayInput.disabled=![],this.yearInput.disabled=![]}clear(){this.setValue(""),this.clearErrors()}template(){var t;const n=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name+"-month"),n.push(o)}const o=document.createElement("div");o.className="date-input-container";const s=document.createElement("input");s.type="text",s.placeholder="MM",s.name=this.params.name+"-month",s.id=this.params.name+"-month",s.maxLength=2,s.className="date-field month-field",s.setAttribute("data-field","month"),s.inputMode="numeric";const c=document.createElement("span");c.className="date-separator",c.textContent="/";const l=document.createElement("input");l.type="text",l.placeholder="DD",l.name=this.params.name+"-day",l.id=this.params.name+"-day",l.maxLength=2,l.className="date-field day-field",l.setAttribute("data-field","day"),l.inputMode="numeric";const d=document.createElement("span");d.className="date-separator",d.textContent="/";const u=document.createElement("input");u.type="text",u.placeholder="YYYY",u.name=this.params.name+"-year",u.id=this.params.name+"-year",u.maxLength=4,u.className="date-field year-field",u.setAttribute("data-field","year"),u.inputMode="numeric",this.params.disabled&&(s.disabled=!![],l.disabled=!![],u.disabled=!![]),this.params.className&&(o.className+=" "+this.params.className),o.appendChild(s),o.appendChild(c),o.appendChild(l),o.appendChild(d),o.appendChild(u);const h=document.createElement("div");return h.className="error-container",n.push(o),n.push(h),n}}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 n=t.target,o=n.selectionStart||0,s=n.value;o>0&&/\D/.test(s[o-1])&&setTimeout(()=>{const t=Math.max(0,o-2);n.setSelectionRange(t,t)},0)}}formatPhoneNumber(t){const n=t.target;let o=n.value.replace(/\D/g,"");o.length>10&&(o=o.substring(0,10)),o.length>=6?o="("+o.substring(0,3)+") "+o.substring(3,6)+"-"+o.substring(6):o.length>=3&&(o="("+o.substring(0,3)+") "+o.substring(3)),n.value=o}formatDate(t){const n=t.target;let o=n.value.replace(/\D/g,"");o.length>8&&(o=o.substring(0,8)),o.length>=5?o=o.substring(0,2)+"/"+o.substring(2,4)+"/"+o.substring(4):o.length>=3&&(o=o.substring(0,2)+"/"+o.substring(2)),n.value=o}validateEmail(t){const n=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;return n.test(t)}validateTel(t){const n=/^\(\d{3}\) \d{3}-\d{4}$/;return n.test(t)}validateDate(t){const n=/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/;if(!n.test(t))return![];const[o,s,c]=t.split("/").map(Number),l=new Date(c,o-1,s);return l.getFullYear()===c&&l.getMonth()===o-1&&l.getDate()===s}isFieldComplete(){var t,n,o;const s=this.inputElement.value.trim();if(!s)return![];switch(this.params.inputType){case"tel":return this.validateTel(s);case"date":return this.validateDate(s);case"email":return s.includes("@")&&(null===(t=s.split("@")[1])||void 0===t?void 0:t.includes("."));case"number":return!Number.isNaN(Number.parseFloat(s));default:return(null===(n=this.params.validation)||void 0===n?void 0:n.max)&&s.length>=this.params.validation.max||(null===(o=this.params.validation)||void 0===o?void 0:o.min)&&s.length>=this.params.validation.min?!![]:s.length>=3}}validateInput(){const t=this.inputElement.value,n=[],o=this.params.validation;if(!o)return this.showErrors([]),!![];if(o.required&&!t.trim()&&n.push("This field is required"),!o.required&&!t.trim())return this.showErrors([]),!![];if(t.trim()){if("email"!==this.params.inputType||this.validateEmail(t)||n.push("Please enter a valid email address"),"tel"!==this.params.inputType||this.validateTel(t)||n.push("Please enter a valid phone number ((XXX) XXX-XXXX)"),"date"!==this.params.inputType||this.validateDate(t)||n.push("Please enter a valid date (MM/DD/YYYY)"),"number"===this.params.inputType){const s=Number.parseFloat(t);Number.isNaN(s)?t.trim()&&n.push("Please enter a valid number"):(void 0!==o.min&&s<o.min&&n.push("Value must be at least "+o.min),void 0!==o.max&&s>o.max&&n.push("Value must be no more than "+o.max))}if("text"!==this.params.inputType&&"email"!==this.params.inputType||(void 0!==o.min&&t.length<o.min&&n.push("Must be at least "+o.min+" characters"),void 0!==o.max&&t.length>o.max&&n.push("Must be no more than "+o.max+" characters")),o.pattern){const s=new RegExp(o.pattern);s.test(t)||n.push("Invalid format")}if(o.customValidator){const s=o.customValidator(t);s&&n.push(s)}}this.showErrors(n);const s=0===n.length;return this.params.onValidation&&this.params.onValidation(s,n),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(t){if(this.errorContainer.innerHTML="",t.length>0){this.errorContainer.classList.add("show"),this.inputElement.classList.add("input-error");for(const n of t){const t=document.createElement("div");t.className="error-message",t.textContent=n,this.errorContainer.appendChild(t)}}else this.inputElement.classList.remove("input-error")}clearErrors(){this.inputElement.classList.contains("input-error")&&(this.inputElement.classList.remove("input-error"),this.errorContainer.innerHTML="",this.errorContainer.classList.remove("show"))}getValue(){return this.inputElement.value}setValue(t){this.inputElement.value=t,"tel"===this.params.inputType&&this.formatPhoneNumber({target:this.inputElement}),"date"===this.params.inputType&&this.formatDate({target:this.inputElement})}validate(){return this.validateInput()}focus(){this.inputElement.focus()}disable(){this.inputElement.disabled=!![]}enable(){this.inputElement.disabled=![]}template(){var t;const n=[];if(this.params.label){const o=document.createElement("label");o.textContent=this.params.label,(null===(t=this.params.validation)||void 0===t?void 0:t.required)&&(o.textContent+="*"),o.setAttribute("for",this.params.name),n.push(o)}return this.inputElement=document.createElement("input"),this.inputElement.type=this.params.inputType,this.inputElement.placeholder=this.params.placeholder||"",this.inputElement.name=this.params.name,this.inputElement.id=this.params.name,this.params.autocomplete&&(this.inputElement.autocomplete=this.params.autocomplete?"on":"off"),this.params.className&&(this.inputElement.className=this.params.className),this.params.hostClassName&&this.addHostClasses(this.params.hostClassName),this.params.disabled&&(this.inputElement.disabled=!![]),this.params.value&&(this.inputElement.value=this.params.value),this.params.validation&&(this.params.validation.required&&(this.inputElement.required=!![]),void 0!==this.params.validation.min&&(this.inputElement.min=this.params.validation.min.toString()),void 0!==this.params.validation.max&&(this.inputElement.max=this.params.validation.max.toString()),this.params.validation.pattern&&(this.inputElement.pattern=this.params.validation.pattern)),"tel"===this.params.inputType&&(this.inputElement.addEventListener("keydown",this.handlePhoneKeydown.bind(this)),this.inputElement.addEventListener("input",this.formatPhoneNumber.bind(this))),"date"===this.params.inputType&&this.inputElement.addEventListener("input",this.formatDate.bind(this)),this.inputElement.addEventListener("focusout",this.validateInput.bind(this)),this.inputElement.addEventListener("input",t=>{this.clearErrors(),this.scheduleValidation(),this.params.onChange&&this.params.onChange(t.target.value)}),this.errorContainer=document.createElement("div"),this.errorContainer.className="error-container",n.push(this.inputElement),n.push(this.errorContainer),n}}class LceElementComponent extends HTMLElement{constructor(){super(),this.F=![],this.j=null;const t=ClientConfigService.getInstance();this.U=this.attachShadow({mode:t.isProduction()?"closed":"open"})}initialize(t,n){if(this.F)return;if(!t||"string"!=typeof t)throw new SDKError("LceElementComponent: contentType must be a non-empty string");if(!(n&&n instanceof HTMLElement))throw new SDKError("LceElementComponent: contentElement must be a valid HTMLElement");if(this.setAttribute(t.toLowerCase(),""),!this.U)throw new SDKError("LceElementComponent: Shadow DOM container is not available");n&&"function"==typeof n.rerender&&(this.j=t=>{n.rerender(t||"LceElementRerender")}),this.U.appendChild(n),this.applyBasicStyles();const o=ThemeProviderService.getInstance(),s=o.getStylesheet(t);this.applyThemeStyles(s),this.F=!![],this.U=null}rerender(t){this.j&&this.j(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 n=new CSSStyleSheet;n.replaceSync(t),this.U.adoptedStyleSheets=[n,...this.U.adoptedStyleSheets]}else this.createFallbackStylesheet(t)}catch(Z){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.U.adoptedStyleSheets=[...this.U.adoptedStyleSheets,t]})}createFallbackStylesheet(t){const n=document.createElement("style");n.textContent=t,this.U&&this.U.appendChild(n)}}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 n=document.createElement("span");n.className="pb-text",n.textContent="Powered by",t.appendChild(n);const o=document.createElement("span");o.className="pb-lc",o.textContent="LiquidCommerce",t.appendChild(o);const s=document.createElement("span");return s.className="pb-dot",s.textContent=".",t.appendChild(s),t}createDisclaimerSection(){const t=document.createElement("div");t.className="pb-disclaimer-container";const n=this.getDisclaimerConfig();return n.parts.forEach(n=>{"text"===n.type?t.appendChild(document.createTextNode(n.content)):"link"===n.type&&t.appendChild(this.createLink(n.href,n.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,n){const o=document.createElement("a");return o.href=t,o.target="_blank",o.rel="noopener noreferrer",o.className="pb-link",o.textContent=n,o.setAttribute("role","link"),o.setAttribute("aria-label","Read "+n),o}template(){const t=this.createPoweredBySection(),n=this.createDisclaimerSection();return[t,n]}}class PromoCodeTickerComponent extends BaseComponent{constructor(){super(...arguments),this.applyButton=null,this.promoCodeApplied=![],this.currentActiveTicker=null}get hostClasses(){return["promo-ticker",this.params.context]}beforeSetupStoreWatchers(){this.reactiveOptions.watchOnlyStorePaths=["cart.promoCode","checkout.promoCode"]}onStoreWatch(t){const n=t.find(t=>"cart.promoCode"===t.path||"checkout.promoCode"===t.path);if(!n||!this.applyButton||!this.currentActiveTicker)return;const o=this.isPromoCodeApplied(this.currentActiveTicker.promoCode);o&&!this.promoCodeApplied?(this.applyButton.disabled=!![],this.applyButton.textContent="APPLIED",this.promoCodeApplied=!![]):!o&&this.promoCodeApplied&&(this.applyButton.disabled=![],this.applyButton.textContent="APPLY",this.promoCodeApplied=![])}isPromoCodeApplied(t){const n=this.store.get("cart.promoCode"),o=this.store.get("checkout.promoCode");return(null==n?void 0:n.code)===t||(null==o?void 0:o.code)===t}getActiveTickers(){var t;const n=this.store.get("address");return null===(t=this.params.tickers)||void 0===t?void 0:t.filter(t=>{var o;return isDateTimeInRange({startDate:t.activeFrom,endDate:t.activeUntil,addressState:null===(o=null==n?void 0:n.address)||void 0===o?void 0:o.state})})}selectCurrentTicker(t){return 0===t.length?null:t[0]}generateTextContent(t){const n=document.createElement("div");n.classList.add("promo-ticker__text-group");const o=t.text.map(t=>t.trim()).map(t=>t.substring(0,50)).filter(t=>""!==t.trim()).slice(0,5);for(const s of o){const o=s.trim();if(!o)continue;const c=document.createElement("span");c.classList.add("promo-ticker__text-item"),c.textContent=o,n.appendChild(c);const l=document.createElement("span");l.classList.add("promo-ticker__separator"),l.textContent=t.separator,n.appendChild(l)}return n}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 n=document.createElement("div");n.classList.add("promo-ticker__content");const o=document.createElement("div");o.classList.add("promo-ticker__track");for(let c=0;c<5;c++)o.appendChild(this.generateTextContent(this.currentActiveTicker));n.appendChild(o);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",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),this.handlePromoClick())}),this.applyButton=s,[n,s]}}const Ct=LoggerFactory.get("ElementsClientHelper"),isObject=t=>null!==t&&"object"==typeof t&&!Array.isArray(t),getType=t=>null===t?"null":Array.isArray(t)?"array":typeof t;function deepMergeConfigs(t,n){if(!t||!n)return t;const o={...t},s=[];for(const c in n){const l=n[c],d=o[c];if(!(c in t)){s.push('Property "'+c+'" does not exist in target schema, skipping merge.');continue}const u=getType(l),h=getType(d);u===h?isObject(l)&&isObject(d)?o[c]=deepMergeConfigs(d,l):o[c]=l:s.push('Type mismatch for key "'+c+'": source is '+u+", target is "+h+". Skipping merge.")}return s.length>0&&Ct.warn("Merging configurations with warnings:",s),o}const kt=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.BIRTHDATE_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(t,n){const o=new Set;for(const s of Object.keys(n)){const n=kt.get(t+"."+s);if(n)for(const t of n)o.add(t)}return Array.from(o)}class ElementsBaseClient{constructor(t){this.clientPrepared=![],this.componentFactoryInitialized=![],this.cartDrawerCreated=![],this.gtmInitialized=![],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.authService=AuthService.getInstance({apiKey:t.apiKey,env:t.env,baseUrl:t.baseUrl})}async prepare(){try{if(this.clientPrepared)return;await this.prepareEssentialServices(),this.deferHeavyInitialization(),this.clientPrepared=!![],this.clientConfig.set("clientPrepared",!![])}catch(t){throw this.logger.error("Failed to prepare client",t),this.clientPrepared=![],this.clientConfig.set("clientPrepared",![]),t}}async prepareEssentialServices(){this.clientConfig.set("version",Z.version),this.clientConfig.isProduction()?LoggerFactory.setEnableLogging(![]):this.clientConfig.isDebuggingEnabled()&&(LoggerFactory.setEnableLogging(!![]),this.logger.info("🐞 Debugging mode is enabled"),this.clientConfig.isDebugPanelEnabled()&&(this.debugPanel.initialize(),this.logger.info("🔧 Debug panel initialized"))),this.telemetry.isEnabled()&&(LoggerFactory.setTelemetryService(this.telemetry),this.logger.info("📊 Telemetry initialized")),this.logger.info("🔐 Starting authentication...");const t=await this.authService.authenticate();if(!t)throw this.clientPrepared=![],new SDKError("Unable to authenticate with the provided API key.",!![]);this.logger.info("✅ Authentication completed"),this.logger.info("🌐 Setting up API client..."),await this.apiClient.setClient(this.authService),this.logger.info("✅ API client setup completed"),this.logger.info("⚙️ Loading configurations...");let n=await this.apiClient.getAllConfigs();this.logger.info("✅ Configurations loaded"),this.clientConfig.set("partnerCode",n.configurations.partnerCode),this.clientConfig.set("partnerName",n.configurations.partnerName),this.logger.info("🔍 Setting up fingerprinting and store...");const o=await this.fingerPrintService.getId(n.configurations.partnerCode),s=this.fingerPrintService.isLocalStorageWebApiAvailable();this.clientConfig.set("userDeviceId",o),this.clientConfig.set("isLocalStorageAvailable",s);const c=s?null:await this.apiClient.getPersistedStore(o);if(await this.store.initialize({userDeviceId:o,isLocalStorageAvailable:s,persistedStore:c}),this.logger.info("✅ Store setup completed"),this.logger.info("🎨 Initializing theme provider..."),this.clientConfig.hasCustomTheme()){const t=this.clientConfig.get("customTheme"),o=n.global.layout.showPoweredBy;n=deepMergeConfigs(n,t),n.global.layout.showPoweredBy=o}await this.themeProvider.initialize(n),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");if(!this.gtmInitialized)try{await this.googleTagManager.initialize({partnerName:t.partnerName,partnerGtmId:t.googleTagManagerId,partnerEnableGaTracking:t.enablePartnerGaTracking,liquidCommerceEnableGaTracking:t.enableLiquidCommerceGaTracking,liquidCommerceGtmId:t.liquidCommerceGoogleTagManagerId}),this.gtmInitialized=!![]}catch(n){this.logger.error("GTM initialization failed",n)}this.isElementsEnabled()&&await this.commands.common.loadCart(),this.ensureCartDrawerExists(),this.ensureAllComponentsRegistered()}get actions(){return this.clientAction.actions}async processInjectElement(t){if(this.ensureAllComponentsRegistered(),!t||"object"!=typeof t)throw new SDKError("Invalid parameters provided. Expected an object, received: "+typeof t,!![]);const{type:n,containerId:o,...c}=t;if(!o||"string"!=typeof o)throw new SDKError("Container ID is required and must be a string. Received: "+("string"==typeof o?'"'+o+'"':o),!![]);if(!n)throw new SDKError("Component type is required (e.g., product, cart, checkout).",!![]);const l=o.replace("#",""),d=document.getElementById(l);if(!d)return console.warn("Container with ID '"+l+"' not found"),null;d.innerHTML="";const u={type:t.type,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],...c},h=ComponentFactoryService.createElement(u);return safeReplaceChildren(d,h),t.type===s.CHECKOUT&&await this.commands.checkout.loadCheckout(),this.createInjectedComponentWrapper(l,t.type,h)}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 n=t.slice(0,20),o=[],c=[];for(const s of n){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 t=s.containerId.replace("#","").trim();if(!t){this.logger.warn("Container ID is required for product with ID '"+s.identifier+"'");continue}const n=document.getElementById(t);if(!n){this.logger.warn("Container with ID '"+t+"' not found for product '"+s.identifier+"'");continue}const c=o.every(n=>n.containerId!==t);if(!c){this.logger.warn("Duplicate container ID '"+t+"' 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 '"+t+"'");continue}const l=o.every(t=>t.identifier!==s.identifier);l?o.push({containerId:t,identifier:s.identifier}):this.logger.warn("Duplicate product identifier '"+s.identifier+"' found, skipping")}for(const l of o){const t=ComponentFactoryService.createElement({type:s.PRODUCT,useShadowDom:!![],productId:l.identifier,isIndependentComponent:!![],wrapInLceElement:!![]}),n=document.getElementById(l.containerId);n?(n.innerHTML="",n.appendChild(t),c.push(this.createInjectedComponentWrapper(l.containerId,s.PRODUCT,t)),await this.commands.product.createProductInstance(l.identifier,!![])):this.logger.warn("Product ("+l.identifier+") container with ID '"+l.containerId+"' not found")}return await this.commands.product.loadMultipleProducts(o.map(t=>t.identifier)),c}async injectProductList(t){if(!this.isElementsEnabled())return this.injectDisabledElementsError(t.containerId,s.CHECKOUT),void 0;if(!t)throw new SDKError("Product list requires a container ID parameter.",!![]);if(!t.containerId||"string"!=typeof t.containerId)throw new SDKError("Product list container ID is required and must be a string. Received: "+("string"==typeof t.containerId?'"'+t.containerId+'"':t.containerId),!![]);if(t.rows&&("number"!=typeof t.rows||t.rows<1||t.rows>10))throw new SDKError("Rows must be a number between 1 and 10. Received: "+t.rows,!![]);if(t.columns&&("number"!=typeof t.columns||t.columns<1||t.columns>4))throw new SDKError("Columns must be a number between 1 and 4. Received: "+t.columns,!![]);if(t.cardVariant&&!Object.values(u).includes(t.cardVariant))throw new SDKError('Invalid card variant "'+t.cardVariant+'". Valid options: '+Object.values(u).join(", "),!![]);if(t.filters&&!Array.isArray(t.filters))throw new SDKError("Filters must be an array. Received: "+typeof t.filters,!![]);if(t.filters&&t.filters.length>0){const n=Object.values(h);for(const o of t.filters)if(!n.includes(o))throw new SDKError('Invalid filter "'+o+'". Valid options: '+n.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 n=document.getElementById(t.containerId.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t.containerId+'". Make sure the element exists before adding the product list.',!![]);const o=ComponentFactoryService.createElement({type:s.PRODUCT_LIST,wrapInLceElement:!![],cardVariant:t.cardVariant||u.STANDARD,fillCard:t.fillCard||![],rows:t.rows||4,columns:t.columns||4,filters:t.filters||[],productUrl:t.productUrl});safeReplaceChildren(n,o)}ensureCartDrawerExists(){if(!this.cartDrawerCreated)try{const t=ComponentFactoryService.createElement({type:s.DRAWER,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![]});document.body.appendChild(t),this.cartDrawerCreated=!![]}catch(t){this.logger.warn("Failed to create cart drawer:",t)}}ensureAllComponentsRegistered(){this.componentFactoryInitialized||(this.registerComponents(),this.componentFactoryInitialized=!![])}createInjectedComponentWrapper(t,n,o){const s={getType:()=>n,getElement:()=>document.getElementById(t),rerender:()=>{try{o&&"function"==typeof o.rerender?o.rerender("InjectedComponentRerender"):this.logger.warn("Component in container '"+t+"' does not support rerender")}catch(n){this.logger.warn("Failed to rerender component in container '"+t+"'")}}};return this.injectedComponents.set(t,s),s}rerenderInjectedComponentsByType(t){for(const[n,o]of this.injectedComponents)o.getType()===t&&o.rerender()}isElementsEnabled(){var t;try{const n=this.themeProvider.getConfigs("configurations");return null!==(t=null==n?void 0:n.isElementsEnabled)&&void 0!==t?t:![]}catch(n){return this.logger.warn("Could not check elements enabled status, defaulting to not enabled",n),!![]}}injectDisabledElementsError(t,n){const o=document.getElementById(t.replace("#",""));if(!o)return this.logger.warn("Container with ID '"+t+"' 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:n}):componentError({message:"Elements is not enabled.",componentType:n}),o.innerHTML="",safeReplaceChildren(o,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)}registerComponents(){this.componentFactoryInitialized||this.registerAllComponents()}registerAllComponents(){ComponentFactoryService.registerComponent(s.DRAWER,DrawerComponent),ComponentFactoryService.registerComponent(s.INPUT,InputComponent),ComponentFactoryService.registerComponent(s.BIRTHDATE_INPUT,BirthdateInputComponent),ComponentFactoryService.registerComponent(s.ENGRAVING_FORM,EngravingFormComponent),ComponentFactoryService.registerComponent(s.ENGRAVING_VIEW,EngravingViewComponent),ComponentFactoryService.registerComponent(s.BUTTONS_CART_OPEN,ButtonsOpenCartComponent),ComponentFactoryService.registerComponent(s.POWERED_BY,PoweredByComponent),ComponentFactoryService.registerComponent(s.LCE_ELEMENT,LceElementComponent),ComponentFactoryService.registerComponent(s.PURCHASE_MIN_ALERT,PurchaseMinAlertComponent),ComponentFactoryService.registerComponent(s.ALERT,AlertComponent),ComponentFactoryService.registerComponent(s.PROMO_CODE_TICKER,PromoCodeTickerComponent),ComponentFactoryService.registerComponent(s.ADDRESS,AddressComponent),ComponentFactoryService.registerComponent(s.ADDRESS_INPUT,AddressInputComponent),ComponentFactoryService.registerComponent(s.ADDRESS_DISPLAY,AddressDisplayComponent),ComponentFactoryService.registerComponent(s.PRODUCT,ProductComponent),ComponentFactoryService.registerComponent(s.PRODUCT_IMAGE_CAROUSEL,ProductImageCarouselComponent),ComponentFactoryService.registerComponent(s.PRODUCT_OPTIONS,ProductOptionsComponent),ComponentFactoryService.registerComponent(s.PRODUCT_DESCRIPTION,ProductDescriptionComponent),ComponentFactoryService.registerComponent(s.PRODUCT_INTERACTIONS,ProductInteractionsComponent),ComponentFactoryService.registerComponent(s.PRODUCT_ADD_TO_CART_SECTION,ProductAddToCartSectionComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS,ProductRetailersComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS_CAROUSEL,ProductRetailersCarouselComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS_POPUP,ProductRetailersPopupComponent),ComponentFactoryService.registerComponent(s.PRODUCT_RETAILERS_POPUP_LIST,ProductRetailersPopupListComponent),ComponentFactoryService.registerComponent(s.PRODUCT_PRICE,ProductPriceComponent),ComponentFactoryService.registerComponent(s.PRODUCT_DRAWER,ProductDrawerComponent),ComponentFactoryService.registerComponent(s.PRODUCT_LOADING,ProductLoadingComponent),ComponentFactoryService.registerComponent(s.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.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:(t,n)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart button requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);this.ensureCartDrawerExists();const o=document.getElementById(t.replace("#",""));if(!o)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before adding the cart button.',!![]);const c=ComponentFactoryService.createElement({type:s.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],showItemsCount:n});o.innerHTML="",safeReplaceChildren(o,c)},floatingCartButton:t=>{this.ensureCartDrawerExists();const n=ComponentFactoryService.createElement({type:s.BUTTONS_CART_OPEN,useShadowDom:!![],isIndependentComponent:!![],wrapInLceElement:!![],classes:["independent"],showItemsCount:t});document.body.appendChild(n)},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 n=document.getElementById(t.replace("#",""));if(!n)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart subtotal.',!![]);n.innerHTML="",n.classList.add("lce-cart-subtotal");const Y=t=>{n.textContent=formatCentToDollarText(t)},o=this.store.get("cart.totals.subtotal")||0;Y(o),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.subtotal")||0;Y(t)})},cartItemsCount:(t,n)=>{if(!t||"string"!=typeof t)throw new SDKError("Cart items count display requires a valid element ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);let o=!![];n&&"boolean"==typeof n.hideZero&&(o=n.hideZero);const s=document.getElementById(t.replace("#",""));if(!s)throw new SDKError('Cannot find element with ID "'+t+'". Make sure the element exists before displaying cart items count.',!![]);s.innerHTML="",s.classList.add("lce-cart-items-count");const a=t=>{s.textContent=t.toString(),0===t?(o&&(s.style.visibility="hidden"),s.classList.add("no-items")):(o&&(s.style.visibility="visible"),s.classList.remove("no-items"))},c=this.store.get("cart.totals.quantity")||0;a(c),this.store.watch("cart.totals",()=>{const t=this.store.get("cart.totals.quantity")||0;a(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 n of t)this.injectDisabledElementsError(n.containerId,s.PRODUCT);return[]}return await this.processInjectProduct(t)}async injectAddressElement(t,n){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:s.ADDRESS,containerId:t,options:n}):(this.injectDisabledElementsError(t,s.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:s.CART,containerId:t}):(this.injectDisabledElementsError(t,s.CART),null)}async injectCheckoutElement(t){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);return this.isElementsEnabled()?await this.processInjectElement({type:s.CHECKOUT,containerId:t}):(this.injectDisabledElementsError(t,s.CHECKOUT),null)}getInjectedComponents(){return this.injectedComponents}}async function Elements(t,o){try{SingletonManager.setContext({isBuilder:![]});const s=ClientConfigService.getInstance();s.initialize(t,{env:o.env,isBuilder:![],debugMode:o.debugMode,customTheme:o.customTheme,proxy:o.proxy,promoTicker:o.promoTicker,paymentMethodId:o.paymentMethodId});const c=s.getConfigs();SingletonManager.setClientConstructor(ElementsClient);const l=await SingletonManager.getClient(c);if(!l.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const d={injectProductElement:l.injectProductElement.bind(l),injectAddressElement:l.injectAddressElement.bind(l),injectCartElement:l.injectCartElement.bind(l),injectCheckoutElement:l.injectCheckoutElement.bind(l),injectProductList:l.injectProductList.bind(l),ui:l.ui,actions:l.actions,getInjectedComponents:l.getInjectedComponents.bind(l)};window.elements=d;const u=PubSubService.getInstance();return u.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Client Is Ready",timestamp:Date.now(),version:s.get("version")}),d}catch(s){try{const t=LoggerFactory.get("ElementsClientInit");t.error("Elements Client Initialization failed",s)}catch(c){console.error("[LiquidCommerce Elements] Client initialization failed:",null==s?void 0:s.message)}try{const t=ClientConfigService.getInstance(),o=PubSubService.getInstance();o.publishAction(n.CLIENT_READY,{isReady:![],message:"Initialization failed: "+(null==s?void 0:s.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(l){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}const St={CORE:{MAIN_SCRIPT:"data-liquid-commerce-elements",TOKEN:"data-token",ENV:"data-env",DEBUG_MODE:"data-debug-mode",PAYMENT_METHOD_ID:"data-pm-id"},PROMO_TICKER:{CODE:"data-promo-code",TEXT:"data-promo-text",SEPARATOR:"data-promo-separator",ACTIVE_FROM:"data-promo-active-from",ACTIVE_UNTIL:"data-promo-active-until",CODE_PARAM:"data-promo-code-param"},PRODUCT:{PRODUCT:"data-product",CONTAINER:"data-container",PARAM:"data-product-param",FULFILLMENT_TYPE_PARAM:"data-product-fulfillment-type-param",LCE_PRODUCT:"data-lce-product"},PRODUCT_LIST:{LIST:"data-liquid-commerce-elements-products-list",SCRIPT:"data-liquid-commerce-elements-products",CARD:"data-card",CARD_FILL:"data-card-fill",ROWS:"data-rows",COLUMNS:"data-columns",FILTERS:"data-filters",PRODUCT_URL:"data-product-url"},CART:{BUTTON:"data-cart-button",BADGE_BUTTON:"data-cart-badge-button",MOBILE_BUTTON:"data-cart-mobile-button",MOBILE_BADGE_BUTTON:"data-cart-mobile-badge-button",BUTTON_HIDDEN:"data-cart-button-hidden",TOGGLE_BUTTON:"data-lce-cart-toggle-button",ITEMS_COUNT:"data-lce-cart-items-count"}};function startsWithLcePrefix(t){return null!==t&&"lce_"===t.substring(0,4)}function generateElementId({prefix:t,index:n}){const o=Math.random().toString(36).substring(2,7),s=void 0!==t?t:"",c=void 0!==n?n:"",l=s&&c?"-":"";return""+s+l+c+o}function pairsFromMainScript(t){const n=[];try{const s=t.getAttributeNames().filter(t=>t.substring(0,12)===St.PRODUCT.PRODUCT);for(const c of s)try{const o=c.match(/^data-product(-(.+))?$/),s=(null==o?void 0:o[2])?"-"+o[2]:"",l=""+St.PRODUCT.CONTAINER+s;if(t.hasAttribute(l)){const o=t.getAttribute(l),s=t.getAttribute(c);o&&s&&n.push({containerId:o,identifier:s})}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error processing product attribute:",o)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from main script:",s)}return n}function pairsFromProductsScript(){const t=[];try{const o=document.querySelectorAll("script["+St.PRODUCT_LIST.SCRIPT+"]");for(const s of o)try{const n=JSON.parse(s.textContent||"[]");if(!Array.isArray(n))continue;for(const o of n)o.containerId&&o.identifier&&t.push({containerId:o.containerId,identifier:o.identifier})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Invalid JSON in data-liquid-commerce-elements-products script",n)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from products script:",o)}return t}function pairsFromAttributedElements(){const t=[];try{const o=document.querySelectorAll("div["+St.PRODUCT.LCE_PRODUCT+"]");let s=0;for(const c of o)try{const n=generateElementId({prefix:"lce-p",index:s});c.setAttribute("id",n);const o=c.getAttribute(St.PRODUCT.LCE_PRODUCT);n&&o&&t.push({containerId:n,identifier:o}),s+=1}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Error processing attributed element:",n)}}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Error extracting products from attributed elements:",o)}return t}async function addProductToCartViaQueryParam(t,n){try{const s=n.getAttribute(St.PRODUCT.PARAM),l=n.getAttribute(St.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 d=new URLSearchParams(window.location.search),u=d.get(s);if(!u)return;let h=c.SHIPPING;if(l)if(startsWithLcePrefix(l)){const t=d.get(l);t!==c.ON_DEMAND&&t!==c.SHIPPING||(h=t)}else console.warn('[LiquidCommerce Elements Auto Initialization] Ignoring product fulfillment type query parameter "'+l+'" because it does not start with "lce_" prefix.');try{await t.actions.cart.addProduct([{identifier:u,fulfillmentType:h,quantity:1}],!![])}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Failed to add product from query parameter to cart:",o)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process product query parameter:",s)}}async function addPromoCodeToCartViaQueryParam(t,n){try{const s=n.getAttribute(St.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),l=c.get(s);if(!l)return;try{await t.actions.cart.applyPromoCode(l)}catch(o){console.error("[LiquidCommerce Elements Auto Initialization] Failed to apply promo code from query parameter to cart:",o)}}catch(s){console.error("[LiquidCommerce Elements Auto Initialization] Failed to process promo code query parameter:",s)}}async function setupCartButtonWithPosition(t,n,o,s){var c,l,d;try{const u=o.includes("mobile"),h=u?"mobile":"desktop",m=!u,f=n.getAttribute(o),g=n.getAttribute(s);if(!n.hasAttribute(o)&&!n.hasAttribute(s))return;if(m){if(n.hasAttribute(o)&&!f)return t.ui.floatingCartButton(![]),void 0;if(n.hasAttribute(s)&&!g)return t.ui.floatingCartButton(!![]),void 0}const v=f||g,y=!!g;if(!v)return m&&(console.warn("[LiquidCommerce Elements Auto Initialization] No cart button position specified. Using floating button."),t.ui.floatingCartButton(y)),void 0;const b=["above","below","replace","inside"],x=v.match(/^(\w+):(.+)$/),w=x&&b.includes(x[1])?x[1]:"inside";let E=x?x[2]:v;/^[#.]/.test(E)||/\s/.test(E)||(E="#"+E);const _=document.querySelector(E);if(!_)return m&&(console.warn('[LiquidCommerce Elements Auto Initialization] Cart target "'+E+'" not found. Using floating button.'),t.ui.floatingCartButton(y)),void 0;const T=document.createElement("div");switch(T.classList.add("lce-cart-"+h+"-button-container"),T.id=generateElementId({prefix:"lce-cart-"+h+"-btn"}),w){case"above":null===(c=_.parentNode)||void 0===c?void 0:c.insertBefore(T,_);break;case"below":null===(l=_.parentNode)||void 0===l?void 0:l.insertBefore(T,_.nextSibling);break;case"replace":null===(d=_.parentNode)||void 0===d?void 0:d.replaceChild(T,_);break;default:_.appendChild(T)}t.ui.cartButton(T.id,y)}catch(u){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup cart button:",u)}}async function setupCartButtons(t,n){n.hasAttribute(St.CART.BUTTON_HIDDEN)||(await setupCartButtonWithPosition(t,n,St.CART.BUTTON,St.CART.BADGE_BUTTON),await setupCartButtonWithPosition(t,n,St.CART.MOBILE_BUTTON,St.CART.MOBILE_BADGE_BUTTON))}async function initializeProductsList(t){try{const n=document.querySelector("div["+St.PRODUCT_LIST.LIST+"]");if(!n)return;const o="lce-products-list-container";n.className="lce-products-list-container",n.id=o;const s=n.getAttribute(St.PRODUCT_LIST.CARD)||"standard",c=n.hasAttribute(St.PRODUCT_LIST.CARD_FILL),l=Number.parseInt(n.getAttribute(St.PRODUCT_LIST.ROWS)||"3",10)||3,d=Number.parseInt(n.getAttribute(St.PRODUCT_LIST.COLUMNS)||"4",10)||4,u=n.getAttribute(St.PRODUCT_LIST.FILTERS),h=n.getAttribute(St.PRODUCT_LIST.PRODUCT_URL)||void 0;let m=[];u&&(m=u.split(",").map(t=>t.trim()).filter(t=>t.length>0)),await t.injectProductList({containerId:o,rows:l,columns:d,cardVariant:s,fillCard:c,filters:m,productUrl:h})}catch(n){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize products list:",n)}}function setupEventListeners(){try{window.addEventListener("lce:actions.client_ready",async t=>{const n=t.detail;if(!n.data.isReady)return;const o=window.elements,s=document.querySelectorAll("["+St.CART.TOGGLE_BUTTON+"]");if(s.length>0)for(const l of s)l.addEventListener("click",async t=>{t.stopPropagation(),t.preventDefault(),o.actions.cart.toggleCart()});const c=document.querySelectorAll("["+St.CART.ITEMS_COUNT+"]");if(c.length>0){let t=0;for(const n of c){const s=n.getAttribute(St.CART.ITEMS_COUNT),c=!(s&&"keep-zero"===s),l=Boolean(null==n?void 0:n.id);let d;l?d=n.id:(d=generateElementId({prefix:"lce-cart-items-count",index:t}),n.id=d),o.ui.cartItemsCount(d,{hideZero:c}),t+=1}}})}catch(Z){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup event listeners:",Z)}}async function ElementsAutoInitialize(){var n,o,s,c,d,u,h;try{const h=document.querySelector("script["+St.CORE.MAIN_SCRIPT+"]");if(!h)return;const m=h.getAttribute(St.CORE.TOKEN),f=h.getAttribute(St.CORE.ENV)||t.PRODUCTION,g=h.getAttribute(St.CORE.DEBUG_MODE),v=null!==(n=h.getAttribute(St.CORE.PAYMENT_METHOD_ID))&&void 0!==n?n:void 0;if(!m)throw new SDKError('Missing required data-token attribute on the script tag. Add data-token="your-api-key" to the Elements script tag.',!![]);const y=h.getAttribute(St.PROMO_TICKER.CODE),b=h.getAttribute(St.PROMO_TICKER.TEXT),x=null!==(o=h.getAttribute(St.PROMO_TICKER.SEPARATOR))&&void 0!==o?o:"•",w=null!==(s=h.getAttribute(St.PROMO_TICKER.ACTIVE_FROM))&&void 0!==s?s:void 0,E=null!==(c=h.getAttribute(St.PROMO_TICKER.ACTIVE_UNTIL))&&void 0!==c?c:void 0,_=pairsFromMainScript(h),T=pairsFromProductsScript(),D=pairsFromAttributedElements(),P=[..._,...T,...D],F=y&&b&&w&&E?{promoCode:y,text:b.split("|").map(t=>t.trim()).filter(t=>t.length>0),separator:x,activeFrom:null===(d=new Date(w))||void 0===d?void 0:d.toISOString(),activeUntil:null===(u=new Date(E))||void 0===u?void 0:u.toISOString()}:void 0;let A=l.NONE;g&&f!==t.PRODUCTION&&(A=g),setupEventListeners();const z=await Elements(m,{env:f,debugMode:A,promoTicker:F?[F]:void 0,paymentMethodId:v});if(!z)throw new SDKError("Elements client returned null. Check console for authentication or API errors.",!![]);setupCartButtons(z,h),0!==P.length&&z.injectProductElement(P).catch(t=>{console.error("[LiquidCommerce Elements Auto Initialization] Failed to inject product elements:",t)}),initializeProductsList(z),addProductToCartViaQueryParam(z,h),addPromoCodeToCartViaQueryParam(z,h)}catch(m){console.error("[LiquidCommerce Elements Auto Initialization]",null!==(h=null==m?void 0:m.message)&&void 0!==h?h:String(m))}}function triggerElementsAutoInit(){try{"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(Z){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",Z)}},50)}):setTimeout(async()=>{try{await ElementsAutoInitialize()}catch(Z){console.error("[LiquidCommerce Elements Auto Initialization] Failed to initialize:",Z)}},50)}catch(Z){console.error("[LiquidCommerce Elements Auto Initialization] Failed to setup initialization:",Z)}}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 n of getComponentTypesForLayoutFields("global.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Global theme configuration updated - changes applied to all components")}catch(n){throw this.logger.error("❌ Failed to update global theme configuration",n),new SDKError("Failed to update global configuration: "+n.message,!![])}}async updateProductComponent(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 n of getComponentTypesForLayoutFields("product.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Product component theme updated - changes applied to product elements")}catch(n){throw this.logger.error("❌ Failed to update product component theme",n),new SDKError("Failed to update product configuration: "+n.message,!![])}}updateCartComponent(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 n of getComponentTypesForLayoutFields("cart.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Cart component theme updated - changes applied to cart elements")}catch(n){throw this.logger.error("❌ Failed to update cart component theme",n),new SDKError("Failed to update cart configuration: "+n.message,!![])}}updateCheckoutComponent(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 n of getComponentTypesForLayoutFields("checkout.layout",t.layout))this.rerenderInjectedComponentsByType(n)}this.logger.info("✅ Checkout component theme updated - changes applied to checkout elements")}catch(n){throw this.logger.error("❌ Failed to update checkout component theme",n),new SDKError("Failed to update checkout configuration: "+n.message,!![])}}updateAddressComponent(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(n){throw this.logger.error("❌ Failed to update address component theme",n),new SDKError("Failed to update address configuration: "+n.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,n){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:s.ADDRESS,containerId:t,options:n})}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:s.CART,containerId:t})}async injectCheckoutElement(t,n){if(!t||"string"!=typeof t)throw new SDKError("Checkout element requires a valid container ID. Received: "+("string"==typeof t?'"'+t+'"':t),!![]);const o=await this.processInjectElement({type:s.CHECKOUT,containerId:t});if(null==n?void 0:n.simulatePresale){const t=n.presaleExpiresInMinutes||15,o=new Date;o.setMinutes(o.getMinutes()+t),this.store.set("checkout.presale",{isLocked:!![],expiresAt:o.toISOString()}),this.logger.info("✅ Builder presale simulation activated - expires in "+t+" minutes")}return o}}async function ElementsBuilder(t,o){try{SingletonManager.setContext({isBuilder:!![]});const s=ClientConfigService.getInstance();s.initialize(t,{env:o.env,isBuilder:!![],debugMode:o.debugMode,customTheme:o.customTheme,proxy:void 0,promoTicker:o.promoTicker,paymentMethodId:o.paymentMethodId});const c=s.getConfigs();SingletonManager.setClientConstructor(ElementsBuilderClient);const l=await SingletonManager.getClient(c);if(!l.clientPrepared)throw new SDKError("Failed to initialize. Check console for authentication or configuration errors.",!![]);const d={updateComponentGlobalConfigs:l.updateComponentGlobalConfigs.bind(l),updateProductComponent:l.updateProductComponent.bind(l),updateAddressComponent:l.updateAddressComponent.bind(l),updateCartComponent:l.updateCartComponent.bind(l),updateCheckoutComponent:l.updateCheckoutComponent.bind(l),injectElement:l.injectElement.bind(l),injectProductElement:l.injectProductElement.bind(l),injectAddressElement:l.injectAddressElement.bind(l),injectCartElement:l.injectCartElement.bind(l),injectCheckoutElement:l.injectCheckoutElement.bind(l),injectProductList:l.injectProductList.bind(l),actions:l.actions};window.elementsBuilder=d;const u=PubSubService.getInstance();return u.publishAction(n.CLIENT_READY,{isReady:!![],message:"Elements Builder Client Is Ready",timestamp:Date.now(),version:s.get("version")}),d}catch(s){try{const t=LoggerFactory.get("ElementsBuilderClientInit");t.error("Elements Builder Client Initialization failed",s)}catch(c){console.error("[LiquidCommerce Elements] Builder Client initialization failed:",null==s?void 0:s.message)}try{const t=ClientConfigService.getInstance(),o=PubSubService.getInstance();o.publishAction(n.CLIENT_READY,{isReady:![],message:"Builder initialization failed: "+(null==s?void 0:s.message),timestamp:Date.now(),version:t.get("version")||"unknown"})}catch(l){console.warn("[LiquidCommerce Elements] Could not fire error event - services unavailable")}return null}}if(void 0===window.customElements)console.error("[LiquidCommerce Elements] SDK requires support for Web Components. Please include a Web Components polyfill for older browsers.");else if(void 0===HTMLElement.prototype.attachShadow)console.error("[LiquidCommerce Elements] SDK requires support for Shadow DOM. Please include a Shadow DOM polyfill for older browsers.");else try{const t=window.onerror;window.onerror=(n,o,s,c,l)=>isSDKError(l,o)?(console.error("[LiquidCommerce Elements] Unhandled SDK error:",{message:n,source:o,lineno:s,colno:c,error:l}),!![]):t?t(n,o,s,c,l):![];const n=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;n&&n.call(window,t)};try{initializeDOMPolyfills()}catch(Et){console.error("[LiquidCommerce Elements] DOM polyfills initialization failed:",Et)}try{triggerElementsAutoInit()}catch(_t){console.error("[LiquidCommerce Elements] Auto-initialization failed:",_t)}}catch(Tt){console.error("[LiquidCommerce Elements] SDK initialization failed:",Tt)}initializeDOMPolyfills(),window.Elements=Elements,window.ElementsBuilder=ElementsBuilder,exports.Elements=Elements,exports.ElementsBuilder=ElementsBuilder,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});
|